Remove declaration of unimplemented method
[u/mrichter/AliRoot.git] / HLT / MUON / src / AliRoot / TriggerSource.hpp
CommitLineData
8356cc1d 1////////////////////////////////////////////////////////////////////////////////
2//
3// Author: Artur Szostak
4// Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
5//
6////////////////////////////////////////////////////////////////////////////////
7
3a682eae 8/* AliHLTMUONTriggerSource is used to extract L0 trigger information for
9 the muon spectrometer from a simulated event stored in .root files by AliRoot.
10 It is used by the AliHLTMUONMicrodHLT class as a input data set for the
11 dHLT algorithm.
12 */
13
69d7cf2e 14#ifndef ALIHLTMUONTRIGGERSOURCE_H
15#define ALIHLTMUONTRIGGERSOURCE_H
8356cc1d 16
17#include "TROOT.h"
18#include "TObject.h"
19#include "TString.h"
20#include "TClonesArray.h"
21#include "AliRoot/TriggerRecord.hpp"
22
23class AliMUON;
24class AliMUONLocalTrigger;
25class AliMUONDataInterface;
26
27
69d7cf2e 28class AliHLTMUONTriggerSource : public TObject
8356cc1d 29{
4175c31c 30public: // Unfortunately ROOT requires the following to be public.
31
32 class AliEventData : public TObject
33 {
34 public:
35 AliEventData();
36 AliEventData(Int_t eventnumber);
37 virtual ~AliEventData();
38
39 Int_t& EventNumber() { return fEventNumber; }
40 TClonesArray& Blocks() { return fBlocks; }
41
42 private:
43
44 Int_t fEventNumber; // Event number in AliMUONDataInterface from which the triggers were taken.
45 TClonesArray fBlocks; // The list of blocks of trigger records.
46
47 ClassDef(AliEventData, 1) // Data per event.
48 };
49
50
8356cc1d 51public:
52
53 enum AreaType
54 {
3a682eae 55 kFromWholePlane,
56 kFromLeftHalfPlane,
57 kFromRightHalfPlane
8356cc1d 58 };
59
60 enum SourceType
61 {
3a682eae 62 kFromHits,
63 kFromLocalTriggers
8356cc1d 64 };
65
66
69d7cf2e 67 AliHLTMUONTriggerSource();
8356cc1d 68
69 /* Creates a new trigger source object by filling data from the data interface.
70 */
69d7cf2e 71 AliHLTMUONTriggerSource(AliMUONDataInterface* data);
8356cc1d 72
69d7cf2e 73 virtual ~AliHLTMUONTriggerSource();
8356cc1d 74
75 /* Get and set methods to specify how the FillFrom methods should fill the
76 internal data structures.
77 */
e33f3609 78 void AreaToUse(AreaType value) { fAreaToUse = value; };
8356cc1d 79 AreaType AreaToUse() const { return fAreaToUse; };
e33f3609 80 void DataToUse(SourceType value) { fDataToUse = value; };
8356cc1d 81 SourceType DataToUse() const { return fDataToUse; };
e33f3609 82 void MaxBlockSize(UInt_t value) { fMaxBlockSize = value; };
8356cc1d 83 UInt_t MaxBlockSize() const { return fMaxBlockSize; };
e33f3609 84 void UseLookupTable(Bool_t value) { fUseLookupTable = value; };
8356cc1d 85 Bool_t UseLookupTable() const { return fUseLookupTable; };
86
87 /* Fills the internal data structures from the specified data interface
88 for all the events found in AliMUONDataInterface.
89 */
90 void FillFrom(AliMUONDataInterface* data);
91
92 /* Fills the internal data structures from the specified data interface
93 for the given event.
94 */
e33f3609 95 void FillFrom(AliMUONDataInterface* data, Int_t event);
8356cc1d 96
97 /* Fills the internal data structures from the specified data interface
98 for the given event and trigger number.
99 If 'newblock' is set to true then the new trigger record is added to
100 a new block. Otherwise the point is added to the current block.
101 Note: This method ignores the fAreaToUse and fMaxBlockSize flags.
102 This is very usefull for custom trigger source filling.
103 For the case of adding data from AliMUONHit objects the 'trigger'
104 parameter becomes the track number in TreeH and not the index of the
105 AliMUONLocalTrigger object.
106 */
107 void FillFrom(
108 AliMUONDataInterface* data,
e33f3609 109 Int_t event, Int_t trigger, Bool_t newblock = kFALSE
8356cc1d 110 );
111
112 /* Clears all the internal arrays.
113 */
12ab84fc 114 virtual void Clear(Option_t* option = "");
8356cc1d 115
116 // Get methods.
117 TString FileName() const { return fFilename; };
118 TString FolderName() const { return fFoldername; };
119
120 /* Returns the number of events stored.
121 */
122 Int_t NumberOfEvents() const { return fEventList.GetEntriesFast(); };
123
69d7cf2e 124 /* Fetches the specified event number stored in this AliHLTMUONTriggerSource.
8356cc1d 125 Sets the current block and trigger to the first block and trigger record in
126 the event. If there are no blocks or trigger records then these pointers are
127 set to NULL. kTRUE is returned if the event was found, kFALSE otherwise.
128 */
e33f3609 129 Bool_t GetEvent(Int_t eventnumber) const;
8356cc1d 130
69d7cf2e 131 /* Fetches the first event stored in this AliHLTMUONTriggerSource.
8356cc1d 132 Sets the current block and trigger record to the first block and trigger
133 in the event. If there are no blocks or trigger records then these pointers
134 are set to NULL. kTRUE is returned if the event was found, kFALSE otherwise.
135 */
136 Bool_t GetFirstEvent() const;
137
138 /* Returns kTRUE if there are more events to iterate over.
139 */
140 Bool_t MoreEvents() const;
141
142 /* Fetches the next event stored following the currently selected one.
143 kTRUE is returned if the event was found, kFALSE otherwise.
144 The internal pointers are reset if we reached the last event.
145 */
146 Bool_t GetNextEvent() const;
147
148 /* Returns the corresponding AliRoot event number for the current event.
149 -1 is returned if no event is selected.
150 */
151 Int_t CurrentEvent() const;
152
153 /* Returns the number of trigger record blocks in the current event.
154 -1 is returned if no event is selected.
155 */
156 Int_t NumberOfBlocks() const;
157
158 /* Fetches the index'th block in the current event.
159 Sets the current trigger record to the first trigger in the block.
160 If there are no trigger records then this pointer is set to NULL.
161 kTRUE is returned if the block was found, kFALSE otherwise.
162 */
e33f3609 163 Bool_t GetBlock(Int_t index) const;
8356cc1d 164
165 /* Fetches the first block in the current event.
166 Sets the current trigger record to the first trigger in the block.
167 If there are no trigger records then this pointer is set to NULL.
168 kTRUE is returned if the block was found, kFALSE otherwise.
169 */
170 Bool_t GetFirstBlock() const;
171
172 /* Returns kTRUE if there are more blocks to be traversed.
173 */
174 Bool_t MoreBlocks() const;
175
176 /* Fetches the next block in the current event.
177 kTRUE is returned if the block was found, kFALSE otherwise.
178 */
179 Bool_t GetNextBlock() const;
180
181 /* Returns the currently selected block number.
182 -1 is returned if no blocks are selected.
183 */
184 Int_t CurrentBlock() const { return fBlockIndex; };
185
186 /* Returns the number of trigger records in the current block.
187 -1 is returned if no block is selected.
188 */
189 Int_t NumberOfTriggers() const;
190
191 /* Fetches the trigger record with the specified trigger number from
192 the current block.
193 NULL is returned if the record was not found.
194 */
69d7cf2e 195 const AliHLTMUONTriggerRecord* GetTrigger(Int_t triggernumber) const;
8356cc1d 196
197 /* Fetches the first trigger record in the current block.
198 NULL is returned if the record was not found.
199 */
69d7cf2e 200 const AliHLTMUONTriggerRecord* GetFirstTrigger() const;
8356cc1d 201
202 /* Returns kTRUE if there are more triggers to iterate over.
203 */
204 Bool_t MoreTriggers() const;
205
206 /* Fetches the next trigger record in the current block.
207 NULL is returned if the record was not found.
208 */
69d7cf2e 209 const AliHLTMUONTriggerRecord* GetNextTrigger() const;
8356cc1d 210
211 /* Returns the current trigger record.
212 NULL is returned if the record was not found.
213 */
69d7cf2e 214 const AliHLTMUONTriggerRecord* GetTrigger() const { return fCurrentTrigger; };
8356cc1d 215
216 /* Returns the trigger record number for the currently selected trigger record.
217 This number corresponds to the index'th AliMUONLocalTrigger object for the
218 current event.
219 -1 is returned if no trigger record is selected.
220 */
221 Int_t CurrentTrigger() const;
222
223
224private:
225
3a682eae 226 /* Adds a new AliEventData block to the fEventList and updates the fCurrentEvent,
8356cc1d 227 fCurrentBlock and fCurrentTrigger pointers.
228 */
e33f3609 229 void AddEvent(Int_t eventnumber);
8356cc1d 230
231 /* Adds a new block to the current event and updates fCurrentBlock and fCurrentTrigger.
232 */
233 void AddBlock();
234
235 /* Adds a new trigger record to the current event and block.
236 The fCurrentTrigger is updated appropriately.
237 */
69d7cf2e 238 void AddTrigger(const AliHLTMUONTriggerRecord& data);
8356cc1d 239
69d7cf2e 240 /* Checks if the file and folder names correspond to this AliHLTMUONTriggerSource's
8356cc1d 241 file and folder names. kTRUE is returned if they do.
242 If the file and folder names are empty then they are assigned the names
243 as found in the data interface and kTRUE is returned.
244 */
245 Bool_t FileAndFolderOk(AliMUONDataInterface* data);
246
247 /* Adds the whole event from the data interface to the internal data structures.
248 It is assumed that FileAndFolderOk(data) returns true just before calling
249 this method.
250 */
e33f3609 251 void AddEventFrom(AliMUONDataInterface* data, AliMUON* module, Int_t event);
8356cc1d 252
253 /* Adds the specified trigger record from the given data interface.
254 The data interface should be initialised correctly, that is the event
255 should already be selected before calling this method.
256 */
e33f3609 257 void AddTriggerFrom(AliMUONDataInterface* data, AliMUON* module, Int_t trigger);
8356cc1d 258
259 /* Checks to see if the specified trigger record is in the chamber region
260 we want to fill from.
261 kTRUE is returned if (x, y) is in the region, and kFALSE otherwise.
262 */
3a682eae 263 Bool_t InFillRegion(const AliHLTMUONTriggerRecord& data) const;
8356cc1d 264
265 /* Fills the trigger data from the AliMUONLocalTrigger object.
266 if the fUseLookupTable is set to true then we use the L0 lookup table to
267 fill the Pt value otherwise we use the PtCal method in AliMUONTriggerCircuit.
268 Note the fTriggerNumber parameter is not filled in to 'record'.
269 */
270 void FillTriggerFromLocalTrigger(
69d7cf2e 271 AliMUONLocalTrigger* trigger, AliMUON* module, AliHLTMUONTriggerRecord& record
8356cc1d 272 );
273
274 /* Fills the TriggerRecord structure from AliMUONHit objects.
275 The hits on the last 4 chambers are used (i.e. chambers 11 to 14).
276 kTRUE is returned if the structure was filled successfully.
277 */
69d7cf2e 278 Bool_t FillTriggerFromHits(AliMUONDataInterface* data, Int_t track, AliHLTMUONTriggerRecord& record);
8356cc1d 279
280 /* Fetches the AliMUON module from the AliRun global object. AliRun will be loaded
281 by the runloader if it has not yet been loaded. In such a case the AliRun object
282 will also we unloaded when we are done with it.
283 kTRUE is returned if no error occured and kFALSE otherwise.
3a682eae 284 Note that if fDataToUse is set to kFromHits then gAlice is not loaded and 'module'
8356cc1d 285 will be left untouched. The method will still return kTRUE however since this is
286 not an error. We do not need the AliMUON module when filling from hits.
287 */
288 Bool_t FetchAliMUON(AliMUON*& module);
289
290 /* After one is finished with the AliMUON object returned by GetAliMUON, one
291 should call this method.
292 If the gAlice object was loaded by GetAliMUON then it will be unloaded at
293 this point, otherwise nothing is done.
294 */
295 void FinishedWithAliMUON();
296
297 /* Sets all the current pointers to NULL and indices to -1.
298 */
299 void ResetAllPointers() const;
300
301 /* Sets the block and trigger pointers to NULL and indices to -1.
302 */
303 void ResetBlockPointers() const;
304
305 /* Sets just the current trigger record pointer to NULL and index to -1.
306 */
307 void ResetTriggerPointers() const;
308
309
3a682eae 310 // Do not allow copying of this object.
77650318 311 AliHLTMUONTriggerSource(const AliHLTMUONTriggerSource& /*object*/)
312 : TObject(),
313 fAreaToUse(kFromWholePlane), fDataToUse(kFromLocalTriggers),
314 fMaxBlockSize(0xFFFFFFFF), fUseLookupTable(kTRUE),
315 fFilename(""), fFoldername(""),
316 fEventIndex(-1), fCurrentEvent(NULL),
317 fBlockIndex(-1), fCurrentBlock(NULL),
318 fTriggerIndex(-1), fCurrentTrigger(NULL),
319 fEventList(AliHLTMUONTriggerSource::AliEventData::Class()),
320 fHadToLoadgAlice(kFALSE)
321 {}
322
3a682eae 323 AliHLTMUONTriggerSource& operator = (const AliHLTMUONTriggerSource& /*object*/) { return *this; }
324
325
8356cc1d 326 AreaType fAreaToUse; //! The part of the chamber to fill from.
327 SourceType fDataToUse; //! The type of raw AliRoot data to fill from.
328 UInt_t fMaxBlockSize; //! The maximum block size to create in the fill methods.
329 Bool_t fUseLookupTable; //! Set to true if the L0 lookup table should be used for finding Pt.
330
331 TString fFilename; // The file from which the trigger data was taken.
332 TString fFoldername; // The folder name from which trigger data was taken.
333
334 mutable Int_t fEventIndex; //! The index number of the currently selected event.
77650318 335 mutable AliEventData* fCurrentEvent; //! Pointer to the currently selected event.
8356cc1d 336 mutable Int_t fBlockIndex; //! The index number of the currently selected block.
337 mutable TClonesArray* fCurrentBlock; //! Pointer to the currently selected block.
338 mutable Int_t fTriggerIndex; //! The index number of the currently selected trigger record.
69d7cf2e 339 mutable AliHLTMUONTriggerRecord* fCurrentTrigger; //! Pointer to the currently selected trigger record.
8356cc1d 340
341 TClonesArray fEventList; // List of trigger records per event.
342
343 Bool_t fHadToLoadgAlice; //! Flag indicating if this object had to load the AliRun object.
344
69d7cf2e 345 ClassDef(AliHLTMUONTriggerSource, 1) // The source of trigger records for dHLT.
8356cc1d 346};
347
348
69d7cf2e 349#endif // ALIHLTMUONTRIGGERSOURCE_H