void run_ana_eta_c_stt(int nevts=0) { bool use4cfit=1; // if flag is off vertex fit is used TString OutFile; if (use4cfit==1) OutFile="etac_histo_4c_stt.root"; else OutFile="etac_histo_vtx_stt.root"; gStyle->SetOptFit(1011); TStopwatch timer; timer.Start(); gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); TString inPidFile = "evt_pid_stt.root"; TString inSimFile = "evt_points_stt.root"; TFile *inFile = TFile::Open(inPidFile,"READ"); TTree *tree=(TTree *) inFile->Get("cbmsim") ; tree->AddFriend("cbmsim",inSimFile); TClonesArray* mc_array=new TClonesArray("PndMCTrack"); tree->SetBranchAddress("MCTrack",&mc_array); TClonesArray* cand_array=new TClonesArray("PndPidCandidate"); tree->SetBranchAddress("PidChargedCand",&cand_array); TFile *out = TFile::Open(OutFile,"RECREATE"); // the PndEventReader takes care about file/event handling PndEventReader evr(inPidFile); TH1F *h_etac_nocut=new TH1F("h_etac_nocut","m(eta_c), (no cuts);E, GeV",100,2.5,3.5); TH1F *h_etac_pid=new TH1F("h_etac_pid","m(eta_c), (MC PID);E, GeV",100,2.5,3.5); TH1F *h_etac_vtx=new TH1F("h_etac_vtx","m(eta_c), Vertex fit",100,2.5,3.5); TH1F *h_etac_4c=new TH1F("h_etac_4c","m(eta_c), 4C-fit",100,2.5,3.5); TH1F *h_etac_phimass=new TH1F("h_etac_phimass","m(eta_c), (cut on #phi mass);E, GeV",100,2.5,3.5); TH1F *h_mphi_nocuts=new TH1F("h_mphi_nocuts","#phi: m(K+ K-) (no cuts)",100,1.020-0.15,1.020+0.5); TH1F *h_mphi_pid=new TH1F("h_mphi_pid","#phi: m(K+ K-) (MC PID)",100,1.020-0.15,1.020+0.5); TH1F *h_mphi_vtx=new TH1F("h_mphi_vtx","#phi: m(K+ K-) (Vertex fit)",100,1.020-0.15,1.020+0.5); TH1F *h_mphi_4c=new TH1F("h_mphi_4c","#phi: m(K+ K-) (4C-fit)",100,1.020-0.15,1.020+0.5); TH1F *h_mphi_final=new TH1F("h_mphi_final","#phi: m(K+ K-)",200,1.020-0.15,1.020+0.15); TH1F *nc=new TH1F("nc","n charged",20,0,20); TH1F *h_chi2_4c=new TH1F("h_chi2_4c","#chi^{2} 4C-fit;#chi^{2}/N_{df}",100,0,100); TH1F *h_chi2_vtx=new TH1F("h_chi2_vtx","#chi^{2} vertex;#chi^{2}/N_{df}",100,0,100); TH2F *hvpos = new TH2F("hvpos","(x,y) projection of fitted decay vertex",100,-5,5,100,-5,5); TH1F *hvzpos = new TH1F("hvzpos","z position of fitted decay vertex",100,-10,10); //TPidMassSelector *phiMassSel=new TPidMassSelector("phi",1.02,0.03); TPidPlusSelector *kplusSel=new TPidPlusSelector("kplus"); TPidMinusSelector *kminusSel=new TPidMinusSelector("kminus"); // the candidates lists we need TCandList p1, p2, p3, p4, phi1, phi2, etac, etac_nocut; int n_reco=0; // Number of events in file and number of reconstructed eta_c to store in root file TH1F *n_events=new TH1F("n_events","total number of events",1,0,1); TH1F *n_etac=new TH1F("n_etac","number of reconstructed eta_c",1,0,1); TLorentzVector ini(0,0,3.6772,4.7333); if (nevts==0) nevts=evr.GetEntries(); n_events->SetBinContent(1,nevts); // cout << "nevts " << nevts << "\n"; int i=0,j=0, k=0, l=0; // ************* // this is the loop through the events ... as simple as this... // **************** while (evr.GetEvent() && i++Fill(nchrg); for (j=0;jGetPDG()->GetParticle(321)->Mass()); } for (j=0;jGetPDG()->GetParticle(321)->Mass()); } for (j=0;jGetPDG()->GetParticle(321)->Mass()); } for (j=0;jGetPDG()->GetParticle(321)->Mass()); } phi1.Combine(p1,p2); phi2.Combine(p3,p4); for (j=0;jFill(phi1[j].M()); etac_nocut.Combine(phi1,phi2); for (l=0;lFill(etac_nocut[l].M()); } tree->GetEntry(i); // MC PID // Leave only kaons in particle lists for (l=0;l-1){ PndMCTrack *mcTrack = (PndMCTrack*)mc_array->At(p1[l].GetMicroCandidate().GetMcIndex()); if (mcTrack!=0) { if (mcTrack->GetPdgCode()!=321) p1.Remove(p1[l]); } else { std::cout<<"Kaon list 1, element "<-1){ PndMCTrack *mcTrack = (PndMCTrack*)mc_array->At(p2[l].GetMicroCandidate().GetMcIndex()); if (mcTrack!=0) { if (mcTrack->GetPdgCode()!=-321) p2.Remove(p2[l]); } else { std::cout<<"Kaon list 2, element "<-1){ PndMCTrack *mcTrack = (PndMCTrack*)mc_array->At(p3[l].GetMicroCandidate().GetMcIndex()); if (mcTrack!=0) { if (mcTrack->GetPdgCode()!=321) p3.Remove(p3[l]); } else { std::cout<<"Kaon list 3, element "<-1){ PndMCTrack *mcTrack = (PndMCTrack*)mc_array->At(p4[l].GetMicroCandidate().GetMcIndex()); if (mcTrack!=0) { if (mcTrack->GetPdgCode()!=-321) p4.Remove(p4[l]); } else { std::cout<<"Kaon list 4, element "<Fill(phi1[j].M()); etac.Combine(phi1,phi2); for (l=0;lFill(etac[l].M()); } if (use4cfit) { ////////////// 4C-fit /////////////// int best_i=0; double best_chi2=1000; for (l=0;lFill(chi2/9); // Ndf=3N-3=9 } if((best_chi2<90)&&(etac.GetLength()!=0)) { h_etac_4c->Fill(etac[best_i].M()); TCandidate *phi1best=(etac[best_i].Daughter(0)); TCandidate *phi2best=(etac[best_i].Daughter(1)); double m_phi1=phi1best->M(); double m_phi2=phi2best->M(); h_mphi_4c->Fill(m_phi1); h_mphi_4c->Fill(m_phi2); h_mphi_final->Fill(m_phi1); h_mphi_final->Fill(m_phi2); //std::cout<<"m_phi1="<