Interface for RecoParam to OCDB
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Jun 2008 11:45:48 +0000 (11:45 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Jun 2008 11:45:48 +0000 (11:45 +0000)
TRD/AliTRDReconstructor.cxx
TRD/AliTRDcalibDB.cxx
TRD/AliTRDcalibDB.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDrecoParam.cxx
TRD/AliTRDrecoParam.h
TRD/AliTRDtracker.cxx
TRD/AliTRDtrackerV1.cxx

index 8f39bb9..fb50601 100644 (file)
@@ -80,8 +80,6 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
 
   AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]");
 
-       // TODO move it to rec.C. check TPC
-       if (!fgRecoParam) fgRecoParam = AliTRDrecoParam::GetLowFluxParam();
 
   rawReader->Reset();
   rawReader->Select("TRD");
@@ -104,9 +102,6 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree
 
   AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]");
 
-       // TODO move it to rec.C. check TPC
-  if (!fgRecoParam) fgRecoParam = AliTRDrecoParam::GetLowFluxParam();
-
   AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
   clusterer.OpenOutput(clusterTree);
   clusterer.ReadDigits(digitsTree);
@@ -123,8 +118,6 @@ AliTracker *AliTRDReconstructor::CreateTracker() const
 
   //return new AliTRDtracker(NULL);
 
-       // TODO move it to rec.C. check TPC
-       if (!fgRecoParam) fgRecoParam = AliTRDrecoParam::GetLowFluxParam();
   return new AliTRDtrackerV1();
 
 }
index 4eff278..aca1e45 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <TMath.h>
 #include <TRandom.h>
+#include <TClonesArray.h>
 
 #include "AliCDBManager.h"
 #include "AliCDBStorage.h"
@@ -37,6 +38,7 @@
 #include "AliLog.h"
 
 #include "AliTRDcalibDB.h"
+#include "AliTRDrecoParam.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDpadPlane.h"
 #include "AliTRDCommonParam.h"
@@ -256,6 +258,9 @@ const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
     case kIDPIDLQ : 
       return CacheCDBEntry(kIDPIDLQ             ,"TRD/Calib/PIDLQ"); 
       break;
+    case kIDRecoParam : 
+      return CacheCDBEntry(kIDRecoParam             ,"TRD/Calib/RecoParam"); 
+      break;
 
   }
 
@@ -272,7 +277,7 @@ AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
     
   AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
   if (!entry) { 
-    AliFatal(Form("Failed to get entry: %s",cdbPath));
+    AliError(Form("Failed to get entry: %s",cdbPath));
     return 0; 
   }
   
@@ -814,6 +819,18 @@ Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
 }
 
 //_____________________________________________________________________________
+AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
+{
+  const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
+  if(!recos) return 0x0;
+
+  // calculate entry based on event type info
+  Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
+  return (AliTRDrecoParam*)recos->UncheckedAt(n);
+}
+
+
+//_____________________________________________________________________________
 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
 {
   //
index 9942ea2..399eca0 100644 (file)
@@ -73,6 +73,7 @@ class AliTRDcalibDB : public TObject {
 
   Char_t                              GetPadStatus(Int_t det, Int_t col, Int_t row);
   AliTRDCalSingleChamberStatus       *GetPadStatusROC(Int_t det);
+  AliTRDrecoParam*                    GetRecoParam(Int_t *eventtype);
 
   Char_t                              GetChamberStatus(Int_t det);
 
@@ -95,7 +96,7 @@ class AliTRDcalibDB : public TObject {
  protected:
 
   // For caching see also implentation of GetCachedCDBObject in the .cxx file
-  enum { kCDBCacheSize = 18 };   // Number of cached objects
+  enum { kCDBCacheSize = 19 };   // Number of cached objects
   enum { kIDVdriftPad = 0
        , kIDVdriftChamber
        , kIDT0Pad
@@ -111,6 +112,7 @@ class AliTRDcalibDB : public TObject {
        , kIDSuperModulePos
        , kIDPIDNN
        , kIDPIDLQ
+       , kIDRecoParam
        , kIDMonitoringData
        , kIDChamberStatus
        , kIDPadStatus };         // IDs of cached objects
@@ -145,7 +147,7 @@ class AliTRDcalibDB : public TObject {
   AliTRDcalibDB &operator=(const AliTRDcalibDB &c); 
   virtual ~AliTRDcalibDB();
 
-  ClassDef(AliTRDcalibDB,3)                         //  Provides central access to the CDB
+  ClassDef(AliTRDcalibDB, 4)                         //  Provides central access to the CDB
 
 };
 
index 5ba62ac..8c497be 100644 (file)
@@ -77,8 +77,22 @@ AliTRDclusterizer::AliTRDclusterizer()
   // AliTRDclusterizer default constructor
   //
 
+  AliTRDcalibDB *trd = 0x0;
+  if (!(trd = AliTRDcalibDB::Instance())) {
+    AliFatal("Could not get calibration object");
+  }
+
   fRawVersion = AliTRDfeeParam::Instance()->GetRAWversion();
 
+  // retrive reco params
+  AliTRDrecoParam *rec = 0x0;
+  if (!(rec = AliTRDReconstructor::RecoParam())){
+    if(!(rec = trd->GetRecoParam(0))){
+      AliInfo("Using default RecoParams =  LowFluxParam.");
+      rec = AliTRDrecoParam::GetLowFluxParam();    
+    }
+    AliTRDReconstructor::SetRecoParam(rec);
+  }
 }
 
 //_____________________________________________________________________________
@@ -100,12 +114,26 @@ AliTRDclusterizer::AliTRDclusterizer(const Text_t *name, const Text_t *title)
   // AliTRDclusterizer constructor
   //
 
+  AliTRDcalibDB *trd = 0x0;
+  if (!(trd = AliTRDcalibDB::Instance())) {
+    AliFatal("Could not get calibration object");
+  }
+
+  // retrive reco params
+  AliTRDrecoParam *rec = 0x0;
+  if (!(rec = AliTRDReconstructor::RecoParam())){
+    if(!(rec = trd->GetRecoParam(0))){
+      AliInfo("Using default RecoParams =  LowFluxParam.");
+      rec = AliTRDrecoParam::GetLowFluxParam();    
+    }
+    AliTRDReconstructor::SetRecoParam(rec);
+  }
+
   fDigitsManager->CreateArrays();
 
   fRawVersion = AliTRDfeeParam::Instance()->GetRAWversion();
 
   FillLUT();
-
 }
 
 //_____________________________________________________________________________
@@ -862,7 +890,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 
         // The position of the cluster in COL direction relative to the center pad (pad units)
         Double_t clusterPosCol = 0.0;
-        if (AliTRDReconstructor::RecoParam()->LUTOn()) {
+        if (AliTRDReconstructor::RecoParam()->IsLUT()) {
           // Calculate the position of the cluster by using the
           // lookup table method
           clusterPosCol = LUTposition(ilayer,clusterSignal[0]
@@ -1172,7 +1200,7 @@ void AliTRDclusterizer::TailCancelation(AliTRDdataArrayDigits *digitsIn
        {
          // Apply the tail cancelation via the digital filter
          // (only for non-coorupted pads)
-         if (AliTRDReconstructor::RecoParam()->TCOn()) 
+         if (AliTRDReconstructor::RecoParam()->IsTailCancelation()) 
            {
              DeConvExp(inADC,outADC,nTimeTotal,AliTRDReconstructor::RecoParam()->GetTCnexp());
            }
index 9ba7450..5e261de 100644 (file)
@@ -33,7 +33,6 @@ ClassImp(AliTRDrecoParam)
 //______________________________________________________________
 AliTRDrecoParam::AliTRDrecoParam()
   :AliDetectorRecoParam()
-  ,fkClusterSharing(0)
   ,fkPIDMethod(kLQPID) // LQ PID
   ,fkMaxTheta(1.0)
   ,fkMaxPhi(2.0)
@@ -49,20 +48,22 @@ AliTRDrecoParam::AliTRDrecoParam()
   ,fkChi2Y(.25)
   ,fkTrackLikelihood(-15.)
   ,fkStreamLevel(0)
-  ,fSeedingOn(kFALSE)
-  ,fVertexConstrained(kTRUE)
   ,fMinMaxCutSigma(4.)
   ,fMinLeftRightCutSigma(8.)
   ,fClusMaxThresh(4.5)
   ,fClusSigThresh(3.5)
-  ,fLUTOn(kTRUE)
-  ,fTCOn(kTRUE)
   ,fTCnexp(1)
   ,fADCbaseline(0)
 {
   //
   // Default constructor
   //
+  SetClusterSharing(kFALSE);
+  SetSeeding(kFALSE);
+  SetVertexConstrained();
+  SetLUT();
+  SetTailCancelation();
+
   fSysCovMatrix[0] = 1.; // y direction (1 cm)
   fSysCovMatrix[1] = 1.; // z direction (1 cm)
   fSysCovMatrix[2] = 0.; // snp
@@ -71,6 +72,43 @@ AliTRDrecoParam::AliTRDrecoParam()
 }
 
 //______________________________________________________________
+AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
+  :AliDetectorRecoParam(ref)
+  ,fkPIDMethod(ref.fkPIDMethod)
+  ,fkMaxTheta(ref.fkMaxTheta)
+  ,fkMaxPhi(ref.fkMaxPhi)
+  ,fkRoad0y(ref.fkRoad0y)
+  ,fkRoad0z(ref.fkRoad0z) 
+  ,fkRoad1y(ref.fkRoad1y)
+  ,fkRoad1z(ref.fkRoad1z)      
+  ,fkRoad2y(ref.fkRoad2y)
+  ,fkRoad2z(ref.fkRoad2z)
+  ,fkPlaneQualityThreshold(ref.fkPlaneQualityThreshold)
+  ,fkFindable(ref.fkFindable)
+  ,fkChi2Z(ref.fkChi2Z)
+  ,fkChi2Y(ref.fkChi2Y)
+  ,fkTrackLikelihood(ref.fkTrackLikelihood)
+  ,fkStreamLevel(ref.fkStreamLevel)
+  ,fMinMaxCutSigma(ref.fMinMaxCutSigma)
+  ,fMinLeftRightCutSigma(ref.fMinLeftRightCutSigma)
+  ,fClusMaxThresh(ref.fClusMaxThresh)
+  ,fClusSigThresh(ref.fClusSigThresh)
+  ,fTCnexp(ref.fTCnexp)
+  ,fADCbaseline(ref.fADCbaseline)
+{
+  //
+  // Copy constructor
+  //
+  SetClusterSharing(ref.IsClusterSharing());
+  SetSeeding(ref.IsSeeding());
+  SetVertexConstrained(ref.IsVertexConstrained());
+  SetLUT(ref.IsLUT());
+  SetTailCancelation(ref.IsTailCancelation());
+
+  memcpy(fSysCovMatrix, ref.fSysCovMatrix, 5*sizeof(Double_t));
+}
+
+//______________________________________________________________
 AliTRDrecoParam *AliTRDrecoParam::GetLowFluxParam()
 {
   //
@@ -102,8 +140,8 @@ AliTRDrecoParam *AliTRDrecoParam::GetCosmicTestParam()
   AliTRDrawStreamBase::SetRawStreamVersion("TB");
   AliTRDrecoParam *par = new AliTRDrecoParam();
   par->SetADCbaseline(10);
-  par->SetSeedingOn(kTRUE);
-  par->SetVertexConstrained(kTRUE);
+  par->SetSeeding();
+  par->SetVertexConstrained();
   return par;
 
 }
index 4d957c0..a12024a 100644 (file)
@@ -24,11 +24,12 @@ public:
   };
   
   AliTRDrecoParam();
+  AliTRDrecoParam(const AliTRDrecoParam &rec);
   ~AliTRDrecoParam() { }
 
+  Int_t    GetADCbaseline() const           { return fADCbaseline;     };
   Double_t GetChi2Y() const                 { return fkChi2Y;    }
   Double_t GetChi2Z() const                 { return fkChi2Z;    }
-  Bool_t   GetClusterSharing() const        { return fkClusterSharing;}
   Double_t GetFindableClusters() const      { return fkFindable; }
   Double_t GetMaxTheta() const              { return fkMaxTheta; }
   Double_t GetMaxPhi() const                { return fkMaxPhi;   }
@@ -43,49 +44,54 @@ public:
   Double_t GetRoad2z() const                { return fkRoad2z;   }
   Double_t GetTrackLikelihood() const       { return fkTrackLikelihood;       }
   Int_t    GetStreamLevel() const           { return fkStreamLevel;           }
-  inline void GetSysCovMatrix(Double_t *sys);
-
-  Bool_t   IsVertexConstrained() const      { return fVertexConstrained; }
-  
+  inline void GetSysCovMatrix(Double_t *sys);  
   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;          };
-  Bool_t   LUTOn() const                    { return fLUTOn;           };
-  Bool_t   TCOn() const                     { return fTCOn;            };
 
-  Int_t    GetADCbaseline() const           { return fADCbaseline;     };
         
   static   AliTRDrecoParam *GetLowFluxParam();
   static   AliTRDrecoParam *GetHighFluxParam();
   static   AliTRDrecoParam *GetCosmicTestParam();
 
-  void     SetClusterSharing(Bool_t share = kTRUE)            { fkClusterSharing = share;  };
+  Bool_t   IsClusterSharing() const         { return TestBit(kClusterSharing);}
+  Bool_t   IsLUT() const                    { return TestBit(kLUT);}
+  Bool_t   IsSeeding() const                { return TestBit(kSeeding); }
+  Bool_t   IsTailCancelation() const        { return TestBit(kTC);}
+  Bool_t   IsVertexConstrained() const      { return TestBit(kVertexConstrained); }
+
+
+  void     SetClusterSharing(Bool_t share = kTRUE)            { SetBit(kClusterSharing, share);  };
   void     SetPIDMethod(AliTRDpidMethod pid)                  { fkPIDMethod = pid; };
-  void     SetSeedingOn(Bool_t seedingOn = kTRUE)             { fSeedingOn = seedingOn; }
-  void     SetVertexConstrained(Bool_t vertexConstrained = kTRUE) { fVertexConstrained = vertexConstrained; }
+  void     SetSeeding(Bool_t so = kTRUE)             { SetBit(kSeeding, so); }
+  void     SetVertexConstrained(Bool_t vc = kTRUE) { SetBit(kVertexConstrained, vc); }
   void     SetStreamLevel(Int_t streamLevel= 1)               { fkStreamLevel = streamLevel; }
-  void     SetLUT(Int_t lutOn = 1)                            { fLUTOn           = lutOn;  };
+  void     SetLUT(Bool_t lut = kTRUE)                            { SetBit(kLUT, lut);};
   void     SetMinMaxCutSigma(Float_t minMaxCutSigma)          { fMinMaxCutSigma   = minMaxCutSigma; };
   void     SetMinLeftRightCutSigma(Float_t minLeftRightCutSigma) { fMinLeftRightCutSigma   = minLeftRightCutSigma; };
   void     SetClusMaxThresh(Float_t thresh)                   { fClusMaxThresh   = thresh; };
   void     SetClusSigThresh(Float_t thresh)                   { fClusSigThresh   = thresh; };
-  void     SetTailCancelation(Int_t tcOn = 1)                 { fTCOn            = tcOn;   };
+  void     SetTailCancelation(Bool_t tc = kTRUE)                 { SetBit(kTC, tc);  };
   void     SetNexponential(Int_t nexp)                        { fTCnexp          = nexp;   };
   void     SetADCbaseline(Int_t base)                         { fADCbaseline     = base;   };
-  Bool_t   SeedingOn() const                { return fSeedingOn; }
   inline void SetSysCovMatrix(Double_t *sys);
 
 private:
   enum{
-    kNNslices = 8,
-    kLQslices = 3
+    kNNslices = 8
+   ,kLQslices = 3
   };
   
+  enum{
+    kClusterSharing    = 1 // Toggle cluster sharing
+   ,kSeeding           = 2 // Do stand alone tracking in the TRD
+   ,kVertexConstrained = 3 // Perform vertex constrained fit
+   ,kLUT               = 4 // 
+   ,kTC                = 5 // tail cancelation
+  };
 
-  // Tracking parameters
-  Bool_t    fkClusterSharing;        // Toggle cluster sharing
   AliTRDpidMethod fkPIDMethod;       // PID method selector 0(LQ) 1(NN)
   Double_t  fkMaxTheta;              // Maximum theta
   Double_t  fkMaxPhi;                // Maximum phi
@@ -106,17 +112,13 @@ private:
   Double_t  fkTrackLikelihood;       // Track likelihood for tracklets Rieman fit
   Int_t     fkStreamLevel;                                      // Streaming Level in TRD Reconstruction
   
-  Bool_t    fSeedingOn;                     // Do stand alone tracking in the TRD
-  Bool_t    fVertexConstrained;      // Perform vertex constrained fit
   Double_t  fSysCovMatrix[5];        // Systematic uncertainty from calibration and alignment for each tracklet
 
-        // Clusterization parameter
+  // Clusterization parameter
   Double_t  fMinMaxCutSigma;         // Threshold sigma noise pad middle
   Double_t  fMinLeftRightCutSigma;   // Threshold sigma noise sum pad
   Double_t  fClusMaxThresh;          // Threshold value for cluster maximum
   Double_t  fClusSigThresh;          // Threshold value for cluster signal
-  Int_t     fLUTOn;                  // Switch for the lookup table method  
-  Int_t     fTCOn;                   // Switch for the tail cancelation
   Int_t     fTCnexp;                 // Number of exponentials, digital filter
   
   // ADC parameter
index c96f59b..3d9461f 100644 (file)
@@ -418,7 +418,7 @@ Int_t AliTRDtracker::PropagateBack(AliESDEvent *event)
        Int_t    nSeed   = event->GetNumberOfTracks();
        if(!nSeed){
                // run stand alone tracking
-               if (AliTRDReconstructor::RecoParam()->SeedingOn()) Clusters2Tracks(event);
+               if (AliTRDReconstructor::RecoParam()->IsSeeding()) Clusters2Tracks(event);
                return 0;
        }
        
index c30d66e..692d9d8 100644 (file)
@@ -91,20 +91,27 @@ AliTRDtrackerV1::AliTRDtrackerV1()
   //
   // Default constructor.
   // 
-  if (!AliTRDcalibDB::Instance()) {
+  AliTRDcalibDB *trd = 0x0;
+  if (!(trd = AliTRDcalibDB::Instance())) {
     AliFatal("Could not get calibration object");
   }
-  if(!fgNTimeBins) fgNTimeBins = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
+
+  if(!fgNTimeBins) fgNTimeBins = trd->GetNumberOfTimeBins();
 
   for (Int_t isector = 0; isector < AliTRDgeometry::kNsector; isector++) new(&fTrSec[isector]) AliTRDtrackingSector(fGeom, isector);
 
-  if (!AliTRDReconstructor::RecoParam()){
-       AliWarning("RecoParams not set in AliTRDReconstructor. Setting to default LowFluxParam.");
-    AliTRDReconstructor::SetRecoParam(AliTRDrecoParam::GetLowFluxParam());
+  // retrive reco params
+  AliTRDrecoParam *rec = 0x0;
+  if (!(rec = AliTRDReconstructor::RecoParam())){
+    if(!(rec = trd->GetRecoParam(0))){
+      AliInfo("Using default RecoParams =  LowFluxParam.");
+      rec = AliTRDrecoParam::GetLowFluxParam();    
+    }
+    AliTRDReconstructor::SetRecoParam(rec);
   }
   
 
-  if(AliTRDReconstructor::RecoParam()->GetStreamLevel() > 1){
+  if(rec->GetStreamLevel() > 1){
     TDirectory *savedir = gDirectory; 
     fgDebugStreamer    = new TTreeSRedirector("TRD.TrackerDebug.root");
     savedir->cd();
@@ -258,7 +265,7 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event)
   Int_t    nSeed   = event->GetNumberOfTracks();
   if(!nSeed){
     // run stand alone tracking
-    if (AliTRDReconstructor::RecoParam()->SeedingOn()) Clusters2Tracks(event);
+    if (AliTRDReconstructor::RecoParam()->IsSeeding()) Clusters2Tracks(event);
     return 0;
   }