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