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