]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Introduce new NtimeBin consistency checks
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Feb 2010 17:17:15 +0000 (17:17 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Feb 2010 17:17:15 +0000 (17:17 +0000)
TRD/AliTRDReconstructor.cxx
TRD/AliTRDReconstructor.h
TRD/AliTRDcalibDB.cxx
TRD/AliTRDclusterizer.cxx
TRD/AliTRDrecoParam.cxx
TRD/AliTRDrecoParam.h
TRD/AliTRDtrackerV1.cxx
TRD/AliTRDtrackerV1.h

index c33a29b9a4ef0cd60fcdc2d1fec81aef8d92e823..d151c8aeae71b87900eb1503342d4d3c0f6c84c5 100644 (file)
@@ -71,6 +71,7 @@ Char_t const * AliTRDReconstructor::fgTaskFlags[AliTRDrecoParam::kTRDreconstruct
  ,"tr"
  ,"pd"
 };
+Int_t AliTRDReconstructor::fgNTimeBins = -1;
 
 //_____________________________________________________________________________
 AliTRDReconstructor::AliTRDReconstructor()
@@ -189,6 +190,8 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
   // take over ownership of online tracklets
   fgTracklets = clusterer.TrackletsArray();
   clusterer.SetTrackletsOwner(kFALSE);
+
+  fgNTimeBins = clusterer.GetNTimeBins();
 }
 
 //_____________________________________________________________________________
@@ -216,6 +219,8 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree
   // take over ownership of online tracklets
   fgTracklets = clusterer.TrackletsArray();
   clusterer.SetTrackletsOwner(kFALSE);
+
+  fgNTimeBins = clusterer.GetNTimeBins();
 }
 
 //_____________________________________________________________________________
index 2d6e47498ea827320982d61f98235f9848ab663a..01c97b424c34f0d5d66b52ef5bb4e823948acc22 100644 (file)
@@ -48,6 +48,7 @@ public:
   virtual void        FillESD(TTree *digitsTree, TTree *clusterTree, AliESDEvent *esd) const;
   static TClonesArray* GetClusters() {return fgClusters;}
   static TClonesArray* GetTracklets() {return fgTracklets;}
+  static Int_t        GetNTimeBins() {return fgNTimeBins;}
   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;}
@@ -85,6 +86,7 @@ private:
   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
+  static Int_t         fgNTimeBins;   // number of time bins as given by the clusterizer
 
   ClassDef(AliTRDReconstructor, 2)    //  Class for the TRD reconstruction
 
index 92ed2bc23137f16f6db27663136b9a3735b749e5..f4e20a25f9fc6175d0cd7a12204525744191dc81 100644 (file)
@@ -743,50 +743,52 @@ Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
   // Returns Number of time bins from the DCS
   //
 
+  Int_t nMixed = -2; // not the same number for all chambers
+  Int_t nUndef = -1; // default value - has not been set!
+  Int_t nTbSor = nUndef;
+  Int_t nTbEor = nUndef;
+
   const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
 
-  if(!dcsArr){
-    printf("No DCS Object found\n");
-    //return -1;
-    return 30;
+  if (!dcsArr) {
+    AliError("No DCS object found!");
+    return nUndef;
   }
-  const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0)); // Take SOR
+
+  const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0));
   const AliTRDCalDCS *calDCSeor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1));
 
-  // prefer SOR
-  if(!calDCSsor){
-    if(!calDCSeor){
-      printf("No calDCSeor found\n");
-      //return -1;
-      return 30;
+  if (!calDCSsor) {
+    // the SOR file is mandatory
+    AliError("NO SOR AliTRDCalDCS object found in CDB file!");
+    return nUndef;
     }
-    if(calDCSeor->GetGlobalNumberOfTimeBins() > 0) return calDCSeor->GetGlobalNumberOfTimeBins();
-    else return 30;
-  }
-  // if SOR is available and the number of timebins is > -1, take this, otherwise check EOR
-  Int_t nTimeSOR = calDCSsor->GetGlobalNumberOfTimeBins();
-  if(nTimeSOR > -1){
-    // Make a consistency check
-    if(calDCSeor){
-      Int_t nTimeEOR = calDCSeor->GetGlobalNumberOfTimeBins();
-      if((nTimeEOR > -1) && (nTimeSOR != nTimeEOR)){
-        // Parameter inconsistency found, return -2 to be able to catch the error
-        //return -2;
-       printf("Inconsistency\n");
-       return 30;
-      }
-    }
-    // Consisency check passed or not done
-    if(nTimeSOR > 0.0) return nTimeSOR;
-    else return 30;
-  } else {
-    // SOR has unphysical time parameter, take EOR
-    if(calDCSeor) {
-     if(calDCSeor->GetGlobalNumberOfTimeBins() > 0) return calDCSeor->GetGlobalNumberOfTimeBins(); 
-     else return 30;
+
+  if (!calDCSeor) {
+    // this can happen if the run is shorter than a couple of seconds.
+    AliWarning("NO EOR AliTRDCalDCS object found in CDB file.");
     }
-    return 30;  // Both SOR and EOR not available
+
+  // get the numbers
+  nTbSor = calDCSsor->GetGlobalNumberOfTimeBins();
+  if (calDCSeor) nTbEor = calDCSeor->GetGlobalNumberOfTimeBins();
+
+  // if they're the same return the value
+  // -2 means mixed, -1: no data, >= 0: good number of time bins
+  if (nTbSor == nTbEor) return nTbSor;
+
+  // if they're differing:
+  if (nTbSor == nMixed || nTbEor == nMixed) {
+    AliWarning("Inconsistent number of time bins found!");
+    return nMixed;
   }
+  
+  // one is undefined, the other ok -> return that one
+  if (nTbSor == nUndef) return nTbEor;
+  if (nTbEor == nUndef) return nTbSor;
+
+  // only remains: two different numbers >= 0
+  return nMixed;
 }
 
 //_____________________________________________________________________________
index 0df14d4692b271a6bc9cdd26342620f94210bf42..1d215d4968b7034088e8b931cd5377d6a86f06e4 100644 (file)
@@ -667,7 +667,9 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
   else
     fRawStream->SetReader(rawReader);
 
-  if(fReconstructor->IsHLT()){
+  SetBit(kHLT, fReconstructor->IsHLT());
+
+  if(TestBit(kHLT)){
     fRawStream->SetSharedPadReadout(kFALSE);
     fRawStream->SetNoErrorWarning();
   }
@@ -676,10 +678,8 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
   
   Int_t det    = 0;
   while ((det = fRawStream->NextChamber(fDigitsManager,fTrackletContainer)) >= 0){
-    Bool_t iclusterBranch = kFALSE;
-    if (fDigitsManager->GetIndexes(det)->HasEntry()){
-      iclusterBranch = MakeClusters(det);
-    }
+    if (fDigitsManager->GetIndexes(det)->HasEntry())
+      MakeClusters(det);
 
     fDigitsManager->ClearArrays(det);
 
@@ -786,7 +786,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
     return kFALSE;
   }
 
-  const AliTRDrecoParamconst recoParam = fReconstructor->GetRecoParam();
+  const AliTRDrecoParam *const recoParam = fReconstructor->GetRecoParam();
 
   fMaxThresh            = recoParam->GetClusMaxThresh();
   fSigThresh            = recoParam->GetClusSigThresh();
@@ -823,10 +823,26 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 
   // Check consistency between OCDB and raw data
   Int_t nTimeOCDB = calibration->GetNumberOfTimeBinsDCS();
-  if ((nTimeOCDB  >         -1) &&
-      (fTimeTotal != nTimeOCDB)) {
-    AliError(Form("Number of timebins does not match OCDB value (RAW[%d] OCDB[%d])"
-                ,fTimeTotal,calibration->GetNumberOfTimeBinsDCS()));
+  if(TestBit(kHLT)){
+    if((nTimeOCDB > -1) && (fTimeTotal != nTimeOCDB)){
+      AliWarning(Form("Number of timebins does not match OCDB value (RAW[%d] OCDB[%d]), using raw value"
+                     ,fTimeTotal,nTimeOCDB));
+    }
+  }else{
+    if(nTimeOCDB == -1){
+      AliWarning("Undefined number of timebins in OCDB, using value from raw data.");
+      if(!fTimeTotal>0){
+       AliError("Number of timebins in raw data is negative, skipping chamber!");
+       return kFALSE;
+      }
+    }else if(nTimeOCDB == -2){
+      AliError("Mixed number of timebins in OCDB, no reconstruction of TRD data!"); 
+      return kFALSE;
+    }else if(fTimeTotal != nTimeOCDB){
+      AliError(Form("Number of timebins in raw data does not match OCDB value (RAW[%d] OCDB[%d]), skipping chamber!"
+                   ,fTimeTotal,nTimeOCDB));
+      return kFALSE;
+    }
   }
 
   // Detector wise calibration object for the gain factors
@@ -846,13 +862,12 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   // Calibration object with the pad status
   fCalPadStatusROC       = calibration->GetPadStatusROC(fDet);
 
-  SetBit(kLUT, recoParam->UseLUT());
-  SetBit(kGAUS, recoParam->UseGAUS());
-  SetBit(kHLT, fReconstructor->IsHLT());
-  
   firstClusterROC = -1;
   fClusterROC     =  0;
 
+  SetBit(kLUT, recoParam->UseLUT());
+  SetBit(kGAUS, recoParam->UseGAUS());
+
   // Apply the gain and the tail cancelation via digital filter
   if(recoParam->UseTailCancelation()) TailCancelation(recoParam);
 
index 89c7d196613c272358fbec0952a227bedd8e9863..f868a602d7a78aba57599ecbfc98897af7344acd 100644 (file)
@@ -59,7 +59,6 @@ AliTRDrecoParam::AliTRDrecoParam()
   ,fkTrackLikelihood(-15.)
   ,fFlags(0)
   ,fRawStreamVersion("REAL")
-  ,fADCBaseline(0)
   ,fMinMaxCutSigma(4.)
   ,fMinLeftRightCutSigma(8.)
   ,fClusMaxThresh(4.5)
@@ -126,7 +125,6 @@ AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
   ,fkTrackLikelihood(ref.fkTrackLikelihood)
   ,fFlags(ref.fFlags)
   ,fRawStreamVersion(ref.fRawStreamVersion)
-  ,fADCBaseline(ref.fADCBaseline)
   ,fMinMaxCutSigma(ref.fMinMaxCutSigma)
   ,fMinLeftRightCutSigma(ref.fMinLeftRightCutSigma)
   ,fClusMaxThresh(ref.fClusMaxThresh)
@@ -193,7 +191,6 @@ AliTRDrecoParam *AliTRDrecoParam::GetCosmicTestParam()
   par->fkNMeanClusters  = 12.89;
   par->fkNSigmaClusters = 2.095;
   par->fkRoadzMultiplicator = 3.;
-  par->fADCBaseline = 10;
   par->fStreamLevel[kTracker] = 1;
   par->SetCheckTimeConsistency();
   return par;
index 4667bdd9895d76932898f4d8ac5c75e6301623d1..a33716bb67cde0bca58575d76e0d80bc0ccc4008 100644 (file)
@@ -73,7 +73,6 @@ public:
   inline void GetTCParams(Double_t *par) const;
   inline Int_t GetStreamLevel(ETRDReconstructionTask task) const;
   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;   };
@@ -122,7 +121,6 @@ public:
   void     SetNSigmaClusters(Double_t sigmaNclusters)         {fkNSigmaClusters = sigmaNclusters;} 
   void     SetRawStreamVersion(const Char_t *version)         {fRawStreamVersion = version; }
   void     SetRoadzMultiplicator(Double_t mult)               {fkRoadzMultiplicator = mult; } 
-  void     SetADCBaseline(Int_t baseline)                     { fADCBaseline = baseline; }
   void     SetMinMaxCutSigma(Float_t minMaxCutSigma)          { fMinMaxCutSigma   = minMaxCutSigma; }
   void     SetMinLeftRightCutSigma(Float_t minLeftRightCutSigma) { fMinLeftRightCutSigma   = minLeftRightCutSigma; };
   void     SetClusMaxThresh(Float_t thresh)                   { fClusMaxThresh   = thresh; };
@@ -174,7 +172,6 @@ private:
   
   // Raw Reader Params
   TString   fRawStreamVersion;       // Raw Reader version
-  Int_t     fADCBaseline;            // ADC Baseline
 
   // Clusterization parameter
   Double_t  fMinMaxCutSigma;         // Threshold sigma noise pad middle
index ba28453b5720ef7acbb4b2138d8a66d24902f367..537468d45c8dfdc30ea37977a7d0668af4800626 100644 (file)
@@ -275,7 +275,7 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event)
   }
   AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance(); // Calibration monitor
   if (!calibra) AliInfo("Could not get Calibra instance");
-  if(!fgNTimeBins) CookNTimeBins();
+  if (!fgNTimeBins) fgNTimeBins = fkReconstructor->GetNTimeBins(); 
 
   // Define scalers
   Int_t nFound   = 0, // number of tracks found
@@ -2089,38 +2089,6 @@ AliTRDseedV1* AliTRDtrackerV1::SetTracklet(const AliTRDseedV1 * const tracklet)
   return new ((*fTracklets)[nentries]) AliTRDseedV1(*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();
-    if(fgNTimeBins>0) AliDebug(2, Form("NTimeBins [%d] (set from digits param)", fgNTimeBins));
-    else AliWarning(Form("NTimeBins [%d] failed from digits param.", fgNTimeBins));
-  }
-
-  if(!fgNTimeBins){ // 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 24)", fgNTimeBins));
-      } else AliDebug(2, Form("NTimeBins [%d] (set from DB)", fgNTimeBins));
-    } else AliFatal("Could not get DB.");
-  }
-
-  if(fgNTimeBins<=0){
-    AliError("NTimeBins failed all settings. Use default 24 !");
-    fgNTimeBins = 24;
-  }
-}
-
 //____________________________________________________________________
 AliTRDtrackV1* AliTRDtrackerV1::SetTrack(const AliTRDtrackV1 * const track)
 {
index 4a8966264a9fadb6a12da5c78aaaa4c7c32895ce..2eb32ffbc8413f0dbb83d37011e6f22c3aada30c 100644 (file)
@@ -191,7 +191,6 @@ private:
   AliTRDtrackerV1(const AliTRDtrackerV1 &tracker);
   AliTRDtrackerV1 &operator=(const AliTRDtrackerV1 &tracker);
   Double_t       CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]);
-  void           CookNTimeBins();
   Double_t       CalculateTrackLikelihood(const AliTRDseedV1 *const tracklets, Double_t *chi2);
   Int_t                ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRDseedV1 *tracklet);
   static Float_t       CalculateReferenceX(const AliTRDseedV1 *const tracklets);