]>
Commit | Line | Data |
---|---|---|
cac2eb58 | 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 | **************************************************************************/ | |
cac2eb58 | 15 | /* $Id$ */ |
16 | ||
22899106 | 17 | /// \class AliMUONReconstructor |
18 | /// | |
19 | /// Implementation of AliReconstructor for MUON subsystem. | |
20 | /// | |
21 | /// The behavior of the MUON reconstruction can be changed, besides | |
22 | /// the usual methods found in AliReconstruction (e.g. to disable tracking) | |
23 | /// by using AliReconstruction::SetOption("MUON",options) | |
24 | /// where options should be a space separated string. | |
25 | /// | |
26 | /// Valid options are : | |
27 | /// | |
28 | /// SAVEDIGITS : if you want to save in the TreeD the *calibrated* digits | |
29 | /// that are used for the clustering | |
30 | /// | |
31 | /// SIMPLEFIT : use the AliMUONClusterFinderSimpleFit clusterizer | |
32 | /// | |
33 | /// AZ : use the AliMUONClusterFinderAZ clusterizer (default) | |
34 | /// | |
35 | /// PRECLUSTER : use only AliMUONPreClusterFinder. Only for debug as | |
36 | /// the produced clusters do not have a position, hence the tracking will not | |
37 | /// work | |
38 | /// | |
39 | /// COG : use AliMUONClusterFinderCOG clusterizer. Not really a production | |
40 | /// option either, as center-of-gravity is generally not a good estimate | |
41 | /// of the cluster position... | |
42 | /// | |
43 | /// NOCLUSTERING : bypass completely the clustering stage | |
44 | /// | |
45 | /// NOSTATUSMAP : disable the computation and usage of the pad status map. Only | |
46 | /// for debug ! | |
47 | /// | |
48 | /// NOLOCALRECONSTRUCTION : for debug, to disable local reconstruction (and hence | |
49 | /// "recover" old behavior) | |
50 | /// | |
51 | /// TRIGGERDISABLE : disable the treatment of MUON trigger | |
52 | /// | |
53 | /// \author Laurent Aphecetche, Subatech | |
30178c30 | 54 | |
cf464691 | 55 | #include "AliMUONReconstructor.h" |
b2d7df0b | 56 | |
22899106 | 57 | #include "AliCDBManager.h" |
58 | #include "AliLoader.h" | |
59 | #include "AliLog.h" | |
60 | #include "AliRunLoader.h" | |
b2d7df0b | 61 | #include "AliMUONCalibrationData.h" |
22899106 | 62 | #include "AliMUONClusterFinderCOG.h" |
63 | #include "AliMUONClusterFinderMLEM.h" | |
64 | #include "AliMUONClusterFinderSimpleFit.h" | |
346fb008 | 65 | #include "AliMUONClusterFinderAZ.h" |
b2d7df0b | 66 | #include "AliMUONClusterReconstructor.h" |
22899106 | 67 | #include "AliMUONClusterStoreV1.h" |
68 | #include "AliMUONConstants.h" | |
b2d7df0b | 69 | #include "AliMUONDigitCalibrator.h" |
2cf44ef3 | 70 | #include "AliMUONDigitMaker.h" |
22899106 | 71 | #include "AliMUONDigitStoreV1.h" |
72 | #include "AliMUONGeometryTransformer.h" | |
73 | #include "AliMUONPreClusterFinder.h" | |
196471e9 | 74 | #include "AliMUONTracker.h" |
22899106 | 75 | #include "AliMUONVTrackStore.h" |
8c0b5e70 | 76 | #include "AliMUONTriggerChamberEff.h" |
e1a10d41 | 77 | #include "AliMUONTriggerCircuit.h" |
96fdfe9a | 78 | #include "AliMUONTriggerCrateStore.h" |
22899106 | 79 | #include "AliMUONTriggerStoreV1.h" |
80 | #include "AliMUONVClusterFinder.h" | |
cf464691 | 81 | #include "AliRawReader.h" |
22899106 | 82 | #include "AliMUONStopwatchGroup.h" |
83 | #include "AliMUONStopwatchGroupElement.h" | |
84 | #include <Riostream.h> | |
85 | #include <TClonesArray.h> | |
86 | #include <TString.h> | |
87 | #include <TTree.h> | |
29f1b13a | 88 | |
9265505b | 89 | /// \cond CLASSIMP |
cac2eb58 | 90 | ClassImp(AliMUONReconstructor) |
22899106 | 91 | /// \endcond |
b2d7df0b | 92 | |
cac2eb58 | 93 | //_____________________________________________________________________________ |
22899106 | 94 | AliMUONReconstructor::AliMUONReconstructor() : |
95 | AliReconstructor(), | |
96 | fCrateManager(0x0), | |
97 | fDigitMaker(0x0), | |
98 | fTransformer(new AliMUONGeometryTransformer(kTRUE)), | |
99 | fDigitStore(0x0), | |
100 | fTriggerCircuit(0x0), | |
101 | fCalibrationData(0x0), | |
102 | fDigitCalibrator(0x0), | |
103 | fClusterReconstructor(0x0), | |
104 | fClusterStore(0x0), | |
105 | fTriggerStore(0x0), | |
106 | fTrackStore(0x0), | |
8c0b5e70 | 107 | fTrigChamberEff(0x0), |
22899106 | 108 | fTimers(new AliMUONStopwatchGroup) |
8789635b | 109 | { |
22899106 | 110 | /// normal ctor |
111 | fTransformer->ReadGeometryData("volpath.dat", "geometry.root"); | |
112 | } | |
d19b6003 | 113 | |
22899106 | 114 | //_____________________________________________________________________________ |
115 | AliMUONReconstructor::~AliMUONReconstructor() | |
116 | { | |
117 | /// dtor | |
118 | delete fDigitMaker; | |
119 | delete fDigitStore; | |
120 | delete fTransformer; | |
121 | delete fCrateManager; | |
122 | delete fTriggerCircuit; | |
123 | delete fCalibrationData; | |
124 | delete fDigitCalibrator; | |
125 | delete fClusterReconstructor; | |
126 | delete fClusterStore; | |
127 | delete fTriggerStore; | |
128 | delete fTrackStore; | |
8c0b5e70 | 129 | delete fTrigChamberEff; |
22899106 | 130 | AliInfo("Timers:"); |
131 | fTimers->Print(); | |
132 | delete fTimers; | |
133 | } | |
96fdfe9a | 134 | |
22899106 | 135 | //_____________________________________________________________________________ |
136 | void | |
137 | AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const | |
138 | { | |
139 | /// Calibrate the digitStore | |
140 | if (!fDigitCalibrator) | |
141 | { | |
142 | CreateCalibrator(); | |
143 | } | |
144 | AliMUONStopwatchGroupElement timer(fTimers,"MUON",Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName())); | |
145 | fDigitCalibrator->Calibrate(digitStore); | |
146 | } | |
96fdfe9a | 147 | |
22899106 | 148 | //_____________________________________________________________________________ |
149 | void | |
150 | AliMUONReconstructor::Clusterize(const AliMUONVDigitStore& digitStore, | |
151 | AliMUONVClusterStore& clusterStore) const | |
152 | { | |
153 | /// Creates clusters from digits. | |
9c4b1ee7 | 154 | |
22899106 | 155 | TString sopt(GetOption()); |
156 | sopt.ToUpper(); | |
157 | if ( sopt.Contains("NOCLUSTERING") ) return; | |
158 | ||
159 | if (!fClusterReconstructor) | |
160 | { | |
161 | CreateClusterReconstructor(); | |
162 | } | |
9c4b1ee7 | 163 | |
22899106 | 164 | AliMUONStopwatchGroupElement timer(fTimers,"MUON",Form("%s::Digits2Clusters(const AliMUONVDigitStore&,AliMUONVClusterStore&)", |
165 | fClusterReconstructor->ClassName())); | |
166 | fClusterReconstructor->Digits2Clusters(digitStore,clusterStore); | |
8789635b | 167 | } |
94f6fba9 | 168 | |
8789635b | 169 | //_____________________________________________________________________________ |
22899106 | 170 | AliMUONVClusterStore* |
171 | AliMUONReconstructor::ClusterStore() const | |
cac2eb58 | 172 | { |
22899106 | 173 | /// Return (and create if necessary) the cluster container |
174 | if (!fClusterStore) | |
175 | { | |
176 | fClusterStore = new AliMUONClusterStoreV1; | |
177 | } | |
178 | return fClusterStore; | |
179 | } | |
d19b6003 | 180 | |
22899106 | 181 | //_____________________________________________________________________________ |
182 | void | |
183 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, | |
184 | AliMUONVDigitStore* digitStore, | |
185 | AliMUONVTriggerStore* triggerStore) const | |
186 | { | |
187 | /// Convert raw data into digit and trigger stores | |
188 | CreateDigitMaker(); | |
189 | AliMUONStopwatchGroupElement timer(fTimers,"MUON",Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)", | |
190 | fDigitMaker->ClassName())); | |
191 | fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore); | |
192 | Calibrate(*digitStore); | |
cac2eb58 | 193 | } |
b2d7df0b | 194 | |
195 | //_____________________________________________________________________________ | |
22899106 | 196 | void |
197 | AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const | |
b2d7df0b | 198 | { |
22899106 | 199 | /// convert raw data into a digit tree |
200 | ||
201 | Bool_t alone = ( TriggerStore() == 0 ); | |
b2d7df0b | 202 | |
22899106 | 203 | Bool_t ok = DigitStore()->Connect(*digitsTree,alone); |
204 | if ( TriggerStore() ) | |
b476b122 | 205 | { |
22899106 | 206 | ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE); |
b476b122 | 207 | } |
ee103e97 | 208 | |
22899106 | 209 | if (!ok) |
210 | { | |
211 | AliError("Could not make branches on TreeD"); | |
212 | } | |
213 | else | |
214 | { | |
215 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); | |
216 | digitsTree->Fill(); | |
217 | DigitStore()->Clear(); | |
218 | } | |
219 | } | |
220 | ||
221 | //_____________________________________________________________________________ | |
222 | AliMUONTriggerCrateStore* | |
223 | AliMUONReconstructor::CrateManager() const | |
224 | { | |
225 | /// Return (and create if necessary) the trigger crate store | |
226 | if (fCrateManager) return fCrateManager; | |
227 | fCrateManager = new AliMUONTriggerCrateStore; | |
228 | fCrateManager->ReadFromFile(); | |
229 | return fCrateManager; | |
230 | } | |
231 | ||
232 | //_____________________________________________________________________________ | |
233 | void | |
234 | AliMUONReconstructor::CreateDigitMaker() const | |
235 | { | |
236 | /// Create (and create if necessary) the digit maker | |
237 | if (fDigitMaker) return; | |
238 | ||
239 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::CreateDigitMaker()"); | |
240 | ||
241 | fDigitMaker = new AliMUONDigitMaker; | |
22899106 | 242 | } |
243 | ||
244 | //_____________________________________________________________________________ | |
245 | void | |
246 | AliMUONReconstructor::CreateTriggerCircuit() const | |
247 | { | |
248 | /// Return (and create if necessary) the trigger circuit object | |
249 | if (fTriggerCircuit) return; | |
250 | ||
251 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::CreateTriggerCircuit()"); | |
252 | ||
32ab62c9 | 253 | fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer); |
22899106 | 254 | |
32ab62c9 | 255 | } |
8c0b5e70 | 256 | |
257 | //_____________________________________________________________________________ | |
258 | void | |
259 | AliMUONReconstructor::CreateTriggerChamberEff() const | |
260 | { | |
261 | /// Create (and create if necessary) the trigger chamber efficiency class | |
262 | if (fTrigChamberEff) return; | |
263 | ||
264 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::CreateTriggerChamberEff()"); | |
265 | ||
266 | fTrigChamberEff = new AliMUONTriggerChamberEff(fTransformer,fDigitMaker,kTRUE); | |
267 | //fTrigChamberEff->SetDebugLevel(1); | |
268 | } | |
269 | ||
22899106 | 270 | //_____________________________________________________________________________ |
271 | AliTracker* | |
272 | AliMUONReconstructor::CreateTracker(AliRunLoader* runLoader) const | |
273 | { | |
274 | /// Create the MUONTracker object | |
275 | /// The MUONTracker is passed the GetOption(), i.e. our own options | |
ee103e97 | 276 | |
22899106 | 277 | CreateTriggerCircuit(); |
278 | CreateDigitMaker(); | |
8c0b5e70 | 279 | CreateTriggerChamberEff(); |
22899106 | 280 | |
281 | AliLoader* loader = runLoader->GetDetectorLoader("MUON"); | |
282 | if (!loader) | |
ee103e97 | 283 | { |
22899106 | 284 | AliError("Cannot get MUONLoader, so cannot create MUONTracker"); |
285 | return 0x0; | |
ee103e97 | 286 | } |
8c0b5e70 | 287 | AliMUONTracker* tracker = new AliMUONTracker(loader,fDigitMaker,fTransformer,fTriggerCircuit,fTrigChamberEff); |
22899106 | 288 | tracker->SetOption(GetOption()); |
289 | ||
290 | return tracker; | |
b2d7df0b | 291 | } |
292 | ||
f9247068 | 293 | //_____________________________________________________________________________ |
22899106 | 294 | void |
196471e9 | 295 | AliMUONReconstructor::CreateClusterReconstructor() const |
f9247068 | 296 | { |
22899106 | 297 | /// Create cluster reconstructor, depending on GetOption() |
298 | ||
299 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::CreateClusterReconstructor()"); | |
06ca6d7b | 300 | |
22899106 | 301 | AliDebug(1,""); |
302 | ||
f9247068 | 303 | AliMUONVClusterFinder* clusterFinder(0x0); |
304 | ||
305 | TString opt(GetOption()); | |
306 | opt.ToUpper(); | |
307 | ||
308 | if ( strstr(opt,"PRECLUSTER") ) | |
309 | { | |
310 | clusterFinder = new AliMUONPreClusterFinder; | |
311 | } | |
312 | else if ( strstr(opt,"COG") ) | |
313 | { | |
314 | clusterFinder = new AliMUONClusterFinderCOG; | |
315 | } | |
316 | else if ( strstr(opt,"SIMPLEFIT") ) | |
317 | { | |
318 | clusterFinder = new AliMUONClusterFinderSimpleFit; | |
319 | } | |
320 | else if ( strstr(opt,"MLEM:DRAW") ) | |
321 | { | |
322 | clusterFinder = new AliMUONClusterFinderMLEM(kTRUE); | |
323 | } | |
324 | else if ( strstr(opt,"MLEM") ) | |
325 | { | |
326 | clusterFinder = new AliMUONClusterFinderMLEM(kFALSE); | |
327 | } | |
22899106 | 328 | else if ( strstr(opt,"AZ") ) |
329 | { | |
330 | clusterFinder = new AliMUONClusterFinderAZ; | |
331 | } | |
332 | else | |
333 | { | |
334 | clusterFinder = new AliMUONClusterFinderAZ; | |
335 | } | |
f9247068 | 336 | |
22899106 | 337 | if ( clusterFinder ) |
f9247068 | 338 | { |
339 | AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName())); | |
340 | } | |
341 | ||
22899106 | 342 | fClusterReconstructor = new AliMUONClusterReconstructor(clusterFinder,fTransformer); |
f9247068 | 343 | } |
344 | ||
cac2eb58 | 345 | //_____________________________________________________________________________ |
22899106 | 346 | void |
347 | AliMUONReconstructor::CreateCalibrator() const | |
cac2eb58 | 348 | { |
22899106 | 349 | /// Create the calibrator |
2457f726 | 350 | |
22899106 | 351 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::CreateCalibrator()"); |
3bc8b580 | 352 | |
22899106 | 353 | Int_t runNumber = AliCDBManager::Instance()->GetRun(); |
3bc8b580 | 354 | |
22899106 | 355 | AliInfo("Calibration will occur."); |
356 | ||
357 | fCalibrationData = new AliMUONCalibrationData(runNumber); | |
358 | if ( !fCalibrationData->IsValid() ) | |
359 | { | |
360 | AliError("Could not retrieve calibrations !"); | |
361 | delete fCalibrationData; | |
362 | fCalibrationData = 0x0; | |
363 | return; | |
364 | } | |
365 | ||
366 | // Check that we get all the calibrations we'll need | |
367 | if ( !fCalibrationData->Pedestals() || | |
368 | !fCalibrationData->Gains() || | |
369 | !fCalibrationData->HV() ) | |
370 | { | |
371 | AliFatal("Could not access all required calibration data"); | |
9ffe3ef4 | 372 | } |
cc87ebcd | 373 | |
22899106 | 374 | TString opt(GetOption()); |
375 | opt.ToUpper(); | |
376 | Bool_t statusMap(kTRUE); | |
b2d7df0b | 377 | |
22899106 | 378 | if ( strstr(opt,"NOSTATUSMAP") ) |
379 | { | |
380 | AliWarning("Disconnecting status map : SHOULD BE USED FOR DEBUG ONLY. NOT FOR PRODUCTION !!!"); | |
381 | statusMap = kFALSE; | |
382 | } | |
383 | fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,statusMap); | |
384 | } | |
9c4b1ee7 | 385 | |
22899106 | 386 | //_____________________________________________________________________________ |
387 | AliMUONVDigitStore* | |
388 | AliMUONReconstructor::DigitStore() const | |
389 | { | |
390 | /// Return (and create if necessary) the digit container | |
391 | if (!fDigitStore) | |
392 | { | |
393 | fDigitStore = new AliMUONDigitStoreV1; | |
394 | } | |
395 | return fDigitStore; | |
396 | } | |
94f6fba9 | 397 | |
22899106 | 398 | //_____________________________________________________________________________ |
399 | void | |
400 | AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore, | |
401 | AliMUONVClusterStore* clusterStore, | |
402 | TTree& clustersTree) const | |
403 | { | |
404 | /// Write the trigger and cluster information into TreeR | |
405 | ||
406 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::FillTreeR()"); | |
cc87ebcd | 407 | |
22899106 | 408 | AliDebug(1,""); |
409 | ||
410 | Bool_t ok(kFALSE); | |
411 | if ( triggerStore ) | |
412 | { | |
413 | Bool_t alone = ( clusterStore ? kFALSE : kTRUE ); | |
414 | ok = triggerStore->Connect(clustersTree,alone); | |
415 | if (!ok) | |
b2d7df0b | 416 | { |
22899106 | 417 | AliError("Could not create triggerStore branches in TreeR"); |
cc87ebcd | 418 | } |
cac2eb58 | 419 | } |
22899106 | 420 | |
421 | if ( clusterStore ) | |
422 | { | |
423 | Bool_t alone = ( triggerStore ? kFALSE : kTRUE ); | |
424 | ok = clusterStore->Connect(clustersTree,alone); | |
425 | if (!ok) | |
426 | { | |
427 | AliError("Could not create triggerStore branches in TreeR"); | |
428 | } | |
429 | } | |
430 | ||
431 | if (ok) // at least one type of branches created successfully | |
432 | { | |
433 | clustersTree.Fill(); | |
434 | } | |
cac2eb58 | 435 | } |
cf464691 | 436 | |
437 | //_____________________________________________________________________________ | |
22899106 | 438 | Bool_t |
439 | AliMUONReconstructor::HasDigitConversion() const | |
cf464691 | 440 | { |
22899106 | 441 | /// We *do* have digit conversion, but we might advertise it only |
442 | /// if we want to save the digits. | |
443 | ||
444 | TString opt(GetOption()); | |
445 | opt.ToUpper(); | |
446 | if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") ) | |
447 | { | |
448 | return kTRUE; | |
449 | } | |
450 | else | |
451 | { | |
452 | return kFALSE; | |
453 | } | |
454 | } | |
f9247068 | 455 | |
22899106 | 456 | //_____________________________________________________________________________ |
457 | Bool_t | |
458 | AliMUONReconstructor::HasLocalReconstruction() const | |
459 | { | |
460 | /// Whether or not we have local reconstruction | |
461 | TString opt(GetOption()); | |
462 | opt.ToUpper(); | |
463 | if ( opt.Contains("NOLOCALRECONSTRUCTION" ) ) | |
94f6fba9 | 464 | { |
22899106 | 465 | return kFALSE; |
30eabfb8 | 466 | } |
22899106 | 467 | else |
468 | { | |
469 | return kTRUE; | |
470 | } | |
471 | } | |
472 | ||
473 | //_____________________________________________________________________________ | |
474 | void | |
475 | AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const | |
476 | { | |
477 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND | |
478 | /// HasDigitConversion()==kFALSE | |
8cde4af5 | 479 | |
22899106 | 480 | if ( !clustersTree ) |
481 | { | |
482 | AliError("clustersTree is 0x0 !"); | |
483 | return; | |
484 | } | |
b2d7df0b | 485 | |
22899106 | 486 | if ( DigitStore() ) |
487 | { | |
488 | ConvertDigits(rawReader,DigitStore(),TriggerStore()); | |
489 | Clusterize(*(DigitStore()),*(ClusterStore())); | |
490 | } | |
491 | ||
492 | FillTreeR(TriggerStore(),ClusterStore(),*clustersTree); | |
493 | } | |
64b056bc | 494 | |
22899106 | 495 | //_____________________________________________________________________________ |
496 | void | |
497 | AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader) const | |
498 | { | |
499 | /// Reconstruct simulated data | |
94f6fba9 | 500 | |
22899106 | 501 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::Reconstruct(AliRunLoader*)"); |
94f6fba9 | 502 | |
22899106 | 503 | AliLoader* loader = runLoader->GetDetectorLoader("MUON"); |
504 | if (!loader) | |
505 | { | |
506 | AliError("Could not get MUON loader"); | |
507 | return; | |
508 | } | |
94f6fba9 | 509 | |
22899106 | 510 | Int_t nEvents = runLoader->GetNumberOfEvents(); |
511 | ||
512 | for ( Int_t i = 0; i < nEvents; ++i ) | |
94f6fba9 | 513 | { |
22899106 | 514 | runLoader->GetEvent(i); |
94f6fba9 | 515 | |
22899106 | 516 | loader->LoadRecPoints("update"); |
517 | loader->CleanRecPoints(); | |
518 | loader->MakeRecPointsContainer(); | |
519 | TTree* clustersTree = loader->TreeR(); | |
8cde4af5 | 520 | |
22899106 | 521 | loader->LoadDigits("read"); |
522 | TTree* digitsTree = loader->TreeD(); | |
94f6fba9 | 523 | |
22899106 | 524 | Reconstruct(digitsTree,clustersTree); |
94f6fba9 | 525 | |
22899106 | 526 | loader->UnloadDigits(); |
cf464691 | 527 | loader->WriteRecPoints("OVERWRITE"); |
22899106 | 528 | loader->UnloadRecPoints(); |
cf464691 | 529 | } |
cf464691 | 530 | } |
531 | ||
cac2eb58 | 532 | //_____________________________________________________________________________ |
22899106 | 533 | void |
534 | AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const | |
cac2eb58 | 535 | { |
22899106 | 536 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kFALSE |
537 | ||
538 | AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONReconstructor::Reconstruct(AliRunLoader*, AliRawReader*)"); | |
539 | ||
540 | AliLoader* loader = runLoader->GetDetectorLoader("MUON"); | |
541 | if (!loader) | |
542 | { | |
543 | AliError("Could not get MUON loader"); | |
544 | return; | |
545 | } | |
546 | ||
547 | Int_t i(0); | |
548 | ||
549 | while (rawReader->NextEvent()) | |
550 | { | |
551 | runLoader->GetEvent(i++); | |
552 | ||
553 | loader->LoadRecPoints("update"); | |
554 | loader->CleanRecPoints(); | |
555 | loader->MakeRecPointsContainer(); | |
556 | TTree* clustersTree = loader->TreeR(); | |
8cde4af5 | 557 | |
22899106 | 558 | loader->LoadDigits("update"); |
559 | loader->CleanDigits(); | |
560 | loader->MakeDigitsContainer(); | |
561 | TTree* digitsTree = loader->TreeD(); | |
562 | ConvertDigits(rawReader, digitsTree); | |
563 | loader->WriteDigits("OVERWRITE"); | |
22ccc301 | 564 | |
22899106 | 565 | Reconstruct(digitsTree,clustersTree); |
22ccc301 | 566 | |
22899106 | 567 | loader->UnloadDigits(); |
568 | loader->WriteRecPoints("OVERWRITE"); | |
569 | loader->UnloadRecPoints(); | |
570 | } | |
196471e9 | 571 | } |
572 | ||
573 | //_____________________________________________________________________________ | |
22899106 | 574 | void |
575 | AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const | |
a2da7817 | 576 | { |
22899106 | 577 | /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE |
578 | /// AND HasDigitConversion()==kTRUE | |
579 | ||
580 | AliDebug(1,""); | |
581 | ||
582 | if (!digitsTree || !clustersTree) | |
583 | { | |
584 | AliError(Form("Tree is null : digitsTree=%p clustersTree=%p", | |
585 | digitsTree,clustersTree)); | |
586 | return; | |
587 | } | |
d19b6003 | 588 | |
22899106 | 589 | if (!fDigitStore) |
590 | { | |
591 | fDigitStore = AliMUONVDigitStore::Create(*digitsTree); | |
592 | if (!fDigitStore) | |
593 | { | |
594 | AliError(Form("Could not get DigitStore from %s",digitsTree->GetName())); | |
595 | } | |
596 | else | |
597 | { | |
598 | AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName())); | |
599 | } | |
600 | } | |
601 | if (!fTriggerStore) | |
602 | { | |
603 | fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree); | |
604 | if (!fTriggerStore) | |
605 | { | |
606 | AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName())); | |
607 | } | |
608 | else | |
609 | { | |
610 | AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName())); | |
611 | } | |
612 | } | |
613 | ||
614 | if (!fTriggerStore && !fDigitStore) | |
615 | { | |
616 | AliError("No store at all. Nothing to do."); | |
617 | return; | |
618 | } | |
619 | ||
620 | // insure we start with empty stores | |
621 | if ( fDigitStore ) | |
622 | { | |
623 | fDigitStore->Clear(); | |
624 | Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE ); | |
625 | Bool_t ok = fDigitStore->Connect(*digitsTree,alone); | |
626 | if (!ok) | |
627 | { | |
628 | AliError("Could not connect digitStore to digitsTree"); | |
629 | return; | |
630 | } | |
631 | } | |
632 | if ( fTriggerStore ) | |
633 | { | |
634 | fTriggerStore->Clear(); | |
635 | Bool_t alone = ( fDigitStore ? kFALSE : kTRUE ); | |
636 | Bool_t ok = fTriggerStore->Connect(*digitsTree,alone); | |
637 | if (!ok) | |
638 | { | |
639 | AliError("Could not connect triggerStore to digitsTree"); | |
640 | return; | |
641 | } | |
642 | } | |
643 | ||
644 | digitsTree->GetEvent(0); | |
645 | ||
646 | if ( fDigitStore ) | |
647 | { | |
e729a0c8 | 648 | // Insure we got calibrated digits (if we reconstruct from pure simulated, |
649 | // i.e. w/o going through raw data, this will be the case) | |
650 | TIter next(fDigitStore->CreateIterator()); | |
651 | AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next()); | |
652 | if (!digit->IsCalibrated()) | |
653 | { | |
654 | Calibrate(*fDigitStore); | |
655 | } | |
22899106 | 656 | Clusterize(*fDigitStore,*(ClusterStore())); |
657 | } | |
658 | ||
659 | FillTreeR(fTriggerStore,ClusterStore(),*clustersTree); | |
cac2eb58 | 660 | } |
196471e9 | 661 | |
662 | //_____________________________________________________________________________ | |
22899106 | 663 | AliMUONVTriggerStore* |
664 | AliMUONReconstructor::TriggerStore() const | |
196471e9 | 665 | { |
22899106 | 666 | /// Return (and create if necessary and allowed) the trigger container |
667 | TString sopt(GetOption()); | |
668 | sopt.ToUpper(); | |
669 | ||
670 | if (sopt.Contains("TRIGGERDISABLE")) | |
671 | { | |
672 | delete fTriggerStore; | |
673 | fTriggerStore = 0x0; | |
674 | } | |
675 | else | |
676 | { | |
677 | if (!fTriggerStore) | |
678 | { | |
679 | fTriggerStore = new AliMUONTriggerStoreV1; | |
680 | } | |
681 | } | |
682 | return fTriggerStore; | |
196471e9 | 683 | } |