]>
Commit | Line | Data |
---|---|---|
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 | ||
8 | // | |
9 | // class for running generation, simulation and digitization | |
10 | // Hits, sdigits and digits are created for all detectors by typing: | |
11 | // AliSimulation sim; | |
12 | // sim.Run(); | |
13 | // | |
14 | ||
15 | #include <TNamed.h> | |
16 | #include <TString.h> | |
17 | #include <TObjArray.h> | |
18 | #include "AliQAv1.h" | |
19 | #include "AliQAManager.h" | |
20 | ||
21 | class AliCDBId; | |
22 | class AliCDBParam; | |
23 | class AliRunLoader; | |
24 | class AliLegoGenerator; | |
25 | class AliLego; | |
26 | class AliMagF; | |
27 | class AliHLTSimulation; | |
28 | ||
29 | class AliSimulation: public TNamed { | |
30 | public: | |
31 | AliSimulation(const char* configFileName = "Config.C", | |
32 | const char* name = "AliSimulation", | |
33 | const char* title = "generation, simulation and digitization"); | |
34 | virtual ~AliSimulation(); | |
35 | ||
36 | static AliSimulation *Instance() {return fgInstance;} | |
37 | ||
38 | void SetNumberOfEvents(Int_t nEvents); | |
39 | void SetConfigFile(const char* fileName); | |
40 | void SetGAliceFile(const char* fileName); | |
41 | void SetEventsPerFile(const char* detector, const char* type, | |
42 | Int_t nEvents); | |
43 | ||
44 | void SetRunGeneration(Bool_t run) {fRunGeneration = run;}; | |
45 | void SetRunSimulation(Bool_t run) {fRunSimulation = run;}; | |
46 | void SetLoadAlignFromCDB(Bool_t load) {fLoadAlignFromCDB = load;}; | |
47 | void SetLoadAlignData(const char* detectors) | |
48 | {fLoadAlObjsListOfDets = detectors;}; | |
49 | void SetMakeSDigits(const char* detectors) | |
50 | {fMakeSDigits = detectors;}; | |
51 | void MergeWith(const char* fileName, Int_t nSignalPerBkgrd = 0); | |
52 | void EmbedInto(const char* fileName, Int_t nSignalPerBkgrd = 0); | |
53 | void SetUseBkgrdVertex(Bool_t useBkgrdVertex) | |
54 | {fUseBkgrdVertex = useBkgrdVertex;}; | |
55 | void SetRegionOfInterest(Bool_t flag) {fRegionOfInterest = flag;}; | |
56 | void SetMakeDigits(const char* detectors) | |
57 | {fMakeDigits = detectors;}; | |
58 | void SetMakeTrigger(const char* descriptors) | |
59 | {fMakeTrigger = descriptors;}; | |
60 | void SetMakeDigitsFromHits(const char* detectors) | |
61 | {fMakeDigitsFromHits = detectors;}; | |
62 | void SetWriteRawData(const char* detectors, | |
63 | const char* fileName = NULL, | |
64 | Bool_t deleteIntermediateFiles = kFALSE) | |
65 | {fWriteRawData = detectors; fRawDataFileName = fileName; | |
66 | fDeleteIntermediateFiles = deleteIntermediateFiles;}; | |
67 | void SetWriteSelRawData(Bool_t sel = kTRUE) | |
68 | {fWriteSelRawData = sel;} | |
69 | void SetAlignObjArray(TObjArray *array) | |
70 | {fAlignObjArray = array; | |
71 | fLoadAlignFromCDB = kFALSE;} | |
72 | ||
73 | Bool_t MisalignGeometry(AliRunLoader *runLoader = NULL); | |
74 | ||
75 | void SetRunNumber(Int_t run); | |
76 | void SetSeed(Int_t seed); | |
77 | ||
78 | void ProcessEnvironmentVars(); | |
79 | ||
80 | // CDB storage activation | |
81 | void SetDefaultStorage(const char* uri); | |
82 | void SetSpecificStorage(const char* calibType, const char* uri); | |
83 | ||
84 | virtual Bool_t Run(Int_t nEvents = 0); | |
85 | virtual Bool_t RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178, | |
86 | Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0, | |
87 | Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL, Int_t nev = -1); | |
88 | ||
89 | virtual Bool_t RunSimulation(Int_t nEvents = 0); | |
90 | virtual Bool_t RunSDigitization(const char* detectors = "ALL"); | |
91 | virtual Bool_t RunTrigger(const char* descriptors ="", const char* detectors = "ALL"); | |
92 | virtual Bool_t WriteTriggerRawData(); | |
93 | virtual Bool_t RunDigitization(const char* detectors = "ALL", | |
94 | const char* excludeDetectors = ""); | |
95 | virtual Bool_t RunHitsDigitization(const char* detectors = "ALL"); | |
96 | virtual Bool_t WriteRawData(const char* detectors = "ALL", | |
97 | const char* fileName = NULL, | |
98 | Bool_t deleteIntermediateFiles = kFALSE, | |
99 | Bool_t selrawdata = kFALSE); | |
100 | virtual Bool_t WriteRawFiles(const char* detectors = "ALL"); | |
101 | virtual Bool_t ConvertRawFilesToDate(const char* dateFileName = "raw.date", | |
102 | const char* rootFileName = ""); | |
103 | virtual Bool_t ConvertDateToRoot(const char* dateFileName = "raw.date", | |
104 | const char* rootFileName = "raw.root"); | |
105 | virtual Bool_t ConvertRaw2SDigits(const char* rawDirectory, const char* esdFile = ""); | |
106 | ||
107 | // Sets the name of the file from which the geometry is loaded | |
108 | virtual void SetGeometryFile(const Char_t* filename) {fGeometryFile=filename;} | |
109 | virtual const Char_t* GetGeometryFile() const {return fGeometryFile.Data();} | |
110 | virtual Bool_t IsGeometryFromFile() const {return !fGeometryFile.IsNull();} | |
111 | ||
112 | ||
113 | // HLT | |
114 | void SetRunHLT(const char* options) {fRunHLT=options;} | |
115 | virtual Bool_t CreateHLT(); | |
116 | virtual Bool_t RunHLT(); | |
117 | virtual Bool_t IsLegoRun() const {return (fLego!=0);} | |
118 | AliLego* Lego() const {return fLego;} | |
119 | virtual void FinishRun(); | |
120 | ||
121 | //Quality Assurance | |
122 | Int_t GetDetIndex(const char * detector); | |
123 | void SetQACycles(AliQAv1::DETECTORINDEX_t det, const Int_t cycles) { AliQAManager::QAManager()->SetCycleLength(det, cycles) ; } | |
124 | Bool_t RunQA() ; | |
125 | Bool_t SetRunQA(TString detAndAction="ALL:ALL") ; | |
126 | void SetQAWriteExpert(AliQAv1::DETECTORINDEX_t det) { AliQAManager::QAManager()->SetWriteExpert(det) ; } | |
127 | void SetQARefDefaultStorage(const char* uri); | |
128 | void InitQA(); | |
129 | void SetEventSpecie(AliRecoParam::EventSpecie_t es) { fEventSpecie = es ; } | |
130 | void SetWriteQAExpert() { fWriteQAExpertData = kTRUE ; } | |
131 | ||
132 | void SetWriteGRPEntry(Bool_t flag = kTRUE) { fWriteGRPEntry = flag; } | |
133 | void WriteGRPEntry(); | |
134 | ||
135 | private: | |
136 | ||
137 | AliSimulation(const AliSimulation&); // Not implemented | |
138 | AliSimulation& operator = (const AliSimulation&); // Not implemented | |
139 | ||
140 | void InitCDB(); | |
141 | void InitRunNumber(); | |
142 | void SetCDBLock(); | |
143 | Bool_t SetRunNumberFromData(); | |
144 | AliRunLoader* LoadRun(const char* mode = "UPDATE") const; | |
145 | Int_t GetNSignalPerBkgrd(Int_t nEvents = 0) const; | |
146 | Bool_t IsSelected(TString detName, TString& detectors) const; | |
147 | ||
148 | static AliSimulation *fgInstance; // Static pointer to object | |
149 | ||
150 | Bool_t fRunGeneration; // generate prim. particles or not | |
151 | Bool_t fRunSimulation; // simulate detectors (hits) or not | |
152 | Bool_t fLoadAlignFromCDB; // Load alignment data from CDB and apply it to geometry or not | |
153 | TString fLoadAlObjsListOfDets; // Load alignment data from CDB for these detectors | |
154 | TString fMakeSDigits; // create sdigits for these detectors | |
155 | TString fMakeDigits; // create digits for these detectors | |
156 | TString fMakeTrigger; // run trigger for these descriptors | |
157 | TString fMakeDigitsFromHits; // create digits from hits for these detectors | |
158 | TString fWriteRawData; // write raw data for these detectors | |
159 | TString fRawDataFileName; // file name for the raw data file | |
160 | Bool_t fDeleteIntermediateFiles; // delete intermediate raw data files | |
161 | Bool_t fWriteSelRawData; // write detectors raw data in a separate file accoring to the trigger cluster | |
162 | Bool_t fStopOnError; // stop or continue on errors | |
163 | ||
164 | Int_t fNEvents; // number of events | |
165 | TString fConfigFileName; // name of the config file | |
166 | TString fGAliceFileName; // name of the galice file | |
167 | TObjArray fEventsPerFile; // number of events per file for given detectors and data types | |
168 | ||
169 | TObjArray* fBkgrdFileNames; // names of background files for merging | |
170 | TObjArray* fAlignObjArray; // array with the alignment objects to be applied to the geometry | |
171 | Bool_t fUseBkgrdVertex; // use vertex from background in case of merging | |
172 | Bool_t fRegionOfInterest; // digitization in region of interest | |
173 | ||
174 | TString fCDBUri; //! Uri of the default CDB storage | |
175 | TString fQARefUri; //! Uri of the default QA reference storage | |
176 | TObjArray fSpecCDBUri; //! Array with detector specific CDB storages | |
177 | Int_t fRun; //! Run number, will be passed to CDB and gAlice!! | |
178 | Int_t fSeed; //! Seed for random number generator | |
179 | Bool_t fInitCDBCalled; //! flag to check if CDB storages are already initialized | |
180 | Bool_t fInitRunNumberCalled; //! flag to check if run number is already initialized | |
181 | Bool_t fSetRunNumberFromDataCalled; //! flag to check if run number is already loaded from run loader | |
182 | ||
183 | Bool_t fEmbeddingFlag; // Flag for embedding | |
184 | AliLego *fLego; //! Pointer to aliLego object if it exists | |
185 | ||
186 | //QA stuff | |
187 | static const Int_t fgkNDetectors = 15 ; // number of detectors | |
188 | static const char * fgkDetectorName[fgkNDetectors] ; // names of detectors | |
189 | TString fQADetectors ; // list of detectors to be QA'ed | |
190 | TString fQATasks ; // list of QA tasks to be performed | |
191 | Bool_t fRunQA ; // Runs the QA at the end of simulation | |
192 | AliRecoParam::EventSpecie_t fEventSpecie ; // type of event (see AliRecoParam::EventSpecie_t) | |
193 | Bool_t fWriteQAExpertData ; //! decides wheter or not to write experts QA data; true by default | |
194 | ||
195 | TString fGeometryFile; // Geometry file | |
196 | ||
197 | //HLT | |
198 | TString fRunHLT; //! HLT options, HLT is disabled if empty, default='default' | |
199 | AliHLTSimulation* fpHLT; //! The instance of HLT simulation | |
200 | ||
201 | Bool_t fWriteGRPEntry; // Write or not GRP entry corresponding to the settings in Config.C | |
202 | ||
203 | ClassDef(AliSimulation, 11) // class for running generation, simulation and digitization | |
204 | }; | |
205 | ||
206 | #endif |