]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliSimulation.h
0a0f303242edb2ea8d3e1eda83be5ca22307cd22
[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* name = "AliSimulation", 
28                 const char* title = "generation, simulation and digitization");
29   AliSimulation(const AliSimulation& sim);
30   AliSimulation& operator = (const AliSimulation& sim);
31   virtual ~AliSimulation();
32
33   void           SetNumberOfEvents(Int_t nEvents);
34   void           SetConfigFile(const char* fileName);
35   void           SetGAliceFile(const char* fileName);
36   void           SetEventsPerFile(const char* detector, const char* type, 
37                                   Int_t nEvents);
38
39   void           SetRunGeneration(Bool_t run) {fRunGeneration = run;};
40   void           SetRunSimulation(Bool_t run) {fRunSimulation = run;};
41   void           SetMakeSDigits(const char* detectors) 
42                    {fMakeSDigits = detectors;};
43   void           MergeWith(const char* fileName, Int_t nSignalPerBkgrd = 0);
44   void           SetUseBkgrdVertex(Bool_t useBkgrdVertex)
45                    {fUseBkgrdVertex = useBkgrdVertex;};
46   void           SetRegionOfInterest(Bool_t flag) {fRegionOfInterest = flag;};
47   void           SetMakeDigits(const char* detectors)
48                    {fMakeDigits = detectors;};
49   void           SetMakeTrigger(const char* descriptors)
50                    {fMakeTrigger = descriptors;};
51   void           SetMakeDigitsFromHits(const char* detectors)
52                    {fMakeDigitsFromHits = detectors;};
53   void           SetWriteRawData(const char* detectors, 
54                                  const char* fileName = NULL,
55                                  Bool_t deleteIntermediateFiles = kFALSE)
56                    {fWriteRawData = detectors; fRawDataFileName = fileName;
57                    fDeleteIntermediateFiles = deleteIntermediateFiles;};
58
59   static Bool_t  ApplyAlignObjsToGeom(const char* fileName,
60                                     const char* clArrayName);
61   static Bool_t  ApplyAlignObjsToGeom(AliCDBParam* param,
62                                     AliCDBId& Id);
63   static Bool_t  ApplyAlignObjsToGeom(const char* uri, const char* path,
64                                     Int_t runnum, Int_t version,
65                                     Int_t sversion);
66   void           SetAlignObjArray(TClonesArray *array)
67                    {fAlignObjArray = array;}
68
69   virtual Bool_t Run(Int_t nEvents = 0);
70
71   virtual Bool_t RunSimulation(Int_t nEvents = 0);
72   virtual Bool_t RunSDigitization(const char* detectors = "ALL");
73   virtual Bool_t RunTrigger(const char* descriptors ="" );
74   virtual Bool_t RunDigitization(const char* detectors = "ALL",
75                                  const char* excludeDetectors = "");
76   virtual Bool_t RunHitsDigitization(const char* detectors = "ALL");
77   virtual Bool_t WriteRawData(const char* detectors = "ALL",
78                               const char* fileName = NULL,
79                               Bool_t deleteIntermediateFiles = kFALSE);
80   virtual Bool_t WriteRawFiles(const char* detectors = "ALL");
81   virtual Bool_t ConvertRawFilesToDate(const char* dateFileName = "raw.date");
82   virtual Bool_t ConvertDateToRoot(const char* dateFileName = "raw.date",
83                                    const char* rootFileName = "raw.root");
84
85 private:
86   AliRunLoader*  LoadRun(const char* mode = "UPDATE") const;
87   Int_t          GetNSignalPerBkgrd(Int_t nEvents = 0) const;
88   Bool_t         IsSelected(TString detName, TString& detectors) const;
89
90   Bool_t         fRunGeneration;      // generate prim. particles or not
91   Bool_t         fRunSimulation;      // simulate detectors (hits) or not
92   TString        fMakeSDigits;        // create sdigits for these detectors
93   TString        fMakeDigits;         // create digits for these detectors
94   TString        fMakeTrigger;        // run trigger for these descriptors
95   TString        fMakeDigitsFromHits; // create digits from hits for these detectors
96   TString        fWriteRawData;       // write raw data for these detectors
97   TString        fRawDataFileName;    // file name for the raw data file
98   Bool_t         fDeleteIntermediateFiles; // delete intermediate raw data files
99   Bool_t         fStopOnError;        // stop or continue on errors
100
101   Int_t          fNEvents;            // number of events
102   TString        fConfigFileName;     // name of the config file
103   TString        fGAliceFileName;     // name of the galice file
104   TObjArray      fEventsPerFile;      // number of events per file for given detectors and data types
105
106   TObjArray*     fBkgrdFileNames;     // names of background files for merging
107   TClonesArray*  fAlignObjArray;      // array with the alignment objects to be applied to the geometry
108   Bool_t         fUseBkgrdVertex;     // use vertex from background in case of merging
109   Bool_t         fRegionOfInterest;   // digitization in region of interest
110
111   ClassDef(AliSimulation, 2)  // class for running generation, simulation and digitization
112 };
113
114 #endif