4 kDCH,
kDRC,
kDSK,
kEMC,
kGEM,
kLUMI,
kMDT,
kMVD,
kRPC,
kSTT,
kTPC,
kTOF,
kFTS,
kHYPG,
kHYP};
8 gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/rootlogon.C");
10 TString inPidFile =
"evt_pid_stt.root";
13 TFile *
inFile = TFile::Open(inSimFile,
"READ");
15 TTree *
tree=(TTree *) inFile->Get(
"pndsim") ;
16 tree->AddFriend(
"pndsim",inPidFile);
18 TClonesArray* cand_array=
new TClonesArray(
"PndPidCandidate");
19 tree->SetBranchAddress(
"PidChargedCand", &cand_array);
21 TClonesArray*
mc_array=
new TClonesArray(
"PndMCTrack");
22 tree->SetBranchAddress(
"MCTrack", &mc_array);
24 TFile *
out = TFile::Open(
"out_test.root",
"RECREATE");
25 TNtuple *nt =
new TNtuple(
"nt",
"nt",
"evt:id:mc_p:mc_theta:mc_phi:mc_pid:mc_stt:mc_tpc:mc_mvd:mc_gem:p:theta:phi:mult:stt:tpc:mvd");
26 TNtuple *ntEvt =
new TNtuple(
"ntEvt",
"ntEvt",
"evt:acc_stt:acc_tpc:eff:effct:cand:mc_phi1:mc_phi2:reco_phi1:reco_phi2:mc_all:reco_all");
27 Float_t mass_k = 0.493677;
29 if (nEntries==0) nEntries = tree->GetEntriesFast();
30 for (Int_t j=0; j< nEntries; j++){
33 if ((j%100)==0) cout <<
"processing event " << j <<
"\n";
35 Float_t mc_mom = 0, mc_theta = 0, mc_phi = 0;
36 Float_t rec_mom = -1, rec_theta = -1, rec_phi = 0;
37 Int_t stt_mccount = 0, tpc_mccount = 0, reco_stt = 0, reco_tpc = 0,
reco_mvd = 0, reco_gem = 0, reco_count = 0, reco_ctcount = 0;
38 TLorentzVector mc_k[4], reco_k[4], mc_phi1, reco_phi1, mc_phi2, reco_phi2, mc_all, reco_all;
39 for (Int_t mc = 0; mc < mc_array->GetEntriesFast(); mc++)
47 mc_theta = mctrack->
GetMomentum().Theta()*TMath::RadToDeg();
48 mc_phi = mctrack->
GetMomentum().Phi()*TMath::RadToDeg();
51 for (Int_t pp=0; pp<cand_array->GetEntriesFast(); pp++)
55 if ( (cand_mult==0) || ((cand_mult>0) && (
fabs(rec_mom-mc_mom)>
fabs(pidCand->
GetMomentum().Mag()-mc_mom))) )
62 reco_tpc = pidCand->GetTpcHits();
69 if (cand_mult>0) reco_count++;
70 if ((cand_mult>0) && ((reco_stt>0) || (reco_tpc>0))) reco_ctcount++;
71 Float_t ntuple_nt[] = {
72 j,mc, mc_mom,mc_theta,mc_phi, mc_pid,
74 rec_mom, rec_theta*TMath::RadToDeg(), rec_phi*TMath::RadToDeg(), cand_mult, reco_stt, reco_tpc,
reco_mvd
79 mc_phi1 = mc_k[0] + mc_k[1];
80 mc_phi2 = mc_k[2] + mc_k[3];
81 reco_phi1 = reco_k[0] + reco_k[1];
82 reco_phi2 = reco_k[2] + reco_k[3];
83 mc_all = mc_phi1 + mc_phi2;
84 reco_all = reco_phi1 + reco_phi2;
86 Float_t ntuple_evt[] = {
87 j, stt_mccount, tpc_mccount, reco_count, reco_ctcount,cand_array->GetEntriesFast(),
88 mc_phi1.M(), mc_phi2.M(), reco_phi1.M(), reco_phi2.M(), mc_all.M(), reco_all.M()
90 ntEvt->Fill(ntuple_evt);
95 nt->Draw(
"mc_theta>>hMcTheta(50,0,100)");
96 nt->Draw(
"mc_theta>>hMcSttTheta(50,0,100)",
"mc_stt>0");
97 nt->Draw(
"mc_theta>>hMcSttMvdTheta(50,0,100)",
"(mc_stt>0)||(mc_mvd>0)");
98 nt->Draw(
"mc_theta>>hMcTpcTheta(50,0,100)",
"mc_tpc>0");
99 nt->Draw(
"mc_theta>>hMcTpcMvdTheta(50,0,100)",
"(mc_tpc>0)||(mc_tpc>0)");
100 nt->Draw(
"mc_theta>>hMcMvdTheta(50,0,100)",
"mc_mvd>0");
101 nt->Draw(
"mc_theta>>hMcGemTheta(50,0,100)",
"mc_gem>0");
102 nt->Draw(
"mc_theta>>hRecoTheta(50,0,100)",
"mult>0");
103 nt->Draw(
"mc_theta>>hRecoCtTheta(50,0,100)",
"mult>0&&(stt>0||tpc>0)");
104 nt->Draw(
"mc_theta>>hRecoEffTheta(50,0,100)",
"mult>0");
105 nt->Draw(
"mc_theta>>hRecoEffCtTheta(50,0,100)",
"mult>0&&(stt>0||tpc>0)");
106 hRecoEffTheta->Divide(hMcTheta);
107 hRecoEffCtTheta->Divide(hMcTheta);
108 nt->Draw(
"mc_theta>>hMcAccSttTheta(50,0,100)",
"mc_stt>0");
109 hMcAccSttTheta->Divide(hMcTheta);
110 nt->Draw(
"mc_theta>>hMcAccTpcTheta(50,0,100)",
"mc_tpc>0");
111 hMcAccTpcTheta->Divide(hMcTheta);
114 nt->Draw(
"mc_phi>>hMcPhi(50,-200,200)");
115 nt->Draw(
"mc_phi>>hMcSttPhi(50,-200,200)",
"mc_stt>0");
116 nt->Draw(
"mc_phi>>hMcSttMvdPhi(50,-200,200)",
"(mc_stt>0)||(mc_mvd>0)");
117 nt->Draw(
"mc_phi>>hMcTpcPhi(50,-200,200)",
"mc_tpc>0");
118 nt->Draw(
"mc_phi>>hMcTpcMvdPhi(50,-200,200)",
"(mc_tpc>0)||(mc_mvd>0)");
119 nt->Draw(
"mc_phi>>hMcMvdPhi(50,-200,200)",
"mc_mvd>0");
120 nt->Draw(
"mc_phi>>hMcGemPhi(50,-200,200)",
"mc_gem>0");
121 nt->Draw(
"mc_phi>>hRecoPhi(50,-200,200)",
"mult>0");
122 nt->Draw(
"mc_phi>>hRecoCtPhi(50,-200,200)",
"mult>0&&(stt>0||tpc>0)");
123 nt->Draw(
"mc_phi>>hRecoEffPhi(50,-200,200)",
"mult>0");
124 nt->Draw(
"mc_phi>>hRecoEffCtPhi(50,-200,200)",
"mult>0&&(stt>0||tpc>0)");
125 hRecoEffPhi->Divide(hMcPhi);
126 hRecoEffCtPhi->Divide(hMcPhi);
127 nt->Draw(
"mc_phi>>hMcAccSttPhi(50,-200,200)",
"mc_stt>0");
128 hMcAccSttPhi->Divide(hMcPhi);
129 nt->Draw(
"mc_phi>>hMcAccTpcPhi(50,-200,200)",
"mc_tpc>0");
130 hMcAccTpcPhi->Divide(hMcPhi);
132 nt->Draw(
"mc_p>>hMcP(100,0,5)");
133 nt->Draw(
"mc_p>>hMcSttP(100,0,5)",
"mc_stt>0");
134 nt->Draw(
"mc_p>>hMcSttMvdP(100,0,5)",
"(mc_stt>0)||(mc_mvd>0)");
135 nt->Draw(
"mc_p>>hMcTpcP(100,0,5)",
"mc_tpc>0");
136 nt->Draw(
"mc_p>>hMcTpcMvdP(100,0,5)",
"(mc_tpc>0)||(mc_mvd>0)");
137 nt->Draw(
"mc_p>>hMcMvdP(100,0,5)",
"mc_mvd>0");
138 nt->Draw(
"mc_p>>hMcGemP(100,0,5)",
"mc_gem>0");
139 nt->Draw(
"mc_p>>hRecoP(100,0,5)",
"mult>0");
140 nt->Draw(
"mc_p>>hRecoCtP(100,0,5)",
"mult>0&&(stt>0||tpc>0)");
141 nt->Draw(
"mc_p>>hRecoEffP(100,0,5)",
"mult>0");
142 nt->Draw(
"mc_p>>hRecoEffCtP(100,0,5)",
"mult>0&&(stt>0||tpc>0)");
143 hRecoEffP->Divide(hMcP);
144 hRecoEffCtP->Divide(hMcP);
145 nt->Draw(
"mc_p>>hMcAccSttP(100,0,5)",
"mc_stt>0");
146 hMcAccSttP->Divide(hMcP);
147 nt->Draw(
"mc_p>>hMcAccTpcP(100,0,5)",
"mc_tpc>0");
148 hMcAccTpcP->Divide(hMcP);
150 nt->Draw(
"(mc_p-p):mc_p>>hresp_p(100,0,5,100,-0.5,0.5)",
"mult>0");
151 nt->Draw(
"(mc_p-p):mc_theta>>hresp_theta(100,0,100,100,-0.5,0.5)",
"mult>0",
"colz");
152 nt->Draw(
"(mc_theta-theta):mc_theta>>hrestheta_theta(100,0,100,100,-2,2)",
"mult>0");
153 nt->Draw(
"(mc_theta-theta):mc_p>>hrestheta_p(100,0,5,100,-2,2)",
"mult>0");
154 nt->Draw(
"(mc_phi-phi):mc_phi>>hresphi_phi(100,-200,200,100,-2,2)",
"mult>0");
156 ntEvt->Draw(
"reco_phi1>>hphi(100,0.95,1.1)",
"eff==4");
157 ntEvt->Draw(
"reco_phi2>>hphi2(100,0.95,1.1)",
"eff==4");
159 ntEvt->Draw(
"reco_all>>hAll(100,2.5,3.5)",
"eff==4");
165 hMcTheta->Write(); hMcSttTheta->Write(); hMcSttMvdTheta->Write(); hMcMvdTheta->Write(); hMcGemTheta->Write(); hRecoTheta->Write();
166 hMcTpcTheta->Write(); hMcTpcMvdTheta->Write(); hRecoEffTheta->Write(); hMcAccSttTheta->Write(); hMcAccTpcTheta->Write();
167 hMcPhi->Write(); hMcSttPhi->Write(); hMcSttMvdPhi->Write(); hMcMvdPhi->Write(); hMcGemPhi->Write(); hRecoPhi->Write();
168 hMcTpcPhi->Write(); hMcTpcMvdPhi->Write(); hRecoEffPhi->Write(); hMcAccSttPhi->Write(); hMcAccTpcPhi->Write();
169 hMcP->Write(); hMcSttP->Write(); hMcSttMvdP->Write(); hMcMvdP->Write(); hMcGemP->Write(); hRecoP->Write();
170 hMcTpcP->Write(); hMcTpcMvdP->Write(); hRecoEffP->Write();hMcAccSttP->Write(); hMcAccTpcP->Write();
171 hRecoCtTheta->Write();
174 hRecoEffCtTheta->Write();
175 hRecoEffCtPhi->Write();
176 hRecoEffCtP->Write();
181 hresp_theta->Write();
182 hrestheta_theta->Write();
183 hrestheta_p->Write();
184 hresphi_phi->Write();
Int_t GetNPoints(DetectorId detId) const
TVector3 GetMomentum() const
int track_check(Int_t nEntries=0)
TLorentzVector Get4Momentum() const
friend F32vec4 fabs(const F32vec4 &a)
Int_t GetMotherID() const
TVector3 GetMomentum() const