/****************************************************** Analysis Task created by A.Sanchez Read MicroCandidates and do analysis for Hypernuclei. *******************************************************/ #include "TClonesArray.h" #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" //#include "PndTpcLheGFTrack.h" //#include "PndTpcLheGFTrack.h" #include "PndHypHit.h" #include "PndHypPoint.h" #include "../../hypGe/PndHypGePoint.h" #include "PndStack.h" #include "PndMCTrack.h" #include "TVector3.h" #include "TH1F.h" #include "TH2F.h" #include "FairRun.h" #include "FairRuntimeDb.h" #include "PndHypFullAna.h" #include #include #include "GFTrack.h" #include "LSLTrackRep.h" //RHO stuff #include "RhoBase/TCandidate.h" #include "PndMicroCandidate.h" #include "RhoBase/VAbsMicroCandidate.h" #include "RhoBase/TCandList.h" #include "RhoBase/TCandListIterator.h" #include "RhoSelector/TPidSelector.h" #include "RhoBase/TFactory.h" using std::cout; using std::endl; // ----- Default constructor ------------------------------------------- PndHypFullAna::PndHypFullAna() : FairTask("Panda HypFullAna Task") { } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- PndHypFullAna::~PndHypFullAna () { } // ------------------------------------------------------------------------- // ----- Public method Init -------------------------------------------- InitStatus PndHypFullAna::Init() { //cout << " Inside the Init function****" << endl; //FairDetector::Initialize(); //FairRun* sim = FairRun::Instance(); //FairRuntimeDb* rtdb=sim->GetRuntimeDb(); // Get RootManager FairRootManager* ioman = FairRootManager::Instance(); if ( ! ioman ) { cout << "-E- PndEmcHitProducer::Init: " << "RootManager not instantiated!" << endl; return kFATAL; } // Get input array fMcTr = (TClonesArray*) ioman->GetObject("MCTrack"); fMcCands = (TClonesArray*) ioman->GetObject("HypHit"); fMc = (TClonesArray*) ioman->GetObject("HypPoint"); fGe = (TClonesArray*) ioman->GetObject("HypGePoint"); fChargedArray = (TClonesArray*) ioman->GetObject("PndChargedCandidates"); fMicroArray = (TClonesArray*) ioman->GetObject("PndMicroCandidates"); if ( !fChargedArray && !fMicroArray) { cout << "-W- PndHypFullAna ::Init: " << "No PndChargedCandidates && PndNeutralCandidates array!" << endl; return kERROR; } // Create and register output array cout << "-I- PndHypFullAna : Intialization successfull" << endl; ppi2mass = new TH1F("ppimass","p pi cands",200,0.05,0.3); ppi2 = new TH1F("ppion","p pion cands",200,0.05,1.7); e = new TH1F("evenet","p event",200,10000,50000); pid = new TH2F("pid","cands",200,0,16,200,0,16); pidh = new TH2F("pidh","candsh",200,0,16,200,0,16); ximass = new TH1F("ximass","xi cands",200,0.05,2); Lamb = new TH1F("lamb mass","lamb cands",200,0.05,2); //itTop = new TH1F("p","cands",10000000,1010000000,1020000000); spectra[0] = new TH1F("spectra01","cluster 1",200,0.0,0.01); spectra[1] = new TH1F("spectra02","cluster 2",200,0.0,0.01); spectra[2] = new TH1F("spectra03","cluster 3",200,0.0,0.01); spectra[3] = new TH1F("spectra04","cluster 4",200,0.0,0.01); spectra[4] = new TH1F("spectra05","cluster 5",200,0.0,0.01); spectra[5] = new TH1F("spectra06","cluster 6",200,0.0,0.01); spectra[6] = new TH1F("spectra07","cluster 7",200,0.0,0.01); spectra[7] = new TH1F("spectra08","cluster 8",200,0.0,0.01); spectra[8] = new TH1F("spectra09","cluster 9",200,0.0,0.01); spectra[9] = new TH1F("spectra10","cluster 9",200,0.0,0.01); //hvtx2[0]=new TH2F("hvtx201","vertex positions (x,z)",200,0.03,1.,200,0.03,1.); hvtx2[0]=new TH2F("hvtx201","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[1]=new TH2F("hvtx202","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[2]=new TH2F("hvtx203","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[3]=new TH2F("hvtx204","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[4]=new TH2F("hvtx205","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[5]=new TH2F("hvtx206","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[6]=new TH2F("hvtx207","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[7]=new TH2F("hvtx208","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[8]=new TH2F("hvtx209","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); hvtx2[9]=new TH2F("hvtx210","vertex positions (x,z)",100,0.03,0.15,100,0.03,0.15); // **** create and configure the selectors/filters we'd like to use later // //chargedSel = new TPidChargedSelector; neutralSel = new TPidNeutralSelector; plusSel = new TPidPlusSelector; minusSel = new TPidMinusSelector; // **** mass selectors for the resonances/composites // piSel = new TPidSimplePionSelector(); piSel->SetCriterion("veryLoose"); pSel = new TPidSimpleProtonSelector(); pSel->SetCriterion("veryLoose"); LambMSel = new TPidMassSelector("LambSelector" , 1.115 , 0.04); evcount=0; return kSUCCESS; } void PndHypFullAna::SetParContainers() { // Get run and runtime database FairRunAna* run = FairRunAna::Instance(); if ( ! run ) Fatal("SetParContainers", "No analysis run"); //FairRuntimeDb* db = run->GetRuntimeDb(); //if ( ! db ) Fatal("SetParContainers", "No runtime database"); } // ------------------------------------------------------------------------- // ----- Public method Exec -------------------------------------------- void PndHypFullAna::Exec(Option_t* opt) { TFactory::Instance()->Reset(); if (!(++evcount%100)) cout <<"evt "< mapp; //TCandidate *tc; // **** loop over all Candidates and add them to the list allCands // chargedCands.Cleanup(); //neutralCands.Cleanup(); for (Int_t i1=0; i1GetEntriesFast(); i1++){ PndMicroCandidate *mic = (PndMicroCandidate *)fMicroArray->At(i1); TCandidate tc(*mic,i1); TLorentzVector l=tc.P4(); TVector3 p=tc.Pos(); //cout<<" micro to tcaaand "<Fill((ppiCands[la].P4()).M()); } xiCands.Combine(ppiCands,minusCands); TCandidate *t4; TCandListIterator itX(xiCands); while (t4=itX.Next()) { ximass->Fill(t4->Mass()); } for (int c=0;cFill(l.P());//tc->Mass()); TLorentzVector l=t2->P4(); // ppimass->Fill(l.M());//tc->Mass()); TVector3 pim = l.Vect(); //cout <<"fitted = "<GetCharge()<Fill(pim.Mag()); } int ii,jj; int npi=piCands.GetLength(); //int np=pplusCands.GetLength(); PndHypHit *hit; PndHypPoint *po; int Motherpdg,MotherId; //Calculate total energy SPectra SetTotESpectra(9); for (int k=0;kAt((pion.GetMicroCandidate().GetMvdHits())-1); PndHypPoint* pop=(PndHypPoint*)fMc->At(hp->GetRefIndex()); if(pop==0)continue; PndMCTrack* moc=(PndMCTrack*)fMcTr->At(pop->GetTrackID()); if(moc==0)continue; if( moc->GetPdgCode()==-211)dsCands.Add(pion); //cout<<" number real "<GetEventID()<<" pion number real "<Fill(l.P());//tc->Mass()); TLorentzVector v4=t3->P4(); // ppimass->Fill(l.M());//tc->Mass()); TVector3 v3 = v4.Vect(); //cout <<"fitted = "<GetCharge()<Fill(v3.Mag()); } /* for (int k=0;kAt((pion.GetMicroCandidate().GetMvdHits())-1); PndHypPoint* pop=(PndHypPoint*)fMc->At(hp->GetRefIndex()); if(pop==0)continue; PndMCTrack* moc=(PndMCTrack*)fMcTr->At(pop->GetTrackID()); if(moc==0)continue; MotherId= moc->GetMotherID(); if (MotherId==-1)Motherpdg = moc->GetPdgCode(); else { PndMCTrack *mother =(PndMCTrack*)fMcTr->At(MotherId); Motherpdg = mother->GetPdgCode(); } //****cut on PCA to primary vertex has to be added **** TVector3 vx=moc->GetStartVertex(); //cout<<" event "<GetEventID()<<" "<GetPdgCode()!=-211)continue; //if(vx.x()==0&&vx.y()==0&&vx.z()==-76.5)continue; if((Motherpdg>1020000000||Motherpdg>1010000000)&&moc->GetPdgCode()==-211)ppi2->Fill(v3.Mag()); if((Motherpdg>1020000000||Motherpdg>1010000000)&&v3.Mag()>0.5) { Int_t Z,A,L; cout<<" mala part "<GetPdgCode()<<" "<GetEventID()<<" "<Fill(pop->GetEventID()); if(L==1)pid->Fill(Z,A); if(L==2)pidh->Fill(Z,A); } } */ if(dsi==1){ //if(npi==1){ //TCandidate pi=piCands[0]; TCandidate pi=dsCands[0]; //TCandidate pp=piminusCands[jj]; TLorentzVector vpim=pi.P4(); TVector3 pi3v = vpim.Vect(); //cout<Fill(pi3v.Mag(),0.); } if(dsi>1) { for (ii=0;iiAt((pi.GetMicroCandidate().GetMvdHits())-1); po=(PndHypPoint*)fMc->At(hit->GetRefIndex()); if(po==0)continue; PndMCTrack* mc=(PndMCTrack*)fMcTr->At(po->GetTrackID()); if(mc==0)continue; MotherId= mc->GetMotherID(); if (MotherId==-1)Motherpdg = mc->GetPdgCode(); else { PndMCTrack *mother =(PndMCTrack*)fMcTr->At(MotherId); Motherpdg = mother->GetPdgCode(); } //****cut on PCA to primary vertex has to be added **** TVector3 vertex=mc->GetStartVertex(); //if(mc->GetPdgCode()==3112) cout<<" Motherpdg mala "<GetEventID()<<" "<GetPdgCode()!=-211)continue; //if(Motherpdg==-211||Motherpdg==310|| //if(Motherpdg==3312)continue; //if(vertex.x()==0&&vertex.y()==0&&vertex.z()==-76.5)continue; cout<<" Motherpdg "<GetPdgCode()<GetPdgCode()<<" mother "<GetEventID()<pp3v.Mag())cout<<" pi3v >pp3v "<pp3v.Mag()) { hvtx2[0]->Fill(pi3v.Mag(),pp3v.Mag()); if((pi3v.Mag()>0.12&&pi3v.Mag()<0.14)&&(pp3v.Mag()>0.065&&pp3v.Mag()<0.08)) { //if(Motherpdg==1020040110||Motherpdg==1010050110){ //cout<<" Be11LL "<GetPdgCode()<pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); //if((pi3v.Mag()>0.12&&pi3v.Mag()<0.14)&&(pp3v.Mag()>0.065&&pp3v.Mag()<0.08)) { if(mapp[po->GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; //cout<<" Motherpdg "<GetEventID(),0); } } if(Motherpdg==1020040110||Motherpdg==1010050110){ ///hvtx2[1]->Fill(pi3v.Mag(),pp3v.Mag()); } if(Motherpdg==1020030090||(Motherpdg==1010040090 && MotherId!=-1)){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); //if((pi3v.Mag()>0.12&&pi3v.Mag()<0.14)&&(pp3v.Mag()>0.065&&pp3v.Mag()<0.08)) { } //cout<<" Motherpdg Li9LL "<0.112&&pi3v.Mag()<0.126)&&(pp3v.Mag()>0.09&&pp3v.Mag()<0.103)){ hvtx2[2]->Fill(pi3v.Mag(),pp3v.Mag()); if(mapp[po->GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; SetEnergySpectra(po->GetEventID(),1);//cout<<" Motherpdg Li9LL cl1 "<0.128&&pi3v.Mag()<0.147)&&(pp3v.Mag()>0.0898&&pp3v.Mag()<0.109)){ hvtx2[9]->Fill(pi3v.Mag(),pp3v.Mag()); //cout<<" Motherpdg Li9LL cl2 "<GetPdgCode()<GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; SetEnergySpectra(po->GetEventID(),4); //cout<<" Motherpdg Li9LL cl2 "<pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); } if((pi3v.Mag()>0.097&&pi3v.Mag()<0.106)&&(pp3v.Mag()>0.094&&pp3v.Mag()<0.103)) { // if(Motherpdg==1020040100||Motherpdg==1010050100){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); //if((pi3v.Mag()>0.12&&pi3v.Mag()<0.14)&&(pp3v.Mag()>0.065&&pp3v.Mag()<0.08)) { //cout<<" Be10LL "<GetPdgCode()<GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; // cout<<" Motherpdg "<GetEventID(),2); } } if(Motherpdg==1020040120||Motherpdg==1010050120){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); } if((pi3v.Mag()>0.128&&pi3v.Mag()<0.147)&&(pp3v.Mag()>0.110&&pp3v.Mag()<0.124)) { //if(Motherpdg==1020040120||Motherpdg==1010050120){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); // cout<<" Middle "<GetPdgCode()<GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; //cout<<" Mot be12LL "<GetEventID(),3); } } if(Motherpdg==1020020060||Motherpdg==1010030060){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); } if((pi3v.Mag()>0.128&&pi3v.Mag()<0.147)&&(pp3v.Mag()>0.124&&pp3v.Mag()<0.143)) { //if(Motherpdg==1020020060||Motherpdg==1010030060){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pi3v.Mag(),pp3v.Mag()); //cout<<" Top "<GetPdgCode()<GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; // cout<<" Mot He6LL "<GetEventID(),5); } } /* if((pi3v.Mag()>0.095&&pi3v.Mag()<0.11)&&(pp3v.Mag()>0.09&&pp3v.Mag()<0.103)) SetEnergySpectra(po->GetEventID(),1); if((pi3v.Mag()>0.112&&pi3v.Mag()<0.126)&&(pp3v.Mag()>0.09&&pp3v.Mag()<0.103)) SetEnergySpectra(po->GetEventID(),2); if((pi3v.Mag()>0.126&&pi3v.Mag()<0.14)&&(pp3v.Mag()>0.09&&pp3v.Mag()<0.103)) SetEnergySpectra(po->GetEventID(),3);*/ } if(pi3v.Mag()GetEventID()<Fill(pp3v.Mag(),pi3v.Mag()); if(Motherpdg==1020040110||Motherpdg==1010050110){ //hvtx2[1]->Fill(pp3v.Mag(),pi3v.Mag()); } if((pp3v.Mag()>0.12&&pp3v.Mag()<0.14)&&(pi3v.Mag()>0.065&&pi3v.Mag()<0.08)) { //if(Motherpdg==1020040110||Motherpdg==1010050110){ hvtx2[1]->Fill(pp3v.Mag(),pi3v.Mag()); // if(mapp[po->GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; //cout<<" Motherpdg "<GetEventID(),0); } } if(Motherpdg==1020030090||(Motherpdg==1010040090&& MotherId!=-1)){ //hvtx2[2]->Fill(pp3v.Mag(),pi3v.Mag()); } if((pp3v.Mag()>0.112&&pp3v.Mag()<0.126)&&(pi3v.Mag()>0.09&&pi3v.Mag()<0.103)) { //if(Motherpdg==1020030090||(Motherpdg==1010040090&& MotherId!=-1)){ hvtx2[2]->Fill(pp3v.Mag(),pi3v.Mag()); //if((pp3v.Mag()>0.12&&pp3v.Mag()<0.14)&&(pi3v.Mag()>0.065&&pi3v.Mag()<0.08)) { if(mapp[po->GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; //cout<<" Motherpdg "<GetEventID(),1);//cout<<" Motherpdg Li9LL cl1 "<0.128&&pp3v.Mag()<0.147)&&(pi3v.Mag()>0.0898&&pi3v.Mag()<0.109)) { hvtx2[9]->Fill(pp3v.Mag(),pi3v.Mag()); //cout<<" Motherpdg Li9LL cl2 "<GetPdgCode()<GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; SetEnergySpectra(po->GetEventID(),4);// } } //} if(Motherpdg==1020040100||Motherpdg==1010050100){ //hvtx2[3]->Fill(pp3v.Mag(),pi3v.Mag()); } if((pp3v.Mag()>0.097&&pp3v.Mag()<0.106)&&(pi3v.Mag()>0.094&&pi3v.Mag()<0.103)) { // if(Motherpdg==1020040100||Motherpdg==1010050100){ hvtx2[3]->Fill(pp3v.Mag(),pi3v.Mag()); // if(mapp[po->GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; //cout<<" Motherpdg "<GetEventID(),2); } } if(Motherpdg==1020040120||Motherpdg==1010050120){ //hvtx2[4]->Fill(pp3v.Mag(),pi3v.Mag()); } if((pp3v.Mag()>0.128&&pp3v.Mag()<0.147)&&(pi3v.Mag()>0.110&&pi3v.Mag()<0.124)) { //if(Motherpdg==1020040120||Motherpdg==1010050120){ hvtx2[4]->Fill(pp3v.Mag(),pi3v.Mag()); //cout<<" Middle "<GetPdgCode()<GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; //cout<<" Motherpdg "<GetEventID(),3); } } if(Motherpdg==1020020060||Motherpdg==1010030060){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pp3v.Mag(),pi3v.Mag()); } if((pp3v.Mag()>0.128&&pp3v.Mag()<0.147)&&(pi3v.Mag()>0.124&&pi3v.Mag()<0.143)) { // if(Motherpdg==1020020060||Motherpdg==1010030060){ //cout<<" pi3v >pp3v "<GetEventID()<Fill(pp3v.Mag(),pi3v.Mag()); //cout<<" top "<GetPdgCode()<GetEventID(),5); if(mapp[po->GetEventID()]==0) { mapp[po->GetEventID()]=Motherpdg; // // cout<<" Mot He6LL "<GetEventID(),5); } } /* if((pp3v.Mag()>0.095&&pp3v.Mag()<0.11)&&(pi3v.Mag()>0.09&&pi3v.Mag()<0.103)) SetEnergySpectra(po->GetEventID(),1); if((pp3v.Mag()>0.112&&pp3v.Mag()<0.126)&&(pi3v.Mag()>0.09&&pi3v.Mag()<0.103)) SetEnergySpectra(po->GetEventID(),2); if((pp3v.Mag()>0.126&&pp3v.Mag()<0.14)&&(pi3v.Mag()>0.09&&pi3v.Mag()<0.103)) SetEnergySpectra(po->GetEventID(),3);*/ } //ppimass->Fill(compo->Mass()); } } } // cout<<" pdg mother "<::const_iterator ci=mapp.begin(); // ci != mapp.end();ci++){ // TH1F *h = itTop = ci->second; // cout<<" pdg mother "<first<<" length "<GetEntriesFast()!=0) { //cout<<" ge entries "<GetEntriesFast()<At(0); if(event == evCheck->GetEventID()){ cout<<" event "<GetEventID()<GetEntriesFast();entries++) { PndHypGePoint *ge; ge=(PndHypGePoint*)fGe->At(entries); E += ge->GetEnergyLoss(); } } } if(E>0.&&E<0.010)spectra[cluster]->Fill(E); } void PndHypFullAna::SetTotESpectra(int clus) { Float_t E; E=0; if(fGe->GetEntriesFast()!=0) { //cout<<" ge entries total "<GetEntriesFast()<GetEntriesFast();entries++) { PndHypGePoint *ge; ge=(PndHypGePoint*)fGe->At(entries); E += ge->GetEnergyLoss(); } } if(E>0.&&E<0.010)spectra[clus]->Fill(E); } Int_t PndHypFullAna::GetIonCharge(Int_t ion,Int_t &mass,Int_t &str) { Int_t A,Z,L; if(ion>1000000000&&(ion<1010000000)) { ion -= 1000000000; Z = ion/10000; ion -= 10000*Z; A = ion/10; //cout<<" ion charge "<1010000000||ion>1020000000)) { ion -= 1000000000; L = ion/10000000; ion -= 10000000*L; Z = ion/10000; ion -= 10000*Z; A = ion/10; //cout<GetOutFile(); file->cd(); //file->mkdir(cat.Data());//"HypHitAnaF"); //file->cd(cat.Data());//"HypHitAnaF"); ppi2mass->Write(); delete ppi2mass; ppi2mass=NULL; ximass->Write(); delete ximass; ximass=NULL; Lamb->Write(); delete Lamb; Lamb=NULL; ppi2->Write(); delete ppi2; ppi2=NULL; e->Write(); delete e; e=NULL; pid->Write(); delete pid; pid=NULL; pidh->Write(); delete pidh; pidh=NULL; for(int i=0;i<10;i++){ hvtx2[i]->Write(); delete hvtx2[i]; hvtx2[i] =NULL; spectra[i]->Write(); delete spectra[i]; spectra[i]=NULL; } /* hvtx2[0]->Write(); hvtx2[1]->Write(); hvtx2[2]->Write(); hvtx2[3]->Write(); hvtx2[4]->Write(); hvtx2[5]->Write(); hvtx2[6]->Write(); hvtx2[7]->Write();hvtx2[8]->Write(); // hvtx2[9]->Write(); ppi2mass->Write(); spectra[0]->Write(); spectra[1]->Write(); spectra[2]->Write(); spectra[3]->Write(); spectra[4]->Write(); spectra[5]->Write();spectra[6]->Write();spectra[7]->Write(); spectra[8]->Write(); //spectra[9]->Write(); */ } ClassImp(PndHypFullAna)