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