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 */
8 ////////////////////////////////////////////////////////////////////////
10 // Manager Class for Merging/Digitization
12 // Author: Jiri Chudoba (CERN)
14 ////////////////////////////////////////////////////////////////////////
16 // --- ROOT system ---
18 #include "TObjString.h"
20 #include "TClonesArray.h"
22 #include "TParticle.h"
25 const Int_t kMaxStreamsToMerge = 4;
27 // --- AliRoot header files ---
32 class AliRunDigitizer: public TTask {
36 AliRunDigitizer(Int_t nInputStreams, Int_t sperb=1);
37 virtual ~AliRunDigitizer();
38 void AddDigitizer(AliDigitizer *digitizer);
39 void SetOutputFile(TString fn);
40 TString GetOutputFile() const {return fOutputFileName;}
41 void SetOutputDir(TString dn) {fOutputDirName = dn;}
42 TString GetOutputDir() const {return fOutputDirName;}
43 void SetInputStream(Int_t stream, const 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() const {return fEvent;}
49 void SetCombinationFileName(TString fn) {fCombinationFileName = fn;}
50 TString GetCombinationFileName() const {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 void SetInputTreeTPCSBaseName(char * name) {
56 fTreeTPCSBaseName = name;}
57 TTree* GetInputTreeTPCS(Int_t i) const {return fArrayTreeTPCS[i];}
58 TTree* GetInputTreeTRDS(Int_t i) const {return fArrayTreeTRDS[i];}
59 TTree* GetTreeD() const {return fTreeD;}
60 void SetTreeDTPCBaseName(char * name) {
61 fTreeDTPCBaseName = name;}
62 TTree* GetTreeDTPC() const {return fTreeDTPC;}
63 TTree* GetTreeDTRD() const {return fTreeDTRD;}
64 void Digitize(Option_t* option = 0);
65 void Exec(Option_t *option) {this->Digitize(option);}
66 void ExecuteTask(Option_t* option = 0);
69 // Nr of particles in all input files for a given event
70 // (as numbered in the output file)
71 Int_t GetNParticles(Int_t event) const;
73 // Nr of particles in input file input for a given event
74 // (as numbered in this input file)
75 Int_t GetNParticles(Int_t event, Int_t input) const;
77 // return pointer to an int array with input event numbers which were
78 // merged in the output event event
79 Int_t* GetInputEventNumbers(Int_t event) const;
81 // return an event number of an eventInput from input file input
82 // which was merged to create output event event
83 Int_t GetInputEventNumber(Int_t event, Int_t input) const;
85 // return pointer to particle with index i (index with mask)
86 TParticle* GetParticle(Int_t i, Int_t event) const;
88 // return pointer to particle with index i in the input file input
89 // (index without mask)
90 TParticle* GetParticle(Int_t i, Int_t input, Int_t event) const;
93 Int_t GetDebug() const {return fDebug;}
94 void SetDebug(Int_t level) {fDebug = level;}
97 Int_t fkMASK[kMaxStreamsToMerge]; //! masks for track ids from
98 // different source files
99 Int_t fkMASKSTEP; // step to increase MASK for
101 TString fOutputFileName; // output file name
102 TString fOutputDirName; // output dir name
103 TFile * fOutput; //! pointer to the output file
104 Int_t fEvent; // output event nr.
105 Int_t fNrOfEventsToWrite; // Nr of events to write
106 Int_t fNrOfEventsWritten; // Nr of events written
107 Int_t fCopyTreesFromInput; // from which input file the trees
108 // should be copied, -1 for no copies
109 TTree * fTreeD; //! output TreeD
110 TTree * fTreeDTPC; //! output TreeD for TPC
111 TTree * fTreeDTRD; //! output TreeD for TRD
112 Int_t fNinputs; // nr of input streams - can be taken from the TClonesArray dimension
113 Int_t fNinputsGiven; // nr of input streams given by user
114 TClonesArray * fInputStreams; // input streams
115 TFile * fInputFiles[kMaxStreamsToMerge]; //! p. to current input files
116 TTree * fArrayTreeS[kMaxStreamsToMerge]; //! array with p. to TreeS
117 TTree * fArrayTreeTPCS[kMaxStreamsToMerge]; //! array with p. to TreeD_75x40_100x60_x (TPC Sdigits)
118 TTree * fArrayTreeTRDS[kMaxStreamsToMerge]; //! array with p. to TreeSx_TRD (TRD Sdigits)
119 TTree * fArrayTreeH[kMaxStreamsToMerge]; //! array with p. to TreeH
120 char * fTreeDTPCBaseName; //! basename of output TreeD for TPC
121 char * fTreeTPCSBaseName; //! basename of output TreeS for TPC
122 AliMergeCombi * fCombi; // pointer to the combination object
123 TArrayI fCombination; //! combination of events from
124 TString fCombinationFileName; // fn with combinations (used
125 // with type 2 of comb.)
126 Bool_t ConnectInputTrees();
128 Bool_t InitOutputGlobal();
132 Int_t fDebug; //! specifies debug level, 0 is min
134 ClassDef(AliRunDigitizer,4)
137 #endif // ALIRUNDIGITIZER_H