]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONReconstructor.cxx
Coding conventions
[u/mrichter/AliRoot.git] / MUON / AliMUONReconstructor.cxx
CommitLineData
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
3d1463c8 17//-----------------------------------------------------------------------------
22899106 18/// \class AliMUONReconstructor
19///
20/// Implementation of AliReconstructor for MUON subsystem.
21///
ad3c6eda 22/// The clustering mode and the associated parameters can be changed through the
23/// AliMUONRecoParam object set in the reconstruction macro or read from the CDB
24/// (see methods in AliMUONRecoParam.h file for details)
22899106 25///
96ebe67e 26/// Valid modes are :
22899106 27///
28/// SIMPLEFIT : use the AliMUONClusterFinderSimpleFit clusterizer
29///
96ebe67e 30/// SIMPLEFITV3 : SIMPLEFIT with preclustering=PRECLUSTERV3
31///
32/// MLEM : use AliMUONClusterFinderMLEM and AliMUONPreClusterFinder for preclustering (default)
33/// MLEMV2 : MLEM with preclustering=PRECLUSTERV2
93d7b017 34/// MLEMV3 : MLEM with preclustering=PRECLUSTERV3
35///
22899106 36/// PRECLUSTER : use only AliMUONPreClusterFinder. Only for debug as
37/// the produced clusters do not have a position, hence the tracking will not
38/// work
93d7b017 39/// PRECLUSTERV2 : another version of the preclustering
40/// PRECLUSTERV3 : yet another version of the preclustering
22899106 41///
42/// COG : use AliMUONClusterFinderCOG clusterizer. Not really a production
43/// option either, as center-of-gravity is generally not a good estimate
44/// of the cluster position...
45///
3ab319aa 46/// PEAKCOG : COG cluster finder around local maxima
47/// PEAKFIT : fit around local maxima with up to 3 peaks, COG otherwise
48///
22899106 49/// NOCLUSTERING : bypass completely the clustering stage
50///
96ebe67e 51/// ------
22899106 52///
96ebe67e 53/// The behavior of the MUON reconstruction can also be changed, besides
54/// the usual methods found in AliReconstruction (e.g. to disable tracking)
55/// by using AliReconstruction::SetOption("MUON",options)
56/// where options should be a space separated string.
57///
58/// Valid options are :
59///
60/// SAVEDIGITS : if you want to save in the TreeD the *calibrated* digits
61/// that are used for the clustering
22899106 62///
93d7b017 63/// DIGITSTOREV1 : use the V1 implementation of the digitstore
64/// DIGITSTOREV2R : use the V2R implementation of the digitstore
65///
96ebe67e 66/// NOLOCALRECONSTRUCTION : for debug, to disable local reconstruction (and hence
67/// "recover" old behavior)
68///
69/// TRIGGERDISABLE : disable the treatment of MUON trigger
70///
5f3519d9 71/// NOFASTTRKDECODER : makes the digit maker class use the non-high performance decoder
72/// AliMUONPayloadTracker instead of AliMUONTrackerDDLDecoder.
e3a2b9c9 73///
5f3519d9 74/// NOFASTTRGDECODER : makes the digit maker class use the non-high performance decoder
75/// AliMUONPayloadTrigger instead of AliMUONTriggerDDLDecoder.
481d8064 76///
5f3519d9 77/// NOFASTDECODERS : makes the digit maker class use the non-high performance decoders
78/// AliMUONPayloadTracker and AliMUONPayloadTrigger.
481d8064 79///
22899106 80/// \author Laurent Aphecetche, Subatech
3d1463c8 81//-----------------------------------------------------------------------------
30178c30 82
cf464691 83#include "AliMUONReconstructor.h"
b2d7df0b 84
b2d7df0b 85#include "AliMUONCalibrationData.h"
22899106 86#include "AliMUONClusterFinderCOG.h"
87#include "AliMUONClusterFinderMLEM.h"
88#include "AliMUONClusterFinderSimpleFit.h"
3ab319aa 89#include "AliMUONClusterFinderPeakCOG.h"
90#include "AliMUONClusterFinderPeakFit.h"
9bf6860b 91#include "AliMUONClusterStoreV1.h"
92#include "AliMUONClusterStoreV2.h"
22899106 93#include "AliMUONConstants.h"
b2d7df0b 94#include "AliMUONDigitCalibrator.h"
2cf44ef3 95#include "AliMUONDigitMaker.h"
22899106 96#include "AliMUONDigitStoreV1.h"
93d7b017 97#include "AliMUONDigitStoreV2R.h"
22899106 98#include "AliMUONGeometryTransformer.h"
99#include "AliMUONPreClusterFinder.h"
93d7b017 100#include "AliMUONPreClusterFinderV2.h"
101#include "AliMUONPreClusterFinderV3.h"
c5ce806f 102#include "AliMUONSimpleClusterServer.h"
196471e9 103#include "AliMUONTracker.h"
e1a10d41 104#include "AliMUONTriggerCircuit.h"
22899106 105#include "AliMUONTriggerStoreV1.h"
106#include "AliMUONVClusterFinder.h"
c5ce806f 107#include "AliMUONVClusterServer.h"
108#include "AliMUONVTrackStore.h"
109
110#include "AliMpArea.h"
88544f7e 111#include "AliMpCDB.h"
c5ce806f 112#include "AliMpConstants.h"
acd0cf59 113#include "AliMpDDLStore.h"
114#include "AliMpSegmentation.h"
c5ce806f 115
cf464691 116#include "AliRawReader.h"
c5ce806f 117#include "AliCDBManager.h"
93d7b017 118#include "AliCodeTimer.h"
c5ce806f 119#include "AliLog.h"
120
22899106 121#include <Riostream.h>
15d30ed4 122#include <TObjArray.h>
22899106 123#include <TClonesArray.h>
124#include <TString.h>
125#include <TTree.h>
2060b217 126
9265505b 127/// \cond CLASSIMP
cac2eb58 128ClassImp(AliMUONReconstructor)
22899106 129/// \endcond
b2d7df0b 130
cac2eb58 131//_____________________________________________________________________________
22899106 132AliMUONReconstructor::AliMUONReconstructor() :
133AliReconstructor(),
22899106 134fDigitMaker(0x0),
ef4cb4f1 135fTransformer(new AliMUONGeometryTransformer()),
22899106 136fDigitStore(0x0),
137fTriggerCircuit(0x0),
138fCalibrationData(0x0),
139fDigitCalibrator(0x0),
c5ce806f 140fClusterServer(0x0),
22899106 141fTriggerStore(0x0),
9ec6a948 142fTrackStore(0x0),
143fClusterStore(0x0)
8789635b 144{
22899106 145 /// normal ctor
88544f7e 146
acd0cf59 147 AliDebug(1,"");
148
dba06a24 149 // Unload and delete old mapping
150 AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/Mapping");
151 AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/DDLStore");
152 delete AliMpDDLStore::Instance();
153 delete AliMpSegmentation::Instance();
154
88544f7e 155 // Load mapping
a55f49a0 156 if ( ! AliMpCDB::LoadDDLStore() ) {
88544f7e 157 AliFatal("Could not access mapping from OCDB !");
158 }
159
a55f49a0 160 // Load geometry data
161 fTransformer->LoadGeometryData();
88544f7e 162
22899106 163}
d19b6003 164
22899106 165//_____________________________________________________________________________
166AliMUONReconstructor::~AliMUONReconstructor()
167{
7d5d0cc5 168 /// dtor
169
acd0cf59 170 AliDebug(1,"");
171
22899106 172 delete fDigitMaker;
173 delete fDigitStore;
174 delete fTransformer;
22899106 175 delete fTriggerCircuit;
176 delete fCalibrationData;
177 delete fDigitCalibrator;
c5ce806f 178 delete fClusterServer;
22899106 179 delete fTriggerStore;
180 delete fTrackStore;
9ec6a948 181 delete fClusterStore;
acd0cf59 182
183 delete AliMpSegmentation::Instance(false);
184 delete AliMpDDLStore::Instance(false);
22899106 185}
96fdfe9a 186
22899106 187//_____________________________________________________________________________
188void
189AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const
190{
191 /// Calibrate the digitStore
192 if (!fDigitCalibrator)
193 {
194 CreateCalibrator();
195 }
93d7b017 196 AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName()))
22899106 197 fDigitCalibrator->Calibrate(digitStore);
198}
96fdfe9a 199
22899106 200//_____________________________________________________________________________
201void
202AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader,
203 AliMUONVDigitStore* digitStore,
204 AliMUONVTriggerStore* triggerStore) const
205{
206 /// Convert raw data into digit and trigger stores
207 CreateDigitMaker();
93d7b017 208
209 AliCodeTimerStart(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)",
210 fDigitMaker->ClassName()))
22899106 211 fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore);
93d7b017 212 AliCodeTimerStop(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)",
213 fDigitMaker->ClassName()))
22899106 214 Calibrate(*digitStore);
cac2eb58 215}
b2d7df0b 216
217//_____________________________________________________________________________
22899106 218void
219AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
b2d7df0b 220{
22899106 221 /// convert raw data into a digit tree
2060b217 222 AliCodeTimerAuto("")
22899106 223
224 Bool_t alone = ( TriggerStore() == 0 );
b2d7df0b 225
22899106 226 Bool_t ok = DigitStore()->Connect(*digitsTree,alone);
227 if ( TriggerStore() )
b476b122 228 {
22899106 229 ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE);
b476b122 230 }
ee103e97 231
22899106 232 if (!ok)
233 {
234 AliError("Could not make branches on TreeD");
235 }
236 else
237 {
238 ConvertDigits(rawReader,DigitStore(),TriggerStore());
2060b217 239 AliCodeTimerStart("Fill digits")
22899106 240 digitsTree->Fill();
2060b217 241 AliCodeTimerStop("Fill digits")
22899106 242 DigitStore()->Clear();
243 }
244}
245
22899106 246//_____________________________________________________________________________
247void
248AliMUONReconstructor::CreateDigitMaker() const
249{
250 /// Create (and create if necessary) the digit maker
251 if (fDigitMaker) return;
252
93d7b017 253 AliCodeTimerAuto("")
22899106 254
e3a2b9c9 255 TString option = GetOption();
256 Bool_t enableErrorLogging = kTRUE;
5f3519d9 257 Bool_t useFastTrackerDecoder = kTRUE;
258 Bool_t useFastTriggerDecoder = kTRUE;
259 if (option.Contains("NOFASTTRKDECODER"))
481d8064 260 {
5f3519d9 261 useFastTrackerDecoder = kFALSE;
481d8064 262 }
5f3519d9 263 if (option.Contains("NOFASTTRGDECODER"))
481d8064 264 {
5f3519d9 265 useFastTriggerDecoder = kFALSE;
481d8064 266 }
5f3519d9 267 if (option.Contains("NOFASTDECODERS"))
e3a2b9c9 268 {
5f3519d9 269 useFastTrackerDecoder = kFALSE;
270 useFastTriggerDecoder = kFALSE;
e3a2b9c9 271 }
481d8064 272 fDigitMaker = new AliMUONDigitMaker(
273 enableErrorLogging, useFastTrackerDecoder, useFastTriggerDecoder
274 );
5483c51b 275 option.ToUpper();
276 if ( option.Contains("SAVEDIGITS" ))
277 {
278 fDigitMaker->SetMakeTriggerDigits(kTRUE);
279 }
22899106 280}
281
282//_____________________________________________________________________________
283void
284AliMUONReconstructor::CreateTriggerCircuit() const
285{
286 /// Return (and create if necessary) the trigger circuit object
287 if (fTriggerCircuit) return;
288
93d7b017 289 AliCodeTimerAuto("")
22899106 290
32ab62c9 291 fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer);
22899106 292
32ab62c9 293}
8c0b5e70 294
22899106 295//_____________________________________________________________________________
296AliTracker*
d76c31f4 297AliMUONReconstructor::CreateTracker() const
22899106 298{
299 /// Create the MUONTracker object
ee103e97 300
22899106 301 CreateTriggerCircuit();
302 CreateDigitMaker();
c5ce806f 303 CreateClusterServer();
9bf6860b 304
305 AliMUONTracker* tracker(0x0);
c5ce806f 306
a0dc65b4 307 if ( ! GetRecoParam()->CombineClusterTrackReco() )
c5ce806f 308 {
a0dc65b4 309 tracker = new AliMUONTracker(GetRecoParam(),
310 0x0,
9bf6860b 311 *DigitStore(),
312 fDigitMaker,
313 fTransformer,
314 fTriggerCircuit);
315 }
316 else
317 {
a0dc65b4 318 tracker = new AliMUONTracker(GetRecoParam(),
319 fClusterServer,
9bf6860b 320 *DigitStore(),
321 fDigitMaker,
322 fTransformer,
323 fTriggerCircuit);
c5ce806f 324 }
22899106 325
22899106 326
327 return tracker;
b2d7df0b 328}
329
f9247068 330//_____________________________________________________________________________
c5ce806f 331AliMUONVClusterFinder*
9bf6860b 332AliMUONReconstructor::CreateClusterFinder(const char* clusterFinderType)
f9247068 333{
c5ce806f 334 /// Create a given cluster finder instance
22899106 335
9bf6860b 336 AliCodeTimerAutoGeneral("")
06ca6d7b 337
f9247068 338 AliMUONVClusterFinder* clusterFinder(0x0);
339
c5ce806f 340 TString opt(clusterFinderType);
f9247068 341 opt.ToUpper();
342
93d7b017 343 if ( strstr(opt,"PRECLUSTERV2") )
344 {
345 clusterFinder = new AliMUONPreClusterFinderV2;
346 }
347 else if ( strstr(opt,"PRECLUSTERV3") )
348 {
349 clusterFinder = new AliMUONPreClusterFinderV3;
350 }
351 else if ( strstr(opt,"PRECLUSTER") )
f9247068 352 {
353 clusterFinder = new AliMUONPreClusterFinder;
354 }
3ab319aa 355 else if ( strstr(opt,"PEAKCOG") )
356 {
357 clusterFinder = new AliMUONClusterFinderPeakCOG(kFALSE,new AliMUONPreClusterFinder);
358 }
359 else if ( strstr(opt,"PEAKFIT") )
360 {
361 clusterFinder = new AliMUONClusterFinderPeakFit(kFALSE,new AliMUONPreClusterFinder);
362 }
f9247068 363 else if ( strstr(opt,"COG") )
364 {
93d7b017 365 clusterFinder = new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder);
f9247068 366 }
93d7b017 367 else if ( strstr(opt,"SIMPLEFITV3") )
368 {
369 clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinderV3));
370 }
f9247068 371 else if ( strstr(opt,"SIMPLEFIT") )
372 {
93d7b017 373 clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder));
f9247068 374 }
375 else if ( strstr(opt,"MLEM:DRAW") )
376 {
93d7b017 377 clusterFinder = new AliMUONClusterFinderMLEM(kTRUE,new AliMUONPreClusterFinder);
f9247068 378 }
93d7b017 379 else if ( strstr(opt,"MLEMV3") )
380 {
381 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV3);
382 }
383 else if ( strstr(opt,"MLEMV2") )
384 {
385 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV2);
386 }
f9247068 387 else if ( strstr(opt,"MLEM") )
388 {
93d7b017 389 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder);
f9247068 390 }
22899106 391 else
392 {
9bf6860b 393 AliErrorClass(Form("clustering mode \"%s\" does not exist",opt.Data()));
c5ce806f 394 return 0x0;
22899106 395 }
f9247068 396
c5ce806f 397 return clusterFinder;
398}
399
400//_____________________________________________________________________________
401void
402AliMUONReconstructor::CreateClusterServer() const
403{
404 /// Create cluster server
405
406 if ( fClusterServer ) return;
407
9bf6860b 408 AliCodeTimerAuto("");
409
15d30ed4 410 AliMUONVClusterFinder* clusterFinder = CreateClusterFinder(GetRecoParam()->GetClusteringMode());
c5ce806f 411
412 if ( !clusterFinder ) return;
413
3304fa09 414 AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName()));
f9247068 415
9bf6860b 416 fClusterServer = new AliMUONSimpleClusterServer(clusterFinder,*fTransformer);
f9247068 417}
418
cac2eb58 419//_____________________________________________________________________________
22899106 420void
421AliMUONReconstructor::CreateCalibrator() const
cac2eb58 422{
22899106 423 /// Create the calibrator
2457f726 424
93d7b017 425 AliCodeTimerAuto("")
3bc8b580 426
22899106 427 Int_t runNumber = AliCDBManager::Instance()->GetRun();
3bc8b580 428
22899106 429 AliInfo("Calibration will occur.");
430
431 fCalibrationData = new AliMUONCalibrationData(runNumber);
432 if ( !fCalibrationData->IsValid() )
433 {
434 AliError("Could not retrieve calibrations !");
435 delete fCalibrationData;
436 fCalibrationData = 0x0;
437 return;
438 }
439
440 // Check that we get all the calibrations we'll need
441 if ( !fCalibrationData->Pedestals() ||
442 !fCalibrationData->Gains() ||
443 !fCalibrationData->HV() )
444 {
445 AliFatal("Could not access all required calibration data");
9ffe3ef4 446 }
cc87ebcd 447
22899106 448 TString opt(GetOption());
449 opt.ToUpper();
b2d7df0b 450
22899106 451 if ( strstr(opt,"NOSTATUSMAP") )
452 {
22f7c9ba 453 AliWarning("NOSTATUSMAP is obsolete");
22899106 454 }
22f7c9ba 455
de98fdc9 456 TString calibMode = GetRecoParam()->GetCalibrationMode();
457
de487b6e 458 fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,GetRecoParam(),calibMode.Data());
22899106 459}
9c4b1ee7 460
22899106 461//_____________________________________________________________________________
462AliMUONVDigitStore*
463AliMUONReconstructor::DigitStore() const
464{
465 /// Return (and create if necessary) the digit container
466 if (!fDigitStore)
467 {
93d7b017 468 TString sopt(GetOption());
469 sopt.ToUpper();
470
471 AliInfo(Form("Options=%s",sopt.Data()));
472
473 if ( sopt.Contains("DIGITSTOREV1") )
474 {
475 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
476 }
477 else if ( sopt.Contains("DIGITSTOREV2R") )
478 {
479 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R");
480 }
481 else if ( sopt.Contains("DIGITSTOREV2S") )
482 {
483 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S");
484 }
485
486 if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R");
487
488 AliInfo(Form("Will use %s to store digits during reconstruction",fDigitStore->ClassName()));
22899106 489 }
490 return fDigitStore;
491}
94f6fba9 492
22899106 493//_____________________________________________________________________________
494void
495AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore,
22899106 496 TTree& clustersTree) const
497{
498 /// Write the trigger and cluster information into TreeR
499
93d7b017 500 AliCodeTimerAuto("")
cc87ebcd 501
22899106 502 AliDebug(1,"");
503
504 Bool_t ok(kFALSE);
9bf6860b 505 Bool_t alone(kTRUE); // is trigger the only info in TreeR ?
506
a0dc65b4 507 if ( ! GetRecoParam()->CombineClusterTrackReco() )
9bf6860b 508 {
509 alone = kFALSE; // we'll get both tracker and trigger information in TreeR
510 }
511
22899106 512 if ( triggerStore )
513 {
9bf6860b 514 ok = triggerStore->Connect(clustersTree,alone);
22899106 515 if (!ok)
b2d7df0b 516 {
22899106 517 AliError("Could not create triggerStore branches in TreeR");
cc87ebcd 518 }
cac2eb58 519 }
9bf6860b 520
9bf6860b 521 if ( !alone )
522 {
9ec6a948 523 if (!fClusterStore)
524 {
525 fClusterStore = new AliMUONClusterStoreV2;
526 }
9bf6860b 527
528 CreateClusterServer();
529
530 TIter next(DigitStore()->CreateIterator());
531 fClusterServer->UseDigits(next);
532
533 AliMpArea area;
534
535 AliDebug(1,Form("Doing full clusterization in local reconstruction using %s ",fClusterServer->ClassName()));
536
537 for ( Int_t i = 0; i < AliMpConstants::NofTrackingChambers(); ++i )
538 {
a0dc65b4 539 if (GetRecoParam()->UseChamber(i))
9bf6860b 540 {
a0dc65b4 541 if ( ( i == 6 || i == 7 ) && GetRecoParam()->BypassSt4() ) continue;
542 if ( ( i == 8 || i == 9 ) && GetRecoParam()->BypassSt5() ) continue;
9bf6860b 543
35be7ed7 544 fClusterServer->Clusterize(i,*fClusterStore,area,GetRecoParam());
9bf6860b 545 }
546 }
547
9ec6a948 548 Bool_t cok = fClusterStore->Connect(clustersTree,alone);
9bf6860b 549
550 if (!cok) AliError("Could not connect clusterStore to clusterTree");
551
9ec6a948 552 AliDebug(1,Form("Number of clusters found = %d",fClusterStore->GetSize()));
9bf6860b 553
9ec6a948 554 StdoutToAliDebug(1,fClusterStore->Print());
9bf6860b 555 }
556
22899106 557 if (ok) // at least one type of branches created successfully
558 {
559 clustersTree.Fill();
560 }
9bf6860b 561
f73ad454 562 if (fClusterStore) fClusterStore->Clear();
cac2eb58 563}
cf464691 564
565//_____________________________________________________________________________
22899106 566Bool_t
567AliMUONReconstructor::HasDigitConversion() const
cf464691 568{
22899106 569 /// We *do* have digit conversion, but we might advertise it only
570 /// if we want to save the digits.
571
572 TString opt(GetOption());
573 opt.ToUpper();
574 if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") )
575 {
576 return kTRUE;
577 }
578 else
579 {
580 return kFALSE;
581 }
582}
f9247068 583
22899106 584//_____________________________________________________________________________
585void
586AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const
587{
588 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND
589 /// HasDigitConversion()==kFALSE
8cde4af5 590
22899106 591 if ( !clustersTree )
592 {
593 AliError("clustersTree is 0x0 !");
594 return;
595 }
b2d7df0b 596
93d7b017 597 ConvertDigits(rawReader,DigitStore(),TriggerStore());
c5ce806f 598
599 FillTreeR(TriggerStore(),*clustersTree);
22899106 600}
64b056bc 601
196471e9 602//_____________________________________________________________________________
22899106 603void
604AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
a2da7817 605{
22899106 606 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE
607 /// AND HasDigitConversion()==kTRUE
608
2060b217 609 AliCodeTimerAuto("")
93d7b017 610
22899106 611 AliDebug(1,"");
612
613 if (!digitsTree || !clustersTree)
614 {
615 AliError(Form("Tree is null : digitsTree=%p clustersTree=%p",
616 digitsTree,clustersTree));
617 return;
618 }
d19b6003 619
22899106 620 if (!fDigitStore)
621 {
622 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
623 if (!fDigitStore)
624 {
625 AliError(Form("Could not get DigitStore from %s",digitsTree->GetName()));
626 }
627 else
628 {
629 AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName()));
630 }
631 }
632 if (!fTriggerStore)
633 {
634 fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree);
635 if (!fTriggerStore)
636 {
637 AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName()));
638 }
639 else
640 {
641 AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName()));
642 }
643 }
644
645 if (!fTriggerStore && !fDigitStore)
646 {
647 AliError("No store at all. Nothing to do.");
648 return;
649 }
650
651 // insure we start with empty stores
652 if ( fDigitStore )
653 {
654 fDigitStore->Clear();
655 Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE );
656 Bool_t ok = fDigitStore->Connect(*digitsTree,alone);
657 if (!ok)
658 {
659 AliError("Could not connect digitStore to digitsTree");
660 return;
661 }
662 }
663 if ( fTriggerStore )
664 {
665 fTriggerStore->Clear();
666 Bool_t alone = ( fDigitStore ? kFALSE : kTRUE );
667 Bool_t ok = fTriggerStore->Connect(*digitsTree,alone);
668 if (!ok)
669 {
670 AliError("Could not connect triggerStore to digitsTree");
671 return;
672 }
673 }
674
675 digitsTree->GetEvent(0);
676
677 if ( fDigitStore )
678 {
e729a0c8 679 // Insure we got calibrated digits (if we reconstruct from pure simulated,
680 // i.e. w/o going through raw data, this will be the case)
681 TIter next(fDigitStore->CreateIterator());
682 AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next());
ca4733b5 683 if (digit && !digit->IsCalibrated())
e729a0c8 684 {
685 Calibrate(*fDigitStore);
686 }
22899106 687 }
688
c5ce806f 689 FillTreeR(fTriggerStore,*clustersTree);
cac2eb58 690}
196471e9 691
692//_____________________________________________________________________________
22899106 693AliMUONVTriggerStore*
694AliMUONReconstructor::TriggerStore() const
196471e9 695{
22899106 696 /// Return (and create if necessary and allowed) the trigger container
697 TString sopt(GetOption());
698 sopt.ToUpper();
699
700 if (sopt.Contains("TRIGGERDISABLE"))
701 {
702 delete fTriggerStore;
703 fTriggerStore = 0x0;
704 }
705 else
706 {
707 if (!fTriggerStore)
708 {
709 fTriggerStore = new AliMUONTriggerStoreV1;
710 }
711 }
712 return fTriggerStore;
196471e9 713}