]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONReconstructor.cxx
Removed hardwired gain inefficiency. Will be taken from the gain map.
[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
9bf6860b 292 if ( ! AliMUONReconstructor::GetRecoParam()->CombineClusterTrackReco() )
c5ce806f 293 {
9bf6860b 294 tracker = new AliMUONTracker(0x0,
295 *DigitStore(),
296 fDigitMaker,
297 fTransformer,
298 fTriggerCircuit);
299 }
300 else
301 {
302 tracker = new AliMUONTracker(fClusterServer,
303 *DigitStore(),
304 fDigitMaker,
305 fTransformer,
306 fTriggerCircuit);
c5ce806f 307 }
22899106 308
22899106 309
310 return tracker;
b2d7df0b 311}
312
f9247068 313//_____________________________________________________________________________
c5ce806f 314AliMUONVClusterFinder*
9bf6860b 315AliMUONReconstructor::CreateClusterFinder(const char* clusterFinderType)
f9247068 316{
c5ce806f 317 /// Create a given cluster finder instance
22899106 318
9bf6860b 319 AliCodeTimerAutoGeneral("")
06ca6d7b 320
f9247068 321 AliMUONVClusterFinder* clusterFinder(0x0);
322
c5ce806f 323 TString opt(clusterFinderType);
f9247068 324 opt.ToUpper();
325
93d7b017 326 if ( strstr(opt,"PRECLUSTERV2") )
327 {
328 clusterFinder = new AliMUONPreClusterFinderV2;
329 }
330 else if ( strstr(opt,"PRECLUSTERV3") )
331 {
332 clusterFinder = new AliMUONPreClusterFinderV3;
333 }
334 else if ( strstr(opt,"PRECLUSTER") )
f9247068 335 {
336 clusterFinder = new AliMUONPreClusterFinder;
337 }
3ab319aa 338 else if ( strstr(opt,"PEAKCOG") )
339 {
340 clusterFinder = new AliMUONClusterFinderPeakCOG(kFALSE,new AliMUONPreClusterFinder);
341 }
342 else if ( strstr(opt,"PEAKFIT") )
343 {
344 clusterFinder = new AliMUONClusterFinderPeakFit(kFALSE,new AliMUONPreClusterFinder);
345 }
f9247068 346 else if ( strstr(opt,"COG") )
347 {
93d7b017 348 clusterFinder = new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder);
f9247068 349 }
93d7b017 350 else if ( strstr(opt,"SIMPLEFITV3") )
351 {
352 clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinderV3));
353 }
f9247068 354 else if ( strstr(opt,"SIMPLEFIT") )
355 {
93d7b017 356 clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder));
f9247068 357 }
358 else if ( strstr(opt,"MLEM:DRAW") )
359 {
93d7b017 360 clusterFinder = new AliMUONClusterFinderMLEM(kTRUE,new AliMUONPreClusterFinder);
f9247068 361 }
93d7b017 362 else if ( strstr(opt,"MLEMV3") )
363 {
364 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV3);
365 }
366 else if ( strstr(opt,"MLEMV2") )
367 {
368 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV2);
369 }
f9247068 370 else if ( strstr(opt,"MLEM") )
371 {
93d7b017 372 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder);
f9247068 373 }
22899106 374 else
375 {
9bf6860b 376 AliErrorClass(Form("clustering mode \"%s\" does not exist",opt.Data()));
c5ce806f 377 return 0x0;
22899106 378 }
f9247068 379
c5ce806f 380 return clusterFinder;
381}
382
383//_____________________________________________________________________________
384void
385AliMUONReconstructor::CreateClusterServer() const
386{
387 /// Create cluster server
388
389 if ( fClusterServer ) return;
390
9bf6860b 391 AliCodeTimerAuto("");
392
15d30ed4 393 AliMUONVClusterFinder* clusterFinder = CreateClusterFinder(GetRecoParam()->GetClusteringMode());
c5ce806f 394
395 if ( !clusterFinder ) return;
396
3304fa09 397 AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName()));
f9247068 398
9bf6860b 399 fClusterServer = new AliMUONSimpleClusterServer(clusterFinder,*fTransformer);
f9247068 400}
401
cac2eb58 402//_____________________________________________________________________________
22899106 403void
404AliMUONReconstructor::CreateCalibrator() const
cac2eb58 405{
22899106 406 /// Create the calibrator
2457f726 407
93d7b017 408 AliCodeTimerAuto("")
3bc8b580 409
22899106 410 Int_t runNumber = AliCDBManager::Instance()->GetRun();
3bc8b580 411
22899106 412 AliInfo("Calibration will occur.");
413
414 fCalibrationData = new AliMUONCalibrationData(runNumber);
415 if ( !fCalibrationData->IsValid() )
416 {
417 AliError("Could not retrieve calibrations !");
418 delete fCalibrationData;
419 fCalibrationData = 0x0;
420 return;
421 }
422
423 // Check that we get all the calibrations we'll need
424 if ( !fCalibrationData->Pedestals() ||
425 !fCalibrationData->Gains() ||
426 !fCalibrationData->HV() )
427 {
428 AliFatal("Could not access all required calibration data");
9ffe3ef4 429 }
cc87ebcd 430
22899106 431 TString opt(GetOption());
432 opt.ToUpper();
b2d7df0b 433
22899106 434 if ( strstr(opt,"NOSTATUSMAP") )
435 {
22f7c9ba 436 AliWarning("NOSTATUSMAP is obsolete");
22899106 437 }
22f7c9ba 438
de98fdc9 439 TString calibMode = GetRecoParam()->GetCalibrationMode();
440
de487b6e 441 fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,GetRecoParam(),calibMode.Data());
22899106 442}
9c4b1ee7 443
22899106 444//_____________________________________________________________________________
445AliMUONVDigitStore*
446AliMUONReconstructor::DigitStore() const
447{
448 /// Return (and create if necessary) the digit container
449 if (!fDigitStore)
450 {
93d7b017 451 TString sopt(GetOption());
452 sopt.ToUpper();
453
454 AliInfo(Form("Options=%s",sopt.Data()));
455
456 if ( sopt.Contains("DIGITSTOREV1") )
457 {
458 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
459 }
460 else if ( sopt.Contains("DIGITSTOREV2R") )
461 {
462 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R");
463 }
464 else if ( sopt.Contains("DIGITSTOREV2S") )
465 {
466 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S");
467 }
468
469 if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R");
470
471 AliInfo(Form("Will use %s to store digits during reconstruction",fDigitStore->ClassName()));
22899106 472 }
473 return fDigitStore;
474}
94f6fba9 475
22899106 476//_____________________________________________________________________________
477void
478AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore,
22899106 479 TTree& clustersTree) const
480{
481 /// Write the trigger and cluster information into TreeR
482
93d7b017 483 AliCodeTimerAuto("")
cc87ebcd 484
22899106 485 AliDebug(1,"");
486
487 Bool_t ok(kFALSE);
9bf6860b 488 Bool_t alone(kTRUE); // is trigger the only info in TreeR ?
489
490 if ( ! AliMUONReconstructor::GetRecoParam()->CombineClusterTrackReco() )
491 {
492 alone = kFALSE; // we'll get both tracker and trigger information in TreeR
493 }
494
22899106 495 if ( triggerStore )
496 {
9bf6860b 497 ok = triggerStore->Connect(clustersTree,alone);
22899106 498 if (!ok)
b2d7df0b 499 {
22899106 500 AliError("Could not create triggerStore branches in TreeR");
cc87ebcd 501 }
cac2eb58 502 }
9bf6860b 503
9bf6860b 504 if ( !alone )
505 {
9ec6a948 506 if (!fClusterStore)
507 {
508 fClusterStore = new AliMUONClusterStoreV2;
509 }
9bf6860b 510
511 CreateClusterServer();
512
513 TIter next(DigitStore()->CreateIterator());
514 fClusterServer->UseDigits(next);
515
516 AliMpArea area;
517
518 AliDebug(1,Form("Doing full clusterization in local reconstruction using %s ",fClusterServer->ClassName()));
519
520 for ( Int_t i = 0; i < AliMpConstants::NofTrackingChambers(); ++i )
521 {
522 if (AliMUONReconstructor::GetRecoParam()->UseChamber(i))
523 {
de487b6e 524 if ( ( i == 6 || i == 7 ) && AliMUONReconstructor::GetRecoParam()->BypassSt4() ) continue;
525 if ( ( i == 8 || i == 9 ) && AliMUONReconstructor::GetRecoParam()->BypassSt5() ) continue;
9bf6860b 526
9ec6a948 527 fClusterServer->Clusterize(i,*fClusterStore,area);
9bf6860b 528 }
529 }
530
9ec6a948 531 Bool_t cok = fClusterStore->Connect(clustersTree,alone);
9bf6860b 532
533 if (!cok) AliError("Could not connect clusterStore to clusterTree");
534
9ec6a948 535 AliDebug(1,Form("Number of clusters found = %d",fClusterStore->GetSize()));
9bf6860b 536
9ec6a948 537 StdoutToAliDebug(1,fClusterStore->Print());
9bf6860b 538 }
539
22899106 540 if (ok) // at least one type of branches created successfully
541 {
542 clustersTree.Fill();
543 }
9bf6860b 544
f73ad454 545 if (fClusterStore) fClusterStore->Clear();
cac2eb58 546}
cf464691 547
548//_____________________________________________________________________________
22899106 549Bool_t
550AliMUONReconstructor::HasDigitConversion() const
cf464691 551{
22899106 552 /// We *do* have digit conversion, but we might advertise it only
553 /// if we want to save the digits.
554
555 TString opt(GetOption());
556 opt.ToUpper();
557 if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") )
558 {
559 return kTRUE;
560 }
561 else
562 {
563 return kFALSE;
564 }
565}
f9247068 566
22899106 567//_____________________________________________________________________________
568void
569AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const
570{
571 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND
572 /// HasDigitConversion()==kFALSE
8cde4af5 573
22899106 574 if ( !clustersTree )
575 {
576 AliError("clustersTree is 0x0 !");
577 return;
578 }
b2d7df0b 579
93d7b017 580 ConvertDigits(rawReader,DigitStore(),TriggerStore());
c5ce806f 581
582 FillTreeR(TriggerStore(),*clustersTree);
22899106 583}
64b056bc 584
196471e9 585//_____________________________________________________________________________
22899106 586void
587AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
a2da7817 588{
22899106 589 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE
590 /// AND HasDigitConversion()==kTRUE
591
2060b217 592 AliCodeTimerAuto("")
93d7b017 593
22899106 594 AliDebug(1,"");
595
596 if (!digitsTree || !clustersTree)
597 {
598 AliError(Form("Tree is null : digitsTree=%p clustersTree=%p",
599 digitsTree,clustersTree));
600 return;
601 }
d19b6003 602
22899106 603 if (!fDigitStore)
604 {
605 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
606 if (!fDigitStore)
607 {
608 AliError(Form("Could not get DigitStore from %s",digitsTree->GetName()));
609 }
610 else
611 {
612 AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName()));
613 }
614 }
615 if (!fTriggerStore)
616 {
617 fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree);
618 if (!fTriggerStore)
619 {
620 AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName()));
621 }
622 else
623 {
624 AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName()));
625 }
626 }
627
628 if (!fTriggerStore && !fDigitStore)
629 {
630 AliError("No store at all. Nothing to do.");
631 return;
632 }
633
634 // insure we start with empty stores
635 if ( fDigitStore )
636 {
637 fDigitStore->Clear();
638 Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE );
639 Bool_t ok = fDigitStore->Connect(*digitsTree,alone);
640 if (!ok)
641 {
642 AliError("Could not connect digitStore to digitsTree");
643 return;
644 }
645 }
646 if ( fTriggerStore )
647 {
648 fTriggerStore->Clear();
649 Bool_t alone = ( fDigitStore ? kFALSE : kTRUE );
650 Bool_t ok = fTriggerStore->Connect(*digitsTree,alone);
651 if (!ok)
652 {
653 AliError("Could not connect triggerStore to digitsTree");
654 return;
655 }
656 }
657
658 digitsTree->GetEvent(0);
659
660 if ( fDigitStore )
661 {
e729a0c8 662 // Insure we got calibrated digits (if we reconstruct from pure simulated,
663 // i.e. w/o going through raw data, this will be the case)
664 TIter next(fDigitStore->CreateIterator());
665 AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next());
ca4733b5 666 if (digit && !digit->IsCalibrated())
e729a0c8 667 {
668 Calibrate(*fDigitStore);
669 }
22899106 670 }
671
c5ce806f 672 FillTreeR(fTriggerStore,*clustersTree);
cac2eb58 673}
196471e9 674
675//_____________________________________________________________________________
22899106 676AliMUONVTriggerStore*
677AliMUONReconstructor::TriggerStore() const
196471e9 678{
22899106 679 /// Return (and create if necessary and allowed) the trigger container
680 TString sopt(GetOption());
681 sopt.ToUpper();
682
683 if (sopt.Contains("TRIGGERDISABLE"))
684 {
685 delete fTriggerStore;
686 fTriggerStore = 0x0;
687 }
688 else
689 {
690 if (!fTriggerStore)
691 {
692 fTriggerStore = new AliMUONTriggerStoreV1;
693 }
694 }
695 return fTriggerStore;
196471e9 696}