]>
Commit | Line | Data |
---|---|---|
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 | #include "TClonesArray.h" | |
21 | class TFile; | |
22 | class TParticle; | |
23 | class TTree; | |
24 | ||
25 | // --- AliRoot header files --- | |
26 | ||
27 | #include "AliStream.h" | |
28 | class AliDigitizer; | |
29 | class AliMergeCombi; | |
30 | class AliRunLoader; | |
31 | ||
32 | static const Int_t kMaxStreamsToMerge = 4; | |
33 | ||
34 | class AliRunDigitizer: public TTask { | |
35 | ||
36 | public: | |
37 | AliRunDigitizer(); | |
38 | AliRunDigitizer(Int_t nInputStreams, Int_t sperb=1); | |
39 | AliRunDigitizer(const AliRunDigitizer& dig); | |
40 | AliRunDigitizer& operator=(const AliRunDigitizer& dig) | |
41 | {dig.Copy(*this); return (*this);} | |
42 | virtual ~AliRunDigitizer(); | |
43 | ||
44 | void ExecuteTask(Option_t* option = 0); | |
45 | void Exec(Option_t *option) {this->Digitize(option);} | |
46 | void Digitize(Option_t* option = 0); | |
47 | void AddDigitizer(AliDigitizer *digitizer); | |
48 | ||
49 | void SetOutputFile(TString fn); | |
50 | TString GetOutputFile() const {return fOutputFileName;} | |
51 | ||
52 | void SetOutputDir(TString dn) {fOutputDirName = dn;} | |
53 | TString GetOutputDir() const {return fOutputDirName;} | |
54 | ||
55 | void SetInputStream(Int_t stream, const char *inputName, TString foldername = ""); | |
56 | ||
57 | void SetFirstOutputEventNr(Int_t i) {fEvent = i;} | |
58 | void SetNrOfEventsToWrite(Int_t i) {fNrOfEventsToWrite = i;} | |
59 | void SetCopyTreesFromInput(Int_t i) {fCopyTreesFromInput = i;} | |
60 | Int_t GetCopyTreesFromInput() const {return fCopyTreesFromInput;} | |
61 | Int_t GetOutputEventNr() const {return fEvent;} | |
62 | void SetCombinationFileName(TString fn) {fCombinationFileName = fn;} | |
63 | TString GetCombinationFileName() const {return fCombinationFileName;} | |
64 | Int_t GetMask(Int_t i) const {return fkMASK[i];} | |
65 | ||
66 | ||
67 | Int_t GetNinputs() const {return fNinputs;} | |
68 | const TString& GetInputFolderName(Int_t i) const; | |
69 | const char* GetOutputFolderName(); | |
70 | ||
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 | AliStream * GetInputStream(const Int_t index) const { return dynamic_cast<AliStream *>(fInputStreams->At(index)) ; } | |
90 | // return pointer to particle with index i (index with mask) | |
91 | TParticle* GetParticle(Int_t i, Int_t event) const; | |
92 | ||
93 | // return pointer to particle with index i in the input file input | |
94 | // (index without mask) | |
95 | TParticle* GetParticle(Int_t i, Int_t input, Int_t event) const; | |
96 | ||
97 | // return TString with input file name | |
98 | TString GetInputFileName(const Int_t input, const Int_t order) const; | |
99 | ||
100 | Int_t GetDebug() const {return fDebug;} | |
101 | void SetDebug(Int_t level) {fDebug = level;} | |
102 | ||
103 | private: | |
104 | void Copy(AliRunDigitizer& dig) const; | |
105 | Bool_t ConnectInputTrees(); | |
106 | Bool_t InitGlobal(); | |
107 | Bool_t InitOutputGlobal(); | |
108 | void InitEvent(); | |
109 | void FinishEvent(); | |
110 | void FinishGlobal(); | |
111 | ||
112 | Int_t fkMASK[kMaxStreamsToMerge]; //! masks for track ids from | |
113 | // different source files | |
114 | Int_t fkMASKSTEP; // step to increase MASK for | |
115 | // each input file | |
116 | TString fOutputFileName; // output file name | |
117 | TString fOutputDirName; // output dir name | |
118 | ||
119 | Int_t fEvent; // output event nr. | |
120 | Int_t fNrOfEventsToWrite; // Nr of events to write | |
121 | Int_t fNrOfEventsWritten; // Nr of events written | |
122 | Int_t fCopyTreesFromInput; // from which input file the trees | |
123 | // should be copied, -1 for no copies | |
124 | Int_t fNinputs; // nr of input streams - can be taken from the TClonesArray dimension | |
125 | Int_t fNinputsGiven; // nr of input streams given by user | |
126 | TClonesArray * fInputStreams; // input signal streams | |
127 | ||
128 | // AliStream* fOutputStream; | |
129 | AliRunLoader* fOutRunLoader; //! | |
130 | Bool_t fOutputInitialized; //indicates if outout was initialized | |
131 | // | |
132 | AliMergeCombi * fCombi; // pointer to the combination object | |
133 | TArrayI fCombination; //! combination of events from | |
134 | TString fCombinationFileName; // fn with combinations (used | |
135 | // with type 2 of comb.) | |
136 | Int_t fDebug; //! specifies debug level, 0 is min | |
137 | ||
138 | AliRunLoader* GetOutRunLoader(); | |
139 | ||
140 | static const TString fgkDefOutFolderName;//default name for output foler | |
141 | static const TString fgkBaseInFolderName;//default name for input foler | |
142 | ClassDef(AliRunDigitizer,5) | |
143 | }; | |
144 | ||
145 | #endif // ALIRUNDIGITIZER_H |