Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
genie::flux::GSimpleNtpFlux Class Referenceabstract

A GENIE flux driver using a simple ntuple format. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Tools/Flux/GSimpleNtpFlux.h"

Inheritance diagram for genie::flux::GSimpleNtpFlux:
genie::GFluxI genie::flux::GFluxExposureI genie::flux::GFluxFileConfigI

Public Member Functions

 GSimpleNtpFlux ()
 
 ~GSimpleNtpFlux ()
 
const PDGCodeListFluxParticles (void)
 declare list of flux neutrinos that can be generated (for init. purposes) More...
 
double MaxEnergy (void)
 declare the max flux neutrino energy that can be generated (for init. purposes) More...
 
bool GenerateNext (void)
 generate the next flux neutrino (return false in err) More...
 
int PdgCode (void)
 returns the flux neutrino pdg code More...
 
double Weight (void)
 returns the flux neutrino weight (if any) More...
 
const TLorentzVector & Momentum (void)
 returns the flux neutrino 4-momentum More...
 
const TLorentzVector & Position (void)
 returns the flux neutrino 4-position (note: expect SI rather than physical units) More...
 
bool End (void)
 true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples) More...
 
long int Index (void)
 returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current entry number) More...
 
void Clear (Option_t *opt)
 reset state variables based on opt More...
 
void GenerateWeighted (bool gen_weighted)
 set whether to generate weighted or unweighted neutrinos More...
 
const genie::flux::GSimpleNtpEntryGetCurrentEntry (void)
 GSimpleNtpEntry. More...
 
const genie::flux::GSimpleNtpNuMIGetCurrentNuMI (void)
 GSimpleNtpNuMI. More...
 
const genie::flux::GSimpleNtpAuxGetCurrentAux (void)
 GSimpleNtpAux. More...
 
const genie::flux::GSimpleNtpMetaGetCurrentMeta (void)
 GSimpleNtpMeta. More...
 
TChain * GetFluxTChain (void)
 
double GetDecayDist () const
 dist (user units) from dk to current pos More...
 
void MoveToZ0 (double z0)
 move ray origin to user coord Z0 More...
 
virtual double GetTotalExposure () const
 GFluxExposureI interface. More...
 
virtual long int NFluxNeutrinos () const
 

of rays generated

More...
 
double UsedPOTs (void) const
 

of protons-on-target used

More...
 
long int NEntriesUsed (void) const
 number of entries read from files More...
 
double SumWeight (void) const
 integrated weight for flux neutrinos looped so far More...
 
void PrintCurrent (void)
 print current entry from leaves More...
 
void PrintConfig ()
 print the current configuration More...
 
std::vector< std::stringGetFileList ()
 list of files currently part of chain More...
 
virtual void LoadBeamSimData (const std::vector< string > &filenames, const std::string &det_loc)
 
virtual void GetBranchInfo (std::vector< std::string > &branchNames, std::vector< std::string > &branchClassNames, std::vector< void ** > &branchObjPointers)
 
virtual TTree * GetMetaDataTree ()
 
void SetRequestedBranchList (string blist="entry,numi,aux")
 
void SetMaxEnergy (double Ev)
 specify maximum flx neutrino energy More...
 
void SetGenWeighted (bool genwgt=false)
 toggle whether GenerateNext() returns weight=1 flux (initial default false) More...
 
void SetEntryReuse (long int nuse=1)
 

of times to use entry before moving to next

More...
 
void ProcessMeta (void)
 scan for max flux energy, weight More...
 
void GetFluxWindow (TVector3 &p1, TVector3 &p2, TVector3 &p3) const
 3 points define a plane in beam coordinate More...
 
const char * GetExposureUnits () const
 what units are returned by GetTotalExposure? More...
 
genie::flux::Exposure_t GetExposureType () const
 
virtual void LoadBeamSimData (const std::vector< std::string > &filenames, const std::string &det_loc)=0
 
virtual void LoadBeamSimData (const std::set< std::string > &filenames, const std::string &det_loc)
 
virtual void LoadBeamSimData (const std::string &filename, const std::string &det_loc)
 
virtual void SetXMLFileBase (std::string xmlbasename="")
 
virtual std::string GetXMLFileBase () const
 
virtual void SetFluxParticles (const PDGCodeList &particles)
 specify list of flux neutrino species More...
 
virtual void SetUpstreamZ (double z0)
 
virtual void SetNumOfCycles (long int ncycle)
 limit cycling through input files More...
 

Static Public Member Functions

static const char * AsString (genie::flux::Exposure_t etype)
 
static genie::flux::Exposure_t StringToEnum (const char *chars, int maxChar=0)
 

Protected Attributes

PDGCodeListfPdgCList
 list of neutrino pdg-codes to generate More...
 
PDGCodeListfPdgCListRej
 list of nu pdg-codes seen but rejected More...
 
std::string fXMLbasename
 XML file that might hold config param_sets. More...
 
long int fNCycles
 

times to cycle through the ntuple(s)

More...
 
long int fICycle
 
double fZ0
 

Private Member Functions

bool GenerateNext_weighted (void)
 
void Initialize (void)
 
void SetDefaults (void)
 
void CleanUp (void)
 
void ResetCurrent (void)
 
void AddFile (TTree *fluxtree, TTree *metatree, string fname)
 
bool OptionalAttachBranch (std::string bname)
 
void CalcEffPOTsPerNu (void)
 
void ScanMeta (void)
 

Private Attributes

double fMaxEv
 maximum energy More...
 
bool fEnd
 end condition reached More...
 
std::vector< stringfNuFluxFilePatterns
 (potentially wildcarded) path(s) More...
 
string fNuFluxBranchRequest
 list of requested branches "entry,numi,au" More...
 
TChain * fNuFluxTree
 TTree // REF ONLY. More...
 
TChain * fNuMetaTree
 TTree // REF ONLY. More...
 
int fNFiles
 number of files in chain More...
 
Long64_t fNEntries
 number of flux ntuple entries More...
 
Long64_t fIEntry
 current flux ntuple entry More...
 
Int_t fIFileNumber
 which file for the current entry More...
 
Double_t fFilePOTs
 

of protons-on-target represented by all files

More...
 
double fWeight
 current neutrino weight More...
 
double fMaxWeight
 max flux neutrino weight in input file More...
 
long int fNUse
 how often to use same entry in a row More...
 
long int fIUse
 current # of times an entry has been used More...
 
double fSumWeight
 sum of weights for nus thrown so far More...
 
long int fNNeutrinos
 number of flux neutrinos thrown so far More...
 
long int fNEntriesUsed
 number of entries read from files More...
 
double fEffPOTsPerNu
 what a entry is worth ... More...
 
double fAccumPOTs
 POTs used so far. More...
 
bool fGenWeighted
 does GenerateNext() give weights? More...
 
bool fAlreadyUnwgt
 are input files already unweighted More...
 
bool fAllFilesMeta
 do all files in chain have meta data More...
 
GSimpleNtpEntryfCurEntry
 current entry More...
 
GSimpleNtpNuMIfCurNuMI
 current "numi" branch extra info More...
 
GSimpleNtpAuxfCurAux
 current "aux" branch extra info More...
 
TLorentzVector fP4
 reconstituted p4 vector More...
 
TLorentzVector fX4
 reconstituted position vector More...
 
GSimpleNtpMetafCurMeta
 current meta data More...
 
GSimpleNtpEntryfCurEntryCopy
 current entry More...
 
GSimpleNtpNuMIfCurNuMICopy
 current "numi" branch extra info More...
 
GSimpleNtpAuxfCurAuxCopy
 current "aux" branch extra info More...
 

Detailed Description

A GENIE flux driver using a simple ntuple format.

GSimpleNtpFlux:

An implementation of the GFluxI interface that provides NuMI flux

Author
Robert Hatcher <rhatcher fnal.gov> Fermi National Accelerator Laboratory

Jan 25, 2010

Copyright (c) 2003-2019, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 199 of file GSimpleNtpFlux.h.

Constructor & Destructor Documentation

genie::flux::GSimpleNtpFlux::GSimpleNtpFlux ( )
GSimpleNtpFlux::~GSimpleNtpFlux ( )

Definition at line 84 of file GSimpleNtpFlux.cxx.

References CleanUp().

85 {
86  this->CleanUp();
87 }

Member Function Documentation

void GSimpleNtpFlux::AddFile ( TTree *  fluxtree,
TTree *  metatree,
string  fname 
)
private

Definition at line 800 of file GSimpleNtpFlux.cxx.

References fAllFilesMeta, plot_validation_datamc::fname, fNFiles, fNuFluxTree, fNuMetaTree, LOG, nentries, and pINFO.

Referenced by LoadBeamSimData().

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 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool fAllFilesMeta
do all files in chain have meta data
Long64_t nentries
#define pINFO
Definition: Messenger.h:63
int fNFiles
number of files in chain
TChain * fNuMetaTree
TTree // REF ONLY.
TChain * fNuFluxTree
TTree // REF ONLY.
const char * genie::flux::GFluxExposureI::AsString ( genie::flux::Exposure_t  etype)
staticinherited

Definition at line 20 of file GFluxExposureI.cxx.

References genie::flux::kPOTs, genie::flux::kSeconds, and genie::flux::kUnknown.

Referenced by genie::flux::GFluxExposureI::GetExposureUnits().

21  {
22  switch (etype) {
23  case kUnknown: return "UnknownExposureUnits"; break;
24  case kPOTs: return "POT"; break;
25  case kSeconds: return "Seconds"; break;
26  default: return "?UnknownExposureUnits?"; break;
27  }
28  }
void GSimpleNtpFlux::CalcEffPOTsPerNu ( void  )
private

Definition at line 362 of file GSimpleNtpFlux.cxx.

References fEffPOTsPerNu, fFilePOTs, fNEntries, and fNuFluxTree.

Referenced by LoadBeamSimData().

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 }
Double_t fFilePOTs
of protons-on-target represented by all files
Long64_t fNEntries
number of flux ntuple entries
double fEffPOTsPerNu
what a entry is worth ...
TChain * fNuFluxTree
TTree // REF ONLY.
void GSimpleNtpFlux::CleanUp ( void  )
private

Definition at line 780 of file GSimpleNtpFlux.cxx.

References fCurAux, fCurEntry, fCurMeta, fCurNuMI, genie::flux::GFluxFileConfigI::fICycle, fIEntry, fIUse, genie::flux::GFluxFileConfigI::fNCycles, fNuFluxTree, fNuMetaTree, fNUse, genie::flux::GFluxFileConfigI::fPdgCList, genie::flux::GFluxFileConfigI::fPdgCListRej, LOG, pINFO, and pNOTICE.

Referenced by ~GSimpleNtpFlux().

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 }
GSimpleNtpAux * fCurAux
current "aux" branch extra info
GSimpleNtpMeta * fCurMeta
current meta data
long int fIUse
current # of times an entry has been used
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
long int fNCycles
times to cycle through the ntuple(s)
GSimpleNtpNuMI * fCurNuMI
current "numi" branch extra info
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
TChain * fNuMetaTree
TTree // REF ONLY.
GSimpleNtpEntry * fCurEntry
current entry
Long64_t fIEntry
current flux ntuple entry
long int fNUse
how often to use same entry in a row
#define pNOTICE
Definition: Messenger.h:62
TChain * fNuFluxTree
TTree // REF ONLY.
void GSimpleNtpFlux::Clear ( Option_t *  opt)
virtual

reset state variables based on opt

Implements genie::GFluxI.

Definition at line 685 of file GSimpleNtpFlux.cxx.

References fAccumPOTs, genie::flux::GFluxFileConfigI::fICycle, fNNeutrinos, fSumWeight, LOG, and pWARN.

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 }
long int fNNeutrinos
number of flux neutrinos thrown so far
double fSumWeight
sum of weights for nus thrown so far
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pWARN
Definition: Messenger.h:61
double fAccumPOTs
POTs used so far.
bool genie::flux::GSimpleNtpFlux::End ( void  )
inlinevirtual

true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)

Implements genie::GFluxI.

Definition at line 219 of file GSimpleNtpFlux.h.

Referenced by GenerateNext().

219 { return fEnd; }
bool fEnd
end condition reached
const PDGCodeList& genie::flux::GSimpleNtpFlux::FluxParticles ( void  )
inlinevirtual

declare list of flux neutrinos that can be generated (for init. purposes)

Implements genie::GFluxI.

Definition at line 212 of file GSimpleNtpFlux.h.

212 { return *fPdgCList; }
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
bool GSimpleNtpFlux::GenerateNext ( void  )
virtual

generate the next flux neutrino (return false in err)

Implements genie::GFluxI.

Definition at line 101 of file GSimpleNtpFlux.cxx.

References om::cout, febshutoff_auto::end, End(), MakeMiniprodValidationCuts::f, fAlreadyUnwgt, fCurEntry, fGenWeighted, fMaxWeight, fP4, fWeight, fX4, GenerateNext_weighted(), GetCurrentEntry(), genie::RandomGen::Instance(), LOG, genie::utils::print::P4AsShortString(), genie::flux::GSimpleNtpEntry::pdg, pERROR, pNOTICE, r(), generate_hists::rnd, genie::RandomGen::RndFlux(), Weight(), and genie::utils::print::X4AsString().

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 }
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:52
#define pERROR
Definition: Messenger.h:60
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
bool End(void)
true if no more flux nu&#39;s can be thrown (eg reaching end of beam sim ntuples)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
const genie::flux::GSimpleNtpEntry * GetCurrentEntry(void)
GSimpleNtpEntry.
#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
bool fGenWeighted
does GenerateNext() give weights?
double fMaxWeight
max flux neutrino weight in input file
OStream cout
Definition: OStream.cxx:6
double fWeight
current neutrino weight
GSimpleNtpEntry * fCurEntry
current entry
TLorentzVector fP4
reconstituted p4 vector
bool fAlreadyUnwgt
are input files already unweighted
TRandom3 r(0)
#define pNOTICE
Definition: Messenger.h:62
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:72
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
double Weight(void)
returns the flux neutrino weight (if any)
bool GSimpleNtpFlux::GenerateNext_weighted ( void  )
private

user might modify list via SetFluxParticles() in order to reject certain flavors, even if they're found in the file. So don't make a big fuss. Spit out a single message and then stop reporting that flavor as problematic.

Definition at line 166 of file GSimpleNtpFlux.cxx.

References ana::assert(), genie::flux::GSimpleNtpEntry::E, genie::flux::GSimpleNtpNuMI::entryno, genie::flux::GSimpleNtpNuMI::evtno, genie::PDGCodeList::ExistsInPDGCodeList(), exit(), fAccumPOTs, fAllFilesMeta, fCurEntry, fCurMeta, fCurNuMI, fEffPOTsPerNu, fEnd, genie::flux::GFluxFileConfigI::fICycle, fIEntry, fIUse, fMaxEv, genie::flux::GFluxFileConfigI::fNCycles, fNEntries, fNEntriesUsed, fNNeutrinos, fNuFluxTree, fNuMetaTree, fP4, genie::flux::GFluxFileConfigI::fPdgCList, genie::flux::GFluxFileConfigI::fPdgCListRej, fSumWeight, fWeight, fX4, genie::flux::GFluxFileConfigI::fZ0, LOG, genie::flux::GSimpleNtpEntry::metakey, genie::flux::GSimpleNtpMeta::metakey, MoveToZ0(), nbytes, genie::utils::print::P4AsShortString(), pDEBUG, genie::flux::GSimpleNtpEntry::pdg, pERROR, pFATAL, pINFO, genie::PDGCodeList::push_back(), pWARN, genie::flux::GSimpleNtpEntry::px, genie::flux::GSimpleNtpEntry::py, genie::flux::GSimpleNtpEntry::pz, ResetCurrent(), genie::flux::GSimpleNtpEntry::vtxx, genie::flux::GSimpleNtpEntry::vtxy, genie::flux::GSimpleNtpEntry::vtxz, Weight(), genie::flux::GSimpleNtpEntry::wgt, and genie::utils::print::X4AsString().

Referenced by GenerateNext().

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 }
Double_t E
energy in lab frame
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:52
long int fNNeutrinos
number of flux neutrinos thrown so far
GSimpleNtpMeta * fCurMeta
current meta data
#define pERROR
Definition: Messenger.h:60
long int fIUse
current # of times an entry has been used
Double_t px
x momentum in lab frame
double fSumWeight
sum of weights for nus thrown so far
Double_t vtxy
y position in lab frame
#define pFATAL
Definition: Messenger.h:57
bool ExistsInPDGCodeList(int pdg_code) const
void MoveToZ0(double z0)
move ray origin to user coord Z0
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
#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
bool fAllFilesMeta
do all files in chain have meta data
Double_t vtxz
z position in lab frame
#define pINFO
Definition: Messenger.h:63
long int fNEntriesUsed
number of entries read from files
long int fNCycles
times to cycle through the ntuple(s)
GSimpleNtpNuMI * fCurNuMI
current "numi" branch extra info
#define pWARN
Definition: Messenger.h:61
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
double fWeight
current neutrino weight
TChain * fNuMetaTree
TTree // REF ONLY.
GSimpleNtpEntry * fCurEntry
current entry
TLorentzVector fP4
reconstituted p4 vector
UInt_t metakey
index key to tie to individual entries
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
Double_t pz
z momentum in lab frame
exit(0)
assert(nhit_max >=nhit_nbins)
double fEffPOTsPerNu
what a entry is worth ...
bool fEnd
end condition reached
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
double fMaxEv
maximum energy
UInt_t metakey
key to meta data
Double_t py
y momentum in lab frame
double Weight(void)
returns the flux neutrino weight (if any)
double fAccumPOTs
POTs used so far.
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:67
TChain * fNuFluxTree
TTree // REF ONLY.
#define pDEBUG
Definition: Messenger.h:64
void GSimpleNtpFlux::GenerateWeighted ( bool  gen_weighted)
virtual

set whether to generate weighted or unweighted neutrinos

Implements genie::GFluxI.

Definition at line 700 of file GSimpleNtpFlux.cxx.

References fGenWeighted.

701 {
702 // Set whether to generate weighted rays
703 //
704  fGenWeighted = gen_weighted;
705 }
bool fGenWeighted
does GenerateNext() give weights?
void GSimpleNtpFlux::GetBranchInfo ( std::vector< std::string > &  branchNames,
std::vector< std::string > &  branchClassNames,
std::vector< void ** > &  branchObjPointers 
)
virtual

allow caller to copy current status / ntuple entry info in the output file by providing copies of internal info

Assumes that branch object pointers will not change which may require either a copy be made or, if using the class directly for reading the branch, one must force ROOT to not autodelete: myns::MyClassType* fCurrMyClass = new myns::MyClassType; myTree->SetBranchAddress("bname",&fCurMyClass); //? TBranch* b = myTree->GetBranch("bname"); //? b->SetAutoDelete(false);

ensure vectors are sized sufficiently (or use .push_back()) branchNames[i] = "bname" branchClassNames[i] = "myns::MyClassType" branchObjPointers[i] = (void**)

Reimplemented from genie::flux::GFluxFileConfigI.

Definition at line 564 of file GSimpleNtpFlux.cxx.

References fCurAux, fCurEntry, and fCurNuMI.

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 }
GSimpleNtpAux * fCurAux
current "aux" branch extra info
GSimpleNtpNuMI * fCurNuMI
current "numi" branch extra info
GSimpleNtpEntry * fCurEntry
current entry
const genie::flux::GSimpleNtpAux* genie::flux::GSimpleNtpFlux::GetCurrentAux ( void  )
inline

GSimpleNtpAux.

Definition at line 238 of file GSimpleNtpFlux.h.

const genie::flux::GSimpleNtpEntry* genie::flux::GSimpleNtpFlux::GetCurrentEntry ( void  )
inline

GSimpleNtpEntry.

Definition at line 234 of file GSimpleNtpFlux.h.

Referenced by GenerateNext().

const genie::flux::GSimpleNtpMeta* genie::flux::GSimpleNtpFlux::GetCurrentMeta ( void  )
inline

GSimpleNtpMeta.

Definition at line 240 of file GSimpleNtpFlux.h.

const genie::flux::GSimpleNtpNuMI* genie::flux::GSimpleNtpFlux::GetCurrentNuMI ( void  )
inline

GSimpleNtpNuMI.

Definition at line 236 of file GSimpleNtpFlux.h.

double GSimpleNtpFlux::GetDecayDist ( ) const

dist (user units) from dk to current pos

Definition at line 326 of file GSimpleNtpFlux.cxx.

References genie::flux::GSimpleNtpEntry::dist, and fCurEntry.

Referenced by genie::flux::GFluxBlender::GenerateNext().

327 {
328  // return distance (user units) between dk point and start position
329  // these are in beam units
330  return fCurEntry->dist;
331 }
GSimpleNtpEntry * fCurEntry
current entry
Double_t dist
distance from hadron decay
genie::flux::Exposure_t genie::flux::GFluxExposureI::GetExposureType ( ) const
inherited

Definition at line 56 of file GFluxExposureI.cxx.

References genie::flux::GFluxExposureI::fEType.

57  { return fEType; }
genie::flux::Exposure_t fEType
const char * genie::flux::GFluxExposureI::GetExposureUnits ( ) const
inherited

what units are returned by GetTotalExposure?

Definition at line 59 of file GFluxExposureI.cxx.

References genie::flux::GFluxExposureI::AsString(), and genie::flux::GFluxExposureI::fEType.

Referenced by main().

static const char * AsString(genie::flux::Exposure_t etype)
genie::flux::Exposure_t fEType
std::vector< std::string > GSimpleNtpFlux::GetFileList ( )

list of files currently part of chain

Definition at line 1117 of file GSimpleNtpFlux.cxx.

References modify_metadata_with_upmu_sample_type::flist, and next().

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 }
void next()
Definition: show_event.C:84
TChain * fNuFluxTree
TTree // REF ONLY.
TChain* genie::flux::GSimpleNtpFlux::GetFluxTChain ( void  )
inline

Definition at line 244 of file GSimpleNtpFlux.h.

void GSimpleNtpFlux::GetFluxWindow ( TVector3 &  p1,
TVector3 &  p2,
TVector3 &  p3 
) const

3 points define a plane in beam coordinate

Definition at line 663 of file GSimpleNtpFlux.cxx.

References fCurMeta, genie::flux::GSimpleNtpMeta::windowBase, genie::flux::GSimpleNtpMeta::windowDir1, and genie::flux::GSimpleNtpMeta::windowDir2.

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 }
GSimpleNtpMeta * fCurMeta
current meta data
Double_t windowDir1[3]
dx,dy,dz of window direction 1
Double_t windowDir2[3]
dx,dy,dz of window direction 2
Double_t windowBase[3]
x,y,z position of window base point
TTree * GSimpleNtpFlux::GetMetaDataTree ( )
virtual

Reimplemented from genie::flux::GFluxFileConfigI.

Definition at line 591 of file GSimpleNtpFlux.cxx.

References fNuMetaTree.

591 { return fNuMetaTree; }
TChain * fNuMetaTree
TTree // REF ONLY.
double GSimpleNtpFlux::GetTotalExposure ( ) const
virtual

GFluxExposureI interface.

Implements genie::flux::GFluxExposureI.

Definition at line 89 of file GSimpleNtpFlux.cxx.

References UsedPOTs().

90 {
91  // complete the GFluxExposureI interface
92  return UsedPOTs();
93 }
double UsedPOTs(void) const
of protons-on-target used
virtual std::string genie::flux::GFluxFileConfigI::GetXMLFileBase ( ) const
inlinevirtualinherited
long int genie::flux::GSimpleNtpFlux::Index ( void  )
inlinevirtual

returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current entry number)

Implements genie::GFluxI.

Definition at line 220 of file GSimpleNtpFlux.h.

References MECModelEnuComparisons::opt.

220 { return fIEntry; }
Long64_t fIEntry
current flux ntuple entry
void GSimpleNtpFlux::Initialize ( void  )
private

Definition at line 707 of file GSimpleNtpFlux.cxx.

References fAccumPOTs, fAllFilesMeta, fAlreadyUnwgt, fCurAux, fCurAuxCopy, fCurEntry, fCurEntryCopy, fCurMeta, fCurNuMI, fCurNuMICopy, fEffPOTsPerNu, fEnd, fFilePOTs, fGenWeighted, genie::flux::GFluxFileConfigI::fICycle, fIEntry, fIFileNumber, fIUse, fMaxEv, fMaxWeight, fNEntries, fNEntriesUsed, fNFiles, fNNeutrinos, fNuFluxBranchRequest, fNuFluxTree, fNuMetaTree, fNUse, fSumWeight, LOG, pINFO, ResetCurrent(), and SetDefaults().

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 }
GSimpleNtpAux * fCurAux
current "aux" branch extra info
Int_t fIFileNumber
which file for the current entry
long int fNNeutrinos
number of flux neutrinos thrown so far
GSimpleNtpMeta * fCurMeta
current meta data
long int fIUse
current # of times an entry has been used
double fSumWeight
sum of weights for nus thrown so far
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool fAllFilesMeta
do all files in chain have meta data
Double_t fFilePOTs
of protons-on-target represented by all files
bool fGenWeighted
does GenerateNext() give weights?
GSimpleNtpNuMI * fCurNuMICopy
current "numi" branch extra info
#define pINFO
Definition: Messenger.h:63
long int fNEntriesUsed
number of entries read from files
GSimpleNtpNuMI * fCurNuMI
current "numi" branch extra info
int fNFiles
number of files in chain
double fMaxWeight
max flux neutrino weight in input file
TChain * fNuMetaTree
TTree // REF ONLY.
GSimpleNtpEntry * fCurEntry
current entry
bool fAlreadyUnwgt
are input files already unweighted
Long64_t fIEntry
current flux ntuple entry
Long64_t fNEntries
number of flux ntuple entries
GSimpleNtpAux * fCurAuxCopy
current "aux" branch extra info
long int fNUse
how often to use same entry in a row
GSimpleNtpEntry * fCurEntryCopy
current entry
double fEffPOTsPerNu
what a entry is worth ...
string fNuFluxBranchRequest
list of requested branches "entry,numi,au"
bool fEnd
end condition reached
double fMaxEv
maximum energy
double fAccumPOTs
POTs used so far.
TChain * fNuFluxTree
TTree // REF ONLY.
virtual void genie::flux::GFluxFileConfigI::LoadBeamSimData ( const std::vector< std::string > &  filenames,
const std::string det_loc 
)
pure virtualinherited

first is primary method for loading root flux ntuple files and config others are alternatives that can be overloaded but have sensible defaults to fall back to calling the vector version

Implemented in genie::flux::GNuMIFlux, genie::flux::GDk2NuFlux, and genie::flux::GDk2NuFlux.

Referenced by genie::flux::GFluxFileConfigI::LoadBeamSimData(), main(), SumWeight(), and genie::flux::GNuMIFlux::SumWeight().

void genie::flux::GFluxFileConfigI::LoadBeamSimData ( const std::set< std::string > &  filenames,
const std::string det_loc 
)
virtualinherited

Definition at line 34 of file GFluxFileConfigI.cxx.

References genie::flux::GFluxFileConfigI::LoadBeamSimData().

36  {
37  // Loads a beam simulation root file into the GFluxFileConfig driver.
38  // have a set<> want a vector<>
39  std::vector<std::string> filevec;
40  std::copy(fileset.begin(),fileset.end(),std::back_inserter(filevec));
41  LoadBeamSimData(filevec,config); // call the one that takes a vector
42  }
virtual void LoadBeamSimData(const std::vector< std::string > &filenames, const std::string &det_loc)=0
Definition: config.py:1
void genie::flux::GFluxFileConfigI::LoadBeamSimData ( const std::string filename,
const std::string det_loc 
)
virtualinherited

Definition at line 45 of file GFluxFileConfigI.cxx.

References genie::flux::GFluxFileConfigI::LoadBeamSimData().

47  {
48  // Loads a beam simulation root file into the GFluxFileConfig driver.
49  std::vector<std::string> filevec;
50  filevec.push_back(filename);
51  LoadBeamSimData(filevec,config); // call the one that takes a vector
52  }
virtual void LoadBeamSimData(const std::vector< std::string > &filenames, const std::string &det_loc)=0
Definition: config.py:1
string filename
Definition: shutoffs.py:106
void GSimpleNtpFlux::LoadBeamSimData ( const std::vector< string > &  filenames,
const std::string det_loc 
)
virtual

Definition at line 385 of file GSimpleNtpFlux.cxx.

References AddFile(), ana::assert(), CalcEffPOTsPerNu(), fAccumPOTs, fCurAux, fCurEntry, fCurNuMI, genie::flux::GFluxFileConfigI::fICycle, fIEntry, shutoffs::filename, fIUse, fMaxWeight, fNEntries, fNEntriesUsed, fNNeutrinos, fNuFluxFilePatterns, fNuFluxTree, fSumWeight, genie::RandomGen::Instance(), LOG, OptionalAttachBranch(), submit_syst::pattern, pDEBUG, pERROR, pFATAL, pINFO, pNOTICE, ProcessMeta(), generate_hists::rnd, genie::RandomGen::RndFlux(), and string.

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 }
GSimpleNtpAux * fCurAux
current "aux" branch extra info
std::vector< string > fNuFluxFilePatterns
(potentially wildcarded) path(s)
long int fNNeutrinos
number of flux neutrinos thrown so far
void AddFile(TTree *fluxtree, TTree *metatree, string fname)
#define pERROR
Definition: Messenger.h:60
long int fIUse
current # of times an entry has been used
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
double fSumWeight
sum of weights for nus thrown so far
#define pFATAL
Definition: Messenger.h:57
Definition: config.py:1
string filename
Definition: shutoffs.py:106
Timing fit.
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
void ProcessMeta(void)
scan for max flux energy, weight
bool OptionalAttachBranch(std::string bname)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
long int fNEntriesUsed
number of entries read from files
GSimpleNtpNuMI * fCurNuMI
current "numi" branch extra info
double fMaxWeight
max flux neutrino weight in input file
GSimpleNtpEntry * fCurEntry
current entry
Long64_t fIEntry
current flux ntuple entry
Long64_t fNEntries
number of flux ntuple entries
assert(nhit_max >=nhit_nbins)
#define pNOTICE
Definition: Messenger.h:62
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:72
double fAccumPOTs
POTs used so far.
TChain * fNuFluxTree
TTree // REF ONLY.
#define pDEBUG
Definition: Messenger.h:64
enum BeamMode string
double genie::flux::GSimpleNtpFlux::MaxEnergy ( void  )
inlinevirtual

declare the max flux neutrino energy that can be generated (for init. purposes)

Implements genie::GFluxI.

Definition at line 213 of file GSimpleNtpFlux.h.

213 { return fMaxEv; }
double fMaxEv
maximum energy
const TLorentzVector& genie::flux::GSimpleNtpFlux::Momentum ( void  )
inlinevirtual

returns the flux neutrino 4-momentum

Implements genie::GFluxI.

Definition at line 217 of file GSimpleNtpFlux.h.

217 { return fP4; }
TLorentzVector fP4
reconstituted p4 vector
void GSimpleNtpFlux::MoveToZ0 ( double  z0)

move ray origin to user coord Z0

Definition at line 333 of file GSimpleNtpFlux.cxx.

References e, fP4, fX4, LOG, pWARN, and scale.

Referenced by GenerateNext_weighted().

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 }
Double_t scale
Definition: plot.C:25
#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
#define pWARN
Definition: Messenger.h:61
TLorentzVector fP4
reconstituted p4 vector
Float_t e
Definition: plot.C:35
long int genie::flux::GSimpleNtpFlux::NEntriesUsed ( void  ) const
inline

number of entries read from files

Definition at line 257 of file GSimpleNtpFlux.h.

long int GSimpleNtpFlux::NFluxNeutrinos ( void  ) const
virtual

of rays generated

< number of flux neutrinos looped so far

Implements genie::flux::GFluxExposureI.

Definition at line 95 of file GSimpleNtpFlux.cxx.

References fNNeutrinos.

96 {
97  ///< number of flux neutrinos looped so far
98  return fNNeutrinos;
99 }
long int fNNeutrinos
number of flux neutrinos thrown so far
bool GSimpleNtpFlux::OptionalAttachBranch ( std::string  bname)
private

Definition at line 825 of file GSimpleNtpFlux.cxx.

References fNuFluxBranchRequest, fNuFluxTree, LOG, and pINFO.

Referenced by LoadBeamSimData().

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 }
const XML_Char * name
Definition: expat.h:151
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
string fNuFluxBranchRequest
list of requested branches "entry,numi,au"
TChain * fNuFluxTree
TTree // REF ONLY.
int genie::flux::GSimpleNtpFlux::PdgCode ( void  )
inlinevirtual

returns the flux neutrino pdg code

Implements genie::GFluxI.

Definition at line 215 of file GSimpleNtpFlux.h.

215 { return fCurEntry->pdg; }
GSimpleNtpEntry * fCurEntry
current entry
const TLorentzVector& genie::flux::GSimpleNtpFlux::Position ( void  )
inlinevirtual

returns the flux neutrino 4-position (note: expect SI rather than physical units)

Implements genie::GFluxI.

Definition at line 218 of file GSimpleNtpFlux.h.

218 { return fX4; }
TLorentzVector fX4
reconstituted position vector
void GSimpleNtpFlux::PrintConfig ( void  )
virtual

print the current configuration

Implements genie::flux::GFluxFileConfigI.

Definition at line 1073 of file GSimpleNtpFlux.cxx.

References modify_metadata_with_upmu_sample_type::flist, MECModelEnuComparisons::i, LOG, and pNOTICE.

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 }
std::vector< string > fNuFluxFilePatterns
(potentially wildcarded) path(s)
long int fNNeutrinos
number of flux neutrinos thrown so far
long int fIUse
current # of times an entry has been used
double fSumWeight
sum of weights for nus thrown so far
const XML_Char * s
Definition: expat.h:262
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
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
bool fAllFilesMeta
do all files in chain have meta data
Double_t fFilePOTs
of protons-on-target represented by all files
bool fGenWeighted
does GenerateNext() give weights?
long int fNEntriesUsed
number of entries read from files
long int fNCycles
times to cycle through the ntuple(s)
int fNFiles
number of files in chain
double fMaxWeight
max flux neutrino weight in input file
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
bool fAlreadyUnwgt
are input files already unweighted
Long64_t fIEntry
current flux ntuple entry
Long64_t fNEntries
number of flux ntuple entries
long int fNUse
how often to use same entry in a row
double fEffPOTsPerNu
what a entry is worth ...
#define pNOTICE
Definition: Messenger.h:62
double fMaxEv
maximum energy
double fAccumPOTs
POTs used so far.
void GSimpleNtpFlux::PrintCurrent ( void  )

print current entry from leaves

Definition at line 680 of file GSimpleNtpFlux.cxx.

References fCurEntry, LOG, and pNOTICE.

681 {
682  LOG("Flux", pNOTICE) << "CurrentEntry:" << *fCurEntry;
683 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
GSimpleNtpEntry * fCurEntry
current entry
#define pNOTICE
Definition: Messenger.h:62
void GSimpleNtpFlux::ProcessMeta ( void  )

scan for max flux energy, weight

Definition at line 594 of file GSimpleNtpFlux.cxx.

References fAllFilesMeta, fAlreadyUnwgt, fCurMeta, fFilePOTs, fIFileNumber, fMaxEv, fMaxWeight, fNFiles, fNuMetaTree, genie::flux::GFluxFileConfigI::fPdgCList, MECModelEnuComparisons::i, LOG, pDEBUG, pFATAL, pNOTICE, genie::PDGCodeList::push_back(), genie::flux::GSimpleNtpMeta::Reset(), and SetMaxEnergy().

Referenced by LoadBeamSimData().

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 }
Int_t fIFileNumber
which file for the current entry
GSimpleNtpMeta * fCurMeta
current meta data
#define pFATAL
Definition: Messenger.h:57
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool fAllFilesMeta
do all files in chain have meta data
Double_t fFilePOTs
of protons-on-target represented by all files
void SetMaxEnergy(double Ev)
specify maximum flx neutrino energy
int fNFiles
number of files in chain
double fMaxWeight
max flux neutrino weight in input file
TChain * fNuMetaTree
TTree // REF ONLY.
bool fAlreadyUnwgt
are input files already unweighted
#define pNOTICE
Definition: Messenger.h:62
double fMaxEv
maximum energy
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:67
#define pDEBUG
Definition: Messenger.h:64
void GSimpleNtpFlux::ResetCurrent ( void  )
private

Definition at line 769 of file GSimpleNtpFlux.cxx.

References fCurAux, fCurEntry, fCurNuMI, genie::flux::GSimpleNtpEntry::Reset(), genie::flux::GSimpleNtpNuMI::Reset(), and genie::flux::GSimpleNtpAux::Reset().

Referenced by GenerateNext_weighted(), and Initialize().

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 }
GSimpleNtpAux * fCurAux
current "aux" branch extra info
GSimpleNtpNuMI * fCurNuMI
current "numi" branch extra info
GSimpleNtpEntry * fCurEntry
current entry
void genie::flux::GSimpleNtpFlux::ScanMeta ( void  )
private
void GSimpleNtpFlux::SetDefaults ( void  )
private

Definition at line 756 of file GSimpleNtpFlux.cxx.

References LOG, pINFO, SetEntryReuse(), genie::flux::GFluxFileConfigI::SetNumOfCycles(), and genie::flux::GFluxFileConfigI::SetUpstreamZ().

Referenced by Initialize().

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 }
void SetEntryReuse(long int nuse=1)
of times to use entry before moving to next
virtual void SetNumOfCycles(long int ncycle)
limit cycling through input files
virtual void SetUpstreamZ(double z0)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
void GSimpleNtpFlux::SetEntryReuse ( long int  nuse = 1)

of times to use entry before moving to next

Definition at line 655 of file GSimpleNtpFlux.cxx.

References fNUse, and CLHEP::L.

Referenced by SetDefaults().

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 }
static constexpr double L
long int fNUse
how often to use same entry in a row
void genie::flux::GFluxFileConfigI::SetFluxParticles ( const PDGCodeList particles)
virtualinherited

specify list of flux neutrino species

Definition at line 100 of file GFluxFileConfigI.cxx.

References genie::PDGCodeList::Copy(), genie::flux::GFluxFileConfigI::fPdgCList, LOG, and pINFO.

Referenced by genie::flux::GFluxFileConfigI::GetXMLFileBase(), main(), and genie::flux::GDk2NuFlux::SetDefaults().

101  {
102  fPdgCList->Copy(particles);
103 
104  LOG("Flux", pINFO)
105  << "Declared list of neutrino species: " << *fPdgCList;
106  }
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
void Copy(const PDGCodeList &list)
copy / print
void genie::flux::GSimpleNtpFlux::SetGenWeighted ( bool  genwgt = false)
inline
void GSimpleNtpFlux::SetMaxEnergy ( double  Ev)

specify maximum flx neutrino energy

Definition at line 647 of file GSimpleNtpFlux.cxx.

References fMaxEv, LOG, and pINFO.

Referenced by ProcessMeta().

648 {
649  fMaxEv = TMath::Max(0.,Ev);
650 
651  LOG("Flux", pINFO)
652  << "Declared maximum flux neutrino energy: " << fMaxEv;
653 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
double fMaxEv
maximum energy
void genie::flux::GFluxFileConfigI::SetNumOfCycles ( long int  ncycle)
virtualinherited

limit cycling through input files

Definition at line 86 of file GFluxFileConfigI.cxx.

References genie::flux::GFluxFileConfigI::fNCycles, and CLHEP::L.

Referenced by genie::flux::GFluxFileConfigI::GetXMLFileBase(), main(), genie::flux::GDk2NuFlux::SetDefaults(), and SetDefaults().

87  {
88  // The flux ntuples can be recycled for a number of times to boost
89  // generated event statistics without requiring enormous beam simulation
90  // statistics.
91  // That option determines how many times the driver is going to cycle
92  // through the input flux ntuple.
93  // With ncycle=0 the flux ntuple will be recycled an infinite amount of
94  // times so that the event generation loop can exit only on a POT or
95  // event num check.
96 
97  fNCycles = TMath::Max(0L, ncycle);
98  }
static constexpr double L
long int fNCycles
times to cycle through the ntuple(s)
void genie::flux::GSimpleNtpFlux::SetRequestedBranchList ( string  blist = "entry,numi,aux")
inline

Definition at line 280 of file GSimpleNtpFlux.h.

280 { fNuFluxBranchRequest = blist; }
string fNuFluxBranchRequest
list of requested branches "entry,numi,au"
void genie::flux::GFluxFileConfigI::SetUpstreamZ ( double  z0)
virtualinherited

set flux neutrino initial z position (upstream of the detector) pushed back from the normal flux window

Definition at line 74 of file GFluxFileConfigI.cxx.

References genie::flux::GFluxFileConfigI::fZ0.

Referenced by fill_simple(), genie::flux::GFluxFileConfigI::GetXMLFileBase(), main(), genie::flux::GDk2NuFlux::SetDefaults(), and SetDefaults().

75  {
76  // The flux neutrino position (x,y) is given on the user specified
77  // flux window. This method sets the preferred user coord starting z
78  // position upstream of detector face. Each flux neutrino will be
79  // backtracked from the initial flux window to the input z0.
80  // If the value is unreasonable (> 10^30) then the ray is left on
81  // the flux window.
82 
83  fZ0 = z0;
84  }
void genie::flux::GFluxFileConfigI::SetXMLFileBase ( std::string  xmlbasename = "")
virtualinherited

Definition at line 30 of file GFluxFileConfigI.cxx.

References genie::flux::GFluxFileConfigI::fXMLbasename.

Referenced by genie::flux::GDk2NuFlux::SetDefaults().

31  { fXMLbasename = xmlbasename; }
std::string fXMLbasename
XML file that might hold config param_sets.
genie::flux::Exposure_t genie::flux::GFluxExposureI::StringToEnum ( const char *  chars,
int  maxChar = 0 
)
staticinherited

Definition at line 31 of file GFluxExposureI.cxx.

References MECModelEnuComparisons::i, genie::flux::kPOTs, genie::flux::kSeconds, and genie::flux::kUnknown.

32  {
33  int len = strlen(chars);
34  if (maxChar == 0 ) maxChar = len;
35  if (maxChar > len) maxChar = len;
36  if (maxChar <= 0 ) return genie::flux::kUnknown;
37 
38  char* lowchars = new char [maxChar];
39  for (int i=0; i<maxChar; ++i) lowchars[i] = tolower(chars[i]);
40 
42  if ( 0 == strncmp(lowchars,"pot",TMath::Min(maxChar,3))) {
43  etype = genie::flux::kPOTs;
44  } else if ( 0 == strncmp(lowchars,"sec",TMath::Min(maxChar,3))) {
45  etype = genie::flux::kSeconds;
46  }
47  delete [] lowchars;
48  return etype;
49  }
const XML_Char int len
Definition: expat.h:262
enum genie::flux::EExposure Exposure_t
double genie::flux::GSimpleNtpFlux::SumWeight ( void  ) const
inline

integrated weight for flux neutrinos looped so far

Definition at line 258 of file GSimpleNtpFlux.h.

References site_stats_from_log::filenames, genie::flux::GFluxFileConfigI::LoadBeamSimData(), and string.

double GSimpleNtpFlux::UsedPOTs ( void  ) const

of protons-on-target used

Definition at line 372 of file GSimpleNtpFlux.cxx.

References fAccumPOTs, fNuFluxTree, LOG, and pWARN.

Referenced by GetTotalExposure().

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 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pWARN
Definition: Messenger.h:61
double fAccumPOTs
POTs used so far.
TChain * fNuFluxTree
TTree // REF ONLY.
double genie::flux::GSimpleNtpFlux::Weight ( void  )
inlinevirtual

returns the flux neutrino weight (if any)

Implements genie::GFluxI.

Definition at line 216 of file GSimpleNtpFlux.h.

Referenced by GenerateNext(), and GenerateNext_weighted().

216 { return fWeight; }
double fWeight
current neutrino weight

Member Data Documentation

double genie::flux::GSimpleNtpFlux::fAccumPOTs
private

POTs used so far.

Definition at line 333 of file GSimpleNtpFlux.h.

Referenced by Clear(), GenerateNext_weighted(), Initialize(), LoadBeamSimData(), and UsedPOTs().

bool genie::flux::GSimpleNtpFlux::fAllFilesMeta
private

do all files in chain have meta data

Definition at line 338 of file GSimpleNtpFlux.h.

Referenced by AddFile(), GenerateNext_weighted(), Initialize(), and ProcessMeta().

bool genie::flux::GSimpleNtpFlux::fAlreadyUnwgt
private

are input files already unweighted

Definition at line 336 of file GSimpleNtpFlux.h.

Referenced by GenerateNext(), Initialize(), and ProcessMeta().

GSimpleNtpAux* genie::flux::GSimpleNtpFlux::fCurAux
private

current "aux" branch extra info

Definition at line 342 of file GSimpleNtpFlux.h.

Referenced by CleanUp(), GetBranchInfo(), Initialize(), LoadBeamSimData(), and ResetCurrent().

GSimpleNtpAux* genie::flux::GSimpleNtpFlux::fCurAuxCopy
private

current "aux" branch extra info

Definition at line 349 of file GSimpleNtpFlux.h.

Referenced by Initialize().

GSimpleNtpEntry* genie::flux::GSimpleNtpFlux::fCurEntry
private
GSimpleNtpEntry* genie::flux::GSimpleNtpFlux::fCurEntryCopy
private

current entry

Definition at line 347 of file GSimpleNtpFlux.h.

Referenced by Initialize().

GSimpleNtpMeta* genie::flux::GSimpleNtpFlux::fCurMeta
private

current meta data

Definition at line 345 of file GSimpleNtpFlux.h.

Referenced by CleanUp(), GenerateNext_weighted(), GetFluxWindow(), Initialize(), and ProcessMeta().

GSimpleNtpNuMI* genie::flux::GSimpleNtpFlux::fCurNuMI
private

current "numi" branch extra info

Definition at line 341 of file GSimpleNtpFlux.h.

Referenced by CleanUp(), GenerateNext_weighted(), GetBranchInfo(), Initialize(), LoadBeamSimData(), and ResetCurrent().

GSimpleNtpNuMI* genie::flux::GSimpleNtpFlux::fCurNuMICopy
private

current "numi" branch extra info

Definition at line 348 of file GSimpleNtpFlux.h.

Referenced by Initialize().

double genie::flux::GSimpleNtpFlux::fEffPOTsPerNu
private

what a entry is worth ...

Definition at line 332 of file GSimpleNtpFlux.h.

Referenced by CalcEffPOTsPerNu(), GenerateNext_weighted(), and Initialize().

bool genie::flux::GSimpleNtpFlux::fEnd
private

end condition reached

Definition at line 309 of file GSimpleNtpFlux.h.

Referenced by GenerateNext_weighted(), and Initialize().

Double_t genie::flux::GSimpleNtpFlux::fFilePOTs
private

of protons-on-target represented by all files

Definition at line 321 of file GSimpleNtpFlux.h.

Referenced by CalcEffPOTsPerNu(), Initialize(), and ProcessMeta().

bool genie::flux::GSimpleNtpFlux::fGenWeighted
private

does GenerateNext() give weights?

Definition at line 335 of file GSimpleNtpFlux.h.

Referenced by GenerateNext(), GenerateWeighted(), and Initialize().

long int genie::flux::GFluxFileConfigI::fICycle
protectedinherited
Long64_t genie::flux::GSimpleNtpFlux::fIEntry
private

current flux ntuple entry

Definition at line 318 of file GSimpleNtpFlux.h.

Referenced by CleanUp(), GenerateNext_weighted(), Initialize(), and LoadBeamSimData().

Int_t genie::flux::GSimpleNtpFlux::fIFileNumber
private

which file for the current entry

Definition at line 319 of file GSimpleNtpFlux.h.

Referenced by Initialize(), and ProcessMeta().

long int genie::flux::GSimpleNtpFlux::fIUse
private

current # of times an entry has been used

Definition at line 327 of file GSimpleNtpFlux.h.

Referenced by CleanUp(), GenerateNext_weighted(), Initialize(), and LoadBeamSimData().

double genie::flux::GSimpleNtpFlux::fMaxEv
private

maximum energy

Definition at line 308 of file GSimpleNtpFlux.h.

Referenced by GenerateNext_weighted(), Initialize(), ProcessMeta(), and SetMaxEnergy().

double genie::flux::GSimpleNtpFlux::fMaxWeight
private

max flux neutrino weight in input file

Definition at line 324 of file GSimpleNtpFlux.h.

Referenced by GenerateNext(), Initialize(), LoadBeamSimData(), and ProcessMeta().

long int genie::flux::GFluxFileConfigI::fNCycles
protectedinherited
Long64_t genie::flux::GSimpleNtpFlux::fNEntries
private

number of flux ntuple entries

Definition at line 317 of file GSimpleNtpFlux.h.

Referenced by CalcEffPOTsPerNu(), GenerateNext_weighted(), Initialize(), and LoadBeamSimData().

long int genie::flux::GSimpleNtpFlux::fNEntriesUsed
private

number of entries read from files

Definition at line 331 of file GSimpleNtpFlux.h.

Referenced by GenerateNext_weighted(), Initialize(), and LoadBeamSimData().

int genie::flux::GSimpleNtpFlux::fNFiles
private

number of files in chain

Definition at line 316 of file GSimpleNtpFlux.h.

Referenced by AddFile(), Initialize(), and ProcessMeta().

long int genie::flux::GSimpleNtpFlux::fNNeutrinos
private

number of flux neutrinos thrown so far

Definition at line 330 of file GSimpleNtpFlux.h.

Referenced by Clear(), GenerateNext_weighted(), Initialize(), LoadBeamSimData(), and NFluxNeutrinos().

string genie::flux::GSimpleNtpFlux::fNuFluxBranchRequest
private

list of requested branches "entry,numi,au"

Definition at line 312 of file GSimpleNtpFlux.h.

Referenced by Initialize(), and OptionalAttachBranch().

std::vector<string> genie::flux::GSimpleNtpFlux::fNuFluxFilePatterns
private

(potentially wildcarded) path(s)

Definition at line 311 of file GSimpleNtpFlux.h.

Referenced by LoadBeamSimData().

TChain* genie::flux::GSimpleNtpFlux::fNuFluxTree
private
TChain* genie::flux::GSimpleNtpFlux::fNuMetaTree
private

TTree // REF ONLY.

Definition at line 314 of file GSimpleNtpFlux.h.

Referenced by AddFile(), CleanUp(), GenerateNext_weighted(), GetMetaDataTree(), Initialize(), and ProcessMeta().

long int genie::flux::GSimpleNtpFlux::fNUse
private

how often to use same entry in a row

Definition at line 326 of file GSimpleNtpFlux.h.

Referenced by CleanUp(), Initialize(), and SetEntryReuse().

TLorentzVector genie::flux::GSimpleNtpFlux::fP4
private

reconstituted p4 vector

Definition at line 343 of file GSimpleNtpFlux.h.

Referenced by GenerateNext(), GenerateNext_weighted(), and MoveToZ0().

PDGCodeList* genie::flux::GFluxFileConfigI::fPdgCList
protectedinherited
PDGCodeList* genie::flux::GFluxFileConfigI::fPdgCListRej
protectedinherited
double genie::flux::GSimpleNtpFlux::fSumWeight
private

sum of weights for nus thrown so far

Definition at line 329 of file GSimpleNtpFlux.h.

Referenced by Clear(), GenerateNext_weighted(), Initialize(), and LoadBeamSimData().

double genie::flux::GSimpleNtpFlux::fWeight
private

current neutrino weight

Definition at line 323 of file GSimpleNtpFlux.h.

Referenced by GenerateNext(), and GenerateNext_weighted().

TLorentzVector genie::flux::GSimpleNtpFlux::fX4
private

reconstituted position vector

Definition at line 344 of file GSimpleNtpFlux.h.

Referenced by GenerateNext(), GenerateNext_weighted(), and MoveToZ0().

std::string genie::flux::GFluxFileConfigI::fXMLbasename
protectedinherited

XML file that might hold config param_sets.

Definition at line 96 of file GFluxFileConfigI.h.

Referenced by genie::flux::GFluxFileConfigI::GetXMLFileBase(), and genie::flux::GFluxFileConfigI::SetXMLFileBase().

double genie::flux::GFluxFileConfigI::fZ0
protectedinherited

configurable starting z position for each flux neutrino (in detector coord system)

Definition at line 100 of file GFluxFileConfigI.h.

Referenced by genie::flux::GDk2NuFlux::GenerateNext_weighted(), GenerateNext_weighted(), genie::flux::GDk2NuFlux::PrintConfig(), and genie::flux::GFluxFileConfigI::SetUpstreamZ().


The documentation for this class was generated from the following files: