]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONReconstructor.cxx
In AliMUONRawStreamTriggerHP:
[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///
5f3519d9 72/// NOFASTTRKDECODER : makes the digit maker class use the non-high performance decoder
73/// AliMUONPayloadTracker instead of AliMUONTrackerDDLDecoder.
e3a2b9c9 74///
5f3519d9 75/// NOFASTTRGDECODER : makes the digit maker class use the non-high performance decoder
76/// AliMUONPayloadTrigger instead of AliMUONTriggerDDLDecoder.
481d8064 77///
5f3519d9 78/// NOFASTDECODERS : makes the digit maker class use the non-high performance decoders
79/// AliMUONPayloadTracker and AliMUONPayloadTrigger.
481d8064 80///
22899106 81/// \author Laurent Aphecetche, Subatech
3d1463c8 82//-----------------------------------------------------------------------------
30178c30 83
cf464691 84#include "AliMUONReconstructor.h"
b2d7df0b 85
b2d7df0b 86#include "AliMUONCalibrationData.h"
22899106 87#include "AliMUONClusterFinderCOG.h"
88#include "AliMUONClusterFinderMLEM.h"
89#include "AliMUONClusterFinderSimpleFit.h"
3ab319aa 90#include "AliMUONClusterFinderPeakCOG.h"
91#include "AliMUONClusterFinderPeakFit.h"
9bf6860b 92#include "AliMUONClusterStoreV1.h"
93#include "AliMUONClusterStoreV2.h"
22899106 94#include "AliMUONConstants.h"
b2d7df0b 95#include "AliMUONDigitCalibrator.h"
2cf44ef3 96#include "AliMUONDigitMaker.h"
22899106 97#include "AliMUONDigitStoreV1.h"
93d7b017 98#include "AliMUONDigitStoreV2R.h"
22899106 99#include "AliMUONGeometryTransformer.h"
100#include "AliMUONPreClusterFinder.h"
93d7b017 101#include "AliMUONPreClusterFinderV2.h"
102#include "AliMUONPreClusterFinderV3.h"
c5ce806f 103#include "AliMUONRecoParam.h"
104#include "AliMUONSimpleClusterServer.h"
196471e9 105#include "AliMUONTracker.h"
e1a10d41 106#include "AliMUONTriggerCircuit.h"
22899106 107#include "AliMUONTriggerStoreV1.h"
108#include "AliMUONVClusterFinder.h"
c5ce806f 109#include "AliMUONVClusterServer.h"
110#include "AliMUONVTrackStore.h"
111
112#include "AliMpArea.h"
88544f7e 113#include "AliMpCDB.h"
c5ce806f 114#include "AliMpConstants.h"
115
15d30ed4 116#include "AliRecoParam.h"
cf464691 117#include "AliRawReader.h"
c5ce806f 118#include "AliCDBManager.h"
93d7b017 119#include "AliCodeTimer.h"
c5ce806f 120#include "AliLog.h"
121
22899106 122#include <Riostream.h>
15d30ed4 123#include <TObjArray.h>
22899106 124#include <TClonesArray.h>
125#include <TString.h>
126#include <TTree.h>
2060b217 127
9265505b 128/// \cond CLASSIMP
cac2eb58 129ClassImp(AliMUONReconstructor)
22899106 130/// \endcond
b2d7df0b 131
3304fa09 132AliMUONRecoParam* AliMUONReconstructor::fgRecoParam = 0x0; // reconstruction parameters
133
cac2eb58 134//_____________________________________________________________________________
22899106 135AliMUONReconstructor::AliMUONReconstructor() :
136AliReconstructor(),
22899106 137fDigitMaker(0x0),
ef4cb4f1 138fTransformer(new AliMUONGeometryTransformer()),
22899106 139fDigitStore(0x0),
140fTriggerCircuit(0x0),
141fCalibrationData(0x0),
142fDigitCalibrator(0x0),
c5ce806f 143fClusterServer(0x0),
22899106 144fTriggerStore(0x0),
9ec6a948 145fTrackStore(0x0),
146fClusterStore(0x0)
8789635b 147{
22899106 148 /// normal ctor
88544f7e 149
88544f7e 150 // Load mapping
a55f49a0 151 if ( ! AliMpCDB::LoadDDLStore() ) {
88544f7e 152 AliFatal("Could not access mapping from OCDB !");
153 }
154
a55f49a0 155 // Load geometry data
156 fTransformer->LoadGeometryData();
88544f7e 157
22899106 158}
d19b6003 159
22899106 160//_____________________________________________________________________________
161AliMUONReconstructor::~AliMUONReconstructor()
162{
163 /// dtor
164 delete fDigitMaker;
165 delete fDigitStore;
166 delete fTransformer;
22899106 167 delete fTriggerCircuit;
168 delete fCalibrationData;
169 delete fDigitCalibrator;
c5ce806f 170 delete fClusterServer;
22899106 171 delete fTriggerStore;
172 delete fTrackStore;
9ec6a948 173 delete fClusterStore;
22899106 174}
96fdfe9a 175
3304fa09 176//_____________________________________________________________________________
15d30ed4 177const AliMUONRecoParam* AliMUONReconstructor::GetRecoParam()
3304fa09 178{
15d30ed4 179 /// get reconstruction parameters
3304fa09 180
6769d914 181 // initialize reconstruction parameters if not already done
182 cout<<"W-AliMUONReconstructor::GetRecoParam: Reconstruction parameters not initialized - Use default one"<<endl;
183 fgRecoParam = AliMUONRecoParam::GetLowFluxParam();
3304fa09 184
15d30ed4 185 return fgRecoParam;
3304fa09 186}
187
22899106 188//_____________________________________________________________________________
189void
190AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const
191{
192 /// Calibrate the digitStore
193 if (!fDigitCalibrator)
194 {
195 CreateCalibrator();
196 }
93d7b017 197 AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName()))
22899106 198 fDigitCalibrator->Calibrate(digitStore);
199}
96fdfe9a 200
22899106 201//_____________________________________________________________________________
202void
203AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader,
204 AliMUONVDigitStore* digitStore,
205 AliMUONVTriggerStore* triggerStore) const
206{
207 /// Convert raw data into digit and trigger stores
208 CreateDigitMaker();
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
2060b217 223 AliCodeTimerAuto("")
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
93d7b017 254 AliCodeTimerAuto("")
22899106 255
e3a2b9c9 256 TString option = GetOption();
257 Bool_t enableErrorLogging = kTRUE;
5f3519d9 258 Bool_t useFastTrackerDecoder = kTRUE;
259 Bool_t useFastTriggerDecoder = kTRUE;
260 if (option.Contains("NOFASTTRKDECODER"))
481d8064 261 {
5f3519d9 262 useFastTrackerDecoder = kFALSE;
481d8064 263 }
5f3519d9 264 if (option.Contains("NOFASTTRGDECODER"))
481d8064 265 {
5f3519d9 266 useFastTriggerDecoder = kFALSE;
481d8064 267 }
5f3519d9 268 if (option.Contains("NOFASTDECODERS"))
e3a2b9c9 269 {
5f3519d9 270 useFastTrackerDecoder = kFALSE;
271 useFastTriggerDecoder = kFALSE;
e3a2b9c9 272 }
481d8064 273 fDigitMaker = new AliMUONDigitMaker(
274 enableErrorLogging, useFastTrackerDecoder, useFastTriggerDecoder
275 );
5483c51b 276 option.ToUpper();
277 if ( option.Contains("SAVEDIGITS" ))
278 {
279 fDigitMaker->SetMakeTriggerDigits(kTRUE);
280 }
22899106 281}
282
283//_____________________________________________________________________________
284void
285AliMUONReconstructor::CreateTriggerCircuit() const
286{
287 /// Return (and create if necessary) the trigger circuit object
288 if (fTriggerCircuit) return;
289
93d7b017 290 AliCodeTimerAuto("")
22899106 291
32ab62c9 292 fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer);
22899106 293
32ab62c9 294}
8c0b5e70 295
22899106 296//_____________________________________________________________________________
297AliTracker*
d76c31f4 298AliMUONReconstructor::CreateTracker() const
22899106 299{
300 /// Create the MUONTracker object
ee103e97 301
22899106 302 CreateTriggerCircuit();
303 CreateDigitMaker();
c5ce806f 304 CreateClusterServer();
9bf6860b 305
306 AliMUONTracker* tracker(0x0);
c5ce806f 307
9bf6860b 308 if ( ! AliMUONReconstructor::GetRecoParam()->CombineClusterTrackReco() )
c5ce806f 309 {
9bf6860b 310 tracker = new AliMUONTracker(0x0,
311 *DigitStore(),
312 fDigitMaker,
313 fTransformer,
314 fTriggerCircuit);
315 }
316 else
317 {
318 tracker = new AliMUONTracker(fClusterServer,
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
457 fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,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
506 if ( ! AliMUONReconstructor::GetRecoParam()->CombineClusterTrackReco() )
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 {
538 if (AliMUONReconstructor::GetRecoParam()->UseChamber(i))
539 {
540 if ( i >= 6 && AliMUONReconstructor::GetRecoParam()->BypassSt45() ) continue;
541
9ec6a948 542 fClusterServer->Clusterize(i,*fClusterStore,area);
9bf6860b 543 }
544 }
545
9ec6a948 546 Bool_t cok = fClusterStore->Connect(clustersTree,alone);
9bf6860b 547
548 if (!cok) AliError("Could not connect clusterStore to clusterTree");
549
9ec6a948 550 AliDebug(1,Form("Number of clusters found = %d",fClusterStore->GetSize()));
9bf6860b 551
9ec6a948 552 StdoutToAliDebug(1,fClusterStore->Print());
9bf6860b 553 }
554
22899106 555 if (ok) // at least one type of branches created successfully
556 {
557 clustersTree.Fill();
558 }
9bf6860b 559
f73ad454 560 if (fClusterStore) fClusterStore->Clear();
cac2eb58 561}
cf464691 562
563//_____________________________________________________________________________
22899106 564Bool_t
565AliMUONReconstructor::HasDigitConversion() const
cf464691 566{
22899106 567 /// We *do* have digit conversion, but we might advertise it only
568 /// if we want to save the digits.
569
570 TString opt(GetOption());
571 opt.ToUpper();
572 if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") )
573 {
574 return kTRUE;
575 }
576 else
577 {
578 return kFALSE;
579 }
580}
f9247068 581
22899106 582//_____________________________________________________________________________
583void
584AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const
585{
586 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND
587 /// HasDigitConversion()==kFALSE
8cde4af5 588
22899106 589 if ( !clustersTree )
590 {
591 AliError("clustersTree is 0x0 !");
592 return;
593 }
b2d7df0b 594
93d7b017 595 ConvertDigits(rawReader,DigitStore(),TriggerStore());
c5ce806f 596
597 FillTreeR(TriggerStore(),*clustersTree);
22899106 598}
64b056bc 599
196471e9 600//_____________________________________________________________________________
22899106 601void
602AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
a2da7817 603{
22899106 604 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE
605 /// AND HasDigitConversion()==kTRUE
606
2060b217 607 AliCodeTimerAuto("")
93d7b017 608
22899106 609 AliDebug(1,"");
610
611 if (!digitsTree || !clustersTree)
612 {
613 AliError(Form("Tree is null : digitsTree=%p clustersTree=%p",
614 digitsTree,clustersTree));
615 return;
616 }
d19b6003 617
22899106 618 if (!fDigitStore)
619 {
620 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
621 if (!fDigitStore)
622 {
623 AliError(Form("Could not get DigitStore from %s",digitsTree->GetName()));
624 }
625 else
626 {
627 AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName()));
628 }
629 }
630 if (!fTriggerStore)
631 {
632 fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree);
633 if (!fTriggerStore)
634 {
635 AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName()));
636 }
637 else
638 {
639 AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName()));
640 }
641 }
642
643 if (!fTriggerStore && !fDigitStore)
644 {
645 AliError("No store at all. Nothing to do.");
646 return;
647 }
648
649 // insure we start with empty stores
650 if ( fDigitStore )
651 {
652 fDigitStore->Clear();
653 Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE );
654 Bool_t ok = fDigitStore->Connect(*digitsTree,alone);
655 if (!ok)
656 {
657 AliError("Could not connect digitStore to digitsTree");
658 return;
659 }
660 }
661 if ( fTriggerStore )
662 {
663 fTriggerStore->Clear();
664 Bool_t alone = ( fDigitStore ? kFALSE : kTRUE );
665 Bool_t ok = fTriggerStore->Connect(*digitsTree,alone);
666 if (!ok)
667 {
668 AliError("Could not connect triggerStore to digitsTree");
669 return;
670 }
671 }
672
673 digitsTree->GetEvent(0);
674
675 if ( fDigitStore )
676 {
e729a0c8 677 // Insure we got calibrated digits (if we reconstruct from pure simulated,
678 // i.e. w/o going through raw data, this will be the case)
679 TIter next(fDigitStore->CreateIterator());
680 AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next());
ca4733b5 681 if (digit && !digit->IsCalibrated())
e729a0c8 682 {
683 Calibrate(*fDigitStore);
684 }
22899106 685 }
686
c5ce806f 687 FillTreeR(fTriggerStore,*clustersTree);
cac2eb58 688}
196471e9 689
690//_____________________________________________________________________________
22899106 691AliMUONVTriggerStore*
692AliMUONReconstructor::TriggerStore() const
196471e9 693{
22899106 694 /// Return (and create if necessary and allowed) the trigger container
695 TString sopt(GetOption());
696 sopt.ToUpper();
697
698 if (sopt.Contains("TRIGGERDISABLE"))
699 {
700 delete fTriggerStore;
701 fTriggerStore = 0x0;
702 }
703 else
704 {
705 if (!fTriggerStore)
706 {
707 fTriggerStore = new AliMUONTriggerStoreV1;
708 }
709 }
710 return fTriggerStore;
196471e9 711}