introduce option to run QA for selected detectors and for selected tasks
[u/mrichter/AliRoot.git] / STEER / AliSimulation.h
CommitLineData
85a5290f 1#ifndef ALISIMULATION_H
2#define ALISIMULATION_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// class for running generation, simulation and digitization
10// Hits, sdigits and digits are created for all detectors by typing:
af7ba10c 11// AliSimulation sim;
12// sim.Run();
13//
14
85a5290f 15#include <TNamed.h>
16#include <TString.h>
3c166bf6 17#include <TObjArray.h>
cae17938 18#include "AliQA.h"
85a5290f 19
e8d02863 20class AliCDBId;
21class AliCDBParam;
85a5290f 22class AliRunLoader;
a1b90a73 23class AliQADataMakerSteer ;
85a5290f 24
25class AliSimulation: public TNamed {
26public:
95601147 27 AliSimulation(const char* configFileName = "Config.C",
28 const char* name = "AliSimulation",
85a5290f 29 const char* title = "generation, simulation and digitization");
30 AliSimulation(const AliSimulation& sim);
31 AliSimulation& operator = (const AliSimulation& sim);
32 virtual ~AliSimulation();
33
b856a511 34 static AliSimulation *GetInstance() {return fgInstance;}
35
85a5290f 36 void SetNumberOfEvents(Int_t nEvents);
37 void SetConfigFile(const char* fileName);
0421c3d1 38 void SetGAliceFile(const char* fileName);
18b43626 39 void SetEventsPerFile(const char* detector, const char* type,
40 Int_t nEvents);
85a5290f 41
42 void SetRunGeneration(Bool_t run) {fRunGeneration = run;};
43 void SetRunSimulation(Bool_t run) {fRunSimulation = run;};
024cf675 44 void SetLoadAlignFromCDB(Bool_t load) {fLoadAlignFromCDB = load;};
45 void SetLoadAlignData(const char* detectors)
25be1e5c 46 {fLoadAlObjsListOfDets = detectors;};
85a5290f 47 void SetMakeSDigits(const char* detectors)
48 {fMakeSDigits = detectors;};
05526d44 49 void MergeWith(const char* fileName, Int_t nSignalPerBkgrd = 0);
ca30848f 50 void EmbedInto(const char* fileName, Int_t nSignalPerBkgrd = 0);
04bae0a0 51 void SetUseBkgrdVertex(Bool_t useBkgrdVertex)
52 {fUseBkgrdVertex = useBkgrdVertex;};
4df28b43 53 void SetRegionOfInterest(Bool_t flag) {fRegionOfInterest = flag;};
85a5290f 54 void SetMakeDigits(const char* detectors)
55 {fMakeDigits = detectors;};
a5a091ce 56 void SetMakeTrigger(const char* descriptors)
57 {fMakeTrigger = descriptors;};
85a5290f 58 void SetMakeDigitsFromHits(const char* detectors)
59 {fMakeDigitsFromHits = detectors;};
06c7e392 60 void SetWriteRawData(const char* detectors,
61 const char* fileName = NULL,
62 Bool_t deleteIntermediateFiles = kFALSE)
63 {fWriteRawData = detectors; fRawDataFileName = fileName;
64 fDeleteIntermediateFiles = deleteIntermediateFiles;};
67327b72 65 void SetWriteSelRawData(Bool_t sel = kTRUE)
66 {fWriteSelRawData = sel;}
024cf675 67 void SetAlignObjArray(TObjArray *array)
6bae477a 68 {fAlignObjArray = array;
69 fLoadAlignFromCDB = kFALSE;}
024cf675 70
6bae477a 71 Bool_t MisalignGeometry(AliRunLoader *runLoader = NULL);
72
795e4a22 73 void SetRunNumber(Int_t run);
74 void SetSeed(Int_t seed);
75
76 void ProcessEnvironmentVars();
024cf675 77
78 // CDB storage activation
ec92bee0 79 void SetDefaultStorage(const char* uri);
00aa02d5 80 void SetSpecificStorage(const char* calibType, const char* uri);
85a5290f 81
82 virtual Bool_t Run(Int_t nEvents = 0);
83
95601147 84 virtual Bool_t RunSimulation(Int_t nEvents = 0);
85 virtual Bool_t RunSDigitization(const char* detectors = "ALL");
8480396b 86 virtual Bool_t RunTrigger(const char* descriptors ="", const char* detectors = "ALL");
007155cc 87 virtual Bool_t WriteTriggerRawData();
95601147 88 virtual Bool_t RunDigitization(const char* detectors = "ALL",
89 const char* excludeDetectors = "");
90 virtual Bool_t RunHitsDigitization(const char* detectors = "ALL");
06c7e392 91 virtual Bool_t WriteRawData(const char* detectors = "ALL",
92 const char* fileName = NULL,
67327b72 93 Bool_t deleteIntermediateFiles = kFALSE,
94 Bool_t selrawdata = kFALSE);
06c7e392 95 virtual Bool_t WriteRawFiles(const char* detectors = "ALL");
67327b72 96 virtual Bool_t ConvertRawFilesToDate(const char* dateFileName = "raw.date",
1b8db7f0 97 const char* rootFileName = "");
06c7e392 98 virtual Bool_t ConvertDateToRoot(const char* dateFileName = "raw.date",
99 const char* rootFileName = "raw.root");
ca30848f 100 virtual Bool_t ConvertRaw2SDigits(const char* rawDirectory, const char* esdFile = "");
5b188f2f 101
cae21299 102 // HLT
103 void SetRunHLT(const char* options) {fRunHLT=options;}
104 virtual Bool_t RunHLT();
105
5b188f2f 106 //Quality Assurance
107 Int_t GetDetIndex(const char * detector);
108 const Int_t GetQACycles(const char * detector) { return fQACycles[GetDetIndex(detector)] ; }
109 void SetQACycles(const char * detector, const Int_t cycles) { fQACycles[GetDetIndex(detector)] = cycles ; }
a1b90a73 110 Bool_t RunQA() ;
e3b20d9a 111 Bool_t SetRunQA(TString detAndAction="ALL:ALL") ;
759c1df1 112
95601147 113private:
795e4a22 114 void InitCDB();
115 void InitRunNumber();
116 void SetCDBLock();
117 Bool_t SetRunNumberFromData();
06c7e392 118 AliRunLoader* LoadRun(const char* mode = "UPDATE") const;
05526d44 119 Int_t GetNSignalPerBkgrd(Int_t nEvents = 0) const;
85a5290f 120 Bool_t IsSelected(TString detName, TString& detectors) const;
121
b856a511 122 static AliSimulation *fgInstance; // Static pointer to object
123
85a5290f 124 Bool_t fRunGeneration; // generate prim. particles or not
125 Bool_t fRunSimulation; // simulate detectors (hits) or not
024cf675 126 Bool_t fLoadAlignFromCDB; // Load alignment data from CDB and apply it to geometry or not
25be1e5c 127 TString fLoadAlObjsListOfDets; // Load alignment data from CDB for these detectors
85a5290f 128 TString fMakeSDigits; // create sdigits for these detectors
129 TString fMakeDigits; // create digits for these detectors
a5a091ce 130 TString fMakeTrigger; // run trigger for these descriptors
85a5290f 131 TString fMakeDigitsFromHits; // create digits from hits for these detectors
0421c3d1 132 TString fWriteRawData; // write raw data for these detectors
06c7e392 133 TString fRawDataFileName; // file name for the raw data file
134 Bool_t fDeleteIntermediateFiles; // delete intermediate raw data files
67327b72 135 Bool_t fWriteSelRawData; // write detectors raw data in a separate file accoring to the trigger cluster
85a5290f 136 Bool_t fStopOnError; // stop or continue on errors
137
138 Int_t fNEvents; // number of events
139 TString fConfigFileName; // name of the config file
140 TString fGAliceFileName; // name of the galice file
18b43626 141 TObjArray fEventsPerFile; // number of events per file for given detectors and data types
142
85a5290f 143 TObjArray* fBkgrdFileNames; // names of background files for merging
024cf675 144 TObjArray* fAlignObjArray; // array with the alignment objects to be applied to the geometry
04bae0a0 145 Bool_t fUseBkgrdVertex; // use vertex from background in case of merging
4df28b43 146 Bool_t fRegionOfInterest; // digitization in region of interest
85a5290f 147
795e4a22 148 TString fCDBUri; //! Uri of the default CDB storage
149 TObjArray fSpecCDBUri; //! Array with detector specific CDB storages
150 Int_t fRun; //! Run number, will be passed to CDB and gAlice!!
151 Int_t fSeed; //! Seed for random number generator
152 Bool_t fInitCDBCalled; //! flag to check if CDB storages are already initialized
153 Bool_t fInitRunNumberCalled; //! flag to check if run number is already initialized
154 Bool_t fSetRunNumberFromDataCalled; //! flag to check if run number is already loaded from run loader
155
ca30848f 156 Bool_t fEmbeddingFlag; // Flag for embedding
5b188f2f 157
158 //QA stuff
a1b90a73 159 static const Int_t fgkNDetectors = 15 ; // number of detectors
160 static const char * fgkDetectorName[fgkNDetectors] ; // names of detectors
161 Int_t fQACycles[fgkNDetectors] ; // cycle length (# events) over which QA data are accumulated
e3b20d9a 162 TString fQADetectors ; // list of detectors to be QA'ed
163 TString fQATasks ; // list of QA tasks to be performed
04236e67 164 Bool_t fRunQA ; // Runs the QA at the end of simulation
5b188f2f 165
cae21299 166 //HLT
167 TString fRunHLT; // HLT options, HLT is disabled if empty, default='default'
168
67327b72 169 ClassDef(AliSimulation, 8) // class for running generation, simulation and digitization
85a5290f 170};
171
172#endif