]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEER/AliSimulation.h
Removed unused variables. Initial value for centrality fixed.
[u/mrichter/AliRoot.git] / STEER / 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>
4e25ac79 18#include "AliQAv1.h"
b03591ab 19#include "AliQAManager.h"
f828ebed 20#include <time.h>
85a5290f 21
e8d02863 22class AliCDBId;
23class AliCDBParam;
85a5290f 24class AliRunLoader;
3e2e3ece 25class AliLegoGenerator;
26class AliLego;
f7a1cc68 27class AliMagF;
c4affb19 28class AliHLTSimulation;
85a5290f 29
30class AliSimulation: public TNamed {
31public:
95601147 32 AliSimulation(const char* configFileName = "Config.C",
33 const char* name = "AliSimulation",
85a5290f 34 const char* title = "generation, simulation and digitization");
85a5290f 35 virtual ~AliSimulation();
36
b72539fa 37 static AliSimulation *Instance() {if(!fgInstance) fgInstance=new AliSimulation(); return fgInstance;}
b856a511 38
85a5290f 39 void SetNumberOfEvents(Int_t nEvents);
40 void SetConfigFile(const char* fileName);
0421c3d1 41 void SetGAliceFile(const char* fileName);
18b43626 42 void SetEventsPerFile(const char* detector, const char* type,
43 Int_t nEvents);
85a5290f 44
45 void SetRunGeneration(Bool_t run) {fRunGeneration = run;};
46 void SetRunSimulation(Bool_t run) {fRunSimulation = run;};
024cf675 47 void SetLoadAlignFromCDB(Bool_t load) {fLoadAlignFromCDB = load;};
48 void SetLoadAlignData(const char* detectors)
25be1e5c 49 {fLoadAlObjsListOfDets = detectors;};
85a5290f 50 void SetMakeSDigits(const char* detectors)
51 {fMakeSDigits = detectors;};
05526d44 52 void MergeWith(const char* fileName, Int_t nSignalPerBkgrd = 0);
ca30848f 53 void EmbedInto(const char* fileName, Int_t nSignalPerBkgrd = 0);
04bae0a0 54 void SetUseBkgrdVertex(Bool_t useBkgrdVertex)
55 {fUseBkgrdVertex = useBkgrdVertex;};
4df28b43 56 void SetRegionOfInterest(Bool_t flag) {fRegionOfInterest = flag;};
85a5290f 57 void SetMakeDigits(const char* detectors)
58 {fMakeDigits = detectors;};
59 void SetMakeDigitsFromHits(const char* detectors)
60 {fMakeDigitsFromHits = detectors;};
06c7e392 61 void SetWriteRawData(const char* detectors,
62 const char* fileName = NULL,
63 Bool_t deleteIntermediateFiles = kFALSE)
64 {fWriteRawData = detectors; fRawDataFileName = fileName;
65 fDeleteIntermediateFiles = deleteIntermediateFiles;};
67327b72 66 void SetWriteSelRawData(Bool_t sel = kTRUE)
67 {fWriteSelRawData = sel;}
28da60d3 68 void SetTriggerConfig(TString conf) {fTriggerConfig=conf;}
69 const Char_t* GetTriggerConfig() const {return fTriggerConfig.Data();}
024cf675 70 void SetAlignObjArray(TObjArray *array)
6bae477a 71 {fAlignObjArray = array;
72 fLoadAlignFromCDB = kFALSE;}
a5fe2c41 73 void SetUseMonitoring(Bool_t flag=kTRUE) {fUseMonitoring = flag;}
024cf675 74
6bae477a 75 Bool_t MisalignGeometry(AliRunLoader *runLoader = NULL);
76
795e4a22 77 void SetRunNumber(Int_t run);
78 void SetSeed(Int_t seed);
79
80 void ProcessEnvironmentVars();
024cf675 81
82 // CDB storage activation
ec92bee0 83 void SetDefaultStorage(const char* uri);
00aa02d5 84 void SetSpecificStorage(const char* calibType, const char* uri);
7c41d36a 85 void SetCDBSnapshotMode(const char* snapshotFileName) {AliCDBManager::Instance()->SetSnapshotMode(snapshotFileName);}
85a5290f 86
87 virtual Bool_t Run(Int_t nEvents = 0);
3e2e3ece 88 virtual Bool_t RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
89 Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0,
90 Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL, Int_t nev = -1);
85a5290f 91
95601147 92 virtual Bool_t RunSimulation(Int_t nEvents = 0);
93 virtual Bool_t RunSDigitization(const char* detectors = "ALL");
8480396b 94 virtual Bool_t RunTrigger(const char* descriptors ="", const char* detectors = "ALL");
007155cc 95 virtual Bool_t WriteTriggerRawData();
95601147 96 virtual Bool_t RunDigitization(const char* detectors = "ALL",
97 const char* excludeDetectors = "");
98 virtual Bool_t RunHitsDigitization(const char* detectors = "ALL");
06c7e392 99 virtual Bool_t WriteRawData(const char* detectors = "ALL",
100 const char* fileName = NULL,
67327b72 101 Bool_t deleteIntermediateFiles = kFALSE,
102 Bool_t selrawdata = kFALSE);
06c7e392 103 virtual Bool_t WriteRawFiles(const char* detectors = "ALL");
67327b72 104 virtual Bool_t ConvertRawFilesToDate(const char* dateFileName = "raw.date",
1b8db7f0 105 const char* rootFileName = "");
06c7e392 106 virtual Bool_t ConvertDateToRoot(const char* dateFileName = "raw.date",
107 const char* rootFileName = "raw.root");
c95d53ea 108 virtual Int_t ConvertRaw2SDigits(const char* rawDirectory, const char* esdFile = "", Int_t N=-1, Int_t nSkip=0);
5b188f2f 109
d97f1dbe 110 // Sets the name of the file from which the geometry is loaded
111 virtual void SetGeometryFile(const Char_t* filename) {fGeometryFile=filename;}
112 virtual const Char_t* GetGeometryFile() const {return fGeometryFile.Data();}
113 virtual Bool_t IsGeometryFromFile() const {return !fGeometryFile.IsNull();}
114
115
cae21299 116 // HLT
117 void SetRunHLT(const char* options) {fRunHLT=options;}
c4affb19 118 virtual Bool_t CreateHLT();
cae21299 119 virtual Bool_t RunHLT();
3e2e3ece 120 virtual Bool_t IsLegoRun() const {return (fLego!=0);}
121 AliLego* Lego() const {return fLego;}
122 virtual void FinishRun();
cae21299 123
5b188f2f 124 //Quality Assurance
125 Int_t GetDetIndex(const char * detector);
eca4fa66 126 void SetQACycles(AliQAv1::DETECTORINDEX_t det, const Int_t cycles) { AliQAManager::QAManager()->SetCycleLength(det, cycles) ; }
a1b90a73 127 Bool_t RunQA() ;
e3b20d9a 128 Bool_t SetRunQA(TString detAndAction="ALL:ALL") ;
eca4fa66 129 void SetQAWriteExpert(AliQAv1::DETECTORINDEX_t det) { AliQAManager::QAManager()->SetWriteExpert(det) ; }
f1c1204d 130 void SetQARefDefaultStorage(const char* uri);
131 void InitQA();
80636887 132 void SetEventSpecie(AliRecoParam::EventSpecie_t es) { fEventSpecie = es ; }
75373542 133 void SetWriteQAExpert() { fWriteQAExpertData = kTRUE ; }
fc7e1b1c 134
135 void SetWriteGRPEntry(Bool_t flag = kTRUE) { fWriteGRPEntry = flag; }
136 void WriteGRPEntry();
732ee20f 137 void UseVertexFromCDB() {fUseVertexFromCDB = kTRUE;}
138 void UseMagFieldFromGRP() {fUseMagFieldFromGRP = kTRUE;}
139 void SetGRPWriteLocation(char* loc) {fGRPWriteLocation = loc;}
fc7e1b1c 140
475baf89 141 void UseTimeStampFromCDB() {fUseTimeStampFromCDB = kTRUE;}
142 time_t GenerateTimeStamp() const;
143
95601147 144private:
7dd2cbe4 145
146 AliSimulation(const AliSimulation&); // Not implemented
147 AliSimulation& operator = (const AliSimulation&); // Not implemented
148
795e4a22 149 void InitCDB();
150 void InitRunNumber();
151 void SetCDBLock();
152 Bool_t SetRunNumberFromData();
06c7e392 153 AliRunLoader* LoadRun(const char* mode = "UPDATE") const;
05526d44 154 Int_t GetNSignalPerBkgrd(Int_t nEvents = 0) const;
85a5290f 155 Bool_t IsSelected(TString detName, TString& detectors) const;
156
b856a511 157 static AliSimulation *fgInstance; // Static pointer to object
158
85a5290f 159 Bool_t fRunGeneration; // generate prim. particles or not
160 Bool_t fRunSimulation; // simulate detectors (hits) or not
024cf675 161 Bool_t fLoadAlignFromCDB; // Load alignment data from CDB and apply it to geometry or not
25be1e5c 162 TString fLoadAlObjsListOfDets; // Load alignment data from CDB for these detectors
85a5290f 163 TString fMakeSDigits; // create sdigits for these detectors
164 TString fMakeDigits; // create digits for these detectors
28da60d3 165 TString fTriggerConfig; // run trigger for these descriptors
85a5290f 166 TString fMakeDigitsFromHits; // create digits from hits for these detectors
0421c3d1 167 TString fWriteRawData; // write raw data for these detectors
06c7e392 168 TString fRawDataFileName; // file name for the raw data file
169 Bool_t fDeleteIntermediateFiles; // delete intermediate raw data files
67327b72 170 Bool_t fWriteSelRawData; // write detectors raw data in a separate file accoring to the trigger cluster
85a5290f 171 Bool_t fStopOnError; // stop or continue on errors
a5fe2c41 172 Bool_t fUseMonitoring; // monitor simulation timing per volume
85a5290f 173
174 Int_t fNEvents; // number of events
175 TString fConfigFileName; // name of the config file
176 TString fGAliceFileName; // name of the galice file
18b43626 177 TObjArray fEventsPerFile; // number of events per file for given detectors and data types
178
85a5290f 179 TObjArray* fBkgrdFileNames; // names of background files for merging
732ee20f 180 TObjArray* fAlignObjArray; // array with the alignment objects to be applied to the geometry
04bae0a0 181 Bool_t fUseBkgrdVertex; // use vertex from background in case of merging
4df28b43 182 Bool_t fRegionOfInterest; // digitization in region of interest
85a5290f 183
57acd2d2 184 TString fCDBUri; //! Uri of the default CDB storage
732ee20f 185 TString fQARefUri; //! Uri of the default QA reference storage
186 TObjArray fSpecCDBUri; //! Array with detector specific CDB storages
57acd2d2 187 Int_t fRun; //! Run number, will be passed to CDB and gAlice!!
188 Int_t fSeed; //! Seed for random number generator
189 Bool_t fInitCDBCalled; //! flag to check if CDB storages are already initialized
190 Bool_t fInitRunNumberCalled; //! flag to check if run number is already initialized
191 Bool_t fSetRunNumberFromDataCalled; //! flag to check if run number is already loaded from run loader
795e4a22 192
732ee20f 193 Bool_t fEmbeddingFlag; // Flag for embedding
194 AliLego *fLego; //! Pointer to aliLego object if it exists
195 // OCDB
6fc2efbf 196 ULong64_t fKey; //! current CDB key
732ee20f 197 Bool_t fUseVertexFromCDB; // Flag to use Vertex from CDB
198 Bool_t fUseMagFieldFromGRP; // Use magnetic field settings from GRP
199 TString fGRPWriteLocation; // Location to write the GRP entry from simulation
475baf89 200
201 Bool_t fUseTimeStampFromCDB;// Flag to generate event time-stamps according to SOR/EOR from GRP
202 time_t fTimeStart; // SOR time-stamp
203 time_t fTimeEnd; // EOR time-stamp
5b188f2f 204
205 //QA stuff
820b4d9e 206// #ifdef MFT_UPGRADE
207// static const Int_t fgkNDetectors = 16 ; // number of detectors
208// #else
209// static const Int_t fgkNDetectors = 15 ; // number of detectors
210// #endif
211 static const Int_t fgkNDetectors = 16 ; // number of detectors // AU
a1b90a73 212 static const char * fgkDetectorName[fgkNDetectors] ; // names of detectors
e3b20d9a 213 TString fQADetectors ; // list of detectors to be QA'ed
214 TString fQATasks ; // list of QA tasks to be performed
04236e67 215 Bool_t fRunQA ; // Runs the QA at the end of simulation
80636887 216 AliRecoParam::EventSpecie_t fEventSpecie ; // type of event (see AliRecoParam::EventSpecie_t)
75373542 217 Bool_t fWriteQAExpertData ; //! decides wheter or not to write experts QA data; true by default
5b188f2f 218
d97f1dbe 219 TString fGeometryFile; // Geometry file
220
cae21299 221 //HLT
c4affb19 222 TString fRunHLT; //! HLT options, HLT is disabled if empty, default='default'
223 AliHLTSimulation* fpHLT; //! The instance of HLT simulation
cae21299 224
fc7e1b1c 225 Bool_t fWriteGRPEntry; // Write or not GRP entry corresponding to the settings in Config.C
226
6fc2efbf 227 ClassDef(AliSimulation, 13) // class for running generation, simulation and digitization
85a5290f 228};
229
230#endif