]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRunDigitizer.h
Set to zero new pointers to TPC and TRD special trees in the default ctor. Add const...
[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 #include "TNamed.h"
18 #include "TObjString.h"
19 #include "TArrayI.h"
20 #include "TClonesArray.h"
21 #include "TTree.h"
22 #include "TParticle.h"
23 #include "TTask.h"
24
25 const Int_t kMaxStreamsToMerge = 4;
26
27 // --- AliRoot header files ---
28
29 class AliDigitizer;
30 class AliMergeCombi;
31
32 class AliRunDigitizer: public TTask {
33
34 public:
35   AliRunDigitizer(Int_t nInputStream=1, Int_t sperb=1);
36   virtual ~AliRunDigitizer();
37   void      AddDigitizer(AliDigitizer *digitizer);
38   void      SetOutputFile(TString fn);
39   TString   GetOutputFile() const {return fOutputFileName;}
40   void      SetOutputDir(TString dn) {fOutputDirName = dn;}
41   TString   GetOutputDir() const {return fOutputDirName;}
42   void      SetInputStream(Int_t stream, char *inputName);
43   void      SetFirstOutputEventNr(Int_t i) {fEvent = i;}
44   void      SetNrOfEventsToWrite(Int_t i) {fNrOfEventsToWrite = i;}
45   void      SetCopyTreesFromInput(Int_t i) {fCopyTreesFromInput = i;}
46   Int_t     GetCopyTreesFromInput() {return fCopyTreesFromInput;}
47   Int_t     GetOutputEventNr() const {return fEvent;}
48   void      SetCombinationFileName(TString fn) {fCombinationFileName = fn;} 
49   TString   GetCombinationFileName() const {return fCombinationFileName;}
50   Int_t     GetNinputs() const {return fNinputs;}
51   Int_t     GetMask(Int_t i) const {return fkMASK[i];}
52   TTree*    GetInputTreeS(Int_t i) const {return fArrayTreeS[i];}
53   TTree*    GetInputTreeH(Int_t i) const {return fArrayTreeH[i];}
54   TTree*    GetInputTreeTPCS(Int_t i) const {return fArrayTreeTPCS[i];}
55   TTree*    GetInputTreeTRDS(Int_t i) const {return fArrayTreeTRDS[i];}
56   TTree*    GetTreeD() const {return fTreeD;}
57   TTree*    GetTreeDTPC() const {return fTreeDTPC;} 
58   TTree*    GetTreeDTRD() const {return fTreeDTRD;} 
59   void      Digitize(Option_t* option = 0);
60   void      Exec(Option_t *option) {this->Digitize();}
61   void      ExecuteTask(Option_t* option = 0);
62
63   
64 // Nr of particles in all input files for a given event
65 //     (as numbered in the output file)
66   Int_t GetNParticles(Int_t event) const;
67
68 // Nr of particles in input file input for a given event
69 //     (as numbered in this input file)
70   Int_t GetNParticles(Int_t event, Int_t input) const;
71
72 // return pointer to an int array with input event numbers which were
73 // merged in the output event event
74   Int_t* GetInputEventNumbers(Int_t event) const;
75
76 // return an event number of an eventInput from input file input
77 // which was merged to create output event event
78   Int_t GetInputEventNumber(Int_t event, Int_t input) const;
79   
80 // return pointer to particle with index i (index with mask)
81   TParticle* GetParticle(Int_t i, Int_t event) const;
82
83 // return pointer to particle with index i in the input file input
84 // (index without mask)
85   TParticle* GetParticle(Int_t i, Int_t input, Int_t event) const;
86
87   
88   Int_t     GetDebug() const {return fDebug;}
89   void      SetDebug(Int_t level) {fDebug = level;}
90   
91 private:
92   Int_t             fkMASK[kMaxStreamsToMerge];  //! masks for track ids from
93                                               //  different source files
94   Int_t             fkMASKSTEP;           // step to increase MASK for
95                                           // each input file
96   TString           fOutputFileName;      // output file name
97   TString           fOutputDirName;       // output dir name
98   TFile *           fOutput;              //! pointer to the output file
99   Int_t             fEvent;               // output event nr.
100   Int_t             fNrOfEventsToWrite;   // Nr of events to write
101   Int_t             fNrOfEventsWritten;   // Nr of events written
102   Int_t             fCopyTreesFromInput;  // from which input file the trees
103                                           // should be copied, -1 for no copies
104   TTree *           fTreeD;               //! output TreeD
105   TTree *           fTreeDTPC;            //! output TreeD for TPC
106   TTree *           fTreeDTRD;            //! output TreeD for TRD
107   Int_t             fNinputs;             // nr of input streams - can be taken from the TClonesArray dimension
108   Int_t             fNinputsGiven;        // nr of input streams given by user
109   TClonesArray *    fInputStreams;        // input streams
110   TFile *           fInputFiles[kMaxStreamsToMerge];   //! p. to current input files
111   TTree *           fArrayTreeS[kMaxStreamsToMerge];   //! array with p. to TreeS
112   TTree *           fArrayTreeTPCS[kMaxStreamsToMerge];   //! array with p. to TreeD_75x40_100x60_x (TPC Sdigits)
113   TTree *           fArrayTreeTRDS[kMaxStreamsToMerge];   //! array with p. to TreeSx_TRD (TRD Sdigits)
114   TTree *           fArrayTreeH[kMaxStreamsToMerge];   //! array with p. to TreeH
115   AliMergeCombi *   fCombi;               // pointer to the combination object
116   TArrayI           fCombination;         //! combination of events from
117   TString           fCombinationFileName; // fn with combinations (used
118                                           // with type 2 of comb.)
119   Bool_t            ConnectInputTrees();
120   Bool_t            InitGlobal();
121   Bool_t            InitOutputGlobal();
122   void              InitEvent();
123   void              FinishEvent();
124   void              FinishGlobal();
125   Int_t             fDebug;                //! specifies debug level, 0 is min
126   
127   ClassDef(AliRunDigitizer,3)
128 };
129
130 #endif // ALIRUNDIGITIZER_H