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