use digits param to extract no of time bins
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Nov 2009 10:55:02 +0000 (10:55 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Nov 2009 10:55:02 +0000 (10:55 +0000)
add on/off setters in reco param

TRD/AliTRDReconstructor.cxx
TRD/AliTRDReconstructor.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDrecoParam.cxx
TRD/AliTRDrecoParam.h
TRD/AliTRDtrackerV1.cxx

index 69a066e..c357157 100644 (file)
 
 ClassImp(AliTRDReconstructor)
 
-TClonesArray *AliTRDReconstructor::fgClusters = 0x0;
-TClonesArray *AliTRDReconstructor::fgTracklets = 0x0;
-Char_t* AliTRDReconstructor::fgSteerNames[kNsteer] = {
+TClonesArray *AliTRDReconstructor::fgClusters = NULL;
+TClonesArray *AliTRDReconstructor::fgTracklets = NULL;
+AliTRDdigitsParam *AliTRDReconstructor::fgDigitsParam = NULL;
+Char_t const * AliTRDReconstructor::fgSteerNames[kNsteer] = {
   "DigitsConversion       "
  ,"Write Clusters         "
  ,"Write Online Tracklets "
@@ -51,7 +52,7 @@ Char_t* AliTRDReconstructor::fgSteerNames[kNsteer] = {
  ,"Process Online Tracklets"
  ,"Debug Streaming        "
 };
-Char_t* AliTRDReconstructor::fgSteerFlags[kNsteer] = {
+Char_t const * AliTRDReconstructor::fgSteerFlags[kNsteer] = {
   "dc"// digits conversion [false]
  ,"cw"// write clusters [true]
  ,"tw"// write online tracklets [false]
@@ -60,12 +61,12 @@ Char_t* AliTRDReconstructor::fgSteerFlags[kNsteer] = {
  ,"tp"// also use online tracklets for reconstruction [false]
  ,"deb"// Write debug stream [false]
 };
-Char_t* AliTRDReconstructor::fgTaskNames[AliTRDrecoParam::kTRDreconstructionTasks] = {
+Char_t const * AliTRDReconstructor::fgTaskNames[AliTRDrecoParam::kTRDreconstructionTasks] = {
   "Clusterizer"
  ,"Tracker"
  ,"PID"
 };
-Char_t* AliTRDReconstructor::fgTaskFlags[AliTRDrecoParam::kTRDreconstructionTasks] = {
+Char_t const * AliTRDReconstructor::fgTaskFlags[AliTRDrecoParam::kTRDreconstructionTasks] = {
   "cl"
  ,"tr"
  ,"pd"
@@ -94,6 +95,7 @@ AliTRDReconstructor::~AliTRDReconstructor()
   // Destructor
   //
 
+  if(fgDigitsParam) delete fgDigitsParam;
   if(fgClusters) {
     fgClusters->Delete(); delete fgClusters;
   }
@@ -234,6 +236,13 @@ void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
 
 }
 
+//_____________________________________________________________________________
+void AliTRDReconstructor::SetDigitsParam(AliTRDdigitsParam const *par)
+{ 
+  if(fgDigitsParam) (*fgDigitsParam) = (*par);
+  else fgDigitsParam = new AliTRDdigitsParam(*par);
+}
+
 
 //_____________________________________________________________________________
 void AliTRDReconstructor::SetOption(Option_t *opt)
index 3eafd50..2d6e474 100644 (file)
@@ -16,6 +16,7 @@
 #include "AliDetectorRecoParam.h"
 #include "AliTRDpidUtil.h"
 #include "AliTRDrecoParam.h"
+#include "AliTRDdigitsParam.h"
 
 class TClonesArray;
 class TTreeSRedirector;
@@ -49,8 +50,10 @@ public:
   static TClonesArray* GetTracklets() {return fgTracklets;}
   Int_t               GetNdEdxSlices() const     { return (Int_t)AliTRDpidUtil::GetNdEdxSlices(GetPIDMethod());}
   AliTRDpidUtil::ETRDPIDMethod       GetPIDMethod() const       { return GetRecoParam()->IsPIDNeuralNetwork() ? AliTRDpidUtil::kNN : AliTRDpidUtil::kLQ;}
+  static AliTRDdigitsParam* GetDigitsParam() { return fgDigitsParam;}
   static const AliTRDrecoParam* GetRecoParam() { return dynamic_cast<const AliTRDrecoParam*>(AliReconstructor::GetRecoParam(2)); }
   virtual Bool_t      HasDigitConversion() const { return fSteerParam&kDigitsConversion;  };
+  Bool_t              HasDigitsParam() const { return Bool_t(fgDigitsParam);}
   Bool_t              IsCosmic() const { return GetRecoParam()->GetEventSpecie() & AliRecoParam::kCosmic;}
   Bool_t              IsWritingClusters() const  { return fSteerParam&kWriteClusters;}
   Bool_t              IsWritingTracklets() const { return fSteerParam&kWriteTracklets;}
@@ -63,21 +66,23 @@ public:
   virtual void        Reconstruct(AliRawReader *rawReader, TTree *clusterTree) const;
   virtual void        Reconstruct(TTree *digitsTree, TTree *clusterTree) const;
 
-  static void         SetClusters(TClonesArray *clusters) {fgClusters = clusters;} 
-  static void         SetTracklets(TClonesArray *tracklets) {fgTracklets = tracklets;}
+  static void         SetClusters(TClonesArray *clusters)  { fgClusters = clusters;} 
+  static void         SetTracklets(TClonesArray *tracklets) { fgTracklets = tracklets;}
+  static void         SetDigitsParam(AliTRDdigitsParam const *par);
   void               SetOption(Option_t *opt);
 
 private:
   AliTRDReconstructor(const AliTRDReconstructor &r); //Not implemented
   AliTRDReconstructor& operator = (const AliTRDReconstructor&); //Not implemented
 
-  static Char_t    *fgSteerNames[kNsteer];//! steering names
-  static Char_t    *fgSteerFlags[kNsteer];//! steering flags
-  static Char_t    *fgTaskNames[AliTRDrecoParam::kTRDreconstructionTasks]; //! tasks names
-  static Char_t    *fgTaskFlags[AliTRDrecoParam::kTRDreconstructionTasks]; //! tasks flags
+  static Char_t const *fgSteerNames[kNsteer];//! steering names
+  static Char_t const *fgSteerFlags[kNsteer];//! steering flags
+  static Char_t const   *fgTaskNames[AliTRDrecoParam::kTRDreconstructionTasks]; //! tasks names
+  static Char_t const   *fgTaskFlags[AliTRDrecoParam::kTRDreconstructionTasks]; //! tasks flags
   UInt_t            fSteerParam;          // steering bits
   TTreeSRedirector *fDebugStream[AliTRDrecoParam::kTRDreconstructionTasks];// Debug Streamer container;
  
+  static AliTRDdigitsParam *fgDigitsParam; // Digits Param information
   static TClonesArray *fgClusters;    // list of clusters for local reconstructor
   static TClonesArray *fgTracklets;   // list of online tracklets for local reconstructor
 
index 12221d9..ce03cfe 100644 (file)
@@ -616,6 +616,7 @@ Bool_t AliTRDclusterizer::MakeClusters()
     fDigitsManager->RemoveDictionaries(i);      
     fDigitsManager->ClearIndexes(i);  
   }
+  fReconstructor->SetDigitsParam(fDigitsManager->GetDigitsParam());
   
   if(fReconstructor->IsWritingClusters()) WriteClusters(-1);
 
@@ -685,6 +686,7 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
     if (!fReconstructor->IsWritingTracklets()) continue;
     if (*(fTrackletContainer[0]) > 0 || *(fTrackletContainer[1]) > 0) WriteTracklets(det);
   }
+  fReconstructor->SetDigitsParam(fDigitsManager->GetDigitsParam());
   
   if (fTrackletContainer){
     delete [] fTrackletContainer[0];
@@ -782,6 +784,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
     return kFALSE;
   }
 
+
   fMaxThresh            = fReconstructor->GetRecoParam()->GetClusMaxThresh();
   fSigThresh            = fReconstructor->GetRecoParam()->GetClusSigThresh();
   fMinMaxCutSigma       = fReconstructor->GetRecoParam()->GetMinMaxCutSigma();
@@ -795,7 +798,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 
   fDet  = AliTRDgeometry::GetDetector(fLayer,istack,isector);
   if (fDet != det) {
-    AliError("Strange Detector number mismatch!");
+    AliError("Strange Detector number Missmatch!");
     return kFALSE;
   }
 
@@ -817,8 +820,8 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 
   // Check consistency between OCDB and raw data
   if (fTimeTotal != calibration->GetNumberOfTimeBinsDCS()) {
-    AliError(Form("Number of timebins does not match OCDB value (raw:%d, OCDB:%d)"
-                ,fTimeTotal,calibration->GetNumberOfTimeBinsDCS()));
+    AliError(Form("Number of timebins does not match OCDB value (RAW[%d] OCDB[%d])"
+                ,fTimeTotal,calibration->GetNumberOfTimeBinsDCS()));
   }
 
   // Detector wise calibration object for the gain factors
index c55a584..dc97789 100644 (file)
@@ -154,6 +154,7 @@ AliTRDrecoParam *AliTRDrecoParam::GetLowFluxParam()
   AliTRDrecoParam *rec = new AliTRDrecoParam();
   rec->fkdNchdy = 12.; // pp in TRD
   rec->SetVertexConstrained();
+  rec->SetCheckTimeConsistency();
   return rec;
 
 }
@@ -168,6 +169,7 @@ AliTRDrecoParam *AliTRDrecoParam::GetHighFluxParam()
   AliTRDrecoParam *rec = new AliTRDrecoParam();
   rec->fkdNchdy = 4000.; // PbPb in TRD
   rec->SetVertexConstrained();
+  rec->SetCheckTimeConsistency();
   return rec;
 
 }
@@ -193,7 +195,7 @@ AliTRDrecoParam *AliTRDrecoParam::GetCosmicTestParam()
   par->fkRoadzMultiplicator = 3.;
   par->fADCBaseline = 10;
   par->fStreamLevel[kTracker] = 1;
-  par->SetArgon();
+  par->SetCheckTimeConsistency();
   return par;
 
 }
index 725d173..a24a8bb 100644 (file)
@@ -38,8 +38,9 @@ public:
     kGAUS,
     kClusterSharing,
     kSteerPID,
-    kEightSlices  
-   };
+    kEightSlices,
+    kCheckTimeConsistency
+  };
   AliTRDrecoParam();
   AliTRDrecoParam(const AliTRDrecoParam &rec);
   ~AliTRDrecoParam() { }
@@ -69,19 +70,20 @@ public:
   inline void GetSysCovMatrix(Double_t *sys) const;  
   inline void GetTCParams(Double_t *par) const;
   inline Int_t GetStreamLevel(ETRDReconstructionTask task) const;
-  const TString *GetRawStreamVersion() const  { return &fRawStreamVersion; };
+  const TString *GetRawStreamVersion() const{ return &fRawStreamVersion; };
   Int_t    GetADCBaseline() const           { return fADCBaseline; }
   Double_t GetMinMaxCutSigma() const        { return fMinMaxCutSigma;     };
   Double_t GetMinLeftRightCutSigma() const  { return fMinLeftRightCutSigma;  };
   Double_t GetClusMaxThresh() const         { return fClusMaxThresh;   };
   Double_t GetClusSigThresh() const         { return fClusSigThresh;   };
   Int_t    GetTCnexp() const                { return fTCnexp;          };
-  Int_t    GetNumberOfPresamples()  const   {return fNumberOfPresamples;}
-  Int_t    GetNumberOfPostsamples() const   {return fNumberOfPostsamples;}
-  Bool_t   IsArgon() const { return TESTBIT(fFlags, kDriftGas); }
-  Bool_t   IsXenon() const { return !TESTBIT(fFlags, kDriftGas); }
+  Int_t    GetNumberOfPresamples()  const   { return fNumberOfPresamples;}
+  Int_t    GetNumberOfPostsamples() const   { return fNumberOfPostsamples;}
+  Bool_t   IsArgon() const                  { return TESTBIT(fFlags, kDriftGas); }
+  Bool_t   IsCheckTimeConsistency() const   { return kCheckTimeConsistency;}
+  Bool_t   IsXenon() const                  { return !TESTBIT(fFlags, kDriftGas); }
   Bool_t   IsPIDNeuralNetwork() const       { return TESTBIT(fFlags, kSteerPID);}
-  Bool_t   IsVertexConstrained() const       { return TESTBIT(fFlags, kVertexConstraint); }
+  Bool_t   IsVertexConstrained() const      { return TESTBIT(fFlags, kVertexConstraint); }
   Bool_t   IsEightSlices() const            { return TESTBIT(fFlags, kEightSlices);}
   Bool_t   HasImproveTracklets() const      { return TESTBIT(fFlags, kImproveTracklet);}
   Bool_t   UseClusterSharing() const        { return TESTBIT(fFlags, kClusterSharing);}
@@ -93,15 +95,16 @@ public:
   static   AliTRDrecoParam *GetHighFluxParam();
   static   AliTRDrecoParam *GetCosmicTestParam();
 
-  void     SetArgon()                                         {SETBIT(fFlags, kDriftGas);}
-  void     SetClusterSharing()                                {SETBIT(fFlags, kClusterSharing);}
-  void     SetEightSlices()                                   {SETBIT(fFlags, kEightSlices);}
-  void     SetImproveTracklets()                              {SETBIT(fFlags, kImproveTracklet);}
+  void     SetArgon(Bool_t b = kTRUE)                         {if(b) SETBIT(fFlags, kDriftGas); else CLRBIT(fFlags, kDriftGas);}
+  void     SetCheckTimeConsistency(Bool_t b = kTRUE)          {if(b) SETBIT(fFlags, kCheckTimeConsistency); else CLRBIT(fFlags, kCheckTimeConsistency);}
+  void     SetClusterSharing(Bool_t b = kTRUE)                {if(b) SETBIT(fFlags, kClusterSharing); else CLRBIT(fFlags, kClusterSharing);}
+  void     SetEightSlices(Bool_t b = kTRUE)                   {if(b) SETBIT(fFlags, kEightSlices); else CLRBIT(fFlags, kEightSlices);}
+  void     SetImproveTracklets(Bool_t b = kTRUE)              {if(b) SETBIT(fFlags, kImproveTracklet); else CLRBIT(fFlags, kImproveTracklet);}
   void     SetLUT(Bool_t b=kTRUE)                             {if(b) SETBIT(fFlags, kLUT); else CLRBIT(fFlags, kLUT);}
   void     SetGAUS(Bool_t b=kTRUE)                            {if(b) SETBIT(fFlags, kGAUS); else CLRBIT(fFlags, kGAUS);}
   void     SetPIDNeuralNetwork(Bool_t b=kTRUE)                {if(b) SETBIT(fFlags, kSteerPID); else CLRBIT(fFlags, kSteerPID);}
   void     SetTailCancelation(Bool_t b=kTRUE)                 {if(b) SETBIT(fFlags, kTailCancelation); else CLRBIT(fFlags, kTailCancelation);}
-  void     SetXenon()                                         {CLRBIT(fFlags, kDriftGas);}
+  void     SetXenon(Bool_t b = kTRUE)                         {if(b) CLRBIT(fFlags, kDriftGas); else SETBIT(fFlags, kDriftGas);}
   void     SetVertexConstrained()                             {SETBIT(fFlags, kVertexConstraint);}
   void     SetMaxTheta(Double_t maxTheta)                     {fkMaxTheta = maxTheta;}
   void     SetMaxPhi(Double_t maxPhi)                         {fkMaxPhi = maxPhi;}
index b17bbe6..30922d7 100644 (file)
@@ -49,6 +49,7 @@
 #include "AliTRDrecoParam.h"
 
 #include "AliTRDcluster.h" 
+#include "AliTRDdigitsParam.h"
 #include "AliTRDseedV1.h"
 #include "AliTRDtrackV1.h"
 #include "AliTRDtrackerV1.h"
@@ -112,13 +113,6 @@ AliTRDtrackerV1::AliTRDtrackerV1(AliTRDReconstructor *rec)
     fR[ily] = glb[0]+ AliTRDgeometry::AnodePos()-.5*AliTRDgeometry::AmThick() - AliTRDgeometry::DrThick();
   }
 
-  // initialize calibration values
-  AliTRDcalibDB *trd = NULL;
-  if (!(trd = AliTRDcalibDB::Instance())) {
-    AliFatal("Could not get calibration.");
-  }
-  if(!fgNTimeBins) fgNTimeBins = trd->GetNumberOfTimeBins();
-
   // initialize cluster containers
   for (Int_t isector = 0; isector < AliTRDgeometry::kNsector; isector++) new(&fTrSec[isector]) AliTRDtrackingSector(fGeom, isector);
   
@@ -271,7 +265,8 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event)
 
   AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance(); // Calibration monitor
   if (!calibra) AliInfo("Could not get Calibra instance\n");
-  
+  if(!fgNTimeBins) CookNTimeBins();
+
   // Define scalers
   Int_t nFound   = 0, // number of tracks found
         nSeeds   = 0, // total number of ESD seeds
@@ -2047,6 +2042,33 @@ AliTRDseedV1* AliTRDtrackerV1::SetTracklet(const AliTRDseedV1 * const tracklet)
 }
 
 //____________________________________________________________________
+void AliTRDtrackerV1::CookNTimeBins()
+{ 
+  // Initialize number of time bins
+
+  if(fgNTimeBins){
+    // first look if set by hand
+    AliDebug(2, Form("NTimeBins [%d] (set by user)", fgNTimeBins));
+  } else if(fkReconstructor && fkReconstructor->HasDigitsParam()) {
+    // second look into digits param to avoid DB query
+    fgNTimeBins = fkReconstructor->GetDigitsParam()->GetNTimeBins();
+    AliDebug(2, Form("NTimeBins [%d] (set from digits param)", fgNTimeBins));
+  } else { // third query DB
+    AliTRDcalibDB *trd(NULL);
+    if((trd = AliTRDcalibDB::Instance())) {
+      if((fgNTimeBins = trd->GetNumberOfTimeBinsDCS()) <= 0){
+        AliError("Corrupted DCS Object in OCDB");
+        fgNTimeBins = 24;
+        AliDebug(2, Form("NTimeBins [%d] (set to default)", fgNTimeBins));
+      } else AliDebug(2, Form("NTimeBins [%d] (set from DB)", fgNTimeBins));
+    } else AliFatal("Could not get DB.");
+  }
+  if(fgNTimeBins<=0){
+    AliFatal("Could not get number of time bins.");
+  }
+}
+
+//____________________________________________________________________
 AliTRDtrackV1* AliTRDtrackerV1::SetTrack(const AliTRDtrackV1 * const track)
 {
   // Add this track to the list of tracks stored in the tracker