Add a protection againts runs with missing DCS information in the OCDB
[u/mrichter/AliRoot.git] / TRD / AliTRDReconstructor.h
1 #ifndef ALITRDRECONSTRUCTOR_H
2 #define ALITRDRECONSTRUCTOR_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 //                                                                           //
10 // Class for TRD reconstruction                                              //
11 //                                                                           //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include "AliReconstructor.h"
15 #include "AliRecoParam.h"
16 #include "AliDetectorRecoParam.h"
17 #include "AliTRDpidUtil.h"
18 #include "AliTRDrecoParam.h"
19 #include "AliTRDdigitsParam.h"
20 #include "AliESDTrdTrigger.h"
21
22 class TClonesArray;
23 class TTreeSRedirector;
24 class AliRawReader;
25 class AliTRDclusterizer;
26 class AliTRDReconstructor: public AliReconstructor 
27 {
28 public:
29   enum ETRDReconstructorSteer {
30     kDigitsConversion= BIT(0)
31     ,kWriteClusters  = BIT(1)
32     ,kWriteTracklets = BIT(2)
33     ,kSeeding        = BIT(3)
34     ,kHLT            = BIT(4)
35     ,kProcTracklets  = BIT(5) // process online tracklets
36     ,kDebug          = BIT(6)
37     ,kClRadialCorr   = BIT(7) // toggle radial correction in clusters
38     ,kOwner          = BIT(8)
39     ,kNsteer         = 8      // number of tasks
40   };
41   AliTRDReconstructor();
42   virtual ~AliTRDReconstructor();
43         
44         virtual void        Init();
45
46   virtual void        ConvertDigits(AliRawReader *rawReader, TTree *digitsTree) const;
47   virtual AliTracker* CreateTracker() const;
48   TTreeSRedirector*   GetDebugStream(AliTRDrecoParam::ETRDReconstructionTask task) const { return task < AliTRDrecoParam::kTRDreconstructionTasks ? fDebugStream[task] : NULL; }
49
50   virtual void        FillESD(AliRawReader *, TTree *clusterTree, AliESDEvent *esd) const { FillESD((TTree * )NULL, clusterTree, esd);                    }
51   virtual void        FillESD(TTree *digitsTree, TTree *clusterTree, AliESDEvent *esd) const;
52   static TClonesArray* GetClusters()             {return fgClusters;}
53   static TClonesArray* GetTracklets()            { return fgTracklets;}
54   static TClonesArray* GetTracks()               { return fgTracks;}
55   static Int_t        GetNTimeBins()             { return fgNTimeBins;}
56   Int_t               GetNdEdxSlices() const     { return (Int_t)AliTRDpidUtil::GetNdEdxSlices(GetPIDMethod());}
57   AliTRDpidUtil::ETRDPIDMethod       GetPIDMethod() const       { return GetRecoParam()->IsPIDNeuralNetwork() ? AliTRDpidUtil::kNN : AliTRDpidUtil::kLQ;}
58   static const AliTRDrecoParam* GetRecoParam()   { return dynamic_cast<const AliTRDrecoParam*>(AliReconstructor::GetRecoParam(2)); }
59   static Float_t      GetMinClustersInTrack()    { return fgkMinClustersInTrack;}
60   static Float_t      GetLabelFraction()         { return fgkLabelFraction;}
61   static Double_t     GetMaxChi2()               { return fgkMaxChi2;}
62   static Double_t     GetMaxSnp()                { return fgkMaxSnp;}
63   static Double_t     GetMaxStep()               { return fgkMaxStep;}
64   static Double_t     GetEpsilon()               { return fgkEpsilon;}
65
66   virtual Bool_t      HasDigitConversion() const { return fSteerParam&kDigitsConversion;  };
67   Bool_t              IsCosmic() const           { return GetRecoParam()->GetEventSpecie() & AliRecoParam::kCosmic;}
68   Bool_t              IsWritingClusters() const  { return fSteerParam&kWriteClusters;}
69   Bool_t              IsWritingTracklets() const { return fSteerParam&kWriteTracklets;}
70   Bool_t              IsHLT() const              { return fSteerParam&kHLT;}
71   Bool_t              IsSeeding() const          { return fSteerParam&kSeeding;}
72   Bool_t              IsProcessingTracklets() const { return fSteerParam&kProcTracklets;}
73   Bool_t              IsDebugStreaming() const   { return fSteerParam&kDebug;}
74   Bool_t              UseClusterRadialCorrection() const { return fSteerParam&kClRadialCorr;}
75
76   static void         Options(UInt_t steer=0);
77   virtual void        Reconstruct(AliRawReader *rawReader, TTree *clusterTree) const;
78   virtual void        Reconstruct(TTree *digitsTree, TTree *clusterTree) const;
79
80   static void         SetClusters(TClonesArray *clusters)  { fgClusters = clusters;} 
81   static void         SetTracklets(TClonesArray *tracklets) { fgTracklets = tracklets;}
82   static void         SetTracks(TClonesArray *tracks) { fgTracks = tracks;}
83   void                SetOption(Option_t *opt);
84
85 private:
86   AliTRDReconstructor(const AliTRDReconstructor &r); //Not implemented
87   AliTRDReconstructor& operator = (const AliTRDReconstructor&); //Not implemented
88
89   static Char_t const *fgSteerNames[kNsteer];//! steering names
90   static Char_t const *fgSteerFlags[kNsteer];//! steering flags
91   static Char_t const   *fgTaskNames[AliTRDrecoParam::kTRDreconstructionTasks]; //! tasks names
92   static Char_t const   *fgTaskFlags[AliTRDrecoParam::kTRDreconstructionTasks]; //! tasks flags
93   UInt_t            fSteerParam;          // steering bits
94   // configuration vars for tracking
95   static const Double_t    fgkMaxChi2;                  // Max increment in track chi2
96   static const Float_t     fgkMinClustersInTrack;       // Min number of clusters in track
97   static const Float_t     fgkLabelFraction;            // Min fraction of same label
98   static const Double_t    fgkMaxSnp;                   // Maximal snp for tracking
99   static const Double_t    fgkMaxStep;                  // Maximal step for tracking
100   static const Double_t    fgkEpsilon;                  // Precision of radial coordinate
101
102   TTreeSRedirector *fDebugStream[AliTRDrecoParam::kTRDreconstructionTasks];// Debug Streamer container;
103  
104   static TClonesArray *fgClusters;    //  list of clusters for local reconstructor
105   static TClonesArray *fgTracklets;   //  list of online tracklets for local reconstructor
106   static TClonesArray *fgTracks;      //  list of GTU tracks for local reconstructor
107   static Int_t         fgNTimeBins;   //  number of time bins as given by the clusterizer
108   AliTRDclusterizer   *fClusterizer;  //! instance of TRD clusterizer
109   static AliESDTrdTrigger fgTriggerFlags; //  L1 trigger flags
110
111   ClassDef(AliTRDReconstructor, 5)    //  Class for the TRD reconstruction
112
113 };
114
115
116
117 #endif
118