#include "AliMUONTrackHitPattern.h"
#include "AliMUONTrackParam.h"
#include "AliMUONVCluster.h"
+#include "AliMUONVClusterServer.h"
+#include "AliMUONVDigitStore.h"
#include "AliMUONTrackReconstructor.h"
#include "AliMUONTrackReconstructorK.h"
#include "AliMUONTrackStoreV1.h"
-#include "AliMUONTriggerChamberEff.h"
#include "AliMUONTriggerTrackStoreV1.h"
-#include "AliMUONVClusterStore.h"
+#include "AliMUONClusterStoreV2.h"
#include "AliMUONVTriggerStore.h"
#include "AliESDEvent.h"
#include "AliESDMuonTrack.h"
+#include "AliESDMuonCluster.h"
+#include "AliESDMuonPad.h"
#include "AliESDVertex.h"
#include "AliLog.h"
#include "AliCodeTimer.h"
#include <Riostream.h>
#include <TTree.h>
+#include <TRandom.h>
/// \cond CLASSIMP
ClassImp(AliMUONTracker)
//_____________________________________________________________________________
-AliMUONTracker::AliMUONTracker(const AliMUONDigitMaker* digitMaker,
+AliMUONTracker::AliMUONTracker(AliMUONVClusterServer& clusterServer,
+ const AliMUONVDigitStore& digitStore,
+ const AliMUONDigitMaker* digitMaker,
const AliMUONGeometryTransformer* transformer,
- const AliMUONTriggerCircuit* triggerCircuit,
- AliMUONTriggerChamberEff* chamberEff)
+ const AliMUONTriggerCircuit* triggerCircuit)
: AliTracker(),
fDigitMaker(digitMaker), // not owner
fTransformer(transformer), // not owner
fTriggerCircuit(triggerCircuit), // not owner
- fTrigChamberEff(chamberEff), // not owner
fTrackHitPatternMaker(0x0),
fTrackReco(0x0),
fClusterStore(0x0),
- fTriggerStore(0x0)
+ fTriggerStore(0x0),
+ fClusterServer(clusterServer), // not owner
+ fDigitStore(digitStore) // not owner
{
/// constructor
if (fTransformer && fDigitMaker)
fTrackHitPatternMaker = new AliMUONTrackHitPattern(*fTransformer,*fDigitMaker);
+
+ fClusterServer.UseDigitStore(fDigitStore);
}
//_____________________________________________________________________________
delete fTriggerStore;
}
+//_____________________________________________________________________________
+AliMUONVClusterStore*
+AliMUONTracker::ClusterStore() const
+{
+ /// Return (and create if necessary) the cluster container
+ if (!fClusterStore)
+ {
+ fClusterStore = new AliMUONClusterStoreV2;
+ }
+ return fClusterStore;
+}
+
//_____________________________________________________________________________
Int_t AliMUONTracker::LoadClusters(TTree* clustersTree)
{
- /// Load clusterStore and triggerStore from clustersTree
- delete fClusterStore;
+ /// Load triggerStore from clustersTree
+
+ ClusterStore()->Clear();
+
delete fTriggerStore;
if ( ! clustersTree ) {
return 1;
}
- fClusterStore = AliMUONVClusterStore::Create(*clustersTree);
fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
- if (!fClusterStore)
- {
- AliError("Could not get clusterStore");
- return 1;
- }
if (!fTriggerStore)
{
AliError("Could not get triggerStore");
return 2;
}
- fClusterStore->Connect(*clustersTree,kFALSE);
+ ClusterStore()->Connect(*clustersTree,kFALSE);
fTriggerStore->Connect(*clustersTree,kFALSE);
clustersTree->GetEvent(0);
// if the required tracking mode does not exist
if (!fTrackReco) return 1;
- if (!fClusterStore) {
+ if ( ! ClusterStore() )
+ {
AliError("ClusterStore is NULL");
return 2;
}
AliError("TriggerStore is NULL");
return 3;
}
-
+
// Make tracker tracks
AliMUONVTrackStore* trackStore = new AliMUONTrackStoreV1;
- fTrackReco->EventReconstruct(*fClusterStore,*trackStore);
+ fTrackReco->EventReconstruct(*(ClusterStore()),*trackStore);
// Make trigger tracks
AliMUONVTriggerTrackStore* triggerTrackStore(0x0);
fTrackReco->ValidateTracksWithTrigger(*trackStore,*triggerTrackStore,*fTriggerStore,*fTrackHitPatternMaker);
}
- // Compute trigger chamber efficiency
- if( triggerTrackStore && fTrigChamberEff){
- AliCodeTimerStart("EventChamberEff");
- fTrigChamberEff->EventChamberEff(*fTriggerStore,*triggerTrackStore,*trackStore);
- AliCodeTimerStop("EventChamberEff");
- }
-
// Fill ESD
FillESD(*trackStore,esd);
AliDebug(1,"");
AliCodeTimerAuto("")
+ // Random number to decide whether to save additional cluster info or not for the current event
+ Double_t rand = 0.;
+ if (AliMUONReconstructor::GetRecoParam()->SaveFullClusterInESD()) rand = gRandom->Uniform(0.,100.);
+
// Get vertex
Double_t vertex[3] = {0};
+ Double_t errXVtx = 0., errYVtx = 0.;
const AliESDVertex* esdVert = esd->GetVertex();
if (esdVert->GetNContributors())
{
esdVert->GetXYZ(vertex);
+ errXVtx = esdVert->GetXRes();
+ errYVtx = esdVert->GetYRes();
AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2]));
}
- // setting ESD MUON class
- AliESDMuonTrack esdTrack;
-
AliMUONTrack* track;
+ AliMUONVCluster* cluster;
+ AliMUONVDigit* digit;
TIter next(trackStore.CreateIterator());
while ( ( track = static_cast<AliMUONTrack*>(next()) ) )
{
AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track->GetTrackParamAtCluster())->First());
- AliMUONTrackParam trackParamAtVtx(*trackParam);
+
+ // new ESD muon track
+ AliESDMuonTrack esdTrack;
/// Extrapolate to vertex (which is set to (0,0,0) if not available, see above)
- AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0],vertex[1],vertex[2]);
+ AliMUONTrackParam trackParamAtVtx(*trackParam);
+ AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0], vertex[1], vertex[2], errXVtx, errYVtx);
- // setting data member of ESD MUON
+ /// Extrapolate to vertex plan (which is set to z=0 if not available, see above)
+ AliMUONTrackParam trackParamAtDCA(*trackParam);
+ AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(&trackParamAtDCA, vertex[2]);
// at first station
trackParam->SetParamForUncorrected(esdTrack);
trackParam->SetCovFor(esdTrack);
+
// at vertex
trackParamAtVtx.SetParamFor(esdTrack);
+
+ // at Distance of Closest Approach
+ trackParamAtDCA.SetParamForDCA(esdTrack);
+
// global info
esdTrack.SetChi2(track->GetGlobalChi2());
esdTrack.SetNHit(track->GetNClusters());
esdTrack.SetLocalTrigger(track->GetLocalTrigger());
esdTrack.SetChi2MatchTrigger(track->GetChi2MatchTrigger());
esdTrack.SetHitsPatternInTrigCh(track->GetHitsPatternInTrigCh());
- // muon cluster map
+
+ // muon cluster info
while (trackParam) {
- esdTrack.AddInMuonClusterMap(trackParam->GetClusterPtr()->GetChamberId());
+ cluster = trackParam->GetClusterPtr();
+
+ // new ESD muon cluster
+ AliESDMuonCluster esdCluster;
+
+ // fill minimum info in ESD cluster
+ esdCluster.SetUniqueID(cluster->GetUniqueID());
+ esdCluster.SetXYZ(cluster->GetX(), cluster->GetY(), cluster->GetZ());
+ esdCluster.SetErrXY(cluster->GetErrX(), cluster->GetErrY());
+
+ // fill additional info in ESD cluster if required and only for a fraction of events
+ if (AliMUONReconstructor::GetRecoParam()->SaveFullClusterInESD() &&
+ rand <= AliMUONReconstructor::GetRecoParam()->GetPercentOfFullClusterInESD()) {
+
+ esdCluster.SetCharge(cluster->GetCharge());
+ esdCluster.SetChi2(cluster->GetChi2());
+
+ // fill ESD pad with digit info
+ for (Int_t i=0; i<cluster->GetNDigits(); i++) {
+ digit = fDigitStore.FindObject(cluster->GetDigitId(i));
+
+ // new ESD muon pad
+ AliESDMuonPad esdPad;
+
+ esdPad.SetUniqueID(digit->GetUniqueID());
+ esdPad.SetADC(digit->ADC());
+ esdPad.SetCharge(digit->Charge());
+
+ // add pad info in ESD cluster
+ esdCluster.AddPad(esdPad);
+ }
+
+ }
+
+ // add cluster info in ESD track
+ esdTrack.AddCluster(esdCluster);
+ esdTrack.AddInMuonClusterMap(cluster->GetChamberId());
+
trackParam = static_cast<AliMUONTrackParam*>(track->GetTrackParamAtCluster()->After(trackParam));
}
if (strstr(opt,"ORIGINAL"))
{
- fTrackReco = new AliMUONTrackReconstructor();
+ fTrackReco = new AliMUONTrackReconstructor(fClusterServer);
}
else if (strstr(opt,"KALMAN"))
{
- fTrackReco = new AliMUONTrackReconstructorK();
+ fTrackReco = new AliMUONTrackReconstructorK(fClusterServer);
}
else
{
//_____________________________________________________________________________
void AliMUONTracker::UnloadClusters()
{
- /// Delete internal clusterStore
- delete fClusterStore;
- fClusterStore = 0x0;
+ /// Clear internal clusterStore
+
+ ClusterStore()->Clear();
}
-