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