#include "AliMUONTracker.h"
#include "AliMUONRecoParam.h"
#include "AliMUONVTrackReconstructor.h"
+#include "AliMUONCDB.h"
#include "AliMpExMapIterator.h"
#include "AliMpVSegmentation.h"
/// \author Philippe Pillot
//-----------------------------------------------------------------------------
+using std::endl;
+using std::cout;
/// \cond CLASSIMP
ClassImp(AliMUONESDInterface)
/// \endcond
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);
+ fgTracker = AliMUONTracker::CreateTrackReconstructor(fgRecoParam,0x0,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())));
track.SetMatchTrigger(esdTrack.GetMatchTrigger());
track.SetChi2MatchTrigger(esdTrack.GetChi2MatchTrigger());
track.SetHitsPatternInTrigCh(esdTrack.GetHitsPatternInTrigCh());
+ track.SetHitsPatternInTrigChTrk(esdTrack.GetHitsPatternInTrigChTrk());
track.SetLocalTrigger(esdTrack.LoCircuit(), esdTrack.LoStripX(), esdTrack.LoStripY(),
esdTrack.LoDev(), esdTrack.LoLpt(), esdTrack.LoHpt(),
esdTrack.GetTriggerWithoutChamber());
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;
}
{
/// Transfert trigger data from ESDMuon track to the MUONLocalTtrigger object
- // if the ESDMuon track is a ghost then return an empty MUON track
- if (!esdTrack.ContainTriggerData()) {
- AliMUONLocalTrigger emptyLocTrg;
- locTrg = emptyLocTrg;
- return;
- }
+ // reset the local trigger content
+ AliMUONLocalTrigger emptyLocTrg;
+ locTrg = emptyLocTrg;
+
+ // if the ESDMuon track is a ghost then return an empty local trigger
+ if (!esdTrack.ContainTriggerData()) return;
locTrg.SetUniqueID(esdTrack.GetUniqueID());
locTrg.SetLoCircuit(esdTrack.LoCircuit());
locTrg.SetDeviation(esdTrack.LoDev());
locTrg.SetLoLpt(esdTrack.LoLpt());
locTrg.SetLoHpt(esdTrack.LoHpt());
- locTrg.SetTriggerWithoutChamber(esdTrack.GetTriggerWithoutChamber());
- locTrg.SetLoTrigY(1);
+ for (Int_t ich = 0; ich < 4; ich++)
+ if (esdTrack.TriggerFiredWithoutChamber(ich))
+ locTrg.SetTriggerWithoutChamber(ich);
+ locTrg.SetLoTrigY(0);
locTrg.SetX1Pattern(esdTrack.GetTriggerX1Pattern());
locTrg.SetX2Pattern(esdTrack.GetTriggerX2Pattern());
locTrg.SetX3Pattern(esdTrack.GetTriggerX3Pattern());
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);
esdTrack.SetLocalTrigger(track.GetLocalTrigger());
esdTrack.SetChi2MatchTrigger(track.GetChi2MatchTrigger());
esdTrack.SetHitsPatternInTrigCh(track.GetHitsPatternInTrigCh());
+ esdTrack.SetHitsPatternInTrigChTrk(track.GetHitsPatternInTrigChTrk());
if (locTrg) {
esdTrack.SetTriggerX1Pattern(locTrg->GetX1Pattern());
esdTrack.SetTriggerY1Pattern(locTrg->GetY1Pattern());
esdTrack.SetTriggerX4Pattern(locTrg.GetX4Pattern());
esdTrack.SetTriggerY4Pattern(locTrg.GetY4Pattern());
UShort_t hitPattern = 0;
+ esdTrack.SetHitsPatternInTrigChTrk(hitPattern);
if(triggerTrack){
hitPattern = triggerTrack->GetHitsPatternInTrigCh();
esdTrack.SetHitsPatternInTrigCh(hitPattern);
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);