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