16 if (l.GetLength()>0) pdgcode = l[0].PdgCode();
17 for (
int ii=l.GetLength()-1;ii>=0;--ii)
19 if (!mcm.MctMatch(l[ii],mct))
31 int i=0,j=0, k=0, l=0;
36 TString inPidFile =
"pid_sttcombi.root";
39 TString inParFile =
"params_sttcombi.root";
41 gStyle->SetOptFit(1011);
42 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
44 FairLogger::GetLogger()->SetLogToFile(kFALSE);
47 FairRunAna*
fRun =
new FairRunAna();
48 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
49 fRun->SetInputFile(inSimFile);
50 fRun->AddFriend(inPidFile);
51 fRun->AddFriend(inRecoFile);
53 FairParRootFileIo* parIO =
new FairParRootFileIo();
54 parIO->open(inParFile);
55 rtdb->setFirstInput(parIO);
56 rtdb->setOutput(parIO);
58 fRun->SetOutputFile(OutFile);
62 TFile *
out = TFile::Open(
"output_psi2sana.root",
"RECREATE");
65 TH1F *hjpsim_nopid =
new TH1F(
"hjpsim_nopid",
"J/#psi mass (no pid)",200,0,4);
66 TH1F *hpsim_nopid =
new TH1F(
"hpsim_nopid",
"#psi(2S) mass (no pid)",200,0,5);
67 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4);
68 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
69 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (true pid)",200,0,4);
70 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (true pid)",200,0,5);
72 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4);
73 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass ( truth match)",200,0,5);
74 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4);
75 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
77 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
78 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
80 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass vertex fit",200,0,4);
81 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4);
82 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (4C fit)",200,0,4);
84 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi, #chi^{2} vertex fit",100,0,10);
85 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi, #chi^{2} 4C fit",100,0,250);
86 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi, #chi^{2} mass fit",100,0,10);
88 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
92 if (nevts==0) nevts= theAnalysis->
GetEntries();
98 TPidMassSelector *jpsiMassSel=
new TPidMassSelector(
"jpsi",3.096,1.0);
104 TLorentzVector ini(0, 0, 6.231552, 7.240065);
109 while (theAnalysis->
GetEvent() && i++<nevts)
111 if ((i%100)==0) cout<<
"evt " << i << endl;
114 theAnalysis->
FillList(mctrk,
"McTruth");
117 theAnalysis->
FillList(muplus,
"MuonAllPlus");
118 theAnalysis->
FillList(muminus,
"MuonAllMinus");
119 theAnalysis->
FillList(piplus,
"PionAllPlus");
120 theAnalysis->
FillList(piminus,
"PionAllMinus");
122 jpsi.Combine(muplus, muminus);
125 mcm.SetType(jpsi,
"J/psi");
126 for (j=0;j<jpsi.GetLength();++j)
128 hjpsim_nopid->Fill( jpsi[j].M() );
129 if (mcm.MctMatch(jpsi[j], mctrk)) hjpsim_ftm->Fill( jpsi[j].M() );
130 else hjpsim_nm->Fill( jpsi[j].M() );
134 for (j=0;j<jpsi.GetLength();++j)
139 TCandidate *jfit = vtxfitter.FittedCand(jpsi[j]);
140 TVector3 jVtx=jfit->Pos();
142 double chi2_vtx=vtxfitter.GlobalChi2();
143 hjpsi_chi2_vf->Fill(chi2_vtx);
147 hjpsim_vf->Fill(jfit->M());
148 hvpos->Fill(jVtx.X(),jVtx.Y());
155 psi2s.Combine(jpsi, piplus, piminus);
158 mcm.SetType(psi2s,
"psi(2S)");
160 for (j=0;j<psi2s.GetLength();++j)
162 hpsim_nopid->Fill( psi2s[j].M() );
163 if (mcm.MctMatch(psi2s[j], mctrk))
165 hpsim_ftm->Fill( psi2s[j].M() );
167 TCandidate truePsi = mctrk[psi2s[j].GetMcIdx()];
168 TCandidate trueJ = mctrk[psi2s[j].Daughter(0)->GetMcIdx()];
170 hjpsim_diff->Fill(trueJ.M()-psi2s[j].Daughter(0)->M());
171 hpsim_diff->Fill(truePsi.M()-psi2s[j].M());
173 else hpsim_nm->Fill( psi2s[j].M() );
177 for (j=0;j<psi2s.GetLength();++j)
182 double chi2_4c=fitter.
GetChi2();
183 hpsi_chi2_4c->Fill(chi2_4c);
185 TCandidate *jfit = fitter.FittedCand(*(psi2s[j].Daughter(0)));
187 TCandidate *mupfit = fitter.FittedCand(*(psi2s[j].Daughter(0)->Daughter(0)));
188 TCandidate *mumfit = fitter.FittedCand(*(psi2s[j].Daughter(0)->Daughter(1)));
190 TLorentzVector tlvmupf = mupfit->P4();
191 TLorentzVector tlvmumf = mumfit->P4();
193 hjpsim_4cf->Fill((tlvmupf+tlvmumf).M());
197 for (j=0;j<jpsi.GetLength();++j)
202 double chi2_m = mfitter.GlobalChi2();
203 hjpsi_chi2_mf->Fill(chi2_m);
205 if (chi2_m<2) hjpsim_mcf->Fill(jpsi[j].M());
215 jpsi.Combine(muplus, muminus);
216 for (j=0;j<jpsi.GetLength();++j) hjpsim_tpid->Fill( jpsi[j].M() );
219 psi2s.Combine(jpsi, piplus, piminus);
220 for (j=0;j<psi2s.GetLength();++j) hpsim_tpid->Fill( psi2s[j].M() );
223 theAnalysis->
FillList(muplus,
"MuonLoosePlus",
"PidAlgoMvd;PidAlgoStt");
224 theAnalysis->
FillList(muminus,
"MuonLooseMinus",
"PidAlgoMvd;PidAlgoStt");
225 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt");
226 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt");
228 jpsi.Combine(muplus, muminus);
229 for (j=0;j<jpsi.GetLength();++j) hjpsim_lpid->Fill( jpsi[j].M() );
232 psi2s.Combine(jpsi, piplus, piminus);
233 for (j=0;j<psi2s.GetLength();++j) hpsim_lpid->Fill( psi2s[j].M() );
240 hjpsim_nopid->Write();
241 hpsim_nopid->Write();
242 hjpsim_lpid->Write();
244 hjpsim_tpid->Write();
250 hjpsim_diff->Write();
256 hjpsi_chi2_vf->Write();
257 hpsi_chi2_4c->Write();
258 hjpsi_chi2_mf->Write();
void AddMassConstraint(double mass)
Bool_t FitConserveMasses()
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
int SelectPdgCode(TCandList &mct, TCandList &l)
Int_t GetEvent(Int_t n=-1)
void anatut_psi2s(int nevts=0)