]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliReconstruction.h
Possibility to propagate tracks to the DCA to the primary vertex at the AOD level...
[u/mrichter/AliRoot.git] / STEER / AliReconstruction.h
CommitLineData
596a855f 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
af7ba10c 8///////////////////////////////////////////////////////////////////////////////
9// //
10// class for running the reconstruction //
11// Clusters and tracks are created for all detectors and all events by //
12// typing: //
13// //
a6eb5fc9 14// AliReconstruction rec; //
af7ba10c 15// rec.Run(); //
16// //
17///////////////////////////////////////////////////////////////////////////////
18
19
4b71572b 20#include <TSelector.h>
596a855f 21#include <TString.h>
59697224 22#include <TObjArray.h>
596a855f 23
b8cd5251 24class AliReconstructor;
596a855f 25class AliRunLoader;
b649205a 26class AliRawReader;
596a855f 27class AliLoader;
28class AliTracker;
61807e09 29class AliMagF;
c84a5e9e 30class AliVertexer;
1f9831ab 31class AliTrackleter;
9178838a 32class AliESDVertex;
af885e0f 33class AliESDEvent;
21a3aa09 34class AliESDfriend;
10d100d4 35class AliESDpid;
21a3aa09 36class AliVertexerTracks;
e583c30d 37class TFile;
46698ae4 38class TTree;
444753c6 39class TList;
b03591ab 40class AliQAManager;
6b6e4472 41class TMap;
7e88424f 42class AliRecoParam;
43class AliDetectorRecoParam;
44class AliRunInfo;
44e45fac 45class AliGRPObject;
77ba28ba 46class THashTable;
522fdd91 47class AliTriggerRunScalers;
70410f60 48class AliCTPTimeParams;
49
4e25ac79 50#include "AliQAv1.h"
7e88424f 51#include "AliEventInfo.h"
52#include "AliRecoParam.h"
596a855f 53
4b71572b 54class AliReconstruction: public TSelector {
596a855f 55public:
4b71572b 56 AliReconstruction(const char* gAliceFilename = "galice.root");
596a855f 57 virtual ~AliReconstruction();
58
59 void SetGAliceFile(const char* fileName);
b58710ef 60 void SetInput(const char* input);
975320a0 61 void SetOutput(const char* output);
21a3aa09 62
35042093 63 void SetEquipmentIdMap(const char *mapFile) {fEquipIdMap = mapFile;};
b26c3770 64 void SetEventRange(Int_t firstEvent = 0, Int_t lastEvent = -1)
65 {fFirstEvent = firstEvent; fLastEvent = lastEvent;};
973388c2 66 void SetNumberOfEventsPerFile(UInt_t nEvents)
67 {fNumberOfEventsPerFile = nEvents;};
fc01854a 68 void SetFractionFriends(Double32_t frac = 0.04)
69 {fFractionFriends = frac;};
efd2085e 70 void SetOption(const char* detector, const char* option);
7e88424f 71 void SetRecoParam(const char* detector, AliDetectorRecoParam *par);
596a855f 72
59697224 73 void SetRunLocalReconstruction(const char* detectors) {
74 fRunLocalReconstruction = detectors;};
b8cd5251 75 void SetRunTracking(const char* detectors) {
76 fRunTracking = detectors;};
596a855f 77 void SetFillESD(const char* detectors) {fFillESD = detectors;};
b8cd5251 78 void SetRunReconstruction(const char* detectors) {
79 SetRunLocalReconstruction(detectors);
80 SetRunTracking(detectors);
81 SetFillESD(detectors);};
48ce48d1 82 void SetUseTrackingErrorsForAlignment(const char* detectors)
83 {fUseTrackingErrorsForAlignment = detectors;};
6bae477a 84 void SetLoadAlignFromCDB(Bool_t load) {fLoadAlignFromCDB = load;};
85 void SetLoadAlignData(const char* detectors)
86 {fLoadAlignData = detectors;};
c84a5e9e 87
61807e09 88 //*** Global reconstruction flag setters
1d99986f 89 void SetRunVertexFinder(Bool_t flag=kTRUE) {fRunVertexFinder=flag;};
a84e2607 90 void SetRunVertexFinderTracks(Bool_t flag=kTRUE) {fRunVertexFinderTracks=flag;};
1d99986f 91 void SetRunHLTTracking(Bool_t flag=kTRUE) {fRunHLTTracking=flag;};
d1683eef 92 void SetRunV0Finder(Bool_t flag=kTRUE) {fRunV0Finder=flag;};
93 void SetRunCascadeFinder(Bool_t flag=kTRUE) {fRunCascadeFinder=flag;};
1d99986f 94 void SetStopOnError(Bool_t flag=kTRUE) {fStopOnError=flag;}
95 void SetWriteAlignmentData(Bool_t flag=kTRUE){fWriteAlignmentData=flag;}
96 void SetWriteESDfriend(Bool_t flag=kTRUE){fWriteESDfriend=flag;}
b647652d 97 void SetFillTriggerESD(Bool_t flag=kTRUE){fFillTriggerESD=flag;}
f2a195c1 98 void SetDiamondProfileSPD(AliESDVertex *dp) {fDiamondProfileSPD=dp;}
9178838a 99 void SetDiamondProfile(AliESDVertex *dp) {fDiamondProfile=dp;}
43c9dae1 100 void SetDiamondProfileTPC(AliESDVertex *dp) {fDiamondProfileTPC=dp;}
1d99986f 101
7f68891d 102 void SetCleanESD(Bool_t flag=kTRUE){fCleanESD=flag;}
cc9e123e 103 void SetUseHLTData(const char* detectors){fUseHLTData=detectors;}
a023d8d8 104 void SetV0DCAmax(Float_t d) {fV0DCAmax=d;}
105 void SetV0CsPmin(Float_t d) {fV0CsPmin=d;}
7f68891d 106 void SetDmax(Float_t d) {fDmax=d;}
107 void SetZmax(Float_t z) {fZmax=z;}
a023d8d8 108 Float_t GetV0DCAmax() const {return fV0DCAmax;}
109 Float_t GetV0CsPmin() const {return fV0CsPmin;}
7f68891d 110 Float_t GetDmax() const {return fDmax;}
111 Float_t GetZmax() const {return fZmax;}
795e4a22 112
024cf675 113 // CDB storage activation
024cf675 114 void SetDefaultStorage(const char* uri);
c3a7b59a 115 void SetSpecificStorage(const char* calibType, const char* uri);
24f7a148 116
6bae477a 117 Bool_t MisalignGeometry(const TString& detectors);
118
119 void SetAlignObjArray(TObjArray *array)
120 {fAlignObjArray = array;
121 fLoadAlignFromCDB = kFALSE;}
6bae477a 122
4b71572b 123 virtual Int_t Version() const {return 2;}
124 virtual void Begin(TTree*);
125 virtual void SlaveBegin(TTree*);
126 virtual void Init(TTree *tree);
127 virtual Bool_t Process(Long64_t entry);
128 virtual Bool_t ProcessEvent(Int_t iEvent);
129 virtual void SlaveTerminate();
130 virtual void Terminate();
21a3aa09 131 virtual Bool_t Run(const char* input = NULL);
4b71572b 132 void Abort(const char *method, EAbort what);
8fb1f1dc 133 virtual void SetOption(const char* option) {
134 TSelector::SetOption(option);
135 }
596a855f 136
c7c63b89 137 // Trackers
ac4a7581 138 AliTracker* GetTracker(Int_t idx) const { return fTracker[idx]; }
c7c63b89 139 Bool_t CreateTrackers(const TString& detectors);
140 void ImportRunLoader(AliRunLoader* rl) { fRunLoader = rl; }
141
a5fa6165 142 // Quality Assurance
4e25ac79 143 void SetQACycles(AliQAv1::DETECTORINDEX_t det, Int_t cycles) { fQACycles[det] = cycles ; }
144 void SetQAWriteExpert(AliQAv1::DETECTORINDEX_t det) { fQAWriteExpert[det] = kTRUE ; }
ce43afbe 145 Bool_t SetRunQA(TString detAndAction="ALL:ALL") ;
aa3c69a9 146 void SetRunGlobalQA(Bool_t flag=kTRUE){fRunGlobalQA = flag;}
f1c1204d 147 void SetQARefDefaultStorage(const char* uri);
148 void InitQA();
87da0921 149 void MergeQA(const char *fileName = NULL);
75373542 150 void SetWriteQAExpert() { fWriteQAExpertData = kTRUE ; }
0a035be5 151 Bool_t IsRunQA() const { return fRunQA ; }
152 Bool_t IsRunGlobalQA() const { return fRunGlobalQA ; }
514cb8c7 153 Bool_t IsInTasks(AliQAv1::TASKINDEX_t tsk) { return fQATasks.Contains(Form("%d", tsk)) ; }
154
7167ae53 155 // Plane Efficiency Evaluation
156 void SetRunPlaneEff(Bool_t flag=kFALSE) {fRunPlaneEff = flag;}
157
7e88424f 158 enum {
ac4a7581 159 kNDetectors = 15 // number of detectors
7e88424f 160 };
161 static Int_t GetDetIndex(const char * detector);
162
2f954aba 163protected:
164 virtual Bool_t ProcessEvent(void* event);
165 void InitRun(const char* input);
166
596a855f 167private:
61807e09 168 AliReconstruction(const AliReconstruction& rec);
169 AliReconstruction& operator = (const AliReconstruction& rec);
170
4b71572b 171 void InitRawReader(const char* input);
930e6e3e 172 void InitCDB();
173 Bool_t InitGRP();
174 void SetCDBLock();
795e4a22 175 Bool_t SetRunNumberFromData();
4b71572b 176 Bool_t LoadCDB();
522fdd91 177 Bool_t LoadTriggerScalersCDB();
70410f60 178 Bool_t LoadCTPTimeParamsCDB();
3d84ad67 179 Bool_t ReadIntensityInfoCDB();
b26c3770 180 Bool_t RunLocalEventReconstruction(const TString& detectors);
af885e0f 181 Bool_t RunVertexFinder(AliESDEvent*& esd);
182 Bool_t RunHLTTracking(AliESDEvent*& esd);
183 Bool_t RunMuonTracking(AliESDEvent*& esd);
58e8dc31 184 Bool_t RunSPDTrackleting(AliESDEvent*& esd);
1f9831ab 185 Bool_t RunMultFinder(AliESDEvent*& esd);
10d100d4 186 Bool_t RunTracking(AliESDEvent*& esd, AliESDpid &PID);
d64bd07d 187 Bool_t CleanESD(AliESDEvent *esd);
af885e0f 188 Bool_t FillESD(AliESDEvent*& esd, const TString& detectors);
189 Bool_t FillTriggerESD(AliESDEvent*& esd);
f7812afc 190 Bool_t FillTriggerScalers(AliESDEvent*& esd);
af885e0f 191 Bool_t FillRawEventHeaderESD(AliESDEvent*& esd);
596a855f 192
e583c30d 193 Bool_t IsSelected(TString detName, TString& detectors) const;
f08fc9f5 194 Bool_t InitRunLoader();
b8cd5251 195 AliReconstructor* GetReconstructor(Int_t iDet);
92bffc4d 196 AliVertexer* CreateVertexer();
1f9831ab 197 AliTrackleter* CreateMultFinder();
4b71572b 198 void CleanUp();
24f7a148 199
81d57268 200 Bool_t ParseOutput();
201
48c83a1c 202 //==========================================//
af885e0f 203 void WriteAlignmentData(AliESDEvent* esd);
f3a97c86 204
af885e0f 205 void FillRawDataErrorLog(Int_t iEvent, AliESDEvent* esd);
f3a97c86 206
a5fa6165 207 //Quality Assurance
0a035be5 208 // void CheckQA() ;
a5fa6165 209
7167ae53 210 // Plane Efficiency evaluation
211 Bool_t FinishPlaneEff(); //ultimate tasks related to Plane Eff. evaluation
212 Bool_t InitPlaneEff(); // initialize what is needed for Plane Eff. evaluation
213
14dd053c 214 Bool_t InitAliEVE();
215 void RunAliEVE();
216
7e88424f 217 Bool_t InitRecoParams(); // init the array with the reconstruciton parameters
218 Bool_t GetEventInfo(); // fill the event info inside the event loop
219
220 const char *MatchDetectorList(const char *detectorList, UInt_t detectorMask);
221
61807e09 222 //*** Global reconstruction flags *******************
2257f27e 223 Bool_t fRunVertexFinder; // run the vertex finder
a84e2607 224 Bool_t fRunVertexFinderTracks; // run the vertex finder with tracks
1f46a9ae 225 Bool_t fRunHLTTracking; // run the HLT tracking
d1683eef 226 Bool_t fRunMuonTracking; // run the HLT tracking
227 Bool_t fRunV0Finder; // run the ESD V0 finder
228 Bool_t fRunCascadeFinder; // run the ESD cascade finder
1f9831ab 229 Bool_t fRunMultFinder; // run the trackleter for ITS clusters
1d99986f 230 Bool_t fStopOnError; // stop or continue on errors
231 Bool_t fWriteAlignmentData; // write track space-points flag
232 Bool_t fWriteESDfriend; // write ESD friend flag
b647652d 233 Bool_t fFillTriggerESD; // fill trigger info into ESD
1d99986f 234
7f68891d 235 //*** Clean ESD flag and parameters *******************
236 Bool_t fCleanESD; // clean ESD flag
a023d8d8 237 Float_t fV0DCAmax; // max. allowed DCA between V0 daugthers
238 Float_t fV0CsPmin; // min. allowed cosine of V0 pointing angle
7f68891d 239 Float_t fDmax; // max. allowed transverse impact parameter
240 Float_t fZmax; // max. allowed longitudinal impact parameter
241
1d99986f 242 TString fRunLocalReconstruction; // run the local reconstruction for these detectors
b8cd5251 243 TString fRunTracking; // run the tracking for these detectors
596a855f 244 TString fFillESD; // fill ESD for these detectors
7d566c20 245 TString fLoadCDB; // prefetch CDB entries and init reco-params for these detectors
48ce48d1 246 TString fUseTrackingErrorsForAlignment; // for these detectors
596a855f 247 TString fGAliceFileName; // name of the galice file
4b71572b 248 TString fRawInput; // name of input raw-data file or directory
81d57268 249 TString fESDOutput; //! name of output ESD file
250 TString fProofOutputFileName;//! name of output file in PROOF mode
251 TString fProofOutputLocation;//! output location in PROOF mode
252 Bool_t fProofOutputDataset; //! keep output file in PROOF mode in dataset or merge
253 TString fProofOutputArchive; //! list of file to be kept in output zip archive in PROOF mode
35042093 254 TString fEquipIdMap; // name of file with equipment id map
b26c3770 255 Int_t fFirstEvent; // index of first event to be reconstr.
256 Int_t fLastEvent; // index of last event to be reconstr.
973388c2 257 UInt_t fNumberOfEventsPerFile; // number of events per file in case of raw-data reconstruction
fc01854a 258 Double32_t fFractionFriends; // fraction of ESD friends to be stored
b8cd5251 259 TObjArray fOptions; // options for reconstructor objects
6bae477a 260 Bool_t fLoadAlignFromCDB; // Load alignment data from CDB and apply it to geometry or not
261 TString fLoadAlignData; // Load alignment data from CDB for these detectors
cc9e123e 262 TString fUseHLTData; // Detectors for which the HLT data is used as input
7e88424f 263 AliRunInfo* fRunInfo; // an object which contains essential global conditions information
264 AliEventInfo fEventInfo; // an object which contains essential event information
522fdd91 265 AliTriggerRunScalers* fRunScalers; // an object which contains the trigger counters for xsection
70410f60 266 AliCTPTimeParams* fCTPTimeParams; // an object which contains the trigger delays
596a855f 267 AliRunLoader* fRunLoader; //! current run loader object
b649205a 268 AliRawReader* fRawReader; //! current raw data reader
cc9e123e 269 AliRawReader* fParentRawReader; //! parent raw data reader in case of AliRawReaderHLT
596a855f 270
ac4a7581 271 static const char* fgkDetectorName[kNDetectors]; //! names of detectors
272 AliReconstructor* fReconstructor[kNDetectors]; //! array of reconstructor objects
4b71572b 273 AliRecoParam fRecoParam; // container for the reco-param objects for detectors
ac4a7581 274 AliLoader* fLoader[kNDetectors]; //! detector loaders
ac4a7581 275 AliTracker* fTracker[kNDetectors]; //! trackers
58e8dc31 276 AliTracker* fSPDTrackleter; //! trackleter [for SPD Plane Efficiency purposes]
f2a195c1 277 AliESDVertex* fDiamondProfileSPD; // (x,y) diamond profile from SPD for AliITSVertexer3D(Z)
278 AliESDVertex* fDiamondProfile; // (x,y) diamond profile for AliVertexerTracks (ITS+TPC)
43c9dae1 279 AliESDVertex* fDiamondProfileTPC; // (x,y) diamond profile from TPC for AliVertexerTracks
77ba28ba 280 THashTable* fListOfCosmicTriggers; // list of cosmic triggers as defined by trigger coordination
59697224 281
44e45fac 282 AliGRPObject* fGRPData; // Data from the GRP/GRP/Data CDB folder
444753c6 283
4b71572b 284 TObjArray* fAlignObjArray; //! array with the alignment objects to be applied to the geometry
98937d93 285
4b71572b 286 TString fCDBUri; //! Uri of the default CDB storage
f1c1204d 287 TString fQARefUri; //! Uri of the default QA reference storage
4b71572b 288 TObjArray fSpecCDBUri; //! Array with detector specific CDB storages
795e4a22 289 Bool_t fInitCDBCalled; //! flag to check if CDB storages are already initialized
290 Bool_t fSetRunNumberFromDataCalled; //! flag to check if run number is already loaded from run loader
024cf675 291
a5fa6165 292 //Quality Assurance
4e25ac79 293 Int_t fQACycles[ AliQAv1::kNDET]; // # events over which QA data are accumulated
294 Bool_t fQAWriteExpert[AliQAv1::kNDET]; // Flag to save or not expert QA data
30bbd491 295 TString fQADetectors ; // list of detectors to be QA'ed
30bbd491 296 TString fQATasks ; // list of QA tasks to be performed
297 Bool_t fRunQA ; // Run QA flag
298 Bool_t fRunGlobalQA; // Run global QA flag
30bbd491 299 Bool_t fSameQACycle; //! open a new QA data file or not
f1c1204d 300 Bool_t fInitQACalled; //! control of QA intialisation
75373542 301 Bool_t fWriteQAExpertData ; //! decides wheter or not to write experts QA data; true by default
302
7167ae53 303 // Plane Efficiency Evaluation
304 Bool_t fRunPlaneEff ; // Evaluate Plane Efficiency
a5fa6165 305
21a3aa09 306 // New members needed in order to split Run method
307 // into InitRun,RunEvent,FinishRun methods
308 AliESDEvent* fesd; //! Pointer to the ESD event object
309 AliESDEvent* fhltesd; //! Pointer to the HLT ESD event object
310 AliESDfriend* fesdf; //! Pointer to the ESD friend object
311 TFile* ffile; //! Pointer to the ESD file
ee7c441c 312 TFile* ffileF; //! Pointer to the ESD friend file
21a3aa09 313 TTree* ftree; //! Pointer to the ESD tree
ee7c441c 314 TTree* ftreeF; //! Pointer to the ESD friend tree
21a3aa09 315 TTree* fhlttree; //! Pointer to the HLT ESD tree
21a3aa09 316 AliVertexerTracks* ftVertexer; //! Pointer to the vertexer based on ESD tracks
317 Bool_t fIsNewRunLoader; // galice.root created from scratch (real raw data case)
14dd053c 318 Bool_t fRunAliEVE; // Run AliEVE or not
3d84ad67 319 Double_t fBeamInt[2][2]; //! mean beam intensities from AliLHCData
320
4b71572b 321 TTree* fChain; //! The raw-data chain in case of AliRawReaderChain
322
fc01854a 323 ClassDef(AliReconstruction, 37) // class for running the reconstruction
596a855f 324};
325
326#endif