]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDclusterizer.h
o small fix
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterizer.h
index 0db02de592b30240e25094bfa9fb0b9049f10d52..9b7950b9d374d3a7d88b3173532748c18ecb1d27 100644 (file)
@@ -13,6 +13,8 @@
 
 #include <TNamed.h>
 
+#include "AliTRDgeometry.h"
+
 class TFile;
 class TTree;
 class TClonesArray;
@@ -23,6 +25,7 @@ class AliRawReader;
 class AliTRD;
 class AliTRDcluster;
 
+class AliTRDrawStream;
 class AliTRDarrayADC;
 class AliTRDarraySignal;
 class AliTRDdigitsManager;
@@ -31,6 +34,8 @@ class AliTRDtransform;
 class AliTRDCalROC;
 class AliTRDReconstructor;
 class AliTRDCalSingleChamberStatus;
+class AliTRDrecoParam;
+class AliTRDCalOnlineGainTableROC;
 
 class AliTRDclusterizer : public TNamed 
 {
@@ -38,28 +43,31 @@ class AliTRDclusterizer : public TNamed
  public:
 
   // steering flags
+  // bits from 0-13 are reserved by ROOT (see TObject.h)
   enum{
-    kTrOwner= BIT(13)  //  toggle online tracklets ownership
-   ,kClOwner= BIT(14)  //  toggle cluster ownership
-   ,kLabels = BIT(15)  //  toggle MC labels for clusters
-   ,kHLT    = BIT(16)  //  HLT mode
-   ,kLUT    = BIT(17)  //  using look up table for cluster's r-phi position
-   ,kGAUS   = BIT(18)  //  using gauss approx. for cluster's r-phi position
+    kTrOwner = BIT(14)  //  toggle online tracklets ownership
+    ,kClOwner= BIT(15)  //  toggle cluster ownership
+    ,kLabels = BIT(16)  //  toggle MC labels for clusters
+    ,kSkipTrafo = BIT(17)  //  skip the coordinate transformation of clusters?
+    ,kLUT    = BIT(18)  //  using look up table for cluster's r-phi position
+    ,kGAUS   = BIT(19)  //  using gauss approx. for cluster's r-phi position
+    ,knewDM  = BIT(20)  //  was the digitsmanger created by raw2clusters?
+    ,kTracksOwner = BIT(21) //  toggle GTU track ownership
+    ,kRawSignal = BIT(22) //  toggle storage of raw signals in clusters
   };
 
   struct MaxStruct
   {
-    Int_t       Row;
-    Int_t       Col;
-    Int_t       Time;
-    UChar_t     padStatus;
-    Short_t     Signals[3];
-    Bool_t      FivePad;
-  MaxStruct():Row(-1),Col(0),Time(0),padStatus(0),FivePad(kFALSE)
-      {memset(Signals, 0, 3*sizeof(Short_t));}
+    Int_t       row;           // row of the current cluster candidate
+    Int_t       col;           // col of the current cluster candidate
+    Int_t       time;          // time -"-
+    Float_t     signals[3];    // signals of the maximum pad and it's twon neigbours
+    UChar_t     padStatus;     // padStatus of the current cluster candidate
+    Bool_t      fivePad;       // is this cluster candidate part of a 5 pad cluster (two overlaping clusters)?
+  MaxStruct():row(-1),col(0),time(0),padStatus(0),fivePad(kFALSE)
+      {memset(signals, 0, 3*sizeof(Float_t));}
     MaxStruct &operator=(const MaxStruct &a)
-    {Row=a.Row; Col=a.Col; Time=a.Time; padStatus=a.padStatus; FivePad=a.FivePad;
-     memcpy(Signals, a.Signals, 3*sizeof(Short_t)); return *this;}
+    {memcpy(this, &a, sizeof(MaxStruct)); return *this;}
   };
   
   AliTRDclusterizer(const AliTRDReconstructor *const rec = 0x0);
@@ -73,18 +81,20 @@ class AliTRDclusterizer : public TNamed
   Bool_t   Open(const Char_t *name, Int_t nEvent = 0);
   Bool_t   OpenInput(Int_t nEvent = 0);
   Bool_t   OpenOutput();
-  Bool_t   OpenOutput(TTree *clusterTree);
-  Bool_t   OpenTrackletOutput();
+  Bool_t   OpenOutput(TTree *const clusterTree);
 
   Bool_t   ReadDigits();
   Bool_t   ReadDigits(AliRawReader *rawReader);
   Bool_t   ReadDigits(TTree *digitsTree);
 
+  Bool_t   ReadTracklets();
+  Bool_t   ReadTracks();
+
   Bool_t   WriteClusters(Int_t det);
-  void     ResetRecPoints();
+  void     ResetRecPoints()                { fNoOfClusters = 0;}
   virtual TClonesArray    *RecPoints();
-  TClonesArray    *TrackletsArray();
-  Bool_t   WriteTracklets(Int_t det);
+  virtual TClonesArray    *TrackletsArray(const TString &trkltype = "");
+  virtual TClonesArray    *TracksArray();
 
   Bool_t   Raw2Clusters(AliRawReader *rawReader);
   Bool_t   Raw2ClustersChamber(AliRawReader *rawReader);
@@ -97,69 +107,80 @@ class AliTRDclusterizer : public TNamed
   void     SetRawVersion(const Int_t iver) { fRawVersion = iver; } // set the expected raw data version
   void             SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
   static UChar_t   GetStatus(Short_t &signal);
-  Int_t            GetAddedClusters() {return fNoOfClusters;}
+  Int_t            GetAddedClusters() const {return fNoOfClusters;}
+  Int_t            GetNTimeBins() const {return fTimeTotal;}
 
-  Bool_t   IsClustersOwner() const {return TestBit(kClOwner);}
+  Bool_t           IsClustersOwner() const {return TestBit(kClOwner);}
   virtual void     SetClustersOwner(Bool_t own=kTRUE) {SetBit(kClOwner, own); if(!own) {fRecPoints = 0x0; fNoOfClusters=0;} }
-  void     SetTrackletsOwner(Bool_t own=kTRUE) {SetBit(kTrOwner, own); if(!own) {fTracklets = 0x0; } }
+  void             SetTrackletsOwner(Bool_t own=kTRUE) {SetBit(kTrOwner, own); if(!own) {fTracklets = 0x0; } }
+  void             SetTracksOwner(Bool_t own=kTRUE) {SetBit(kTracksOwner, own); if(!own) {fTracks = 0x0; } }
+  void             SetSkipTransform(Bool_t b=kTRUE) {SetBit(kSkipTrafo, b); }
+  void             SetStoreRawSignals(Bool_t b=kTRUE) {SetBit(kRawSignal, b); }
+
+  UInt_t   GetTriggerFlags(const Int_t sector) const { return fTrgFlags[sector]; }
 
 protected:
 
-  void             DeConvExp (const Double_t *const source, Double_t *const target
-                            ,const Int_t nTimeTotal, const Int_t nexp);
-  void             TailCancelation();
+  void             ApplyTCTM(Short_t *const arr, const Int_t nTime, const Int_t nexp);
+  void             DeConvExp (Short_t *const arr, const Int_t nTime, const Int_t nexp);
+  void             ConvExp(Short_t *const arr, const Int_t nTime);
+  void             TailCancelation(const AliTRDrecoParam* const recoParam);
 
-  Float_t  Unfold(Double_t eps, Int_t layer, Double_t *padSignal) const;
+  Float_t          Unfold(Double_t eps, Int_t layer, const Double_t *const padSignal) const;
   
-  void             SetPadStatus(const UChar_t status, UChar_t &encoding);
+  void             SetPadStatus(const UChar_t status, UChar_t &encoding) const;
   UChar_t          GetPadStatus(UChar_t encoding) const;
   Int_t            GetCorruption(UChar_t encoding) const;
 
-  Bool_t           IsMaximum(const MaxStruct &Max, UChar_t &padStatus, Short_t *const Signals);       //for const correctness reasons not const parameters are given separately
+  Bool_t           IsMaximum(const MaxStruct &Max, UChar_t &padStatus, Float_t *const Signals);       //for const correctness reasons not const parameters are given separately
   Bool_t           FivePadCluster(MaxStruct &ThisMax, MaxStruct &NeighbourMax);
   void             CreateCluster(const MaxStruct &Max); 
-  inline void      CalcAdditionalInfo(const MaxStruct &Max, Short_t *const signals, Int_t &nPadCount);
-  virtual void     AddClusterToArray(AliTRDcluster *cluster);
-  inline void      AddTrackletsToArray();
-
-  const AliTRDReconstructor *fReconstructor; //! reconstructor
-  AliRunLoader        *fRunLoader;           //! Run Loader
-  TTree               *fClusterTree;         //! Tree with the cluster
-  TClonesArray        *fRecPoints;           //! Array of clusters
-  TClonesArray        *fTracklets;           //! Array of online tracklets
-
-  TTree               *fTrackletTree;        //! Tree for tracklets
-
-  AliTRDdigitsManager *fDigitsManager;       //! TRD digits manager
-
-  UInt_t              **fTrackletContainer;  //! tracklet container
-
-  Int_t                fRawVersion;          //  Expected raw version of the data - default is 2
-
-  AliTRDtransform     *fTransform;           //! Transforms the reconstructed space points
-
-  AliTRDarrayADC      *fDigits;               // Array holding the digits
-  AliTRDSignalIndex   *fIndexes;              // Array holding the indexes to the digits
-  Float_t              fADCthresh;            // ADC thresholds: There is no ADC threshold anymore, and simParam should not be used in clusterizer. KO
-  Float_t              fMaxThresh;            // Threshold value for the maximum
-  Float_t              fSigThresh;            // Threshold value for the digit signal
-  Float_t              fMinMaxCutSigma;       // Threshold value for the maximum (cut noise)
-  Float_t              fMinLeftRightCutSigma; // Threshold value for the sum pad (cut noise)
-  Int_t                fLayer;                // Current layer of the detector
-  Int_t                fDet;                  // Current detecor
-  UShort_t             fVolid;                // Volume ID
-  Int_t                fColMax;               // Number of Colums in one detector
-  Int_t                fTimeTotal;            // Number of time bins
-  AliTRDCalROC        *fCalGainFactorROC;     // Calibration object with pad wise values for the gain factors
-  Float_t              fCalGainFactorDetValue;// Calibration value for chamber wise noise
-  AliTRDCalROC        *fCalNoiseROC;          // Calibration object with pad wise values for the noise
-  Float_t              fCalNoiseDetValue;     // Calibration value for chamber wise noise
+
+  virtual void     AddClusterToArray(AliTRDcluster* cluster);
+
+  const AliTRDReconstructor *fReconstructor;     //! reconstructor
+  AliRunLoader        *fRunLoader;                //! Run Loader
+  TTree               *fClusterTree;              //! Tree with the cluster
+  TClonesArray        *fRecPoints;                //! Array of clusters
+  TClonesArray        *fTracklets;                //! Array of online tracklets
+  TClonesArray        *fTracks;                   //! Array of GTU tracks
+
+  AliTRDdigitsManager *fDigitsManager;            //! TRD digits manager
+
+  Int_t                fRawVersion;               //  Expected raw version of the data - default is 2
+
+  AliTRDtransform     *fTransform;                //! Transforms the reconstructed space points
+
+  AliTRDarrayADC      *fDigits;                   // Array holding the digits
+  AliTRDarrayADC      *fDigitsRaw;                // Array holding the raw digits if requested
+  AliTRDSignalIndex   *fIndexes;                  // Array holding the indexes to the digits
+  Float_t              fMaxThresh;                // Threshold value for the maximum
+  Float_t              fMaxThreshTest;            // Threshold value for the maximum to test agains
+  Float_t              fSigThresh;                // Threshold value for the digit signal
+  Float_t              fMinMaxCutSigma;           // Threshold value for the maximum (cut noise)
+  Float_t              fMinLeftRightCutSigma;     // Threshold value for the sum pad (cut noise)
+  Int_t                fLayer;                    // Current layer of the detector
+  Int_t                fDet;                      // Current detecor
+  UShort_t             fVolid;                    // Volume ID
+  Int_t                fColMax;                   // Number of Colums in one detector
+  Int_t                fTimeTotal;                // Number of time bins
+  AliTRDCalROC        *fCalGainFactorROC;         // Calibration object with pad wise values for the gain factors
+  Float_t              fCalGainFactorDetValue;    // Calibration value for chamber wise noise
+  AliTRDCalROC        *fCalNoiseROC;              // Calibration object with pad wise values for the noise
+  Float_t              fCalNoiseDetValue;         // Calibration value for chamber wise noise
   AliTRDCalSingleChamberStatus *fCalPadStatusROC; // Calibration object with the pad status
-  Int_t                fClusterROC;           // The index to the first cluster of a given ROC
-  Int_t                firstClusterROC;       // The number of cluster in a given ROC
-  Int_t                fNoOfClusters;         // Number of Clusters already processed and still owned by the clusterizer
+  AliTRDCalOnlineGainTableROC *fCalOnlGainROC;     // Calibration table of online gain factors
+  Int_t                fClusterROC;               // The index to the first cluster of a given ROC
+  Int_t                firstClusterROC;           // The number of cluster in a given ROC
+  Int_t                fNoOfClusters;             // Number of Clusters already processed and still owned by the clusterizer
+  Int_t                fBaseline;                 // Baseline of the ADC values
+  AliTRDrawStream     *fRawStream;                // Raw data streamer
+  UInt_t               fTrgFlags[AliTRDgeometry::kNsector]; // trigger flags
+
+private:
+  inline void      CalcAdditionalInfo(const MaxStruct &Max, Short_t *const signals, Int_t &nPadCount);
 
-  ClassDef(AliTRDclusterizer,6)               //  TRD clusterfinder
+  ClassDef(AliTRDclusterizer,6)                   //  TRD clusterfinder
 
 };