]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliReconstruction.h
43f551b61c1c9455450c57c64df1eb6021f3838d
[u/mrichter/AliRoot.git] / STEER / AliReconstruction.h
1 #ifndef ALIRECONSTRUCTION_H
2 #define ALIRECONSTRUCTION_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 running the reconstruction                                      //
11 // Clusters and tracks are created for all detectors and all events by       //
12 // typing:                                                                   //
13 //                                                                           //
14 //   AliReconstruction rec;                                                  //
15 //   rec.Run();                                                              //
16 //                                                                           //
17 ///////////////////////////////////////////////////////////////////////////////
18
19
20 #include <TNamed.h>
21 #include <TString.h>
22 #include <TObjArray.h>
23
24 class AliReconstructor;
25 class AliRunLoader;
26 class AliRawReader;
27 class AliLoader;
28 class AliTracker;
29 class AliVertexer;
30 class AliESDVertex;
31 class AliESD;
32 class TFile;
33
34 class AliRunTag;
35 class AliLHCTag;
36 class AliDetectorTag;
37 class AliEventTag;
38
39
40 class AliReconstruction: public TNamed {
41 public:
42   AliReconstruction(const char* gAliceFilename = "galice.root",
43                     const char* cdbUri = "local://$ALICE_ROOT",
44                     const char* name = "AliReconstruction", 
45                     const char* title = "reconstruction");
46   AliReconstruction(const AliReconstruction& rec);
47   AliReconstruction& operator = (const AliReconstruction& rec);
48   virtual ~AliReconstruction();
49
50   void           SetGAliceFile(const char* fileName);
51   void           SetInput(const char* input) {fInput = input;};
52   void           SetEquipmentIdMap(const char *mapFile) {fEquipIdMap = mapFile;};
53   void           SetEventRange(Int_t firstEvent = 0, Int_t lastEvent = -1) 
54     {fFirstEvent = firstEvent; fLastEvent = lastEvent;};
55   void           SetNumberOfEventsPerFile(UInt_t nEvents)
56     {fNumberOfEventsPerFile = nEvents;};
57   void           SetOption(const char* detector, const char* option);
58
59   void           SetRunLocalReconstruction(const char* detectors) {
60     fRunLocalReconstruction = detectors;};
61   void           SetRunTracking(const char* detectors) {
62     fRunTracking = detectors;};
63   void           SetFillESD(const char* detectors) {fFillESD = detectors;};
64   void           SetRunReconstruction(const char* detectors) {
65     SetRunLocalReconstruction(detectors); 
66     SetRunTracking(detectors);
67     SetFillESD(detectors);};
68   void           SetLoadAlignFromCDB(Bool_t load)  {fLoadAlignFromCDB = load;};
69   void           SetLoadAlignData(const char* detectors) 
70     {fLoadAlignData = detectors;};
71
72
73   //*** Global reconstruction flag setters
74   void SetUniformFieldTracking(Bool_t flag=kTRUE){fUniformField=flag;} 
75   void SetRunVertexFinder(Bool_t flag=kTRUE) {fRunVertexFinder=flag;};
76   void SetRunHLTTracking(Bool_t flag=kTRUE) {fRunHLTTracking=flag;};
77   void SetStopOnError(Bool_t flag=kTRUE) {fStopOnError=flag;}
78   void SetWriteAlignmentData(Bool_t flag=kTRUE){fWriteAlignmentData=flag;}
79   void SetWriteESDfriend(Bool_t flag=kTRUE){fWriteESDfriend=flag;}
80   void SetWriteAOD(Bool_t flag=kTRUE){fWriteAOD=flag;}
81   void SetFillTriggerESD(Bool_t flag=kTRUE){fFillTriggerESD=flag;}
82   void SetDiamondProfile(AliESDVertex *dp) {fDiamondProfile=dp;}
83                    
84   void           SetCheckPointLevel(Int_t checkPointLevel)
85     {fCheckPointLevel = checkPointLevel;}
86   // CDB storage activation
87   void InitCDBStorage();
88   void SetDefaultStorage(const char* uri);
89   void SetSpecificStorage(const char* calibType, const char* uri);
90
91   Bool_t SetRunNumber();
92
93   Bool_t SetAlignObjArraySingleDet(const char* detName);
94   Bool_t MisalignGeometry(const TString& detectors);
95
96   void           SetAlignObjArray(TObjArray *array)
97                    {fAlignObjArray = array;
98                    fLoadAlignFromCDB = kFALSE;}
99   Bool_t         ApplyAlignObjsToGeom(TObjArray* alObjArray);
100
101   virtual Bool_t Run(const char* input = NULL);
102
103
104 private:
105   Bool_t         RunLocalReconstruction(const TString& detectors);
106   Bool_t         RunLocalEventReconstruction(const TString& detectors);
107   Bool_t         RunVertexFinder(AliESD*& esd);
108   Bool_t         RunHLTTracking(AliESD*& esd);
109   Bool_t         RunMuonTracking();
110   Bool_t         RunTracking(AliESD*& esd);
111   Bool_t         FillESD(AliESD*& esd, const TString& detectors);
112   Bool_t         FillTriggerESD(AliESD*& esd);
113   Bool_t         FillRawEventHeaderESD(AliESD*& esd);
114
115   Bool_t         IsSelected(TString detName, TString& detectors) const;
116   Bool_t         InitRunLoader();
117   AliReconstructor* GetReconstructor(Int_t iDet);
118   Bool_t         CreateVertexer();
119   Bool_t         CreateTrackers(const TString& detectors);
120   void           CleanUp(TFile* file = NULL, TFile* fileOld = NULL);
121
122   Bool_t         ReadESD(AliESD*& esd, const char* recStep) const;
123   void           WriteESD(AliESD* esd, const char* recStep) const;
124
125  
126   //===========================================//
127   void           CreateTag(TFile* file);
128   //==========================================//
129   void           CreateAOD(TFile* file);
130
131   void           WriteAlignmentData(AliESD* esd);
132
133   void           FillRawDataErrorLog(Int_t iEvent, AliESD* esd);
134
135   //*** Global reconstruction flags *******************
136   Bool_t         fUniformField;       // uniform field tracking flag
137   Bool_t         fRunVertexFinder;    // run the vertex finder
138   Bool_t         fRunHLTTracking;     // run the HLT tracking
139   Bool_t         fRunMuonTracking;     // run the HLT tracking
140   Bool_t         fStopOnError;        // stop or continue on errors
141   Bool_t         fWriteAlignmentData; // write track space-points flag
142   Bool_t         fWriteESDfriend;     // write ESD friend flag
143   Bool_t         fWriteAOD;           // write AOD flag
144   Bool_t         fFillTriggerESD;     // fill trigger info into ESD
145
146   TString        fRunLocalReconstruction; // run the local reconstruction for these detectors
147   TString        fRunTracking;        // run the tracking for these detectors
148   TString        fFillESD;            // fill ESD for these detectors
149   TString        fGAliceFileName;     // name of the galice file
150   TString        fInput;              // name of input file or directory
151   TString        fEquipIdMap;         // name of file with equipment id map
152   Int_t          fFirstEvent;         // index of first event to be reconstr.
153   Int_t          fLastEvent;          // index of last event to be reconstr.
154   UInt_t         fNumberOfEventsPerFile; // number of events per file in case of raw-data reconstruction
155   Int_t          fCheckPointLevel;    // level of ESD check points
156   TObjArray      fOptions;            // options for reconstructor objects
157   Bool_t         fLoadAlignFromCDB;   // Load alignment data from CDB and apply it to geometry or not
158   TString        fLoadAlignData;      // Load alignment data from CDB for these detectors
159
160   AliRunLoader*  fRunLoader;          //! current run loader object
161   AliRawReader*  fRawReader;          //! current raw data reader
162
163   static const Int_t fgkNDetectors = 15;   //! number of detectors
164   static const char* fgkDetectorName[fgkNDetectors]; //! names of detectors
165   AliReconstructor*  fReconstructor[fgkNDetectors];  //! array of reconstructor objects
166   AliLoader*     fLoader[fgkNDetectors];   //! detector loaders
167   AliVertexer*   fVertexer;                //! vertexer for ITS
168   AliTracker*    fTracker[fgkNDetectors];  //! trackers
169   AliESDVertex*  fDiamondProfile;          // (x,y) diamond profile for AliVertexerTracks
170
171   TObjArray*     fAlignObjArray;      // array with the alignment objects to be applied to the geometry
172
173   TString        fCDBUri;             // Uri of the default CDB storage
174   TObjArray      fSpecCDBUri;         // Array with detector specific CDB storages
175
176   ClassDef(AliReconstruction, 9)      // class for running the reconstruction
177 };
178
179 #endif