112 #include "AliRawReader.h"
113 #include "AliCDBManager.h"
114 #include "AliCodeTimer.h"
116 #include "AliRunInfo.h"
118 #include <Riostream.h>
119 #include <TObjArray.h>
120 #include <TClonesArray.h>
134 fTriggerCircuit(0x0),
135 fCalibrationData(0x0),
136 fDigitCalibrator(0x0),
140 fTriggerProcessor(0x0),
141 fTriggerUtilities(0x0),
144 fShouldCalibrate(
kTRUE)
154 AliCDBManager::Instance()->UnloadFromCache(
"MUON/Calib/DDLStore");
159 AliCDBManager::Instance()->UnloadFromCache(
"MUON/Calib/Mapping");
165 AliFatal(
"Could not access mapping from OCDB !");
169 fTransformer->LoadGeometryData();
171 fClusterServers.SetOwner(kTRUE);
172 fTrackers.SetOwner(kTRUE);
176 AliMUONReconstructor::~AliMUONReconstructor()
182 delete fDigitCalibrator;
187 delete fTriggerCircuit;
188 delete fTriggerStore;
190 delete fClusterStore;
191 delete fTriggerProcessor;
192 delete fTriggerUtilities;
197 delete fCalibrationData;
205 if (!fDigitCalibrator)
210 if ( fShouldCalibrate )
212 AliCodeTimerAuto(Form(
"%s::Calibrate(AliMUONVDigitStore*)",fDigitCalibrator->ClassName()),0)
213 fDigitCalibrator->Calibrate(digitStore);
227 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
229 triggerStore->Clear();
230 AliInfo(
"Calibration event: do not convert digits");
234 AliCodeTimerStart(Form(
"%s::Raw2Digits(AliRawReader*,AliMUONVDigitStore*,AliMUONVTriggerStore*)",
235 fDigitMaker->ClassName()))
236 fDigitMaker->Raw2Digits(rawReader,digitStore,triggerStore);
238 fDigitMaker->ClassName()))
239 Calibrate(*digitStore);
247 AliCodeTimerAuto(
"",0)
249 Bool_t alone = ( TriggerStore() == 0 );
251 Bool_t ok = DigitStore()->Connect(*digitsTree,alone);
252 if ( TriggerStore() )
254 ok = ok && TriggerStore()->Connect(*digitsTree,kFALSE);
259 AliError(
"Could not make branches on TreeD");
263 ConvertDigits(rawReader,DigitStore(),TriggerStore());
264 AliCodeTimerStart(
"Fill digits")
266 AliCodeTimerStop("Fill digits")
267 DigitStore()->Clear();
276 if (fDigitMaker)
return;
278 AliCodeTimerAuto(
"",0)
280 TString option = GetOption();
282 Bool_t enableErrorLogging = kFALSE;
284 if (option.Contains("ENABLEERRORLOGGING"))
286 enableErrorLogging =
kTRUE;
294 fDigitMaker->SetMakeTriggerDigits(kTRUE);
296 if ( GetRecoParam()->TryRecover() )
298 fDigitMaker->SetTryRecover(kTRUE);
302 fDigitMaker->SetTryRecover(kFALSE);
308 AliMUONReconstructor::CreateTriggerCircuit()
const
311 if (fTriggerCircuit)
return;
313 AliCodeTimerAuto(
"",0)
324 if ( fTriggerUtilities )
return;
326 AliCodeTimerAuto(
"",0)
328 if ( ! fCalibrationData ) CreateCalibrationData();
339 CreateTriggerCircuit();
340 CreateTriggerUtilities();
344 Int_t es = rp->GetEventSpecie();
346 AliTracker* tracker = 0X0;
348 if ( es <= fTrackers.GetLast() )
350 tracker =
static_cast<AliTracker*
>(fTrackers.At(es));
364 AliInfo(Form(
"Created tracker %p for recoparam of type %s es=%d",
366 AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(rp->GetEventSpecie())),es));
372 CreateClusterServer(*rp),
378 AliInfo(Form(
"Created (combined) tracker %p for recoparam of type %s es=%d",
380 AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(rp->GetEventSpecie())),es));
383 fTrackers.AddAtAndExpand(tracker,es);
392 AliMUONReconstructor::CreateClusterFinder(
const char* clusterFinderType)
396 AliCodeTimerAutoGeneral(
"",0)
400 TString opt(clusterFinderType);
403 if ( strstr(opt,"PRECLUSTERV2") )
407 else if ( strstr(opt,
"PRECLUSTERV3") )
411 else if ( strstr(opt,
"PRECLUSTER") )
415 else if ( strstr(opt,
"PEAKCOG") )
419 else if ( strstr(opt,
"PEAKFIT") )
423 else if ( strstr(opt,
"COG") )
427 else if ( strstr(opt,
"SIMPLEFITV3") )
431 else if ( strstr(opt,
"SIMPLEFIT") )
435 else if ( strstr(opt,
"MLEM:DRAW") )
439 else if ( strstr(opt,
"MLEMV3") )
443 else if ( strstr(opt,
"MLEMV2") )
447 else if ( strstr(opt,
"MLEM") )
453 AliErrorClass(Form(
"clustering mode \"%s\" does not exist",opt.Data()));
466 AliCodeTimerAuto(
"",0);
470 if (rp.GetEventSpecie() <= fClusterServers.GetLast() )
479 if ( !clusterFinder )
return 0x0;
483 AliInfo(Form(
"Created AliMUONSimpleClusterServer (%p) for specie %d with clustering = %s (following requesting clustering mode %s)",
484 clusterServer,rp.GetEventSpecie(),clusterFinder->ClassName(),rp.
GetClusteringMode()));
486 fClusterServers.AddAtAndExpand(clusterServer,rp.GetEventSpecie());
489 return clusterServer;
494 AliMUONReconstructor::CreateCalibrationData()
const
498 AliCodeTimerAuto(
"",0);
500 Int_t
runNumber = AliCDBManager::Instance()->GetRun();
503 if ( !fCalibrationData->IsValid() )
505 AliError(
"Could not retrieve calibrations !");
506 delete fCalibrationData;
507 fCalibrationData = 0x0;
516 Bool_t kTracker(kFALSE);
517 Bool_t kTrigger(kFALSE);
519 const AliRunInfo* runInfo = GetRunInfo();
522 AliError(
"Could not get runinfo ?");
526 TString detectors(runInfo->GetActiveDetectors());
527 if (detectors.Contains(
"MUONTRK")) kTracker=kTRUE;
528 if (detectors.Contains(
"MUONTRG")) kTrigger=kTRUE;
531 AliInfo(Form(
"Run with MUON TRIGGER : %s and MUON TRACKER : %s",
532 kTrigger ?
"YES":
"NO" ,
533 kTracker ?
"YES":
"NO"));
538 if ( !fCalibrationData->Pedestals() )
540 AliFatal(Form(
"Could not access all required calibration data (PED %p)",
541 fCalibrationData->Pedestals()));
544 if ( !fCalibrationData->HV() )
548 UInt_t mask = GetRecoParam()->PadGoodnessMask();
550 if ( smask.Contains(
"HV") )
552 AliFatal(
"Could not access all required calibration data (HV)");
560 AliMUONReconstructor::CreateCalibrator()
const
564 AliCodeTimerAuto(
"",0);
566 if ( ! fCalibrationData )
567 CreateCalibrationData();
569 AliInfo(
"Calibration will occur.");
571 TString opt(GetOption());
574 if ( strstr(opt,
"NOSTATUSMAP") )
576 AliWarning(
"NOSTATUSMAP is obsolete");
579 Bool_t kTracker(kFALSE);
581 const AliRunInfo* runInfo = GetRunInfo();
584 AliError(
"Could not get runinfo ?");
588 TString detectors(runInfo->GetActiveDetectors());
589 if (detectors.Contains(
"MUONTRK")) kTracker=kTRUE;
598 AliWarning(
"Apparently running without MCH so will not instantiante the DigitCalibrator nor read MCH OCDB objects...");
599 fShouldCalibrate=kFALSE;
605 AliMUONReconstructor::ResponseRemovingChambers(AliMUONVTriggerStore* triggerStore)
const
609 AliCodeTimerAuto(
"",0);
611 if ( ! fCalibrationData )
612 CreateCalibrationData();
614 if ( ! fTriggerProcessor )
617 fTriggerProcessor->ResponseRemovingChambers(*triggerStore);
622 AliMUONReconstructor::DigitStore()
const
627 TString sopt(GetOption());
630 AliInfo(Form(
"Options=%s",sopt.Data()));
632 if ( sopt.Contains(
"DIGITSTOREV1") )
636 else if ( sopt.Contains(
"DIGITSTOREV2R") )
640 else if ( sopt.Contains(
"DIGITSTOREV2S") )
647 AliInfo(Form(
"Will use %s to store digits during reconstruction",fDigitStore->ClassName()));
654 AliMUONReconstructor::FillTreeR(AliMUONVTriggerStore* triggerStore,
655 TTree& clustersTree)
const
659 AliCodeTimerAuto(
"",0)
666 if ( ! rp->CombineClusterTrackReco() )
673 ResponseRemovingChambers(triggerStore);
674 ok = triggerStore->
Connect(clustersTree,alone);
677 AliError(
"Could not create triggerStore branches in TreeR");
690 TIter next(DigitStore()->CreateIterator());
691 clusterServer->
UseDigits(next,DigitStore());
695 AliDebug(1,Form(
"Doing full clusterization in local reconstruction using %s ",clusterServer->ClassName()));
701 if ( ( i == 6 || i == 7 ) && rp->
BypassSt4() )
continue;
702 if ( ( i == 8 || i == 9 ) && rp->
BypassSt5() )
continue;
704 clusterServer->
Clusterize(i,*fClusterStore,area,rp);
708 Bool_t cok = fClusterStore->Connect(clustersTree,alone);
710 if (!cok) AliError(
"Could not connect clusterStore to clusterTree");
712 AliDebug(1,Form(
"Number of clusters found = %d",fClusterStore->GetSize()));
714 StdoutToAliDebug(1,fClusterStore->Print());
722 if (fClusterStore) fClusterStore->Clear();
729 return dynamic_cast<const AliMUONRecoParam*
>(AliReconstructor::GetRecoParam(AliReconstruction::GetDetIndex(
"MUON")));
735 AliMUONReconstructor::HasDigitConversion()
const
740 TString opt(GetOption());
742 if ( opt.Contains(
"SAVEDIGITS" ) && !opt.Contains(
"NOLOCALRECONSTRUCTION") )
761 AliError(
"clustersTree is 0x0 !");
765 ConvertDigits(rawReader,DigitStore(),TriggerStore());
767 FillTreeR(TriggerStore(),*clustersTree);
777 AliCodeTimerAuto(
"",0)
781 if (!digitsTree || !clustersTree)
783 AliError(Form(
"Tree is null : digitsTree=%p clustersTree=%p",
784 digitsTree,clustersTree));
793 AliError(Form(
"Could not get DigitStore from %s",digitsTree->GetName()));
797 AliInfo(Form(
"Created %s from %s",fDigitStore->ClassName(),digitsTree->GetName()));
805 AliError(Form(
"Could not get TriggerStore from %s",digitsTree->GetName()));
809 AliInfo(Form(
"Created %s from %s",fTriggerStore->ClassName(),digitsTree->GetName()));
813 if (!fTriggerStore && !fDigitStore)
815 AliError(
"No store at all. Nothing to do.");
822 fDigitStore->Clear();
823 Bool_t alone = ( fTriggerStore ? kFALSE :
kTRUE );
824 Bool_t ok = fDigitStore->Connect(*digitsTree,alone);
827 AliError(
"Could not connect digitStore to digitsTree");
833 fTriggerStore->Clear();
834 Bool_t alone = ( fDigitStore ? kFALSE :
kTRUE );
835 Bool_t ok = fTriggerStore->Connect(*digitsTree,alone);
838 AliError(
"Could not connect triggerStore to digitsTree");
843 digitsTree->GetEvent(0);
849 TIter next(fDigitStore->CreateIterator());
851 if (digit && !digit->IsCalibrated())
853 Calibrate(*fDigitStore);
857 FillTreeR(fTriggerStore,*clustersTree);
861 AliMUONVTriggerStore*
862 AliMUONReconstructor::TriggerStore()
const
865 TString sopt(GetOption());
868 if (sopt.Contains(
"TRIGGERDISABLE"))
870 delete fTriggerStore;
880 return fTriggerStore;
Reading Raw data class for trigger and tracker chambers.
Interface of a cluster finder.
Bool_t BypassSt4() const
return kTRUE if we should replace clusters in St 4 by generated clusters from trigger tracks ...
virtual Int_t Clusterize(Int_t chamberId, AliMUONVClusterStore &clusterStore, const AliMpArea &area, const AliMUONRecoParam *recoParam=0x0)=0
Find and add clusters from a given region of a given chamber to the store.
Interface for a digit container.
Implementation of AliMUONVTriggerStore.
static AliMpSegmentation * Instance(Bool_t warn=true)
Interface of a cluster finder for combined tracking.
void CombineClusterTrackReco(Bool_t flag)
switch on/off the combined cluster/track reconstruction
static Bool_t LoadDDLStore(Bool_t warn=false)
A rectangle area positioned in plane..
Option_t * GetClusteringMode() const
get the clustering (pre-clustering) mode
Class with MUON reconstruction parameters.
Utilities for trigger (check if pad is masked)
ClassImp(AliFMDObjIndex) Int_t AliFMDObjIndex if(!a)
Implementation of VClusterStore.
Base class of a trigger information store.
void Reconstruct(bool raw=false)
Manager class for muon trigger electronics.
static AliMpDDLStore * Instance(Bool_t warn=true)
A basic pre-cluster finder.
virtual AliMUONVDigitStore * Create() const =0
Create an (empty) object of the same concrete class as *this.
virtual AliMUONVStore * Create() const =0
Create an empty copy of this.
Implementation of AliMUONVClusterServer interface.
Class to calibrate the digits.
A very basic (and mostly useless, probably) cluster finder.
static TString AsCondition(Int_t status)
Bool_t BypassSt5() const
return kTRUE if we should replace clusters in St 5 by generated clusters from trigger tracks ...
A basic pre-cluster finder.
Single entry point to access MUON calibration data.
Implementation of AliReconstructor for MUON (both tracker and trigger)
virtual void UseDigits(TIter &next, AliMUONVDigitStore *digitStore=0x0)=0
Specify an iterator to loop over the digits needed to perform our job.
A basic pre-cluster finder.
Cluster finder in MUON arm of ALICE.
virtual Bool_t Connect(TTree &tree, Bool_t alone=kTRUE) const
Connect us to a TTree (only valid if CanConnect()==kTRUE)
static Int_t NofTrackingChambers()
Return number of tracking chambers.
void UseChamber(Int_t iCh, Bool_t flag)
switch on/off a chamber in the reconstruction
Cluster finder in MUON arm of ALICE.
Cluster finder in MUON arm of ALICE.