]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliSimulation.h
i)Restructuring of the GRP preprocessor ii)Adding the storage of raw data tag files...
[u/mrichter/AliRoot.git] / STEER / AliSimulation.h
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
19 class AliCDBId;
20 class AliCDBParam;
21 class AliRunLoader;
22
23
24 class AliSimulation: public TNamed {
25 public:
26   AliSimulation(const char* configFileName = "Config.C",
27                 const char* cdbUri = "local://$ALICE_ROOT",
28                 const char* name = "AliSimulation", 
29                 const char* title = "generation, simulation and digitization");
30   AliSimulation(const AliSimulation& sim);
31   AliSimulation& operator = (const AliSimulation& sim);
32   virtual ~AliSimulation();
33
34   static AliSimulation *GetInstance() {return fgInstance;}
35
36   void           SetNumberOfEvents(Int_t nEvents);
37   void           SetConfigFile(const char* fileName);
38   void           SetGAliceFile(const char* fileName);
39   void           SetEventsPerFile(const char* detector, const char* type, 
40                                   Int_t nEvents);
41
42   void           SetRunGeneration(Bool_t run) {fRunGeneration = run;};
43   void           SetRunSimulation(Bool_t run) {fRunSimulation = run;};
44   void           SetLoadAlignFromCDB(Bool_t load)  {fLoadAlignFromCDB = load;};
45   void           SetLoadAlignData(const char* detectors) 
46                    {fLoadAlObjsListOfDets = detectors;};
47   void           SetMakeSDigits(const char* detectors) 
48                    {fMakeSDigits = detectors;};
49   void           MergeWith(const char* fileName, Int_t nSignalPerBkgrd = 0);
50   void           EmbedInto(const char* fileName, Int_t nSignalPerBkgrd = 0);
51   void           SetUseBkgrdVertex(Bool_t useBkgrdVertex)
52                    {fUseBkgrdVertex = useBkgrdVertex;};
53   void           SetRegionOfInterest(Bool_t flag) {fRegionOfInterest = flag;};
54   void           SetMakeDigits(const char* detectors)
55                    {fMakeDigits = detectors;};
56   void           SetMakeTrigger(const char* descriptors)
57                    {fMakeTrigger = descriptors;};
58   void           SetMakeDigitsFromHits(const char* detectors)
59                    {fMakeDigitsFromHits = detectors;};
60   void           SetWriteRawData(const char* detectors, 
61                                  const char* fileName = NULL,
62                                  Bool_t deleteIntermediateFiles = kFALSE)
63                    {fWriteRawData = detectors; fRawDataFileName = fileName;
64                    fDeleteIntermediateFiles = deleteIntermediateFiles;};
65   void           SetAlignObjArray(TObjArray *array)
66                    {fAlignObjArray = array;
67                    fLoadAlignFromCDB = kFALSE;}
68
69   Bool_t         MisalignGeometry(AliRunLoader *runLoader = NULL);
70
71   Bool_t         SetRunNumber();
72                    
73   // CDB storage activation
74   void InitCDBStorage();
75   void SetDefaultStorage(const char* uri);
76   void SetRemoteStorage(const char* uri);
77   void SetSpecificStorage(const char* calibType, const char* uri);
78
79   virtual Bool_t Run(Int_t nEvents = 0);
80
81   virtual Bool_t RunSimulation(Int_t nEvents = 0);
82   virtual Bool_t RunSDigitization(const char* detectors = "ALL");
83   virtual Bool_t RunTrigger(const char* descriptors ="" );
84   virtual Bool_t WriteTriggerRawData();
85   virtual Bool_t RunDigitization(const char* detectors = "ALL",
86                                  const char* excludeDetectors = "");
87   virtual Bool_t RunHitsDigitization(const char* detectors = "ALL");
88   virtual Bool_t WriteRawData(const char* detectors = "ALL",
89                               const char* fileName = NULL,
90                               Bool_t deleteIntermediateFiles = kFALSE);
91   virtual Bool_t WriteRawFiles(const char* detectors = "ALL");
92   virtual Bool_t ConvertRawFilesToDate(const char* dateFileName = "raw.date");
93   virtual Bool_t ConvertDateToRoot(const char* dateFileName = "raw.date",
94                                    const char* rootFileName = "raw.root");
95   virtual Bool_t ConvertRaw2SDigits(const char* rawDirectory, const char* esdFile = "");
96
97   // HLT
98   void SetRunHLT(const char* options) {fRunHLT=options;}
99   virtual Bool_t RunHLT();
100
101   //Quality Assurance
102   Int_t       GetDetIndex(const char * detector);
103   const Int_t GetQACycles(const char * detector) { return fQACycles[GetDetIndex(detector)] ; }
104   void        SetQACycles(const char * detector, const Int_t cycles) { fQACycles[GetDetIndex(detector)] = cycles ; }
105
106 private:
107   AliRunLoader*  LoadRun(const char* mode = "UPDATE") const;
108   Int_t          GetNSignalPerBkgrd(Int_t nEvents = 0) const;
109   Bool_t         IsSelected(TString detName, TString& detectors) const;
110
111   static AliSimulation *fgInstance;    // Static pointer to object
112
113   Bool_t         fRunGeneration;      // generate prim. particles or not
114   Bool_t         fRunSimulation;      // simulate detectors (hits) or not
115   Bool_t         fLoadAlignFromCDB;   // Load alignment data from CDB and apply it to geometry or not
116   TString        fLoadAlObjsListOfDets;   // Load alignment data from CDB for these detectors
117   TString        fMakeSDigits;        // create sdigits for these detectors
118   TString        fMakeDigits;         // create digits for these detectors
119   TString        fMakeTrigger;        // run trigger for these descriptors
120   TString        fMakeDigitsFromHits; // create digits from hits for these detectors
121   TString        fWriteRawData;       // write raw data for these detectors
122   TString        fRawDataFileName;    // file name for the raw data file
123   Bool_t         fDeleteIntermediateFiles; // delete intermediate raw data files
124   Bool_t         fStopOnError;        // stop or continue on errors
125
126   Int_t          fNEvents;            // number of events
127   TString        fConfigFileName;     // name of the config file
128   TString        fGAliceFileName;     // name of the galice file
129   TObjArray      fEventsPerFile;      // number of events per file for given detectors and data types
130
131   TObjArray*     fBkgrdFileNames;     // names of background files for merging
132   TObjArray*     fAlignObjArray;      // array with the alignment objects to be applied to the geometry
133   Bool_t         fUseBkgrdVertex;     // use vertex from background in case of merging
134   Bool_t         fRegionOfInterest;   // digitization in region of interest
135
136   TString        fCDBUri;             // Uri of the default CDB storage
137   TString        fRemoteCDBUri;       // Uri of the remote CDB storage
138   TObjArray      fSpecCDBUri;         // Array with detector specific CDB storages
139   Bool_t         fEmbeddingFlag;      // Flag for embedding
140   
141   //QA stuff
142   static const Int_t  fgkNDetectors = 15 ;            // number of detectors
143   static const char * fgkDetectorName[fgkNDetectors] ; // names of detectors
144   Int_t               fQACycles[fgkNDetectors] ;      // cycle length (# events) over which QA data are accumulated
145
146   //HLT
147   TString        fRunHLT;             // HLT options, HLT is disabled if empty, default='default'
148
149   ClassDef(AliSimulation, 6)  // class for running generation, simulation and digitization
150 };
151
152 #endif