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