]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDPreprocessorOffline.cxx
check if clusters tagged as photon decay have the decay companion in the list of...
[u/mrichter/AliRoot.git] / TRD / AliTRDPreprocessorOffline.cxx
index cd860f85fad83365289780ac24ac64bac5b9d584..67a440b6e825a197bbae9615d426384af4654ccb 100644 (file)
@@ -99,6 +99,7 @@ ClassImp(AliTRDPreprocessorOffline)
   fSubVersionExBUsed(0),
   fNoExBUsedInReco(kFALSE),
   fSwitchOnValidation(kTRUE),
+  fSwitchOnChamberStatus(kTRUE),
   fVdriftValidated(kFALSE),
   fExBValidated(kFALSE),
   fT0Validated(kFALSE),
@@ -129,6 +130,8 @@ ClassImp(AliTRDPreprocessorOffline)
   fOutliersFitChargeLow(0.03),
   fOutliersFitChargeHigh(0.7),
   fBeginFitCharge(3.5),
+  fT0Shift0(0.124797),
+  fT0Shift1(0.267451),
   fPHQon(kTRUE),
   fDebugPHQon(kFALSE)
 {
@@ -177,7 +180,7 @@ void AliTRDPreprocessorOffline::Process(const Char_t* file, Int_t startRunNumber
     
     CalibVdriftT0(file,startRunNumber,endRunNumber,ocdbStorage);
     CalibGain(file,startRunNumber,endRunNumber,ocdbStorage);
-    CalibChamberStatus(file,startRunNumber,endRunNumber,ocdbStorage);
+    if(fSwitchOnChamberStatus) CalibChamberStatus(file,startRunNumber,endRunNumber,ocdbStorage);
     CalibExbAlt(file,startRunNumber,endRunNumber,ocdbStorage);
 
   }
@@ -431,16 +434,19 @@ void AliTRDPreprocessorOffline::CalibChamberStatus(const Char_t* file, Int_t sta
   //
   // 4. validate OCDB entries
   //
-  if(fSwitchOnValidation==kTRUE && ValidateChamberStatus()==kFALSE) { 
-    //AliError("TRD Chamber status OCDB parameters not ok!");
-    return;
+  //printf("Enough stats for vdrift? %d\n",(Int_t)fNotEnoughStatisticsForTheVdriftLinear);
+  //printf("Enough stats for gain? %d\n",(Int_t)fNotEnoughStatisticsForTheGain); 
+  if((!fNotEnoughStatisticsForTheVdriftLinear) && (!fNotEnoughStatisticsForTheGain)) {
+    if(fSwitchOnValidation==kTRUE && ValidateChamberStatus()==kFALSE) { 
+      //AliError("TRD Chamber status OCDB parameters not ok!");
+      return;
+    }
+    //
+    // 5. update of OCDB
+    //
+    //
+    UpdateOCDBChamberStatus(startRunNumber,endRunNumber,ocdbStorage);
   }
-  //
-  // 5. update of OCDB
-  //
-  //
-  if((!fNotEnoughStatisticsForTheVdriftLinear) && (!fNotEnoughStatisticsForTheGain)) UpdateOCDBChamberStatus(startRunNumber,endRunNumber,ocdbStorage);
-  //UpdateOCDBChamberStatus(startRunNumber,endRunNumber,ocdbStorage);
   
 }
 //______________________________________________________________________________________________________
@@ -496,7 +502,7 @@ Bool_t AliTRDPreprocessorOffline::ReadStatusGlobal(const Char_t* fileName){
   // 
   if(fSparse) return kTRUE;
   TFile fcalib(fileName);
-  TObjArray * array = (TObjArray*)fcalib.Get(fNameList);
+  TList * array = (TList*)fcalib.Get(fNameList);
   if (array){
     fSparse = (THnSparseI *) array->FindObject("NumberOfEntries");
     if(!fSparse) return kFALSE;
@@ -526,11 +532,15 @@ Bool_t AliTRDPreprocessorOffline::ReadGainGlobal(const Char_t* fileName){
   // 
   if(fCH2d) return kTRUE;
   TFile fcalib(fileName);
-  TObjArray * array = (TObjArray*)fcalib.Get(fNameList);
+  TList * array = (TList*)fcalib.Get(fNameList);
   if (array){
     TH2I *ch2d = (TH2I *) array->FindObject("CH2d");
-    if(!ch2d) return kFALSE;
+    if(!ch2d) {
+      delete array;
+      return kFALSE;
+    }
     fCH2d = (TH2I*)ch2d->Clone();
+    delete array;
     //fNEvents = (TH1I *) array->FindObject("NEvents");
     //fAbsoluteGain = (TH2F *) array->FindObject("AbsoluteGain");
   }else{
@@ -554,12 +564,16 @@ Bool_t AliTRDPreprocessorOffline::ReadVdriftT0Global(const Char_t* fileName){
   // 
   if(fPH2d) return kTRUE;
   TFile fcalib(fileName);
-  TObjArray * array = (TObjArray*)fcalib.Get(fNameList);
+  TList * array = (TList*)fcalib.Get(fNameList);
   if (array){
     TProfile2D *ph2d = (TProfile2D *) array->FindObject("PH2d");
-    if(!ph2d) return kFALSE;
+    if(!ph2d) {
+      delete array;
+      return kFALSE;
+    }
     fPH2d = (TProfile2D*)ph2d->Clone();
     //fNEvents = (TH1I *) array->FindObject("NEvents");
+    delete array;
   }else{
     TProfile2D *ph2d = (TProfile2D *) fcalib.Get("PH2d");
     if(!ph2d) return kFALSE;
@@ -580,10 +594,12 @@ Bool_t AliTRDPreprocessorOffline::ReadVdriftLinearFitGlobal(const Char_t* fileNa
   // 
   if(fAliTRDCalibraVdriftLinearFit) return kTRUE;
   TFile fcalib(fileName);
-  TObjArray * array = (TObjArray*)fcalib.Get(fNameList);
+  TList * array = (TList*)fcalib.Get(fNameList);
   if (array){
-    fAliTRDCalibraVdriftLinearFit = (AliTRDCalibraVdriftLinearFit *) array->FindObject("AliTRDCalibraVdriftLinearFit");
+    AliTRDCalibraVdriftLinearFit * dummy = (AliTRDCalibraVdriftLinearFit *) array->FindObject("AliTRDCalibraVdriftLinearFit");
+    fAliTRDCalibraVdriftLinearFit = dummy ? (AliTRDCalibraVdriftLinearFit *) dummy->Clone() : 0x0;
     //fNEvents = (TH1I *) array->FindObject("NEvents");
+    delete array;
   }else{
     fAliTRDCalibraVdriftLinearFit = (AliTRDCalibraVdriftLinearFit *) fcalib.Get("AliTRDCalibraVdriftLinearFit");
     //fNEvents = (TH1I *) fcalib.Get("NEvents");
@@ -602,10 +618,12 @@ Bool_t AliTRDPreprocessorOffline::ReadExbAltFitGlobal(const Char_t* fileName){
   // 
   if(fAliTRDCalibraExbAltFit) return kTRUE;
   TFile fcalib(fileName);
-  TObjArray * array = (TObjArray*)fcalib.Get(fNameList);
+  TList * array = (TList*)fcalib.Get(fNameList);
   if (array){
-    fAliTRDCalibraExbAltFit = (AliTRDCalibraExbAltFit *) array->FindObject("AliTRDCalibraExbAltFit");
+     AliTRDCalibraExbAltFit * dummy = (AliTRDCalibraExbAltFit *) array->FindObject("AliTRDCalibraExbAltFit");
+     fAliTRDCalibraExbAltFit = dummy ? (AliTRDCalibraExbAltFit *)dummy->Clone() : 0x0;
     //fNEvents = (TH1I *) array->FindObject("NEvents");
+    delete array;
   }else{
     fAliTRDCalibraExbAltFit = (AliTRDCalibraExbAltFit *) fcalib.Get("AliTRDCalibraExbAltFit");
     //fNEvents = (TH1I *) fcalib.Get("NEvents");
@@ -625,11 +643,15 @@ Bool_t AliTRDPreprocessorOffline::ReadPRFGlobal(const Char_t* fileName){
   // 
   if(fPRF2d) return kTRUE;
   TFile fcalib(fileName);
-  TObjArray * array = (TObjArray*)fcalib.Get(fNameList);
+  TList * array = (TList*)fcalib.Get(fNameList);
   if (array){
     TProfile2D *prf2d = (TProfile2D *) array->FindObject("PRF2d");
-    if(!prf2d) return kFALSE;
+    if(!prf2d) {
+      delete array;
+      return kFALSE;
+    }
     fPRF2d = (TProfile2D*)prf2d->Clone();
+    delete array;
     //fNEvents = (TH1I *) array->FindObject("NEvents");
   }else{
     TProfile2D *prf2d = (TProfile2D *) fcalib.Get("PRF2d");
@@ -726,8 +748,11 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){
   //
 
   AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
+  calibra->SetT0Shift0(fT0Shift0);
+  calibra->SetT0Shift1(fT0Shift1);
   calibra->SetMinEntries(fMinStatsVdriftT0PH); // If there is less than 1000 entries in the histo: no fit
-  calibra->AnalysePH(fPH2d);
+  calibra->AnalysePH(fPH2d); 
+  //calibra->SetDebugLevel(2);
 
   Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
     + 6*  18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
@@ -740,6 +765,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){
   Bool_t ok = kFALSE;
   if ((nbtg >                  0) && 
       (nbfit        >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) {
+    //printf("nbtg %d, nbfit %d, nbE %d, nbfitSucess %d\n",nbtg,nbfit,nbE,nbfitSuccess);
     //printf("Pass the cut for VdriftT0\n");
     // create the cal objects
     calibra->RemoveOutliers(1,kFALSE);
@@ -790,7 +816,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftLinearFit(){
   AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
   calibra->SetCalDetVdriftExB(fCalDetVdriftUsed,fCalDetExBUsed);
   calibra->SetMinEntries(fMinStatsVdriftLinear); // If there is less than 1000 entries in the histo: no fit
-  printf("The mean stat is by %d for VdriftLinear\n",fMinStatsVdriftLinear);
+  //printf("The mean stat is by %d for VdriftLinear\n",fMinStatsVdriftLinear);
   //fAliTRDCalibraVdriftLinearFit->SetSeeDetector(0);
   //fAliTRDCalibraVdriftLinearFit->SetDebugLevel(1);
   //printf("Fill PE Array\n");
@@ -1529,7 +1555,7 @@ void AliTRDPreprocessorOffline::UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRun
      Double_t rmsdet = calDet->GetRMSRobust();
      Double_t meanpad = calPad->GetMean();
      //Double_t rmspad = calPad->GetRMS();
-     //printf("T0::minimum %f, rmsdet %f,meanpad %f, rmspad %f\n",meandet,rmsdet,meanpad,rmspad);
+     printf("T0::meandet %f, rmsdet %f,meanpad %f\n",meandet,rmsdet,meanpad);
      if((meandet >   fMinTimeOffsetValidate) && (meandet < 5.0) && (rmsdet < 4.0) && (meanpad < 5.0) && (meanpad > -0.5)) return kTRUE;
      else {
        fStatusPos = fStatusPos | kTimeOffsetErrorRange;