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