]>
Commit | Line | Data |
---|---|---|
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$ */ | |
7 | // Revision of includes 07/05/2004 | |
8 | ||
9 | #include "AliDigitizer.h" | |
10 | #include "AliMUONDigit.h" | |
11 | ||
12 | class AliRunDigitizer; | |
13 | class AliRunLoader; | |
14 | class AliMUONHitMapA1; | |
15 | class AliMUON; | |
16 | class AliMUONData; | |
17 | class AliMUONLoader; | |
18 | class AliMUONTransientDigit; | |
19 | class AliMUONTriggerDecision; | |
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 | ||
34 | // Destructor | |
35 | virtual ~AliMUONDigitizer(); | |
36 | ||
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 | protected: | |
45 | AliMUONDigitizer(const AliMUONDigitizer& rhs); | |
46 | AliMUONDigitizer& operator=(const AliMUONDigitizer& rhs); | |
47 | ||
48 | /* Digitizers inheriting from AliMUONDigitizer should implement this abstract method | |
49 | so that TransientDigit objects are generated and put onto the fTDList. | |
50 | The method would be implemented as some loop over the input stream. The data can be | |
51 | fetched from the fMUONData pointer. To add to the fTDList once should use code similar | |
52 | to the following: | |
53 | ||
54 | TObject* source_object; // Assume the object from which the transient digit | |
55 | // is created is already initialized at this point. | |
56 | AliMUONTransientDigit* td = new AliMUONTransientDigit(); | |
57 | // Initialize the transient digit. | |
58 | // ... | |
59 | ||
60 | // The following line of code is required to have working digitisers that want | |
61 | // to store information about which digits were created from which hits. | |
62 | OnCreateTransientDigit(td, source_object); | |
63 | ||
64 | AddOrUpdateTransientDigit(td); // Adds to the fTDList preventing duplicates. | |
65 | */ | |
66 | virtual void GenerateTransientDigits() = 0; | |
67 | ||
68 | // Loops over the fTDList of transient digits to write them to the output stream. | |
69 | virtual void CreateDigits(); | |
70 | ||
71 | /* Inheriting digitizers should implement this method to prepare the fMUONData | |
72 | object before GenerateTransientDigits() is called. | |
73 | If the initialization was successful then kTRUE should be returned otherwise | |
74 | kFALSE should be returned. | |
75 | */ | |
76 | virtual Bool_t InitInputData(AliMUONLoader* muonloader) = 0; | |
77 | ||
78 | /* This method should be overridden to undo/cleanup what was done in the | |
79 | InitInputData method call. | |
80 | */ | |
81 | virtual void CleanupInputData(AliMUONLoader* muonloader) = 0; | |
82 | ||
83 | /* Inheriting digitizers should implement this method to prepare the fMUONData | |
84 | object before CreateDigits() is called. | |
85 | If the initialization was successful then kTRUE should be returned otherwise | |
86 | kFALSE should be returned. | |
87 | */ | |
88 | virtual Bool_t InitOutputData(AliMUONLoader* muonloader) = 0; | |
89 | ||
90 | /* When all the data is added to the fMUONData object and the trees need to be | |
91 | filled then this method is called by CreateDigits(). | |
92 | Thus code like | |
93 | fMUONData->Fill("D") | |
94 | should go into this method. | |
95 | */ | |
96 | virtual void FillOutputData() = 0; | |
97 | ||
98 | /* This method should be overridden to undo/cleanup what was done in the | |
99 | InitOutputData method call. | |
100 | */ | |
101 | virtual void CleanupOutputData(AliMUONLoader* muonloader) = 0; | |
102 | ||
103 | /* This is called by CreateDigits when it wants the Signal value that will be written | |
104 | to the output stream. Inheriting digitizers can override this to apply some kind | |
105 | of detector response. | |
106 | */ | |
107 | virtual Int_t GetSignalFrom(AliMUONTransientDigit* td) = 0; | |
108 | ||
109 | /* Should be overridden by inheriting digitizers such that this method adds the digits | |
110 | to the correct tree. | |
111 | */ | |
112 | virtual void AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7]) = 0; | |
113 | ||
114 | /* Should be called by GenerateTransientDigits() when a new transient digit is generated | |
115 | form a source object from the input stream. The source object could be an AliMUONHit | |
116 | or AliMUONSDigit for example. | |
117 | */ | |
118 | virtual void OnCreateTransientDigit(AliMUONTransientDigit* /*digit*/, TObject* /*source_object*/); | |
119 | ||
120 | /* Called by AddDigit(AliMUONTransientDigit*, Int_t) when transient digit is added to the | |
121 | fMUONData object ready for writing to the data trees. | |
122 | */ | |
123 | virtual void OnWriteTransientDigit(AliMUONTransientDigit* digit); | |
124 | ||
125 | // Wrapper method for AddDigit(Int_t, Int_t[kMAXTRACKS], Int_t[kMAXTRACKS], Int_t[6]) | |
126 | void AddDigit(AliMUONTransientDigit* td, Int_t responseCharge, Int_t digitindex); | |
127 | ||
128 | // Creates a new fTDList object, and creates and fills the fHitMap arrays. | |
129 | // Note: this method assumes the array pointers are NULL when calling this method. | |
130 | void InitArrays(); | |
131 | ||
132 | // Frees the memory allocated for fTDList and the fHitMap arrays. | |
133 | void CleanupArrays(); | |
134 | ||
135 | /* Gets the run loader and muon loader pointers from the given folder name. If an error | |
136 | occurred then kFALSE is returned else kTRUE on success. | |
137 | */ | |
138 | Bool_t FetchLoaders(const char* foldername, AliRunLoader*& runloader, AliMUONLoader*& muonloader); | |
139 | ||
140 | /* Gets the gAlice, and MUON module pointers from the specified run loader. If an error | |
141 | occurred then kFALSE is returned else kTRUE on success. | |
142 | */ | |
143 | Bool_t FetchGlobalPointers(AliRunLoader* runloader); | |
144 | ||
145 | // Adds the transient digit uniquely to the fTDList. | |
146 | void AddOrUpdateTransientDigit(AliMUONTransientDigit* mTD); | |
147 | ||
148 | // Updates a TransientDigit in fTDList | |
149 | void UpdateTransientDigit(AliMUONTransientDigit * mTD); | |
150 | ||
151 | // Adds the new TransientDigit to fTDList | |
152 | void AddTransientDigit(AliMUONTransientDigit * mTD); | |
153 | ||
154 | // Verify that a TransientDigit already exists. | |
155 | Bool_t ExistTransientDigit(AliMUONTransientDigit * mTD); | |
156 | ||
157 | // Sorts the 3 most significant tracks. | |
158 | void SortTracks(Int_t *tracks, Int_t *charges, Int_t ntr) const; | |
159 | ||
160 | // trigger purpose | |
161 | virtual Bool_t FetchTriggerPointer(AliMUONLoader* loader); | |
162 | virtual void CreateTrigger() = 0; | |
163 | virtual void CleanupTriggerArrays() = 0; | |
164 | virtual void FillTriggerOutput() = 0; | |
165 | virtual void AddDigitTrigger( | |
166 | Int_t chamber, Int_t tracks[kMAXTRACKS], | |
167 | Int_t charges[kMAXTRACKS], Int_t digits[6], | |
168 | Int_t digitindex ) = 0; | |
169 | ||
170 | AliRunLoader* fRunLoader; //! Global run loader. | |
171 | AliMUONLoader* fGime; //! MUON specific loader. | |
172 | AliMUON* fMUON; //! Pointer to MUON module. | |
173 | AliMUONData* fMUONData; //! muon data interface | |
174 | AliMUONTriggerDecision* fTrigDec; //!trigger pointer | |
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 | |
183 | ||
184 | ||
185 | private: | |
186 | ||
187 | ClassDef(AliMUONDigitizer, 1) // MUON merging/digitization | |
188 | }; | |
189 | #endif |