24 #include "dk2nu/tree/dk2nu.h" 25 #include "dk2nu/tree/dkmeta.h" 81 std::vector<std::string> fFileVec;
83 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00250.dk2nu.root");
84 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00249.dk2nu.root");
85 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00248.dk2nu.root");
86 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00247.dk2nu.root");
87 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00246.dk2nu.root");
88 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00245.dk2nu.root");
89 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00244.dk2nu.root");
90 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00243.dk2nu.root");
91 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00242.dk2nu.root");
92 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00241.dk2nu.root");
93 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_NoSnout_neutrino_00240.dk2nu.root");
94 fFileVec.push_back(
"/pnfs/dune/scratch/users/ljf26/fluxfiles/g4lbne/v3r5p4/QGSP_BERT/OptimizedEngineeredNov2017_NoSnout/neutrino/flux/g4lbne_v3r5p4_QGSP_BERT_OptimizedEngineeredNov2017_neutrino_00239.dk2nu.root");
100 fChain =
new TChain(ntuple_name.c_str());
103 fChain -> Add(sit -> c_str());
109 rand3 =
new TRandom3(0);
116 delete fChain->GetCurrentFile();
123 return fChain->GetEntry(entry);
129 Long64_t centry =
fChain->LoadTree(entry);
130 if (centry < 0)
return centry;
131 if (!
fChain->InheritsFrom(TChain::Class()))
return centry;
132 TChain *chain = (TChain*)
fChain;
133 if (chain->GetTreeNumber() !=
fCurrent) {
154 dk2nu =
new bsim::Dk2Nu;
191 dk2nu =
new bsim::Dk2Nu;
196 TH2D *h2_all =
new TH2D(
"h_all",
"",20,-100,100,20,-100,100);
197 TH2D *h2_fardet =
new TH2D(
"h_fardet",
"",20,-100,100,20,-100,100);
198 TH2D *h2_fardet_peak =
new TH2D(
"h_fardet_peak",
"",20,-100,100,20,-100,100);
199 TH1D *hx_fardet =
new TH1D(
"hx_fardet",
"",40,-100,100);
200 TH1D *hy_fardet =
new TH1D(
"hy_fardet",
"",40,-100,100);
202 TH2D *h_vxy_all =
new TH2D(
"h_vxy_all",
"",20,-100,100,20,-100,100);
203 TH2D *h_vxy =
new TH2D(
"h_vxy",
"",20,-100,100,20,-100,100);
204 TH2D *h_vxy_peak =
new TH2D(
"h_vxy_peak",
"",20,-100,100,20,-100,100);
205 TH1D *h_vx =
new TH1D(
"h_vx",
"",40,-100,100);
206 TH1D *h_vy =
new TH1D(
"h_vy",
"",40,-100,100);
207 TH1D *h_vx_peak =
new TH1D(
"h_vx_peak",
"",40,-100,100);
208 TH1D *h_vy_peak =
new TH1D(
"h_vy_peak",
"",40,-100,100);
210 TH1D *h_fluxfardet =
new TH1D(
"h_fluxfardet",
"",40,0,20);
212 TCanvas *
c =
new TCanvas();
215 Long64_t nentries =
fChain->GetEntries();
216 std::cout <<
"Total number of Entries = " << nentries <<
std::endl;
218 double ancestors_tot = 0;
219 double ancestors_10 = 0;
220 double ancestors_20 = 0;
221 double ancestors_30 = 0;
222 double ancestors_40 = 0;
223 double ancestors_50 = 0;
224 double ancestors_60 = 0;
225 double ancestors_70 = 0;
226 double ancestors_77p5 = 0;
227 double ancestors_80 = 0;
228 double ancestors_90 = 0;
229 double ancestors_100 = 0;
231 for (Long64_t jentry=0; jentry<nentries;jentry++)
236 if(iread % 10000 == 0)
238 std::cout <<
"Reading Entry " << iread <<
std::endl;
242 double Nimpwt =
dk2nu->decay.nimpwt;
243 int Ntype =
dk2nu->decay.ntype;
244 int Nancestors =
dk2nu->ancestor.size();
245 double fardetwt =
dk2nu->nuray[2].wgt;
247 h_fluxfardet->Fill(
dk2nu->nuray[2].E,Nimpwt*fardetwt);
249 if(
dk2nu->decay.vz>z-100 &&
dk2nu->decay.vz<z+100) {
250 h_vxy_all->Fill(
dk2nu->decay.vx,
dk2nu->decay.vy,Nimpwt);
251 h_vxy->Fill(
dk2nu->decay.vx,
dk2nu->decay.vy,Nimpwt*fardetwt);
252 h_vx->Fill(
dk2nu->decay.vx,Nimpwt*fardetwt);
253 h_vy->Fill(
dk2nu->decay.vy,Nimpwt*fardetwt);
255 if(
dk2nu->nuray[2].E > 0.5 &&
256 dk2nu->nuray[2].E < 4.0 &&
257 dk2nu->decay.ntype==14) {
258 h_vxy_peak->Fill(
dk2nu->decay.vx,
dk2nu->decay.vy,Nimpwt*fardetwt);
259 h_vx_peak->Fill(
dk2nu->decay.vx,Nimpwt*fardetwt);
260 h_vy_peak->Fill(
dk2nu->decay.vy,Nimpwt*fardetwt);
264 for(
int i = 0;
i<Nancestors;
i++) {
266 if(
dk2nu->ancestor[
i].pdg == 12 ||
267 dk2nu->ancestor[
i].pdg == -12 ||
268 dk2nu->ancestor[
i].pdg == 14 ||
269 dk2nu->ancestor[
i].pdg == -14)
273 if(
dk2nu->ancestor[
i].startz <= z &&
274 (
i+1 == Nancestors ||
dk2nu->ancestor[
i+1].startz>z)) {
275 double projx =
dk2nu->ancestor[
i+1].startx - ((
dk2nu->ancestor[
i+1].startz-
z)*
dk2nu->ancestor[
i].stoppx/
dk2nu->ancestor[
i].stoppz);
276 double projy =
dk2nu->ancestor[
i+1].starty - ((
dk2nu->ancestor[
i+1].startz-
z)*
dk2nu->ancestor[
i].stoppy/
dk2nu->ancestor[
i].stoppz);
277 h2_all->Fill(projx,projy,Nimpwt);
278 h2_fardet->Fill(projx,projy,Nimpwt*fardetwt*1);
279 hx_fardet->Fill(projx,Nimpwt*fardetwt*1);
280 hy_fardet->Fill(projy,Nimpwt*fardetwt*1);
282 if(
dk2nu->nuray[2].E > 0.5 &&
283 dk2nu->nuray[2].E < 4.0 &&
284 dk2nu->decay.ntype==14) {
285 h2_fardet_peak->Fill(projx,projy,Nimpwt*fardetwt*1);
286 ancestors_tot += Nimpwt*fardetwt;
287 double radius = sqrt(projx*projx+projy*projy);
289 ancestors_10 += Nimpwt*fardetwt;
291 ancestors_20 += Nimpwt*fardetwt;
293 ancestors_30 += Nimpwt*fardetwt;
295 ancestors_40 += Nimpwt*fardetwt;
297 ancestors_50 += Nimpwt*fardetwt;
299 ancestors_60 += Nimpwt*fardetwt;
301 ancestors_70 += Nimpwt*fardetwt;
303 ancestors_77p5 += Nimpwt*fardetwt;
305 ancestors_80 += Nimpwt*fardetwt;
307 ancestors_90 += Nimpwt*fardetwt;
309 ancestors_100 += Nimpwt*fardetwt;
318 std::cout<<
"Total ancestors "<<ancestors_tot<<
std::endl;
319 std::cout<<
"Total within 10 cm "<<ancestors_10/ancestors_tot<<
std::endl;
320 std::cout<<
"Total within 20 cm "<<ancestors_20/ancestors_tot<<
std::endl;
321 std::cout<<
"Total within 30 cm "<<ancestors_30/ancestors_tot<<
std::endl;
322 std::cout<<
"Total within 40 cm "<<ancestors_40/ancestors_tot<<
std::endl;
323 std::cout<<
"Total within 50 cm "<<ancestors_50/ancestors_tot<<
std::endl;
324 std::cout<<
"Total within 60 cm "<<ancestors_60/ancestors_tot<<
std::endl;
325 std::cout<<
"Total within 70 cm "<<ancestors_70/ancestors_tot<<
std::endl;
326 std::cout<<
"Total within 77.5 cm "<<ancestors_77p5/ancestors_tot<<
std::endl;
327 std::cout<<
"Total within 80 cm "<<ancestors_80/ancestors_tot<<
std::endl;
328 std::cout<<
"Total within 90 cm "<<ancestors_90/ancestors_tot<<
std::endl;
329 std::cout<<
"Total within 100 cm "<<ancestors_100/ancestors_tot<<
std::endl;
333 h2_all->SetTitle(
"All Neutrinos");
334 h2_fardet->SetTitle(
"Neutrinos at Far Detector");
335 h2_fardet_peak->SetTitle(
"Peak #nu_#mu neutrinos at Far Detector");
336 h_vxy_all->SetTitle(
"All Neutrino");
337 h_vxy->SetTitle(
"Neutrinos at Far Detector");
338 h_vx->SetTitle(
"Neutrinos at Far Detector");
339 h_vy->SetTitle(
"Neutrinos at Far Detector");
340 h_vxy_peak->SetTitle(
"Peak #nu_#mu neutrinos at Far Detector");
341 h_vx_peak->SetTitle(
"Peak #nu_#mu neutrinos at Far Detector");
342 h_vy_peak->SetTitle(
"Peak #nu_#mu neutrinos at Far Detector");
343 h2_all->GetXaxis()->SetTitle((
"Ancestor X position (cm) at z = "+str_z).c_str());
344 h2_all->GetYaxis()->SetTitle((
"Ancestor Y position (cm) at z = "+str_z).c_str());
345 h2_fardet->GetXaxis()->SetTitle((
"Ancestor X position (cm) at z = "+str_z).c_str());
346 h2_fardet->GetYaxis()->SetTitle((
"Ancestor Y position (cm) at z = "+str_z).c_str());
347 h2_fardet_peak->GetXaxis()->SetTitle((
"Ancestor X position (cm) at z = "+str_z).c_str());
348 h2_fardet_peak->GetYaxis()->SetTitle((
"Ancestor Y position (cm) at z = "+str_z).c_str());
349 h_vxy->GetXaxis()->SetTitle((
"Neutrino parent decay X position (cm) at z = "+str_z).c_str());
350 h_vxy_all->GetXaxis()->SetTitle((
"Neutrino parent decay X position (cm) at z = "+str_z).c_str());
351 h_vx->GetXaxis()->SetTitle((
"Neutrino parent decay X position (cm) at z = "+str_z).c_str());
352 h_vy->GetXaxis()->SetTitle((
"Neutrino parent decay Y position (cm) at z = "+str_z).c_str());
353 h_vxy->GetYaxis()->SetTitle((
"Neutrino parent decay Y postion (cm) at z = "+str_z).c_str());
354 h_vxy_all->GetYaxis()->SetTitle((
"Neutrino parent decay Y postion (cm) at z = "+str_z).c_str());
355 h_vxy_peak->GetXaxis()->SetTitle((
"Neutrino parent decay position (cm) at z = "+str_z).c_str());
356 h_vx_peak->GetXaxis()->SetTitle((
"Neutrino parent decay X position (cm) at z = "+str_z).c_str());
357 h_vy_peak->GetXaxis()->SetTitle((
"Neutrino parent decay Y position at (cm) z = "+str_z).c_str());
358 h_vxy_peak->GetYaxis()->SetTitle((
"Neutrino parent decay postion at (cm) z = "+str_z).c_str());
360 gStyle->SetOptStat(0);
361 gStyle->SetPalette(56);
363 h2_all->SetContour(99);
364 h2_all->Draw(
"COLZ");
365 c->Print(
"Ancestors_Through_Window_AllNu.eps");
366 c->Print(
"Ancestors_Through_Window_AllNu.png");
367 h2_fardet->Draw(
"COLZ");
368 c->Print(
"Ancestors_Through_Window_FarDetNu_2D.eps");
370 h2_fardet_peak->Draw(
"COLZ");
371 c->Print(
"Ancestors_Through_Window_FarDetNuPeak_2D.eps");
374 c->Print(
"Ancestors_Through_Window_FarDetNu_x.eps");
375 c->Print(
"Ancestors_Through_Window_FarDetNu_x.png");
377 c->Print(
"Ancestors_Through_Window_FarDetNu_y.eps");
378 c->Print(
"Ancestors_Through_Window_FarDetNu_y.png");
379 h_fluxfardet->Draw();
380 c->Print(
"Flux_fardet.eps");
381 c->Print(
"Flux_fardet.png");
385 c->Print(
"Decay_Position_Near_Window_FarDetNu_2D.eps");
388 h_vxy_all->Draw(
"COLZ");
389 c->Print(
"Decay_Position_Near_Window_AllNu_2D.eps");
390 c->Print(
"Decay_Position_Near_Window_AllNu_2D.png");
392 h_vxy_peak->Draw(
"COLZ");
393 c->Print(
"Decay_Position_Near_Window_FarDetNuPeak_2D.eps");
397 c->Print(
"Decay_Position_Near_Window_FarDetNu_x.eps");
398 c->Print(
"Decay_Position_Near_Window_FarDetNu_x.eps");
400 c->Print(
"Decay_Position_Near_Window_FarDetNu_y.eps");
401 c->Print(
"Decay_Position_Near_Window_FarDetNu_y.eps");
404 c->Print(
"Decay_Position_Near_Window_FarDetNuPeak_x.eps");
405 c->Print(
"Decay_Position_Near_Window_FarDetNuPeak_x.eps");
407 c->Print(
"Decay_Position_Near_Window_FarDetNuPeak_y.eps");
408 c->Print(
"Decay_Position_Near_Window_FarDetNuPeak_y.eps");
virtual void Init(TTree *tree)
virtual Int_t Cut(Long64_t entry)
virtual Long64_t LoadTree(Long64_t entry)
Int_t fCurrent
pointer to the analyzed TTree or TChain
int main(int argc, char *argv[])
Double_t fTotalPOT
current Tree number in a TChain
virtual void Show(Long64_t entry=-1)
std::string to_string(ModuleType const mt)
virtual Int_t GetEntry(Long64_t entry)
QTextStream & endl(QTextStream &s)