X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=MFT%2FAliMuonForwardTrackFinder.cxx;h=10630841c5ea4f02b8f9502a8160c38424739cf9;hp=66fb665cf46afbb4b78f9c326ec53b797b241fcb;hb=d6080682f89d052b457a8971c1c814e0bf00b3a0;hpb=7230691d9998119811131f792ae000e240fc24ec diff --git a/MFT/AliMuonForwardTrackFinder.cxx b/MFT/AliMuonForwardTrackFinder.cxx index 66fb665cf46..10630841c5e 100644 --- a/MFT/AliMuonForwardTrackFinder.cxx +++ b/MFT/AliMuonForwardTrackFinder.cxx @@ -47,6 +47,7 @@ #include "AliMFTCluster.h" #include "AliMFT.h" #include "AliMFTSegmentation.h" +#include "AliMFTConstants.h" #include "AliMuonForwardTrackFinder.h" @@ -59,6 +60,8 @@ // //==================================================================================================================================================== +const Double_t AliMuonForwardTrackFinder::fRadLengthSi = AliMFTConstants::fRadLengthSi; + ClassImp(AliMuonForwardTrackFinder) //===================================================================================================== @@ -70,8 +73,9 @@ AliMuonForwardTrackFinder::AliMuonForwardTrackFinder(): fSigmaClusterCut(0), fChi2GlobalCut(0), fSigmaSpectrometerCut(0), - fExtrapOriginTransvError(0), - fGaussianBlurZVert(0), + fVertexErrorX(0.015), + fVertexErrorY(0.015), + fVertexErrorZ(0.010), fNFinalCandidatesCut(0), fReadDir(0), fOutDir(0), @@ -89,24 +93,20 @@ AliMuonForwardTrackFinder::AliMuonForwardTrackFinder(): fEv(0), fLabelMC(0), - fHistPtSpectrometer(0), - fHistPtMuonTrackWithGoodMatch(0), - fHistPtMuonTrackWithBadMatch(0), fHistRadiusEndOfAbsorber(0), fHistNGoodClustersForFinalTracks(0), fHistDistanceGoodClusterFromTrackMinusDistanceBestClusterFromTrackAtLastPlane(0), fHistDistanceGoodClusterFromTrackAtLastPlane(0), - fNtuFinalCandidates1(0), - fNtuFinalBestCandidates1(0), - fNtuFinalCandidates2(0), - fNtuFinalBestCandidates2(0), + fNtuFinalCandidates(0), + fNtuFinalBestCandidates(0), fCanvas(0), fTxtMuonHistory(0), fTxtTrackGoodClusters(0), - fTxtTrackFinalChi2(0), + fTxtTrackFinalChi2(0), + fTxtTrackMomentum(0), fTxtFinalCandidates(0), fTxtDummy(0), fTxtAllClust(0), @@ -118,7 +118,8 @@ AliMuonForwardTrackFinder::AliMuonForwardTrackFinder(): fMrkClustMC(0), fMrkClustOfTrack(0), - fCountRealTracksAnalyzed(0), + fCountRealTracksAnalyzed(0), + fMaxNTracksToBeAnalyzed(99999999), fCountRealTracksWithRefMC(0), fCountRealTracksWithRefMC_andTrigger(0), fCountRealTracksWithRefMC_andTrigger_andGoodPt(0), @@ -136,6 +137,7 @@ AliMuonForwardTrackFinder::AliMuonForwardTrackFinder(): fMFTClusterTree(0), fMuonTrackReco(0), fCurrentTrack(0), + fFinalBestCandidate(0), fIsCurrentMuonTrackable(0), fCandidateTracks(0), fTrackStore(0), @@ -145,6 +147,7 @@ AliMuonForwardTrackFinder::AliMuonForwardTrackFinder(): fMFT(0), fSegmentation(0), fOutputTreeFile(0), + fOutputQAFile(0), fOutputEventTree(0), fMuonForwardTracks(0), fMatchingMode(-1), @@ -156,7 +159,7 @@ AliMuonForwardTrackFinder::AliMuonForwardTrackFinder(): // Default constructor - for (Int_t iPlane=0; iPlane Branch("tracks", &fMuonForwardTracks); @@ -208,53 +211,145 @@ AliMuonForwardTrackFinder::AliMuonForwardTrackFinder(): //===================================================================================================== +AliMuonForwardTrackFinder::~AliMuonForwardTrackFinder() { + + for (Int_t iPlane=0; iPlaneIsOpen()) return; - else printf("file %s successfully opened\n", fFileESD->GetName()); + else AliInfo(Form("file %s successfully opened\n", fFileESD->GetName())); fMuonRecoCheck = new AliMUONRecoCheck(esdFileName, Form("%s/generated/", fReadDir.Data())); // Utility class to check reconstruction fFile_gAlice = new TFile(gAliceName); if (!fFile_gAlice || !fFile_gAlice->IsOpen()) return; - else printf("file %s successfully opened\n", fFile_gAlice->GetName()); + else AliInfo(Form("file %s successfully opened\n", fFile_gAlice->GetName())); fRunLoader = AliRunLoader::Open(gAliceName); gAlice = fRunLoader->GetAliRun(); @@ -279,29 +374,28 @@ void AliMuonForwardTrackFinder::Init(Int_t nRun, fMFTClusterTree = fMFTLoader->TreeR(); - Int_t nEventsInFile = fMuonRecoCheck->NumberOfEvents(); if (!nEventsInFile) { - printf("no events available!!!\n"); + AliError("no events available!!!\n"); return; } if (nEventsInFileReconstructedTracks(fEv); fTrackRefStore = fMuonRecoCheck->ReconstructibleTracks(fEv); @@ -333,7 +426,7 @@ Bool_t AliMuonForwardTrackFinder::LoadNextEvent() { fRunLoader->GetEvent(fEv); if (!fMFTLoader->TreeR()->GetEvent()) return kFALSE; for (Int_t iPlane=0; iPlaneGetRecPointsList(iPlane))->GetEntries()); + AliDebug(1, Form("plane %02d: nClusters = %d\n", iPlane, (fMFT->GetRecPointsList(iPlane))->GetEntries())); fMFTClusterArray[iPlane] = fMFT->GetRecPointsList(iPlane); } SeparateFrontBackClusters(); @@ -357,13 +450,19 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { // load next muon track from the reconstructed event + if (fCountRealTracksAnalyzed>fMaxNTracksToBeAnalyzed) return kFALSE; + if (!fCountRealTracksAnalyzed) if (!LoadNextEvent()) return kFALSE; + if (fCountRealTracksAnalyzed==fMaxNTracksToBeAnalyzed) { + fCountRealTracksAnalyzed++; + if (!LoadNextEvent()) return kFALSE; + } while ( !(fMuonTrackReco = static_cast(fNextTrack->Next())) ) if (!LoadNextEvent()) return kFALSE; - printf("**************************************************************************************\n"); - printf("*************************** MUON TRACK %3d ***************************************\n", fCountRealTracksAnalyzedOfEvent); - printf("**************************************************************************************\n"); + AliDebug(1, "**************************************************************************************\n"); + AliDebug(1, Form("*************************** MUON TRACK %3d ***************************************\n", fCountRealTracksAnalyzedOfEvent)); + AliDebug(1, "**************************************************************************************\n"); fCountRealTracksAnalyzed++; @@ -392,33 +491,52 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { // ------------------------------------- ...done! - if (fMuonTrackReco->GetMCLabel()>=0) fCountRealTracksWithRefMC++; - fLabelMC = fMuonTrackReco->GetMCLabel(); + Int_t motherPdg=0; + if (fLabelMC>=0) { + fCountRealTracksWithRefMC++; + if (fStack->Particle(fLabelMC)->GetFirstMother() != -1) { + motherPdg = fStack->Particle(fStack->Particle(fLabelMC)->GetFirstMother())->GetPdgCode(); + } + } + CheckCurrentMuonTrackable(); - PrintParticleHistory(); - if (fMuonTrackReco->GetMatchTrigger()) fCountRealTracksWithRefMC_andTrigger++; // the track we are going to build, starting from fMuonTrackReco and adding the MFT clusters AliMuonForwardTrack *track = new ((*fCandidateTracks)[0]) AliMuonForwardTrack(); track -> SetMUONTrack(fMuonTrackReco); - if (fLabelMC>=0) track -> SetMCTrackRef(fStack->Particle(fLabelMC)); + if (fLabelMC>=0 && fStack->Particle(fLabelMC)) track->SetMCTrackRef(fStack->Particle(fLabelMC)); track -> SetMCLabel(fMuonTrackReco->GetMCLabel()); track -> SetMatchTrigger(fMuonTrackReco->GetMatchTrigger()); - - // track parameters at the first tracking station in the Muon Spectrometer - AliMUONTrackParam *param = (AliMUONTrackParam*) (fMuonTrackReco->GetTrackParamAtCluster()->First()); - Double_t ptSpectrometer = TMath::Sqrt(param->Px()*param->Px() + param->Py()*param->Py()); - Double_t thetaSpectrometer = TMath::ATan(ptSpectrometer/param->Pz()); - if (thetaSpectrometer<0.) thetaSpectrometer += TMath::Pi(); - Double_t etaSpectrometer = -1.*TMath::Log(TMath::Tan(0.5*thetaSpectrometer)); - fHistPtSpectrometer -> Fill(ptSpectrometer); - - // if the transverse momentum in the Muon Spectrometer is smaller than the threshold, skip to the next track - if (ptSpectrometer < fLowPtCut) return 3; + + // track origin + Double_t xVtx=-999., yVtx=-999., zVtx=-999999.; + if (track->GetMCTrackRef()) { + xVtx = track->GetMCTrackRef()->Vx(); + yVtx = track->GetMCTrackRef()->Vy(); + zVtx = track->GetMCTrackRef()->Vz(); + } + + // track kinematics + Double_t pt=-999., theta=-999., eta=-999.; + if (track->GetMCTrackRef()) { + pt = track->GetMCTrackRef()->Pt(); + theta = track->GetMCTrackRef()->Theta(); + if (theta<0.) theta += TMath::Pi(); + eta = track->GetMCTrackRef()->Eta(); + } + else { + AliMUONTrackParam *param = (AliMUONTrackParam*) (fMuonTrackReco->GetTrackParamAtCluster()->First()); + pt = TMath::Sqrt(param->Px()*param->Px() + param->Py()*param->Py()); + theta = TMath::ATan(pt/param->Pz()); + if (theta<0.) theta += TMath::Pi(); + eta = -1.*TMath::Log(TMath::Tan(0.5*theta)); + } + // if the transverse momentum is smaller than the threshold, skip to the next track + if (pt < fLowPtCut) return 3; // track parameters linearly extrapolated from the first tracking station to the end of the absorber AliMUONTrackParam trackParamEndOfAbsorber(*((AliMUONTrackParam*)(fMuonTrackReco->GetTrackParamAtCluster()->First()))); @@ -428,8 +546,7 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { Double_t rAbsorber = TMath::Sqrt(xEndOfAbsorber*xEndOfAbsorber + yEndOfAbsorber*yEndOfAbsorber); fHistRadiusEndOfAbsorber -> Fill(rAbsorber); - // if the radial distance of the track at the end of the absorber is smaller than a radius corresponding to - // 3 degrees as seen from the interaction point, skip to the next track + // if the radial distance of the track at the end of the absorber is smaller than a given radius, skip to the next track if (rAbsorber < fRAbsorberCut) return 4; //------------------------- NOW THE CYCLE OVER THE MFT PLANES STARTS --------------------------------------- @@ -454,13 +571,16 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { } } fCandidateTracks->Compress(); - if (fIsCurrentMuonTrackable) fHistNTracksAfterExtrapolation[iPlane] -> Fill(fCandidateTracks->GetEntriesFast()); + if (fIsCurrentMuonTrackable) { + // fOutputQAFile->cd(); + fHistNTracksAfterExtrapolation[iPlane] -> Fill(fCandidateTracks->GetEntriesFast()); + } } - else if (fMatchingMode==kIdealMatching) { + else if (fMatchingMode==kIdealMatching && fIsCurrentMuonTrackable) { fCurrentTrack = (AliMuonForwardTrack*) fCandidateTracks->UncheckedAt(0); - printf("plane %02d: fCandidateTracks->GetEntriesFast() = %d fCandidateTracks->UncheckedAt(0) = %p fCurrentTrack = %p\n", - iPlane, fCandidateTracks->GetEntriesFast(), fCandidateTracks->UncheckedAt(0), fCurrentTrack); + AliDebug(2, Form("plane %02d: fCandidateTracks->GetEntriesFast() = %d fCandidateTracks->UncheckedAt(0) = %p fCurrentTrack = %p\n", + iPlane, fCandidateTracks->GetEntriesFast(), fCandidateTracks->UncheckedAt(0), fCurrentTrack)); AttachGoodClusterInPlane(iPlane); } @@ -468,19 +588,53 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { // -------------------------- END OF THE CYCLE OVER THE MFT PLANES -------------------------------------------- + AliDebug(1, "Finished cycle over planes"); + + Double_t momentum = pt * TMath::CosH(eta); + fTxtTrackMomentum = new TLatex(0.10, 0.70, Form("P_{spectro} = %3.1f GeV/c", momentum)); + if (fMatchingMode==kIdealMatching) { - printf("Adding track to output tree...\n"); + AliDebug(1, "Adding track to output tree...\n"); + fFinalBestCandidate = (AliMuonForwardTrack*) fCandidateTracks->UncheckedAt(0); AliMuonForwardTrack *newTrack = (AliMuonForwardTrack*) fCandidateTracks->UncheckedAt(0); - new ((*fMuonForwardTracks)[fMuonForwardTracks->GetEntries()]) AliMuonForwardTrack(*newTrack); // AU - printf("...track added!\n"); + new ((*fMuonForwardTracks)[fMuonForwardTracks->GetEntries()]) AliMuonForwardTrack(*newTrack); + AliDebug(1, "...track added!\n"); fCandidateTracks->Clear(); fCountRealTracksAnalyzedOfEvent++; + fCountRealTracksAnalyzedWithFinalCandidates++; + PrintParticleHistory(); + FillPlanesWithTrackHistory(); + + Double_t chi2AtPlane[fNMaxPlanes] = {0}; + Int_t nGoodClusters = 0; + Int_t nMFTClusters = fFinalBestCandidate->GetNMFTClusters(); +// Int_t nMUONClusters = fFinalBestCandidate->GetNMUONClusters(); + Int_t plane = 0; + for (Int_t iCluster=0; iClusterPlaneExists(plane)) plane++; + AliMFTCluster *localCluster = fFinalBestCandidate->GetMFTCluster(iCluster); + chi2AtPlane[plane] = localCluster->GetLocalChi2(); + if (IsCorrectMatch(localCluster)) nGoodClusters++; +// Int_t nClustersGlobalTrack = nMUONClusters + (nMFTClusters-iCluster); // Muon Spectrometer clusters + clusters in the Vertex Telescope +// Int_t ndfGlobalTrack = GetNDF(nClustersGlobalTrack); +// chi2AtPlane[plane] /= Double_t(ndfGlobalTrack); + plane++; + } + for (Int_t iPlane=0; iPlaneGetEntriesFast(); + AliDebug(1, Form("nFinalTracks = %d", nFinalTracks)); if (nFinalTracks) fCountRealTracksAnalyzedWithFinalCandidates++; @@ -488,8 +642,12 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { Bool_t bestCandidateExists = kFALSE; Int_t nGoodClustersBestCandidate = 0; Int_t idBestCandidate = 0; - Double_t chi2HistoryForBestCandidate[fMaxNPlanesMFT]={0}; // chi2 on each plane, for the best candidate - for (Int_t iPlane=0; iPlane GetEntries(); + } fTxtFinalCandidates = new TLatex(0.10, 0.78, Form("N_{FinalCandidates} = %d", nFinalTracks)); @@ -500,61 +658,66 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { AliMuonForwardTrack *finalTrack = (AliMuonForwardTrack*) fCandidateTracks->UncheckedAt(iTrack); - Double_t chi2AtPlane[fMaxNPlanesMFT]={0}; + Double_t chi2AtPlane[fNMaxPlanes] = {0}; Int_t nGoodClusters = 0; Int_t nMFTClusters = finalTrack->GetNMFTClusters(); - Int_t nMUONClusters = finalTrack->GetNMUONClusters(); +// Int_t nMUONClusters = finalTrack->GetNMUONClusters(); Int_t plane = 0; for (Int_t iCluster=0; iClusterPlaneExists(plane)) plane++; AliMFTCluster *localCluster = finalTrack->GetMFTCluster(iCluster); - chi2AtPlane[plane++] = localCluster->GetTrackChi2(); + chi2AtPlane[plane] = localCluster->GetLocalChi2(); if (IsCorrectMatch(localCluster)) nGoodClusters++; - Int_t nClustersGlobalTrack = nMUONClusters + (nMFTClusters-iCluster); // Muon Spectrometer clusters + clusters in the Vertex Telescope - Int_t ndfGlobalTrack = GetNDF(nClustersGlobalTrack); - chi2AtPlane[plane] /= Double_t(ndfGlobalTrack); +// Int_t nClustersGlobalTrack = nMUONClusters + (nMFTClusters-iCluster); // Muon Spectrometer clusters + clusters in the Vertex Telescope +// Int_t ndfGlobalTrack = GetNDF(nClustersGlobalTrack); +// chi2AtPlane[plane] /= Double_t(ndfGlobalTrack); + plane++; } - if (fIsCurrentMuonTrackable) fHistNGoodClustersForFinalTracks -> Fill(nGoodClusters); - - fNtuFinalCandidates1 -> Fill(Double_t(fRun), - Double_t(fEv), - Double_t(fCountRealTracksAnalyzedOfEvent), - Double_t(nFinalTracks), - Double_t(nClustersMC), - Double_t(nGoodClusters), - ptSpectrometer, - thetaSpectrometer, - etaSpectrometer); - - fNtuFinalCandidates2 -> Fill(chi2AtPlane[0], - chi2AtPlane[1], - chi2AtPlane[2], - chi2AtPlane[3], - chi2AtPlane[4], - chi2AtPlane[5], - chi2AtPlane[6], - chi2AtPlane[7], - chi2AtPlane[8], - chi2AtPlane[9], - chi2AtPlane[10], - chi2AtPlane[11], - chi2AtPlane[12], - chi2AtPlane[13], - chi2AtPlane[14]); + if (fIsCurrentMuonTrackable) { + // fOutputQAFile->cd(); + fHistNGoodClustersForFinalTracks -> Fill(nGoodClusters); + } + + // fOutputQAFile->cd(); + + Float_t finalCandidatesInfo[] = {Double_t(fRun), + Double_t(fEv), + Double_t(fCountRealTracksAnalyzedOfEvent), + Double_t(nFinalTracks), + Double_t(fLabelMC>=0), + xVtx, yVtx, zVtx, + motherPdg, + Double_t(fMuonTrackReco->GetMatchTrigger()), + Double_t(nClustersMC), + Double_t(nGoodClusters), + pt, theta, eta, + chi2AtPlane[0], + chi2AtPlane[1], + chi2AtPlane[2], + chi2AtPlane[3], + chi2AtPlane[4], + chi2AtPlane[5], + chi2AtPlane[6], + chi2AtPlane[7], + chi2AtPlane[8]}; + fNtuFinalCandidates -> Fill(finalCandidatesInfo); + // now comparing the tracks with various criteria, in order to find the best one Double_t theVariable = 0.; +// theVariable = chi2AtPlane[0]; for (Int_t iCluster=0; iClusterUncheckedAt(idBestCandidate)); + fFinalBestCandidate = (AliMuonForwardTrack*) fCandidateTracks->UncheckedAt(idBestCandidate); + AliInfo(Form("fFinalBestCandidate->GetNMFTClusters() = %d\n", fFinalBestCandidate->GetNMFTClusters())); + PrintParticleHistory(); + FillPlanesWithTrackHistory(); AliMuonForwardTrack *newTrack = (AliMuonForwardTrack*) fCandidateTracks->UncheckedAt(idBestCandidate); - new ((*fMuonForwardTracks)[fMuonForwardTracks->GetEntries()]) AliMuonForwardTrack(*newTrack); // AU - fNtuFinalBestCandidates1 -> Fill(Double_t(fRun), - Double_t(fEv), - Double_t(fCountRealTracksAnalyzedOfEvent), - Double_t(nFinalTracks), - Double_t(nClustersMC), - Double_t(nGoodClustersBestCandidate), - ptSpectrometer, - thetaSpectrometer, - etaSpectrometer); - - fNtuFinalBestCandidates2 -> Fill(chi2HistoryForBestCandidate[0], - chi2HistoryForBestCandidate[1], - chi2HistoryForBestCandidate[2], - chi2HistoryForBestCandidate[3], - chi2HistoryForBestCandidate[4], - chi2HistoryForBestCandidate[5], - chi2HistoryForBestCandidate[6], - chi2HistoryForBestCandidate[7], - chi2HistoryForBestCandidate[8], - chi2HistoryForBestCandidate[9], - chi2HistoryForBestCandidate[10], - chi2HistoryForBestCandidate[11], - chi2HistoryForBestCandidate[12], - chi2HistoryForBestCandidate[13], - chi2HistoryForBestCandidate[14]); - + newTrack -> SetNWrongClustersMC(newTrack->GetNMFTClusters() - nGoodClustersBestCandidate); + new ((*fMuonForwardTracks)[fMuonForwardTracks->GetEntries()]) AliMuonForwardTrack(*newTrack); } + + // fOutputQAFile->cd(); + + Float_t finalBestCandidatesInfo[] = {Double_t(fRun), + Double_t(fEv), + Double_t(fCountRealTracksAnalyzedOfEvent), + Double_t(nFinalTracks), + Double_t(fLabelMC>=0), + xVtx, yVtx, zVtx, + motherPdg, + Double_t(fMuonTrackReco->GetMatchTrigger()), + Double_t(nClustersMC), + Double_t(nGoodClustersBestCandidate), + pt, theta, eta, + chi2HistoryForBestCandidate[0], + chi2HistoryForBestCandidate[1], + chi2HistoryForBestCandidate[2], + chi2HistoryForBestCandidate[3], + chi2HistoryForBestCandidate[4], + chi2HistoryForBestCandidate[5], + chi2HistoryForBestCandidate[6], + chi2HistoryForBestCandidate[7], + chi2HistoryForBestCandidate[8], + nClustersPerPlane[0], + nClustersPerPlane[1], + nClustersPerPlane[2], + nClustersPerPlane[3], + nClustersPerPlane[4], + nClustersPerPlane[5], + nClustersPerPlane[6], + nClustersPerPlane[7], + nClustersPerPlane[8]}; + + fNtuFinalBestCandidates -> Fill(finalBestCandidatesInfo); if (fDrawOption && bestCandidateExists) { - fTxtTrackGoodClusters = new TLatex(0.20, 0.59, Form("N_{GoodClusters} = %d", nGoodClustersBestCandidate)); + fTxtTrackGoodClusters = new TLatex(0.20, 0.51, Form("N_{GoodClusters} = %d", nGoodClustersBestCandidate)); DrawPlanes(); } - if (fIsCurrentMuonTrackable) { - if (nGoodClustersBestCandidate==5) fHistPtMuonTrackWithGoodMatch -> Fill(ptSpectrometer); - else fHistPtMuonTrackWithBadMatch -> Fill(ptSpectrometer); - } - // ------------------------------------------------------------------------------------------- fCandidateTracks->Clear(); + fFinalBestCandidate = NULL; fCountRealTracksAnalyzedOfEvent++; @@ -624,7 +795,7 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() { void AliMuonForwardTrackFinder::FindClusterInPlane(Int_t planeId) { - printf(">>>> executing AliMuonForwardTrackFinder::FindClusterInPlane(%d)\n", planeId); + AliDebug(2, Form(">>>> executing AliMuonForwardTrackFinder::FindClusterInPlane(%d)\n", planeId)); // !!!!!!!!! coordinates and errors on the interaction vertex should be taken from the event itself (ITS) if available @@ -639,10 +810,13 @@ void AliMuonForwardTrackFinder::FindClusterInPlane(Int_t planeId) { currentParamBack = (*((AliMUONTrackParam*)(fMuonTrackReco->GetTrackParamAtCluster()->First()))); currentParamForResearchFront = currentParamFront; currentParamForResearchBack = currentParamBack; - AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(¤tParamFront, 0.); - AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(¤tParamBack, 0.); - AliMUONTrackExtrap::ExtrapToVertex(¤tParamForResearchFront, 0., 0., gRandom->Gaus(0,fGaussianBlurZVert), fExtrapOriginTransvError, fExtrapOriginTransvError); - AliMUONTrackExtrap::ExtrapToVertex(¤tParamForResearchBack, 0., 0., gRandom->Gaus(0,fGaussianBlurZVert), fExtrapOriginTransvError, fExtrapOriginTransvError); + Double_t xExtrap = gRandom->Gaus(0,fVertexErrorX); + Double_t yExtrap = gRandom->Gaus(0,fVertexErrorY); + Double_t zExtrap = gRandom->Gaus(0,fVertexErrorZ); + AliMUONTrackExtrap::ExtrapToVertex(¤tParamFront, xExtrap, yExtrap, zExtrap, fVertexErrorX, fVertexErrorY); + AliMUONTrackExtrap::ExtrapToVertex(¤tParamBack, xExtrap, yExtrap, zExtrap, fVertexErrorX, fVertexErrorY); + AliMUONTrackExtrap::ExtrapToVertex(¤tParamForResearchFront, xExtrap, yExtrap, zExtrap, fVertexErrorX, fVertexErrorY); + AliMUONTrackExtrap::ExtrapToVertex(¤tParamForResearchBack, xExtrap, yExtrap, zExtrap, fVertexErrorX, fVertexErrorY); } else { // MFT planes others than the last one: mult. scattering correction because of the upstream MFT planes is performed currentParamFront = (*((AliMUONTrackParam*)(fCurrentTrack->GetTrackParamAtCluster()->First()))); @@ -650,13 +824,13 @@ void AliMuonForwardTrackFinder::FindClusterInPlane(Int_t planeId) { currentParamForResearchFront = currentParamFront; currentParamForResearchBack = currentParamBack; AliMUONTrackExtrap::AddMCSEffect(¤tParamFront, (fSegmentation->GetPlane(planeId+1)->GetEquivalentSilicon()+ - fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeFront())/radLengthSi,-1.); + fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeFront())/fRadLengthSi,-1.); AliMUONTrackExtrap::AddMCSEffect(¤tParamForResearchFront,(fSegmentation->GetPlane(planeId+1)->GetEquivalentSilicon()+ - fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeFront())/radLengthSi,-1.); + fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeFront())/fRadLengthSi,-1.); AliMUONTrackExtrap::AddMCSEffect(¤tParamBack, (fSegmentation->GetPlane(planeId+1)->GetEquivalentSilicon()+ - fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeBack())/radLengthSi,-1.); + fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeBack())/fRadLengthSi,-1.); AliMUONTrackExtrap::AddMCSEffect(¤tParamForResearchBack, (fSegmentation->GetPlane(planeId+1)->GetEquivalentSilicon()+ - fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeBack())/radLengthSi,-1.); + fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeBack())/fRadLengthSi,-1.); } // for all planes: extrapolation to the Z of the plane AliMUONTrackExtrap::ExtrapToZCov(¤tParamFront, -1.*fSegmentation->GetPlane(planeId)->GetZCenterActiveFront()); @@ -681,7 +855,10 @@ void AliMuonForwardTrackFinder::FindClusterInPlane(Int_t planeId) { if (planeId==fNPlanesMFT-1 && 0.5*(researchRadiusFront+researchRadiusBack) Fill(corrFact*0.5*(researchRadiusFront+researchRadiusBack)); + if (fIsCurrentMuonTrackable) { + // fOutputQAFile->cd(); + fHistResearchRadius[planeId] -> Fill(0.5*(researchRadiusFront+researchRadiusBack)); + } Double_t position_X_Front = currentParamForResearchFront.GetNonBendingCoor(); Double_t position_Y_Front = currentParamForResearchFront.GetBendingCoor(); @@ -697,7 +874,7 @@ void AliMuonForwardTrackFinder::FindClusterInPlane(Int_t planeId) { // Analyizing the clusters: FRONT ACTIVE ELEMENTS Int_t nClustersFront = fMFTClusterArrayFront[planeId]->GetEntries(); - printf("There are %3d clusters in plane %02d FRONT\n", nClustersFront, planeId); + AliDebug(2, Form("There are %3d clusters in plane %02d FRONT\n", nClustersFront, planeId)); for (Int_t iCluster=0; iClustercd(); if (IsCorrectMatch(cluster)) fHistChi2Cluster_GoodCluster[planeId]->Fill(chi2/2.); // chi2/ndf else fHistChi2Cluster_BadCluster[planeId] ->Fill(chi2/2.); // chi2/ndf } if (isGoodChi2) { - printf("accepting cluster: chi2=%f (cut = %f)\n", chi2, chi2cut); + AliDebug(3, Form("accepting cluster: chi2=%f (cut = %f)\n", chi2, chi2cut)); AliMuonForwardTrack *newTrack = new ((*fCandidateTracks)[fCandidateTracks->GetEntriesFast()]) AliMuonForwardTrack(*fCurrentTrack); newTrack->AddTrackParamAtMFTCluster(currentParamFront, *cluster); // creating new track param and attaching the cluster + AliDebug(1, Form("After plane %02d: newTrack->GetNMFTClusters() = %d (fCurrentTrack->GetNMFTClusters() = %d)", + planeId, newTrack->GetNMFTClusters(), fCurrentTrack->GetNMFTClusters())); newTrack->SetPlaneExists(planeId); - printf("current muon is trackable: %d\n", fIsCurrentMuonTrackable); + AliDebug(2, Form("current muon is trackable: %d\n", fIsCurrentMuonTrackable)); if (fIsCurrentMuonTrackable) { Double_t newGlobalChi2 = ((AliMUONTrackParam*) newTrack->GetTrackParamAtCluster()->First())->GetTrackChi2(); - printf("new chi2 = %f (= %f)\n", newGlobalChi2, newTrack->GetMFTCluster(0)->GetTrackChi2()); + AliDebug(2, Form("new chi2 = %f (= %f)\n", newGlobalChi2, newTrack->GetMFTCluster(0)->GetTrackChi2())); Int_t nClustersGlobalTrack = newTrack->GetNMUONClusters() + newTrack->GetNMFTClusters(); // Muon Spectrometer clusters + clusters in the Vertex Telescope Int_t ndfGlobalTrack = GetNDF(nClustersGlobalTrack); - if (IsCorrectMatch(cluster)) fHistChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[planeId]->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); - else fHistChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[planeId] ->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); + // fOutputQAFile->cd(); + if (IsCorrectMatch(cluster)) fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[planeId]->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); + else fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[planeId] ->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); } - fGrMFTPlane[planeId][kClustersGoodChi2] -> SetPoint(fGrMFTPlane[planeId][kClustersGoodChi2]->GetN(), cluster->GetX(), cluster->GetY()); + fGrMFTPlane[kClustersGoodChi2][planeId] -> SetPoint(fGrMFTPlane[kClustersGoodChi2][planeId]->GetN(), cluster->GetX(), cluster->GetY()); } - else printf("discarding cluster: chi2=%f (cut = %f)\n", chi2, chi2cut); + else AliDebug(3, Form("discarding cluster: chi2=%f (cut = %f)\n", chi2, chi2cut)); } // Analyizing the clusters: BACK ACTIVE ELEMENTS Int_t nClustersBack = fMFTClusterArrayBack[planeId]->GetEntries(); - printf("There are %3d clusters in plane %02d BACK\n", nClustersBack, planeId); + AliDebug(2, Form("There are %3d clusters in plane %02d BACK\n", nClustersBack, planeId)); for (Int_t iCluster=0; iClustercd(); if (IsCorrectMatch(cluster)) fHistChi2Cluster_GoodCluster[planeId]->Fill(chi2/2.); // chi2/ndf else fHistChi2Cluster_BadCluster[planeId] ->Fill(chi2/2.); // chi2/ndf } if (isGoodChi2) { - printf("accepting cluster: chi2=%f (cut = %f)\n", chi2, chi2cut); + AliDebug(3,Form("accepting cluster: chi2=%f (cut = %f)\n", chi2, chi2cut)); AliMuonForwardTrack *newTrack = new ((*fCandidateTracks)[fCandidateTracks->GetEntriesFast()]) AliMuonForwardTrack(*fCurrentTrack); newTrack->AddTrackParamAtMFTCluster(currentParamBack, *cluster); // creating new track param and attaching the cluster + AliDebug(1, Form("After plane %02d: newTrack->GetNMFTClusters() = %d (fCurrentTrack->GetNMFTClusters() = %d)", + planeId, newTrack->GetNMFTClusters(), fCurrentTrack->GetNMFTClusters())); newTrack->SetPlaneExists(planeId); - printf("current muon is trackable: %d\n", fIsCurrentMuonTrackable); + AliDebug(2, Form("current muon is trackable: %d\n", fIsCurrentMuonTrackable)); if (fIsCurrentMuonTrackable) { Double_t newGlobalChi2 = ((AliMUONTrackParam*) newTrack->GetTrackParamAtCluster()->First())->GetTrackChi2(); - printf("new chi2 = %f (= %f)\n", newGlobalChi2, newTrack->GetMFTCluster(0)->GetTrackChi2()); + AliDebug(2, Form("new chi2 = %f (= %f)\n", newGlobalChi2, newTrack->GetMFTCluster(0)->GetTrackChi2())); Int_t nClustersGlobalTrack = newTrack->GetNMUONClusters() + newTrack->GetNMFTClusters(); // Muon Spectrometer clusters + clusters in the Vertex Telescope Int_t ndfGlobalTrack = GetNDF(nClustersGlobalTrack); - if (IsCorrectMatch(cluster)) fHistChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[planeId]->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); - else fHistChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[planeId] ->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); + // fOutputQAFile->cd(); + if (IsCorrectMatch(cluster)) fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[planeId]->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); + else fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[planeId] ->Fill(newGlobalChi2/Double_t(ndfGlobalTrack)); } - fGrMFTPlane[planeId][kClustersGoodChi2] -> SetPoint(fGrMFTPlane[planeId][kClustersGoodChi2]->GetN(), cluster->GetX(), cluster->GetY()); + fGrMFTPlane[kClustersGoodChi2][planeId] -> SetPoint(fGrMFTPlane[kClustersGoodChi2][planeId]->GetN(), cluster->GetX(), cluster->GetY()); } - else printf("discarding cluster: chi2=%f (cut = %f)\n", chi2, chi2cut); + else AliDebug(3,Form("discarding cluster: chi2=%f (cut = %f)\n", chi2, chi2cut)); } @@ -796,6 +981,7 @@ void AliMuonForwardTrackFinder::FindClusterInPlane(Int_t planeId) { if (planeId == fNPlanesMFT-1) { if (fIsCurrentMuonTrackable && fDistanceFromGoodClusterAndTrackAtLastPlane>0.) { + // fOutputQAFile->cd(); fHistDistanceGoodClusterFromTrackMinusDistanceBestClusterFromTrackAtLastPlane -> Fill(TMath::Abs(fDistanceFromBestClusterAndTrackAtLastPlane- fDistanceFromGoodClusterAndTrackAtLastPlane)); fHistDistanceGoodClusterFromTrackAtLastPlane -> Fill(fDistanceFromGoodClusterAndTrackAtLastPlane); @@ -808,7 +994,7 @@ void AliMuonForwardTrackFinder::FindClusterInPlane(Int_t planeId) { void AliMuonForwardTrackFinder::AttachGoodClusterInPlane(Int_t planeId) { - printf(">>>> executing AliMuonForwardTrackFinder::AttachGoodClusterInPlane(%d)\n", planeId); + AliDebug(1, Form(">>>> executing AliMuonForwardTrackFinder::AttachGoodClusterInPlane(%d)\n", planeId)); AliMUONTrackParam currentParamFront, currentParamBack; @@ -819,13 +1005,13 @@ void AliMuonForwardTrackFinder::AttachGoodClusterInPlane(Int_t planeId) { AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(¤tParamBack, 0.); } else { // MFT planes others than the last one: mult. scattering correction because of the upstream MFT planes is performed - printf("fCurrentTrack = %p\n", fCurrentTrack); + AliDebug(2, Form("fCurrentTrack = %p\n", fCurrentTrack)); currentParamFront = (*((AliMUONTrackParam*)(fCurrentTrack->GetTrackParamAtCluster()->First()))); currentParamBack = (*((AliMUONTrackParam*)(fCurrentTrack->GetTrackParamAtCluster()->First()))); AliMUONTrackExtrap::AddMCSEffect(¤tParamFront, (fSegmentation->GetPlane(planeId+1)->GetEquivalentSilicon()+ - fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeFront())/radLengthSi,-1.); + fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeFront())/fRadLengthSi,-1.); AliMUONTrackExtrap::AddMCSEffect(¤tParamBack, (fSegmentation->GetPlane(planeId+1)->GetEquivalentSilicon()+ - fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeBack())/radLengthSi,-1.); + fSegmentation->GetPlane(planeId)->GetEquivalentSiliconBeforeBack())/fRadLengthSi,-1.); } // for all planes: linear extrapolation to the Z of the plane AliMUONTrackExtrap::ExtrapToZCov(¤tParamFront, -1.*fSegmentation->GetPlane(planeId)->GetZCenterActiveFront()); @@ -837,10 +1023,10 @@ void AliMuonForwardTrackFinder::AttachGoodClusterInPlane(Int_t planeId) { Int_t nClustersFront = fMFTClusterArrayFront[planeId]->GetEntries(); - printf("nClustersFront = %d\n", nClustersFront); + AliDebug(1, Form("nClustersFront = %d\n", nClustersFront)); for (Int_t iCluster=0; iClusterUncheckedAt(iCluster); - printf("checking cluster %02d of %02d: cluter=%p, fCurrentTrack=%p\n", iCluster, nClustersFront, cluster, fCurrentTrack); + AliDebug(2, Form("checking cluster %02d of %02d: cluter=%p, fCurrentTrack=%p\n", iCluster, nClustersFront, cluster, fCurrentTrack)); if (IsCorrectMatch(cluster)) { fCurrentTrack->AddTrackParamAtMFTCluster(currentParamFront, *cluster); // creating new track param and attaching the cluster fCurrentTrack->SetPlaneExists(planeId); @@ -855,10 +1041,10 @@ void AliMuonForwardTrackFinder::AttachGoodClusterInPlane(Int_t planeId) { Int_t nClustersBack = fMFTClusterArrayBack[planeId]->GetEntries(); - printf("nClustersBack = %d\n", nClustersBack); + AliDebug(1, Form("nClustersBack = %d\n", nClustersBack)); for (Int_t iCluster=0; iClusterUncheckedAt(iCluster); - printf("checking cluster %02d of %02d: cluter=%p, fCurrentTrack=%p\n", iCluster, nClustersBack, cluster, fCurrentTrack); + AliDebug(2,Form("checking cluster %02d of %02d: cluter=%p, fCurrentTrack=%p\n", iCluster, nClustersBack, cluster, fCurrentTrack)); if (IsCorrectMatch(cluster)) { fCurrentTrack->AddTrackParamAtMFTCluster(currentParamBack, *cluster); // creating new track param and attaching the cluster fCurrentTrack->SetPlaneExists(planeId); @@ -894,30 +1080,25 @@ void AliMuonForwardTrackFinder::CheckCurrentMuonTrackable() { //========================================================================================================================================== -void AliMuonForwardTrackFinder::FillPlanesWithTrackHistory(AliMuonForwardTrack *track) { +void AliMuonForwardTrackFinder::FillPlanesWithTrackHistory() { - // recover track parameters on each planes and look for the corresponding clusters + // Fill planes with the clusters + Int_t cluster = 0; + AliDebug(2, Form("fFinalBestCandidate->GetNMFTClusters() = %d\n", fFinalBestCandidate->GetNMFTClusters())); for (Int_t iPlane=0; iPlaneGetMFTCluster(iPlane); - - fGrMFTPlane[iPlane][kClusterOfTrack] -> SetPoint(fGrMFTPlane[iPlane][kClusterOfTrack]->GetN(), trackCluster->GetX(), trackCluster->GetY()); - + if (fFinalBestCandidate->PlaneExists(iPlane)) { + AliMFTCluster *trackCluster = fFinalBestCandidate->GetMFTCluster(cluster++); + fGrMFTPlane[kClusterOfTrack][iPlane] -> SetPoint(fGrMFTPlane[kClusterOfTrack][iPlane]->GetN(), trackCluster->GetX(), trackCluster->GetY()); + } Int_t nClusters = fMFTClusterArray[iPlane]->GetEntriesFast(); - for (Int_t iCluster=0; iClusterUncheckedAt(iCluster); - - fGrMFTPlane[iPlane][kAllClusters] -> SetPoint(fGrMFTPlane[iPlane][kAllClusters]->GetN(), cluster->GetX(), cluster->GetY()); - - if (IsCorrectMatch(cluster)) { - fGrMFTPlane[iPlane][kClusterCorrectMC] -> SetPoint(fGrMFTPlane[iPlane][kClusterCorrectMC]->GetN(), cluster->GetX(), cluster->GetY()); + AliMFTCluster *myCluster = (AliMFTCluster*) fMFTClusterArray[iPlane]->UncheckedAt(iCluster); + fGrMFTPlane[kAllClusters][iPlane] -> SetPoint(fGrMFTPlane[kAllClusters][iPlane]->GetN(), myCluster->GetX(), myCluster->GetY()); + if (IsCorrectMatch(myCluster)) { + fGrMFTPlane[kClusterCorrectMC][iPlane] -> SetPoint(fGrMFTPlane[kClusterCorrectMC][iPlane]->GetN(), myCluster->GetX(), myCluster->GetY()); } - } - } } @@ -937,7 +1118,7 @@ Bool_t AliMuonForwardTrackFinder::IsCorrectMatch(AliMFTCluster *cluster) { } } - printf("returning %d\n", result); + AliDebug(2,Form("returning %d\n", result)); return result; @@ -954,13 +1135,13 @@ Double_t AliMuonForwardTrackFinder::TryOneCluster(const AliMUONTrackParam &track // Set differences between trackParam and cluster in the bending and non bending directions Double_t dX = cluster->GetX() - trackParam.GetNonBendingCoor(); Double_t dY = cluster->GetY() - trackParam.GetBendingCoor(); - printf("dX = %f, dY = %f\n", dX, dY); + AliDebug(3,Form("dX = %f, dY = %f\n", dX, dY)); // Calculate errors and covariances const TMatrixD& kParamCov = trackParam.GetCovariances(); Double_t sigmaX2 = kParamCov(0,0) + cluster->GetErrX2(); Double_t sigmaY2 = kParamCov(2,2) + cluster->GetErrY2(); - printf("dX2 = %f, dY2 = %f\n", sigmaX2, sigmaY2); + AliDebug(3, Form("dX2 = %f, dY2 = %f\n", sigmaX2, sigmaY2)); Double_t covXY = kParamCov(0,2); Double_t det = sigmaX2 * sigmaY2 - covXY * covXY; @@ -1004,14 +1185,9 @@ Int_t AliMuonForwardTrackFinder::GetNDF(Int_t nClusters) { //============================================================================================================================================ void AliMuonForwardTrackFinder::BookHistos() { - - const Int_t nMaxNewTracks[] = {150, 200, 250, 600, 1000}; - const Double_t radiusPlane[] = {0.001, 0.010, 0.100, 5.0, 5.0}; - - fHistPtSpectrometer = new TH1D("hPtSpectrometer", "p_{T} as given by the Muon Spectrometer", 200, 0, 20.); - fHistPtMuonTrackWithGoodMatch = new TH1D("fHistPtMuonTrackWithGoodMatch", "p_{T} of muon track with good match", 200, 0, 20.); - fHistPtMuonTrackWithBadMatch = new TH1D("fHistPtMuonTrackWithBadMatch", "p_{T} of muon track with bad match", 200, 0, 20.); + const Int_t nMaxNewTracks[] = {150, 200, 250, 600, 1000}; + const Double_t radiusPlane[] = {0.010, 0.010, 0.050, 0.5, 1.5}; fHistRadiusEndOfAbsorber = new TH1D("hRadiusEndOfAbsorber", "Track radial distance at the end of the absorber", 1000, 0, 100.); @@ -1042,21 +1218,18 @@ void AliMuonForwardTrackFinder::BookHistos() { Form("#chi^{2}_{clust} for Bad clusters in MFT plane %02d", iPlane), 100, 0., 15.); - fHistChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] = new TH1D(Form("fHistChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons_pl%02d", iPlane), - Form("#chi^{2}/ndf at plane %d for GOOD candidates of trackable muons",iPlane), - 100, 0., 15.); - - fHistChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] = new TH1D(Form("fHistChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons_pl%02d", iPlane), - Form("#chi^{2}/ndf at plane %d for BAD candidates of trackable muons",iPlane), - 100, 0., 15.); - + fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] = new TH1D(Form("fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons_pl%02d", iPlane), + Form("#chi^{2}/ndf at plane %d for GOOD candidates of trackable muons",iPlane), + 100, 0., 15.); + + fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] = new TH1D(Form("fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons_pl%02d", iPlane), + Form("#chi^{2}/ndf at plane %d for BAD candidates of trackable muons",iPlane), + 100, 0., 15.); + } //------------------------------------------ - fHistPtSpectrometer -> Sumw2(); - fHistPtMuonTrackWithGoodMatch -> Sumw2(); - fHistPtMuonTrackWithBadMatch -> Sumw2(); fHistRadiusEndOfAbsorber -> Sumw2(); fHistNGoodClustersForFinalTracks -> Sumw2(); @@ -1071,18 +1244,14 @@ void AliMuonForwardTrackFinder::BookHistos() { fHistChi2Cluster_GoodCluster[iPlane] -> Sumw2(); fHistChi2Cluster_BadCluster[iPlane] -> Sumw2(); - fHistChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] -> Sumw2(); - fHistChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] -> Sumw2(); + fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] -> Sumw2(); + fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] -> Sumw2(); } - fNtuFinalCandidates1 = new TNtuple("ntuFinalCandidates1", "Final Candidates (ALL)", "run:event:muonTrack:nFinalCandidates:nClustersMC:nGoodClusters:ptSpectrometer:thetaSpectrometer:etaSpectrometer"); - - fNtuFinalBestCandidates1 = new TNtuple("ntuFinalBestCandidates1", "Final Best Candidates", "run:event:muonTrack:nFinalCandidates:nClustersMC:nGoodClusters:ptSpectrometer:thetaSpectrometer:etaSpectrometer"); + fNtuFinalCandidates = new TNtuple("ntuFinalCandidates", "Final Candidates (ALL)", "run:event:muonTrack:nFinalCandidates:MCTrackRefExists:xVtx:yVtx:zVtx:motherPdg:triggerMatch:nClustersMC:nGoodClusters:pt:theta:eta:chi2AtPlane0:chi2AtPlane1:chi2AtPlane2:chi2AtPlane3:chi2AtPlane4:chi2AtPlane5:chi2AtPlane6:chi2AtPlane7:chi2AtPlane8"); - fNtuFinalCandidates2 = new TNtuple("ntuFinalCandidates2", "Final Candidates (ALL)", "chi2AtPlane0:chi2AtPlane1:chi2AtPlane2:chi2AtPlane3:chi2AtPlane4:chi2AtPlane5:chi2AtPlane6:chi2AtPlane7:chi2AtPlane8:chi2AtPlane9:chi2AtPlane10:chi2AtPlane11:chi2AtPlane12:chi2AtPlane13:chi2AtPlane14"); - - fNtuFinalBestCandidates2 = new TNtuple("ntuFinalBestCandidates2", "Final Best Candidates", "chi2AtPlane0:chi2AtPlane1:chi2AtPlane2:chi2AtPlane3:chi2AtPlane4:chi2AtPlane5:chi2AtPlane6:chi2AtPlane7:chi2AtPlane8:chi2AtPlane9:chi2AtPlane10:chi2AtPlane11:chi2AtPlane12:chi2AtPlane13:chi2AtPlane14"); + fNtuFinalBestCandidates = new TNtuple("ntuFinalBestCandidates", "Final Best Candidates", "run:event:muonTrack:nFinalCandidates:MCTrackRefExists:xVtx:yVtx:zVtx:motherPdg:triggerMatch:nClustersMC:nGoodClusters:pt:theta:eta:chi2AtPlane0:chi2AtPlane1:chi2AtPlane2:chi2AtPlane3:chi2AtPlane4:chi2AtPlane5:chi2AtPlane6:chi2AtPlane7:chi2AtPlane8:nClustersAtPlane0:nClustersAtPlane1:nClustersAtPlane2:nClustersAtPlane3:nClustersAtPlane4:nClustersAtPlane5:nClustersAtPlane6:nClustersAtPlane7:nClustersAtPlane8"); } @@ -1090,9 +1259,6 @@ void AliMuonForwardTrackFinder::BookHistos() { void AliMuonForwardTrackFinder::SetTitleHistos() { - fHistPtSpectrometer -> SetXTitle("p_{T} [GeV/c]"); - fHistPtMuonTrackWithGoodMatch -> SetXTitle("p_{T} [GeV/c]"); - fHistPtMuonTrackWithBadMatch -> SetXTitle("p_{T} [GeV/c]"); fHistRadiusEndOfAbsorber -> SetXTitle("R_{abs} [cm]"); fHistNGoodClustersForFinalTracks -> SetXTitle("N_{GoodClusters}"); @@ -1108,8 +1274,8 @@ void AliMuonForwardTrackFinder::SetTitleHistos() { fHistChi2Cluster_GoodCluster[iPlane] -> SetXTitle("#chi^{2}/ndf"); fHistChi2Cluster_BadCluster[iPlane] -> SetXTitle("#chi^{2}/ndf"); - fHistChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] -> SetXTitle("#chi^{2}/ndf"); - fHistChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] -> SetXTitle("#chi^{2}/ndf"); + fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] -> SetXTitle("#chi^{2}/ndf"); + fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] -> SetXTitle("#chi^{2}/ndf"); } @@ -1120,41 +1286,41 @@ void AliMuonForwardTrackFinder::SetTitleHistos() { void AliMuonForwardTrackFinder::BookPlanes() { for (Int_t iPlane=0; iPlane SetName(Form("fGrMFTPlane_%02d_AllClusters",iPlane)); - fGrMFTPlane[iPlane][kAllClusters] -> SetMarkerStyle(20); - // fGrMFTPlane[iPlane][kAllClusters] -> SetMarkerSize(0.5); - // fGrMFTPlane[iPlane][kAllClusters] -> SetMarkerSize(0.3); - fGrMFTPlane[iPlane][kAllClusters] -> SetMarkerSize(0.2); + fGrMFTPlane[kAllClusters][iPlane] = new TGraph(); + fGrMFTPlane[kAllClusters][iPlane] -> SetName(Form("fGrMFTPlane_%02d_AllClusters",iPlane)); + fGrMFTPlane[kAllClusters][iPlane] -> SetMarkerStyle(20); + // fGrMFTPlane[kAllClusters][iPlane] -> SetMarkerSize(0.5); + // fGrMFTPlane[kAllClusters][iPlane] -> SetMarkerSize(0.3); + fGrMFTPlane[kAllClusters][iPlane] -> SetMarkerSize(0.2); } for (Int_t iPlane=0; iPlane SetName(Form("fGrMFTPlane_%02d_ClustersGoodChi2",iPlane)); - fGrMFTPlane[iPlane][kClustersGoodChi2] -> SetMarkerStyle(20); - // fGrMFTPlane[iPlane][kClustersGoodChi2] -> SetMarkerSize(0.8); - // fGrMFTPlane[iPlane][kClustersGoodChi2] -> SetMarkerSize(0.4); - fGrMFTPlane[iPlane][kClustersGoodChi2] -> SetMarkerSize(0.3); - fGrMFTPlane[iPlane][kClustersGoodChi2] -> SetMarkerColor(kBlue); + fGrMFTPlane[kClustersGoodChi2][iPlane] = new TGraph(); + fGrMFTPlane[kClustersGoodChi2][iPlane] -> SetName(Form("fGrMFTPlane_%02d_ClustersGoodChi2",iPlane)); + fGrMFTPlane[kClustersGoodChi2][iPlane] -> SetMarkerStyle(20); + // fGrMFTPlane[kClustersGoodChi2][iPlane] -> SetMarkerSize(0.8); + // fGrMFTPlane[kClustersGoodChi2][iPlane] -> SetMarkerSize(0.4); + fGrMFTPlane[kClustersGoodChi2][iPlane] -> SetMarkerSize(0.3); + fGrMFTPlane[kClustersGoodChi2][iPlane] -> SetMarkerColor(kBlue); } for (Int_t iPlane=0; iPlane SetName(Form("fGrMFTPlane_%02d_ClustersOfTrack",iPlane)); - fGrMFTPlane[iPlane][kClusterOfTrack] -> SetMarkerStyle(25); - // fGrMFTPlane[iPlane][kClusterOfTrack] -> SetMarkerSize(1.2); - fGrMFTPlane[iPlane][kClusterOfTrack] -> SetMarkerSize(0.9); - fGrMFTPlane[iPlane][kClusterOfTrack] -> SetMarkerColor(kRed); - fGrMFTPlane[iPlane][kClusterOfTrack] -> SetTitle(Form("Plane %d (%3.1f cm)", iPlane, fZPlane[iPlane])); + fGrMFTPlane[kClusterOfTrack][iPlane] = new TGraph(); + fGrMFTPlane[kClusterOfTrack][iPlane] -> SetName(Form("fGrMFTPlane_%02d_ClustersOfTrack",iPlane)); + fGrMFTPlane[kClusterOfTrack][iPlane] -> SetMarkerStyle(25); + // fGrMFTPlane[kClusterOfTrack][iPlane] -> SetMarkerSize(1.2); + fGrMFTPlane[kClusterOfTrack][iPlane] -> SetMarkerSize(0.9); + fGrMFTPlane[kClusterOfTrack][iPlane] -> SetMarkerColor(kRed); + fGrMFTPlane[kClusterOfTrack][iPlane] -> SetTitle(Form("Plane %d (%3.1f cm)", iPlane, fZPlane[iPlane])); } for (Int_t iPlane=0; iPlane SetName(Form("fGrMFTPlane_%02d_ClustersCorrectMC",iPlane)); - fGrMFTPlane[iPlane][kClusterCorrectMC] -> SetMarkerStyle(20); - // fGrMFTPlane[iPlane][kClusterCorrectMC] -> SetMarkerSize(0.8); - fGrMFTPlane[iPlane][kClusterCorrectMC] -> SetMarkerSize(0.5); - fGrMFTPlane[iPlane][kClusterCorrectMC] -> SetMarkerColor(kGreen); + fGrMFTPlane[kClusterCorrectMC][iPlane] = new TGraph(); + fGrMFTPlane[kClusterCorrectMC][iPlane] -> SetName(Form("fGrMFTPlane_%02d_ClustersCorrectMC",iPlane)); + fGrMFTPlane[kClusterCorrectMC][iPlane] -> SetMarkerStyle(20); + // fGrMFTPlane[kClusterCorrectMC][iPlane] -> SetMarkerSize(0.8); + fGrMFTPlane[kClusterCorrectMC][iPlane] -> SetMarkerSize(0.5); + fGrMFTPlane[kClusterCorrectMC][iPlane] -> SetMarkerColor(kGreen); } for (Int_t iPlane=0; iPlaneGetN(); - for (Int_t iPoint=nOldClusters-1; iPoint>=0; iPoint--) fGrMFTPlane[iPlane][iGr]->RemovePoint(iPoint); + Int_t nOldClusters = fGrMFTPlane[iGr][iPlane]->GetN(); + for (Int_t iPoint=nOldClusters-1; iPoint>=0; iPoint--) fGrMFTPlane[iGr][iPlane]->RemovePoint(iPoint); } } @@ -1212,38 +1378,66 @@ void AliMuonForwardTrackFinder::ResetPlanes() { void AliMuonForwardTrackFinder::PrintParticleHistory() { + AliDebug(1, "Entering"); + TString history = ""; - TParticle *part = fStack->Particle(fLabelMC); - - if (part->GetFirstMother() != -1) { - TParticle *partMother = fStack->Particle(part->GetFirstMother()); - if (partMother->GetFirstMother() != -1) history += "... #rightarrow "; + TParticle *part = 0; + if (fLabelMC>=0) part = fStack->Particle(fLabelMC); + + AliDebug(1, Form("fStack->Particle(fLabelMC) = %p", part)); + + if (part) { + if (part->GetFirstMother() != -1) { + TParticle *partMother = fStack->Particle(part->GetFirstMother()); + AliDebug(1, Form("fStack->Particle(part->GetFirstMother() = %p", partMother)); + if (partMother) { + Char_t newName[100]; + if (partMother->GetFirstMother() != -1) history += "... #rightarrow "; + PDGNameConverter(partMother->GetName(), newName); + history += Form("%s #rightarrow ", newName); + } + } Char_t newName[100]; - PDGNameConverter(partMother->GetName(), newName); - history += Form("%s #rightarrow ", newName); + PDGNameConverter(part->GetName(), newName); + history += Form("%s at z = %5.1f cm", newName, part->Vz()); + // printf("%s", history.Data()); } - Char_t newName[100]; - PDGNameConverter(part->GetName(), newName); - history += Form("%s at z = %5.1f cm", newName, part->Vz()); - - // printf("%s", history.Data()); - + else history += "NO AVAILABLE HISTORY"; + fTxtMuonHistory = new TLatex(0.10, 0.86, history.Data()); + + // Filling particle history in the fFinalBestCandidate + + if (part) { + for (Int_t iParent=0; iParentGetFirstMother() == -1) break; + if (!(fStack->Particle(part->GetFirstMother()))) break; + AliDebug(1, Form("fStack->Particle(part->GetFirstMother() = %p", fStack->Particle(part->GetFirstMother()))); + fFinalBestCandidate->SetParentMCLabel(iParent, part->GetFirstMother()); + fFinalBestCandidate->SetParentPDGCode(iParent, fStack->Particle(part->GetFirstMother())->GetPdgCode()); + part = fStack->Particle(part->GetFirstMother()); + } + } } //=========================================================================================================================================== -Bool_t AliMuonForwardTrackFinder::IsMother(const Char_t *nameMother) { +Bool_t AliMuonForwardTrackFinder::IsMother(Char_t *nameMother) { Bool_t result = kFALSE; - TParticle *part = fStack->Particle(fLabelMC); + TParticle *part = 0; + if (fLabelMC>=0) part = fStack->Particle(fLabelMC); - if (part->GetFirstMother() != -1) { - TParticle *partMother = fStack->Particle(part->GetFirstMother()); - if (!strcmp(partMother->GetName(), nameMother)) result=kTRUE; + if (part) { + if (part->GetFirstMother() != -1) { + TParticle *partMother = fStack->Particle(part->GetFirstMother()); + if (partMother) { + if (!strcmp(partMother->GetName(), nameMother)) result=kTRUE; + } + } } return result; @@ -1263,19 +1457,19 @@ void AliMuonForwardTrackFinder::DrawPlanes() { fCanvas->cd(fNPlanesMFT-iPlane+1); - fGrMFTPlane[iPlane][kClusterOfTrack] -> GetXaxis() -> SetLimits(-1.1*fRPlaneMax[fNPlanesMFT-1], +1.1*fRPlaneMax[fNPlanesMFT-1]); - fGrMFTPlane[iPlane][kClusterOfTrack] -> GetYaxis() -> SetRangeUser(-1.1*fRPlaneMax[fNPlanesMFT-1], +1.1*fRPlaneMax[fNPlanesMFT-1]); - fGrMFTPlane[iPlane][kClusterOfTrack] -> GetXaxis() -> SetTitle("X [cm]"); - fGrMFTPlane[iPlane][kClusterOfTrack] -> GetYaxis() -> SetTitle("Y [cm]"); - fGrMFTPlane[iPlane][kClusterOfTrack] -> Draw("ap"); + fGrMFTPlane[kClusterOfTrack][iPlane] -> GetXaxis() -> SetLimits(-1.1*fRPlaneMax[fNPlanesMFT-1], +1.1*fRPlaneMax[fNPlanesMFT-1]); + fGrMFTPlane[kClusterOfTrack][iPlane] -> GetYaxis() -> SetRangeUser(-1.1*fRPlaneMax[fNPlanesMFT-1], +1.1*fRPlaneMax[fNPlanesMFT-1]); + fGrMFTPlane[kClusterOfTrack][iPlane] -> GetXaxis() -> SetTitle("X [cm]"); + fGrMFTPlane[kClusterOfTrack][iPlane] -> GetYaxis() -> SetTitle("Y [cm]"); + fGrMFTPlane[kClusterOfTrack][iPlane] -> Draw("ap"); fCircleExt[iPlane] -> Draw("same"); fCircleInt[iPlane] -> Draw("same"); - if (fGrMFTPlane[iPlane][kAllClusters]->GetN()) fGrMFTPlane[iPlane][kAllClusters] -> Draw("psame"); - if (fGrMFTPlane[iPlane][kClustersGoodChi2]->GetN()) fGrMFTPlane[iPlane][kClustersGoodChi2] -> Draw("psame"); - if (fGrMFTPlane[iPlane][kClusterOfTrack]->GetN()) fGrMFTPlane[iPlane][kClusterOfTrack] -> Draw("psame"); - if (fGrMFTPlane[iPlane][kClusterCorrectMC]->GetN()) fGrMFTPlane[iPlane][kClusterCorrectMC] -> Draw("psame"); + if (fGrMFTPlane[kAllClusters][iPlane]->GetN()) fGrMFTPlane[kAllClusters][iPlane] -> Draw("psame"); + if (fGrMFTPlane[kClustersGoodChi2][iPlane]->GetN()) fGrMFTPlane[kClustersGoodChi2][iPlane] -> Draw("psame"); + if (fGrMFTPlane[kClusterOfTrack][iPlane]->GetN()) fGrMFTPlane[kClusterOfTrack][iPlane] -> Draw("psame"); + if (fGrMFTPlane[kClusterCorrectMC][iPlane]->GetN()) fGrMFTPlane[kClusterCorrectMC][iPlane] -> Draw("psame"); fTxtTrackChi2[iPlane] -> Draw("same"); @@ -1284,9 +1478,10 @@ void AliMuonForwardTrackFinder::DrawPlanes() { fCanvas -> cd(1); fTxtMuonHistory -> Draw(); fTxtDummy -> Draw("same"); - fTxtTrackGoodClusters -> Draw("same"); + if (fMatchingMode==kRealMatching) fTxtTrackGoodClusters -> Draw("same"); fTxtTrackFinalChi2 -> Draw("same"); - fTxtFinalCandidates -> Draw("same"); + fTxtTrackMomentum -> Draw("same"); + if (fMatchingMode==kRealMatching) fTxtFinalCandidates -> Draw("same"); fMrkAllClust -> Draw("same"); fMrkClustGoodChi2 -> Draw("same"); @@ -1315,15 +1510,20 @@ void AliMuonForwardTrackFinder::DrawPlanes() { void AliMuonForwardTrackFinder::Terminate() { - printf("\n"); - printf("---------------------------------------------------------------------------------------------------------------\n"); - printf("%8d tracks analyzed\n", fCountRealTracksAnalyzed); - printf("%8d tracks with MC ref\n", fCountRealTracksWithRefMC); - printf("%8d tracks with MC ref & trigger match\n", fCountRealTracksWithRefMC_andTrigger); - printf("%8d tracks analyzed with final candidates\n", fCountRealTracksAnalyzedWithFinalCandidates); -// printf("%8d tracks with MC ref & trigger match & pt>%3.1f GeV/c\n", fCountRealTracksWithRefMC_andTrigger_andGoodPt, fLowPtCut); -// printf("%8d tracks with MC ref & trigger match & pt>%3.1f GeV/c & correct R_abs\n", fCountRealTracksWithRefMC_andTrigger_andGoodPt_andGoodTheta, fLowPtCut); - printf("---------------------------------------------------------------------------------------------------------------\n"); + AliInfo(""); + AliInfo("---------------------------------------------------------------------------------------------------------------"); + AliInfo(Form("%8d tracks analyzed", fCountRealTracksAnalyzed)); + AliInfo(Form("%8d tracks with MC ref", fCountRealTracksWithRefMC)); + AliInfo(Form("%8d tracks with MC ref & trigger match", fCountRealTracksWithRefMC_andTrigger)); + if (fMatchingMode==kRealMatching) { + AliInfo(Form("%8d tracks analyzed with final candidates", fCountRealTracksAnalyzedWithFinalCandidates)); + } + else { + AliInfo(Form("%8d tracks matched with their MC clusters", fCountRealTracksAnalyzedWithFinalCandidates)); + } +// printf("%8d tracks with MC ref & trigger match & pt>%3.1f GeV/c", fCountRealTracksWithRefMC_andTrigger_andGoodPt, fLowPtCut); +// printf("%8d tracks with MC ref & trigger match & pt>%3.1f GeV/c & correct R_abs", fCountRealTracksWithRefMC_andTrigger_andGoodPt_andGoodTheta, fLowPtCut); + AliInfo("---------------------------------------------------------------------------------------------------------------"); WriteOutputTree(); WriteHistos(); @@ -1339,8 +1539,9 @@ void AliMuonForwardTrackFinder::FillOutputTree() { AliDebug(1, Form("Filling output tree %p with %p having %d entries whose 1st entry is %p", fOutputEventTree, fMuonForwardTracks, fMuonForwardTracks->GetEntries(), fMuonForwardTracks->At(0))); + // fOutputTreeFile->cd(); fOutputEventTree->Fill(); - AliDebug(1, Form("\n\nFilled Tree: nEvents = %d!!!!\n\n", Int_t(fOutputEventTree->GetEntries()))); + AliDebug(1, Form("\nFilled Tree: nEvents = %d!!!!\n", Int_t(fOutputEventTree->GetEntries()))); } @@ -1361,11 +1562,9 @@ void AliMuonForwardTrackFinder::WriteOutputTree() { void AliMuonForwardTrackFinder::WriteHistos() { - TFile *fileOut = new TFile(Form("%s/MuonGlobalTracking.QA.run%d.root", fOutDir.Data(), fRun), "recreate"); + fOutputQAFile = new TFile(Form("MuonGlobalTracking.QA.run%d.root", fRun), "recreate"); + fOutputQAFile -> cd(); - fHistPtSpectrometer -> Write(); - fHistPtMuonTrackWithGoodMatch -> Write(); - fHistPtMuonTrackWithBadMatch -> Write(); fHistRadiusEndOfAbsorber -> Write(); fHistNGoodClustersForFinalTracks -> Write(); @@ -1380,17 +1579,15 @@ void AliMuonForwardTrackFinder::WriteHistos() { fHistChi2Cluster_GoodCluster[iPlane] -> Write(); fHistChi2Cluster_BadCluster[iPlane] -> Write(); - fHistChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] -> Write(); - fHistChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] -> Write(); + fHistGlobalChi2AtPlaneFor_GOOD_CandidatesOfTrackableMuons[iPlane] -> Write(); + fHistGlobalChi2AtPlaneFor_BAD_CandidatesOfTrackableMuons[iPlane] -> Write(); } - fNtuFinalCandidates1 -> Write(); - fNtuFinalBestCandidates1 -> Write(); - fNtuFinalCandidates2 -> Write(); - fNtuFinalBestCandidates2 -> Write(); + fNtuFinalCandidates -> Write(); + fNtuFinalBestCandidates -> Write(); - fileOut -> Close(); + fOutputQAFile -> Close(); } @@ -1398,50 +1595,50 @@ void AliMuonForwardTrackFinder::WriteHistos() { void AliMuonForwardTrackFinder::PDGNameConverter(const Char_t *nameIn, Char_t *nameOut) { - if (!strcmp(nameIn, "mu+")) sprintf(nameOut, "#mu^{+}"); - else if (!strcmp(nameIn, "mu-")) sprintf(nameOut, "#mu^{-}"); - else if (!strcmp(nameIn, "pi+")) sprintf(nameOut, "#pi^{+}"); - else if (!strcmp(nameIn, "pi-")) sprintf(nameOut, "#pi^{-}"); - else if (!strcmp(nameIn, "K+")) sprintf(nameOut, "K^{+}"); - else if (!strcmp(nameIn, "K-")) sprintf(nameOut, "K^{-}"); - else if (!strcmp(nameIn, "K*+")) sprintf(nameOut, "K^{*+}"); - else if (!strcmp(nameIn, "K*-")) sprintf(nameOut, "K^{*-}"); - else if (!strcmp(nameIn, "K_S0")) sprintf(nameOut, "K_{S}^{0}"); - else if (!strcmp(nameIn, "K_L0")) sprintf(nameOut, "K_{L}^{0}"); - else if (!strcmp(nameIn, "K0")) sprintf(nameOut, "K^{0}"); - else if (!strcmp(nameIn, "K0_bar")) sprintf(nameOut, "#bar{K}^{0}"); - else if (!strcmp(nameIn, "K*0")) sprintf(nameOut, "K^{*0}"); - else if (!strcmp(nameIn, "K*0_bar")) sprintf(nameOut, "#bar{K}^{*0}"); - else if (!strcmp(nameIn, "rho0")) sprintf(nameOut, "#rho^{0}"); - else if (!strcmp(nameIn, "rho+")) sprintf(nameOut, "#rho^{+}"); - else if (!strcmp(nameIn, "rho-")) sprintf(nameOut, "#rho^{-}"); - else if (!strcmp(nameIn, "omega")) sprintf(nameOut, "#omega"); - else if (!strcmp(nameIn, "eta'")) sprintf(nameOut, "#eta'"); - else if (!strcmp(nameIn, "phi")) sprintf(nameOut, "#phi"); - - else if (!strcmp(nameIn, "D-")) sprintf(nameOut, "D^{-}"); - else if (!strcmp(nameIn, "D+")) sprintf(nameOut, "D^{+}"); - else if (!strcmp(nameIn, "D0")) sprintf(nameOut, "D^{0}"); - else if (!strcmp(nameIn, "D0_bar")) sprintf(nameOut, "#bar{D}^{0}"); - else if (!strcmp(nameIn, "D*-")) sprintf(nameOut, "D^{*-}"); - else if (!strcmp(nameIn, "D*+")) sprintf(nameOut, "D^{*+}"); - else if (!strcmp(nameIn, "D_s+")) sprintf(nameOut, "D_{s}^{+}"); - else if (!strcmp(nameIn, "D*_s+")) sprintf(nameOut, "D_{s}^{*+}"); - - else if (!strcmp(nameIn, "B-")) sprintf(nameOut, "B^{-}"); - else if (!strcmp(nameIn, "B+")) sprintf(nameOut, "B^{+}"); - else if (!strcmp(nameIn, "B_s0_bar")) sprintf(nameOut, "#bar{B}_{s}^{0}"); - - else if (!strcmp(nameIn, "antiproton")) sprintf(nameOut, "#bar{p}"); - else if (!strcmp(nameIn, "proton")) sprintf(nameOut, "p"); - else if (!strcmp(nameIn, "neutron")) sprintf(nameOut, "n"); - else if (!strcmp(nameIn, "Sigma+")) sprintf(nameOut, "#Sigma^{+}"); - else if (!strcmp(nameIn, "Delta+")) sprintf(nameOut, "#Delta{+}"); - else if (!strcmp(nameIn, "Delta--")) sprintf(nameOut, "#Delta{--}"); - else if (!strcmp(nameIn, "Lambda0")) sprintf(nameOut, "#Lambda_0"); - else if (!strcmp(nameIn, "Lambda0_bar")) sprintf(nameOut, "#bar{Lambda}_0"); - - else sprintf(nameOut, "%s", nameIn); + if (!strcmp(nameIn, "mu+")) snprintf(nameOut, 50, "#mu^{+}"); + else if (!strcmp(nameIn, "mu-")) snprintf(nameOut, 50, "#mu^{-}"); + else if (!strcmp(nameIn, "pi+")) snprintf(nameOut, 50, "#pi^{+}"); + else if (!strcmp(nameIn, "pi-")) snprintf(nameOut, 50, "#pi^{-}"); + else if (!strcmp(nameIn, "K+")) snprintf(nameOut, 50, "K^{+}"); + else if (!strcmp(nameIn, "K-")) snprintf(nameOut, 50, "K^{-}"); + else if (!strcmp(nameIn, "K*+")) snprintf(nameOut, 50, "K^{*+}"); + else if (!strcmp(nameIn, "K*-")) snprintf(nameOut, 50, "K^{*-}"); + else if (!strcmp(nameIn, "K_S0")) snprintf(nameOut, 50, "K_{S}^{0}"); + else if (!strcmp(nameIn, "K_L0")) snprintf(nameOut, 50, "K_{L}^{0}"); + else if (!strcmp(nameIn, "K0")) snprintf(nameOut, 50, "K^{0}"); + else if (!strcmp(nameIn, "K0_bar")) snprintf(nameOut, 50, "#bar{K}^{0}"); + else if (!strcmp(nameIn, "K*0")) snprintf(nameOut, 50, "K^{*0}"); + else if (!strcmp(nameIn, "K*0_bar")) snprintf(nameOut, 50, "#bar{K}^{*0}"); + else if (!strcmp(nameIn, "rho0")) snprintf(nameOut, 50, "#rho^{0}"); + else if (!strcmp(nameIn, "rho+")) snprintf(nameOut, 50, "#rho^{+}"); + else if (!strcmp(nameIn, "rho-")) snprintf(nameOut, 50, "#rho^{-}"); + else if (!strcmp(nameIn, "omega")) snprintf(nameOut, 50, "#omega"); + else if (!strcmp(nameIn, "eta'")) snprintf(nameOut, 50, "#eta'"); + else if (!strcmp(nameIn, "phi")) snprintf(nameOut, 50, "#phi"); + + else if (!strcmp(nameIn, "D-")) snprintf(nameOut, 50, "D^{-}"); + else if (!strcmp(nameIn, "D+")) snprintf(nameOut, 50, "D^{+}"); + else if (!strcmp(nameIn, "D0")) snprintf(nameOut, 50, "D^{0}"); + else if (!strcmp(nameIn, "D0_bar")) snprintf(nameOut, 50, "#bar{D}^{0}"); + else if (!strcmp(nameIn, "D*-")) snprintf(nameOut, 50, "D^{*-}"); + else if (!strcmp(nameIn, "D*+")) snprintf(nameOut, 50, "D^{*+}"); + else if (!strcmp(nameIn, "D_s+")) snprintf(nameOut, 50, "D_{s}^{+}"); + else if (!strcmp(nameIn, "D*_s+")) snprintf(nameOut, 50, "D_{s}^{*+}"); + + else if (!strcmp(nameIn, "B-")) snprintf(nameOut, 50, "B^{-}"); + else if (!strcmp(nameIn, "B+")) snprintf(nameOut, 50, "B^{+}"); + else if (!strcmp(nameIn, "B_s0_bar")) snprintf(nameOut, 50, "#bar{B}_{s}^{0}"); + + else if (!strcmp(nameIn, "antiproton")) snprintf(nameOut, 50, "#bar{p}"); + else if (!strcmp(nameIn, "proton")) snprintf(nameOut, 50, "p"); + else if (!strcmp(nameIn, "neutron")) snprintf(nameOut, 50, "n"); + else if (!strcmp(nameIn, "Sigma+")) snprintf(nameOut, 50, "#Sigma^{+}"); + else if (!strcmp(nameIn, "Delta+")) snprintf(nameOut, 50, "#Delta{+}"); + else if (!strcmp(nameIn, "Delta--")) snprintf(nameOut, 50, "#Delta{--}"); + else if (!strcmp(nameIn, "Lambda0")) snprintf(nameOut, 50, "#Lambda_0"); + else if (!strcmp(nameIn, "Lambda0_bar")) snprintf(nameOut, 50, "#bar{Lambda}_0"); + + else snprintf(nameOut, 50, "%s", nameIn); }