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