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