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