]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRunDigitizer.h
Adaption to new fluka common blocks (E. Futo)
[u/mrichter/AliRoot.git] / STEER / AliRunDigitizer.h
1 #ifndef ALIRUNDIGITIZER_H
2 #define ALIRUNDIGITIZER_H
3 /* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ////////////////////////////////////////////////////////////////////////
9 //
10 //  Manager Class for Merging/Digitization   
11 //                  
12 //  Author: Jiri Chudoba (CERN)
13 //
14 ////////////////////////////////////////////////////////////////////////
15
16 // --- ROOT system ---
17
18 #include "TArrayI.h"
19 #include "TTask.h"
20 class TClonesArray;
21 class TFile;
22 class TParticle;
23 class TTree;
24
25 // --- AliRoot header files ---
26
27 class AliDigitizer;
28 class AliMergeCombi;
29
30 static const Int_t kMaxStreamsToMerge = 4;
31
32 class AliRunDigitizer: public TTask {
33
34 public:
35   AliRunDigitizer();
36   AliRunDigitizer(Int_t nInputStreams, Int_t sperb=1);
37   AliRunDigitizer(const AliRunDigitizer& dig);
38   AliRunDigitizer& operator=(const AliRunDigitizer& dig)
39     {dig.Copy(*this); return (*this);}
40   virtual ~AliRunDigitizer();
41   void      AddDigitizer(AliDigitizer *digitizer);
42   void      SetOutputFile(TString fn);
43   TString   GetOutputFile() const {return fOutputFileName;}
44   void      SetOutputDir(TString dn) {fOutputDirName = dn;}
45   TString   GetOutputDir() const {return fOutputDirName;}
46   void      SetInputStream(Int_t stream, const char *inputName);
47   void      SetFirstOutputEventNr(Int_t i) {fEvent = i;}
48   void      SetNrOfEventsToWrite(Int_t i) {fNrOfEventsToWrite = i;}
49   void      SetCopyTreesFromInput(Int_t i) {fCopyTreesFromInput = i;}
50   Int_t     GetCopyTreesFromInput() const {return fCopyTreesFromInput;}
51   Int_t     GetOutputEventNr() const {return fEvent;}
52   void      SetCombinationFileName(TString fn) {fCombinationFileName = fn;} 
53   TString   GetCombinationFileName() const {return fCombinationFileName;}
54   Int_t     GetNinputs() const {return fNinputs;}
55   Int_t     GetMask(Int_t i) const {return fkMASK[i];}
56   TTree*    GetInputTreeS(Int_t i) const {return fArrayTreeS[i];}
57   TTree*    GetInputTreeH(Int_t i) const {return fArrayTreeH[i];}
58   void      SetInputTreeTPCSBaseName(char * name) {
59     fTreeTPCSBaseName = name;}
60   TTree*    GetInputTreeTPCS(Int_t i) const {return fArrayTreeTPCS[i];}
61   TTree*    GetInputTreeTRDS(Int_t i) const {return fArrayTreeTRDS[i];}
62   TTree*    GetTreeD() const {return fTreeD;}
63   void      SetTreeDTPCBaseName(char * name) {
64     fTreeDTPCBaseName = name;}
65   TTree*    GetTreeDTPC() const {return fTreeDTPC;} 
66   TTree*    GetTreeDTRD() const {return fTreeDTRD;} 
67   TTree*    GetTreeR() const {return fTreeR;} 
68   void      Digitize(Option_t* option = 0);
69   void      Exec(Option_t *option) {this->Digitize(option);}
70   void      ExecuteTask(Option_t* option = 0);
71
72   
73 // Nr of particles in all input files for a given event
74 //     (as numbered in the output file)
75   Int_t GetNParticles(Int_t event) const;
76
77 // Nr of particles in input file input for a given event
78 //     (as numbered in this input file)
79   Int_t GetNParticles(Int_t event, Int_t input) const;
80
81 // return pointer to an int array with input event numbers which were
82 // merged in the output event event
83   Int_t* GetInputEventNumbers(Int_t event) const;
84
85 // return an event number of an eventInput from input file input
86 // which was merged to create output event event
87   Int_t GetInputEventNumber(Int_t event, Int_t input) const;
88   
89 // return pointer to particle with index i (index with mask)
90   TParticle* GetParticle(Int_t i, Int_t event) const;
91
92 // return pointer to particle with index i in the input file input
93 // (index without mask)
94   TParticle* GetParticle(Int_t i, Int_t input, Int_t event) const;
95
96 // return TString with input file name  
97   TString GetInputFileName(const Int_t input, const Int_t order) const;
98   
99   Int_t     GetDebug() const {return fDebug;}
100   void      SetDebug(Int_t level) {fDebug = level;}
101   
102 private:
103   void Copy(AliRunDigitizer& dig) const;
104   Bool_t            ConnectInputTrees();
105   Bool_t            InitGlobal();
106   Bool_t            InitOutputGlobal();
107   void              InitEvent();
108   void              FinishEvent();
109   void              FinishGlobal();
110
111   Int_t             fkMASK[kMaxStreamsToMerge];  //! masks for track ids from
112                                               //  different source files
113   Int_t             fkMASKSTEP;           // step to increase MASK for
114                                           // each input file
115   TString           fOutputFileName;      // output file name
116   TString           fOutputDirName;       // output dir name
117   TFile *           fOutput;              //! pointer to the output file
118   Int_t             fEvent;               // output event nr.
119   Int_t             fNrOfEventsToWrite;   // Nr of events to write
120   Int_t             fNrOfEventsWritten;   // Nr of events written
121   Int_t             fCopyTreesFromInput;  // from which input file the trees
122                                           // should be copied, -1 for no copies
123   TTree *           fTreeD;               //! output TreeD
124   TTree *           fTreeDTPC;            //! output TreeD for TPC
125   TTree *           fTreeDTRD;            //! output TreeD for TRD
126   TTree *           fTreeR;               //! output TreeR for ITS fast points
127   Int_t             fNinputs;             // nr of input streams - can be taken from the TClonesArray dimension
128   Int_t             fNinputsGiven;        // nr of input streams given by user
129   TClonesArray *    fInputStreams;        // input streams
130   TFile *           fInputFiles[kMaxStreamsToMerge];   //! p. to current input files
131   TTree *           fArrayTreeS[kMaxStreamsToMerge];   //! array with p. to TreeS
132   TTree *           fArrayTreeTPCS[kMaxStreamsToMerge];   //! array with p. to TreeD_75x40_100x60_x (TPC Sdigits)
133   TTree *           fArrayTreeTRDS[kMaxStreamsToMerge];   //! array with p. to TreeSx_TRD (TRD Sdigits)
134   TTree *           fArrayTreeH[kMaxStreamsToMerge];   //! array with p. to TreeH
135   char *            fTreeDTPCBaseName;    //! basename of output TreeD for TPC
136   char *            fTreeTPCSBaseName;    //! basename of output TreeS for TPC
137   AliMergeCombi *   fCombi;               // pointer to the combination object
138   TArrayI           fCombination;         //! combination of events from
139   TString           fCombinationFileName; // fn with combinations (used
140                                           // with type 2 of comb.)
141   Int_t             fDebug;                //! specifies debug level, 0 is min
142   
143   ClassDef(AliRunDigitizer,4)
144 };
145
146 #endif // ALIRUNDIGITIZER_H