]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliSimulation.h
Corrected call to the static method AliBitPacking::UnpackWord
[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   void           SetNumberOfEvents(Int_t nEvents);
35   void           SetConfigFile(const char* fileName);
36   void           SetGAliceFile(const char* fileName);
37   void           SetEventsPerFile(const char* detector, const char* type, 
38                                   Int_t nEvents);
39
40   void           SetRunGeneration(Bool_t run) {fRunGeneration = run;};
41   void           SetRunSimulation(Bool_t run) {fRunSimulation = run;};
42   void           SetLoadAlignFromCDB(Bool_t load)  {fLoadAlignFromCDB = load;};
43   void           SetLoadAlignData(const char* detectors) 
44                    {fLoadAlignData = detectors;};
45   void           SetMakeSDigits(const char* detectors) 
46                    {fMakeSDigits = detectors;};
47   void           MergeWith(const char* fileName, Int_t nSignalPerBkgrd = 0);
48   void           SetUseBkgrdVertex(Bool_t useBkgrdVertex)
49                    {fUseBkgrdVertex = useBkgrdVertex;};
50   void           SetRegionOfInterest(Bool_t flag) {fRegionOfInterest = flag;};
51   void           SetMakeDigits(const char* detectors)
52                    {fMakeDigits = detectors;};
53   void           SetMakeTrigger(const char* descriptors)
54                    {fMakeTrigger = descriptors;};
55   void           SetMakeDigitsFromHits(const char* detectors)
56                    {fMakeDigitsFromHits = detectors;};
57   void           SetWriteRawData(const char* detectors, 
58                                  const char* fileName = NULL,
59                                  Bool_t deleteIntermediateFiles = kFALSE)
60                    {fWriteRawData = detectors; fRawDataFileName = fileName;
61                    fDeleteIntermediateFiles = deleteIntermediateFiles;};
62
63   Bool_t         ApplyAlignObjsToGeom(TObjArray* alObjArray);
64
65   Bool_t         ApplyAlignObjsToGeom(const char* fileName,
66                                       const char* clArrayName);
67   Bool_t         ApplyAlignObjsToGeom(AliCDBParam* param,
68                                       AliCDBId& Id);
69   Bool_t         ApplyAlignObjsToGeom(const char* uri, const char* path,
70                                       Int_t runnum, Int_t version,
71                                       Int_t sversion);
72   Bool_t         ApplyAlignObjsToGeom(const char* detName, Int_t runnum, Int_t version,
73                                       Int_t sversion);
74   void           SetAlignObjArray(TObjArray *array)
75                    {fAlignObjArray = array;
76                    fLoadAlignFromCDB = kFALSE;}
77
78   Bool_t         SetAlignObjArraySingleDet(const char* detName);                   
79
80   Bool_t         MisalignGeometry(AliRunLoader *runLoader = NULL);
81
82   Bool_t         SetRunNumber();
83                    
84   // CDB storage activation
85   static void InitCDBStorage(const char *uri);
86   static void SetDefaultStorage(const char* uri);
87   static void SetSpecificStorage(const char* detName, const char* uri);    
88
89   virtual Bool_t Run(Int_t nEvents = 0);
90
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 ="" );
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   virtual Bool_t WriteRawFiles(const char* detectors = "ALL");
102   virtual Bool_t ConvertRawFilesToDate(const char* dateFileName = "raw.date");
103   virtual Bool_t ConvertDateToRoot(const char* dateFileName = "raw.date",
104                                    const char* rootFileName = "raw.root");
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   Bool_t         fRunGeneration;      // generate prim. particles or not
112   Bool_t         fRunSimulation;      // simulate detectors (hits) or not
113   Bool_t         fLoadAlignFromCDB;   // Load alignment data from CDB and apply it to geometry or not
114   TString        fLoadAlignData;      // Load alignment data from CDB for these detectors
115   TString        fMakeSDigits;        // create sdigits for these detectors
116   TString        fMakeDigits;         // create digits for these detectors
117   TString        fMakeTrigger;        // run trigger for these descriptors
118   TString        fMakeDigitsFromHits; // create digits from hits for these detectors
119   TString        fWriteRawData;       // write raw data for these detectors
120   TString        fRawDataFileName;    // file name for the raw data file
121   Bool_t         fDeleteIntermediateFiles; // delete intermediate raw data files
122   Bool_t         fStopOnError;        // stop or continue on errors
123
124   Int_t          fNEvents;            // number of events
125   TString        fConfigFileName;     // name of the config file
126   TString        fGAliceFileName;     // name of the galice file
127   TObjArray      fEventsPerFile;      // number of events per file for given detectors and data types
128
129   TObjArray*     fBkgrdFileNames;     // names of background files for merging
130   TObjArray*     fAlignObjArray;      // array with the alignment objects to be applied to the geometry
131   Bool_t         fUseBkgrdVertex;     // use vertex from background in case of merging
132   Bool_t         fRegionOfInterest;   // digitization in region of interest
133
134   TString        fCDBUri;             // Uri of the default CDB storage
135
136   ClassDef(AliSimulation, 2)  // class for running generation, simulation and digitization
137 };
138
139 #endif