Adaption to new fluka common blocks (E. Futo)
[u/mrichter/AliRoot.git] / STEER / AliRunDigitizer.h
CommitLineData
9ce40367 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 ---
e2afb3b6 17
9ce40367 18#include "TArrayI.h"
8d5e6345 19#include "TTask.h"
e2afb3b6 20class TClonesArray;
21class TFile;
22class TParticle;
23class TTree;
9ce40367 24
25// --- AliRoot header files ---
26
27class AliDigitizer;
a90ecf3c 28class AliMergeCombi;
9ce40367 29
116cbefd 30static const Int_t kMaxStreamsToMerge = 4;
e2afb3b6 31
8d5e6345 32class AliRunDigitizer: public TTask {
9ce40367 33
34public:
314558d7 35 AliRunDigitizer();
36 AliRunDigitizer(Int_t nInputStreams, Int_t sperb=1);
e2afb3b6 37 AliRunDigitizer(const AliRunDigitizer& dig);
38 AliRunDigitizer& operator=(const AliRunDigitizer& dig)
39 {dig.Copy(*this); return (*this);}
9ce40367 40 virtual ~AliRunDigitizer();
41 void AddDigitizer(AliDigitizer *digitizer);
8d5e6345 42 void SetOutputFile(TString fn);
9ae76683 43 TString GetOutputFile() const {return fOutputFileName;}
9ce40367 44 void SetOutputDir(TString dn) {fOutputDirName = dn;}
9ae76683 45 TString GetOutputDir() const {return fOutputDirName;}
3466e07f 46 void SetInputStream(Int_t stream, const char *inputName);
9ce40367 47 void SetFirstOutputEventNr(Int_t i) {fEvent = i;}
48 void SetNrOfEventsToWrite(Int_t i) {fNrOfEventsToWrite = i;}
49 void SetCopyTreesFromInput(Int_t i) {fCopyTreesFromInput = i;}
116cbefd 50 Int_t GetCopyTreesFromInput() const {return fCopyTreesFromInput;}
9ae76683 51 Int_t GetOutputEventNr() const {return fEvent;}
9ce40367 52 void SetCombinationFileName(TString fn) {fCombinationFileName = fn;}
9ae76683 53 TString GetCombinationFileName() const {return fCombinationFileName;}
9ce40367 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];}
f042097d 58 void SetInputTreeTPCSBaseName(char * name) {
59 fTreeTPCSBaseName = name;}
9ce40367 60 TTree* GetInputTreeTPCS(Int_t i) const {return fArrayTreeTPCS[i];}
f34e67f9 61 TTree* GetInputTreeTRDS(Int_t i) const {return fArrayTreeTRDS[i];}
9ce40367 62 TTree* GetTreeD() const {return fTreeD;}
f042097d 63 void SetTreeDTPCBaseName(char * name) {
64 fTreeDTPCBaseName = name;}
f34e67f9 65 TTree* GetTreeDTPC() const {return fTreeDTPC;}
66 TTree* GetTreeDTRD() const {return fTreeDTRD;}
a08ddb28 67 TTree* GetTreeR() const {return fTreeR;}
8d5e6345 68 void Digitize(Option_t* option = 0);
f042097d 69 void Exec(Option_t *option) {this->Digitize(option);}
8d5e6345 70 void ExecuteTask(Option_t* option = 0);
9ce40367 71
8d5e6345 72
9ce40367 73// Nr of particles in all input files for a given event
74// (as numbered in the output file)
9ae76683 75 Int_t GetNParticles(Int_t event) const;
9ce40367 76
77// Nr of particles in input file input for a given event
78// (as numbered in this input file)
9ae76683 79 Int_t GetNParticles(Int_t event, Int_t input) const;
9ce40367 80
81// return pointer to an int array with input event numbers which were
82// merged in the output event event
9ae76683 83 Int_t* GetInputEventNumbers(Int_t event) const;
9ce40367 84
85// return an event number of an eventInput from input file input
86// which was merged to create output event event
9ae76683 87 Int_t GetInputEventNumber(Int_t event, Int_t input) const;
9ce40367 88
89// return pointer to particle with index i (index with mask)
9ae76683 90 TParticle* GetParticle(Int_t i, Int_t event) const;
9ce40367 91
92// return pointer to particle with index i in the input file input
93// (index without mask)
9ae76683 94 TParticle* GetParticle(Int_t i, Int_t input, Int_t event) const;
9ce40367 95
2e3dd5e5 96// return TString with input file name
97 TString GetInputFileName(const Int_t input, const Int_t order) const;
9ce40367 98
99 Int_t GetDebug() const {return fDebug;}
100 void SetDebug(Int_t level) {fDebug = level;}
101
102private:
e2afb3b6 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
9ae76683 111 Int_t fkMASK[kMaxStreamsToMerge]; //! masks for track ids from
9ce40367 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
f34e67f9 124 TTree * fTreeDTPC; //! output TreeD for TPC
125 TTree * fTreeDTRD; //! output TreeD for TRD
a08ddb28 126 TTree * fTreeR; //! output TreeR for ITS fast points
a90ecf3c 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
9ae76683 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
f042097d 135 char * fTreeDTPCBaseName; //! basename of output TreeD for TPC
136 char * fTreeTPCSBaseName; //! basename of output TreeS for TPC
a90ecf3c 137 AliMergeCombi * fCombi; // pointer to the combination object
9ce40367 138 TArrayI fCombination; //! combination of events from
9ce40367 139 TString fCombinationFileName; // fn with combinations (used
140 // with type 2 of comb.)
9ce40367 141 Int_t fDebug; //! specifies debug level, 0 is min
142
f042097d 143 ClassDef(AliRunDigitizer,4)
9ce40367 144};
145
146#endif // ALIRUNDIGITIZER_H