Skip to content

Commit

Permalink
ALIROOT-5981 Fix or the pedestal run issue (Raphaelle)
Browse files Browse the repository at this point in the history
Fix for the not calibrated chamber status in case of low stats in one SM (Raphaelle)

Minor updates for chamber status (Raphaelle)

Security check for the t0 calibration (Raphaelle)

Minor update to check if the OCDB objects were indeed stored properly (Raphaelle)
  • Loading branch information
cblume authored and hristov committed May 13, 2015
1 parent abac9e4 commit 096baae
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 22 deletions.
6 changes: 4 additions & 2 deletions TRD/AliTRDCalibraFit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ AliTRDCalibraFit::AliTRDCalibraFit()
,fTakeTheMaxPH(kTRUE)
,fT0Shift0(0.124797)
,fT0Shift1(0.267451)
,fMaxValueT0(5.)
,fRangeFitPRF(1.0)
,fAccCDB(kFALSE)
,fMinEntries(800)
Expand Down Expand Up @@ -200,6 +201,7 @@ AliTRDCalibraFit::AliTRDCalibraFit(const AliTRDCalibraFit &c)
,fTakeTheMaxPH(c.fTakeTheMaxPH)
,fT0Shift0(c.fT0Shift0)
,fT0Shift1(c.fT0Shift1)
,fMaxValueT0(c.fMaxValueT0)
,fRangeFitPRF(c.fRangeFitPRF)
,fAccCDB(c.fAccCDB)
,fMinEntries(c.fMinEntries)
Expand Down Expand Up @@ -5285,7 +5287,7 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
if (fPhdt0 >= 0.0) {
fCurrentCoef2[0] = (fPhdt0 - t0Shift) / widbins;
//printf("Value of timeoffset %f\n",fCurrentCoef2[0]);
if (fCurrentCoef2[0] < -3.0) {
if ((fCurrentCoef2[0] < -3.0) || (fCurrentCoef2[0] > fMaxValueT0)) {
fCurrentCoef2[0] = fCurrentCoef2[1] + 100.0;
}
}
Expand All @@ -5301,7 +5303,7 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH)
(put)) {
if (fPhdt0 >= 0.0) {
fCurrentCoef2[0] = (fPhdt0 - t0Shift) / widbins;
if (fCurrentCoef2[0] < -3.0) {
if ((fCurrentCoef2[0] < -3.0) || (fCurrentCoef2[0] > fMaxValueT0)) {
fCurrentCoef2[0] = fCurrentCoef2[1] + 100.0;
}
else fNumberFitSuccess++;
Expand Down
6 changes: 4 additions & 2 deletions TRD/AliTRDCalibraFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ class AliTRDCalibraFit : public TObject {
void SetPeriodeFitPH(Int_t periodeFitPH);
void SetTakeTheMaxPH() { fTakeTheMaxPH = kTRUE; }
void SetT0Shift0(Float_t t0Shift0);
void SetT0Shift1(Float_t t0Shift1);
void SetT0Shift1(Float_t t0Shift1);
void SetMaxValueT0(Float_t maxValueT0) { fMaxValueT0 = maxValueT0; }
void SetRangeFitPRF(Float_t rangeFitPRF);
void SetAccCDB() { fAccCDB = kTRUE; }
void SetMinEntries(Int_t minEntries);
Expand Down Expand Up @@ -215,6 +216,7 @@ class AliTRDCalibraFit : public TObject {
Bool_t fTakeTheMaxPH; // Take the Max for the T0 determination
Float_t fT0Shift0; // T0 Shift with the maximum positive slope
Float_t fT0Shift1; // T0 Shift with the maximum of the amplification region
Float_t fMaxValueT0; // Max possible t0
Float_t fRangeFitPRF; // The fit range for the PRF is -fRangeFitPRF +fRangeFitPRF
Bool_t fAccCDB; // If there is a calibration database to be compared with....
Int_t fMinEntries; // Min Entries to fit the histo
Expand Down Expand Up @@ -377,7 +379,7 @@ class AliTRDCalibraFit : public TObject {
virtual ~AliTRDCalibraFit();


ClassDef(AliTRDCalibraFit,3) // TRD Calibration class
ClassDef(AliTRDCalibraFit,4) // TRD Calibration class

};

Expand Down
62 changes: 49 additions & 13 deletions TRD/AliTRDPreprocessorOffline.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ClassImp(AliTRDPreprocessorOffline)
fStatusPos(0),
fBadCalibValidate(40),
fNoDataValidate(40),
fRMSBadCalibratedGain(20.0),
fRMSBadCalibratedGain(15.0),
fRMSBadCalibratedVdrift(20.0),
fRMSBadCalibratedExB(20.0),
fMinTimeOffsetValidate(-1.6),
Expand All @@ -132,6 +132,7 @@ ClassImp(AliTRDPreprocessorOffline)
fBeginFitCharge(3.5),
fT0Shift0(0.124797),
fT0Shift1(0.267451),
fMaxValueT0(5.),
fPHQon(kTRUE),
fDebugPHQon(kFALSE)
{
Expand Down Expand Up @@ -750,6 +751,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){
AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
calibra->SetT0Shift0(fT0Shift0);
calibra->SetT0Shift1(fT0Shift1);
calibra->SetMaxValueT0(fMaxValueT0);
calibra->SetMinEntries(fMinStatsVdriftT0PH); // If there is less than 1000 entries in the histo: no fit
calibra->AnalysePH(fPH2d);
//calibra->SetDebugLevel(2);
Expand Down Expand Up @@ -1092,6 +1094,14 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
Double_t entries = projch->GetEntries();
//printf("Number of entries %f for det %d\n",entries,idet);

TVectorD error(3);
Bool_t heree = fAliTRDCalibraVdriftLinearFit->GetError(idet,&error);
Double_t entriesvd = 0.;
if(heree) {
entriesvd = error[2];
}
//printf("Number of entries for detector %d for gain %f and for vd %f\n",idet,entries,entriesvd);

// sm number
Int_t smnumber = (Int_t) idet/30;

Expand Down Expand Up @@ -1121,6 +1131,8 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()

if(TMath::Abs(gainmeanSM[smnumber]-gain) < 0.000001 ||
TMath::Abs(vdriftmeanSM[smnumber]-vdrift) < 0.000001 ||
entries < fMinStatsGain ||
entriesvd < fMinStatsVdriftLinear ||
TMath::Abs(exbmeanSM[smnumber]-exb) < 0.000001) {

//printf(" chamber det %03d notcalibrated sm %d \n",idet,smnumber);
Expand Down Expand Up @@ -1277,6 +1289,8 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
// Update OCDB entry
//

Bool_t status = kTRUE;

AliCDBMetaData *metaData= new AliCDBMetaData();
metaData->SetObjectClassName("AliTRDCalDet");
metaData->SetResponsible("Raphaelle Bailhache");
Expand All @@ -1285,8 +1299,8 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()

AliCDBId id1("TRD/Calib/ChamberGainFactor", startRunNumber, endRunNumber);
AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(kGain);
if(calDet) storage->Put(calDet, id1, metaData);

if(calDet) status = storage->Put(calDet, id1, metaData);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;

}
//___________________________________________________________________________________________________________________
Expand All @@ -1295,6 +1309,8 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
// Update OCDB entry
//

Bool_t status = kTRUE;

Int_t detExB = kLorentzLinear;
if(!fMethodSecond) return;

Expand All @@ -1308,7 +1324,8 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()

AliCDBId id1("TRD/Calib/ChamberExB", startRunNumber, endRunNumber);
AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detExB);
if(calDet) storage->Put(calDet, id1, metaData);
if(calDet) status = storage->Put(calDet, id1, metaData);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;
//if(!calDet) printf("No caldet\n");

}
Expand All @@ -1318,6 +1335,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end
// Update OCDB entry
//

Bool_t status = kTRUE;

Int_t detExB = kExbAlt;
if(!fMethodSecond) return;

Expand All @@ -1331,7 +1350,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end

AliCDBId id1("TRD/Calib/ChamberExBAlt", startRunNumber, endRunNumber);
AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detExB);
if(calDet) storage->Put(calDet, id1, metaData);
if(calDet) status = storage->Put(calDet, id1, metaData);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;
//if(!calDet) printf("No caldet\n");

}
Expand All @@ -1341,6 +1361,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end
// Update OCDB entry
//

Bool_t status = kTRUE;

Int_t detVdrift = kVdriftPHDet;

if(fMethodSecond) detVdrift = kVdriftLinear;
Expand All @@ -1353,7 +1375,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end

AliCDBId id1("TRD/Calib/ChamberVdrift", startRunNumber, endRunNumber);
AliTRDCalDet *calDet = (AliTRDCalDet *) fCalibObjects->At(detVdrift);
if(calDet) storage->Put(calDet, id1, metaData);
if(calDet) status = storage->Put(calDet, id1, metaData);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;

//

Expand All @@ -1367,7 +1390,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end

AliCDBId id1Pad("TRD/Calib/LocalVdrift", startRunNumber, endRunNumber);
AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kVdriftPHPad);
if(calPad) storage->Put(calPad, id1Pad, metaDataPad);
if(calPad) status = storage->Put(calPad, id1Pad, metaDataPad);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;

}

Expand All @@ -1378,6 +1402,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end
// Update OCDB entry
//

Bool_t status = kTRUE;

AliCDBMetaData *metaData= new AliCDBMetaData();
metaData->SetObjectClassName("AliTRDCalDet");
metaData->SetResponsible("Raphaelle Bailhache");
Expand All @@ -1398,8 +1424,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end

AliCDBId id1Pad("TRD/Calib/LocalT0", startRunNumber, endRunNumber);
AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kT0PHPad);
if(calPad) storage->Put(calPad, id1Pad, metaDataPad);

if(calPad) status = storage->Put(calPad, id1Pad, metaDataPad);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;


}
Expand All @@ -1409,6 +1435,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end
// Update OCDB entry
//

Bool_t status = kTRUE;

AliCDBMetaData *metaData= new AliCDBMetaData();
metaData->SetObjectClassName("AliTRDCalPad");
metaData->SetResponsible("Raphaelle Bailhache");
Expand All @@ -1418,7 +1446,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBExBAlt(Int_t startRunNumber, Int_t end

AliCDBId id1("TRD/Calib/PRFWidth", startRunNumber, endRunNumber);
AliTRDCalPad *calPad = (AliTRDCalPad *) fCalibObjects->At(kPRF);
if(calPad) storage->Put(calPad, id1, metaData);
if(calPad) status = storage->Put(calPad, id1, metaData);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;


}
Expand All @@ -1428,6 +1457,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRun
//
// Update OCDB entry
//
Bool_t status = kTRUE;

AliCDBMetaData *metaData= new AliCDBMetaData();
metaData->SetObjectClassName("TObjArray");
metaData->SetResponsible("Raphaelle Bailhache and Xianguo Lu");
Expand All @@ -1438,7 +1469,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRun
TObjArray *cobj = (TObjArray *) fCalibObjects->At(kPHQ);
if(cobj){
//cobj->Print();
storage->Put(cobj, id1, metaData);
status = storage->Put(cobj, id1, metaData);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;
}
}

Expand All @@ -1448,6 +1480,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRun
// Update OCDB entry
//

Bool_t status = kTRUE;

AliCDBMetaData *metaData= new AliCDBMetaData();
metaData->SetObjectClassName("AliTRDCalChamberStatus");
metaData->SetResponsible("Raphaelle Bailhache and Julian Book");
Expand All @@ -1456,7 +1490,8 @@ void AliTRDPreprocessorOffline::UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRun

AliCDBId id1("TRD/Calib/ChamberStatus", startRunNumber, endRunNumber);
AliTRDCalChamberStatus *calChamberStatus = (AliTRDCalChamberStatus *) fCalibObjects->At(kChamberStatus);
if(calChamberStatus) storage->Put(calChamberStatus, id1, metaData);
if(calChamberStatus) status = storage->Put(calChamberStatus, id1, metaData);
if (status==kFALSE) fStatusPos = fStatusPos | kCalibFailedExport;


}
Expand Down Expand Up @@ -1742,6 +1777,7 @@ void AliTRDPreprocessorOffline::PrintStatus() const
AliInfo(Form("IsVdriftErrorRange? %d",(Int_t)IsVdriftErrorRange()));
AliInfo(Form("IsTimeOffsetErrorRange? %d",(Int_t)IsTimeOffsetErrorRange()));
AliInfo(Form("IsChamberStatusErrorRange? %d",(Int_t)IsChamberStatusErrorRange()));
AliInfo(Form("IsCalibFailedExport? %d",(Int_t)IsCalibFailedExport()));


AliInfo(Form("The info status is %d",fStatusNeg));
Expand All @@ -1750,9 +1786,9 @@ void AliTRDPreprocessorOffline::PrintStatus() const
AliInfo(Form("IsGainNotEnoughStatsNotFill? %d",(Int_t)IsGainNotEnoughStatsNotFill()));
AliInfo(Form("IsVdriftNotEnoughStatsNotFill? %d",(Int_t)IsVdriftNotEnoughStatsNotFill()));
AliInfo(Form("IsTimeOffsetNotEnoughStatsNotFill? %d",(Int_t)IsTimeOffsetNotEnoughStatsNotFill()));

AliInfo(Form("IsExBErrorRange? %d",(Int_t)IsExBErrorRange()));
AliInfo(Form("IsExBErrorOld? %d",(Int_t)IsExBErrorOld()));


}
//___________________________________________________________________________________
Expand Down
9 changes: 7 additions & 2 deletions TRD/AliTRDPreprocessorOffline.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class AliTRDPreprocessorOffline:public TNamed {
kGainErrorRange = 16,
kVdriftErrorRange = 32,
kTimeOffsetErrorRange = 64,
kChamberStatusErrorRange = 128};
kChamberStatusErrorRange = 128,
kCalibFailedExport = 256};


AliTRDPreprocessorOffline();
Expand Down Expand Up @@ -91,6 +92,7 @@ class AliTRDPreprocessorOffline:public TNamed {
void SetBeginFitCharge(Float_t beginFitCharge) { fBeginFitCharge = beginFitCharge;};
void SetT0Shift0(Float_t t0Shift0) { fT0Shift0 = t0Shift0;};
void SetT0Shift1(Float_t t0Shift1) { fT0Shift1 = t0Shift1;};
void SetMaxValueT0(Float_t maxValueT0) { fMaxValueT0 = maxValueT0;};



Expand Down Expand Up @@ -128,6 +130,8 @@ class AliTRDPreprocessorOffline:public TNamed {
{ return CheckStatus(fStatusPos, kTimeOffsetErrorRange); };
Bool_t IsChamberStatusErrorRange() const
{ return CheckStatus(fStatusPos, kChamberStatusErrorRange); };
Bool_t IsCalibFailedExport() const
{ return CheckStatus(fStatusPos, kCalibFailedExport); };


// Back corrections
Expand Down Expand Up @@ -266,6 +270,7 @@ class AliTRDPreprocessorOffline:public TNamed {
Float_t fBeginFitCharge; // Fit Begin Charge starts at mean/fBeginFitCharge
Float_t fT0Shift0; // T0 Shift with the maximum positive slope
Float_t fT0Shift1; // T0 Shift with the maximum of the amplification region
Float_t fMaxValueT0; // Max possible t0

Int_t GetSubVersion(TString name) const;
Int_t GetVersion(TString name) const;
Expand All @@ -280,7 +285,7 @@ class AliTRDPreprocessorOffline:public TNamed {
Bool_t fPHQon; //switch of PHQ
Bool_t fDebugPHQon; //switch of DebugPHQ

ClassDef(AliTRDPreprocessorOffline,5)
ClassDef(AliTRDPreprocessorOffline,6)
};

#endif
Expand Down
1 change: 1 addition & 0 deletions TRD/Cal/AliTRDCalChamberStatus.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void AliTRDCalChamberStatus::SetStatus(Int_t det, Char_t status)
SETBIT(fStatus[det], kBadCalibrated);
break;
case AliTRDCalChamberStatus::kNotCalibrated:
CLRBIT(fStatus[det], kGood);
SETBIT(fStatus[det], kNotCalibrated);
//CLRBIT(fStatus[det], kBadCalibrated);
break;
Expand Down
Loading

0 comments on commit 096baae

Please sign in to comment.