// ------------------------------------------------------------------------- // ----- PndAnaPidLambdaLambdaBar source file ----- // ----- Created 18/07/08 by S.Esch ----- // ------------------------------------------------------------------------- // libc includes #include // Root includes #include "TROOT.h" #include "TClonesArray.h" #include "TVector3.h" #include "TLorentzVector.h" // framework includes #include "FairRootManager.h" #include "FairRun.h" #include "FairRuntimeDb.h" #include "FairHit.h" #include "FairMultiLinkedData.h" #include "FairEventHeader.h" #include "PndAnaPidLambdaLambdaBar.h" #include "PndSdsMCPoint.h" #include "PndSdsHit.h" #include "PndGemHit.h" #include "PndSttHit.h" #include "PndMCEntry.h" #include "PndMCTrack.h" #include "PndGemMCPoint.h" #include "PndTrackCand.h" #include "PndDetectorList.h" #include // ----- Default constructor ------------------------------------------- PndAnaPidLambdaLambdaBar::PndAnaPidLambdaLambdaBar() : FairTask("Creates PndMC test"),fInputBranchName(" "), fNumberOfMVDHits(3), fNumberOfTotalHits(9) { } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- PndAnaPidLambdaLambdaBar::~PndAnaPidLambdaLambdaBar() { } // ----- Public method Init -------------------------------------------- InitStatus PndAnaPidLambdaLambdaBar::Init() { eventcounter=0; FairRootManager* ioman = FairRootManager::Instance(); if (!ioman) { std::cout << "-E- PndAnaPidLambdaLambdaBar::Init: " << "RootManager not instantiated!" << std::endl; return kFATAL; } // fMCMatch = (PndMCMatch*)ioman->GetObject("MCMatch"); // if ( ! fMCMatch ) { // std::cout << "-W- PndAnaPidLambdaLambdaBar::Init: No MCMatch array! Needed for MC Truth" << std::endl; // return kERROR; // } fEventHeader = (TClonesArray*)ioman->GetObject("EventHeader."); if ( ! fEventHeader ) { std::cout << "-W- PndAnaPidLambdaLambdaBar::Init: No EventHeader array! Needed for EventNumber" << std::endl; return kERROR; } if(fInputBranchName== " ") { std::cout << "-E- PndAnaPidLambdaLambdaBar::Init: No InputBranchName Set" << std::endl; return kERROR; } else { fPID = (TClonesArray*)ioman->GetObject(fInputBranchName); if(!fPID) { std::cout << "-E- PndAnaPidLambdaLambdaBar::Init: No Input Branch Found! BranchName: "<< fInputBranchName << std::endl; return kERROR; } } fStripHit = (TClonesArray*)ioman->GetObject("MVDHitsStrip"); fPixelHit = (TClonesArray*)ioman->GetObject("MVDHitsPixel"); fMCPoint = (TClonesArray*)ioman->GetObject("MVDPoint"); fMCTrack = (TClonesArray*)ioman->GetObject("MCTrack"); fSTTHit = (TClonesArray*)ioman->GetObject("STTHit"); fGEMHit = (TClonesArray*)ioman->GetObject("GEMHit"); fGEMPoint = (TClonesArray*)ioman->GetObject("GEMPoint"); fFTSHit = (TClonesArray*)ioman->GetObject("FTSHit"); fErrorCounter=0; std::cout << "-I- PndAnaPidLambdaLambdaBar::Init: Initialization successfull" << std::endl; fAnaPid_HitAnalysisTracksPerEvent2D = new TH2I("fAnaPid_HitAnalysisTracksPerEvent2D", "fAnaPid_HitAnalysisTracksPerEvent2D;Number of Tracks/Event", 6,-0.5,5.5,16,-0.5,15.5); return kSUCCESS; } void PndAnaPidLambdaLambdaBar::Exec(Option_t* opt) { if(fVerbose>0) { std::cout << "============= Begin PndAnaPidLambdaLambdaBar::Exec for Event "<< eventcounter << std::endl; } int protontrack=0; int antiprotontrack=0; int pionplustrack=0; int pionminustrack=0; for(Int_t i=0; iGetEntriesFast(); i++) { PndPidCandidate* pidcand = (PndPidCandidate*)fPID->At(i); //std::cout << "pidcand->GetMcIndex() " << pidcand->GetMcIndex() << std::endl; if(pidcand->GetMcIndex()==5) { protontrack++; } if(pidcand->GetMcIndex()==3) { antiprotontrack++; } if(pidcand->GetMcIndex()==4) { pionplustrack++; } if(pidcand->GetMcIndex()==6) { pionminustrack++; } } if(protontrack>1 || antiprotontrack>1 || pionplustrack>1 || pionminustrack>1) { fErrorCounter++; } SetHitAnalysisEventAxis(fAnaPid_HitAnalysisTracksPerEvent2D); FillAnalysisTracksPerEventSingleTrack(protontrack,antiprotontrack, pionminustrack,pionplustrack, fAnaPid_HitAnalysisTracksPerEvent2D); if(fVerbose>0) { std::cout << "============= End PndAnaPidLambdaLambdaBar::Exec for Event "<< eventcounter << std::endl; } eventcounter++; } // ------------------------------------------------------------------------- void PndAnaPidLambdaLambdaBar::SetParContainers() { fGeoH = PndGeoHandling::Instance(); fGeoH->SetParContainers(); } bool PndAnaPidLambdaLambdaBar::CutCriteria(int fts, int stt, int gem, int mvd) { if (mvd>fNumberOfMVDHits || fts+stt+gem+mvd >fNumberOfTotalHits) { return true; } else { return false; } } void PndAnaPidLambdaLambdaBar::FillAnalysisTracksPerEventSingleTrack(int protontrack, int antiprotontrack, int pionminustrack, int pionplustrack, TH2I* histo) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,0); if(protontrack==0 && antiprotontrack==1 && pionminustrack==1 && pionplustrack==1 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,1); } else if(protontrack==1 && antiprotontrack==0 && pionminustrack==1 && pionplustrack==1 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,2); } else if(protontrack==1 && antiprotontrack==1 && pionminustrack==0 && pionplustrack==1 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,3); } else if(protontrack==1 && antiprotontrack==1 && pionminustrack==1 && pionplustrack==0 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,4); } else if(protontrack==1 && antiprotontrack==1 && pionminustrack==0 && pionplustrack==0 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,5); } else if(protontrack==1 && antiprotontrack==0 && pionminustrack==1 && pionplustrack==0 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,6); } else if(protontrack==0 && antiprotontrack==1 && pionminustrack==1 && pionplustrack==0 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,7); } else if(protontrack==1 && antiprotontrack==0 && pionminustrack==0 && pionplustrack==1 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,8); } else if(protontrack==0 && antiprotontrack==1 && pionminustrack==0 && pionplustrack==1 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,9); } else if(protontrack==0 && antiprotontrack==0 && pionminustrack==1 && pionplustrack==1 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,10); } else if(protontrack==1 && antiprotontrack==0 && pionminustrack==0 && pionplustrack==0 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,11); } else if(protontrack==0 && antiprotontrack==1 && pionminustrack==0 && pionplustrack==0 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,12); } else if(protontrack==0 && antiprotontrack==0 && pionminustrack==1 && pionplustrack==0 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,13); } else if(protontrack==0 && antiprotontrack==0 && pionminustrack==0 && pionplustrack==1 ) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,14); } else if(protontrack==0 && antiprotontrack==0 && pionminustrack==0 && pionplustrack==0) { histo->Fill(protontrack+antiprotontrack+pionplustrack+pionminustrack,15); } } void PndAnaPidLambdaLambdaBar::SetHitAnalysisEventAxis(TH1* histo) { histo->GetYaxis()->SetBinLabel(1,"Vertical Sum"); histo->GetYaxis()->SetBinLabel(2,"p mis."); histo->GetYaxis()->SetBinLabel(3,"pbar mis."); histo->GetYaxis()->SetBinLabel(4,"#pi- mis."); histo->GetYaxis()->SetBinLabel(5,"#pi+ mis."); histo->GetYaxis()->SetBinLabel(6,"#pi- #pi+ mis."); histo->GetYaxis()->SetBinLabel(7,"pbar #pi+ mis."); histo->GetYaxis()->SetBinLabel(8,"p #pi+ mis."); histo->GetYaxis()->SetBinLabel(9,"pbar #pi- mis."); histo->GetYaxis()->SetBinLabel(10,"p #pi- mis."); histo->GetYaxis()->SetBinLabel(11,"p pbar mis."); histo->GetYaxis()->SetBinLabel(12,"just p"); histo->GetYaxis()->SetBinLabel(13,"just antip"); histo->GetYaxis()->SetBinLabel(14,"just #pi-"); histo->GetYaxis()->SetBinLabel(15,"just #pi+"); histo->GetYaxis()->SetBinLabel(16,"no track"); } void PndAnaPidLambdaLambdaBar::SetHitAnalysisAxis(TH1* histo) { histo->GetXaxis()->SetBinLabel(3,"MVD"); histo->GetXaxis()->SetBinLabel(4,"STT"); histo->GetXaxis()->SetBinLabel(5,"GEM"); histo->GetXaxis()->SetBinLabel(6,"FTS"); histo->GetXaxis()->SetBinLabel(7,"MVD+STT"); histo->GetXaxis()->SetBinLabel(8,"MVD+GEM"); histo->GetXaxis()->SetBinLabel(9,"MVD+FTS"); histo->GetXaxis()->SetBinLabel(10,"STT+GEM"); histo->GetXaxis()->SetBinLabel(11,"STT+FTS"); histo->GetXaxis()->SetBinLabel(12,"GEM+FTS"); histo->GetXaxis()->SetBinLabel(13,"MVD+STT+GEM"); histo->GetXaxis()->SetBinLabel(14,"MVD+STT+FTS"); histo->GetXaxis()->SetBinLabel(15,"MVD+GEM+FTS"); histo->GetXaxis()->SetBinLabel(16,"STT+GEM+FTS"); histo->GetXaxis()->SetBinLabel(17,"all"); } int PndAnaPidLambdaLambdaBar::FillAnalysisHistoSingleDetectors(TH2I* SingleParticleHisto, TH2I* TotalHisto, TH2I* SingleParticleSelected, TH2I* TotalSelected, TH2I* SingleParticleRejected, TH2I* TotalRejected, int fts, int stt, int gem, int mvd) { if(fts==0 && stt==0 && gem==0 && (mvd)!=0) { TotalHisto->Fill(2,mvd); SingleParticleHisto->Fill(2,mvd); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(2,mvd); TotalSelected->Fill(2,mvd); return 1; } else { SingleParticleRejected->Fill(2,mvd); TotalRejected->Fill(2,mvd); return 0; } } else if(fts==0 && stt!=0 && gem==0 && (mvd)==0) { TotalHisto->Fill(3,stt); SingleParticleHisto->Fill(3,stt); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(3,stt); TotalSelected->Fill(3,stt); return 1; } else { SingleParticleRejected->Fill(3,stt); TotalRejected->Fill(3,stt); return 0; } } else if(fts==0 && stt==0 && gem!=0 && (mvd)==0) { TotalHisto->Fill(4,gem); SingleParticleHisto->Fill(4,gem); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(4,gem); TotalSelected->Fill(4,gem); return 1; } else { SingleParticleRejected->Fill(4,gem); TotalRejected->Fill(4,gem); return 0; } } else if(fts!=0 && stt==0 && gem==0 && (mvd)==0) { TotalHisto->Fill(5,fts); SingleParticleHisto->Fill(5,fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(5,fts); TotalSelected->Fill(5,fts); return 1; } else { SingleParticleRejected->Fill(5,fts); TotalRejected->Fill(5,fts); return 0; } } //std::cout << "end" << std::endl; return 0; } int PndAnaPidLambdaLambdaBar::FillAnalysisHistoDoubleDetectors(TH2I* SingleParticleHisto, TH2I* TotalHisto, TH2I* SingleParticleSelected, TH2I* TotalSelected, TH2I* SingleParticleRejected, TH2I* TotalRejected,int fts, int stt, int gem, int mvd) { //std::cout << "double " << " stt " << stt << " mvd " << mvd << " fts " << fts << " gem " << gem; if(fts==0 && stt!=0 && gem==0 && (mvd)!=0) { TotalHisto->Fill(6,mvd+stt+gem+fts); SingleParticleHisto->Fill(6,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(6,mvd+stt+gem+fts); TotalSelected->Fill(6,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(6,mvd+stt+gem+fts); TotalRejected->Fill(6,mvd+stt+gem+fts); return 0; } } else if(fts==0 && stt==0 && gem!=0 && (mvd)!=0) { TotalHisto->Fill(7,mvd+stt+gem+fts); SingleParticleHisto->Fill(7,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(7,mvd+stt+gem+fts); TotalSelected->Fill(7,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(7,mvd+stt+gem+fts); TotalRejected->Fill(7,mvd+stt+gem+fts); return 0; } } else if(fts!=0 && stt==0 && gem==0 && (mvd)!=0) { TotalHisto->Fill(8,mvd+stt+gem+fts); SingleParticleHisto->Fill(8,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(8,mvd+stt+gem+fts); TotalSelected->Fill(8,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(8,mvd+stt+gem+fts); TotalRejected->Fill(8,mvd+stt+gem+fts); return 0; } } else if(fts==0 && stt!=0 && gem!=0 && (mvd)==0) { TotalHisto->Fill(9,mvd+stt+gem+fts); SingleParticleHisto->Fill(9,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(9,mvd+stt+gem+fts); TotalSelected->Fill(9,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(9,mvd+stt+gem+fts); TotalRejected->Fill(9,mvd+stt+gem+fts); return 0; } } else if(fts!=0 && stt!=0 && gem==0 && (mvd)==0) { TotalHisto->Fill(10,mvd+stt+gem+fts); SingleParticleHisto->Fill(10,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(10,mvd+stt+gem+fts); TotalSelected->Fill(10,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(10,mvd+stt+gem+fts); TotalRejected->Fill(10,mvd+stt+gem+fts); return 0; } } else if(fts!=0 && stt==0 && gem!=0 && (mvd)==0) { TotalHisto->Fill(11,mvd+stt+gem+fts); SingleParticleHisto->Fill(11,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(11,mvd+stt+gem+fts); TotalSelected->Fill(11,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(11,mvd+stt+gem+fts); TotalRejected->Fill(11,mvd+stt+gem+fts); return 0; } } // std::cout << "end" << std::endl; return 0; } int PndAnaPidLambdaLambdaBar::FillAnalysisHistoTripleDetectors(TH2I* SingleParticleHisto, TH2I* TotalHisto, TH2I* SingleParticleSelected, TH2I* TotalSelected, TH2I* SingleParticleRejected, TH2I* TotalRejected, int fts, int stt, int gem, int mvd) { // std::cout << "triple " << " stt " << stt << " mvd " << mvd << " fts " << fts << " gem " << gem; if(fts==0 && stt!=0 && gem!=0 && (mvd)!=0) { TotalHisto->Fill(12,mvd+stt+gem+fts); SingleParticleHisto->Fill(12,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(12,mvd+stt+gem+fts); TotalSelected->Fill(12,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(12,mvd+stt+gem+fts); TotalRejected->Fill(12,mvd+stt+gem+fts); return 0; } } else if(fts!=0 && stt!=0 && gem==0 && (mvd)!=0) { TotalHisto->Fill(13,mvd+stt+gem+fts); SingleParticleHisto->Fill(13,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(13,mvd+stt+gem+fts); TotalSelected->Fill(13,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(13,mvd+stt+gem+fts); TotalRejected->Fill(13,mvd+stt+gem+fts); return 0; } } else if(fts!=0 && stt==0 && gem!=0 && (mvd)!=0) { TotalHisto->Fill(14,mvd+stt+gem+fts); SingleParticleHisto->Fill(14,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(14,mvd+stt+gem+fts); TotalSelected->Fill(14,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(14,mvd+stt+gem+fts); TotalRejected->Fill(14,mvd+stt+gem+fts); return 0; } } else if(fts!=0 && stt!=0 && gem!=0 && (mvd)==0) { TotalHisto->Fill(15,mvd+stt+gem+fts); SingleParticleHisto->Fill(15,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(15,mvd+stt+gem+fts); TotalSelected->Fill(15,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(15,mvd+stt+gem+fts); TotalRejected->Fill(15,mvd+stt+gem+fts); return 0; } } // std::cout << "end" << std::endl; return 0; } int PndAnaPidLambdaLambdaBar::FillAnalysisHistoQuatroDetectors(TH2I* SingleParticleHisto, TH2I* TotalHisto, TH2I* SingleParticleSelected, TH2I* TotalSelected, TH2I* SingleParticleRejected, TH2I* TotalRejected, int fts, int stt, int gem, int mvd) { //std::cout << "quatro " << " stt " << stt << " mvd " << mvd << " fts " << fts << " gem " << gem; if(fts!=0 && stt!=0 && gem!=0 && (mvd)!=0) { TotalHisto->Fill(16,mvd+stt+gem+fts); SingleParticleHisto->Fill(16,mvd+stt+gem+fts); if(CutCriteria(fts,stt,gem,mvd)==true) { SingleParticleSelected->Fill(16,mvd+stt+gem+fts); TotalSelected->Fill(16,mvd+stt+gem+fts); return 1; } else { SingleParticleRejected->Fill(16,mvd+stt+gem+fts); TotalRejected->Fill(16,mvd+stt+gem+fts); return 0; } } // std::cout << "end" << std::endl; return 0; } void PndAnaPidLambdaLambdaBar::MVDStripCounter(FairMultiLinkedData MVDStriplinks, int &mvdstrip, int &mvdstriplambda) { for(int h=0;h < MVDStriplinks.GetNLinks();h++) // Loop over all MVD Strip hits to count the hits from the Lambda Disks { PndSdsHit* myStripHit = (PndSdsHit*)fStripHit->At(MVDStriplinks.GetLink(h).GetIndex()); if(fGeoH->GetPath(myStripHit->GetSensorID()).Contains("LambdaDisk") || fGeoH->GetPath(myStripHit->GetSensorID()).Contains("AddDisk") ) { //std::cout <<"fGeoH->GetPath(myStripHit->GetSensorID())" << fGeoH->GetPath(myStripHit->GetSensorID()) << std::endl; mvdstriplambda++;} else { mvdstrip++; //std::cout <<"fGeoH->GetPath(myStripHit->GetSensorID())" << fGeoH->GetPath(myStripHit->GetSensorID()) << std::endl; } } } int PndAnaPidLambdaLambdaBar::GEMCounter(FairMultiLinkedData GEMlinks) { int gemcounter=0; for(int i=0;icd("AnaPID"+fInputBranchName); fAnaPid_HitAnalysisTracksPerEvent2D->Write(); gDirectory->cd("/"); } ClassImp(PndAnaPidLambdaLambdaBar);