convert_g4minerva.C
Go to the documentation of this file.
1 //
2 // Convert a g4minerva ntuple to the new format
3 //
4 // this script can be run using:
5 // $ root $(DK2NU)/snippets/load_dk2nu.C convert_g4minerva.C("file.root")
6 //
7 // rhatcher@fnal.gov 2012-11-06
8 //====================================================================
9 
10 #include <iostream>
11 #include <iomanip>
12 #include <string>
13 using namespace std;
14 
15 #include "TMath.h"
16 
17 #include "convert/common_convert.C"
18 #include "convert/g4minerva/g4minerva.C"
19 
20 void copy_g4minerva_to_dk2nu(const g4minerva& g4minervaObj);
21 void g4minervaCrossChecks(const g4minerva& g4minervaObj);
22 
23 void convert_g4minerva(string ifname="../fluxfiles/generic_g4minerva.root",
24  int jobnum=42,
25  string dummyloc="",
26  Long64_t maxentries=-1,
27  Long64_t moddump=-1) // modulo for dump
28 {
29  // set globals
30  myjob = jobnum; // allow override because g4minerva files forgot to set this
31  pots = 0;
32  // allowance in location energy/weight cross-check
33  frac_diff_tolerance = 2.5e-4;
34 
35  int highest_potnum = 0;
36 
37  // open input ntuple
38  TFile* fin = TFile::Open(ifname.c_str());
39  if ( ! fin ) {
40  cout << "couldn't open input file: " << ifname << endl;
41  return;
42  }
43  const char* objName = "nudata";
44  TTree* tin = 0;
45  fin->GetObject(objName,tin);
46 
47  if ( ! tin ) {
48  cout << "couldn't find " << objName << endl;
49  return;
50  }
51  cout << endl << "Input file: " << ifname << endl;
52 
53  // use makeclass interface for g4minerva
54  g4minerva g4minervaObj(tin);
55 
56  // construct output filename
57  string ofname = construct_outfilename(ifname);
58  cout << "Output file: " << ofname << endl << endl;
59 
60  ConvertInit();
61  ConvertBookNtuple(ofname);
62 
63  ///
64  /// loop over entries
65  ///
66  Long64_t nentries = g4minervaObj.fChain->GetEntriesFast();
67  if ( maxentries > 0 ) {
68  cout << "limit # of entries to " << nentries
69  << " / " << maxentries << endl;
70  nentries = TMath::Min(nentries,maxentries);
71  }
72  cout << endl;
73 
74  Long64_t nbytes = 0, nb = 0;
75  for (Long64_t jentry = 0; jentry < nentries; ++jentry) {
76  Long64_t ientry = g4minervaObj.LoadTree(jentry);
77  if (ientry < 0) break;
78  nb = g4minervaObj.fChain->GetEntry(jentry);
79  nbytes += nb;
80 
81  // always clear the dk2nu object
82  dk2nu->clear(); // !!! important !!! always do this
83 
84  // fill the dk2nu object from the g4minerva entry
85  copy_g4minerva_to_dk2nu(g4minervaObj);
86 
87  // fill location specific p3, energy and weights
88  // locations to fill are in the metadata
89  // assumes that prior copying filled the first entry w/ random decay
91 
92  // keep track of potnum
93  if ( dk2nu->potnum > highest_potnum )
94  highest_potnum = dk2nu->potnum;
95 
96  // push entry out to tree
97  dk2nuTree->Fill();
98 
99  // just for fun print every n entries
100  if ( moddump > 0 && jentry%moddump == 0 ) cout << endl << *dk2nu << endl;
101 
102  g4minervaCrossChecks(g4minervaObj);
103 
104  }
105  cout << endl;
106 
107  pots = estimate_pots(highest_potnum);
108  cout << "estimated pots " << pots << " (" << highest_potnum << ")" << endl;
109  cout << "maximum observed fractional difference in cross checks: "
110  << obs_frac_diff_max << endl
111  << "print ## message when exceeded " << frac_diff_tolerance << endl;
112 
113  dkmeta->job = myjob;
114  dkmeta->pots = pots;
115  dkmeta->beamsim = "convert_g4minerva.C";
116  dkmeta->physics = "bogus";
117 
118  dkmeta->tgtcfg = TString::Format("Z=%6.1fcm",g4minervaObj.nuTarZ);
119  dkmeta->horncfg = TString::Format("I=%6.1fkA",g4minervaObj.hornCurrent);
120 
121  dkmeta->beam0x = g4minervaObj.beamX;
122  dkmeta->beam0y = g4minervaObj.beamY;
123  dkmeta->beamhwidth = g4minervaObj.beamHWidth;
124  dkmeta->beamvwidth = g4minervaObj.beamVWidth;
125 
126  // print last entries
127  cout << endl << "========== last entries" << endl << endl;
128  cout << *dk2nu << endl << endl;
129  cout << *dkmeta << endl;
130 
131  // finish off ntuples (including meta data)
132  ConvertFinish();
133 
134  // close input file
135  fin->Close();
136 }
137 
138 void copy_g4minerva_to_dk2nu(const g4minerva& g4minervaObj)
139 {
140  // fill the global dk2nu object
141 
142  dk2nu->job = myjob;
143  dk2nu->potnum = g4minervaObj.evtno;
144 
145  // calcLocationWeights needs random decay entries filled first
146  // but don't copy any other (i.e. near/far) values as they'll
147  // be recalculated for the whole set of locations
148  double pzrndm = g4minervaObj.Npz;
149  double pxrndm = g4minervaObj.Ndxdz * pzrndm;
150  double pyrndm = g4minervaObj.Ndydz * pzrndm;
151  bsim::NuRay nuray(pxrndm,pyrndm,pzrndm,g4minervaObj.Nenergy,1.0);
152  dk2nu->nuray.push_back(nuray);
153 
154  // calcLocationWeights needs these filled if it isn't going assert()
155  // really need to fill the other bits at this point as well:
156  // ntype, ptype, vx, vy, vz, pdpx, pdpy, pdpz, necm,
157  // ppenergy, ppdxdz, ppdydz, pppz,
158  // muparpx, muparpy, muparpz, mupare
159 
160  dk2nu->decay.norig = g4minervaObj.Norig;
161  dk2nu->decay.ndecay = g4minervaObj.Ndecay;
162  dk2nu->decay.ntype = Convert5xToPdg(g4minervaObj.Ntype);
163  dk2nu->decay.vx = g4minervaObj.Vx;
164  dk2nu->decay.vy = g4minervaObj.Vy;
165  dk2nu->decay.vz = g4minervaObj.Vz;
166  dk2nu->decay.pdpx = g4minervaObj.pdPx;
167  dk2nu->decay.pdpy = g4minervaObj.pdPy;
168  dk2nu->decay.pdpz = g4minervaObj.pdPz;
169  dk2nu->decay.ppdxdz = g4minervaObj.ppdxdz;
170  dk2nu->decay.ppdydz = g4minervaObj.ppdydz;
171  dk2nu->decay.pppz = g4minervaObj.pppz;
172  dk2nu->decay.ppenergy = g4minervaObj.ppenergy;
173  dk2nu->decay.ppmedium = g4minervaObj.ppmedium;
174  dk2nu->decay.ptype = ConvertGeantToPdg(g4minervaObj.ptype,"ptype");
175  dk2nu->decay.muparpx = g4minervaObj.muparpx;
176  dk2nu->decay.muparpy = g4minervaObj.muparpy;
177  dk2nu->decay.muparpz = g4minervaObj.muparpz;
178  dk2nu->decay.mupare = g4minervaObj.mupare;
179 
180  dk2nu->decay.necm = g4minervaObj.Necm;
181  dk2nu->decay.nimpwt = g4minervaObj.Nimpwt;
182 
183  dk2nu->ppvx = g4minervaObj.ppvx;
184  dk2nu->ppvy = g4minervaObj.ppvy;
185  dk2nu->ppvz = g4minervaObj.ppvz;
186 
187  //not-in-new//dk2nu->xpoint = g4minervaObj.xpoint;
188  //not-in-new//dk2nu->ypoint = g4minervaObj.ypoint;
189  //not-in-new//dk2nu->zpoint = g4minervaObj.zpoint;
190 
191  dk2nu->tgtexit.tvx = g4minervaObj.tvx;
192  dk2nu->tgtexit.tvy = g4minervaObj.tvy;
193  dk2nu->tgtexit.tvz = g4minervaObj.tvz;
194  dk2nu->tgtexit.tpx = g4minervaObj.tpx;
195  dk2nu->tgtexit.tpy = g4minervaObj.tpy;
196  dk2nu->tgtexit.tpz = g4minervaObj.tpz;
197  dk2nu->tgtexit.tptype = ConvertGeantToPdg(g4minervaObj.tptype,"tptype");
198  dk2nu->tgtexit.tgen = g4minervaObj.tgen;
199 
200  //no-equiv// dk2nu->tgptype = ConvertGeantToPdg(g4minervaObj.tgptype,"tgptype");
201  //no-equiv// dk2nu->tgppx = g4minervaObj.tgppx;
202  //no-equiv// dk2nu->tgppy = g4minervaObj.tgppy;
203  //no-equiv// dk2nu->tgppz = g4minervaObj.tgppz;
204  //no-equiv// dk2nu->tprivx = g4minervaObj.tprivx;
205  //no-equiv// dk2nu->tprivy = g4minervaObj.tprivy;
206  //no-equiv// dk2nu->tprivz = g4minervaObj.tprivz;
207 
208  //not-in-new//dk2nu->beamx = g4minervaObj.protonX;
209  //not-in-new//dk2nu->beamy = g4minervaObj.protonY;
210  //not-in-new//dk2nu->beamz = g4minervaObj.protonZ;
211  //not-in-new//dk2nu->beampx = g4minervaObj.protonPx;
212  //not-in-new//dk2nu->beampy = g4minervaObj.protonPy;
213  //not-in-new//dk2nu->beampz = g4minervaObj.protonPz;
214 
215  //no-equiv// dk2nu->tgptype = g4minervaObj.tgptype;
216 
217  // now copy ancestor history
218  if ( g4minervaObj.overflow ) dk2nu->flagbits |= bsim::kFlgOverflow; // flag overflow
219  int nmx = TMath::Min(g4minervaObj.ntrajectory,10);
220  for (int ian=0; ian < nmx; ++ian) {
221 
222  const double mm2cm = 0.1;
223  const double mev2gev = 0.001;
224 
226  /*
227  dk2nu->apdg.push_back(g4minervaObj.pdg[ian]);
228  dk2nu->trackid.push_back(g4minervaObj.trackId[ian]);
229  dk2nu->parentid.push_back(g4minervaObj.parentId[ian]);
230 
231  dk2nu->startx.push_back(g4minervaObj.startx[ian]*mm2cm);
232  dk2nu->starty.push_back(g4minervaObj.starty[ian]*mm2cm);
233  dk2nu->startz.push_back(g4minervaObj.startz[ian]*mm2cm);
234  dk2nu->stopx.push_back(g4minervaObj.stopx[ian]*mm2cm);
235  dk2nu->stopy.push_back(g4minervaObj.stopy[ian]*mm2cm);
236  dk2nu->stopz.push_back(g4minervaObj.stopz[ian]*mm2cm);
237 
238  dk2nu->startpx.push_back(g4minervaObj.startpx[ian]*mev2gev);
239  dk2nu->startpy.push_back(g4minervaObj.startpy[ian]*mev2gev);
240  dk2nu->startpz.push_back(g4minervaObj.startpz[ian]*mev2gev);
241  dk2nu->stoppx.push_back(g4minervaObj.stoppx[ian]*mev2gev);
242  dk2nu->stoppy.push_back(g4minervaObj.stoppy[ian]*mev2gev);
243  dk2nu->stoppz.push_back(g4minervaObj.stoppz[ian]*mev2gev);
244 
245  dk2nu->pprodpx.push_back(g4minervaObj.pprodpx[ian]*mev2gev);
246  dk2nu->pprodpy.push_back(g4minervaObj.pprodpy[ian]*mev2gev);
247  dk2nu->pprodpz.push_back(g4minervaObj.pprodpz[ian]*mev2gev);
248 
249  // TString -> std::string via char*
250  dk2nu->proc.push_back(g4minervaObj.proc[ian].Data());
251  dk2nu->ivol.push_back(g4minervaObj.ivol[ian].Data());
252  dk2nu->fvol.push_back(g4minervaObj.fvol[ian].Data());
253  */
254 
255  ancestor.pdg = g4minervaObj.pdg[ian];
256  ancestor.SetStartXYZT(g4minervaObj.startx[ian]*mm2cm,
257  g4minervaObj.starty[ian]*mm2cm,
258  g4minervaObj.startz[ian]*mm2cm,
259  0); // don't have a time
260  ancestor.SetStartP(g4minervaObj.startpx[ian]*mev2gev,
261  g4minervaObj.startpy[ian]*mev2gev,
262  g4minervaObj.startpz[ian]*mev2gev);
263  ancestor.SetStopP(g4minervaObj.stoppx[ian]*mev2gev,
264  g4minervaObj.stoppy[ian]*mev2gev,
265  g4minervaObj.stoppz[ian]*mev2gev);
266  ancestor.SetPProdP(g4minervaObj.pprodpx[ian]*mev2gev,
267  g4minervaObj.pprodpy[ian]*mev2gev,
268  g4minervaObj.pprodpz[ian]*mev2gev);
269 
270  // ancestor.polx = ancestor.poly = ancestor.polz = ?
271  // ancestor.nucleau = ?
272  ancestor.proc = g4minervaObj.proc[ian].Data();
273  ancestor.ivol = g4minervaObj.ivol[ian].Data();
274  // ancestor.imat = g4minervaObj.imat[ian].Data();
275 
276  dk2nu->ancestor.push_back(ancestor);
277  }
278 
279 }
280 
281 void g4minervaCrossChecks(const g4minerva& g4minervaObj)
282 {
283 
284  static bool first = true;
285  static size_t indxMinosN = -1, indxMinosF = -1, indxNovaF = -1, indxMini = -1;
286  static size_t ioldMinosN = 0, ioldMinosF = 0, ioldNovaF = 1, ioldMini = 8;
287  if ( first ) {
288  first = false;
289  /// find indices for new weights so we can compare later
290  indxMinosN = find_loc_index("MINOS NearDet");
291  indxMinosF = find_loc_index("MINOS FarDet");
292  //indxNovaF = find_loc_index("NOvA FarDet");
293  indxNovaF = find_loc_index("Ash River per Minerva");
294  indxMini = find_loc_index("MiniBooNE");
295  cout << "indx MINOS Near " << indxMinosN << " Far " << indxMinosF << endl;
296  cout << "indx NOvA Far " << indxNovaF << endl;
297  cout << "indx MiniBooNE " << indxMini << endl;
298 
299  /**** minerva g4numi/src/NumiDataInput.cc
300  * RWH: these appear to be in meters ... not sure about what
301  * the "NovaX" are meant to represent
302  *
303  //Near & Far Detector location
304  nNear=11;//was 9 without the different energy for the ND positions.
305  nFar=2;
306  G4double xdetNear[] = { 0 , 0. , 7. , 11. ,
307  14. , 14. , 14. , 0. ,
308  25.84 , 4.8/2. , -4.8/2. };
309  G4double ydetNear[] = { 0 , -3. , -5. , -5. ,
310  -6. , -3. , 0. , 71. ,
311  78.42 , 3.8/2. , -3.8/2. };
312  G4double zdetNear[] = { 1040 , 1010. , 975. , 958. ,
313  940. , 840. , 740. , 940. ,
314  745.25 , 1040+16.6/2. , 1040-16.6/2. };
315  G4String detNameNear[] = { "Near", "Nova1a","Nova1b","Nova1c",
316  "Nova2a", "Nova2b", "Nova3","MSB",
317  "MiniBooNE","Near +x +y +z","Near -x -y -z"};
318  G4double xdetFar[] = {0 , 28.81258 };
319  G4double ydetFar[] = {0 , 81.39258 };
320  G4double zdetFar[] = {735000, 811400 };
321  G4String detNameFar[] = {"Far" , "Ash River"};
322  *
323  */
324  }
325  // cross check location energy/weights
326  //
327  histCompare(g4minervaObj.NenergyN[ioldMinosN],dk2nu->nuray[indxMinosN].E, "MINOS near energy");
328  histCompare(g4minervaObj.NWtNear[ioldMinosN], dk2nu->nuray[indxMinosN].wgt, "MINOS near wgt");
329  histCompare(g4minervaObj.NenergyF[ioldMinosF],dk2nu->nuray[indxMinosF].E, "MINOS far energy");
330  histCompare(g4minervaObj.NWtFar[ioldMinosF], dk2nu->nuray[indxMinosF].wgt, "MINOS far wgt");
331  if ( indxNovaF > 0 ) {
332  histCompare(g4minervaObj.NenergyF[ioldNovaF], dk2nu->nuray[indxNovaF].E, "NOvA far energy");
333  histCompare(g4minervaObj.NWtFar[ioldNovaF], dk2nu->nuray[indxNovaF].wgt, "NOvA far wgt");
334  } else {
335  static int nmsgnovaf = 10;
336  if ( nmsgnovaf-- > 0 ) {
337  cout << "## no relevant index for NOvA FarDet that will match minerva version of location" << endl;
338  }
339  }
340  histCompare(g4minervaObj.NenergyN[ioldMini], dk2nu->nuray[indxMini].E, "MiniBooNE energy");
341  histCompare(g4minervaObj.NWtNear[ioldMini], dk2nu->nuray[indxMini].wgt, "MiniBooNE wgt");
342 
343  static int nmsg = 0;
344  double a = g4minervaObj.NWtNear[ioldMini];
345  double b = dk2nu->nuray[indxMini].wgt;
346  double myfdiff = ( (a+b) > 1.0e-30 ) ? TMath::Abs(2.0*(a-b)/(a+b)) : 0;
347  if ( (nmsg < 1) && (myfdiff > 1.8) ) {
348  ++nmsg;
349  cout << "#### extreme case: mini wtg " << a << " " << b << " fdiff " << myfdiff << endl;
350  cout << "## g4 MinosN=" << ioldMinosN << " MinosF=" << ioldMinosF << " NovaF=" << ioldNovaF << " MiniBooNE=" << ioldMini << endl;
351  cout << "g4minerva NenergyN ";
352  for (int i=0; i<11; ++i) cout << ((i!=0&&i%4==0)?"\n ":" ")
353  << std::setw(12) << g4minervaObj.NenergyN[i];
354  cout << endl;
355  cout << "g4minerva NWtNear ";
356  for (int i=0; i<11; ++i) cout << ((i!=0&&i%4==0)?"\n ":" ")
357  << std::setw(12) << g4minervaObj.NWtNear[i];
358  cout << endl;
359  cout << "g4minerva NenergyF ";
360  for (int i=0; i<2; ++i) cout << " " << std::setw(12) << g4minervaObj.NenergyF[i];
361  cout << endl;
362  cout << "g4minerva NWtFar ";
363  for (int i=0; i<2; ++i) cout << " " << std::setw(12) << g4minervaObj.NWtFar[i];
364  cout << endl;
365  cout << "## dk MinosN=" << indxMinosN << " MinosF=" << indxMinosF << " NovaF=" << indxNovaF << " MiniBooNE=" << indxMini << endl;
366  cout << *dk2nu << endl;
367  }
368 
369  int nmx = TMath::Min(g4minervaObj.ntrajectory,10);
370  for (int ian=0; ian < nmx; ++ian) {
371  if ( ian <= 0 ) continue;
372  // except for first particle start[i] should == stop[i-1]
373  bool match = true;
374  match = match && ( histCompare(g4minervaObj.startx[ian],g4minervaObj.stopx[ian-1],"startx") );
375  match = match && ( histCompare(g4minervaObj.starty[ian],g4minervaObj.stopy[ian-1],"starty") );
376  match = match && ( histCompare(g4minervaObj.startz[ian],g4minervaObj.stopz[ian-1],"startz") );
377  match = match && ( g4minervaObj.ivol[ian] == g4minervaObj.fvol[ian-1] );
378  if ( ! match ) {
379  cout << "## ancestor " << ian << " didn't start where previous entry stopped" << endl;
380  }
381 
382  }
383 
384 }
385 
Double_t ppvx
Definition: g4minerva.h:67
Double_t stopx[10]
Definition: g4minerva.h:95
TString fin
Definition: Style.C:24
Double_t ppdydz
% direction of nu parent at its production point
Definition: dk2nu.h:139
Double_t muparpx
%
Definition: dk2nu.h:160
Double_t pppz
Definition: g4minerva.h:63
Double_t ppdydz
Definition: g4minerva.h:62
Double_t pdPx
Definition: g4minerva.h:58
Int_t job
identifying job #
Definition: dk2nu.h:323
Double_t pprodpx[10]
Definition: g4minerva.h:104
Double_t pdPz
Definition: g4minerva.h:60
Int_t tptype
Definition: g4minerva.h:85
Double_t pppz
% z momentum of nu parent at its production point
Definition: dk2nu.h:140
TString proc[10]
Definition: g4minerva.h:107
void SetStopP(Double_t px, Double_t py, Double_t pz)
TTree * dk2nuTree
std::string ivol
name of the volume where the particle starts
Definition: dk2nu.h:225
Double_t stopz[10]
Definition: g4minerva.h:97
Double_t pdpx
% px momentum of nu parent at (vx,vy,vz)
Definition: dk2nu.h:133
void clear(const std::string &opt="")
reset everything
Double_t stopy[10]
Definition: g4minerva.h:96
std::vector< bsim::NuRay > nuray
rays through detector fixed points
Definition: dk2nu.h:328
Double_t muparpy
Definition: g4minerva.h:71
Double_t muparpx
Definition: g4minerva.h:70
Double_t beamVWidth
Definition: g4minerva.h:29
Double_t ppdxdz
Definition: g4minerva.h:61
Int_t potnum
proton # processed by simulation
Definition: dk2nu.h:324
std::string proc
name of the process that creates this particle
Definition: dk2nu.h:224
int pots
Double_t beamvwidth
vertical width of beam
Definition: dkmeta.h:110
Int_t tgen
Definition: dk2nu.h:276
Double_t starty[10]
Definition: g4minerva.h:93
Double_t nimpwt
% cumulative importance weight prod to decay
Definition: dk2nu.h:166
Bool_t overflow
Definition: g4minerva.h:88
Double_t muparpz
Definition: g4minerva.h:72
Double_t beamhwidth
horizontal width of beam
Definition: dkmeta.h:109
Int_t Ntype
Definition: g4minerva.h:54
Double_t tvz
Definition: g4minerva.h:81
Double_t necm
% nu energy in center-of-mass frame
Definition: dk2nu.h:165
double estimate_pots(int highest_potnum)
bsim::Decay decay
basic decay information
Definition: dk2nu.h:327
int myjob
Double_t ppvz
production vertex z of nu parent
Definition: dk2nu.h:336
Double_t mupare
Definition: g4minerva.h:73
int ConvertGeantToPdg(int geant_code, std::string tag="?")
Double_t tvy
y position of nu ancestor as it exits target
Definition: dk2nu.h:270
Double_t Ndydz
Definition: g4minerva.h:41
string construct_outfilename(string infilename)
TString ivol[10]
Definition: g4minerva.h:108
Double_t Ndxdz
Definition: g4minerva.h:40
Int_t job
identifying job # (keep files distinct)
Definition: dkmeta.h:86
void SetStartXYZT(Double_t x, Double_t y, Double_t z, Double_t t)
set triplets
bsim::Dk2Nu * dk2nu
Double_t ppdxdz
% direction of nu parent at its production point
Definition: dk2nu.h:138
Double_t ppvy
production vertex y of nu parent
Definition: dk2nu.h:335
Double_t vz
% neutrino production vertex z
Definition: dk2nu.h:132
Double_t beamX
Definition: g4minerva.h:30
bsim::TgtExit tgtexit
info about leaving the target
Definition: dk2nu.h:338
TString fvol[10]
Definition: g4minerva.h:109
Double_t beam0y
y of beam center at start
Definition: dkmeta.h:107
Double_t pots
protons-on-target
Definition: dkmeta.h:87
Int_t ntrajectory
Definition: g4minerva.h:87
std::string tgtcfg
target config e.g. "minos/epoch3/-10cm"
Definition: dkmeta.h:98
Int_t tptype
species of ancestor exiting the target
Definition: dk2nu.h:275
Double_t startpx[10]
Definition: g4minerva.h:98
Int_t pdg
ancestor species
Definition: dk2nu.h:188
void ConvertFinish()
Double_t Npz
Definition: g4minerva.h:42
Int_t tgen
Definition: g4minerva.h:86
Double_t startpy[10]
Definition: g4minerva.h:99
double frac_diff_tolerance
Double_t Vx
Definition: g4minerva.h:55
Double_t pdpz
% pz momentum of nu parent at (vx,vy,vz)
Definition: dk2nu.h:135
Double_t muparpy
%
Definition: dk2nu.h:161
Double_t Vz
Definition: g4minerva.h:57
Double_t ppvx
production vertex x of nu parent
Definition: dk2nu.h:334
Double_t muparpz
%
Definition: dk2nu.h:162
Double_t ppenergy
Definition: g4minerva.h:64
Double_t stoppx[10]
Definition: g4minerva.h:101
Double_t tpz
z momentum of nu ancestor as it exits target
Definition: dk2nu.h:274
Double_t startx[10]
Definition: g4minerva.h:92
Long64_t nentries
void SetStartP(Double_t px, Double_t py, Double_t pz)
std::string physics
e.g. "fluka08", "g4.9.3p01"
Definition: dkmeta.h:96
Int_t evtno
Definition: g4minerva.h:27
Double_t ppenergy
% energy of nu parent at its production point
Definition: dk2nu.h:141
const double a
Double_t nuTarZ
Definition: g4minerva.h:38
Double_t NenergyF[2]
Definition: g4minerva.h:50
std::string beamsim
e.g. "flugg" or "g4numi/<tag>"
Definition: dkmeta.h:95
Double_t beamY
Definition: g4minerva.h:31
Double_t ppmedium
Definition: g4minerva.h:65
Double_t tpy
y momentum of nu ancestor as it exits target
Definition: dk2nu.h:273
Int_t ntype
% neutrino flavor (PDG? code)
Definition: dk2nu.h:128
Double_t Vy
Definition: g4minerva.h:56
Double_t startpz[10]
Definition: g4minerva.h:100
Double_t NWtNear[11]
Definition: g4minerva.h:47
void ConvertBookNtuple(std::string ofname="test_dk2nu.root")
double obs_frac_diff_max
Double_t tpz
Definition: g4minerva.h:84
Int_t Norig
Definition: g4minerva.h:52
void g4minervaCrossChecks(const g4minerva &g4minervaObj)
Double_t Necm
Definition: g4minerva.h:74
Double_t NWtFar[2]
Definition: g4minerva.h:51
OStream cout
Definition: OStream.cxx:6
Double_t stoppy[10]
Definition: g4minerva.h:102
Double_t Nenergy
Definition: g4minerva.h:43
Double_t ppvy
Definition: g4minerva.h:68
Double_t pprodpz[10]
Definition: g4minerva.h:106
void SetPProdP(Double_t px, Double_t py, Double_t pz)
Double_t pprodpy[10]
Definition: g4minerva.h:105
std::string horncfg
horn config e.g. "FHC/185A/LE/h1xoff=1mm"
Definition: dkmeta.h:99
void convert_g4minerva(string ifname="../fluxfiles/generic_g4minerva.root", int jobnum=42, string dummyloc="", Long64_t maxentries=-1, Long64_t moddump=-1)
Double_t tvz
z position of nu ancestor as it exits target
Definition: dk2nu.h:271
Int_t ptype
Definition: g4minerva.h:66
bool histCompare(double a, double b, string s)
bsim::DkMeta * dkmeta
Double_t beam0x
x of beam center at start
Definition: dkmeta.h:106
Long64_t nbytes
Double_t hornCurrent
Definition: g4minerva.h:39
Int_t pdg[10]
Definition: g4minerva.h:89
int Convert5xToPdg(int old_ntype)
size_t find_loc_index(string match)
Double_t stoppz[10]
Definition: g4minerva.h:103
Double_t tpx
x momentum of nu ancestor as it exits target
Definition: dk2nu.h:272
const hit & b
Definition: hits.cxx:21
Double_t vx
% neutrino production vertex x
Definition: dk2nu.h:130
Double_t tvy
Definition: g4minerva.h:80
void calcLocationWeights(const bsim::DkMeta *dkmeta, bsim::Dk2Nu *dk2nu)
user interface
Int_t ndecay
decay process (see dkproc_t)
Definition: dk2nu.h:127
Double_t startz[10]
Definition: g4minerva.h:94
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
virtual Long64_t LoadTree(Long64_t entry)
Double_t mupare
% energy of nu grandparent
Definition: dk2nu.h:163
Double_t vy
% neutrino production vertex y
Definition: dk2nu.h:131
Double_t NenergyN[11]
Definition: g4minerva.h:46
Double_t tpy
Definition: g4minerva.h:83
static const double nb
Definition: Units.h:89
Double_t tpx
Definition: g4minerva.h:82
Int_t flagbits
Definition: dk2nu.h:345
Float_t e
Definition: plot.C:35
Int_t norig
not used?
Definition: dk2nu.h:126
void copy_g4minerva_to_dk2nu(const g4minerva &g4minervaObj)
Int_t ppmedium
material nu parent was produced in
Definition: dk2nu.h:143
Double_t beamHWidth
Definition: g4minerva.h:28
Double_t tvx
Definition: g4minerva.h:79
Double_t tvx
x position of nu ancestor as it exits target
Definition: dk2nu.h:269
Double_t Nimpwt
Definition: g4minerva.h:75
Double_t pdPy
Definition: g4minerva.h:59
std::vector< bsim::Ancestor > ancestor
chain from proton to neutrino
Definition: dk2nu.h:329
Double_t pdpy
% py momentum of nu parent at (vx,vy,vz)
Definition: dk2nu.h:134
Definition: nuray.py:1
Int_t ptype
% nu parent species (PDG? code)
Definition: dk2nu.h:144
TTree * fChain
Definition: g4minerva.h:21
Double_t ppvz
Definition: g4minerva.h:69
void ConvertInit(std::string locfilename="$(DK2NU)/etc/locations.txt")
Int_t Ndecay
Definition: g4minerva.h:53