]>
Commit | Line | Data |
---|---|---|
28752ff4 | 1 | #ifndef ALIMUONDIGITIZER_H |
2 | #define ALIMUONDIGITIZER_H | |
3 | /* Copyright(c) 1998-2001, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
30178c30 | 7 | // Revision of includes 07/05/2004 |
8 | ||
692de412 | 9 | /// \ingroup sim |
10 | /// \class AliMUONDigitizer | |
11 | /// \brief Class for MUON merging/digitization | |
12 | ||
b8278504 | 13 | #include "AliDigitizer.h" |
30178c30 | 14 | #include "AliMUONDigit.h" |
28752ff4 | 15 | |
16 | class AliRunDigitizer; | |
30178c30 | 17 | class AliRunLoader; |
8f36c696 | 18 | class AliMUONHitMapA1; |
30178c30 | 19 | class AliMUON; |
20 | class AliMUONData; | |
21 | class AliMUONLoader; | |
22 | class AliMUONTransientDigit; | |
cf286af7 | 23 | |
7bd1d684 | 24 | static const Int_t kMAXTRACKS=10; |
25 | ||
cf286af7 | 26 | class AliMUONDigitizer : public AliDigitizer |
27 | { | |
28 | public: | |
29 | ||
30 | /* Default constructor initializes all the internal pointers to NULL. | |
31 | */ | |
32 | AliMUONDigitizer(); | |
33 | ||
34 | /* Constructor initialises all the internal pointers to NULL and | |
35 | sets this digitizers manager to the one specified. | |
36 | */ | |
37 | AliMUONDigitizer(AliRunDigitizer * manager); | |
38 | ||
8789635b | 39 | // Destructor |
40 | virtual ~AliMUONDigitizer(); | |
41 | ||
cf286af7 | 42 | // The Init method does nothing. |
43 | // All initialization happens in Exec at the moment. | |
44 | virtual Bool_t Init(); | |
45 | ||
46 | // Override the TTask Exec method. | |
47 | virtual void Exec(Option_t* option = 0); | |
48 | ||
cf286af7 | 49 | protected: |
cf286af7 | 50 | /* Digitizers inheriting from AliMUONDigitizer should implement this abstract method |
51 | so that TransientDigit objects are generated and put onto the fTDList. | |
52 | The method would be implemented as some loop over the input stream. The data can be | |
30178c30 | 53 | fetched from the fMUONData pointer. To add to the fTDList once should use code similar |
cf286af7 | 54 | to the following: |
55 | ||
56 | TObject* source_object; // Assume the object from which the transient digit | |
57 | // is created is already initialized at this point. | |
58 | AliMUONTransientDigit* td = new AliMUONTransientDigit(); | |
59 | // Initialize the transient digit. | |
60 | // ... | |
61 | ||
62 | // The following line of code is required to have working digitisers that want | |
63 | // to store information about which digits were created from which hits. | |
64 | OnCreateTransientDigit(td, source_object); | |
65 | ||
66 | AddOrUpdateTransientDigit(td); // Adds to the fTDList preventing duplicates. | |
67 | */ | |
68 | virtual void GenerateTransientDigits() = 0; | |
ce3e25a8 | 69 | |
cf286af7 | 70 | // Loops over the fTDList of transient digits to write them to the output stream. |
71 | virtual void CreateDigits(); | |
72 | ||
30178c30 | 73 | /* Inheriting digitizers should implement this method to prepare the fMUONData |
cf286af7 | 74 | object before GenerateTransientDigits() is called. |
75 | If the initialization was successful then kTRUE should be returned otherwise | |
76 | kFALSE should be returned. | |
77 | */ | |
78 | virtual Bool_t InitInputData(AliMUONLoader* muonloader) = 0; | |
79 | ||
80 | /* This method should be overridden to undo/cleanup what was done in the | |
81 | InitInputData method call. | |
82 | */ | |
83 | virtual void CleanupInputData(AliMUONLoader* muonloader) = 0; | |
84 | ||
30178c30 | 85 | /* Inheriting digitizers should implement this method to prepare the fMUONData |
cf286af7 | 86 | object before CreateDigits() is called. |
87 | If the initialization was successful then kTRUE should be returned otherwise | |
88 | kFALSE should be returned. | |
89 | */ | |
90 | virtual Bool_t InitOutputData(AliMUONLoader* muonloader) = 0; | |
91 | ||
30178c30 | 92 | /* When all the data is added to the fMUONData object and the trees need to be |
cf286af7 | 93 | filled then this method is called by CreateDigits(). |
94 | Thus code like | |
30178c30 | 95 | fMUONData->Fill("D") |
cf286af7 | 96 | should go into this method. |
97 | */ | |
98 | virtual void FillOutputData() = 0; | |
99 | ||
100 | /* This method should be overridden to undo/cleanup what was done in the | |
101 | InitOutputData method call. | |
102 | */ | |
103 | virtual void CleanupOutputData(AliMUONLoader* muonloader) = 0; | |
104 | ||
105 | /* This is called by CreateDigits when it wants the Signal value that will be written | |
106 | to the output stream. Inheriting digitizers can override this to apply some kind | |
107 | of detector response. | |
108 | */ | |
109 | virtual Int_t GetSignalFrom(AliMUONTransientDigit* td) = 0; | |
110 | ||
111 | /* Should be overridden by inheriting digitizers such that this method adds the digits | |
112 | to the correct tree. | |
113 | */ | |
76fa1113 | 114 | virtual void AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7]) = 0; |
cf286af7 | 115 | |
116 | /* Should be called by GenerateTransientDigits() when a new transient digit is generated | |
117 | form a source object from the input stream. The source object could be an AliMUONHit | |
118 | or AliMUONSDigit for example. | |
119 | */ | |
120 | virtual void OnCreateTransientDigit(AliMUONTransientDigit* /*digit*/, TObject* /*source_object*/); | |
121 | ||
122 | /* Called by AddDigit(AliMUONTransientDigit*, Int_t) when transient digit is added to the | |
30178c30 | 123 | fMUONData object ready for writing to the data trees. |
cf286af7 | 124 | */ |
125 | virtual void OnWriteTransientDigit(AliMUONTransientDigit* digit); | |
126 | ||
127 | // Wrapper method for AddDigit(Int_t, Int_t[kMAXTRACKS], Int_t[kMAXTRACKS], Int_t[6]) | |
b812d393 | 128 | void AddDigit(AliMUONTransientDigit* td, Int_t responseCharge, Int_t digitindex); |
cf286af7 | 129 | |
130 | // Creates a new fTDList object, and creates and fills the fHitMap arrays. | |
131 | // Note: this method assumes the array pointers are NULL when calling this method. | |
132 | void InitArrays(); | |
133 | ||
134 | // Frees the memory allocated for fTDList and the fHitMap arrays. | |
135 | void CleanupArrays(); | |
136 | ||
137 | /* Gets the run loader and muon loader pointers from the given folder name. If an error | |
138 | occurred then kFALSE is returned else kTRUE on success. | |
139 | */ | |
140 | Bool_t FetchLoaders(const char* foldername, AliRunLoader*& runloader, AliMUONLoader*& muonloader); | |
141 | ||
142 | /* Gets the gAlice, and MUON module pointers from the specified run loader. If an error | |
143 | occurred then kFALSE is returned else kTRUE on success. | |
144 | */ | |
145 | Bool_t FetchGlobalPointers(AliRunLoader* runloader); | |
146 | ||
147 | // Adds the transient digit uniquely to the fTDList. | |
148 | void AddOrUpdateTransientDigit(AliMUONTransientDigit* mTD); | |
149 | ||
150 | // Updates a TransientDigit in fTDList | |
151 | void UpdateTransientDigit(AliMUONTransientDigit * mTD); | |
152 | ||
153 | // Adds the new TransientDigit to fTDList | |
154 | void AddTransientDigit(AliMUONTransientDigit * mTD); | |
155 | ||
156 | // Verify that a TransientDigit already exists. | |
157 | Bool_t ExistTransientDigit(AliMUONTransientDigit * mTD); | |
158 | ||
159 | // Sorts the 3 most significant tracks. | |
30178c30 | 160 | void SortTracks(Int_t *tracks, Int_t *charges, Int_t ntr) const; |
cf286af7 | 161 | |
ce3e25a8 | 162 | // trigger purpose |
ce3e25a8 | 163 | virtual void CreateTrigger() = 0; |
164 | virtual void CleanupTriggerArrays() = 0; | |
165 | virtual void FillTriggerOutput() = 0; | |
2be06f1e | 166 | virtual void AddDigitTrigger( |
167 | Int_t chamber, Int_t tracks[kMAXTRACKS], | |
168 | Int_t charges[kMAXTRACKS], Int_t digits[6], | |
7fe0032c | 169 | Int_t digitindex ) = 0; |
cf286af7 | 170 | |
829425a5 | 171 | AliRunLoader* fRunLoader; //!< Global run loader. |
172 | AliMUONLoader* fGime; //!< MUON specific loader. | |
173 | AliMUON* fMUON; //!< Pointer to MUON module. | |
174 | AliMUONData* fMUONData; //!< muon data interface | |
829425a5 | 175 | |
176 | AliMUONHitMapA1 **fHitMap; //!< pointer to array of pointers to hitmaps | |
177 | TObjArray *fTDList; //!< list of AliMUONTransientDigits | |
178 | Int_t fTDCounter; //!< nr. of AliMUONTransientDigit | |
179 | Int_t fMask; //!< mask dependent on input file | |
180 | Bool_t fSignal; //!< kTRUE if signal file is processed | |
181 | Int_t fSegmentation; //!< segmentation type 1=old, 2=new; | |
182 | Int_t fNDetElemId[1500]; //!< detection element number array | |
edb96c6a | 183 | |
cf286af7 | 184 | |
185 | private: | |
b21698f0 | 186 | AliMUONDigitizer(const AliMUONDigitizer& rhs); |
187 | AliMUONDigitizer& operator=(const AliMUONDigitizer& rhs); | |
cf286af7 | 188 | |
cf286af7 | 189 | ClassDef(AliMUONDigitizer, 1) // MUON merging/digitization |
28752ff4 | 190 | }; |
191 | #endif |