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