Implementation of pass0 in automatic procedure (Julian)
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Dec 2010 15:37:43 +0000 (15:37 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Dec 2010 15:37:43 +0000 (15:37 +0000)
TRD/AliTRDPreprocessorOffline.cxx
TRD/AliTRDPreprocessorOffline.h

index 8f70911..3418af2 100644 (file)
@@ -57,6 +57,7 @@
 #include "AliTRDCalibraFit.h"
 #include "AliTRDCalibraVdriftLinearFit.h"
 #include "AliTRDPreprocessorOffline.h"
+#include "AliTRDCalChamberStatus.h"
 
 
 ClassImp(AliTRDPreprocessorOffline)
@@ -857,3 +858,54 @@ Int_t AliTRDPreprocessorOffline::GetSubVersion(TString name) const
 
 }
 
+//_____________________________________________________________________________
+AliTRDCalChamberStatus *AliTRDPreprocessorOffline::ProduceChamberStatus()
+{
+  //
+  // Produce AliTRDCalChamberStatus out of calibration results
+  //
+
+  // set up AliTRDCalChamberStatus
+  AliTRDCalChamberStatus *CalChamberStatus = new AliTRDCalChamberStatus();
+
+  // get calibration objects
+  AliTRDCalDet *calDetGain   = (AliTRDCalDet *) fCalibObjects->At(kGain);
+  AliTRDCalDet *calDetVDrift = (AliTRDCalDet *) fCalibObjects->At(kVdriftLinear);
+  
+  // mask chambers with empty gain entries
+  TH1I *projch = 0x0;
+  Int_t counter = 0;
+  for (Int_t idet = 0; idet < 540; idet++) {
+
+    // ch2d
+    projch->Reset("CE");
+    projch =  (TH1I *) fCH2d->ProjectionX("projch",idet+1,idet+1,(Option_t *)"e");
+    Int_t entries = projch->GetEntries();
+
+    // gain
+    Double_t defaultgain = calDetGain->GetMean();
+    Double_t gain = calDetGain->GetValue(idet);
+
+    // vdrift
+    Double_t defaultvdrift = calDetVDrift->GetMean();
+    Double_t vdrift = calDetVDrift->GetValue(idet);
+
+
+    if(entries<=0 ||
+       TMath::Abs(defaultgain-gain) < 0.5 ||
+       TMath::Abs(defaultvdrift-vdrift) < 0.1) {
+     
+      printf(" chamber det %03d masked \n",idet);
+      CalChamberStatus->SetStatus(idet,2);
+      counter++;
+    }
+    
+    // installed supermodules+1 -> abort
+    if(counter > (7+1)*30) {
+      printf("ERROR: more than one SM to be masked!! \n Abort...\n");
+      return 0x0;
+    }
+
+  }
+  return CalChamberStatus;
+}
index b2c56e7..ae4c0d7 100644 (file)
@@ -11,6 +11,7 @@
 
 
 #include "TNamed.h"
+#include "AliTRDCalChamberStatus.h"
 class TObjArray;
 class AliTRDCalDet;
 class TH2I;
@@ -52,7 +53,7 @@ public:
   void CalibVdriftT0(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
   void CalibGain(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber,  TString  ocdbStorage="");
   void CalibPRF(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber,  TString  ocdbStorage="");
-  
+
   Bool_t ReadGainGlobal(const Char_t* fileName="CalibObjects.root");
   Bool_t ReadVdriftT0Global(const Char_t* fileName="CalibObjects.root");
   Bool_t ReadVdriftLinearFitGlobal(const Char_t* fileName="CalibObjects.root");
@@ -85,15 +86,17 @@ public:
   void     SetMinStatsVdriftLinear(Int_t minStatsVdriftLinear)       { fMinStatsVdriftLinear = minStatsVdriftLinear; }  
   void     SetMinStatsGain(Int_t minStatsGain)                       { fMinStatsGain = minStatsGain; }  
   void     SetMinStatsPRF(Int_t minStatsPRF)                         { fMinStatsPRF = minStatsPRF; }  
+
+  AliTRDCalChamberStatus *ProduceChamberStatus();
   
  private:
-  Bool_t fMethodSecond;                   // Second Method for drift velocity   
-  TString fNameList;                      // Name of the list
-  AliTRDCalDet *fCalDetGainUsed;          // CalDet used and to be corrected for
-  AliTRDCalDet *fCalDetVdriftUsed;        // CalDet used and to be corrected for
-  TH2I *fCH2d;                            // Gain
-  TProfile2D *fPH2d;                      // Drift velocity first method
-  TProfile2D *fPRF2d;                     // PRF
+  Bool_t fMethodSecond;                      // Second Method for drift velocity   
+  TString fNameList;                         // Name of the list
+  AliTRDCalDet *fCalDetGainUsed;             // CalDet used and to be corrected for
+  AliTRDCalDet *fCalDetVdriftUsed;           // CalDet used and to be corrected for
+  TH2I *fCH2d;                               // Gain
+  TProfile2D *fPH2d;                         // Drift velocity first method
+  TProfile2D *fPRF2d;                        // PRF
   AliTRDCalibraVdriftLinearFit *fAliTRDCalibraVdriftLinearFit; // Drift velocity second method
   TH1I *fNEvents;                         // Number of events 
   TH2F *fAbsoluteGain;                    // Absolute Gain calibration