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