GSimpleNtpFlux.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Robert Hatcher <rhatcher@fnal.gov>
8  Fermi National Accelerator Laboratory
9 
10  For the class documentation see the corresponding header file.
11 
12  @ Feb 22, 2011 - JD
13  Implemented dummy versions of the new GFluxI::Clear, GFluxI::Index and
14  GFluxI::GenerateWeighted methods needed for pre-generation of flux
15  interaction probabilities in GMCJDriver.
16  @ Mar 14, 2014 - TD
17  Prevent an infinite loop in GenerateNext() when the flux driver has not been
18  properly configured by exiting within GenerateNext_weighted().
19 
20 */
21 //____________________________________________________________________________
22 
23 #include <cstdlib>
24 #include <fstream>
25 #include <sstream>
26 #include <cassert>
27 #include <limits.h>
28 #include <algorithm>
29 
30 #include <TFile.h>
31 #include <TChain.h>
32 #include <TChainElement.h>
33 #include <TSystem.h>
34 #include <TStopwatch.h>
35 
38 
40 
49 
50 using std::endl;
51 
52 #include <vector>
53 #include <algorithm>
54 #include <iomanip>
55 #include "TRegexp.h"
56 #include "TString.h"
57 
60 
61 //#define __GENIE_LOW_LEVEL_MESG_ENABLED__
62 // next line won't work for NOvA: ROOT's Error() != DefaultErrorHandler
63 //#define USE_INDEX_FOR_META
64 
65 using namespace genie;
66 using namespace genie::flux;
67 
73 
74 // static storage
75 UInt_t genie::flux::GSimpleNtpMeta::mxfileprint = UINT_MAX;
76 
77 //____________________________________________________________________________
79  GFluxExposureI(genie::flux::kPOTs)
80 {
81  this->Initialize();
82 }
83 //___________________________________________________________________________
84 GSimpleNtpFlux::~GSimpleNtpFlux()
85 {
86  this->CleanUp();
87 }
88 //___________________________________________________________________________
90 {
91  // complete the GFluxExposureI interface
92  return UsedPOTs();
93 }
94 //___________________________________________________________________________
95 long int GSimpleNtpFlux::NFluxNeutrinos(void) const
96 {
97  ///< number of flux neutrinos looped so far
98  return fNNeutrinos;
99 }
100 //___________________________________________________________________________
102 {
103 // Get next (unweighted) flux ntuple entry on the specified detector location
104 //
106  while ( true ) {
107  // Check for end of flux ntuple
108  bool end = this->End();
109  if ( end ) {
110  LOG("Flux", pNOTICE) << "GenerateNext signaled End() ";
111  return false;
112  }
113 
114  // Get next weighted flux ntuple entry
115  bool nextok = this->GenerateNext_weighted();
116  if ( fGenWeighted ) return nextok;
117  if ( ! nextok ) continue;
118  if ( fAlreadyUnwgt ) return true;
119 
120  /* RWH - debug purposes
121  if ( fNCycles == 0 ) {
122  LOG("Flux", pNOTICE)
123  << "Got flux entry: " << fIEntry
124  << " - Cycle: "<< fICycle << "/ infinite";
125  } else {
126  LOG("Flux", pNOTICE)
127  << "Got flux entry: "<< fIEntry
128  << " - Cycle: "<< fICycle << "/"<< fNCycles;
129  }
130  */
131 
132  // Get fractional weight & decide whether to accept curr flux neutrino
133  double f = this->Weight() / fMaxWeight;
134  //LOG("Flux", pNOTICE)
135  // << "Curr flux neutrino fractional weight = " << f;
136  if (f > 1.) {
137  fMaxWeight = this->Weight() * 1.01; // bump the weight
138  LOG("Flux", pERROR)
139  << "** Fractional weight = " << f
140  << " > 1 !! Bump fMaxWeight estimate to " << fMaxWeight
141  << GetCurrentEntry();
142  std::cout << std::flush;
143  }
144  double r = (f < 1.) ? rnd->RndFlux().Rndm() : 0;
145  bool accept = ( r < f );
146  if ( accept ) {
147 
148 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
149  LOG("Flux", pNOTICE)
150  << "Generated beam neutrino: "
151  << "\n pdg-code: " << fCurEntry->pdg
152  << "\n p4: " << utils::print::P4AsShortString(&(fP4))
153  << "\n x4: " << utils::print::X4AsString(&(fX4));
154 #endif
155 
156  fWeight = 1.;
157  return true;
158  }
159 
160  //LOG("Flux", pNOTICE)
161  // << "** Rejecting current flux neutrino based on the flux weight only";
162  }
163  return false;
164 }
165 //___________________________________________________________________________
167 {
168 // Get next (weighted) flux ntuple entry
169 //
170 
171  // Check whether a flux ntuple has been loaded
172  if ( ! fNuFluxTree ) {
173  LOG("Flux", pFATAL)
174  << "The flux driver has not been properly configured";
175  // return false; // don't do this - creates an infinite loop!
176  exit(1);
177  }
178 
179  // Reuse an entry?
180  //std::cout << " ***** iuse " << fIUse << " nuse " << fNUse
181  // << " ientry " << fIEntry << " nentry " << fNEntries
182  // << " icycle " << fICycle << " ncycle " << fNCycles << std::endl;
183  if ( fIUse < fNUse && fIEntry >= 0 ) {
184  // Reuse this entry
185  fIUse++;
186  } else {
187  // Reset previously generated neutrino code / 4-p / 4-x
188  this->ResetCurrent();
189  // Move on, read next flux ntuple entry
190  ++fIEntry;
191  ++fNEntriesUsed; // count total # used
192  if ( fIEntry >= fNEntries ) {
193  // Ran out of entries @ the current cycle of this flux file
194  // Check whether more (or infinite) number of cycles is requested
195  if (fICycle < fNCycles || fNCycles == 0 ) {
196  fICycle++;
197  fIEntry=0;
198  } else {
199  LOG("Flux", pWARN)
200  << "No more entries in input flux neutrino ntuple, cycle "
201  << fICycle << " of " << fNCycles;
202  fEnd = true;
203  //assert(0);
204  return false;
205  }
206  }
207 
208  int nbytes = fNuFluxTree->GetEntry(fIEntry);
209  UInt_t metakey = fCurEntry->metakey;
210  if ( fAllFilesMeta && ( fCurMeta->metakey != metakey ) ) {
211  UInt_t oldkey = fCurMeta->metakey;
212 #ifdef USE_INDEX_FOR_META
213  int nbmeta = fNuMetaTree->GetEntryWithIndex(metakey);
214 #else
215  // unordered indices makes ROOT call Error() which might,
216  // if not DefaultErrorHandler, be fatal.
217  // so find the right one by a simple linear search.
218  // not a large burden since it only happens infrequently and
219  // the list is normally quite short.
220  int nmeta = fNuMetaTree->GetEntries();
221  int nbmeta = 0;
222  for (int imeta = 0; imeta < nmeta; ++imeta ) {
223  nbmeta = fNuMetaTree->GetEntry(imeta);
224  if ( fCurMeta->metakey == metakey ) break;
225  }
226  // next condition should never happen
227  if ( fCurMeta->metakey != metakey ) {
228  fCurMeta = 0; // didn't find it!?
229  LOG("Flux",pERROR) << "Failed to find right metakey=" << metakey
230  << " (was " << oldkey << ") out of " << nmeta
231  << " entries";
232  }
233 #endif
234  LOG("Flux",pDEBUG) << "Get meta " << metakey
235  << " (was " << oldkey << ") "
236  << fCurMeta->metakey
237  << " nb " << nbytes << " " << nbmeta;
238 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
239  LOG("Flux",pDEBUG) << "Get meta " << *fCurMeta;
240 #endif
241  }
242 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
243  Int_t ifile = fNuFluxTree->GetFileNumber();
244  LOG("Flux",pDEBUG)
245  << "got " << fNNeutrinos << " nu, using fIEntry " << fIEntry
246  << " ifile " << ifile << " nbytes " << nbytes
247  << *fCurEntry << *fCurMeta;
248 #endif
249 
250  fIUse = 1;
251 
252  // here we might want to do flavor oscillations or simple mappings
253  //RWH modify: fPdgC = fCurEntry->pdg;
254 
255  // Check neutrino pdg against declared list of neutrino species declared
256  // by the current instance of the NuMI neutrino flux driver.
257  // No undeclared neutrino species will be accepted at this point as GENIE
258  // has already been configured to handle the specified list.
259  // Make sure that the appropriate list of flux neutrino species was set at
260  // initialization via GSimpleNtpFlux::SetFluxParticles(const PDGCodeList &)
261 
262  // update the # POTs, sum of weights & number of neutrinos
263  // do this HERE (before rejecting flavors that users might be weeding out)
264  // in order to keep the POT accounting correct. This allows one to get
265  // the right normalization for generating only events from the intrinsic
266  // nu_e entries.
268  fSumWeight += this->Weight();
269  fNNeutrinos++;
270 
272  /// user might modify list via SetFluxParticles() in order to reject certain
273  /// flavors, even if they're found in the file. So don't make a big fuss.
274  /// Spit out a single message and then stop reporting that flavor as problematic.
275  int badpdg = fCurEntry->pdg;
276  if ( ! fPdgCListRej->ExistsInPDGCodeList(badpdg) ) {
277  fPdgCListRej->push_back(badpdg);
278  LOG("Flux", pWARN)
279  << "Encountered neutrino specie (" << badpdg
280  << ") that wasn't in SetFluxParticles() list, "
281  << "\nDeclared list of neutrino species: " << *fPdgCList;
282  }
283  return false;
284  }
285 
286  }
287 
288  // Update the curr neutrino p4/x4 lorentz vector
289  double Ev = fCurEntry->E;
290  fP4.SetPxPyPzE(fCurEntry->px,fCurEntry->py,fCurEntry->pz,Ev);
291  fX4.SetXYZT(fCurEntry->vtxx,fCurEntry->vtxy,fCurEntry->vtxz,0);
292 
293  fWeight = fCurEntry->wgt;
294 
295  if (Ev > fMaxEv) {
296  LOG("Flux", pWARN)
297  << "Flux neutrino energy exceeds declared maximum neutrino energy"
298  << "\nEv = " << Ev << "(> Ev{max} = " << fMaxEv << ")";
299  }
300 
301  // if desired, move to user specified user coord z
302  if ( TMath::Abs(fZ0) < 1.0e30 ) this->MoveToZ0(fZ0);
303 
304 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
305  LOG("Flux", pINFO)
306  << "Generated neutrino: " << fIEntry
307 #ifdef NOT_YET
308  << " run " << fCurNuMI->evtno
309  << " evtno " << fCurNuMI->evtno
310  << " entryno " << fCurNuMI->entryno
311 #endif
312  << "\n pdg-code: " << fCurEntry->pdg << " wgt " << fCurEntry->wgt
313  << "\n p4: " << utils::print::P4AsShortString(&fP4)
314  << "\n x4: " << utils::print::X4AsString(&fX4);
315 #endif
316  if ( Ev > fMaxEv ) {
317  LOG("Flux", pFATAL)
318  << "Generated neutrino had E_nu = " << Ev << " > " << fMaxEv
319  << " maximum ";
320  assert(0);
321  }
322 
323  return true;
324 }
325 //___________________________________________________________________________
327 {
328  // return distance (user units) between dk point and start position
329  // these are in beam units
330  return fCurEntry->dist;
331 }
332 //___________________________________________________________________________
333 void GSimpleNtpFlux::MoveToZ0(double z0usr)
334 {
335  // move ray origin to specified user z0
336  // move beam coord entry correspondingly
337 
338  double pzusr = fP4.Pz();
339  if ( TMath::Abs(pzusr) < 1.0e-30 ) {
340  // neutrino is moving almost entirely in x-y plane
341  LOG("Flux", pWARN)
342  << "MoveToZ0(" << z0usr << ") not possible due to pz_usr (" << pzusr << ")";
343  return;
344  }
345 
346  double scale = (z0usr - fX4.Z()) / pzusr;
347  //LOG("Flux",pDEBUG)
348  // << "MoveToZ0: before x4=(" << fX4.X() << "," << fX4.Y() << "," << fX4.Z()
349  // << ") z0=" << z0usr << " pzusr=" << pzusr
350  // << " p4=(" << fP4.Px() << "," << fP4.Py() << "," << fP4.Pz() << ")";
351  fX4 += (scale*fP4);
352  //LOG("Flux",pDEBUG)
353  // << "MoveToZ0: after (" << fX4.X() << "," << fX4.Y() << "," << fX4.Z()
354  // << ")";
355 
356  // this scaling works for distances, but not the time component
357  fX4.SetT(0);
358 
359 }
360 
361 //___________________________________________________________________________
363 {
364  // do this if flux window changes or # of files changes
365 
366  if (!fNuFluxTree) return; // not yet fully configured
367 
368  fEffPOTsPerNu = ( (double)fFilePOTs / (double)fNEntries );
369 }
370 
371 //___________________________________________________________________________
372 double GSimpleNtpFlux::UsedPOTs(void) const
373 {
374 // Compute current number of flux POTs
375 
376  if (!fNuFluxTree) {
377  LOG("Flux", pWARN)
378  << "The flux driver has not been properly configured";
379  return 0;
380  }
381  return fAccumPOTs;
382 }
383 
384 //___________________________________________________________________________
385 void GSimpleNtpFlux::LoadBeamSimData(const std::vector<string>& patterns,
386  const std::string& config )
387 {
388 // Loads a beam simulation root file into the GSimpleNtpFlux driver.
389 
390  fNuFluxFilePatterns = patterns;
391  std::vector<int> nfiles_from_pattern;
392 
393  // create a (sorted) set of file names
394  // this also helps ensure that the same file isn't listed multiple times
395  std::set<std::string> fnames;
396 
397  LOG("Flux", pINFO) << "LoadBeamSimData was passed " << patterns.size()
398  << " patterns";
399 
400  for (size_t ipatt = 0; ipatt < patterns.size(); ++ipatt ) {
401  string pattern = patterns[ipatt];
402  nfiles_from_pattern.push_back(0);
403  LOG("Flux", pINFO)
404  << "Loading flux tree from ROOT file pattern ["
405  << std::setw(3) << ipatt << "] \"" << pattern << "\"";
406 
407  // !WILDCARD only works for file name ... NOT directory
408  string dirname = gSystem->UnixPathName(gSystem->WorkingDirectory());
409  size_t slashpos = pattern.find_last_of("/");
410  size_t fbegin;
411  if ( slashpos != std::string::npos ) {
412  dirname = pattern.substr(0,slashpos);
413  LOG("Flux", pDEBUG) << "Look for flux using directory " << dirname;
414  fbegin = slashpos + 1;
415  } else { fbegin = 0; }
416 
417  void* dirp = gSystem->OpenDirectory(gSystem->ExpandPathName(dirname.c_str()));
418  if ( dirp ) {
419  std::string basename =
420  pattern.substr(fbegin,pattern.size()-fbegin);
421  TRegexp re(basename.c_str(),kTRUE);
422  const char* onefile;
423  while ( ( onefile = gSystem->GetDirEntry(dirp) ) ) {
424  TString afile = onefile;
425  if ( afile=="." || afile==".." ) continue;
426  if ( basename!=afile && afile.Index(re) == kNPOS ) continue;
427  std::string fullname = dirname + "/" + afile.Data();
428  fnames.insert(fullname);
429  nfiles_from_pattern[ipatt]++;
430  }
431  gSystem->FreeDirectory(dirp);
432  } // legal directory
433  } // loop over patterns
434 
435  size_t indx = 0;
436  std::set<string>::const_iterator sitr = fnames.begin();
437  for ( ; sitr != fnames.end(); ++sitr, ++indx) {
438  string filename = *sitr;
439  //std::cout << " [" << std::setw(3) << indx << "] \""
440  // << filename << "\"" << std::endl;
441  bool isok = true;
442  // this next test only works for local files, so we can't do that
443  // if we want to stream via xrootd
444  // ! (gSystem->AccessPathName(filename.c_str()));
445  if ( ! isok ) continue;
446  // open the file to see what it contains
447  LOG("Flux", pINFO) << "Load file " << filename;
448 
449  TFile* tf = TFile::Open(filename.c_str(),"READ");
450  TTree* etree = (TTree*)tf->Get("flux");
451  if ( etree ) {
452  TTree* mtree = (TTree*)tf->Get("meta");
453  // add the file to the chain
454  LOG("Flux", pDEBUG) << "AddFile " << filename
455  << " etree " << etree << " meta " << mtree;
456  this->AddFile(etree,mtree,filename);
457 
458  } // found a GSimpleNtpEntry "flux" tree
459  tf->Close();
460  delete tf;
461  } // loop over sorted file names
462 
463  // this will open all files and read headers!!
464  fNEntries = fNuFluxTree->GetEntries();
465 
466  if ( fNEntries == 0 ) {
467  LOG("Flux", pERROR)
468  << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
469  LOG("Flux", pERROR)
470  << "Loaded flux tree contains " << fNEntries << " entries";
471  LOG("Flux", pERROR)
472  << "Was passed the file patterns: ";
473  for (size_t ipatt = 0; ipatt < patterns.size(); ++ipatt ) {
474  string pattern = patterns[ipatt];
475  LOG("Flux", pERROR)
476  << " [" << std::setw(3) << ipatt <<"] " << pattern;
477  }
478  LOG("Flux", pERROR)
479  << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
480  } else {
481  LOG("Flux", pNOTICE)
482  << "Loaded flux tree contains " << fNEntries << " entries"
483  << " from " << fnames.size() << " unique files";
484  for (size_t ipatt = 0; ipatt < patterns.size(); ++ipatt ) {
485  string pattern = patterns[ipatt];
486  LOG("Flux", pINFO)
487  << " pattern: " << pattern << " yielded "
488  << nfiles_from_pattern[ipatt] << " files";
489  }
490  }
491 
492  int sba_status[3] = { -999, -999, -999 };
493  // "entry" branch isn't optional ... contains the neutrino info
494 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
495  sba_status[0] =
496 #endif
497  fNuFluxTree->SetBranchAddress("entry",&fCurEntry);
498 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
499  if ( sba_status[0] < 0 ) {
500  LOG("Flux", pFATAL)
501  << "flux chain has no \"entry\" branch " << sba_status[0];
502  assert(0);
503  }
504 #endif
505  //TBranch* bentry = fNuFluxTree->GetBranch("entry");
506  //bentry->SetAutoDelete(false);
507 
508  if ( OptionalAttachBranch("numi") ) {
509 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
510  sba_status[1] =
511 #endif
512  fNuFluxTree->SetBranchAddress("numi",&fCurNuMI);
513  //TBranch* bnumi = fNuFluxTree->GetBranch("numi");
514  //bnumi->SetAutoDelete(false);
515  } else { delete fCurNuMI; fCurNuMI = 0; }
516 
517  if ( OptionalAttachBranch("aux") ) {
518 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
519  sba_status[2] =
520 #endif
521  fNuFluxTree->SetBranchAddress("aux",&fCurAux);
522  //TBranch* baux = fNuFluxTree->GetBranch("aux");
523  //baux->SetAutoDelete(false);
524  } else { delete fCurAux; fCurAux = 0; }
525 
526  LOG("Flux", pDEBUG)
527  << " SetBranchAddress status: "
528  << " \"entry\"=" << sba_status[0]
529  << " \"numi\"=" << sba_status[1]
530  << " \"aux\"=" << sba_status[2];
531 
532  // attach requested branches
533 
534  if (fMaxWeight<=0) {
535  LOG("Flux", pDEBUG)
536  << "Run ProcessMeta() as part of LoadBeamSimData";
537  this->ProcessMeta();
538  }
539 
540  // current ntuple cycle # (flux ntuples may be recycled)
541  fICycle = 0;
542  // pick a starting entry index [0:fNEntries-1]
543  // pretend we just used up the the previous one
545  fIUse = 9999999;
546  fIEntry = rnd->RndFlux().Integer(fNEntries) - 1;
547  if ( config.find("no-offset-index") != string::npos ) {
548  LOG("Flux",pINFO) << "Config saw \"no-offset-index\"";
549  fIEntry = -1;
550  }
551  LOG("Flux",pINFO) << "Start with entry fIEntry=" << fIEntry;
552 
553  // don't count things we used to estimate max weight
554  fNEntriesUsed = 0;
555  fSumWeight = 0;
556  fNNeutrinos = 0;
557  fAccumPOTs = 0;
558 
559  LOG("Flux",pDEBUG) << "about to CalcEffPOTsPerNu";
560  this->CalcEffPOTsPerNu();
561 
562 }
563 //___________________________________________________________________________
564 void GSimpleNtpFlux::GetBranchInfo(std::vector<std::string>& branchNames,
565  std::vector<std::string>& branchClassNames,
566  std::vector<void**>& branchObjPointers)
567 {
568  // allow flux driver to report back current status and/or ntuple entry
569  // info for possible recording in the output file by supplying
570  // the class name, and a pointer to the object that will be filled
571  // as well as a suggested name for the branch.
572 
573  if ( fCurEntry ) {
574  branchNames.push_back("simple");
575  branchClassNames.push_back("genie::flux::GSimpleNtpEntry");
576  branchObjPointers.push_back((void**)&fCurEntry);
577  }
578 
579  if ( fCurNuMI ) {
580  branchNames.push_back("numi");
581  branchClassNames.push_back("genie::flux::GSimpleNtpNuMI");
582  branchObjPointers.push_back((void**)&fCurNuMI);
583  }
584 
585  if ( fCurAux ) {
586  branchNames.push_back("aux");
587  branchClassNames.push_back("genie::flux::GSimpleNtpAux");
588  branchObjPointers.push_back((void**)&fCurAux);
589  }
590 }
592 
593 //___________________________________________________________________________
595 {
596 
597  fAlreadyUnwgt = false;
598  fFilePOTs = 0;
599  double minwgt = +1.0e10;
600  double maxwgt = -1.0e10;
601  double maxenu = 0.0;
602 
603  // PDGLibrary* pdglib = PDGLibrary::Instance(); // get initialized now
604 
605  if ( fAllFilesMeta ) {
606  fNuMetaTree->SetBranchAddress("meta",&fCurMeta);
607 #ifdef USE_INDEX_FOR_META
608  int nindices = fNuMetaTree->BuildIndex("metakey"); // key used to tie entries to meta data
609  LOG("Flux", pDEBUG) << "ProcessMeta() BuildIndex nindices " << nindices;
610 #endif
611  int nmeta = fNuMetaTree->GetEntries();
612  for (int imeta = 0; imeta < nmeta; ++imeta ) {
613  fNuMetaTree->GetEntry(imeta);
614 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
615  LOG("Flux", pNOTICE) << "ProcessMeta() ifile " << imeta
616  << " (of " << fNFiles
617  << ") " << *fCurMeta;
618 #endif
619  minwgt = TMath::Min(minwgt,fCurMeta->minWgt);
620  maxwgt = TMath::Max(maxwgt,fCurMeta->maxWgt);
621  maxenu = TMath::Max(maxenu,fCurMeta->maxEnergy);
622  fFilePOTs += fCurMeta->protons;
623  for (size_t i = 0; i < fCurMeta->pdglist.size(); ++i)
624  fPdgCList->push_back(fCurMeta->pdglist[i]);
625  }
626  if ( minwgt == 1.0 && maxwgt == 1.0 ) fAlreadyUnwgt = true;
627  fMaxWeight = maxwgt;
628  this->SetMaxEnergy(maxenu);
629 
630  } else {
631  //
632  LOG("Flux", pFATAL) << "ProcessMeta() not all files have metadata";
633  // for now PUNT ... eventually could scan all the entries
634  }
635 
636 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
637  LOG("Flux", pNOTICE) << "ProcessMeta() Maximum flux weight = " << fMaxWeight
638  << ", energy = " << fMaxEv
639  << ", AlreadyUnwgt=" << (fAlreadyUnwgt?"true":"false");
640 #endif
641 
642  fCurMeta->Reset();
643  fIFileNumber = -999;
644 
645 }
646 //___________________________________________________________________________
648 {
649  fMaxEv = TMath::Max(0.,Ev);
650 
651  LOG("Flux", pINFO)
652  << "Declared maximum flux neutrino energy: " << fMaxEv;
653 }
654 //___________________________________________________________________________
655 void GSimpleNtpFlux::SetEntryReuse(long int nuse)
656 {
657 // With nuse > 1 then the same entry in the file is used "nuse" times
658 // before moving on to the next entry in the ntuple
659 
660  fNUse = TMath::Max(1L, nuse);
661 }
662 //___________________________________________________________________________
663 void GSimpleNtpFlux::GetFluxWindow(TVector3& p0, TVector3& p1, TVector3& p2) const
664 {
665  // return flux window points
666 
667  p0 = TVector3(fCurMeta->windowBase[0],
668  fCurMeta->windowBase[1],
669  fCurMeta->windowBase[2]);
670  p1 = p0 + TVector3(fCurMeta->windowDir1[0],
671  fCurMeta->windowDir1[1],
672  fCurMeta->windowDir1[2]);
673  p2 = p0 + TVector3(fCurMeta->windowDir2[0],
674  fCurMeta->windowDir2[1],
675  fCurMeta->windowDir2[2]);
676 
677 }
678 
679 //___________________________________________________________________________
681 {
682  LOG("Flux", pNOTICE) << "CurrentEntry:" << *fCurEntry;
683 }
684 //___________________________________________________________________________
685 void GSimpleNtpFlux::Clear(Option_t * opt)
686 {
687 // Clear the driver state
688 //
689  LOG("Flux", pWARN) << "GSimpleNtpFlux::Clear(" << opt << ") called";
690  // do it in all cases, but EVGDriver/GMCJDriver will pass "CycleHistory"
691 
692  fICycle = 0;
693 
694  fSumWeight = 0;
695  fNNeutrinos = 0;
696  fAccumPOTs = 0;
697 
698 }
699 //___________________________________________________________________________
700 void GSimpleNtpFlux::GenerateWeighted(bool gen_weighted)
701 {
702 // Set whether to generate weighted rays
703 //
704  fGenWeighted = gen_weighted;
705 }
706 //___________________________________________________________________________
708 {
709  LOG("Flux", pINFO) << "Initializing GSimpleNtpFlux driver";
710 
711  fMaxEv = 0;
712  fEnd = false;
713 
715  fCurNuMI = new GSimpleNtpNuMI;
716  fCurAux = new GSimpleNtpAux;
717  fCurMeta = new GSimpleNtpMeta;
718 
719  fCurEntryCopy = 0;
720  fCurNuMICopy = 0;
721  fCurAuxCopy = 0;
722 
723  fNuFluxTree = new TChain("flux");
724  fNuMetaTree = new TChain("meta");
725 
726  //fNuFluxFilePatterns = "";
727  fNuFluxBranchRequest = "entry,numi,aux"; // all branches
728 
729  fNFiles = 0;
730 
731  fNEntries = 0;
732  fIEntry = -1;
733  fIFileNumber = 0;
734  fICycle = 0;
735  fNUse = 1;
736  fIUse = 999999;
737 
738  fFilePOTs = 0;
739 
740  fMaxWeight = -1;
741 
742  fSumWeight = 0;
743  fNNeutrinos = 0;
744  fNEntriesUsed = 0;
745  fEffPOTsPerNu = 0;
746  fAccumPOTs = 0;
747 
748  fGenWeighted = false;
749  fAllFilesMeta = true;
750  fAlreadyUnwgt = false;
751 
752  this->SetDefaults();
753  this->ResetCurrent();
754 }
755 //___________________________________________________________________________
757 {
758 
759 // - Set the default flux neutrino start z position at use flux window
760 // - Set number of cycles to 1
761 
762  LOG("Flux", pINFO) << "Setting default GSimpleNtpFlux driver options";
763 
764  this->SetUpstreamZ (-3.4e38); // way upstream ==> use flux window
765  this->SetNumOfCycles (0);
766  this->SetEntryReuse (1);
767 }
768 //___________________________________________________________________________
770 {
771 // reset running values of neutrino pdg-code, 4-position & 4-momentum
772 // and the input ntuple leaves
773 
774  if (fCurEntry) fCurEntry->Reset();
775  if (fCurNuMI) fCurNuMI->Reset();
776  if (fCurAux) fCurAux->Reset();
777  //allow caching//if (fCurMeta) fCurMeta->Reset();
778 }
779 //___________________________________________________________________________
781 {
782  LOG("Flux", pINFO) << "Cleaning up...";
783 
784  if (fPdgCList) delete fPdgCList;
785  if (fPdgCListRej) delete fPdgCListRej;
786  if (fCurEntry) delete fCurEntry;
787  if (fCurNuMI) delete fCurNuMI;
788  if (fCurAux) delete fCurAux;
789  if (fCurMeta) delete fCurMeta;
790 
791  if (fNuFluxTree) delete fNuFluxTree;
792  if (fNuMetaTree) delete fNuMetaTree;
793 
794  LOG("Flux", pNOTICE)
795  << " flux file cycles: " << fICycle << " of " << fNCycles
796  << ", entry " << fIEntry << " use: " << fIUse << " of " << fNUse;
797 }
798 
799 //___________________________________________________________________________
800 void GSimpleNtpFlux::AddFile(TTree* fluxtree, TTree* metatree, string fname)
801 {
802  // Add a file to the chain
803  if ( ! fluxtree ) return;
804 
805  ULong64_t nentries = fluxtree->GetEntries();
806 
807  int stat = fNuFluxTree->AddFile(fname.c_str());
808  if ( metatree ) fNuMetaTree->AddFile(fname.c_str());
809  else fAllFilesMeta = false;
810 
811  LOG("Flux",pINFO)
812  << "flux->AddFile() of " << nentries
813  << " " << ((metatree)?"[+meta]":"[no-meta]")
814  << " [status=" << stat << "]"
815  << " entries in file: " << fname;
816 
817  if ( stat != 1 ) return;
818 
819  fNFiles++;
820 
821 }
822 
823 //___________________________________________________________________________
824 
826 {
827 
828  if ( fNuFluxBranchRequest.find(name) == string::npos ) {
829  LOG("Flux", pINFO)
830  << "no request for \"" << name <<"\" branch ";
831  return false;
832  }
833 
834  if ( ( fNuFluxTree->GetBranch(name.c_str()) ) ) return true;
835 
836  LOG("Flux", pINFO)
837  << "no \"" << name << "\" branch in the \"flux\" tree";
838  return false;
839 }
840 
841 //___________________________________________________________________________
843 
845 {
846  wgt = 0.;
847  vtxx = 0.;
848  vtxy = 0.;
849  vtxz = 0.;
850  dist = 0.;
851  px = 0.;
852  py = 0.;
853  pz = 0.;
854  E = 0.;
855 
856  pdg = 0;
857  metakey = 0;
858 }
859 
860 void GSimpleNtpEntry::Print(const Option_t* /* opt */ ) const
861 {
862  std::cout << *this << std::endl;
863 }
864 
865 //___________________________________________________________________________
867 
869 {
870  tpx = tpy = tpz = 0.;
871  vx = vy = vz = 0.;
872  pdpx = pdpy = pdpz = 0.;
873  pppx = pppy = pppz = 0.;
874 
875  ndecay = 0;
876  ptype = 0;
877  ppmedium = 0;
878  tptype = 0;
879  run = -1;
880  evtno = -1;
881  entryno = -1;
882 }
883 
884 void GSimpleNtpNuMI::Print(const Option_t* /* opt */ ) const
885 {
886  std::cout << *this << std::endl;
887 }
888 
889 //___________________________________________________________________________
891 
893 {
894  auxint.clear();
895  auxdbl.clear();
896 }
897 
898 void GSimpleNtpAux::Print(const Option_t* /* opt */ ) const
899 {
900  std::cout << *this << std::endl;
901 }
902 
903 //___________________________________________________________________________
904 
905 
907  : TObject() //, nflavors(0), flavor(0)
908 {
909  Reset();
910 }
911 
913 {
914  Reset();
915 }
916 
918 {
919 
920  pdglist.clear();
921  maxEnergy = 0.;
922  minWgt = 0.;
923  maxWgt = 0.;
924  protons = 0.;
925  windowBase[0] = 0.;
926  windowBase[1] = 0.;
927  windowBase[2] = 0.;
928  windowDir1[0] = 0.;
929  windowDir1[1] = 0.;
930  windowDir1[2] = 0.;
931  windowDir2[0] = 0.;
932  windowDir2[1] = 0.;
933  windowDir2[2] = 0.;
934 
935  auxintname.clear();
936  auxdblname.clear();
937  infiles.clear();
938 
939  seed = 0;
940  metakey = 0;
941 }
942 
943 void GSimpleNtpMeta::AddFlavor(Int_t nupdg)
944 {
945  bool found = false;
946  for (size_t i=0; i < pdglist.size(); ++i)
947  if ( pdglist[i] == nupdg) found = true;
948  if ( ! found ) pdglist.push_back(nupdg);
949 
950  /* // OLD fashion array
951  bool found = false;
952  for (int i=0; i < nflavors; ++i) if ( flavor[i] == nupdg ) found = true;
953  if ( ! found ) {
954  Int_t* old_list = flavor;
955  flavor = new Int_t[nflavors+1];
956  for (int i=0; i < nflavors; ++i) flavor[i] = old_list[i];
957  flavor[nflavors] = nupdg;
958  nflavors++;
959  delete [] old_list;
960  }
961  */
962 }
963 
964 void GSimpleNtpMeta::Print(const Option_t* /* opt */ ) const
965 {
966  std::cout << *this << std::endl;
967 }
968 
969 //___________________________________________________________________________
970 
971 
972 namespace genie {
973 namespace flux {
974 
975  ostream & operator << (
976  ostream & stream, const genie::flux::GSimpleNtpEntry & entry)
977  {
978  stream << "\nGSimpleNtpEntry "
979  << " PDG " << entry.pdg
980  << " wgt " << entry.wgt
981  << " ( metakey " << entry.metakey << " )"
982  << "\n vtx [" << entry.vtxx << "," << entry.vtxy << ","
983  << entry.vtxz << "] dist " << entry.dist
984  << "\n p4 [" << entry.px << "," << entry.py << ","
985  << entry.pz << "," << entry.E << "]";
986  return stream;
987  }
988 
989 
990 ostream & operator << (ostream & stream,
991  const genie::flux::GSimpleNtpNuMI & numi)
992 {
993  stream << "\nGSimpleNtpNuMI "
994  << "run " << numi.run
995  << " evtno " << numi.evtno
996  << " entryno " << numi.entryno
997  << "\n ndecay " << numi.ndecay << " ptype " << numi.ptype
998  << "\n tptype " << numi.tptype << " ppmedium " << numi.ppmedium
999  << "\n tp[xyz] [" << numi.tpx << "," << numi.tpy << "," << numi.tpz << "]"
1000  << "\n v[xyz] [" << numi.vx << "," << numi.vy << "," << numi.vz << "]"
1001  << "\n pd[xyz] [" << numi.pdpx << "," << numi.pdpy << "," << numi.pdpz << "]"
1002  << "\n pp[xyz] [" << numi.pppx << "," << numi.pppy << "," << numi.pppz << "]"
1003  ;
1004  return stream;
1005 }
1006 
1007  ostream & operator << (
1008  ostream & stream, const genie::flux::GSimpleNtpAux & aux)
1009  {
1010  stream << "\nGSimpleNtpAux ";
1011  size_t nInt = aux.auxint.size();
1012  stream << "\n ints: ";
1013  for (size_t ijInt=0; ijInt < nInt; ++ijInt)
1014  stream << " " << aux.auxint[ijInt];
1015  size_t nDbl = aux.auxdbl.size();
1016  stream << "\n doubles: ";
1017  for (size_t ijDbl=0; ijDbl < nDbl; ++ijDbl)
1018  stream << " " << aux.auxdbl[ijDbl];
1019 
1020  return stream;
1021  }
1022 
1023  ostream & operator << (
1024  ostream & stream, const genie::flux::GSimpleNtpMeta & meta)
1025  {
1026  size_t nf = meta.pdglist.size();
1027  stream << "\nGSimpleNtpMeta " << nf << " flavors: ";
1028  for (size_t i=0; i<nf; ++i) stream << " " << meta.pdglist[i];
1029 
1030  //stream << "\nGSimpleNtpMeta " << meta.nflavors
1031  // << " flavors: ";
1032  //for (int i=0; i< meta.nflavors; ++i) stream << " " << meta.flavor[i];
1033 
1034  stream << "\n maxEnergy " << meta.maxEnergy
1035  << " min/maxWgt " << meta.minWgt << "/" << meta.maxWgt
1036  << " protons " << meta.protons
1037  << " metakey " << meta.metakey
1038  << "\n windowBase [" << meta.windowBase[0] << ","
1039  << meta.windowBase[1] << "," << meta.windowBase[2] << "]"
1040  << "\n windowDir1 [" << meta.windowDir1[0] << ","
1041  << meta.windowDir1[1] << "," << meta.windowDir1[2] << "]"
1042  << "\n windowDir2 [" << meta.windowDir2[0] << ","
1043  << meta.windowDir2[1] << "," << meta.windowDir2[2] << "]";
1044 
1045  size_t nInt = meta.auxintname.size();
1046  if ( nInt > 0 ) stream << "\n aux ints: ";
1047  for (size_t ijInt=0; ijInt < nInt; ++ijInt)
1048  stream << " " << meta.auxintname[ijInt];
1049 
1050  size_t nDbl = meta.auxdblname.size();
1051  if ( nDbl > 0 ) stream << "\n aux doubles: ";
1052  for (size_t ijDbl=0; ijDbl < nDbl; ++ijDbl)
1053  stream << " " << meta.auxdblname[ijDbl];
1054 
1055  size_t nfiles = meta.infiles.size();
1056  stream << "\n " << nfiles << " input files: ";
1057  UInt_t nprint = TMath::Min(UInt_t(nfiles),
1059  for (UInt_t ifiles=0; ifiles < nprint; ++ifiles)
1060  stream << "\n " << meta.infiles[ifiles];
1061 
1062  stream << "\n input seed: " << meta.seed;
1063 
1064  return stream;
1065  }
1066 
1067 
1068 }//flux
1069 }//genie
1070 
1071 //___________________________________________________________________________
1072 
1074 {
1075 
1076  std::ostringstream s;
1077  PDGCodeList::const_iterator itr = fPdgCList->begin();
1078  for ( ; itr != fPdgCList->end(); ++itr) s << (*itr) << " ";
1079  s << "[rejected: ";
1080  itr = fPdgCListRej->begin();
1081  for ( ; itr != fPdgCListRej->end(); ++itr) s << (*itr) << " ";
1082  s << " ] ";
1083 
1084  std::ostringstream fpattout;
1085  for (size_t i = 0; i < fNuFluxFilePatterns.size(); ++i)
1086  fpattout << "\n [" << std::setw(3) << i << "] " << fNuFluxFilePatterns[i];
1087 
1088  std::ostringstream flistout;
1089  std::vector<std::string> flist = GetFileList();
1090  for (size_t i = 0; i < flist.size(); ++i)
1091  flistout << "\n [" << std::setw(3) << i << "] " << flist[i];
1092 
1093  LOG("Flux", pNOTICE)
1094  << "GSimpleNtpFlux Config:"
1095  << "\n Enu_max " << fMaxEv
1096  << "\n pdg-codes: " << s.str() << "\n "
1097  << "\"flux\" " << fNEntries << " entries, "
1098  << "\"meta\" " << fNFiles << " entries"
1099  << " (FilePOTs " << fFilePOTs << ") in files:"
1100  << flistout.str()
1101  << "\n from file patterns: "
1102  << fpattout.str()
1103  << "\n wgt max=" << fMaxWeight
1104  << "\n Z0 pushback " << fZ0
1105  << "\n used entry " << fIEntry << " " << fIUse << "/" << fNUse
1106  << " times, in " << fICycle << "/" << fNCycles << " cycles"
1107  << "\n SumWeight " << fSumWeight << " for " << fNNeutrinos << " neutrinos"
1108  << " with " << fNEntriesUsed << " entries read"
1109  << "\n EffPOTsPerNu " << fEffPOTsPerNu << " AccumPOTs " << fAccumPOTs
1110  << "\n GenWeighted \"" << (fGenWeighted?"true":"false") << "\""
1111  << " AlreadyUnwgt \"" << (fAlreadyUnwgt?"true":"false") << "\""
1112  << " AllFilesMeta \"" << (fAllFilesMeta?"true":"false") << "\"";
1113 
1114 }
1115 
1116 //___________________________________________________________________________
1117 std::vector<std::string> GSimpleNtpFlux::GetFileList()
1118 {
1119  std::vector<std::string> flist;
1120  TObjArray *fileElements=fNuFluxTree->GetListOfFiles();
1121  TIter next(fileElements);
1122  TChainElement *chEl=0;
1123  while (( chEl=(TChainElement*)next() )) {
1124  flist.push_back(chEl->GetTitle());
1125  }
1126  return flist;
1127 }
1128 
1129 //___________________________________________________________________________
double UsedPOTs(void) const
of protons-on-target used
void GetFluxWindow(TVector3 &p1, TVector3 &p2, TVector3 &p3) const
3 points define a plane in beam coordinate
Double_t E
energy in lab frame
GSimpleNtpAux * fCurAux
current "aux" branch extra info
const XML_Char * name
Definition: expat.h:151
A class for generating concrete GFluxI derived classes based on the factory pattern. This code supplies a CPP macro which allows the classes to self-register and thus no modification of this class is needed in order to expand the list of classes it knows about.
Int_t fIFileNumber
which file for the current entry
void Clear(Option_t *opt)
reset state variables based on opt
virtual long int NFluxNeutrinos() const
of rays generated
std::vector< string > fNuFluxFilePatterns
(potentially wildcarded) path(s)
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:52
long int fNNeutrinos
number of flux neutrinos thrown so far
void AddFile(TTree *fluxtree, TTree *metatree, string fname)
void PrintCurrent(void)
print current entry from leaves
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
GSimpleNtpMeta * fCurMeta
current meta data
#define pERROR
Definition: Messenger.h:60
Double_t pdpx
nu parent momentum at time of decay
void SetEntryReuse(long int nuse=1)
of times to use entry before moving to next
long int fIUse
current # of times an entry has been used
Double_t px
x momentum in lab frame
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
A GENIE flux driver using a simple ntuple format.
double fSumWeight
sum of weights for nus thrown so far
Double_t vtxy
y position in lab frame
Double_t vx
vertex position of hadron/muon decay
Double_t maxEnergy
maximum energy
#define pFATAL
Definition: Messenger.h:57
float vtxx
std::vector< std::string > auxintname
tagname of aux ints associated w/ entry
bool ExistsInPDGCodeList(int pdg_code) const
Definition: config.py:1
string filename
Definition: shutoffs.py:106
Int_t tptype
parent particle type at target exit
bool End(void)
true if no more flux nu&#39;s can be thrown (eg reaching end of beam sim ntuples)
std::vector< Double_t > auxdbl
additional doubles associated w/ entry
Timing fit.
virtual void SetNumOfCycles(long int ncycle)
limit cycling through input files
Double_t windowDir1[3]
dx,dy,dz of window direction 1
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
std::vector< Int_t > auxint
additional ints associated w/ entry
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.C:184
Loaders::FluxType flux
virtual TTree * GetMetaDataTree()
void Print(const Option_t *opt="") const
Double_t protons
represented number of protons-on-target
void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
Int_t seed
random seed used in generation
double dist
Definition: runWimpSim.h:113
void MoveToZ0(double z0)
move ray origin to user coord Z0
virtual void SetUpstreamZ(double z0)
Double_t windowDir2[3]
dx,dy,dz of window direction 2
const genie::flux::GSimpleNtpEntry * GetCurrentEntry(void)
GSimpleNtpEntry.
const XML_Char * s
Definition: expat.h:262
Double_t pppx
nu parent momentum at production point
Double_t scale
Definition: plot.C:25
std::vector< Int_t > pdglist
list of neutrino flavors
void ProcessMeta(void)
scan for max flux energy, weight
bool OptionalAttachBranch(std::string bname)
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
Double_t windowBase[3]
x,y,z position of window base point
std::vector< std::string > GetFileList()
list of files currently part of chain
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
TLorentzVector fX4
reconstituted position vector
static constexpr double L
bool fAllFilesMeta
do all files in chain have meta data
Float_t E
Definition: plot.C:20
Long64_t nentries
Double_t fFilePOTs
of protons-on-target represented by all files
bool fGenWeighted
does GenerateNext() give weights?
void Reset()
Double_t vtxz
z position in lab frame
GENIE interface for uniform flux exposure iterface.
ClassImp(EventRecord) namespace genie
Definition: EventRecord.cxx:25
float vtxy
Double_t minWgt
minimum weight
Class for parsing *.fcl files for their metadata information.
Int_t ppmedium
tracking medium where parent was produced
virtual double GetTotalExposure() const
GFluxExposureI interface.
GSimpleNtpNuMI * fCurNuMICopy
current "numi" branch extra info
#define pINFO
Definition: Messenger.h:63
long int fNEntriesUsed
number of entries read from files
bool GenerateNext(void)
generate the next flux neutrino (return false in err)
std::vector< std::string > infiles
list of input files
long int fNCycles
times to cycle through the ntuple(s)
void PrintConfig()
print the current configuration
Double_t tpx
parent particle px at target exit
void SetMaxEnergy(double Ev)
specify maximum flx neutrino energy
GSimpleNtpNuMI * fCurNuMI
current "numi" branch extra info
const ana::Var wgt
int fNFiles
number of files in chain
virtual void GetBranchInfo(std::vector< std::string > &branchNames, std::vector< std::string > &branchClassNames, std::vector< void ** > &branchObjPointers)
#define pWARN
Definition: Messenger.h:61
Definition: run.py:1
double fMaxWeight
max flux neutrino weight in input file
OStream cout
Definition: OStream.cxx:6
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
double fWeight
current neutrino weight
TChain * fNuMetaTree
TTree // REF ONLY.
GSimpleNtpEntry * fCurEntry
current entry
Double_t maxWgt
maximum weight
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
float vtxz
TLorentzVector fP4
reconstituted p4 vector
UInt_t metakey
index key to tie to individual entries
bool fAlreadyUnwgt
are input files already unweighted
Long64_t fIEntry
current flux ntuple entry
Long64_t nbytes
Long64_t fNEntries
number of flux ntuple entries
Double_t vtxx
x position in lab frame
friend ostream & operator<<(ostream &stream, const GSimpleNtpMeta &info)
Double_t pz
z momentum in lab frame
exit(0)
GSimpleNtpAux * fCurAuxCopy
current "aux" branch extra info
long int fNUse
how often to use same entry in a row
assert(nhit_max >=nhit_nbins)
TRandom3 r(0)
Double_t dist
distance from hadron decay
GSimpleNtpEntry * fCurEntryCopy
current entry
double fEffPOTsPerNu
what a entry is worth ...
#define pNOTICE
Definition: Messenger.h:62
double GetDecayDist() const
dist (user units) from dk to current pos
string fNuFluxBranchRequest
list of requested branches "entry,numi,au"
bool fEnd
end condition reached
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:72
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
virtual void LoadBeamSimData(const std::vector< string > &filenames, const std::string &det_loc)
double fMaxEv
maximum energy
Float_t e
Definition: plot.C:35
UInt_t metakey
key to meta data
void Print(const Option_t *opt="") const
Double_t py
y momentum in lab frame
double Weight(void)
returns the flux neutrino weight (if any)
def entry(str)
Definition: HTMLTools.py:26
double fAccumPOTs
POTs used so far.
void next()
Definition: show_event.C:84
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
#define FLUXDRIVERREG4(_nsa, _nsb, _name, _fqname)
void Print(const Option_t *opt="") const
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:67
static UInt_t mxfileprint
allow user to limit # of files to print
std::vector< std::string > auxdblname
tagname of aux doubles associated w/ entry
TChain * fNuFluxTree
TTree // REF ONLY.
#define pDEBUG
Definition: Messenger.h:64
void Print(const Option_t *opt="") const
Int_t ptype
parent type (PDG)