48 #include "AliMCEventHandler.h"
49 #include "AliMCEvent.h"
51 #include "AliTrackReference.h"
53 #include "AliESDEvent.h"
54 #include "AliESDMuonTrack.h"
61 #include "AliGeomManager.h"
62 #include "AliCDBManager.h"
74 #include "TGeoManager.h"
78 #include <TParticle.h>
79 #include <TParticlePDG.h>
80 #include <Riostream.h>
91 fMCEventHandler(new AliMCEventHandler()),
92 fESDEvent(new AliESDEvent()),
97 fRecoTrackRefStore(0x0),
98 fRecoTriggerRefStore(0x0),
100 fRecoTriggerTrackStore(0x0),
101 fGeometryTransformer(0x0),
102 fTriggerCircuit(0x0),
103 fCalibrationData(0x0),
104 fTriggerElectronics(0x0),
105 fESDEventOwner(kTRUE)
110 fMCEventHandler->SetInputPath(pathSim);
111 fMCEventHandler->InitIO(
"");
115 if (!fESDFile || !fESDFile->IsOpen()) {
116 AliError(Form(
"opening ESD file %s failed", esdFileName));
120 fESDTree = (TTree*) fESDFile->Get(
"esdTree");
122 AliError(
"no ESD tree found");
127 fESDEvent->ReadFromTree(fESDTree);
139 fRecoTrackRefStore(0x0),
140 fRecoTriggerRefStore(0x0),
141 fRecoTrackStore(0x0),
142 fRecoTriggerTrackStore(0x0),
143 fGeometryTransformer(0x0),
144 fTriggerCircuit(0x0),
145 fCalibrationData(0x0),
146 fTriggerElectronics(0x0),
147 fESDEventOwner(kFALSE)
209 AliError(Form(
"fails to read ESD object for event %d: cannot get the run number",
fCurrentEvent));
246 if (
fESDTree->GetEvent(event) <= 0) {
247 AliError(Form(
"fails to read ESD object for event %d", event));
275 if (
fESDTree->GetEvent(event) <= 0) {
276 AliError(Form(
"fails to read ESD object for event %d", event));
304 AliError(Form(
"fails to read MC objects for event %d", event));
332 AliError(Form(
"fails to read MC objects for event %d", event));
378 Int_t nTracks = (Int_t)
fESDEvent->GetNumberOfMuonTracks();
379 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
380 AliESDMuonTrack* esdTrack =
fESDEvent->GetMuonTrack(iTrack);
394 if ( ! tmpTriggerStore )
return;
397 Int_t nTracks = (Int_t)
fESDEvent->GetNumberOfMuonTracks();
398 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
399 AliESDMuonTrack* esdTrack =
fESDEvent->GetMuonTrack(iTrack);
409 delete tmpTriggerStore;
427 if (!tmpTrackRefStore)
return;
429 Double_t x, y, z, pX, pY, pZ, bendingSlope, nonBendingSlope, inverseBendingMomentum;
431 TClonesArray* trackRefs;
436 for (Int_t iTrackRef = 0; iTrackRef < nTrackRef; ++iTrackRef) {
437 Int_t nHits =
fMCEventHandler->GetParticleAndTR(iTrackRef, particle, trackRefs);
440 if (nHits < 1)
continue;
443 TParticlePDG* ppdg = particle->GetPDG();
444 Int_t charge = ppdg != NULL ? (Int_t)(ppdg->Charge()/3.0) : 0;
449 for (Int_t iHit = 0; iHit < nHits; ++iHit) {
450 AliTrackReference* trackReference =
static_cast<AliTrackReference*
>(trackRefs->UncheckedAt(iHit));
453 if (trackReference->DetectorId() != AliTrackReference::kMUON)
continue;
456 x = trackReference->X();
457 y = trackReference->Y();
458 z = trackReference->Z();
459 pX = trackReference->Px();
460 pY = trackReference->Py();
461 pZ = trackReference->Pz();
464 Int_t detElemId = trackReference->UserId();
465 Int_t chamberId = detElemId / 100 - 1;
476 inverseBendingMomentum = 0;
477 if (TMath::Abs(pZ) > 0) {
478 bendingSlope = pY/pZ;
479 nonBendingSlope = pX/pZ;
481 Double_t pYZ = TMath::Sqrt(pY*pY+pZ*pZ);
482 if (pYZ >0) inverseBendingMomentum = 1/pYZ;
483 inverseBendingMomentum *= charge;
512 inverseBendingMomentum = 0;
513 if (TMath::Abs(pZ) > 0) {
514 bendingSlope = pY/pZ;
515 nonBendingSlope = pX/pZ;
517 Double_t pYZ = TMath::Sqrt(pY*pY+pZ*pZ);
518 if (pYZ >0) inverseBendingMomentum = 1/pYZ;
519 inverseBendingMomentum *= charge;
525 trackParamAtVertex.
SetZ(z);
534 track.SetUniqueID(iTrackRef);
535 tmpTrackRefStore->
Add(track);
541 delete tmpTrackRefStore;
551 Double_t x, y, z, slopeX, slopeY, pZ, xLoc, yLoc, zLoc;
553 TClonesArray* trackRefs;
557 for (Int_t iTrackRef = 0; iTrackRef < nTrackRef; ++iTrackRef) {
558 Int_t nHits =
fMCEventHandler->GetParticleAndTR(iTrackRef, particle, trackRefs);
561 if (nHits < 1)
continue;
565 Int_t hitsOnTrigger = 0;
569 for (Int_t iHit = 0; iHit < nHits; ++iHit) {
570 AliTrackReference* trackReference =
static_cast<AliTrackReference*
>(trackRefs->UncheckedAt(iHit));
573 if (trackReference->DetectorId() != AliTrackReference::kMUON)
continue;
576 Int_t detElemId = trackReference->UserId();
577 Int_t chamberId = detElemId / 100 - 1;
581 x = trackReference->X();
582 y = trackReference->Y();
583 z = trackReference->Z();
596 Int_t ix = pad.
GetIx();
597 Int_t iy = pad.
GetIy();
599 if ( !pad.
IsValid() )
continue;
612 if ( hitsOnTrigger == 0 ) {
613 pZ = trackReference->Pz();
614 slopeX = ( pZ == 0. ) ? 99999. : trackReference->Px() / pZ;
615 slopeY = ( pZ == 0. ) ? 99999. : trackReference->Py() / pZ;
624 if ( currCh != chamberId ) {
631 if ( hitsOnTrigger < 3 )
continue;
641 Int_t ptCutLevel = 0;
643 while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(next()) ) )
645 if ( locTrg->IsTrigX() && locTrg->IsTrigY() )
647 ptCutLevel = TMath::Max(ptCutLevel, 1);
648 if ( locTrg->LoHpt() ) ptCutLevel = TMath::Max(ptCutLevel, 3);
649 else if ( locTrg->LoLpt() ) ptCutLevel = TMath::Max(ptCutLevel, 2);
654 track.SetUniqueID(iTrackRef);
668 Double_t maxGasGap = 1.;
669 Double_t x, y, z, pX, pY, pZ, x1, y1, z1, pX1, pY1, pZ1, z2;
670 Double_t bendingSlope,nonBendingSlope,inverseBendingMomentum;
678 while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) {
685 while (iHit1 < nTrackHits) {
691 z1 = trackParam1->
GetZ();
692 pX1 = trackParam1->
Px();
693 pY1 = trackParam1->
Py();
694 pZ1 = trackParam1->
Pz();
705 Int_t nCombinedHits = 1;
706 for (Int_t iHit2 = iHit1+1; iHit2 < nTrackHits; iHit2++) {
710 z2 = trackParam2->
GetZ();
713 if ( TMath::Abs(z2-z1) < maxGasGap ) {
717 pX += trackParam2->
Px();
718 pY += trackParam2->
Py();
719 pZ += trackParam2->
Pz();
727 x /= (Double_t)nCombinedHits;
728 y /= (Double_t)nCombinedHits;
729 z /= (Double_t)nCombinedHits;
730 pX /= (Double_t)nCombinedHits;
731 pY /= (Double_t)nCombinedHits;
732 pZ /= (Double_t)nCombinedHits;
735 inverseBendingMomentum = 0;
736 if (TMath::Abs(pZ) > 0) {
737 bendingSlope = pY/pZ;
738 nonBendingSlope = pX/pZ;
740 Double_t pYZ = TMath::Sqrt(pY*pY+pZ*pZ);
741 if (pYZ >0) inverseBendingMomentum = 1/pYZ;
742 inverseBendingMomentum *= trackParam1->
GetCharge();
745 hit->SetUniqueID(trackParam1->
GetClusterPtr()->GetUniqueID());
764 newTrack.SetUniqueID(track->GetUniqueID());
775 Bool_t hitInFrontOfPad)
781 if (hitInFrontOfPad) {
791 while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) {
794 if (track->IsValid(requestedStationMask, request2ChInSameSt45)) {
796 if (hitInFrontOfPad) {
826 Int_t &nMatchClusters, Bool_t useLabel, Double_t
sigmaCut)
844 for (Int_t iCl = 0; iCl < nClusters; iCl++)
854 while ( ( track2 = static_cast<AliMUONTrack*>(next()) ) ) {
858 if (track.
Match(*track2, sigmaCut, n)) {
859 matchedTrack = track2;
885 while ( ( track2 = static_cast<AliMUONTriggerTrack*>(next()) ) ) {
887 if (track.
Match(*track2, sigmaCut)) {
888 matchedTrack = track2;
939 if (!AliGeomManager::GetGeometry()) {
940 AliGeomManager::LoadGeometry();
941 if (!AliGeomManager::GetGeometry())
return kFALSE;
942 if (!AliGeomManager::ApplyAlignObjsFromCDB(
"MUON"))
return kFALSE;
964 if (!seg1 || !seg2)
return kFALSE;
TTree * fESDTree
ESD tree to access MUON data.
Base class of a track container.
Virtual class for the MUON track reconstruction.
TFile * Open(const char *filename, Long64_t &nevents)
void RemoveTrackParamAtCluster(AliMUONTrackParam *trackParam)
AliMUONVTrackStore * ReconstructibleTracks(Int_t event, UInt_t requestedStationMask=0x1F, Bool_t request2ChInSameSt45=kTRUE, Bool_t hitInFrontOfPad=kFALSE)
Return reconstructible reference tracks.
Int_t GetNClusters() const
return the number of clusters attached to the track
static AliMUONVCluster * NewCluster()
const AliMpVSegmentation * GetMpSegmentation(Int_t detElemId, AliMp::CathodType cath, Bool_t warn=true) const
virtual TIterator * CreateIterator() const =0
Iterator to loop over tracks.
Implementation of AliMUONVTriggerStore.
static AliMpSegmentation * Instance(Bool_t warn=true)
virtual ~AliMUONRecoCheck()
Bool_t Match(AliMUONTriggerTrack &track, Double_t sigmaCut) const
Int_t NumberOfEvents() const
Return the total number of events.
static Int_t NTrackingCh()
Return number of tracking chambers.
Bool_t InitCalibrationData()
Double_t GetBendingCoor() const
return bending coordinate (cm)
Bool_t InitTriggerResponse()
virtual TIterator * CreateIterator() const =0
Create an iterator to loop over tracks.
void SetPtCutLevel(Int_t ptCutLevel)
Set pt cut level.
AliMUONGeometryTransformer * fGeometryTransformer
geometry transformer
static void ResetTracker(const AliMUONRecoParam *recoParam=0x0, Bool_t info=kTRUE)
void SetSlopeY(Float_t slopeY)
Set track slope in Y.
Int_t GetRunNumber()
Return the run number of the current ESD event.
static UInt_t BuildUniqueID(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
Build a single integer with id information.
virtual Bool_t Add(TObject *object)
Add.
Int_t fCurrentEvent
current event number
Double_t GetZ() const
return Z coordinate (cm)
static Bool_t LoadDDLStore(Bool_t warn=false)
Track parameters in ALICE dimuon spectrometer.
void SetNonBendingCoor(Double_t nonBendingCoor)
set non bending coordinate (cm)
Reconstructed trigger track in ALICE dimuon spectrometer.
AliMUONVTriggerTrackStore * TriggeredTracks(Int_t event)
Return the list of reconstructed trigger tracks.
virtual void SetCharge(Float_t q)=0
Set the charge of this digit.
Bool_t request2ChInSameSt45
virtual void SetErrXY(Double_t errX, Double_t errY)=0
Set resolution (cm) on coordinates (X,Y)
Implementation of AliMUONVDigitStore.
Bool_t TriggerToTrack(const AliMUONTriggerCircuit &circuit, const AliMUONLocalTrigger &locTrg, AliMUONTriggerTrack &triggerTrack, UChar_t globalTriggerPattern=0)
Bool_t IsValid(UInt_t requestedStationMask, Bool_t request2ChInSameSt45=kFALSE)
Base class of a trigger information store.
Utility class to check reconstruction.
virtual TIterator * CreateIterator() const
Create iterator (on local card)
Manager class for muon trigger electronics.
AliMUONVTrackStore * TrackRefs(Int_t event)
Return reference muon tracks.
Bool_t Match(AliMUONTrack &track, Double_t sigma2Cut, Int_t &nMatchClusters) const
virtual AliMUONVDigit * Add(const AliMUONVDigit &digit, EReplacePolicy replace)
AliMUONRecoCheck(const Char_t *chLoader, const Char_t *pathSim="./")
static AliMpDDLStore * Instance(Bool_t warn=true)
virtual void SetXYZ(Double_t x, Double_t y, Double_t z)=0
Set coordinates (cm)
AliMUONVTriggerTrackStore * fRecoTriggerRefStore
current triggerable tracks (owner)
void SetBendingSlope(Double_t bendingSlope)
set bending slope (cm ** -1)
Bool_t fESDEventOwner
using constructor from the analysis task
abstract base class for clusters
AliMUONVTrackStore * fRecoTrackStore
current reconstructed tracks (owner)
void SetSlopeX(Float_t slopeX)
Set track slope in X.
AliMUONVTrackStore * fTrackRefStore
current simulated tracks (owner)
Reconstructed Local Trigger object.
Bool_t InitGeometryTransformer()
Double_t GetCharge() const
return the charge (assumed forward motion)
void SetTrackParamAtVertex(const AliMUONTrackParam *trackParam)
AliMUONTriggerElectronics * fTriggerElectronics
object to re-compute the trigger info
static AliMUONTrack * Add(const AliESDMuonTrack &esdTrack, AliMUONVTrackStore &trackStore, Bool_t refit=kTRUE)
static AliMUONVTrackStore * NewTrackStore()
void MakeReconstructedTracks(Bool_t refit)
Bool_t TriggerToTrack(const AliMUONLocalTrigger &locTrg, AliMUONTriggerTrack &triggerTrack)
void AddTrackParamAtCluster(const AliMUONTrackParam &trackParam, AliMUONVCluster &cluster, Bool_t copy=kFALSE)
AliESDEvent * fESDEvent
ESD event to access MUON data.
static AliMUONVTriggerStore * NewTriggerStore()
Int_t GetMCLabel() const
return the corresponding MC track number
virtual void SetPadXY(Int_t padx, Int_t pady)=0
Set the ix and iy of this digit.
AliMp::CathodType GetCathodType(Int_t cathodNumber)
Convert integer number in enum;.
void SetNonBendingSlope(Double_t nonBendingSlope)
set non bending slope (cm ** -1)
Base class of a trigger track store.
AliMUONCalibrationData * fCalibrationData
! Used to load Local, Regional and Global masks
Int_t GetLocalBoardId(Int_t i) const
static AliMUONTrack * FindCompatibleTrack(AliMUONTrack &track, AliMUONVTrackStore &trackStore, Int_t &nMatchClusters, Bool_t useLabel=kFALSE, Double_t sigmaCut=10.)
Return the track from the store matched with the given track (or 0x0) and the fraction of matched clu...
static AliMUONVTrackReconstructor * GetTracker()
Return pointer to the MUON tracker if any (use first ResetTracker(...) to create it) ...
void SetX11(Float_t x)
Set x position of fired Y strip in MC11.
AliMUONVTriggerTrackStore * fRecoTriggerTrackStore
current reconstructed trigger tracks (owner)
static Int_t NCh()
Return number of chambers.
AliMUONVTrackStore * ReconstructedTracks(Int_t event, Bool_t refit=kTRUE)
Return the list of reconstructed tracks.
Bool_t IsValid() const
Return validity.
void SetInverseBendingMomentum(Double_t inverseBendingMomentum)
set inverse bending momentum (GeV/c ** -1) times the charge (assumed forward motion) ...
TFile * fESDFile
ESD file to access MUON data.
virtual AliMpPad PadByPosition(Double_t x, Double_t y, Bool_t warning=true) const =0
Find pad by position.
Single entry point to access MUON calibration data.
static AliMUONVTriggerTrackStore * NewTriggerTrackStore()
UInt_t requestedStationMask
void SetBendingCoor(Double_t bendingCoor)
set bending coordinate (cm)
The abstract base class for the segmentation.
Double_t GetNonBendingCoor() const
return non bending coordinate (cm)
void CleanMuonTrackRef(const AliMUONVTrackStore *tmpTrackRefStore)
AliMUONVTriggerTrackStore * TriggerableTracks(Int_t event)
Return triggerable reference tracks.
AliMUONVCluster * GetClusterPtr() const
get pointeur to associated cluster
void SetY11(Float_t y)
Set y position of fired X strip in MC11.
Class which encapsuate all information about a pad.
Bool_t CheckOCDB(Bool_t pathOnly=kFALSE)
static Int_t GetDetElemId(UInt_t uniqueID)
Return detection element id, part of the uniqueID.
void SetZ11(Float_t z)
Set z position of fired X strip in MC11.
void EventReconstructTrigger(const AliMUONTriggerCircuit &triggerCircuit, const AliMUONVTriggerStore &triggerStore, AliMUONVTriggerTrackStore &triggerTrackStore)
Reconstructed track in ALICE dimuon spectrometer.
virtual Bool_t Add(TObject *object)
Add an object, if of the right type.
virtual void Digits2Trigger(const AliMUONVDigitStore &digitStore, AliMUONVTriggerStore &triggerStore)
void MakeTriggeredTracks()
Bool_t LoadMapping(Bool_t segmentationOnly=kFALSE)
void MakeTriggerableTracks()
void SetZ(Double_t z)
set Z coordinate (cm)
AliMUONVTrackStore * fRecoTrackRefStore
current reconstructible tracks (owner)
Int_t GetLocalBoardChannel(Int_t i) const
AliMCEventHandler * fMCEventHandler
to access MC truth information
Bool_t IsHitInFrontOfPad(AliMUONTrackParam *param) const
AliMUONTriggerCircuit * fTriggerCircuit
trigger circuit
virtual TObject * FindObject(const char *name) const
Find an object by name.
void MakeReconstructibleTracks(UInt_t requestedStationMask, Bool_t request2ChInSameSt45=kTRUE, Bool_t hitInFrontOfPad=kFALSE)
TObjArray * GetTrackParamAtCluster() const