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