]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONReconstructor.cxx
- Adding comment lines to class description needed for Root documentation
[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
22899106 17/// \class AliMUONReconstructor
18///
19/// Implementation of AliReconstructor for MUON subsystem.
20///
21/// The behavior of the MUON reconstruction can be changed, besides
22/// the usual methods found in AliReconstruction (e.g. to disable tracking)
23/// by using AliReconstruction::SetOption("MUON",options)
24/// where options should be a space separated string.
25///
26/// Valid options are :
27///
28/// SAVEDIGITS : if you want to save in the TreeD the *calibrated* digits
29/// that are used for the clustering
30///
31/// SIMPLEFIT : use the AliMUONClusterFinderSimpleFit clusterizer
32///
33/// AZ : use the AliMUONClusterFinderAZ clusterizer (default)
34///
93d7b017 35/// MLEM : another implementation of AZ, where preclustering is external
36/// MLEMV3 : MLEM with preclustering=PRECLUSTERV2
37/// MLEMV3 : MLEM with preclustering=PRECLUSTERV3
38///
22899106 39/// PRECLUSTER : use only AliMUONPreClusterFinder. Only for debug as
40/// the produced clusters do not have a position, hence the tracking will not
41/// work
93d7b017 42/// PRECLUSTERV2 : another version of the preclustering
43/// PRECLUSTERV3 : yet another version of the preclustering
22899106 44///
45/// COG : use AliMUONClusterFinderCOG clusterizer. Not really a production
46/// option either, as center-of-gravity is generally not a good estimate
47/// of the cluster position...
48///
49/// NOCLUSTERING : bypass completely the clustering stage
50///
51/// NOSTATUSMAP : disable the computation and usage of the pad status map. Only
52/// for debug !
53///
54/// NOLOCALRECONSTRUCTION : for debug, to disable local reconstruction (and hence
55/// "recover" old behavior)
56///
57/// TRIGGERDISABLE : disable the treatment of MUON trigger
58///
93d7b017 59/// DIGITSTOREV1 : use the V1 implementation of the digitstore
60/// DIGITSTOREV2R : use the V2R implementation of the digitstore
61///
22899106 62/// \author Laurent Aphecetche, Subatech
30178c30 63
cf464691 64#include "AliMUONReconstructor.h"
b2d7df0b 65
22899106 66#include "AliCDBManager.h"
67#include "AliLoader.h"
68#include "AliLog.h"
69#include "AliRunLoader.h"
b2d7df0b 70#include "AliMUONCalibrationData.h"
22899106 71#include "AliMUONClusterFinderCOG.h"
72#include "AliMUONClusterFinderMLEM.h"
73#include "AliMUONClusterFinderSimpleFit.h"
346fb008 74#include "AliMUONClusterFinderAZ.h"
b2d7df0b 75#include "AliMUONClusterReconstructor.h"
22899106 76#include "AliMUONClusterStoreV1.h"
77#include "AliMUONConstants.h"
b2d7df0b 78#include "AliMUONDigitCalibrator.h"
2cf44ef3 79#include "AliMUONDigitMaker.h"
22899106 80#include "AliMUONDigitStoreV1.h"
93d7b017 81#include "AliMUONDigitStoreV2R.h"
22899106 82#include "AliMUONGeometryTransformer.h"
83#include "AliMUONPreClusterFinder.h"
93d7b017 84#include "AliMUONPreClusterFinderV2.h"
85#include "AliMUONPreClusterFinderV3.h"
196471e9 86#include "AliMUONTracker.h"
22899106 87#include "AliMUONVTrackStore.h"
8c0b5e70 88#include "AliMUONTriggerChamberEff.h"
e1a10d41 89#include "AliMUONTriggerCircuit.h"
96fdfe9a 90#include "AliMUONTriggerCrateStore.h"
22899106 91#include "AliMUONTriggerStoreV1.h"
92#include "AliMUONVClusterFinder.h"
88544f7e 93#include "AliMpCDB.h"
cf464691 94#include "AliRawReader.h"
93d7b017 95#include "AliCodeTimer.h"
22899106 96#include <Riostream.h>
97#include <TClonesArray.h>
98#include <TString.h>
99#include <TTree.h>
93d7b017 100//#include "AliCodeTimer.h"
9265505b 101/// \cond CLASSIMP
cac2eb58 102ClassImp(AliMUONReconstructor)
22899106 103/// \endcond
b2d7df0b 104
cac2eb58 105//_____________________________________________________________________________
22899106 106AliMUONReconstructor::AliMUONReconstructor() :
107AliReconstructor(),
108fCrateManager(0x0),
109fDigitMaker(0x0),
ef4cb4f1 110fTransformer(new AliMUONGeometryTransformer()),
22899106 111fDigitStore(0x0),
112fTriggerCircuit(0x0),
113fCalibrationData(0x0),
114fDigitCalibrator(0x0),
115fClusterReconstructor(0x0),
116fClusterStore(0x0),
117fTriggerStore(0x0),
118fTrackStore(0x0),
93d7b017 119fTrigChamberEff(0x0)
8789635b 120{
22899106 121 /// normal ctor
88544f7e 122
123 // Load geometry data
ef4cb4f1 124 fTransformer->LoadGeometryData();
88544f7e 125
126 // Load mapping
127 if ( ! AliMpCDB::LoadMpSegmentation() )
128 {
129 AliFatal("Could not access mapping from OCDB !");
130 }
131
132 // Load DDL store
133 if ( ! AliMpCDB::LoadDDLStore() )
134 {
135 AliFatal("Could not access DDL Store from OCDB !");
136 }
137
138
22899106 139}
d19b6003 140
22899106 141//_____________________________________________________________________________
142AliMUONReconstructor::~AliMUONReconstructor()
143{
144 /// dtor
145 delete fDigitMaker;
146 delete fDigitStore;
147 delete fTransformer;
148 delete fCrateManager;
149 delete fTriggerCircuit;
150 delete fCalibrationData;
151 delete fDigitCalibrator;
152 delete fClusterReconstructor;
153 delete fClusterStore;
154 delete fTriggerStore;
155 delete fTrackStore;
8c0b5e70 156 delete fTrigChamberEff;
22899106 157}
96fdfe9a 158
22899106 159//_____________________________________________________________________________
160void
161AliMUONReconstructor::Calibrate(AliMUONVDigitStore& digitStore) const
162{
163 /// Calibrate the digitStore
164 if (!fDigitCalibrator)
165 {
166 CreateCalibrator();
167 }
93d7b017 168 AliCodeTimerAuto(Form("%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName()))
22899106 169 fDigitCalibrator->Calibrate(digitStore);
170}
96fdfe9a 171
22899106 172//_____________________________________________________________________________
173void
174AliMUONReconstructor::Clusterize(const AliMUONVDigitStore& digitStore,
175 AliMUONVClusterStore& clusterStore) const
176{
177 /// Creates clusters from digits.
9c4b1ee7 178
22899106 179 TString sopt(GetOption());
180 sopt.ToUpper();
181 if ( sopt.Contains("NOCLUSTERING") ) return;
182
183 if (!fClusterReconstructor)
184 {
185 CreateClusterReconstructor();
186 }
9c4b1ee7 187
93d7b017 188 AliCodeTimerAuto(Form("%s::Digits2Clusters(const AliMUONVDigitStore&,AliMUONVClusterStore&)",
189 fClusterReconstructor->ClassName()))
22899106 190 fClusterReconstructor->Digits2Clusters(digitStore,clusterStore);
8789635b 191}
94f6fba9 192
8789635b 193//_____________________________________________________________________________
22899106 194AliMUONVClusterStore*
195AliMUONReconstructor::ClusterStore() const
cac2eb58 196{
22899106 197 /// Return (and create if necessary) the cluster container
198 if (!fClusterStore)
199 {
200 fClusterStore = new AliMUONClusterStoreV1;
201 }
202 return fClusterStore;
203}
d19b6003 204
22899106 205//_____________________________________________________________________________
206void
207AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader,
208 AliMUONVDigitStore* digitStore,
209 AliMUONVTriggerStore* triggerStore) const
210{
211 /// Convert raw data into digit and trigger stores
212 CreateDigitMaker();
93d7b017 213
214 AliCodeTimerStart(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)",
215 fDigitMaker->ClassName()))
22899106 216 fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore);
93d7b017 217 AliCodeTimerStop(Form("%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)",
218 fDigitMaker->ClassName()))
22899106 219 Calibrate(*digitStore);
cac2eb58 220}
b2d7df0b 221
222//_____________________________________________________________________________
22899106 223void
224AliMUONReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
b2d7df0b 225{
22899106 226 /// convert raw data into a digit tree
227
228 Bool_t alone = ( TriggerStore() == 0 );
b2d7df0b 229
22899106 230 Bool_t ok = DigitStore()->Connect(*digitsTree,alone);
231 if ( TriggerStore() )
b476b122 232 {
22899106 233 ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE);
b476b122 234 }
ee103e97 235
22899106 236 if (!ok)
237 {
238 AliError("Could not make branches on TreeD");
239 }
240 else
241 {
242 ConvertDigits(rawReader,DigitStore(),TriggerStore());
243 digitsTree->Fill();
244 DigitStore()->Clear();
245 }
246}
247
248//_____________________________________________________________________________
249AliMUONTriggerCrateStore*
250AliMUONReconstructor::CrateManager() const
251{
252 /// Return (and create if necessary) the trigger crate store
253 if (fCrateManager) return fCrateManager;
254 fCrateManager = new AliMUONTriggerCrateStore;
255 fCrateManager->ReadFromFile();
256 return fCrateManager;
257}
258
259//_____________________________________________________________________________
260void
261AliMUONReconstructor::CreateDigitMaker() const
262{
263 /// Create (and create if necessary) the digit maker
264 if (fDigitMaker) return;
265
93d7b017 266 AliCodeTimerAuto("")
22899106 267
268 fDigitMaker = new AliMUONDigitMaker;
22899106 269}
270
271//_____________________________________________________________________________
272void
273AliMUONReconstructor::CreateTriggerCircuit() const
274{
275 /// Return (and create if necessary) the trigger circuit object
276 if (fTriggerCircuit) return;
277
93d7b017 278 AliCodeTimerAuto("")
22899106 279
32ab62c9 280 fTriggerCircuit = new AliMUONTriggerCircuit(fTransformer);
22899106 281
32ab62c9 282}
8c0b5e70 283
284//_____________________________________________________________________________
285void
286AliMUONReconstructor::CreateTriggerChamberEff() const
287{
288 /// Create (and create if necessary) the trigger chamber efficiency class
289 if (fTrigChamberEff) return;
290
93d7b017 291 AliCodeTimerAuto("")
8c0b5e70 292
293 fTrigChamberEff = new AliMUONTriggerChamberEff(fTransformer,fDigitMaker,kTRUE);
294 //fTrigChamberEff->SetDebugLevel(1);
295}
296
22899106 297//_____________________________________________________________________________
298AliTracker*
299AliMUONReconstructor::CreateTracker(AliRunLoader* runLoader) const
300{
301 /// Create the MUONTracker object
302 /// The MUONTracker is passed the GetOption(), i.e. our own options
ee103e97 303
22899106 304 CreateTriggerCircuit();
305 CreateDigitMaker();
8c0b5e70 306 CreateTriggerChamberEff();
22899106 307
308 AliLoader* loader = runLoader->GetDetectorLoader("MUON");
309 if (!loader)
ee103e97 310 {
22899106 311 AliError("Cannot get MUONLoader, so cannot create MUONTracker");
312 return 0x0;
ee103e97 313 }
8c0b5e70 314 AliMUONTracker* tracker = new AliMUONTracker(loader,fDigitMaker,fTransformer,fTriggerCircuit,fTrigChamberEff);
22899106 315 tracker->SetOption(GetOption());
316
317 return tracker;
b2d7df0b 318}
319
f9247068 320//_____________________________________________________________________________
22899106 321void
196471e9 322AliMUONReconstructor::CreateClusterReconstructor() const
f9247068 323{
22899106 324 /// Create cluster reconstructor, depending on GetOption()
325
93d7b017 326 AliCodeTimerAuto("")
06ca6d7b 327
22899106 328 AliDebug(1,"");
329
f9247068 330 AliMUONVClusterFinder* clusterFinder(0x0);
331
332 TString opt(GetOption());
333 opt.ToUpper();
334
93d7b017 335 if ( strstr(opt,"PRECLUSTERV2") )
336 {
337 clusterFinder = new AliMUONPreClusterFinderV2;
338 }
339 else if ( strstr(opt,"PRECLUSTERV3") )
340 {
341 clusterFinder = new AliMUONPreClusterFinderV3;
342 }
343 else if ( strstr(opt,"PRECLUSTER") )
f9247068 344 {
345 clusterFinder = new AliMUONPreClusterFinder;
346 }
347 else if ( strstr(opt,"COG") )
348 {
93d7b017 349 clusterFinder = new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder);
f9247068 350 }
93d7b017 351 else if ( strstr(opt,"SIMPLEFITV3") )
352 {
353 clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinderV3));
354 }
f9247068 355 else if ( strstr(opt,"SIMPLEFIT") )
356 {
93d7b017 357 clusterFinder = new AliMUONClusterFinderSimpleFit(new AliMUONClusterFinderCOG(new AliMUONPreClusterFinder));
f9247068 358 }
359 else if ( strstr(opt,"MLEM:DRAW") )
360 {
93d7b017 361 clusterFinder = new AliMUONClusterFinderMLEM(kTRUE,new AliMUONPreClusterFinder);
f9247068 362 }
93d7b017 363 else if ( strstr(opt,"MLEMV3") )
364 {
365 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV3);
366 }
367 else if ( strstr(opt,"MLEMV2") )
368 {
369 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinderV2);
370 }
f9247068 371 else if ( strstr(opt,"MLEM") )
372 {
93d7b017 373 clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder);
f9247068 374 }
22899106 375 else if ( strstr(opt,"AZ") )
376 {
377 clusterFinder = new AliMUONClusterFinderAZ;
378 }
379 else
380 {
93d7b017 381 // default is currently AZ
22899106 382 clusterFinder = new AliMUONClusterFinderAZ;
383 }
f9247068 384
22899106 385 if ( clusterFinder )
f9247068 386 {
387 AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName()));
388 }
389
22899106 390 fClusterReconstructor = new AliMUONClusterReconstructor(clusterFinder,fTransformer);
f9247068 391}
392
cac2eb58 393//_____________________________________________________________________________
22899106 394void
395AliMUONReconstructor::CreateCalibrator() const
cac2eb58 396{
22899106 397 /// Create the calibrator
2457f726 398
93d7b017 399 AliCodeTimerAuto("")
3bc8b580 400
22899106 401 Int_t runNumber = AliCDBManager::Instance()->GetRun();
3bc8b580 402
22899106 403 AliInfo("Calibration will occur.");
404
405 fCalibrationData = new AliMUONCalibrationData(runNumber);
406 if ( !fCalibrationData->IsValid() )
407 {
408 AliError("Could not retrieve calibrations !");
409 delete fCalibrationData;
410 fCalibrationData = 0x0;
411 return;
412 }
413
414 // Check that we get all the calibrations we'll need
415 if ( !fCalibrationData->Pedestals() ||
416 !fCalibrationData->Gains() ||
417 !fCalibrationData->HV() )
418 {
419 AliFatal("Could not access all required calibration data");
9ffe3ef4 420 }
cc87ebcd 421
22899106 422 TString opt(GetOption());
423 opt.ToUpper();
424 Bool_t statusMap(kTRUE);
b2d7df0b 425
22899106 426 if ( strstr(opt,"NOSTATUSMAP") )
427 {
428 AliWarning("Disconnecting status map : SHOULD BE USED FOR DEBUG ONLY. NOT FOR PRODUCTION !!!");
429 statusMap = kFALSE;
430 }
431 fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,statusMap);
432}
9c4b1ee7 433
22899106 434//_____________________________________________________________________________
435AliMUONVDigitStore*
436AliMUONReconstructor::DigitStore() const
437{
438 /// Return (and create if necessary) the digit container
439 if (!fDigitStore)
440 {
93d7b017 441 TString sopt(GetOption());
442 sopt.ToUpper();
443
444 AliInfo(Form("Options=%s",sopt.Data()));
445
446 if ( sopt.Contains("DIGITSTOREV1") )
447 {
448 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
449 }
450 else if ( sopt.Contains("DIGITSTOREV2R") )
451 {
452 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R");
453 }
454 else if ( sopt.Contains("DIGITSTOREV2S") )
455 {
456 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S");
457 }
458
459 if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2R");
460
461 AliInfo(Form("Will use %s to store digits during reconstruction",fDigitStore->ClassName()));
22899106 462 }
463 return fDigitStore;
464}
94f6fba9 465
22899106 466//_____________________________________________________________________________
467void
468AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore,
469 AliMUONVClusterStore* clusterStore,
470 TTree& clustersTree) const
471{
472 /// Write the trigger and cluster information into TreeR
473
93d7b017 474 AliCodeTimerAuto("")
cc87ebcd 475
22899106 476 AliDebug(1,"");
477
478 Bool_t ok(kFALSE);
479 if ( triggerStore )
480 {
481 Bool_t alone = ( clusterStore ? kFALSE : kTRUE );
482 ok = triggerStore->Connect(clustersTree,alone);
483 if (!ok)
b2d7df0b 484 {
22899106 485 AliError("Could not create triggerStore branches in TreeR");
cc87ebcd 486 }
cac2eb58 487 }
22899106 488
489 if ( clusterStore )
490 {
491 Bool_t alone = ( triggerStore ? kFALSE : kTRUE );
492 ok = clusterStore->Connect(clustersTree,alone);
493 if (!ok)
494 {
495 AliError("Could not create triggerStore branches in TreeR");
496 }
497 }
498
499 if (ok) // at least one type of branches created successfully
500 {
501 clustersTree.Fill();
502 }
cac2eb58 503}
cf464691 504
505//_____________________________________________________________________________
22899106 506Bool_t
507AliMUONReconstructor::HasDigitConversion() const
cf464691 508{
22899106 509 /// We *do* have digit conversion, but we might advertise it only
510 /// if we want to save the digits.
511
512 TString opt(GetOption());
513 opt.ToUpper();
514 if ( opt.Contains("SAVEDIGITS" ) && !opt.Contains("NOLOCALRECONSTRUCTION") )
515 {
516 return kTRUE;
517 }
518 else
519 {
520 return kFALSE;
521 }
522}
f9247068 523
22899106 524//_____________________________________________________________________________
525Bool_t
526AliMUONReconstructor::HasLocalReconstruction() const
527{
528 /// Whether or not we have local reconstruction
529 TString opt(GetOption());
530 opt.ToUpper();
531 if ( opt.Contains("NOLOCALRECONSTRUCTION" ) )
94f6fba9 532 {
22899106 533 return kFALSE;
30eabfb8 534 }
22899106 535 else
536 {
537 return kTRUE;
538 }
539}
540
541//_____________________________________________________________________________
542void
543AliMUONReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const
544{
545 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE AND
546 /// HasDigitConversion()==kFALSE
8cde4af5 547
22899106 548 if ( !clustersTree )
549 {
550 AliError("clustersTree is 0x0 !");
551 return;
552 }
b2d7df0b 553
93d7b017 554 ConvertDigits(rawReader,DigitStore(),TriggerStore());
555 Clusterize(*(DigitStore()),*(ClusterStore()));
22899106 556
557 FillTreeR(TriggerStore(),ClusterStore(),*clustersTree);
558}
64b056bc 559
22899106 560//_____________________________________________________________________________
561void
562AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader) const
563{
564 /// Reconstruct simulated data
94f6fba9 565
93d7b017 566 AliCodeTimerAuto("Reconstruct(AliRunLoader*)")
94f6fba9 567
22899106 568 AliLoader* loader = runLoader->GetDetectorLoader("MUON");
569 if (!loader)
570 {
571 AliError("Could not get MUON loader");
572 return;
573 }
94f6fba9 574
22899106 575 Int_t nEvents = runLoader->GetNumberOfEvents();
576
577 for ( Int_t i = 0; i < nEvents; ++i )
94f6fba9 578 {
22899106 579 runLoader->GetEvent(i);
94f6fba9 580
22899106 581 loader->LoadRecPoints("update");
582 loader->CleanRecPoints();
583 loader->MakeRecPointsContainer();
584 TTree* clustersTree = loader->TreeR();
8cde4af5 585
22899106 586 loader->LoadDigits("read");
587 TTree* digitsTree = loader->TreeD();
94f6fba9 588
22899106 589 Reconstruct(digitsTree,clustersTree);
94f6fba9 590
22899106 591 loader->UnloadDigits();
cf464691 592 loader->WriteRecPoints("OVERWRITE");
22899106 593 loader->UnloadRecPoints();
cf464691 594 }
cf464691 595}
596
cac2eb58 597//_____________________________________________________________________________
22899106 598void
599AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const
cac2eb58 600{
22899106 601 /// This method is called by AliReconstruction if HasLocalReconstruction()==kFALSE
602
93d7b017 603 AliCodeTimerAuto("AliMUONReconstructor::Reconstruct(AliRunLoader*, AliRawReader*)")
22899106 604
605 AliLoader* loader = runLoader->GetDetectorLoader("MUON");
606 if (!loader)
607 {
608 AliError("Could not get MUON loader");
609 return;
610 }
611
612 Int_t i(0);
613
614 while (rawReader->NextEvent())
615 {
616 runLoader->GetEvent(i++);
617
618 loader->LoadRecPoints("update");
619 loader->CleanRecPoints();
620 loader->MakeRecPointsContainer();
621 TTree* clustersTree = loader->TreeR();
8cde4af5 622
22899106 623 loader->LoadDigits("update");
624 loader->CleanDigits();
625 loader->MakeDigitsContainer();
626 TTree* digitsTree = loader->TreeD();
627 ConvertDigits(rawReader, digitsTree);
628 loader->WriteDigits("OVERWRITE");
22ccc301 629
22899106 630 Reconstruct(digitsTree,clustersTree);
22ccc301 631
22899106 632 loader->UnloadDigits();
633 loader->WriteRecPoints("OVERWRITE");
634 loader->UnloadRecPoints();
635 }
196471e9 636}
637
638//_____________________________________________________________________________
22899106 639void
640AliMUONReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
a2da7817 641{
22899106 642 /// This method is called by AliReconstruction if HasLocalReconstruction()==kTRUE
643 /// AND HasDigitConversion()==kTRUE
644
93d7b017 645// AliCodeTimerAuto("(TTree*,TTree*)")
646
22899106 647 AliDebug(1,"");
648
649 if (!digitsTree || !clustersTree)
650 {
651 AliError(Form("Tree is null : digitsTree=%p clustersTree=%p",
652 digitsTree,clustersTree));
653 return;
654 }
d19b6003 655
22899106 656 if (!fDigitStore)
657 {
658 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
659 if (!fDigitStore)
660 {
661 AliError(Form("Could not get DigitStore from %s",digitsTree->GetName()));
662 }
663 else
664 {
665 AliInfo(Form("Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName()));
666 }
667 }
668 if (!fTriggerStore)
669 {
670 fTriggerStore = AliMUONVTriggerStore::Create(*digitsTree);
671 if (!fTriggerStore)
672 {
673 AliError(Form("Could not get TriggerStore from %s",digitsTree->GetName()));
674 }
675 else
676 {
677 AliInfo(Form("Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName()));
678 }
679 }
680
681 if (!fTriggerStore && !fDigitStore)
682 {
683 AliError("No store at all. Nothing to do.");
684 return;
685 }
686
687 // insure we start with empty stores
688 if ( fDigitStore )
689 {
690 fDigitStore->Clear();
691 Bool_t alone = ( fTriggerStore ? kFALSE : kTRUE );
692 Bool_t ok = fDigitStore->Connect(*digitsTree,alone);
693 if (!ok)
694 {
695 AliError("Could not connect digitStore to digitsTree");
696 return;
697 }
698 }
699 if ( fTriggerStore )
700 {
701 fTriggerStore->Clear();
702 Bool_t alone = ( fDigitStore ? kFALSE : kTRUE );
703 Bool_t ok = fTriggerStore->Connect(*digitsTree,alone);
704 if (!ok)
705 {
706 AliError("Could not connect triggerStore to digitsTree");
707 return;
708 }
709 }
710
711 digitsTree->GetEvent(0);
712
713 if ( fDigitStore )
714 {
e729a0c8 715 // Insure we got calibrated digits (if we reconstruct from pure simulated,
716 // i.e. w/o going through raw data, this will be the case)
717 TIter next(fDigitStore->CreateIterator());
718 AliMUONVDigit* digit = static_cast<AliMUONVDigit*>(next());
719 if (!digit->IsCalibrated())
720 {
721 Calibrate(*fDigitStore);
722 }
22899106 723 Clusterize(*fDigitStore,*(ClusterStore()));
724 }
725
726 FillTreeR(fTriggerStore,ClusterStore(),*clustersTree);
cac2eb58 727}
196471e9 728
729//_____________________________________________________________________________
22899106 730AliMUONVTriggerStore*
731AliMUONReconstructor::TriggerStore() const
196471e9 732{
22899106 733 /// Return (and create if necessary and allowed) the trigger container
734 TString sopt(GetOption());
735 sopt.ToUpper();
736
737 if (sopt.Contains("TRIGGERDISABLE"))
738 {
739 delete fTriggerStore;
740 fTriggerStore = 0x0;
741 }
742 else
743 {
744 if (!fTriggerStore)
745 {
746 fTriggerStore = new AliMUONTriggerStoreV1;
747 }
748 }
749 return fTriggerStore;
196471e9 750}