7 gStyle->SetOptFit(1011);
12 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
14 TString inPidFile =
"evt_pid_tpc.root";
16 TFile *
inFile = TFile::Open(inSimFile,
"READ");
17 TTree *
tree=(TTree *) inFile->Get(
"pndsim") ;
18 tree->AddFriend(
"pndsim",inPidFile);
19 TClonesArray*
mc_array=
new TClonesArray(
"PndMCTrack");
20 tree->SetBranchAddress(
"MCTrack",&mc_array);
22 TClonesArray* cand_array=
new TClonesArray(
"PndPidCandidate");
23 tree->SetBranchAddress(
"PidChargedCand",&cand_array);
25 FairMCEventHeader* evthead;
26 tree->SetBranchAddress(
"MCEventHeader.", &evthead);
28 TFile *
out=TFile::Open(
"invariantmass_4pi_tpc.root",
"RECREATE");
30 PndEventReader evr(inPidFile);
32 TH1F *
nc=
new TH1F(
"nc",
"Number of Charged Tracks; Charged Tracks",20,-0.5,19.5);
33 TH1F *invmassnosel=
new TH1F(
"invmassnosel",
"2(#pi^{+}#pi^{-}) Invariant mass;Invariant Mass (GeV)",100,0,10);
34 TH1F *invmassnocut=
new TH1F(
"invmassnocut",
"2(#pi^{+}#pi^{-}) Invariant mass;Invariant Mass (GeV)",100,2,4);
36 TH1F *invmasswithpid=
new TH1F(
"invmasswithpid",
"#pi^{+}#pi^{-} Invariant mass;Invariant Mass (GeV)",100,0,10);
37 TH1F *invmasswithpid_sel=
new TH1F(
"invmasswithpid_sel",
"#pi^{+}#pi^{-} Invariant mass;Invariant Mass (GeV)",100,2,4);
38 TH1F *invmass_trackhighmom=
new TH1F(
"invmass_trackhighmom",
"2(#pi^{+}#pi^{-}) Invariant mass;Invariant Mass (GeV)",100,2,4);
39 TH1F *invmasschicut=
new TH1F(
"invmasschicut",
"#2(pi^{+}#pi^{-}) Invariant mass;Invariant Mass (GeV)",100,2,4);
40 TH1F *invmasschicut_best=
new TH1F(
"invmasschicut_best",
"2(#pi^{+}#pi^{-}) Invariant mass;Invariant Mass (GeV)",100,2,4);
42 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-5,5,100,-5,5);
43 TH1F *
hvzpos =
new TH1F(
"hvzpos",
"z position of fitted decay vertex",100,-4,4);
45 TH1F *chivtx=
new TH1F(
"chivtx",
"Chi Square RhoKinVtxFitter; Chi Square / N_{df}",100,0,100);
46 TH1F *
hvtxresX =
new TH1F(
"hvtxresX",
"X resolution of fitted decay vertex",100,-0.3,0.3);
47 TH1F *
hvtxresY =
new TH1F(
"hvtxresY",
"Y resolution of fitted decay vertex",100,-0.3,0.3);
48 TH1F *
hvtxresZ =
new TH1F(
"hvtxresZ",
"Z resolution of fitted decay vertex",100,-0.3,0.3);
51 TPidPlusSelector *piplusSel=
new TPidPlusSelector(
"piplus");
52 TPidMinusSelector *piminusSel=
new TPidMinusSelector(
"piminus");
54 TCandList pp, pm, pipi,pipinosel, pipiwithpid;
58 TLorentzVector ini(0,0,4.0,5.04684);
59 int i=0,j=0,k=0,l=0,
y=0;
62 beam.SetXYZM (0.0,0.0,4.0,0.938272);
63 TLorentzVector target;
64 target.SetXYZM (0.0,0.0,0.0,0.938272);
65 TLorentzVector pbarp=beam+target;
69 float energypip, energypim, momxpip, momypip, momzpip;
70 TPidMassSelector *pipisel=
new TPidMassSelector(
"pipisel",3.07,0.5);
71 TPidPlusSelector *piplusSel=
new TPidPlusSelector(
"piplus");
72 TPidMinusSelector *piminusSel=
new TPidMinusSelector(
"piminus");
74 if (nEntries==0) nEntries=evr.GetEntries();
75 while (evr.GetEvent() && i++<nEntries){
77 if (!((i+1)%100)) cout<<
"evt " << i <<
"\n";
79 evr.FillList(pp,
"Charged");
80 evr.FillList(pm,
"Charged");
83 pm.Select(piminusSel);
85 int nchrg=pp.GetLength();
89 float momentumpplus, momentumpminus, theta1, theta2, phi1, phi2;
91 for (Int_t l=0;l<pp.GetLength();l++){
92 pp[l].SetMass(TRho::Instance()->GetPDG()->GetParticle(211)->
Mass());
93 momentumpplus=pp[l].GetMicroCandidate().GetMomentum().Mag();
96 for (Int_t l=0;l<pm.GetLength();l++){
97 pm[l].SetMass(TRho::Instance()->GetPDG()->GetParticle(211)->
Mass());
98 momentumpminus=pm[l].GetMicroCandidate().GetMomentum().Mag();
103 pipinosel.Combine(pp,pm,pp,pm);
105 for (
y=0;
y<pipinosel.GetLength();++
y){
106 invmassnosel->Fill(pipinosel[
y].M());
109 pipi.Combine(pp,pm,pp,pm);
110 pipi.Select(pipisel);
112 for (
y=0;
y<pipi.GetLength();++
y){
113 invmassnocut->Fill(pipi[
y].M());
114 if (momentumpplus>0.3 && momentumpminus >0.3){
115 invmass_trackhighmom->Fill(pipi[
y].M());
125 evthead->GetVertex(mcVertex);
131 for (l=0;l<pp.GetLength();++l) {
133 if (pp[ii].GetMicroCandidate().GetMcIndex()>-1){
145 std::cout<<
"Pi plus, element "<<l<<
" has no assosiated mcTRack"<<std::endl;
153 for (l=0;l<pm.GetLength();++l) {
155 if (pm[ii].GetMicroCandidate().GetMcIndex()>-1){
167 std::cout<<
"Pi Minus, element "<<l<<
" has no assosiated mcTRack"<<std::endl;
173 pipiwithpid.Combine(pp,pm,pp,pm);
174 for (
y=0;
y<pipiwithpid.GetLength();++
y){
175 invmasswithpid->Fill(pipiwithpid[
y].M());
179 pipiwithpid.Combine(pp,pm,pp,pm);
180 pipiwithpid.Select(pipisel);
181 for (
y=0;
y<pipiwithpid.GetLength();++
y){
182 invmasswithpid_sel->Fill(pipiwithpid[
y].M());
187 double best_chi2=1000;
188 TCandidate *pipifit_best=0;
189 Float_t pipivtx_mass;
190 for (
y=0;
y<pipiwithpid.GetLength();++
y){
194 TCandidate *pipifit=vtxfitter.FittedCand(pipiwithpid[y]);
196 TVector3 pipiVtx=pipifit->Pos();
197 double chi2_vtx=vtxfitter.GlobalChi2();
199 hvpos->Fill(pipiVtx.X(),pipiVtx.Y());
200 hvzpos->Fill(pipiVtx.Z());
202 if(chi2_vtx<best_chi2)
206 pipifit_best=pipifit;
207 pipivtx_mass=pipifit_best->M();
208 bestPos = pipifit->Pos();
210 chivtx->Fill(chi2_vtx/5);
214 if((pipiwithpid.GetLength()!=0))
216 invmasschicut_best->Fill(pipivtx_mass);
218 hvtxresX->Fill(mcVertex.X()-bestPos.X());
219 hvtxresY->Fill(mcVertex.Y()-bestPos.Y());
220 hvtxresZ->Fill(mcVertex.Z()-bestPos.Z());
int run_ana_invariantmass_4pi_tpc(int nEntries=0)
Int_t GetMotherID() const