]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONReconstructor.cxx
Update of the alignment-data fileting macro including a fix for the access to the...
[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///
ad3c6eda 22/// The clustering mode and the associated parameters can be changed through the
23/// AliMUONRecoParam object set in the reconstruction macro or read from the CDB
24/// (see methods in AliMUONRecoParam.h file for details)
22899106 25///
96ebe67e 26/// Valid modes are :
22899106 27///
28/// SIMPLEFIT : use the AliMUONClusterFinderSimpleFit clusterizer
29///
96ebe67e 30/// SIMPLEFITV3 : SIMPLEFIT with preclustering=PRECLUSTERV3
31///
32/// MLEM : use AliMUONClusterFinderMLEM and AliMUONPreClusterFinder for preclustering (default)
33/// MLEMV2 : MLEM with preclustering=PRECLUSTERV2
93d7b017 34/// MLEMV3 : MLEM with preclustering=PRECLUSTERV3
35///
22899106 36/// PRECLUSTER : use only AliMUONPreClusterFinder. Only for debug as
37/// the produced clusters do not have a position, hence the tracking will not
38/// work
93d7b017 39/// PRECLUSTERV2 : another version of the preclustering
40/// PRECLUSTERV3 : yet another version of the preclustering
22899106 41///
42/// COG : use AliMUONClusterFinderCOG clusterizer. Not really a production
43/// option either, as center-of-gravity is generally not a good estimate
44/// of the cluster position...
45///
3ab319aa 46/// PEAKCOG : COG cluster finder around local maxima
47/// PEAKFIT : fit around local maxima with up to 3 peaks, COG otherwise
48///
22899106 49/// NOCLUSTERING : bypass completely the clustering stage
50///
96ebe67e 51/// ------
22899106 52///
96ebe67e 53/// The behavior of the MUON reconstruction can also be changed, besides
54/// the usual methods found in AliReconstruction (e.g. to disable tracking)
55/// by using AliReconstruction::SetOption("MUON",options)
56/// where options should be a space separated string.
57///
58/// Valid options are :
59///
60/// SAVEDIGITS : if you want to save in the TreeD the *calibrated* digits
61/// that are used for the clustering
22899106 62///
93d7b017 63/// DIGITSTOREV1 : use the V1 implementation of the digitstore
64/// DIGITSTOREV2R : use the V2R implementation of the digitstore
65///
96ebe67e 66/// NOLOCALRECONSTRUCTION : for debug, to disable local reconstruction (and hence
67/// "recover" old behavior)
68///
69/// TRIGGERDISABLE : disable the treatment of MUON trigger
70///
b6f591ae 71/// ENABLEERRORLOGGING : enable error logging (this activates also warnings in RawStreamTracker)
481d8064 72///
22899106 73/// \author Laurent Aphecetche, Subatech
3d1463c8 74//-----------------------------------------------------------------------------
30178c30 75
cf464691 76#include "AliMUONReconstructor.h"
b2d7df0b 77
b2d7df0b 78#include "AliMUONCalibrationData.h"
22899106 79#include "AliMUONClusterFinderCOG.h"
80#include "AliMUONClusterFinderMLEM.h"
81#include "AliMUONClusterFinderSimpleFit.h"
3ab319aa 82#include "AliMUONClusterFinderPeakCOG.h"
83#include "AliMUONClusterFinderPeakFit.h"
9bf6860b 84#include "AliMUONClusterStoreV1.h"
85#include "AliMUONClusterStoreV2.h"
22899106 86#include "AliMUONConstants.h"
b2d7df0b 87#include "AliMUONDigitCalibrator.h"
2cf44ef3 88#include "AliMUONDigitMaker.h"
22899106 89#include "AliMUONDigitStoreV1.h"
93d7b017 90#include "AliMUONDigitStoreV2R.h"
22899106 91#include "AliMUONGeometryTransformer.h"
92#include "AliMUONPreClusterFinder.h"
93d7b017 93#include "AliMUONPreClusterFinderV2.h"
94#include "AliMUONPreClusterFinderV3.h"
c5ce806f 95#include "AliMUONSimpleClusterServer.h"
196471e9 96#include "AliMUONTracker.h"
e1a10d41 97#include "AliMUONTriggerCircuit.h"
22899106 98#include "AliMUONTriggerStoreV1.h"
99#include "AliMUONVClusterFinder.h"
c5ce806f 100#include "AliMUONVClusterServer.h"
101#include "AliMUONVTrackStore.h"
102
103#include "AliMpArea.h"
88544f7e 104#include "AliMpCDB.h"
c5ce806f 105#include "AliMpConstants.h"
acd0cf59 106#include "AliMpDDLStore.h"
107#include "AliMpSegmentation.h"
c5ce806f 108
cf464691 109#include "AliRawReader.h"
c5ce806f 110#include "AliCDBManager.h"
93d7b017 111#include "AliCodeTimer.h"
c5ce806f 112#include "AliLog.h"
113
22899106 114#include <Riostream.h>
15d30ed4 115#include <TObjArray.h>
22899106 116#include <TClonesArray.h>
117#include <TString.h>
118#include <TTree.h>
2060b217 119
9265505b 120/// \cond CLASSIMP
cac2eb58 121ClassImp(AliMUONReconstructor)
22899106 122/// \endcond
b2d7df0b 123
cac2eb58 124//_____________________________________________________________________________
22899106 125AliMUONReconstructor::AliMUONReconstructor() :
126AliReconstructor(),
22899106 127fDigitMaker(0x0),
ef4cb4f1 128fTransformer(new AliMUONGeometryTransformer()),
22899106 129fDigitStore(0x0),
130fTriggerCircuit(0x0),
131fCalibrationData(0x0),
132fDigitCalibrator(0x0),
c5ce806f 133fClusterServer(0x0),
22899106 134fTriggerStore(0x0),
9ec6a948 135fTrackStore(0x0),
136fClusterStore(0x0)
8789635b 137{
22899106 138 /// normal ctor
88544f7e 139
acd0cf59 140 AliDebug(1,"");
141
dba06a24 142 // Unload and delete old mapping
143 AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/Mapping");
144 AliCDBManager::Instance()->UnloadFromCache("MUON/Calib/DDLStore");
145 delete AliMpDDLStore::Instance();
146 delete AliMpSegmentation::Instance();
147
88544f7e 148 // Load mapping
a55f49a0 149 if ( ! AliMpCDB::LoadDDLStore() ) {
88544f7e 150 AliFatal("Could not access mapping from OCDB !");
151 }
152
a55f49a0 153 // Load geometry data
154 fTransformer->LoadGeometryData();
88544f7e 155
22899106 156}
d19b6003 157
22899106 158//_____________________________________________________________________________
159AliMUONReconstructor::~AliMUONReconstructor()
160{
7d5d0cc5 161 /// dtor
162
acd0cf59 163 AliDebug(1,"");
164
22899106 165 delete fDigitMaker;
166 delete fDigitStore;
167 delete fTransformer;
22899106 168 delete fTriggerCircuit;
22899106 169 delete fDigitCalibrator;
411a502a 170 delete fCalibrationData;
c5ce806f 171 delete fClusterServer;
22899106 172 delete fTriggerStore;
173 delete fTrackStore;
9ec6a948 174 delete fClusterStore;
acd0cf59 175
176 delete AliMpSegmentation::Instance(false);
177 delete AliMpDDLStore::Instance(false);
22899106 178}
96fdfe9a 179
22899106 180//_____________________________________________________________________________
181void
182AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const
183{
184 /// Calibrate the digitStore
185 if (!fDigitCalibrator)
186 {
187 CreateCalibrator();
188 }
93d7b017 189 AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName()))
22899106 190 fDigitCalibrator->Calibrate(digitStore);
191}
96fdfe9a 192
22899106 193//_____________________________________________________________________________
194void
195AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader,
196 AliMUONVDigitStore* digitStore,
197 AliMUONVTriggerStore* triggerStore) const
198{
199 /// Convert raw data into digit and trigger stores
200 CreateDigitMaker();
93d7b017 201
202 AliCodeTimerStart(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)",
203 fDigitMaker->ClassName()))
22899106 204 fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore);
93d7b017 205 AliCodeTimerStop(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)",
206 fDigitMaker->ClassName()))
22899106 207 Calibrate(*digitStore);
cac2eb58 208}
b2d7df0b 209
210//_____________________________________________________________________________
22899106 211void
212AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
b2d7df0b 213{
22899106 214 /// convert raw data into a digit tree
2060b217 215 AliCodeTimerAuto("")
22899106 216
217 Bool_t alone = ( TriggerStore() == 0 );
b2d7df0b 218
22899106 219 Bool_t ok = DigitStore()->Connect(*digitsTree,alone);
220 if ( TriggerStore() )
b476b122 221 {
22899106 222 ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE);
b476b122 223 }
ee103e97 224
22899106 225 if (!ok)
226 {
227 AliError("Could not make branches on TreeD");
228 }
229 else
230 {
231 ConvertDigits(rawReader,DigitStore(),TriggerStore());
2060b217 232 AliCodeTimerStart("Fill digits")
22899106 233 digitsTree->Fill();
2060b217 234 AliCodeTimerStop("Fill digits")
22899106 235 DigitStore()->Clear();
236 }
237}
238
22899106 239//_____________________________________________________________________________
240void
241AliMUONReconstructor::CreateDigitMaker() const
242{
243 /// Create (and create if necessary) the digit maker
244 if (fDigitMaker) return;
245
93d7b017 246 AliCodeTimerAuto("")
22899106 247
e3a2b9c9 248 TString option = GetOption();
b6f591ae 249
250 Bool_t enableErrorLogging = kFALSE;
251
252 if (option.Contains("ENABLEERRORLOGGING"))
e3a2b9c9 253 {
b6f591ae 254 enableErrorLogging = kTRUE;
e3a2b9c9 255 }
b6f591ae 256
257 fDigitMaker = new AliMUONDigitMaker(enableErrorLogging);
5483c51b 258 option.ToUpper();
259 if ( option.Contains("SAVEDIGITS" ))
260 {
261 fDigitMaker->SetMakeTriggerDigits(kTRUE);
262 }
22899106 263}
264
265//_____________________________________________________________________________
266void
267AliMUONReconstructor::CreateTriggerCircuit() const
268{
269 /// Return (and create if necessary) the trigger circuit object
270 if (fTriggerCircuit) return;
271
93d7b017 272 AliCodeTimerAuto("")
22899106 273
32ab62c9 274 fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer);
22899106 275
32ab62c9 276}
8c0b5e70 277
22899106 278//_____________________________________________________________________________
279AliTracker*
d76c31f4 280AliMUONReconstructor::CreateTracker() const
22899106 281{
282 /// Create the MUONTracker object
ee103e97 283
22899106 284 CreateTriggerCircuit();
285 CreateDigitMaker();
c5ce806f 286 CreateClusterServer();
9bf6860b 287
288 AliMUONTracker* tracker(0x0);
c5ce806f 289
a0dc65b4 290 if ( ! GetRecoParam()->CombineClusterTrackReco() )
c5ce806f 291 {
a0dc65b4 292 tracker = new AliMUONTracker(GetRecoParam(),
293 0x0,
9bf6860b 294 *DigitStore(),
295 fDigitMaker,
296 fTransformer,
297 fTriggerCircuit);
298 }
299 else
300 {
a0dc65b4 301 tracker = new AliMUONTracker(GetRecoParam(),
302 fClusterServer,
9bf6860b 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
a0dc65b4 490 if ( ! GetRecoParam()->CombineClusterTrackReco() )
9bf6860b 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());
2e2d0c44 514 fClusterServer->UseDigits(next,DigitStore());
9bf6860b 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 {
a0dc65b4 522 if (GetRecoParam()->UseChamber(i))
9bf6860b 523 {
a0dc65b4 524 if ( ( i == 6 || i == 7 ) && GetRecoParam()->BypassSt4() ) continue;
525 if ( ( i == 8 || i == 9 ) && GetRecoParam()->BypassSt5() ) continue;
9bf6860b 526
35be7ed7 527 fClusterServer->Clusterize(i,*fClusterStore,area,GetRecoParam());
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}