#include "AliMUONTracker.h"
#include "AliMUONRecoParam.h"
#include "AliMUONVTrackReconstructor.h"
+#include "AliMUONCDB.h"
#include "AliMpExMapIterator.h"
#include "AliMpVSegmentation.h"
void AliMUONESDInterface::ResetTracker(const AliMUONRecoParam* recoParam, Bool_t info)
{
/// Reset the MUON tracker using "recoParam" if provided.
- /// If not provided, will use Kalman filter + Smoother
+ /// If not provided, will get them from OCDB.
+ /// Load the magnetic field from OCDB if not already set.
delete fgTracker;
delete fgRecoParam;
if (recoParam) {
+ // use provided recoParam
fgRecoParam = new AliMUONRecoParam(*recoParam);
- if (info) cout<<"I-AliMUONESDInterface::ResetTracker: will refit tracks with provided RecoParam:"<<endl;
+ if (info) AliInfoClass("will refit tracks with provided RecoParam:");
} else {
- fgRecoParam = AliMUONRecoParam::GetLowFluxParam();
+ // or get them from OCDB
+ fgRecoParam = AliMUONCDB::LoadRecoParam();
- cout<<"W-AliMUONESDInterface::ResetTracker: RecoParam not provided. Will use default LowFlux parametrization:"<<endl;
+ if (!fgRecoParam) AliFatalClass("RecoParam have not been set!");
}
<<fgRecoParam->GetBendingVertexDispersion()<<" cm"<<endl;
}
- if (!TGeoGlobalMagField::Instance()->GetField())
- cout<<"W-AliMUONESDInterface::ResetTracker: Magnetic field has not been set --> assume field is OFF"<<endl;
+ // load magnetic field for track extrapolation if not already set
+ if (!TGeoGlobalMagField::Instance()->GetField() && !AliMUONCDB::LoadField())
+ AliFatalClass("Magnetic field has not been set!");
fgTracker = AliMUONTracker::CreateTrackReconstructor(fgRecoParam,0x0);
/// Create an empty track store of type fgTrackStoreName
TClass* classPtr = TClass::GetClass(fgTrackStoreName);
if (!classPtr || !classPtr->InheritsFrom("AliMUONVTrackStore")) {
- cout<<"E-AliMUONESDInterface::NewTrackStore: Unable to create store of type "<<fgTrackStoreName.Data()<<endl;
+ AliErrorClass(Form("Unable to create store of type %s", fgTrackStoreName.Data()));
return 0x0;
}
return reinterpret_cast<AliMUONVTrackStore*>(gROOT->ProcessLineFast(Form("new %s()",fgTrackStoreName.Data())));
/// Create an empty cluster store of type fgClusterStoreName
TClass* classPtr = TClass::GetClass(fgClusterStoreName);
if (!classPtr || !classPtr->InheritsFrom("AliMUONVClusterStore")) {
- cout<<"E-AliMUONESDInterface::NewClusterStore: Unable to create store of type "<<fgClusterStoreName.Data()<<endl;
+ AliErrorClass(Form("Unable to create store of type %s", fgClusterStoreName.Data()));
return 0x0;
}
return reinterpret_cast<AliMUONVClusterStore*>(gROOT->ProcessLineFast(Form("new %s()",fgClusterStoreName.Data())));
/// Create an empty cluster of type associated to the cluster store of type fgClusterStoreName
TClass* classPtr = TClass::GetClass(fgClusterStoreName);
if (!classPtr || !classPtr->InheritsFrom("AliMUONVClusterStore")) {
- cout<<"E-AliMUONESDInterface::NewCluster: Unable to create store of type "<<fgClusterStoreName.Data()<<endl;
+ AliErrorClass(Form("Unable to create store of type %s", fgClusterStoreName.Data()));
return 0x0;
}
AliMUONVClusterStore* cStore = reinterpret_cast<AliMUONVClusterStore*>(classPtr->New());
/// Create an empty digit store of type fgDigitStoreName
TClass* classPtr = TClass::GetClass(fgDigitStoreName);
if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore")) {
- cout<<"E-AliMUONESDInterface::NewDigitStore: Unable to create store of type "<<fgDigitStoreName.Data()<<endl;
+ AliErrorClass(Form("Unable to create store of type %s", fgDigitStoreName.Data()));
return 0x0;
}
return reinterpret_cast<AliMUONVDigitStore*>(gROOT->ProcessLineFast(Form("new %s()",fgDigitStoreName.Data())));
/// Create an empty digit of type associated to the digit store of type fgDigitStoreName
TClass* classPtr = TClass::GetClass(fgDigitStoreName);
if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore")) {
- cout<<"E-AliMUONESDInterface::NewDigitStore: Unable to create store of type "<<fgDigitStoreName.Data()<<endl;
+ AliErrorClass(Form("Unable to create store of type %s", fgDigitStoreName.Data()));
return 0x0;
}
AliMUONVDigitStore* dStore = reinterpret_cast<AliMUONVDigitStore*>(classPtr->New());
/// Create an empty trigger store of type fgTriggerStoreName
TClass* classPtr = TClass::GetClass(fgTriggerStoreName);
if (!classPtr || !classPtr->InheritsFrom("AliMUONVTriggerStore")) {
- cout<<"E-AliMUONESDInterface::NewTriggerStore: Unable to create store of type "<<fgTriggerStoreName.Data()<<endl;
+ AliErrorClass(Form("Unable to create store of type %s", fgTriggerStoreName.Data()));
return 0x0;
}
return reinterpret_cast<AliMUONVTriggerStore*>(gROOT->ProcessLineFast(Form("new %s()",fgTriggerStoreName.Data())));
/// Create an empty trigger track store of type fgTriggerTrackStoreName
TClass* classPtr = TClass::GetClass(fgTriggerTrackStoreName);
if (!classPtr || !classPtr->InheritsFrom("AliMUONVTriggerTrackStore")) {
- cout<<"E-AliMUONESDInterface::NewTriggerTrackStore: Unable to create store of type "<<fgTriggerTrackStoreName.Data()<<endl;
+ AliErrorClass(Form("Unable to create store of type %s", fgTriggerTrackStoreName.Data()));
return 0x0;
}
return reinterpret_cast<AliMUONVTriggerTrackStore*>(gROOT->ProcessLineFast(Form("new %s()",fgTriggerTrackStoreName.Data())));
AliESDMuonCluster *esdCluster = esdTrack.GetESDEvent()->FindMuonCluster(esdTrack.GetClusterId(i));
if (esdCluster) clusterFound = kTRUE;
else {
- cout<<"E-AliMUONESDInterface::ESDToMUON: a cluster is missing in ESD"<<endl;
+ AliErrorClass("a cluster is missing in ESD");
continue;
}
void AliMUONESDInterface::ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit)
{
/// Transfert data from ESDMuon pad to MUON digit
+ /// Load mapping from OCDB if not already set
- if (!AliMpSegmentation::Instance(kFALSE)) {
- cout<<"E-AliMUONESDInterface::ESDToMUON: need mapping segmentation to convert ESD pad to MUON digit"<<endl;
- return;
- }
+ if (!AliMpSegmentation::Instance(kFALSE) && !AliMUONCDB::LoadMapping(kTRUE))
+ AliFatalClass("mapping segmentation has not been set!");
const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(esdPad.GetDetElemId(), esdPad.GetManuId());
AliMpPad pad = seg->PadByLocation(esdPad.GetManuId(), esdPad.GetManuChannel(), kFALSE);
for (Int_t i=0; i<cluster.GetNDigits(); i++) {
AliMUONVDigit* digit = digits->FindObject(cluster.GetDigitId(i));
if (!digit) {
- cout<<"E-AliMUONESDInterface::MUONToESD: digit "<<cluster.GetDigitId(i)<<" not found"<<endl;
+ AliErrorClass(Form("digit %u not found", cluster.GetDigitId(i)));
continue;
}
MUONToESD(*digit, esd);