#include "AliMUONVDigit.h"
#include "AliMUONVDigitStore.h"
#include "AliMUONLocalTrigger.h"
+#include "AliMUONTriggerTrack.h"
#include "AliMUONVTriggerStore.h"
#include "AliMUON2DMapIterator.h"
#include "AliMUONTrackParam.h"
#include "AliMpExMapIterator.h"
#include "AliMpVSegmentation.h"
#include "AliMpSegmentation.h"
-#include "AliMpIntPair.h"
#include "AliMpPad.h"
#include "AliESDEvent.h"
#include <TMath.h>
#include <TMatrixD.h>
#include <Riostream.h>
+#include <TGeoGlobalMagField.h>
+#include <TVirtualMagField.h>
//-----------------------------------------------------------------------------
/// \class AliMUONESDInterface
}
//_____________________________________________________________________________
-void AliMUONESDInterface::LoadEvent(AliESDEvent& esdEvent)
+void AliMUONESDInterface::LoadEvent(AliESDEvent& esdEvent, Bool_t refit)
{
/// Extract MUON data from the given ESD event
if (!esdTrack->ContainTrackerData()) continue;
// add it to track store
- AliMUONTrack* track = Add(*esdTrack, *fTracks);
+ AliMUONTrack* track = Add(*esdTrack, *fTracks, refit);
// prepare cluster map
AliMpExMap* cMap = new AliMpExMap;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//_____________________________________________________________________________
-void AliMUONESDInterface::ResetTracker(const AliMUONRecoParam* recoParam)
+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
fgRecoParam = new AliMUONRecoParam(*recoParam);
+ if (info) cout<<"I-AliMUONESDInterface::ResetTracker: will refit tracks with provided RecoParam:"<<endl;
+
} else {
fgRecoParam = AliMUONRecoParam::GetLowFluxParam();
- fgRecoParam->SetTrackingMode("KALMAN");
- fgRecoParam->UseSmoother(kTRUE);
- fgRecoParam->SetBendingVertexDispersion(10.);
+
+ cout<<"W-AliMUONESDInterface::ResetTracker: RecoParam not provided. Will use default LowFlux parametrization:"<<endl;
}
+ // print useful parameters for refitting
+ if (info) {
+ cout<<" --> Tracking mode = "<<fgRecoParam->GetTrackingMode()<<endl;
+ if (fgRecoParam->UseSmoother()) cout<<" --> Use Smoother"<<endl;
+ else cout<<" --> Do not use smoother"<<endl;
+ cout<<" --> Vertex dispersion in bending direction = "
+ <<fgRecoParam->GetBendingVertexDispersion()<<" cm"<<endl;
+ }
+
+ if (!TGeoGlobalMagField::Instance()->GetField())
+ cout<<"W-AliMUONESDInterface::ResetTracker: Magnetic field has not been set --> assume field is OFF"<<endl;
+
fgTracker = AliMUONTracker::CreateTrackReconstructor(fgRecoParam,0x0);
}
}
//_____________________________________________________________________________
-void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track)
+void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track, Bool_t refit)
{
/// Transfert data from ESDMuon track to MUON track.
- /// The track parameters at each cluster are obtained by refitting the track
+ /// If refit = kTRUE, the track parameters at each cluster are obtained by refitting the track
/// or by extrapolating the parameters at the first one if the refit failed.
+ /// If refit = kFALSE, only the track parameters at first cluster are valid.
/// note: You can set the recoParam used to refit the MUON track with ResetTracker(...);
/// By default we use Kalman filter + Smoother
esdCluster = (AliESDMuonCluster*) esdTrack.GetClusters().After(esdCluster);
}
- // recompute parameters at first cluster in case of those stored
- // in ESD are not related to the most upstream cluster
- AliMUONTrackParam *firstTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
- firstTrackParam->SetZ(esdTrack.GetZUncorrected()); // reset the z to the one stored in ESD
- AliMUONTrackExtrap::ExtrapToZCov(firstTrackParam,firstTrackParam->GetClusterPtr()->GetZ());
-
// refit the track to get better parameters and covariances at each cluster (temporary disable track improvement)
- if (!fgTracker) ResetTracker();
- if (!fgTracker->RefitTrack(track, kFALSE)) track.UpdateCovTrackParamAtCluster();
+ if (refit) {
+
+ AliMUONTrackParam *firstTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
+ AliMUONTrackParam paramSave(*firstTrackParam);
+
+ if (!fgTracker) ResetTracker();
+
+ if (!fgTracker->RefitTrack(track, kFALSE) && track.GetGlobalChi2() < AliMUONTrack::MaxChi2()) {
+ *firstTrackParam = paramSave;
+ track.UpdateCovTrackParamAtCluster();
+ }
+
+ }
} else {
{
/// Transfert data from ESDMuon pad to MUON digit
+ if (!AliMpSegmentation::Instance(kFALSE)) {
+ cout<<"E-AliMUONESDInterface::ESDToMUON: need mapping segmentation to convert ESD pad to MUON digit"<<endl;
+ return;
+ }
+
const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(esdPad.GetDetElemId(), esdPad.GetManuId());
- AliMpPad pad = seg->PadByLocation(AliMpIntPair(esdPad.GetManuId(), esdPad.GetManuChannel()), kFALSE);
+ AliMpPad pad = seg->PadByLocation(esdPad.GetManuId(), esdPad.GetManuChannel(), kFALSE);
digit.Saturated(esdPad.IsSaturated());
digit.Used(kFALSE);
digit.SetUniqueID(esdPad.GetUniqueID());
digit.SetCharge(esdPad.GetCharge());
digit.SetADC(esdPad.GetADC());
- digit.SetPadXY(pad.GetIndices().GetFirst(), pad.GetIndices().GetSecond());
+ digit.SetPadXY(pad.GetIx(), pad.GetIy());
}
}
//_____________________________________________________________________________
-void AliMUONESDInterface::MUONToESD(const AliMUONLocalTrigger& locTrg, AliESDMuonTrack& esdTrack, UInt_t trackId)
+void AliMUONESDInterface::MUONToESD(const AliMUONLocalTrigger& locTrg, AliESDMuonTrack& esdTrack,
+ UInt_t trackId, const AliMUONTriggerTrack* triggerTrack)
{
/// Build ghost ESDMuon track containing only informations about trigger track
locTrg.LoHpt());
esdTrack.SetLocalTrigger(muonTrack.GetLocalTrigger());
esdTrack.SetChi2MatchTrigger(0.);
- esdTrack.SetHitsPatternInTrigCh(0);
esdTrack.SetTriggerX1Pattern(locTrg.GetX1Pattern());
esdTrack.SetTriggerY1Pattern(locTrg.GetY1Pattern());
esdTrack.SetTriggerX2Pattern(locTrg.GetX2Pattern());
esdTrack.SetTriggerY3Pattern(locTrg.GetY3Pattern());
esdTrack.SetTriggerX4Pattern(locTrg.GetX4Pattern());
esdTrack.SetTriggerY4Pattern(locTrg.GetY4Pattern());
-
+ UShort_t hitPattern = 0;
+ if(triggerTrack){
+ hitPattern = triggerTrack->GetHitsPatternInTrigCh();
+ esdTrack.SetHitsPatternInTrigCh(hitPattern);
+ esdTrack.SetThetaXUncorrected(triggerTrack->GetThetax());
+ esdTrack.SetThetaYUncorrected(triggerTrack->GetThetay());
+ esdTrack.SetNonBendingCoorUncorrected(triggerTrack->GetX11());
+ esdTrack.SetBendingCoorUncorrected(triggerTrack->GetY11());
+ }
}
//_____________________________________________________________________________
}
//___________________________________________________________________________
-AliMUONTrack* AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore)
+AliMUONTrack* AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore, Bool_t refit)
{
/// Create MUON track from ESDMuon track and add it to the store
+ /// Track parameters at each clusters are recomputed or not depending on the flag "refit"
/// return a pointer to the track into the store (0x0 if the track already exist)
if(trackStore.FindObject(esdTrack.GetUniqueID())) return 0x0;
AliMUONTrack* track = trackStore.Add(AliMUONTrack());
- ESDToMUON(esdTrack, *track);
+ ESDToMUON(esdTrack, *track, refit);
return track;
}