]>
Commit | Line | Data |
---|---|---|
0145e89a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | ||
18 | #include "AliMUONTrackerRawDataMaker.h" | |
19 | ||
49419555 | 20 | #include "AliCDBManager.h" |
21 | #include "AliCDBStorage.h" | |
8741815f | 22 | #include "AliCodeTimer.h" |
23 | #include "AliLog.h" | |
49419555 | 24 | #include "AliLog.h" |
0145e89a | 25 | #include "AliMUON2DMap.h" |
26 | #include "AliMUONCalibParamND.h" | |
27 | #include "AliMUONCalibrationData.h" | |
28 | #include "AliMUONDigitCalibrator.h" | |
29 | #include "AliMUONDigitMaker.h" | |
30 | #include "AliMUONDigitStoreV2R.h" | |
49419555 | 31 | #include "AliMUONRawStreamTracker.h" |
32 | #include "AliMUONRawStreamTrackerHP.h" | |
0145e89a | 33 | #include "AliMUONTrackerData.h" |
34 | #include "AliMUONVDigit.h" | |
35 | #include "AliMUONVDigitStore.h" | |
36 | #include "AliMpDDLStore.h" | |
0145e89a | 37 | #include "AliRawEventHeaderBase.h" |
38 | #include "AliRawReader.h" | |
39 | #include <Riostream.h> | |
40 | ||
41 | ///\class AliMUONTrackerRawDataMaker | |
42 | /// | |
8741815f | 43 | /// Creator of raw AliMUONVTrackerData from AliRawReader |
0145e89a | 44 | /// |
45 | ///\author Laurent Aphecetche, Subatech | |
46 | ||
47 | ///\cond CLASSIMP | |
48 | ClassImp(AliMUONTrackerRawDataMaker) | |
49 | ///\endcond | |
50 | ||
51 | Int_t AliMUONTrackerRawDataMaker::fgkCounter(0); | |
52 | ||
53 | //_____________________________________________________________________________ | |
49419555 | 54 | AliMUONTrackerRawDataMaker::AliMUONTrackerRawDataMaker(AliRawReader* reader, |
55 | Bool_t histogram, | |
56 | Bool_t useHPdecoder) | |
0145e89a | 57 | : AliMUONVTrackerDataMaker(), |
58 | fRawReader(reader), | |
59 | fAccumulatedData(0x0), | |
60 | fOneEventData(new AliMUON2DMap(true)), | |
0145e89a | 61 | fSource("unspecified"), |
62 | fIsRunning(kFALSE), | |
49419555 | 63 | fNumberOfEvents(0), |
64 | fRunNumber(0), | |
65 | fIsEventByEvent(kFALSE), | |
66 | fUseHPDecoder(useHPdecoder) | |
0145e89a | 67 | { |
68 | /// Ctor | |
49419555 | 69 | |
70 | if (fRawReader) | |
71 | { | |
72 | fRawReader->NextEvent(); // to be sure to get run number available | |
73 | fRunNumber = fRawReader->GetRunNumber(); | |
74 | fRawReader->RewindEvents(); | |
75 | } | |
76 | ||
0145e89a | 77 | TString name; |
78 | ||
49419555 | 79 | if (!fRunNumber) |
0145e89a | 80 | { |
8741815f | 81 | ++fgkCounter; |
82 | name = Form("%sRAW(%d)",(histogram?"H":""),fgkCounter); | |
0145e89a | 83 | } |
84 | else | |
85 | { | |
49419555 | 86 | name = Form("%sRAW%d",(histogram?"H":""),fRunNumber); |
0145e89a | 87 | } |
88 | ||
89 | fAccumulatedData = new AliMUONTrackerData(name.Data(),"charge values",1); | |
8741815f | 90 | fAccumulatedData->SetDimensionName(0,"Raw charge"); |
91 | if ( histogram ) | |
0145e89a | 92 | { |
10eb3d17 | 93 | fAccumulatedData->MakeHistogramForDimension(0,kTRUE); |
0145e89a | 94 | } |
95 | } | |
96 | ||
97 | //_____________________________________________________________________________ | |
98 | AliMUONTrackerRawDataMaker::~AliMUONTrackerRawDataMaker() | |
99 | { | |
100 | /// dtor | |
101 | delete fOneEventData; | |
49419555 | 102 | delete fAccumulatedData; |
103 | delete fRawReader; | |
104 | } | |
105 | ||
106 | //_____________________________________________________________________________ | |
107 | Long64_t | |
108 | AliMUONTrackerRawDataMaker::Merge(TCollection*) | |
109 | { | |
110 | /// Merge objects in collection | |
111 | ||
112 | // AliRawReader* fRawReader; //!< reader of the data (owner) | |
113 | // AliMUONVTrackerData* fAccumulatedData; ///< data (owner) | |
114 | // AliMUONVStore* fOneEventData; ///< data for one event (owner) | |
115 | // TString fSource; ///< where the data comes from | |
116 | // Bool_t fIsRunning; ///< whether we are running or are paused | |
117 | // Int_t fNumberOfEvents; ///< number of events seen | |
118 | // Int_t fRunNumber; ///< run number of the data | |
119 | // Bool_t fIsEventByEvent; ///< we only keep one event's data (no accumulation) | |
120 | // Bool_t fUseHPDecoder; ///< whether to use high performance decoder or not (false by default) | |
121 | ||
122 | AliError("Not implemented yet"); | |
123 | return 0; | |
0145e89a | 124 | } |
125 | ||
126 | //_____________________________________________________________________________ | |
127 | Bool_t | |
128 | AliMUONTrackerRawDataMaker::NextEvent() | |
129 | { | |
130 | /// Read next event | |
131 | ||
8741815f | 132 | AliCodeTimerAuto(""); |
133 | ||
d59411b9 | 134 | static Int_t nphysics(0); |
135 | static Int_t ngood(0); | |
136 | ||
8741815f | 137 | fOneEventData->Clear(); |
138 | ||
0145e89a | 139 | if ( !IsRunning() ) return kTRUE; |
140 | ||
141 | Bool_t ok = fRawReader->NextEvent(); | |
142 | ||
143 | if (!ok) | |
144 | { | |
145 | return kFALSE; | |
146 | } | |
147 | ||
148 | Int_t eventType = fRawReader->GetType(); | |
d59411b9 | 149 | |
150 | ++fNumberOfEvents; | |
0145e89a | 151 | |
152 | if (eventType != AliRawEventHeaderBase::kPhysicsEvent ) | |
153 | { | |
154 | return kTRUE; // for the moment | |
155 | } | |
156 | ||
d59411b9 | 157 | ++nphysics; |
158 | ||
49419555 | 159 | AliMUONVRawStreamTracker* stream = 0x0; |
160 | ||
161 | if ( fUseHPDecoder ) | |
162 | { | |
163 | stream = new AliMUONRawStreamTrackerHP(fRawReader); | |
164 | } | |
165 | else | |
166 | { | |
167 | stream = new AliMUONRawStreamTracker(fRawReader); | |
168 | } | |
8741815f | 169 | |
170 | stream->First(); | |
171 | ||
172 | Int_t buspatchId; | |
173 | UShort_t manuId; | |
174 | UChar_t manuChannel; | |
175 | UShort_t adc; | |
176 | ||
177 | while ( stream->Next(buspatchId,manuId,manuChannel,adc) ) | |
178 | { | |
179 | Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(buspatchId); | |
180 | ||
181 | AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fOneEventData->FindObject(detElemId,manuId)); | |
182 | if (!param) | |
183 | { | |
184 | param = new AliMUONCalibParamND(1,64,detElemId,manuId, | |
185 | AliMUONVCalibParam::InvalidFloatValue()); | |
186 | fOneEventData->Add(param); | |
187 | } | |
188 | ||
189 | param->SetValueAsDouble(manuChannel,0,adc); | |
190 | } | |
0145e89a | 191 | |
8741815f | 192 | if ( !stream->IsErrorMessage() ) |
0145e89a | 193 | { |
8741815f | 194 | ++ngood; |
195 | fAccumulatedData->Add(*fOneEventData); | |
0145e89a | 196 | } |
d59411b9 | 197 | |
198 | AliDebug(1,Form("n %10d nphysics %10d ngood %10d",fNumberOfEvents,nphysics,ngood)); | |
199 | ||
8741815f | 200 | delete stream; |
0145e89a | 201 | |
d59411b9 | 202 | return kTRUE; |
0145e89a | 203 | } |
204 | ||
205 | //_____________________________________________________________________________ | |
206 | void | |
207 | AliMUONTrackerRawDataMaker::Print(Option_t*) const | |
208 | { | |
209 | /// Printout | |
210 | ||
211 | cout << "Source=" << Source() << " Running=" << ( IsRunning() ? "YES" : "NO") | |
212 | << endl; | |
213 | ||
214 | } | |
215 | ||
216 | //_____________________________________________________________________________ | |
217 | void | |
218 | AliMUONTrackerRawDataMaker::Rewind() | |
219 | { | |
220 | /// Rewind events | |
221 | fRawReader->RewindEvents(); | |
d59411b9 | 222 | fNumberOfEvents=0; |
0145e89a | 223 | } |