]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliSimulation.h
b0625eb0f8ab2d632e4486c466cdd4b2d7e89f68
[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 #include <TGeoManager.h>
19 #include <TGeoPhysicalNode.h>
20 #include "AliCDBManager.h"
21 #include "AliCDBStorage.h"
22 #include "AliCDBEntry.h"
23 #include "AliCDBId.h"
24
25 class AliRunLoader;
26
27
28 class AliSimulation: public TNamed {
29 public:
30   AliSimulation(const char* configFileName = "Config.C",
31                 const char* name = "AliSimulation", 
32                 const char* title = "generation, simulation and digitization");
33   AliSimulation(const AliSimulation& sim);
34   AliSimulation& operator = (const AliSimulation& sim);
35   virtual ~AliSimulation();
36
37   void           SetNumberOfEvents(Int_t nEvents);
38   void           SetConfigFile(const char* fileName);
39   void           SetGAliceFile(const char* fileName);
40   void           SetEventsPerFile(const char* detector, const char* type, 
41                                   Int_t nEvents);
42
43   void           SetRunGeneration(Bool_t run) {fRunGeneration = run;};
44   void           SetRunSimulation(Bool_t run) {fRunSimulation = run;};
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           SetMakeDigitsFromHits(const char* detectors)
54                    {fMakeDigitsFromHits = detectors;};
55   void           SetWriteRawData(const char* detectors, 
56                                  const char* fileName = NULL,
57                                  Bool_t deleteIntermediateFiles = kFALSE)
58                    {fWriteRawData = detectors; fRawDataFileName = fileName;
59                    fDeleteIntermediateFiles = deleteIntermediateFiles;};
60   static Bool_t  ApplyDisplacements(const char* fileName,
61                                     const char* ClArrayName);
62   static Bool_t  ApplyDisplacements(TClonesArray* AlObjArray);
63   static Bool_t  ApplyDisplacements(AliCDBParam* param,
64                                     AliCDBId& Id);
65   static Bool_t  ApplyDisplacements(const char* uri, const char* path,
66                                     Int_t runnum, Int_t version,
67                                     Int_t sversion);
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 RunDigitization(const char* detectors = "ALL",
74                                  const char* excludeDetectors = "");
75   virtual Bool_t RunHitsDigitization(const char* detectors = "ALL");
76   virtual Bool_t WriteRawData(const char* detectors = "ALL",
77                               const char* fileName = NULL,
78                               Bool_t deleteIntermediateFiles = kFALSE);
79   virtual Bool_t WriteRawFiles(const char* detectors = "ALL");
80   virtual Bool_t ConvertRawFilesToDate(const char* dateFileName = "raw.date");
81   virtual Bool_t ConvertDateToRoot(const char* dateFileName = "raw.date",
82                                    const char* rootFileName = "raw.root");
83
84 private:
85   AliRunLoader*  LoadRun(const char* mode = "UPDATE") const;
86   Int_t          GetNSignalPerBkgrd(Int_t nEvents = 0) const;
87   Bool_t         IsSelected(TString detName, TString& detectors) const;
88
89   Bool_t         fRunGeneration;      // generate prim. particles or not
90   Bool_t         fRunSimulation;      // simulate detectors (hits) or not
91   TString        fMakeSDigits;        // create sdigits for these detectors
92   TString        fMakeDigits;         // create digits for these detectors
93   TString        fMakeDigitsFromHits; // create digits from hits for these detectors
94   TString        fWriteRawData;       // write raw data for these detectors
95   TString        fRawDataFileName;    // file name for the raw data file
96   Bool_t         fDeleteIntermediateFiles; // delete intermediate raw data files
97   Bool_t         fStopOnError;        // stop or continue on errors
98
99   Int_t          fNEvents;            // number of events
100   TString        fConfigFileName;     // name of the config file
101   TString        fGAliceFileName;     // name of the galice file
102   TObjArray      fEventsPerFile;      // number of events per file for given detectors and data types
103
104   TObjArray*     fBkgrdFileNames;     // names of background files for merging
105   Bool_t         fUseBkgrdVertex;     // use vertex from background in case of merging
106   Bool_t         fRegionOfInterest;   // digitization in region of interest
107
108   ClassDef(AliSimulation, 2)  // class for running generation, simulation and digitization
109 };
110
111 #endif