60 fNPlanesMFTAnalyzed(0),
62 fScaleSigmaClusterCut(1.),
63 fNMaxMissingMFTClusters(0),
64 fGlobalTrackingDiverged(kFALSE),
68 fFinalBestCandidate(0),
72 fXExtrapVertexError(0),
73 fYExtrapVertexError(0),
74 fBransonCorrection(kFALSE)
82 fSegmentation = fMFT->GetSegmentation();
86 AliInfo(Form(
"fMFT = %p, fSegmentation = %p", fMFT, fSegmentation));
88 for (Int_t iPlane=0; iPlane<fNPlanesMFT; iPlane++) {
89 fMFTClusterArray[iPlane] =
new TClonesArray(
"AliMFTCluster");
90 fMFTClusterArrayFront[iPlane] =
new TClonesArray(
"AliMFTCluster");
91 fMFTClusterArrayBack[iPlane] =
new TClonesArray(
"AliMFTCluster");
92 fMFTClusterArray[iPlane] -> SetOwner(kTRUE);
93 fMFTClusterArrayFront[iPlane] -> SetOwner(kTRUE);
94 fMFTClusterArrayBack[iPlane] -> SetOwner(kTRUE);
95 fMinResearchRadiusAtPlane[iPlane] = 0.;
98 fCandidateTracks =
new TClonesArray(
"AliMuonForwardTrack",50000);
108 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
127 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
128 AliDebug(1, Form(
"Setting Address for Branch Plane_%02d", iPlane));
129 cTree->SetBranchAddress(Form(
"Plane_%02d",iPlane), &
fMFTClusterArray[iPlane]);
132 if (!cTree->GetEvent())
return kFALSE;
133 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
154 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
173 TFile *outputFileMuonGlobalTracks =
new TFile(
"MuonGlobalTracks.root",
"update");
174 TTree *outputTreeMuonGlobalTracks =
new TTree(
"AliMuonForwardTracks",
"Tree of AliMuonForwardTracks");
175 TClonesArray *muonForwardTracks =
new TClonesArray(
"AliMuonForwardTrack");
176 outputTreeMuonGlobalTracks -> Branch(
"tracks", &muonForwardTracks);
191 if (esdVert->
GetNContributors() > 0 || !strcmp(esdVert->GetTitle(),
"vertexer: smearMC")) {
197 AliInfo(Form(
"Found ESD vertex from %d contributors (%f +/- %f, %f +/- %f, %f)",
204 Int_t nTracksMUON =
event->GetNumberOfMuonTracks();
206 AliInfo(Form(
"Number of ESD MUON tracks: %d\n", nTracksMUON));
209 while (iTrack<nTracksMUON) {
213 AliInfo(
"****************************************************************************************");
214 AliInfo(Form(
"*************************** MUON TRACK %3d/%d ***************************************", iTrack, nTracksMUON));
215 AliInfo(
"****************************************************************************************");
228 AliInfo(
"Skipping track, no parameters available!!!");
242 Double_t xEndOfAbsorber = trackParamEndOfAbsorber.GetNonBendingCoor();
243 Double_t yEndOfAbsorber = trackParamEndOfAbsorber.GetBendingCoor();
244 Double_t rAbsorber = TMath::Sqrt(xEndOfAbsorber*xEndOfAbsorber + yEndOfAbsorber*yEndOfAbsorber);
245 track -> SetRAtAbsorberEnd(rAbsorber);
249 for (Int_t iPlane=
fNPlanesMFT-1; iPlane>=0; iPlane--) {
258 for (Int_t iCandidate=0; iCandidate<nCandidates; iCandidate++) {
288 AliDebug(1,
"Finished cycle over planes");
295 AliInfo(Form(
"nFinalTracks = %d", nFinalTracks));
297 Int_t nGoodClustersBestCandidate = 0;
298 Int_t idBestCandidate = 0;
299 Double_t bestChi2 = -1.;
301 for (Int_t iFinalCandidate=0; iFinalCandidate<nFinalTracks; iFinalCandidate++) {
305 Int_t nMFTClusters = finalTrack->GetNMFTClusters();
308 for (Int_t iCluster=0; iCluster<nMFTClusters; iCluster++) {
309 AliMFTCluster *localCluster = finalTrack->GetMFTCluster(iCluster);
312 chi2 /= nMFTClusters;
316 if (chi2<bestChi2 || bestChi2<0) {
318 idBestCandidate = iFinalCandidate;
326 newTrack -> SetNWrongClustersMC(newTrack->GetNMFTClusters() - nGoodClustersBestCandidate);
328 new ((*muonForwardTracks)[muonForwardTracks->GetEntries()])
AliMuonForwardTrack(*newTrack);
334 AliDebug(2,
"Creating a new Muon Global Track");
336 myESDTrack -> SetPxPyPz(newTrack->Px(), newTrack->Py(), newTrack->Pz());
338 myESDTrack -> SetLabel(newTrack->
GetMCLabel());
339 myESDTrack -> SetChi2OverNdf(newTrack->GetChi2OverNdf());
340 myESDTrack -> SetCharge(newTrack->GetCharge());
342 myESDTrack -> SetNMFTClusters(newTrack->GetNMFTClusters());
343 myESDTrack -> SetNWrongMFTClustersMC(newTrack->GetNWrongClustersMC());
344 myESDTrack -> SetFirstTrackingPoint(newTrack->GetMFTCluster(0)->GetX(), newTrack->GetMFTCluster(0)->GetY(), newTrack->GetMFTCluster(0)->GetZ());
346 myESDTrack -> SetRAtAbsorberEnd(newTrack->GetRAtAbsorberEnd());
347 myESDTrack -> SetCovariances(newTrack->GetTrackParamAtMFTCluster(0)->GetCovariances());
354 ULong_t mftClusterPattern = 0;
355 for (Int_t iCluster=0; iCluster<newTrack->GetNMFTClusters(); iCluster++) {
356 AliMFTCluster *localCluster = newTrack->GetMFTCluster(iCluster);
357 mftClusterPattern |= 1 << localCluster->
GetPlane();
360 myESDTrack -> SetMFTClusterPattern(mftClusterPattern);
370 outputTreeMuonGlobalTracks -> Fill();
373 while (outputFileMuonGlobalTracks->cd(Form(
"Event%d",myEventID))) myEventID++;
374 outputFileMuonGlobalTracks -> mkdir(Form(
"Event%d",myEventID));
375 outputFileMuonGlobalTracks -> cd(Form(
"Event%d",myEventID));
376 outputTreeMuonGlobalTracks -> Write();
377 outputFileMuonGlobalTracks -> Close();
379 muonForwardTracks -> Delete();
380 delete muonForwardTracks;
545 AliDebug(3,Form(
"dX = %f, dY = %f\n", dX, dY));
549 Double_t sigmaX2 = kParamCov(0,0) + cluster->
GetErrX2();
550 Double_t sigmaY2 = kParamCov(2,2) + cluster->
GetErrY2();
551 AliDebug(3, Form(
"dX2 = %f, dY2 = %f\n", sigmaX2, sigmaY2));
552 Double_t covXY = kParamCov(0,2);
553 Double_t det = sigmaX2 * sigmaY2 - covXY * covXY;
556 if (det==0.)
return 1.e10;
557 return (dX*dX*sigmaY2 + dY*dY*sigmaX2 - 2.*dX*dY*covXY) / det;
565 Bool_t result = kFALSE;
569 for (Int_t iTrack=0; iTrack<cluster->
GetNMCTracks(); iTrack++) {
586 AliError(
"no run loader found in file galice.root");
597 AliInfo(Form(
"Primary vertex from MC found in (%f, %f, %f)\n",vtx[0], vtx[1], vtx[2]));
604 AliInfo(Form(
"Set ESD vertex from MC (%f +/- %f, %f +/- %f, %f)",
613 AliInfo(
"Adding clusters from underlying event");
617 TGrid::Connect(
"alien://");
620 if (!fileWithClustersToAdd)
return;
621 if (!(fileWithClustersToAdd->IsOpen()))
return;
629 treeIn = (TTree*) gDirectory->Get(
"TreeR");
631 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
632 if (!(treeIn->GetBranch(Form(
"Plane_%02d",iPlane)))) {
636 else treeIn->SetBranchAddress(Form(
"Plane_%02d",iPlane), &(recPointsPerPlaneToAdd[iPlane]));
639 treeIn -> GetEntry(0);
641 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
643 Int_t nClusters = recPointsPerPlaneToAdd[iPlane]->GetEntries();
644 for (Int_t iCluster=0; iCluster<nClusters; iCluster++) {
660 AliInfo(
"Adding clusters from pile-up event(s)");
664 TGrid::Connect(
"alien://");
667 if (!fileWithClustersToAdd)
return;
668 if (!(fileWithClustersToAdd->IsOpen()))
return;
679 treeIn = (TTree*) gDirectory->Get(
"TreeR");
681 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
682 if (!(treeIn->GetBranch(Form(
"Plane_%02d",iPlane)))) {
686 else treeIn->SetBranchAddress(Form(
"Plane_%02d",iPlane), &(recPointsPerPlaneToAdd[iPlane]));
689 treeIn -> GetEntry(0);
691 for (Int_t iPlane=0; iPlane<
fNPlanesMFT; iPlane++) {
693 Int_t nClusters = recPointsPerPlaneToAdd[iPlane]->GetEntries();
694 for (Int_t iCluster=0; iCluster<nClusters; iCluster++) {
static const Double_t fYVertexTolerance
static Double_t AbsZEnd()
Return z-position of absorber end.
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
static void ESDToMUON(const AliESDMuonTrack &esdTrack, AliMUONTrack &track, Bool_t refit=kTRUE)
TFile * Open(const char *filename, Long64_t &nevents)
TClonesArray * fMFTClusterArray[fNMaxPlanes]
static const Double_t fPrimaryVertexResY
UInt_t GetMuonClusterMap() const
Int_t GetMatchTrigger(void) const
return 1,2,3 if track matches with trigger track, 0 if not
AliMFT * fMFT
pointer to the ESD event
Class to describe the MUON tracks in the Event Summary Data class.
virtual Double_t GetY() const
AliMuonForwardTrack * fCurrentTrack
muon track being analyzed
Double_t GetBendingCoor() const
return bending coordinate (cm)
Bool_t fIsPlaneMandatory[fNMaxPlanes]
const Char_t * GetFileNameForUnderlyingEvent()
Short_t GetUnderlyingEventID()
void AddClustersFromUnderlyingEvent()
static const Double_t fPrimaryVertexResX
static const Int_t fNMaxPlanes
Track parameters in ALICE dimuon spectrometer.
UInt_t GetHitsPatternInTrigChTrk() const
static const Int_t fNMaxPlanes
UShort_t GetHitsPatternInTrigCh() const
Double_t GetErrX2() const
Int_t GetEvNumber() const
void SetMCLabel(Int_t track, Int_t labelMC)
static AliRunLoader * Open(const char *filename="galice.root", const char *eventfoldername=AliConfig::GetDefaultEventFolderName(), Option_t *option="READ")
Double_t TryOneCluster(const AliMUONTrackParam &trackParam, AliMFTCluster *cluster)
Int_t GetNMCTracks() const
void SeparateFrontBackClusters()
static const Int_t fLabelOffsetMC
TClonesArray * fMFTClusterArrayFront[fNMaxPlanes]
array of clusters for the planes of the MFT
static const Double_t fZEvalKinem
AliHeader * GetHeader() const
Bool_t IsConnected() const
virtual Double_t GetZ() const
Int_t GetMCLabel() const
return the corresponding MC track number
Int_t fNMaxMissingMFTClusters
Int_t LoadClusters(TTree *cf)
virtual Double_t GetX() const
Double_t GetErrY2() const
static const Double_t fPrimaryVertexResZ
void AddClustersFromPileUpEvents()
Double_t fXExtrapVertexError
Constants for the Muon Forward Tracker.
Int_t fNPlanesMFTAnalyzed
Int_t GetEvent(Int_t evno)
#define AliDebug(logLevel, message)
static const Double_t fXVertexTolerance
static const Int_t fNMaxPileUpEvents
TClonesArray * fMFTClusterArrayBack[fNMaxPlanes]
array of front clusters for the planes of the MFT
Double_t fYExtrapVertexError
Double_t fScaleSigmaClusterCut
Double_t GetChi2MatchTrigger() const
const AliESDVertex * GetVertex() const
virtual Int_t GetNContributors() const
Double_t GetNonBendingCoor() const
return non bending coordinate (cm)
Bool_t IsCorrectMatch(AliMFTCluster *cluster, Int_t labelMC)
const Char_t * GetFileNameForPileUpEvents()
Bool_t fGlobalTrackingDiverged
Int_t FindClusterInPlane(Int_t planeId)
AliDetector * GetDetector(const char *name) const
Reconstructed track in ALICE dimuon spectrometer.
#define AliError(message)
TClonesArray * fCandidateTracks
array of back clusters for the planes of the MFT
static const Int_t kNDisks
Number of Disk.
AliMUONTrack * fMUONTrack
array of candidate global tracks
Int_t GetMCLabel(Int_t track) const
AliMuonForwardTrack * fFinalBestCandidate
muon extrapolated track being tested
const TMatrixD & GetCovariances() const
Int_t Clusters2Tracks(AliESDEvent *event)
Double_t fXExtrapVertex
best final candidate (if any)
Short_t GetPileUpEventID(Short_t i)
virtual ~AliMFTTrackerMU()
ALICE muon forward track, combining the information of the Muon Spectrometer and the Muon Forward Tra...
TObjArray * GetTrackParamAtCluster() const