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

An implementation of the GENIE GFluxI interface ("flux driver") encapsulating reading/processing the "dk2nu" tree structure. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/dk2nugenie/v01_08_00e/source/dk2nu/genie/GDk2NuFlux.h"

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

Public Member Functions

 GDk2NuFlux ()
 
 ~GDk2NuFlux ()
 
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 bsim::NuChoiceGetNuChoice (void)
 
const bsim::Dk2NuGetDk2Nu (void)
 
const bsim::DkMetaGetDkMeta (void)
 
Long64_t GetEntryNumber ()
 index in chain More...
 
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
 
double POT_curr (void)
 current average POT (RWH?) More...
 
double UsedPOTs (void) const
 

of protons-on-target used

More...
 
long int NFluxNeutrinos (void) const
 number of flux neutrinos looped so far 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< std::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 SetTreeNames (std::string fname="dk2nuTree", std::string mname="dkmetaTree")
 
bool LoadConfig (std::string cfg)
 load a named configuration More...
 
void SetMaxEnergy (double Ev)
 specify max flx nu 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 ScanForMaxWeight (void)
 scan for max flux weight (before generating unweighted flux neutrinos) More...
 
void SetMaxWgtScan (double fudge=1.05, long int nentries=2500000)
 
void SetMaxEFudge (double fudge=1.05)
 
void SetMinMaxWeight (double minwgt)
 
void SetMaxWeightFailModel (int i=0)
 
void SetApplyWindowTiltWeight (bool apply=true)
 
void SetLengthUnits (double user_units)
 Set units assumed by user. More...
 
double LengthUnits (void) const
 Return user units. More...
 
void SetBeamRotation (TRotation beamrot)
 < beam (0,0,0) relative to user frame, beam direction in user frame More...
 
void SetBeamCenter (TVector3 beam0)
 
TRotation GetBeamRotation () const
 rotation to apply from beam->user More...
 
TVector3 GetBeamCenter () const
 beam origin in user frame More...
 
bool IsFluxSphere () const
 flat window or sphere More...
 
void SetFluxWindow (TVector3 p1, TVector3 p2, TVector3 p3)
 3 points define a plane (by default in user coordinates) More...
 
void GetFluxWindow (TVector3 &p1, TVector3 &p2, TVector3 &p3) const
 3 points define a plane in beam coordinate More...
 
void SetFluxSphere (TVector3 center, double radius, bool inDetCoord=true)
 specification of a sphere More...
 
void GetFluxSphere (TVector3 &center, double &radius, bool inDetCoord=true) const
 specification of a sphere More...
 
void Beam2UserPos (const TLorentzVector &beamxyz, TLorentzVector &usrxyz) const
 
void Beam2UserDir (const TLorentzVector &beamdir, TLorentzVector &usrdir) const
 
void Beam2UserP4 (const TLorentzVector &beamp4, TLorentzVector &usrp4) const
 
void User2BeamPos (const TLorentzVector &usrxyz, TLorentzVector &beamxyz) const
 
void User2BeamDir (const TLorentzVector &usrdir, TLorentzVector &beamdir) const
 
void User2BeamP4 (const TLorentzVector &usrp4, TLorentzVector &beamp4) const
 
TVector3 FluxWindowNormal () const
 
TVector3 SphereNormal () const
 
 GDk2NuFlux ()
 
 ~GDk2NuFlux ()
 
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 bsim::NuChoiceGetNuChoice (void)
 
const bsim::Dk2NuGetDk2Nu (void)
 
const bsim::DkMetaGetDkMeta (void)
 
Long64_t GetEntryNumber ()
 index in chain More...
 
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
 
double POT_curr (void)
 current average POT (RWH?) More...
 
double UsedPOTs (void) const
 

of protons-on-target used

More...
 
long int NFluxNeutrinos (void) const
 number of flux neutrinos looped so far 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< std::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 SetTreeNames (std::string fname="dk2nuTree", std::string mname="dkmetaTree")
 
bool LoadConfig (std::string cfg)
 load a named configuration More...
 
void SetMaxEnergy (double Ev)
 specify max flx nu 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 ScanForMaxWeight (void)
 scan for max flux weight (before generating unweighted flux neutrinos) More...
 
void SetMaxWgtScan (double fudge=1.05, long int nentries=2500000)
 
void SetMaxEFudge (double fudge=1.05)
 
void SetMinMaxWeight (double minwgt)
 
void SetMaxWeightFailModel (int i=0)
 
void SetApplyWindowTiltWeight (bool apply=true)
 
void SetLengthUnits (double user_units)
 Set units assumed by user. More...
 
double LengthUnits (void) const
 Return user units. More...
 
void SetBeamRotation (TRotation beamrot)
 < beam (0,0,0) relative to user frame, beam direction in user frame More...
 
void SetBeamCenter (TVector3 beam0)
 
TRotation GetBeamRotation () const
 rotation to apply from beam->user More...
 
TVector3 GetBeamCenter () const
 beam origin in user frame More...
 
bool IsFluxSphere () const
 flat window or sphere More...
 
void SetFluxWindow (TVector3 p1, TVector3 p2, TVector3 p3)
 3 points define a plane (by default in user coordinates) More...
 
void GetFluxWindow (TVector3 &p1, TVector3 &p2, TVector3 &p3) const
 3 points define a plane in beam coordinate More...
 
void SetFluxSphere (TVector3 center, double radius, bool inDetCoord=true)
 specification of a sphere More...
 
void GetFluxSphere (TVector3 &center, double &radius, bool inDetCoord=true) const
 specification of a sphere More...
 
void Beam2UserPos (const TLorentzVector &beamxyz, TLorentzVector &usrxyz) const
 
void Beam2UserDir (const TLorentzVector &beamdir, TLorentzVector &usrdir) const
 
void Beam2UserP4 (const TLorentzVector &beamp4, TLorentzVector &usrp4) const
 
void User2BeamPos (const TLorentzVector &usrxyz, TLorentzVector &beamxyz) const
 
void User2BeamDir (const TLorentzVector &usrdir, TLorentzVector &beamdir) const
 
void User2BeamP4 (const TLorentzVector &usrp4, TLorentzVector &beamp4) const
 
TVector3 FluxWindowNormal () const
 
TVector3 SphereNormal () const
 
const char * GetExposureUnits () const
 what units are returned by GetTotalExposure? More...
 
genie::flux::Exposure_t GetExposureType () const
 
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, std::string fname)
 
void CalcEffPOTsPerNu (void)
 
void LoadDkMeta (void)
 
bool GenerateNext_weighted (void)
 
void Initialize (void)
 
void SetDefaults (void)
 
void CleanUp (void)
 
void ResetCurrent (void)
 
void AddFile (TTree *fluxtree, TTree *metatree, std::string fname)
 
void CalcEffPOTsPerNu (void)
 
void LoadDkMeta (void)
 

Private Attributes

double fMaxEv
 maximum energy More...
 
bool fEnd
 end condition reached More...
 
std::vector< std::stringfNuFluxFilePatterns
 (potentially wildcarded) path(s) More...
 
std::string fTreeNames [2]
 pair of names "dk2nuTree", "dkmetaTree" More...
 
TChain * fNuFluxTree
 TTree // REF ONLY! More...
 
TChain * fNuMetaTree
 TTree // REF ONLY! More...
 
bsim::Dk2NufCurDk2Nu
 
bsim::DkMetafCurDkMeta
 
bsim::NuChoicefCurNuChoice
 
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...
 
Long64_t fNuTot
 cummulative # of entries (=fNEntries) More...
 
Long64_t fFilePOTs
 

of protons-on-target represented by all files

More...
 
std::map< int, intfJobToMetaIndex
 quick lookup from job# to meta chain More...
 
double fWeight
 current neutrino weight, =1 if generating unweighted entries More...
 
double fMaxWeight
 max flux neutrino weight in input file More...
 
double fMinMaxWeight
 user set lower limit on estimate More...
 
double fMaxWeightScan
 initial estimate from scan More...
 
double fMaxWeightInit
 max of scan & minmaxweight More...
 
double fMaxWeightMax
 if "frozen" this is what bump would given More...
 
double fMaxWgtFudge
 fudge factor for estimating max wgt More...
 
long int fMaxWgtEntries
 

of entries in estimating max wgt

More...
 
double fMaxEFudge
 fudge factor for estmating max enu (0=> use fixed 120GeV) More...
 
long int fMaxWgtExceeded
 track failures of estimate More...
 
int fMaxWgtFailModel
 what to do ... 0=bump, 1=frozen, 2=abort 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...
 
double fEffPOTsPerNu
 what a entry is worth ... More...
 
double fAccumPOTs
 POTs used so far. More...
 
bool fGenWeighted
 does GenerateNext() give weights? More...
 
bool fApplyTiltWeight
 wgt due to window normal not || beam More...
 
bool fDetLocIsSet
 is a flux location (near/far) set? More...
 
double fLengthUnits
 units for coord in user exchanges More...
 
double fLengthScaleB2U
 scale factor beam (cm) –> user More...
 
double fLengthScaleU2B
 scale factor beam user –> (cm) More...
 
TLorentzVector fBeamZero
 beam origin in user coords More...
 
TLorentzRotation fBeamRot
 rotation applied beam –> user coord More...
 
TLorentzRotation fBeamRotInv
 
bool fIsSphere
 doing this on a sphere rather than a flat window? More...
 
TVector3 fFluxWindowPtUser [3]
 user points of flux window More...
 
TLorentzVector fFluxWindowBase
 base point for flux window - beam coord More...
 
TLorentzVector fFluxWindowDir1
 extent for flux window (direction 1) More...
 
TLorentzVector fFluxWindowDir2
 extent for flux window (direction 2) More...
 
double fFluxWindowLen1
 
double fFluxWindowLen2
 
TVector3 fFluxWindowNormal
 normal direction for flux window – beam coord More...
 
TVector3 fFluxSphereCenterUser
 center for flux sphere - user coords More...
 
TVector3 fFluxSphereCenterBeam
 center for flux sphere - beam coords More...
 
double fFluxSphereRadius
 radius for flux sphere More...
 
TLorentzVector fgX4dkvtx
 decay 4-position beam coord More...
 

Detailed Description

An implementation of the GENIE GFluxI interface ("flux driver") encapsulating reading/processing the "dk2nu" tree structure.

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

Nov 6, 2012

Copyright (c) 2012, GENIE Neutrino MC Generator Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 69 of file GDk2NuFlux.h.

Constructor & Destructor Documentation

GDk2NuFlux::GDk2NuFlux ( )

Definition at line 130 of file GDk2NuFlux.cxx.

References Initialize().

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

133 // #endif
134 {
135  this->Initialize();
136 }
GFluxExposureI(genie::flux::Exposure_t etype)
GDk2NuFlux::~GDk2NuFlux ( )

Definition at line 138 of file GDk2NuFlux.cxx.

References CleanUp().

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

139 {
140  this->CleanUp();
141 }
genie::flux::GDk2NuFlux::GDk2NuFlux ( )
genie::flux::GDk2NuFlux::~GDk2NuFlux ( )

Member Function Documentation

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

Definition at line 1192 of file GDk2NuFlux.cxx.

References dkmeta, fCurDk2Nu, fCurDkMeta, fCurNuChoice, fFilePOTs, plot_validation_datamc::fname, fNFiles, fNuFluxTree, fNuMetaTree, fNuTot, fTreeNames, LOG, nentries, pFATAL, pINFO, bsim::DkMeta::pots, and SLOG.

Referenced by LoadBeamSimData(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1193 {
1194  // Add a file to the chain
1195 
1196  ULong64_t nentries = ftree->GetEntries();
1197 
1198  // generally files will only have one meta data entry, but if they've
1199  // been combined (i.e. "hadd") there might be more than one.
1200  int nmeta = mtree->GetEntries();
1201  double potsum = 0;
1203  mtree->SetBranchAddress("dkmeta",&dkmeta);
1204  for (int imeta = 0; imeta < nmeta; ++imeta ) {
1205  mtree->GetEntry(imeta);
1206  double potentry = dkmeta->pots;
1207  potsum += potentry;
1208  }
1209  delete dkmeta;
1210 
1211  // don't need these anymore
1212  delete ftree;
1213  delete mtree;
1214 
1215  // make sure the chains are defined and a branch object attached
1216  if ( ! fNuFluxTree ) {
1217  fNuFluxTree = new TChain(fTreeNames[0].c_str());
1218  fNuMetaTree = new TChain(fTreeNames[1].c_str());
1219  fCurDk2Nu = new bsim::Dk2Nu;
1220  fCurDkMeta = new bsim::DkMeta;
1222  fNuFluxTree->SetBranchAddress("dk2nu",&fCurDk2Nu);
1223  fNuMetaTree->SetBranchAddress("dkmeta",&fCurDkMeta);
1224  }
1225 
1226  // add the file to the chains
1227  int stat0 = fNuFluxTree->AddFile(fname.c_str());
1228  int stat1 = fNuMetaTree->AddFile(fname.c_str());
1229 
1230  LOG("Flux",pINFO)
1231  << "flux->AddFile() of " << nentries
1232  << " " << ((mtree)?"[+meta]":"[no-meta]")
1233  << " [status=" << stat0 << "," << stat1 << "]"
1234  << nentries << " (" << nmeta << ")"
1235  << " entries in file: " << fname;
1236 
1237  if ( stat0 != 1 || stat1 != 1 ) {
1238  SLOG("GDk2NuFlux", pFATAL) << "Add: \"" << fname << "\" failed";
1239  }
1240 
1241  fNuTot += nentries;
1242  fFilePOTs += potsum;
1243  fNFiles++;
1244 
1245 }
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
TChain * fNuFluxTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:272
Long64_t fNuTot
cummulative # of entries (=fNEntries)
Definition: GDk2NuFlux.h:282
#define pFATAL
Definition: Messenger.h:57
std::string fTreeNames[2]
pair of names "dk2nuTree", "dkmetaTree"
Definition: GDk2NuFlux.h:271
Long64_t fFilePOTs
of protons-on-target represented by all files
Definition: GDk2NuFlux.h:283
TChain * fNuMetaTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:273
Double_t pots
protons-on-target
Definition: dkmeta.h:87
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Long64_t nentries
#define pINFO
Definition: Messenger.h:63
bsim::DkMeta * fCurDkMeta
Definition: GDk2NuFlux.h:276
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
int fNFiles
number of files in chain
Definition: GDk2NuFlux.h:279
bsim::DkMeta * dkmeta
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:85
void genie::flux::GDk2NuFlux::AddFile ( TTree *  fluxtree,
TTree *  metatree,
std::string  fname 
)
private
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 GDk2NuFlux::Beam2UserDir ( const TLorentzVector &  beamdir,
TLorentzVector &  usrdir 
) const

Definition at line 1014 of file GDk2NuFlux.cxx.

References fBeamRot, and fLengthScaleB2U.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1016 {
1017  usrdir = fLengthScaleB2U*(fBeamRot*beamdir);
1018 }
double fLengthScaleB2U
scale factor beam (cm) –> user
Definition: GDk2NuFlux.h:311
TLorentzRotation fBeamRot
rotation applied beam –> user coord
Definition: GDk2NuFlux.h:315
void genie::flux::GDk2NuFlux::Beam2UserDir ( const TLorentzVector &  beamdir,
TLorentzVector &  usrdir 
) const
void GDk2NuFlux::Beam2UserP4 ( const TLorentzVector &  beamp4,
TLorentzVector &  usrp4 
) const

Definition at line 1019 of file GDk2NuFlux.cxx.

References fBeamRot.

Referenced by GenerateNext_weighted(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1021 {
1022  usrp4 = fBeamRot*beamp4;
1023 }
TLorentzRotation fBeamRot
rotation applied beam –> user coord
Definition: GDk2NuFlux.h:315
void genie::flux::GDk2NuFlux::Beam2UserP4 ( const TLorentzVector &  beamp4,
TLorentzVector &  usrp4 
) const
void GDk2NuFlux::Beam2UserPos ( const TLorentzVector &  beamxyz,
TLorentzVector &  usrxyz 
) const

Definition at line 1009 of file GDk2NuFlux.cxx.

References fBeamRot, fBeamZero, and fLengthScaleB2U.

Referenced by GenerateNext_weighted(), SetFluxSphere(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1011 {
1012  usrxyz = fLengthScaleB2U*(fBeamRot*beamxyz) + fBeamZero;
1013 }
double fLengthScaleB2U
scale factor beam (cm) –> user
Definition: GDk2NuFlux.h:311
TLorentzVector fBeamZero
beam origin in user coords
Definition: GDk2NuFlux.h:314
TLorentzRotation fBeamRot
rotation applied beam –> user coord
Definition: GDk2NuFlux.h:315
void genie::flux::GDk2NuFlux::Beam2UserPos ( const TLorentzVector &  beamxyz,
TLorentzVector &  usrxyz 
) const
void GDk2NuFlux::CalcEffPOTsPerNu ( void  )
private

Definition at line 481 of file GDk2NuFlux.cxx.

References e, fEffPOTsPerNu, fFilePOTs, fFluxWindowDir1, fFluxWindowDir2, fNEntries, fNuFluxTree, LOG, Mag(), pNOTICE, and pWARN.

Referenced by LoadBeamSimData(), SetFluxWindow(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

482 {
483  // do this if flux window changes or # of files changes
484 
485  if (!fNuFluxTree) return; // not yet fully configured
486 
487  // effpots = mc_pots * (wgtfunction-area) / window-area / wgt-max-est
488  // wgtfunction-area = pi * radius-det-element^2 = pi * (100.cm)^2
489 
490  // this should match what is used in the CalcEnuWgt()
491  const double kRDET = 100.0; // set to flux per 100 cm radius
492  const double kRDET2 = kRDET * kRDET;
493  double flux_area = fFluxWindowDir1.Vect().Cross(fFluxWindowDir2.Vect()).Mag();
494  LOG("Flux",pNOTICE) << "in CalcEffPOTsPerNu, area = " << flux_area;
495 
496  if ( flux_area < 1.0e-30 ) {
497  LOG("Flux", pWARN)
498  << "CalcEffPOTsPerNu called with flux window area effectively zero";
499  flux_area = 1;
500  }
501  double area_ratio = TMath::Pi() * kRDET2 / flux_area;
502  fEffPOTsPerNu = area_ratio * ( (double)fFilePOTs / (double)fNEntries );
503 }
TChain * fNuFluxTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:272
double fEffPOTsPerNu
what a entry is worth ...
Definition: GDk2NuFlux.h:303
Long64_t fFilePOTs
of protons-on-target represented by all files
Definition: GDk2NuFlux.h:283
#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
TLorentzVector fFluxWindowDir1
extent for flux window (direction 1)
Definition: GDk2NuFlux.h:321
float Mag() const
TLorentzVector fFluxWindowDir2
extent for flux window (direction 2)
Definition: GDk2NuFlux.h:322
#define pNOTICE
Definition: Messenger.h:62
Long64_t fNEntries
number of flux ntuple entries
Definition: GDk2NuFlux.h:280
Float_t e
Definition: plot.C:35
void genie::flux::GDk2NuFlux::CalcEffPOTsPerNu ( void  )
private
void genie::flux::GDk2NuFlux::CleanUp ( void  )
private
void GDk2NuFlux::CleanUp ( void  )
private

Definition at line 1178 of file GDk2NuFlux.cxx.

References fCurNuChoice, genie::flux::GFluxFileConfigI::fICycle, fIEntry, fIUse, genie::flux::GFluxFileConfigI::fNCycles, fNUse, genie::flux::GFluxFileConfigI::fPdgCList, genie::flux::GFluxFileConfigI::fPdgCListRej, LOG, and pNOTICE.

Referenced by ~GDk2NuFlux(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1179 {
1180  LOG("Flux", pNOTICE) << "Cleaning up...";
1181 
1182  if ( fPdgCList ) delete fPdgCList;
1183  if ( fPdgCListRej ) delete fPdgCListRej;
1184  if ( fCurNuChoice ) delete fCurNuChoice;
1185 
1186  LOG("Flux", pNOTICE)
1187  << " flux file cycles: " << fICycle << " of " << fNCycles
1188  << ", entry " << fIEntry << " use: " << fIUse << " of " << fNUse;
1189 }
long int fNUse
how often to use same entry in a row
Definition: GDk2NuFlux.h:299
Long64_t fIEntry
current flux ntuple entry
Definition: GDk2NuFlux.h:281
long int fIUse
current # of times an entry has been used
Definition: GDk2NuFlux.h:300
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
long int fNCycles
times to cycle through the ntuple(s)
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
#define pNOTICE
Definition: Messenger.h:62
void genie::flux::GDk2NuFlux::Clear ( Option_t *  opt)
virtual

reset state variables based on opt

Implements genie::GFluxI.

void GDk2NuFlux::Clear ( Option_t *  opt)
virtual

reset state variables based on opt

Implements genie::GFluxI.

Definition at line 1049 of file GDk2NuFlux.cxx.

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

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1050 {
1051  // Clear the driver state
1052  //
1053  LOG("Flux", pWARN) << "GSimpleNtpFlux::Clear(" << opt << ") called";
1054  // do it in all cases, but EVGDriver/GMCJDriver will pass "CycleHistory"
1055 
1056  fICycle = 0;
1057 
1058  fSumWeight = 0;
1059  fNNeutrinos = 0;
1060  fAccumPOTs = 0;
1061 }
long int fNNeutrinos
number of flux neutrinos thrown so far
Definition: GDk2NuFlux.h:302
double fSumWeight
sum of weights for nus thrown so far
Definition: GDk2NuFlux.h:301
#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.
Definition: GDk2NuFlux.h:304
bool genie::flux::GDk2NuFlux::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 89 of file GDk2NuFlux.h.

Referenced by GenerateNext().

89 { return fEnd; }
bool fEnd
end condition reached
Definition: GDk2NuFlux.h:257
bool genie::flux::GDk2NuFlux::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 89 of file GDk2NuFlux.h.

89 { return fEnd; }
bool fEnd
end condition reached
Definition: GDk2NuFlux.h:257
const PDGCodeList& genie::flux::GDk2NuFlux::FluxParticles ( void  )
inlinevirtual

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

Implements genie::GFluxI.

Definition at line 82 of file GDk2NuFlux.h.

82 { return *fPdgCList; }
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
const PDGCodeList& genie::flux::GDk2NuFlux::FluxParticles ( void  )
inlinevirtual

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

Implements genie::GFluxI.

Definition at line 82 of file GDk2NuFlux.h.

82 { return *fPdgCList; }
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
TVector3 genie::flux::GDk2NuFlux::FluxWindowNormal ( ) const
inline

Definition at line 237 of file GDk2NuFlux.h.

References make_static_page::AddFile(), plot_validation_datamc::fname, TMVAGlob::Initialize(), and string.

Referenced by GenerateNext_weighted().

237 { return (fIsSphere) ? SphereNormal() : fFluxWindowNormal; }
bool fIsSphere
doing this on a sphere rather than a flat window?
Definition: GDk2NuFlux.h:318
TVector3 SphereNormal() const
Definition: GDk2NuFlux.cxx:978
TVector3 fFluxWindowNormal
normal direction for flux window – beam coord
Definition: GDk2NuFlux.h:325
TVector3 genie::flux::GDk2NuFlux::FluxWindowNormal ( ) const
inline

Definition at line 237 of file GDk2NuFlux.h.

References make_static_page::AddFile(), plot_validation_datamc::fname, TMVAGlob::Initialize(), and string.

237 { return (fIsSphere) ? SphereNormal() : fFluxWindowNormal; }
bool fIsSphere
doing this on a sphere rather than a flat window?
Definition: GDk2NuFlux.h:318
TVector3 SphereNormal() const
Definition: GDk2NuFlux.cxx:978
TVector3 fFluxWindowNormal
normal direction for flux window – beam coord
Definition: GDk2NuFlux.h:325
bool genie::flux::GDk2NuFlux::GenerateNext ( void  )
virtual

generate the next flux neutrino (return false in err)

Implements genie::GFluxI.

bool GDk2NuFlux::GenerateNext ( void  )
virtual

generate the next flux neutrino (return false in err)

Implements genie::GFluxI.

Definition at line 166 of file GDk2NuFlux.cxx.

References bsim::NuChoice::AsString(), bsim::Dk2Nu::AsString(), om::cout, febshutoff_auto::end, End(), MakeMiniprodValidationCuts::f, fCurDk2Nu, fCurNuChoice, fGenWeighted, fMaxWeight, fMaxWeightMax, fMaxWgtExceeded, fMaxWgtFailModel, fMaxWgtFudge, fWeight, GenerateNext_weighted(), genie::RandomGen::Instance(), LOG, genie::utils::print::P4AsShortString(), bsim::NuChoice::p4NuBeam, bsim::NuChoice::p4NuUser, bsim::NuChoice::pdgNu, pERROR, pFATAL, pNOTICE, PrintConfig(), r(), generate_hists::rnd, genie::RandomGen::RndFlux(), Weight(), genie::utils::print::X4AsString(), bsim::NuChoice::x4NuBeam, and bsim::NuChoice::x4NuUser.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

167 {
168 // Get next (unweighted) flux ntuple entry on the specified detector location
169 //
171  while ( true ) {
172  // Check for end of flux ntuple
173  bool end = this->End();
174  if ( end ) {
175  LOG("Flux", pNOTICE) << "GenerateNext signaled End() ";
176  return false;
177  }
178 
179  // Get next weighted flux ntuple entry
180  bool nextok = this->GenerateNext_weighted();
181  if ( fGenWeighted ) return nextok;
182  if ( ! nextok ) continue;
183 
184  /* RWH - debug purposes
185  if ( fNCycles == 0 ) {
186  LOG("Flux", pNOTICE)
187  << "Got flux entry: " << fIEntry
188  << " - Cycle: "<< fICycle << "/ infinite";
189  } else {
190  LOG("Flux", pNOTICE)
191  << "Got flux entry: "<< fIEntry
192  << " - Cycle: "<< fICycle << "/"<< fNCycles;
193  }
194  */
195 
196  // Get fractional weight & decide whether to accept curr flux neutrino
197  double f = this->Weight() / fMaxWeight;
198  //LOG("Flux", pNOTICE)
199  // << "Curr flux neutrino fractional weight = " << f;
200  if (f > 1.) {
201  // Oh,dear me ... what the weight max _should_ have been
202  double bumped = this->Weight() * fMaxWgtFudge;
203  if ( bumped > fMaxWeightMax ) fMaxWeightMax = bumped;
204  ++fMaxWgtExceeded;
205 
206  // what to do ...
207  if ( fMaxWgtFailModel <= 0 ) {
208  fMaxWeight = bumped;
209  LOG("Flux", pERROR)
210  << "** Fractional weight = " << f
211  << " > 1 !! Bump fMaxWeight estimate to " << fMaxWeight << "\n"
212  << fCurDk2Nu->AsString() << "\n" << fCurNuChoice->AsString();
213  std::cout << std::flush;
214  } else {
215  LOG("Flux", pERROR)
216  << "** Fractional weight = " << f
217  << " > 1 !! Leave fMaxWeight frozen at " << fMaxWeight << " "
218  << " not bumped to " << bumped << ", max so far: "
219  << fMaxWeightMax << "\n"
220  << fCurDk2Nu->AsString() << "\n" << fCurNuChoice->AsString();
221  std::cout << std::flush;
222  if ( fMaxWgtFailModel >= 2 ) {
223  PrintConfig();
224  std::cout << std::flush;
225  LOG("Flux", pFATAL)
226  << "User requested not to continue";
227  abort();
228  }
229  }
230  }
231  double r = rnd->RndFlux().Rndm(); // (f < 1.) ? rnd->RndFlux().Rndm() : 0;
232  bool accept = ( r < f );
233  if ( accept ) {
234 
235 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
236  LOG("Flux", pNOTICE)
237  << "Generated beam neutrino: "
238  << "\n pdg-code: " << fCurNuChoice->pdgNu
240  << "\n x4: " << utils::print::X4AsString(&(fCurNuChoice->x4NuBeam))
242  << "\n x4: " << utils::print::X4AsString(&(fCurNuChoice->x4NuUser));
243 #endif
244 
245  fWeight = 1.;
246  return true;
247  }
248 
249  //LOG("Flux", pNOTICE)
250  // << "** Rejecting current flux neutrino based on the flux weight only";
251  }
252  return false;
253 }
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:52
void PrintConfig()
print the current configuration
#define pERROR
Definition: Messenger.h:60
int pdgNu
generated nu pdg code
Definition: NuChoice.h:51
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
TLorentzVector x4NuBeam
generated nu 4-position in beam coord
Definition: NuChoice.h:56
std::string AsString(const std::string &opt="") const
#define pFATAL
Definition: Messenger.h:57
double fWeight
current neutrino weight, =1 if generating unweighted entries
Definition: GDk2NuFlux.h:287
double fMaxWgtFudge
fudge factor for estimating max wgt
Definition: GDk2NuFlux.h:293
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
double fMaxWeight
max flux neutrino weight in input file
Definition: GDk2NuFlux.h:288
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool End(void)
true if no more flux nu&#39;s can be thrown (eg reaching end of beam sim ntuples)
Definition: GDk2NuFlux.h:89
double fMaxWeightMax
if "frozen" this is what bump would given
Definition: GDk2NuFlux.h:292
bool GenerateNext_weighted(void)
Definition: GDk2NuFlux.cxx:255
int fMaxWgtFailModel
what to do ... 0=bump, 1=frozen, 2=abort
Definition: GDk2NuFlux.h:297
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
OStream cout
Definition: OStream.cxx:6
TLorentzVector x4NuUser
generated nu 4-position in user/det coord
Definition: NuChoice.h:58
TLorentzVector p4NuUser
generated nu 4-momentum in user/det coord
Definition: NuChoice.h:57
double Weight(void)
returns the flux neutrino weight (if any)
Definition: GDk2NuFlux.h:86
TRandom3 r(0)
std::string AsString(const std::string &opt="") const
#define pNOTICE
Definition: Messenger.h:62
bool fGenWeighted
does GenerateNext() give weights?
Definition: GDk2NuFlux.h:306
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:72
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
TLorentzVector p4NuBeam
generated nu 4-momentum in beam coord
Definition: NuChoice.h:55
long int fMaxWgtExceeded
track failures of estimate
Definition: GDk2NuFlux.h:296
bool GDk2NuFlux::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 255 of file GDk2NuFlux.cxx.

References bsim::Dk2Nu::ancestor, ana::assert(), Beam2UserP4(), Beam2UserPos(), bsim::calcEnuWgt(), bsim::Dk2Nu::decay, genie::PDGCodeList::ExistsInPDGCodeList(), fAccumPOTs, fApplyTiltWeight, fCurDk2Nu, fCurNuChoice, fEffPOTsPerNu, fEnd, fFluxWindowBase, fFluxWindowDir1, fFluxWindowDir2, fgX4dkvtx, genie::flux::GFluxFileConfigI::fICycle, fIEntry, fIUse, FluxWindowNormal(), fMaxEv, fMaxWeight, genie::flux::GFluxFileConfigI::fNCycles, fNEntries, fNNeutrinos, fNuFluxTree, genie::flux::GFluxFileConfigI::fPdgCList, genie::flux::GFluxFileConfigI::fPdgCListRej, fSumWeight, fWeight, genie::flux::GFluxFileConfigI::fZ0, GetDecayDist(), bsim::NuChoice::impWgt, bsim::Dk2Nu::indxnu(), genie::RandomGen::Instance(), LOG, MoveToZ0(), bsim::Decay::nimpwt, bsim::Decay::ntype, bsim::Dk2Nu::overflow(), genie::utils::print::P4AsShortString(), bsim::NuChoice::p4NuBeam, bsim::NuChoice::p4NuUser, pDEBUG, bsim::NuChoice::pdgNu, pERROR, pFATAL, pINFO, pNOTICE, bsim::Dk2Nu::potnum, genie::PDGCodeList::push_back(), pWARN, ResetCurrent(), generate_hists::rnd, genie::RandomGen::RndFlux(), Unit(), bsim::Decay::vx, bsim::Decay::vy, bsim::Decay::vz, Weight(), genie::utils::print::X4AsString(), bsim::NuChoice::x4NuBeam, bsim::NuChoice::x4NuUser, and bsim::NuChoice::xyWgt.

Referenced by GenerateNext(), ScanForMaxWeight(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

256 {
257 // Get next (weighted) flux ntuple entry on the specified detector location
258 //
259 
260  // Check whether a flux ntuple has been loaded
261  if ( ! fNuFluxTree ) {
262  LOG("Flux", pERROR)
263  << "The flux driver has not been properly configured";
264  return false;
265  }
266 
267  // Reuse an entry?
268  //std::cout << " ***** iuse " << fIUse << " nuse " << fNUse
269  // << " ientry " << fIEntry << " nentry " << fNEntries
270  // << " icycle " << fICycle << " ncycle " << fNCycles << std::endl;
271  if ( fIUse < fNUse && fIEntry >= 0 ) {
272  // Reuse this entry
273  fIUse++;
274  } else {
275  // Reset previously generated neutrino code / 4-p / 4-x
276  this->ResetCurrent();
277  // Move on, read next flux ntuple entry
278  fIEntry++;
279  if ( fIEntry >= fNEntries ) {
280  // Ran out of entries @ the current cycle of this flux file
281  // Check whether more (or infinite) number of cycles is requested
282  if (fICycle < fNCycles || fNCycles == 0 ) {
283  fICycle++;
284  fIEntry=0;
285  } else {
286  LOG("Flux", pWARN)
287  << "No more entries in input flux neutrino ntuple, cycle "
288  << fICycle << " of " << fNCycles;
289  fEnd = true;
290  //assert(0);
291  return false;
292  }
293  }
294 
295  fNuFluxTree->GetEntry(fIEntry);
296 
297 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
298  LOG("Flux",pDEBUG)
299  << "got " << fNNeutrinos << " new fIEntry " << fIEntry
300  << " pot# " << fCurDk2Nu->potnum;
301 #endif
302 
303  fIUse = 1;
304 
305  // here we might want to do flavor oscillations or simple mappings
308  }
309 
310  // update the # POTs & number of neutrinos
311  // Do this HERE (before rejecting flavors that users might be weeding out)
312  // in order to keep the POT accounting correct. This allows one to get
313  // the right normalization for generating only events from the intrinsic
314  // nu_e entries.
316  fNNeutrinos++;
317 
318  // Check neutrino pdg against declared list of neutrino species declared
319  // by the current instance of the neutrino flux driver.
320  // No undeclared neutrino species will be accepted at this point as GENIE
321  // has already been configured to handle the specified list.
322  // Make sure that the appropriate list of flux neutrino species was set at
323  // initialization via GDk2NuFlux::SetFluxParticles(const PDGCodeList &)
324 
326  /// user might modify list via SetFluxParticles() in order to reject certain
327  /// flavors, even if they're found in the file. So don't make a big fuss.
328  /// Spit out a single message and then stop reporting that flavor as problematic.
329  int badpdg = fCurNuChoice->pdgNu;
330  if ( ! fPdgCListRej->ExistsInPDGCodeList(badpdg) ) {
331  fPdgCListRej->push_back(badpdg);
332  LOG("Flux", pWARN)
333  << "Encountered neutrino specie (" << badpdg
334  << " that wasn't in SetFluxParticles() list, "
335  << "\nDeclared list of neutrino species: " << *fPdgCList;
336  }
337  return false;
338  }
339 
340  // Update the curr neutrino weight and energy
341 
342  // Check current neutrino energy against the maximum flux neutrino energy
343  // declared by the current instance of the neutrino flux driver.
344  // No flux neutrino exceeding that maximum energy will be accepted at this
345  // point as that maximum energy has already been used for normalizing the
346  // interaction probabilities.
347  // Make sure that the appropriate maximum flux neutrino energy was set at
348  // initialization via GDk2NuFlux::SetMaxEnergy(double Ev)
349 
351 
352  double Ev = 0;
353  double& wgt_xy = fCurNuChoice->xyWgt;
354  // recalculate on x-y window
356  fCurNuChoice->x4NuBeam += ( rnd->RndFlux().Rndm()*fFluxWindowDir1 +
357  rnd->RndFlux().Rndm()*fFluxWindowDir2 );
359 
360  if (Ev > fMaxEv) {
361  LOG("Flux", pWARN)
362  << "Flux neutrino energy exceeds declared maximum neutrino energy"
363  << "\nEv = " << Ev << "(> Ev{max} = " << fMaxEv << ")";
364  }
365 
366  // Set the current flux neutrino 4-momentum
367  // this is in *beam* coordinates
368  fgX4dkvtx = TLorentzVector( fCurDk2Nu->decay.vx,
369  fCurDk2Nu->decay.vy,
370  fCurDk2Nu->decay.vz, 0.);
371  // don't use TLorentzVector here for Mag() due to - on metric
372  TVector3 dirNu = (fCurNuChoice->x4NuBeam.Vect() - fgX4dkvtx.Vect()).Unit();
373  fCurNuChoice->p4NuBeam.SetPxPyPzE( Ev*dirNu.X(),
374  Ev*dirNu.Y(),
375  Ev*dirNu.Z(), Ev);
376 
377  // Set the current flux neutrino 4-position, direction in user coord
380 
381  fWeight = fCurNuChoice->impWgt * fCurNuChoice->xyWgt; // full weight
382  if ( fApplyTiltWeight ) {
383  // additional weight due to window tilt relative to flux direction
384  double tiltwgt = dirNu.Dot( FluxWindowNormal() );
385  fWeight *= TMath::Abs( tiltwgt );
386  }
387 
388  // set the time component of the Lorentz vectors
389  double dist_dk2start = GetDecayDist();
390  size_t inu = fCurDk2Nu->indxnu();
391  double t_dk = 0;
392  if ( ! fCurDk2Nu->overflow() && ! fCurDk2Nu->ancestor.empty() ) {
393  t_dk = fCurDk2Nu->ancestor[inu].startt; // units? seconds, hopefully
394  }
395  const double c_mbys = 299792458;
396  const double c_cmbys = c_mbys * 100.;
397  double tstart = t_dk + ( dist_dk2start / c_cmbys );
398  fCurNuChoice->x4NuBeam.SetT(tstart);
399  fCurNuChoice->x4NuUser.SetT(tstart);
400  if ( t_dk == 0 ) {
401  // probably wasn't set
402  static int nmsg = 5;
403  if ( nmsg > 0 ) {
404  --nmsg;
405  LOG("Flux", pNOTICE)
406  << "Setting time at flux window, \n"
407  << "noticed that t_dk from ancestor list was 0, "
408  << "this probably means that the calculated time is wrong";
409  }
410  }
411 
412  // if desired, move to user specified user coord z
413  if ( TMath::Abs(fZ0) < 1.0e30 ) this->MoveToZ0(fZ0);
414 
415 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
416  LOG("Flux", pINFO)
417  << "Generated neutrino: " << fIEntry << " " << fCurDk2Nu->potnum
418  << "\n pdg-code: " << fCurNuChoice->pdgNu
419  << "\n p4 beam: " << utils::print::P4AsShortString(&fCurNuChoice->p4NuBeam)
420  << "\n x4 beam: " << utils::print::X4AsString(&fCurNuChoice->x4NuBeam)
421  << "\n p4 user: " << utils::print::P4AsShortString(&(fCurNuChoice->p4NuUser))
422  << "\n x4 user: " << utils::print::X4AsString(&(fCurNuChoice->x4NuUser));
423 #endif
424  if ( Ev > fMaxEv ) {
425  LOG("Flux", pFATAL)
426  << "Generated neutrino had E_nu = " << Ev << " > " << fMaxEv
427  << " maximum ";
428  assert(0);
429  }
430 
431  // update sum of weights
432  fSumWeight += this->Weight();
433 
434  return true;
435 }
bool fApplyTiltWeight
wgt due to window normal not || beam
Definition: GDk2NuFlux.h:307
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:52
bool fEnd
end condition reached
Definition: GDk2NuFlux.h:257
#define pERROR
Definition: Messenger.h:60
int pdgNu
generated nu pdg code
Definition: NuChoice.h:51
TLorentzVector fgX4dkvtx
decay 4-position beam coord
Definition: GDk2NuFlux.h:330
long int fNNeutrinos
number of flux neutrinos thrown so far
Definition: GDk2NuFlux.h:302
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
Int_t potnum
proton # processed by simulation
Definition: dk2nu.h:324
TChain * fNuFluxTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:272
TLorentzVector x4NuBeam
generated nu 4-position in beam coord
Definition: NuChoice.h:56
size_t indxnu() const
ancestor index of nu ancestor.size()-1
double impWgt
Definition: NuChoice.h:53
double xyWgt
generated nu x-y weight
Definition: NuChoice.h:52
#define pFATAL
Definition: Messenger.h:57
Double_t nimpwt
% cumulative importance weight prod to decay
Definition: dk2nu.h:166
double fSumWeight
sum of weights for nus thrown so far
Definition: GDk2NuFlux.h:301
bsim::Decay decay
basic decay information
Definition: dk2nu.h:327
double fWeight
current neutrino weight, =1 if generating unweighted entries
Definition: GDk2NuFlux.h:287
bool overflow() const
ancestor list is incomplete (g4 minerva overflow)
bool ExistsInPDGCodeList(int pdg_code) const
double fMaxEv
maximum energy
Definition: GDk2NuFlux.h:255
void Beam2UserP4(const TLorentzVector &beamp4, TLorentzVector &usrp4) const
double GetDecayDist() const
dist (user units) from dk to current pos
Definition: GDk2NuFlux.cxx:437
Long64_t fIEntry
current flux ntuple entry
Definition: GDk2NuFlux.h:281
double fEffPOTsPerNu
what a entry is worth ...
Definition: GDk2NuFlux.h:303
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
Double_t vz
% neutrino production vertex z
Definition: dk2nu.h:132
long int fIUse
current # of times an entry has been used
Definition: GDk2NuFlux.h:300
void MoveToZ0(double z0)
move ray origin to user coord Z0
Definition: GDk2NuFlux.cxx:445
double fMaxWeight
max flux neutrino weight in input file
Definition: GDk2NuFlux.h:288
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
void Beam2UserPos(const TLorentzVector &beamxyz, TLorentzVector &usrxyz) const
Int_t ntype
% neutrino flavor (PDG? code)
Definition: dk2nu.h:128
#define pINFO
Definition: Messenger.h:63
long int fNCycles
times to cycle through the ntuple(s)
TVector3 Unit() const
int calcEnuWgt(const bsim::Decay &decay, const TVector3 &xyz, double &enu, double &wgt_xy)
workhorse routine
#define pWARN
Definition: Messenger.h:61
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
TLorentzVector fFluxWindowDir1
extent for flux window (direction 1)
Definition: GDk2NuFlux.h:321
TLorentzVector x4NuUser
generated nu 4-position in user/det coord
Definition: NuChoice.h:58
TLorentzVector fFluxWindowBase
base point for flux window - beam coord
Definition: GDk2NuFlux.h:320
double Weight(void)
returns the flux neutrino weight (if any)
Definition: GDk2NuFlux.h:86
TLorentzVector p4NuUser
generated nu 4-momentum in user/det coord
Definition: NuChoice.h:57
double fAccumPOTs
POTs used so far.
Definition: GDk2NuFlux.h:304
Double_t vx
% neutrino production vertex x
Definition: dk2nu.h:130
TVector3 FluxWindowNormal() const
Definition: GDk2NuFlux.h:237
assert(nhit_max >=nhit_nbins)
TLorentzVector fFluxWindowDir2
extent for flux window (direction 2)
Definition: GDk2NuFlux.h:322
Double_t vy
% neutrino production vertex y
Definition: dk2nu.h:131
#define pNOTICE
Definition: Messenger.h:62
Long64_t fNEntries
number of flux ntuple entries
Definition: GDk2NuFlux.h:280
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:72
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
TLorentzVector p4NuBeam
generated nu 4-momentum in beam coord
Definition: NuChoice.h:55
std::vector< bsim::Ancestor > ancestor
chain from proton to neutrino
Definition: dk2nu.h:329
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:67
#define pDEBUG
Definition: Messenger.h:64
bool genie::flux::GDk2NuFlux::GenerateNext_weighted ( void  )
private
void genie::flux::GDk2NuFlux::GenerateWeighted ( bool  gen_weighted)
virtual

set whether to generate weighted or unweighted neutrinos

Implements genie::GFluxI.

void GDk2NuFlux::GenerateWeighted ( bool  gen_weighted)
virtual

set whether to generate weighted or unweighted neutrinos

Implements genie::GFluxI.

Definition at line 1063 of file GDk2NuFlux.cxx.

References fGenWeighted.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1064 {
1065  // Set whether to generate weighted rays
1066  //
1067  fGenWeighted = gen_weighted;
1068 }
bool fGenWeighted
does GenerateNext() give weights?
Definition: GDk2NuFlux.h:306
TVector3 GDk2NuFlux::GetBeamCenter ( ) const

beam origin in user frame

Definition at line 971 of file GDk2NuFlux.cxx.

References fBeamZero.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

972 {
973  TVector3 beam0 = fBeamZero.Vect();
974  return beam0;
975 }
TLorentzVector fBeamZero
beam origin in user coords
Definition: GDk2NuFlux.h:314
TVector3 genie::flux::GDk2NuFlux::GetBeamCenter ( ) const

beam origin in user frame

TRotation GDk2NuFlux::GetBeamRotation ( ) const

rotation to apply from beam->user

Definition at line 958 of file GDk2NuFlux.cxx.

References fBeamRot.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

959 {
960  // rotation is really only 3-d vector, but we'll be operating on LorentzV's
961  // give people back the original TRotation ... not pretty
962  // ... it think this is right
963  TRotation rot3;
964  const TLorentzRotation& rot4 = fBeamRot;
965  TVector3 newX(rot4.XX(),rot4.XY(),rot4.XZ());
966  TVector3 newY(rot4.YX(),rot4.YY(),rot4.YZ());
967  TVector3 newZ(rot4.ZX(),rot4.ZY(),rot4.ZZ());
968  rot3.RotateAxes(newX,newY,newZ);
969  return rot3.Inverse();
970 }
TLorentzRotation fBeamRot
rotation applied beam –> user coord
Definition: GDk2NuFlux.h:315
TRotation genie::flux::GDk2NuFlux::GetBeamRotation ( ) const

rotation to apply from beam->user

virtual void genie::flux::GDk2NuFlux::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.

void GDk2NuFlux::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 740 of file GDk2NuFlux.cxx.

References fCurDk2Nu, and fCurNuChoice.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

743 {
744  // allow flux driver to report back current status and/or ntuple entry
745  // info for possible recording in the output file by supplying
746  // the class name, and a pointer to the object that will be filled
747  // as well as a suggested name for the branch.
748 
749  branchNames.push_back("dk2nu");
750  branchClassNames.push_back("bsim::Dk2Nu");
751  branchObjPointers.push_back((void**)&fCurDk2Nu);
752 
753  branchNames.push_back("nuchoice");
754  branchClassNames.push_back("bsim::NuChoice");
755  branchObjPointers.push_back((void**)&fCurNuChoice);
756 
757 }
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
double GDk2NuFlux::GetDecayDist ( ) const

dist (user units) from dk to current pos

Definition at line 437 of file GDk2NuFlux.cxx.

References fCurNuChoice, fgX4dkvtx, fLengthScaleB2U, and bsim::NuChoice::x4NuBeam.

Referenced by GenerateNext_weighted(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

438 {
439  // return distance (user units) between dk point and start position
440  // these are in beam units
441  TVector3 x3diff = fCurNuChoice->x4NuBeam.Vect() - fgX4dkvtx.Vect();
442  return x3diff.Mag() * fLengthScaleB2U;
443 }
TLorentzVector fgX4dkvtx
decay 4-position beam coord
Definition: GDk2NuFlux.h:330
TLorentzVector x4NuBeam
generated nu 4-position in beam coord
Definition: NuChoice.h:56
double fLengthScaleB2U
scale factor beam (cm) –> user
Definition: GDk2NuFlux.h:311
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
double genie::flux::GDk2NuFlux::GetDecayDist ( ) const

dist (user units) from dk to current pos

const bsim::Dk2Nu& genie::flux::GDk2NuFlux::GetDk2Nu ( void  )
inline

Definition at line 104 of file GDk2NuFlux.h.

104 { return *fCurDk2Nu; };
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
const bsim::Dk2Nu& genie::flux::GDk2NuFlux::GetDk2Nu ( void  )
inline

Definition at line 104 of file GDk2NuFlux.h.

Referenced by evgen::GENIEGen::produce().

104 { return *fCurDk2Nu; };
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
const bsim::DkMeta& genie::flux::GDk2NuFlux::GetDkMeta ( void  )
inline

Definition at line 105 of file GDk2NuFlux.h.

105 { LoadDkMeta(); return *fCurDkMeta; };
bsim::DkMeta * fCurDkMeta
Definition: GDk2NuFlux.h:276
const bsim::DkMeta& genie::flux::GDk2NuFlux::GetDkMeta ( void  )
inline

Definition at line 105 of file GDk2NuFlux.h.

Referenced by evgen::GENIEGen::produce().

105 { LoadDkMeta(); return *fCurDkMeta; };
bsim::DkMeta * fCurDkMeta
Definition: GDk2NuFlux.h:276
Long64_t genie::flux::GDk2NuFlux::GetEntryNumber ( )
inline

index in chain

Definition at line 107 of file GDk2NuFlux.h.

Long64_t genie::flux::GDk2NuFlux::GetEntryNumber ( )
inline

index in chain

Definition at line 107 of file GDk2NuFlux.h.

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> genie::flux::GDk2NuFlux::GetFileList ( )

list of files currently part of chain

std::vector< std::string > GDk2NuFlux::GetFileList ( )

list of files currently part of chain

Definition at line 1410 of file GDk2NuFlux.cxx.

References modify_metadata_with_upmu_sample_type::flist, fNuFluxTree, and next().

Referenced by PrintConfig(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1411 {
1412  std::vector<std::string> flist;
1413  if ( ! fNuFluxTree ) return flist;
1414  TObjArray *fileElements=fNuFluxTree->GetListOfFiles();
1415  if ( ! fileElements ) return flist;
1416  TIter next(fileElements);
1417  TChainElement *chEl=0;
1418  while (( chEl=(TChainElement*)next() )) {
1419  flist.push_back(chEl->GetTitle());
1420  }
1421  return flist;
1422 }
TChain * fNuFluxTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:272
void next()
Definition: show_event.C:84
void GDk2NuFlux::GetFluxSphere ( TVector3 &  center,
double &  radius,
bool  inDetCoord = true 
) const

specification of a sphere

Definition at line 926 of file GDk2NuFlux.cxx.

References fFluxSphereCenterBeam, fFluxSphereCenterUser, and fFluxSphereRadius.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

928 {
929  center = ( inDetCoord ) ? fFluxSphereCenterUser : fFluxSphereCenterBeam;
931 }
TVector3 fFluxSphereCenterBeam
center for flux sphere - beam coords
Definition: GDk2NuFlux.h:327
double fFluxSphereRadius
radius for flux sphere
Definition: GDk2NuFlux.h:328
Double_t radius
TVector3 fFluxSphereCenterUser
center for flux sphere - user coords
Definition: GDk2NuFlux.h:326
void genie::flux::GDk2NuFlux::GetFluxSphere ( TVector3 &  center,
double &  radius,
bool  inDetCoord = true 
) const

specification of a sphere

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

3 points define a plane in beam coordinate

Definition at line 934 of file GDk2NuFlux.cxx.

References fFluxWindowPtUser.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

935 {
936  // return flux window points
937  p0 = fFluxWindowPtUser[0];
938  p1 = fFluxWindowPtUser[1];
939  p2 = fFluxWindowPtUser[2];
940 
941 }
TVector3 fFluxWindowPtUser[3]
user points of flux window
Definition: GDk2NuFlux.h:319
void genie::flux::GDk2NuFlux::GetFluxWindow ( TVector3 &  p1,
TVector3 &  p2,
TVector3 &  p3 
) const

3 points define a plane in beam coordinate

virtual TTree* genie::flux::GDk2NuFlux::GetMetaDataTree ( )
virtual

Reimplemented from genie::flux::GFluxFileConfigI.

TTree * GDk2NuFlux::GetMetaDataTree ( )
virtual

Reimplemented from genie::flux::GFluxFileConfigI.

Definition at line 758 of file GDk2NuFlux.cxx.

References fNuMetaTree.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

758 { return fNuMetaTree; }
TChain * fNuMetaTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:273
const bsim::NuChoice& genie::flux::GDk2NuFlux::GetNuChoice ( void  )
inline

Definition at line 103 of file GDk2NuFlux.h.

103 { return *fCurNuChoice; };
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
const bsim::NuChoice& genie::flux::GDk2NuFlux::GetNuChoice ( void  )
inline

Definition at line 103 of file GDk2NuFlux.h.

Referenced by evgen::GENIEGen::produce().

103 { return *fCurNuChoice; };
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
double GDk2NuFlux::GetTotalExposure ( ) const
virtual

Implements genie::flux::GFluxExposureI.

Definition at line 144 of file GDk2NuFlux.cxx.

References UsedPOTs().

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

145 {
146  // complete the GFluxExposureI interface
147  return UsedPOTs();
148 }
double UsedPOTs(void) const
of protons-on-target used
Definition: GDk2NuFlux.cxx:552
virtual double genie::flux::GDk2NuFlux::GetTotalExposure ( ) const
virtual
virtual std::string genie::flux::GFluxFileConfigI::GetXMLFileBase ( ) const
inlinevirtualinherited
long int genie::flux::GDk2NuFlux::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 90 of file GDk2NuFlux.h.

References MECModelEnuComparisons::opt.

90 { return fIEntry; }
Long64_t fIEntry
current flux ntuple entry
Definition: GDk2NuFlux.h:281
long int genie::flux::GDk2NuFlux::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 90 of file GDk2NuFlux.h.

References MECModelEnuComparisons::opt.

90 { return fIEntry; }
Long64_t fIEntry
current flux ntuple entry
Definition: GDk2NuFlux.h:281
void GDk2NuFlux::Initialize ( void  )
private

Definition at line 1070 of file GDk2NuFlux.cxx.

References fAccumPOTs, fApplyTiltWeight, fCurDk2Nu, fCurDkMeta, fCurNuChoice, fDetLocIsSet, fEffPOTsPerNu, fEnd, fFilePOTs, fGenWeighted, genie::flux::GFluxFileConfigI::fICycle, fIEntry, fIsSphere, fIUse, fMaxEFudge, fMaxEv, fMaxWeight, fMaxWgtEntries, fMaxWgtExceeded, fMaxWgtFailModel, fMaxWgtFudge, fMinMaxWeight, fNEntries, fNFiles, fNNeutrinos, fNuFluxTree, fNuMetaTree, fNUse, fNuTot, fSumWeight, fTreeNames, LOG, pNOTICE, ResetCurrent(), SetDefaults(), SetLengthUnits(), and genie::utils::units::UnitFromString().

Referenced by GDk2NuFlux(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1071 {
1072  LOG("Flux", pNOTICE) << "Initializing GDk2NuFlux driver";
1073 
1074  fMaxEv = 0;
1075  fEnd = false;
1076 
1077 // #if __GENIE_RELEASE_CODE__ <= GRELCODE(2,9,0)
1078 // fPdgCList = new PDGCodeList;
1079 // fPdgCListRej = new PDGCodeList;
1080 // #endif
1081 
1082  fTreeNames[0] = "dk2nuTree";
1083  fTreeNames[1] = "dkmetaTree";
1084  fNuFluxTree = 0;
1085  fNuMetaTree = 0;
1086  fCurDk2Nu = 0;
1087  fCurDkMeta = 0;
1088  fCurNuChoice = 0;
1089  fNFiles = 0;
1090 
1091  fNEntries = 0;
1092  fIEntry = -1;
1093  fICycle = 0;
1094  fNUse = 1;
1095  fIUse = 999999;
1096 
1097  fNuTot = 0;
1098  fFilePOTs = 0;
1099 
1100  fMaxWeight = -1;
1101  fMinMaxWeight = 0;
1102  fMaxWgtFudge = 1.05;
1103  fMaxWgtEntries = 2500000;
1104  fMaxEFudge = 0;
1105 
1106  fMaxWgtExceeded = 0;
1107  fMaxWgtFailModel = 0; // default: 0=bump, 1=leave frozen, 2=abort
1108 
1109  fSumWeight = 0;
1110  fNNeutrinos = 0;
1111  fEffPOTsPerNu = 0;
1112  fAccumPOTs = 0;
1113 
1114  fGenWeighted = false;
1115  fApplyTiltWeight = true;
1116  fIsSphere = false;
1117  fDetLocIsSet = false;
1118  // by default assume user length is m
1120 
1121 // #if __GENIE_RELEASE_CODE__ < GRELCODE(2,9,0)
1122 // // migrated to GFluxFileConfigI
1123 // fXMLbasename = "GNuMIFlux.xml";
1124 // fNCycles = 0;
1125 // fZ0 = -3.4e38;
1126 // #endif
1127 
1128  this->SetDefaults();
1129  this->ResetCurrent();
1130 }
bool fApplyTiltWeight
wgt due to window normal not || beam
Definition: GDk2NuFlux.h:307
bool fEnd
end condition reached
Definition: GDk2NuFlux.h:257
long int fNNeutrinos
number of flux neutrinos thrown so far
Definition: GDk2NuFlux.h:302
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
TChain * fNuFluxTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:272
Long64_t fNuTot
cummulative # of entries (=fNEntries)
Definition: GDk2NuFlux.h:282
double fSumWeight
sum of weights for nus thrown so far
Definition: GDk2NuFlux.h:301
double fMaxEv
maximum energy
Definition: GDk2NuFlux.h:255
double fMaxWgtFudge
fudge factor for estimating max wgt
Definition: GDk2NuFlux.h:293
bool fIsSphere
doing this on a sphere rather than a flat window?
Definition: GDk2NuFlux.h:318
long int fNUse
how often to use same entry in a row
Definition: GDk2NuFlux.h:299
std::string fTreeNames[2]
pair of names "dk2nuTree", "dkmetaTree"
Definition: GDk2NuFlux.h:271
Long64_t fIEntry
current flux ntuple entry
Definition: GDk2NuFlux.h:281
double fEffPOTsPerNu
what a entry is worth ...
Definition: GDk2NuFlux.h:303
void SetLengthUnits(double user_units)
Set units assumed by user.
Long64_t fFilePOTs
of protons-on-target represented by all files
Definition: GDk2NuFlux.h:283
long int fIUse
current # of times an entry has been used
Definition: GDk2NuFlux.h:300
TChain * fNuMetaTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:273
double fMaxWeight
max flux neutrino weight in input file
Definition: GDk2NuFlux.h:288
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
double UnitFromString(string u)
Definition: UnitUtils.cxx:26
int fMaxWgtFailModel
what to do ... 0=bump, 1=frozen, 2=abort
Definition: GDk2NuFlux.h:297
bsim::DkMeta * fCurDkMeta
Definition: GDk2NuFlux.h:276
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
int fNFiles
number of files in chain
Definition: GDk2NuFlux.h:279
long int fMaxWgtEntries
of entries in estimating max wgt
Definition: GDk2NuFlux.h:294
double fMaxEFudge
fudge factor for estmating max enu (0=> use fixed 120GeV)
Definition: GDk2NuFlux.h:295
double fAccumPOTs
POTs used so far.
Definition: GDk2NuFlux.h:304
bool fDetLocIsSet
is a flux location (near/far) set?
Definition: GDk2NuFlux.h:308
#define pNOTICE
Definition: Messenger.h:62
bool fGenWeighted
does GenerateNext() give weights?
Definition: GDk2NuFlux.h:306
Long64_t fNEntries
number of flux ntuple entries
Definition: GDk2NuFlux.h:280
long int fMaxWgtExceeded
track failures of estimate
Definition: GDk2NuFlux.h:296
double fMinMaxWeight
user set lower limit on estimate
Definition: GDk2NuFlux.h:289
void genie::flux::GDk2NuFlux::Initialize ( void  )
private
bool genie::flux::GDk2NuFlux::IsFluxSphere ( ) const
inline

flat window or sphere

Definition at line 208 of file GDk2NuFlux.h.

References plot_validation_datamc::p1, plot_validation_datamc::p2, make_associated_cosmic_defs::p3, and radius.

Referenced by PrintConfig().

bool genie::flux::GDk2NuFlux::IsFluxSphere ( ) const
inline

flat window or sphere

Definition at line 208 of file GDk2NuFlux.h.

References plot_validation_datamc::p1, plot_validation_datamc::p2, make_associated_cosmic_defs::p3, and radius.

double GDk2NuFlux::LengthUnits ( void  ) const

Return user units.

Definition at line 1282 of file GDk2NuFlux.cxx.

References Munits::cm, fLengthScaleB2U, and genie::utils::units::UnitFromString().

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1283 {
1284  // Return the scale factor for lengths the user is getting
1285  double cm = genie::utils::units::UnitFromString("cm");
1286  return fLengthScaleB2U * cm ;
1287 }
double fLengthScaleB2U
scale factor beam (cm) –> user
Definition: GDk2NuFlux.h:311
double UnitFromString(string u)
Definition: UnitUtils.cxx:26
static constexpr Double_t cm
Definition: Munits.h:140
double genie::flux::GDk2NuFlux::LengthUnits ( void  ) const

Return user units.

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
virtual void genie::flux::GDk2NuFlux::LoadBeamSimData ( const std::vector< std::string > &  filenames,
const std::string det_loc 
)
virtual

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

Implements genie::flux::GFluxFileConfigI.

void GDk2NuFlux::LoadBeamSimData ( const std::vector< std::string > &  filenames,
const std::string det_loc 
)
virtual

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

Implements genie::flux::GFluxFileConfigI.

Definition at line 572 of file GDk2NuFlux.cxx.

References AddFile(), CalcEffPOTsPerNu(), exit(), fAccumPOTs, fDetLocIsSet, genie::flux::GFluxFileConfigI::fICycle, fIEntry, shutoffs::filename, fIUse, fMaxWeight, fNEntries, fNNeutrinos, fNuFluxFilePatterns, fNuFluxTree, fNuMetaTree, fSumWeight, fTreeNames, genie::RandomGen::Instance(), LoadConfig(), LOG, submit_syst::pattern, pERROR, pFATAL, pINFO, pNOTICE, generate_hists::rnd, genie::RandomGen::RndFlux(), ScanForMaxWeight(), and string.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

574 {
575 // Loads in a beam simulation root file into the GDk2NuFlux driver.
576 
577  bool found_cfg = this->LoadConfig(config);
578  if ( ! found_cfg ) {
579  LOG("Flux", pFATAL)
580  << "LoadBeamSimData could not find XML config \"" << config << "\"\n";
581  exit(1);
582  }
583 
584  fNuFluxFilePatterns = patterns;
585  std::vector<int> nfiles_from_pattern;
586 
587  // create a (sorted) set of file names
588  // this also helps ensure that the same file isn't listed multiple times
589  std::set<std::string> fnames;
590 
591  LOG("Flux", pINFO) << "LoadBeamSimData was passed " << patterns.size()
592  << " patterns";
593 
594  for (size_t ipatt = 0; ipatt < patterns.size(); ++ipatt ) {
595  std::string pattern = patterns[ipatt];
596  nfiles_from_pattern.push_back(0);
597 
598  LOG("Flux", pNOTICE)
599  << "Loading dk2nu flux tree from ROOT file pattern ["
600  << std::setw(3) << ipatt << "] \"" << pattern << "\"";
601 
602  // !WILDCARD only works for file name ... NOT directory
603  std::string dirname = gSystem->UnixPathName(gSystem->WorkingDirectory());
604  size_t slashpos = pattern.find_last_of("/");
605  size_t fbegin;
606  if ( slashpos != std::string::npos ) {
607  dirname = pattern.substr(0,slashpos);
608  LOG("Flux", pINFO) << "Look for flux using directory " << dirname;
609  fbegin = slashpos + 1;
610  } else { fbegin = 0; }
611 
612  void* dirp = gSystem->OpenDirectory(gSystem->ExpandPathName(dirname.c_str()));
613  if ( dirp ) {
614  std::string basename =
615  pattern.substr(fbegin,pattern.size()-fbegin);
616  TRegexp re(basename.c_str(),kTRUE);
617  const char* onefile;
618  while ( ( onefile = gSystem->GetDirEntry(dirp) ) ) {
619  TString afile = onefile;
620  if ( afile=="." || afile==".." ) continue;
621  if ( basename!=afile && afile.Index(re) == kNPOS ) continue;
622  std::string fullname = dirname + "/" + afile.Data();
623  fnames.insert(fullname);
624  nfiles_from_pattern[ipatt]++;
625  }
626  gSystem->FreeDirectory(dirp);
627  } // legal directory
628  } // loop over patterns
629 
630  // std::cout << "RWH start adding files" << std::endl << std::flush;
631 
632  size_t indx = 0;
633  std::set<std::string>::const_iterator sitr = fnames.begin();
634  for ( ; sitr != fnames.end(); ++sitr, ++indx ) {
635  std::string filename = *sitr;
636  // std::cout << "RWH [" << std::setw(3) << indx << "] \""
637  // << filename << "\"" << std::endl << std::flush;
638  bool isok = true;
639  // this next test only works for local files, so we can't do that
640  // if we want to stream via xrootd
641  // ! (gSystem->AccessPathName(filename.c_str()));
642  if ( isok ) {
643  TFile* tf = TFile::Open(filename.c_str(),"READ");
644  TTree* ftree = (TTree*)tf->Get(fTreeNames[0].c_str());
645  TTree* mtree = (TTree*)tf->Get(fTreeNames[1].c_str());
646  if ( ftree && mtree ) {
647  // found both trees
648  this->AddFile(ftree,mtree,filename);
649  // std::cout << "RWH AddFile(" << ftree << ","
650  // << mtree << "," << filename << ")" << std::endl << std::flush;
651  } else {
652  // std::cout << "RWH no AddFile" << std::endl << std::flush;
653  LOG("Flux", pNOTICE) << "File " << filename << " lacked a tree: "
654  << " \"" << fTreeNames[0] << "\" " << ftree
655  << " \"" << fTreeNames[1] << "\" " << mtree
656  << " and was not added to the file list";
657  }
658  tf->Close();
659  delete tf;
660  } // loop over tree type
661  } // loop over sorted file names
662 
663  if ( ! fNuFluxTree || ! fNuMetaTree ) {
664  LOG("Flux", pERROR)
665  << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
666  LOG("Flux", pERROR)
667  << "Missing dk2nu (" << fNuFluxTree << ") or dkmeta ("
668  << fNuMetaTree << ") tree";
669  LOG("Flux", pERROR)
670  << "please check that input files are valid";
671  LOG("Flux", pERROR)
672  << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
673  }
674 
675  // this will open all files and read header!!
676  fNEntries = fNuFluxTree->GetEntries();
677 
678  if ( fNEntries == 0 ) {
679  LOG("Flux", pERROR)
680  << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
681  LOG("Flux", pERROR)
682  << "Loaded flux tree contains " << fNEntries << " entries";
683  LOG("Flux", pERROR)
684  << "Was passed the file patterns: ";
685  for (size_t ipatt = 0; ipatt < patterns.size(); ++ipatt ) {
686  std::string pattern = patterns[ipatt];
687  LOG("Flux", pERROR)
688  << " [" << std::setw(3) << ipatt <<"] " << pattern;
689  }
690  LOG("Flux", pERROR)
691  << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
692  } else {
693  LOG("Flux", pNOTICE)
694  << "Loaded flux tree contains " << fNEntries << " entries"
695  << " from " << fnames.size() << " unique files";
696  for (size_t ipatt = 0; ipatt < patterns.size(); ++ipatt ) {
697  std::string pattern = patterns[ipatt];
698  LOG("Flux", pINFO)
699  << " pattern: " << pattern << " yielded "
700  << nfiles_from_pattern[ipatt] << " files";
701  }
702  }
703 
704  TBranch* bdk2nu = fNuFluxTree->GetBranch("dk2nu");
705  if (bdk2nu) bdk2nu->SetAutoDelete(false);
706  TBranch* bdkmeta = fNuMetaTree->GetBranch("dkmeta");
707  if (bdkmeta) bdkmeta->SetAutoDelete(false);
708 
709  // we have a file we can work with
710  if (!fDetLocIsSet) {
711  LOG("Flux", pERROR)
712  << "LoadBeamSimData left detector location unset";
713  }
714  if (fMaxWeight<=0) {
715  LOG("Flux", pINFO)
716  << "Run ScanForMaxWeight() as part of LoadBeamSimData";
717  this->ScanForMaxWeight();
718  }
719 
720  // current ntuple cycle # (flux ntuples may be recycled)
721  fICycle = 0;
722  // pick a starting entry index [0:fNEntries-1]
723  // pretend we just used up the the previous one
725  fIUse = 9999999;
726  fIEntry = rnd->RndFlux().Integer(fNEntries) - 1;
727 
728  // don't count things we used to estimate max weight
729  fSumWeight = 0;
730  fNNeutrinos = 0;
731  fAccumPOTs = 0;
732 
733  LOG("Flux",pNOTICE) << "about to CalcEffPOTsPerNu";
734  this->CalcEffPOTsPerNu();
735 
736 }
bool LoadConfig(std::string cfg)
load a named configuration
#define pERROR
Definition: Messenger.h:60
long int fNNeutrinos
number of flux neutrinos thrown so far
Definition: GDk2NuFlux.h:302
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
TChain * fNuFluxTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:272
#define pFATAL
Definition: Messenger.h:57
double fSumWeight
sum of weights for nus thrown so far
Definition: GDk2NuFlux.h:301
Definition: config.py:1
string filename
Definition: shutoffs.py:106
Timing fit.
std::string fTreeNames[2]
pair of names "dk2nuTree", "dkmetaTree"
Definition: GDk2NuFlux.h:271
Long64_t fIEntry
current flux ntuple entry
Definition: GDk2NuFlux.h:281
std::vector< std::string > fNuFluxFilePatterns
(potentially wildcarded) path(s)
Definition: GDk2NuFlux.h:269
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
long int fIUse
current # of times an entry has been used
Definition: GDk2NuFlux.h:300
TChain * fNuMetaTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:273
double fMaxWeight
max flux neutrino weight in input file
Definition: GDk2NuFlux.h:288
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
void AddFile(TTree *fluxtree, TTree *metatree, std::string fname)
#define pINFO
Definition: Messenger.h:63
double fAccumPOTs
POTs used so far.
Definition: GDk2NuFlux.h:304
exit(0)
bool fDetLocIsSet
is a flux location (near/far) set?
Definition: GDk2NuFlux.h:308
#define pNOTICE
Definition: Messenger.h:62
Long64_t fNEntries
number of flux ntuple entries
Definition: GDk2NuFlux.h:280
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:72
void ScanForMaxWeight(void)
scan for max flux weight (before generating unweighted flux neutrinos)
Definition: GDk2NuFlux.cxx:792
enum BeamMode string
bool genie::flux::GDk2NuFlux::LoadConfig ( std::string  cfg)

load a named configuration

bool GDk2NuFlux::LoadConfig ( std::string  cfg)

load a named configuration

Definition at line 1291 of file GDk2NuFlux.cxx.

References genie::flux::GDk2NuFluxXMLHelper::LoadConfig().

Referenced by LoadBeamSimData(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1292 {
1293  genie::flux::GDk2NuFluxXMLHelper helper(this);
1294  return helper.LoadConfig(cfg);
1295 }
void genie::flux::GDk2NuFlux::LoadDkMeta ( void  )
private
void GDk2NuFlux::LoadDkMeta ( void  )
private

Definition at line 506 of file GDk2NuFlux.cxx.

References ana::assert(), fCurDk2Nu, fCurDkMeta, fJobToMetaIndex, fNuMetaTree, site_stats_from_log::job, bsim::DkMeta::job, bsim::Dk2Nu::job, LOG, pERROR, and pFATAL.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

507 {
508  // load the matching bsim::dkmeta entry that goes w/ bsim::dk2nu entry
509 
510  if ( fJobToMetaIndex.empty() ) {
511  int nmeta = fNuMetaTree->GetEntries();
512  for (int imeta =0; imeta < nmeta; ++imeta ) {
513  fNuMetaTree->GetEntry(imeta);
514  int mjob = fCurDkMeta->job;
515  // there shouldn't already be an entry in the map
516  // complain if there is
517  std::map<int,int>::const_iterator mitr = fJobToMetaIndex.find(mjob);
518  if ( mitr == fJobToMetaIndex.end() ) {
519  fJobToMetaIndex[mjob] = imeta; // make an entry
520  } else {
521  LOG("Flux", pERROR) << "LoadDkMeta already had an entry for job "
522  << mjob << " at " << mitr->second
523  << " which conflicts with new entry at "
524  << imeta;
525  }
526  }
527  }
528 
529  int job = fCurDk2Nu->job;
530  if ( fCurDkMeta->job == job ) return; // already loaded
531 
532  std::map<int,int>::const_iterator lookat = fJobToMetaIndex.find(job);
533  if ( lookat != fJobToMetaIndex.end() ) {
534  int indx = lookat->second;
535  fNuMetaTree->GetEntry(indx);
536  if ( fCurDkMeta->job != job ) {
537  LOG("Flux", pFATAL) << "Failed to get right metadata " << job
538  << " => " << fCurDkMeta->job
539  << " indx " << indx;
540  assert(0);
541  }
542  } else {
543  // wasn't already indexed
544  LOG("Flux", pFATAL) << "Failed index metadata for job " << job
545  << " indx " << lookat->second;
546  assert(0);
547  }
548 
549 }
Int_t job
identifying job #
Definition: dk2nu.h:323
#define pERROR
Definition: Messenger.h:60
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
#define pFATAL
Definition: Messenger.h:57
Int_t job
identifying job # (keep files distinct)
Definition: dkmeta.h:86
TChain * fNuMetaTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:273
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
std::map< int, int > fJobToMetaIndex
quick lookup from job# to meta chain
Definition: GDk2NuFlux.h:285
bsim::DkMeta * fCurDkMeta
Definition: GDk2NuFlux.h:276
assert(nhit_max >=nhit_nbins)
double genie::flux::GDk2NuFlux::MaxEnergy ( void  )
inlinevirtual

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

Implements genie::GFluxI.

Definition at line 83 of file GDk2NuFlux.h.

References genie::utils::res::PdgCode().

83 { return fMaxEv; }
double fMaxEv
maximum energy
Definition: GDk2NuFlux.h:255
double genie::flux::GDk2NuFlux::MaxEnergy ( void  )
inlinevirtual

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

Implements genie::GFluxI.

Definition at line 83 of file GDk2NuFlux.h.

References genie::utils::res::PdgCode().

83 { return fMaxEv; }
double fMaxEv
maximum energy
Definition: GDk2NuFlux.h:255
const TLorentzVector& genie::flux::GDk2NuFlux::Momentum ( void  )
virtual

returns the flux neutrino 4-momentum

Implements genie::GFluxI.

const TLorentzVector & GDk2NuFlux::Momentum ( void  )
virtual

returns the flux neutrino 4-momentum

Implements genie::GFluxI.

Definition at line 156 of file GDk2NuFlux.cxx.

References fCurNuChoice, and bsim::NuChoice::p4NuUser.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

157 {
158  return fCurNuChoice->p4NuUser;
159 }
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
TLorentzVector p4NuUser
generated nu 4-momentum in user/det coord
Definition: NuChoice.h:57
void genie::flux::GDk2NuFlux::MoveToZ0 ( double  z0)

move ray origin to user coord Z0

void GDk2NuFlux::MoveToZ0 ( double  z0)

move ray origin to user coord Z0

Definition at line 445 of file GDk2NuFlux.cxx.

References e, fCurNuChoice, fLengthScaleU2B, LOG, genie::utils::print::P4AsShortString(), bsim::NuChoice::p4NuBeam, bsim::NuChoice::p4NuUser, pDEBUG, pWARN, scale, genie::utils::print::X4AsString(), bsim::NuChoice::x4NuBeam, and bsim::NuChoice::x4NuUser.

Referenced by GenerateNext_weighted(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

446 {
447  // move ray origin to specified user z0
448  // move beam coord entry correspondingly
449 
450 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
451  LOG("Flux", pDEBUG)
452  << "MoveToZ0 (z0usr=" << z0usr << ") before:"
453  << "\n p4 user: " << utils::print::P4AsShortString(&(fCurNuChoice->p4NuUser))
454  << "\n x4 user: " << utils::print::X4AsString(&(fCurNuChoice->x4NuUser));
455 #endif
456 
457  double pzusr = fCurNuChoice->p4NuUser.Pz();
458  if ( TMath::Abs(pzusr) < 1.0e-30 ) {
459  // neutrino is moving almost entirely in x-y plane
460  LOG("Flux", pWARN)
461  << "MoveToZ0(" << z0usr << ") not possible due to pz_usr (" << pzusr << ")";
462  return;
463  }
464 
465  double scale = (z0usr - fCurNuChoice->x4NuUser.Z()) / pzusr;
468  // this scaling works for distances, but not the time component
469  fCurNuChoice->x4NuBeam.SetT(0);
470  fCurNuChoice->x4NuUser.SetT(0);
471 
472 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
473  LOG("Flux", pDEBUG)
474  << "MoveToZ0 (" << z0usr << ") after:"
475  << "\n x4 user: " << utils::print::X4AsString(&(fCurNuChoice->x4NuUser));
476 #endif
477 
478 }
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:52
TLorentzVector x4NuBeam
generated nu 4-position in beam coord
Definition: NuChoice.h:56
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
double fLengthScaleU2B
scale factor beam user –> (cm)
Definition: GDk2NuFlux.h:312
#define pWARN
Definition: Messenger.h:61
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
TLorentzVector x4NuUser
generated nu 4-position in user/det coord
Definition: NuChoice.h:58
TLorentzVector p4NuUser
generated nu 4-momentum in user/det coord
Definition: NuChoice.h:57
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
TLorentzVector p4NuBeam
generated nu 4-momentum in beam coord
Definition: NuChoice.h:55
Float_t e
Definition: plot.C:35
#define pDEBUG
Definition: Messenger.h:64
long int genie::flux::GDk2NuFlux::NFluxNeutrinos ( void  ) const
inlinevirtual

number of flux neutrinos looped so far

Implements genie::flux::GFluxExposureI.

Definition at line 126 of file GDk2NuFlux.h.

long int genie::flux::GDk2NuFlux::NFluxNeutrinos ( void  ) const
inlinevirtual

number of flux neutrinos looped so far

Implements genie::flux::GFluxExposureI.

Definition at line 126 of file GDk2NuFlux.h.

int GDk2NuFlux::PdgCode ( void  )
virtual

returns the flux neutrino pdg code

Implements genie::GFluxI.

Definition at line 151 of file GDk2NuFlux.cxx.

References fCurNuChoice, and bsim::NuChoice::pdgNu.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

152 {
153  return fCurNuChoice->pdgNu;
154 }
int pdgNu
generated nu pdg code
Definition: NuChoice.h:51
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
int genie::flux::GDk2NuFlux::PdgCode ( void  )
virtual

returns the flux neutrino pdg code

Implements genie::GFluxI.

const TLorentzVector& genie::flux::GDk2NuFlux::Position ( void  )
virtual

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

Implements genie::GFluxI.

const TLorentzVector & GDk2NuFlux::Position ( void  )
virtual

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

Implements genie::GFluxI.

Definition at line 161 of file GDk2NuFlux.cxx.

References fCurNuChoice, and bsim::NuChoice::x4NuUser.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

162 {
163  return fCurNuChoice->x4NuUser;
164 }
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
TLorentzVector x4NuUser
generated nu 4-position in user/det coord
Definition: NuChoice.h:58
double GDk2NuFlux::POT_curr ( void  )

current average POT (RWH?)

Definition at line 565 of file GDk2NuFlux.cxx.

References UsedPOTs().

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

565  {
566  // RWH: Not sure what POT_curr is supposed to represent I'll guess for
567  // now that that it means what I mean by UsedPOTs().
568  return UsedPOTs();
569 }
double UsedPOTs(void) const
of protons-on-target used
Definition: GDk2NuFlux.cxx:552
double genie::flux::GDk2NuFlux::POT_curr ( void  )

current average POT (RWH?)

void genie::flux::GDk2NuFlux::PrintConfig ( )
virtual

print the current configuration

Implements genie::flux::GFluxFileConfigI.

void GDk2NuFlux::PrintConfig ( void  )
virtual

print the current configuration

Implements genie::flux::GFluxFileConfigI.

Definition at line 1299 of file GDk2NuFlux.cxx.

References fAccumPOTs, fApplyTiltWeight, fBeamRot, fBeamRotInv, fBeamZero, fDetLocIsSet, fEffPOTsPerNu, fFilePOTs, fFluxSphereCenterBeam, fFluxSphereCenterUser, fFluxSphereRadius, fFluxWindowBase, fFluxWindowDir1, fFluxWindowDir2, fFluxWindowLen1, fFluxWindowLen2, fFluxWindowPtUser, fGenWeighted, genie::flux::GFluxFileConfigI::fICycle, fIEntry, fIUse, fLengthScaleB2U, fLengthScaleU2B, fLengthUnits, modify_metadata_with_upmu_sample_type::flist, fMaxEv, fMaxWeight, fMaxWeightInit, fMaxWeightMax, fMaxWeightScan, fMaxWgtEntries, fMaxWgtExceeded, fMaxWgtFailModel, fMaxWgtFudge, fMinMaxWeight, genie::flux::GFluxFileConfigI::fNCycles, fNEntries, fNFiles, fNNeutrinos, fNuFluxFilePatterns, fNUse, genie::flux::GFluxFileConfigI::fPdgCList, genie::flux::GFluxFileConfigI::fPdgCListRej, fSumWeight, genie::flux::GFluxFileConfigI::fZ0, GetFileList(), MECModelEnuComparisons::i, IsFluxSphere(), LOG, pNOTICE, User2BeamPos(), genie::utils::print::Vec3AsString(), w, and genie::utils::print::X4AsString().

Referenced by GenerateNext(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1300 {
1301 
1302  std::ostringstream s;
1303  PDGCodeList::const_iterator itr = fPdgCList->begin();
1304  for ( ; itr != fPdgCList->end(); ++itr) s << (*itr) << " ";
1305  s << "[rejected: ";
1306  itr = fPdgCListRej->begin();
1307  for ( ; itr != fPdgCListRej->end(); ++itr) s << (*itr) << " ";
1308  s << " ] ";
1309 
1310  std::ostringstream fpattout;
1311  for (size_t i = 0; i < fNuFluxFilePatterns.size(); ++i)
1312  fpattout << "\n [" << std::setw(3) << i << "] " << fNuFluxFilePatterns[i];
1313 
1314  std::ostringstream flistout;
1315  std::vector<std::string> flist = GetFileList();
1316  for (size_t i = 0; i < flist.size(); ++i)
1317  flistout << "\n [" << std::setw(3) << i << "] " << flist[i];
1318 
1319  TLorentzVector usr0(0,0,0,0);
1320  TLorentzVector usr0asbeam;
1321  User2BeamPos(usr0,usr0asbeam);
1322 
1323  const int w=10, p=6;
1324  std::ostringstream beamrot_str, beamrotinv_str;
1325  beamrot_str
1326  << "fBeamRot: " << std::setprecision(p) << "\n"
1327  << " [ "
1328  << std::setw(w) << fBeamRot.XX() << " "
1329  << std::setw(w) << fBeamRot.XY() << " "
1330  << std::setw(w) << fBeamRot.XZ() << " ]\n"
1331  << " [ "
1332  << std::setw(w) << fBeamRot.YX() << " "
1333  << std::setw(w) << fBeamRot.YY() << " "
1334  << std::setw(w) << fBeamRot.YZ() << " ]\n"
1335  << " [ "
1336  << std::setw(w) << fBeamRot.ZX() << " "
1337  << std::setw(w) << fBeamRot.ZY() << " "
1338  << std::setw(w) << fBeamRot.ZZ() << " ]";
1339  beamrotinv_str
1340  << "fBeamRotInv: " << std::setprecision(p) << "\n"
1341  << " [ "
1342  << std::setw(w) << fBeamRotInv.XX() << " "
1343  << std::setw(w) << fBeamRotInv.XY() << " "
1344  << std::setw(w) << fBeamRotInv.XZ() << " ]\n"
1345  << " [ "
1346  << std::setw(w) << fBeamRotInv.YX() << " "
1347  << std::setw(w) << fBeamRotInv.YY() << " "
1348  << std::setw(w) << fBeamRotInv.YZ() << " ]\n"
1349  << " [ "
1350  << std::setw(w) << fBeamRotInv.ZX() << " "
1351  << std::setw(w) << fBeamRotInv.ZY() << " "
1352  << std::setw(w) << fBeamRotInv.ZZ() << " ]";
1353 
1354  std::ostringstream config_str;
1355  config_str
1356  << "GDk2NuFlux Config:"
1357  << "\n Enu_max " << fMaxEv
1358  << "\n pdg-codes: " << s.str() << "\n "
1359  << fNEntries << " entries"
1360  << " (FilePOTs " << fFilePOTs << ") "
1361  << "in " << fNFiles << " files: "
1362  << flistout.str()
1363  << "\n from file patterns:"
1364  << fpattout.str()
1365  << "\n wgt max=" << fMaxWeight
1366  << " min=" << fMinMaxWeight << " scan=" << fMaxWeightScan
1367  << " ( fudge=" << fMaxWgtFudge << " using scan of "
1368  << fMaxWgtEntries << " entries )"
1369  << "\n exceeded init=" << fMaxWeightInit << ", N=" << fMaxWgtExceeded
1370  << " times (fail model " << fMaxWgtFailModel << ") max = " << fMaxWeightMax
1371  << "\n Z0 pushback " << fZ0
1372  << "\n used entry " << fIEntry << " " << fIUse << "/" << fNUse
1373  << " times, in " << fICycle << "/" << fNCycles << " cycles"
1374  << "\n SumWeight " << fSumWeight << " for " << fNNeutrinos << " neutrino entries"
1375  << "\n EffPOTsPerNu " << fEffPOTsPerNu << " AccumPOTs " << fAccumPOTs
1376  << "\n GenWeighted: \"" << (fGenWeighted?"true":"false") << "\", "
1377  << "ApplyTiltWeight: \"" << (fApplyTiltWeight?"true":"false") << "\", "
1378  << "Detector location set: \"" << (fDetLocIsSet?"true":"false") << "\", "
1379  << "\n LengthUnits " << fLengthUnits << ", scale b2u " << fLengthScaleB2U
1380  << ", scale u2b " << fLengthScaleU2B;
1381 
1382  if ( IsFluxSphere() ) {
1383  config_str
1384  << "\n Flux Sphere radius: " << fFluxSphereRadius
1385  << "\n User Center: " << utils::print::Vec3AsString(&fFluxSphereCenterUser)
1386  << "\n Beam Center: " << utils::print::Vec3AsString(&fFluxSphereCenterBeam);
1387  } else {
1388  config_str
1389  << "\n User Flux Window: "
1393  << "\n Flux Window (cm, beam coord): "
1394  << "\n base " << utils::print::X4AsString(&fFluxWindowBase)
1395  << "\n dir1 " << utils::print::X4AsString(&fFluxWindowDir1) << " len " << fFluxWindowLen1
1396  << "\n dir2 " << utils::print::X4AsString(&fFluxWindowDir2) << " len " << fFluxWindowLen2;
1397  }
1398  config_str
1399  << "\n User Beam Origin: "
1400  << "\n base " << utils::print::X4AsString(&fBeamZero)
1401  << "\n " << beamrot_str.str() << " "
1402  << "\n Detector Origin (beam coord): "
1403  << "\n base " << utils::print::X4AsString(&usr0asbeam)
1404  << "\n " << beamrotinv_str.str();
1405 
1406  LOG("Flux", pNOTICE) << config_str.str();
1407 }
bool fApplyTiltWeight
wgt due to window normal not || beam
Definition: GDk2NuFlux.h:307
bool IsFluxSphere() const
flat window or sphere
Definition: GDk2NuFlux.h:208
long int fNNeutrinos
number of flux neutrinos thrown so far
Definition: GDk2NuFlux.h:302
double fMaxWeightScan
initial estimate from scan
Definition: GDk2NuFlux.h:290
const char * p
Definition: xmltok.h:285
double fLengthScaleB2U
scale factor beam (cm) –> user
Definition: GDk2NuFlux.h:311
double fSumWeight
sum of weights for nus thrown so far
Definition: GDk2NuFlux.h:301
TVector3 fFluxWindowPtUser[3]
user points of flux window
Definition: GDk2NuFlux.h:319
double fMaxEv
maximum energy
Definition: GDk2NuFlux.h:255
double fMaxWgtFudge
fudge factor for estimating max wgt
Definition: GDk2NuFlux.h:293
long int fNUse
how often to use same entry in a row
Definition: GDk2NuFlux.h:299
TLorentzRotation fBeamRotInv
Definition: GDk2NuFlux.h:316
Long64_t fIEntry
current flux ntuple entry
Definition: GDk2NuFlux.h:281
TVector3 fFluxSphereCenterBeam
center for flux sphere - beam coords
Definition: GDk2NuFlux.h:327
double fEffPOTsPerNu
what a entry is worth ...
Definition: GDk2NuFlux.h:303
std::vector< std::string > fNuFluxFilePatterns
(potentially wildcarded) path(s)
Definition: GDk2NuFlux.h:269
double fFluxSphereRadius
radius for flux sphere
Definition: GDk2NuFlux.h:328
Long64_t fFilePOTs
of protons-on-target represented by all files
Definition: GDk2NuFlux.h:283
long int fIUse
current # of times an entry has been used
Definition: GDk2NuFlux.h:300
double fMaxWeight
max flux neutrino weight in input file
Definition: GDk2NuFlux.h:288
void User2BeamPos(const TLorentzVector &usrxyz, TLorentzVector &beamxyz) const
const XML_Char * s
Definition: expat.h:262
double fMaxWeightInit
max of scan & minmaxweight
Definition: GDk2NuFlux.h:291
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 fBeamZero
beam origin in user coords
Definition: GDk2NuFlux.h:314
double fMaxWeightMax
if "frozen" this is what bump would given
Definition: GDk2NuFlux.h:292
double fLengthScaleU2B
scale factor beam user –> (cm)
Definition: GDk2NuFlux.h:312
int fMaxWgtFailModel
what to do ... 0=bump, 1=frozen, 2=abort
Definition: GDk2NuFlux.h:297
std::vector< std::string > GetFileList()
list of files currently part of chain
long int fNCycles
times to cycle through the ntuple(s)
double fLengthUnits
units for coord in user exchanges
Definition: GDk2NuFlux.h:310
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
TLorentzVector fFluxWindowDir1
extent for flux window (direction 1)
Definition: GDk2NuFlux.h:321
int fNFiles
number of files in chain
Definition: GDk2NuFlux.h:279
long int fMaxWgtEntries
of entries in estimating max wgt
Definition: GDk2NuFlux.h:294
TLorentzVector fFluxWindowBase
base point for flux window - beam coord
Definition: GDk2NuFlux.h:320
double fAccumPOTs
POTs used so far.
Definition: GDk2NuFlux.h:304
TVector3 fFluxSphereCenterUser
center for flux sphere - user coords
Definition: GDk2NuFlux.h:326
TLorentzVector fFluxWindowDir2
extent for flux window (direction 2)
Definition: GDk2NuFlux.h:322
bool fDetLocIsSet
is a flux location (near/far) set?
Definition: GDk2NuFlux.h:308
#define pNOTICE
Definition: Messenger.h:62
bool fGenWeighted
does GenerateNext() give weights?
Definition: GDk2NuFlux.h:306
Long64_t fNEntries
number of flux ntuple entries
Definition: GDk2NuFlux.h:280
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
long int fMaxWgtExceeded
track failures of estimate
Definition: GDk2NuFlux.h:296
TLorentzRotation fBeamRot
rotation applied beam –> user coord
Definition: GDk2NuFlux.h:315
double fMinMaxWeight
user set lower limit on estimate
Definition: GDk2NuFlux.h:289
Float_t w
Definition: plot.C:20
string Vec3AsString(const TVector3 *vec)
Definition: PrintUtils.cxx:87
void genie::flux::GDk2NuFlux::PrintCurrent ( void  )

print current entry from leaves

void GDk2NuFlux::PrintCurrent ( void  )

print current entry from leaves

Definition at line 1042 of file GDk2NuFlux.cxx.

References bsim::NuChoice::AsString(), bsim::Dk2Nu::AsString(), fCurDk2Nu, fCurNuChoice, LOG, and pNOTICE.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1043 {
1044  LOG("Flux", pNOTICE) << "CurrentEntry:\n"
1045  << fCurDk2Nu->AsString() << "\n"
1046  << fCurNuChoice->AsString();
1047 }
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
std::string AsString(const std::string &opt="") const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
std::string AsString(const std::string &opt="") const
#define pNOTICE
Definition: Messenger.h:62
void genie::flux::GDk2NuFlux::ResetCurrent ( void  )
private
void GDk2NuFlux::ResetCurrent ( void  )
private

Definition at line 1169 of file GDk2NuFlux.cxx.

References bsim::NuChoice::clear(), bsim::Dk2Nu::clear(), fCurDk2Nu, and fCurNuChoice.

Referenced by GenerateNext_weighted(), Initialize(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1170 {
1171 // reset running values of neutrino pdg-code, 4-position & 4-momentum
1172 // and the input ntuple leaves
1173 
1174  if ( fCurDk2Nu ) fCurDk2Nu->clear();
1175  if ( fCurNuChoice ) fCurNuChoice->clear();
1176 }
void clear(const std::string &opt="")
reset everything
bsim::Dk2Nu * fCurDk2Nu
Definition: GDk2NuFlux.h:275
void clear(const std::string &opt="")
reset everything
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
void genie::flux::GDk2NuFlux::ScanForMaxWeight ( void  )

scan for max flux weight (before generating unweighted flux neutrinos)

void GDk2NuFlux::ScanForMaxWeight ( void  )

scan for max flux weight (before generating unweighted flux neutrinos)

Definition at line 792 of file GDk2NuFlux.cxx.

References enu, fCurNuChoice, fDetLocIsSet, fMaxEFudge, fMaxEv, fMaxWeight, fMaxWeightInit, fMaxWeightMax, fMaxWeightScan, fMaxWgtEntries, fMaxWgtExceeded, fMaxWgtFudge, fMinMaxWeight, GenerateNext_weighted(), LOG, bsim::NuChoice::p4NuBeam, pERROR, pNOTICE, confusionMatrixTree::t, Weight(), and wgt.

Referenced by LoadBeamSimData(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

793 {
794  if (!fDetLocIsSet) {
795  LOG("Flux", pERROR)
796  << "Specify a detector location before scanning for max weight";
797  return;
798  }
799 
800  // scan for the maximum weight
801 
802  double wgtgenmx = 0, enumx = 0;
803  TStopwatch t;
804  t.Start();
805  for (int itry=0; itry < fMaxWgtEntries; ++itry) {
806  this->GenerateNext_weighted();
807  double wgt = this->Weight();
808  if ( wgt > wgtgenmx ) wgtgenmx = wgt;
809  double enu = fCurNuChoice->p4NuBeam.Energy();
810  if ( enu > enumx ) enumx = enu;
811  }
812  t.Stop();
813  t.Print("u");
814  LOG("Flux", pNOTICE) << "Maximum flux weight for spin = "
815  << wgtgenmx << ", energy = " << enumx
816  << " (" << fMaxWgtEntries << ")";
817 
818  if (wgtgenmx > fMaxWeight ) fMaxWeight = wgtgenmx;
819  // apply a fudge factor to estimated weight
821  if ( fMaxWgtFudge < 1 ) fMaxWgtFudge=1; // avoid run-away downward spiral
822 
824  // apply possible user supplied minimum (floor)
825  if (fMinMaxWeight > fMaxWeight) {
826  LOG("Flux", pNOTICE) << "Maximum flux weight set by user = "
827  << fMinMaxWeight << " exceeds estimate, use that";
829  }
830 
831  fMaxWeightInit = fMaxWeight; // what we started with before generation
833  fMaxWgtExceeded = 0; // not yet exceeded
834 
835  // adjust max energy?
836  if ( enumx*fMaxEFudge > fMaxEv ) {
837  LOG("Flux", pNOTICE) << "Adjust max: was=" << fMaxEv
838  << " now " << enumx << "*" << fMaxEFudge
839  << " = " << enumx*fMaxEFudge;
840  fMaxEv = enumx * fMaxEFudge;
841  }
842 
843  LOG("Flux", pNOTICE) << "Maximum flux weight = " << fMaxWeight
844  << ", energy = " << fMaxEv;
845 
846 }
#define pERROR
Definition: Messenger.h:60
double fMaxWeightScan
initial estimate from scan
Definition: GDk2NuFlux.h:290
double fMaxEv
maximum energy
Definition: GDk2NuFlux.h:255
double fMaxWgtFudge
fudge factor for estimating max wgt
Definition: GDk2NuFlux.h:293
double fMaxWeight
max flux neutrino weight in input file
Definition: GDk2NuFlux.h:288
double enu
Definition: runWimpSim.h:113
double fMaxWeightInit
max of scan & minmaxweight
Definition: GDk2NuFlux.h:291
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
double fMaxWeightMax
if "frozen" this is what bump would given
Definition: GDk2NuFlux.h:292
bool GenerateNext_weighted(void)
Definition: GDk2NuFlux.cxx:255
const ana::Var wgt
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
long int fMaxWgtEntries
of entries in estimating max wgt
Definition: GDk2NuFlux.h:294
double fMaxEFudge
fudge factor for estmating max enu (0=> use fixed 120GeV)
Definition: GDk2NuFlux.h:295
double Weight(void)
returns the flux neutrino weight (if any)
Definition: GDk2NuFlux.h:86
bool fDetLocIsSet
is a flux location (near/far) set?
Definition: GDk2NuFlux.h:308
#define pNOTICE
Definition: Messenger.h:62
TLorentzVector p4NuBeam
generated nu 4-momentum in beam coord
Definition: NuChoice.h:55
long int fMaxWgtExceeded
track failures of estimate
Definition: GDk2NuFlux.h:296
double fMinMaxWeight
user set lower limit on estimate
Definition: GDk2NuFlux.h:289
void genie::flux::GDk2NuFlux::SetApplyWindowTiltWeight ( bool  apply = true)
inline
Parameters
applyapply wgt due to tilt of flux window relative to beam

Definition at line 179 of file GDk2NuFlux.h.

References g4zmq::apply().

180  { fApplyTiltWeight = apply; }
bool fApplyTiltWeight
wgt due to window normal not || beam
Definition: GDk2NuFlux.h:307
def apply(command)
Definition: g4zmq.py:38
void genie::flux::GDk2NuFlux::SetApplyWindowTiltWeight ( bool  apply = true)
inline
Parameters
applyapply wgt due to tilt of flux window relative to beam

Definition at line 179 of file GDk2NuFlux.h.

References g4zmq::apply().

180  { fApplyTiltWeight = apply; }
bool fApplyTiltWeight
wgt due to window normal not || beam
Definition: GDk2NuFlux.h:307
def apply(command)
Definition: g4zmq.py:38
void genie::flux::GDk2NuFlux::SetBeamCenter ( TVector3  beam0)
void GDk2NuFlux::SetBeamCenter ( TVector3  beam0)

Definition at line 950 of file GDk2NuFlux.cxx.

References fBeamZero.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

951 {
952  // set coord transform between detector and beam
953  // NOTE: internally these are in "cm", but user might have set a preference
954  fBeamZero = TLorentzVector(beam0,0); // no time shift
955 }
TLorentzVector fBeamZero
beam origin in user coords
Definition: GDk2NuFlux.h:314
void GDk2NuFlux::SetBeamRotation ( TRotation  beamrot)

< beam (0,0,0) relative to user frame, beam direction in user frame

Definition at line 943 of file GDk2NuFlux.cxx.

References fBeamRot, and fBeamRotInv.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

944 {
945  // rotation is really only 3-d vector, but we'll be operating on LorentzV's
946  fBeamRot = TLorentzRotation(beamrot);
947  fBeamRotInv = fBeamRot.Inverse();
948 }
TLorentzRotation fBeamRotInv
Definition: GDk2NuFlux.h:316
TLorentzRotation fBeamRot
rotation applied beam –> user coord
Definition: GDk2NuFlux.h:315
void genie::flux::GDk2NuFlux::SetBeamRotation ( TRotation  beamrot)

< beam (0,0,0) relative to user frame, beam direction in user frame

void genie::flux::GDk2NuFlux::SetDefaults ( void  )
private
void GDk2NuFlux::SetDefaults ( void  )
private

Definition at line 1132 of file GDk2NuFlux.cxx.

References genie::kPdgAntiNuE, genie::kPdgAntiNuMu, genie::kPdgNuE, genie::kPdgNuMu, LOG, pNOTICE, genie::PDGCodeList::push_back(), SetEntryReuse(), genie::flux::GFluxFileConfigI::SetFluxParticles(), SetMaxEnergy(), genie::flux::GFluxFileConfigI::SetNumOfCycles(), genie::flux::GFluxFileConfigI::SetUpstreamZ(), genie::flux::GFluxFileConfigI::SetXMLFileBase(), and string.

Referenced by Initialize(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1133 {
1134 // - Set default neutrino species list (nue, nuebar, numu, numubar) and
1135 // maximum energy (120 GeV).
1136 // These defaults can be overwritten by user calls (at the driver init) to
1137 // GDk2NuFlux::SetMaxEnergy(double Ev) and
1138 // GDk2NuFlux::SetFluxParticles(const PDGCodeList & particles)
1139 // - Set the default file normalization to 1E+21 POT
1140 // - Set the default flux neutrino start z position at -5m (z=0 is the
1141 // detector centre).
1142 // - Set number of cycles to 1
1143 
1144  LOG("Flux", pNOTICE) << "Setting default GDk2NuFlux driver options";
1145 
1146  PDGCodeList particles;
1147  particles.push_back(kPdgNuMu);
1148  particles.push_back(kPdgAntiNuMu);
1149  particles.push_back(kPdgNuE);
1150  particles.push_back(kPdgAntiNuE);
1151 
1152  this->SetFluxParticles (particles);
1153  this->SetMaxEnergy (120./*GeV*/); // was 200, but that would be wasteful
1154  this->SetUpstreamZ (-3.4e38); // way upstream ==> use flux window
1155  this->SetNumOfCycles (0);
1156  this->SetEntryReuse (1);
1157 
1158  std::string xmlfile = "GNuMIFlux.xml";
1159  const char* altxml = gSystem->Getenv("GDK2NUFLUXXML");
1160  if ( altxml ) xmlfile = altxml;
1161 // #if __GENIE_RELEASE_CODE__ >= GRELCODE(2,9,0)
1162  this->SetXMLFileBase(xmlfile);
1163 // #else
1164 // this->SetXMLFile(xmlfile);
1165 // #endif
1166 
1167 }
const int kPdgNuE
Definition: PDGCodes.h:28
void SetMaxEnergy(double Ev)
specify max flx nu energy
Definition: GDk2NuFlux.cxx:848
const int kPdgAntiNuE
Definition: PDGCodes.h:29
const int kPdgNuMu
Definition: PDGCodes.h:30
virtual void SetNumOfCycles(long int ncycle)
limit cycling through input files
A list of PDG codes.
Definition: PDGCodeList.h:33
virtual void SetXMLFileBase(std::string xmlbasename="")
virtual void SetUpstreamZ(double z0)
void SetEntryReuse(long int nuse=1)
of times to use entry before moving to next
Definition: GDk2NuFlux.cxx:856
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const int kPdgAntiNuMu
Definition: PDGCodes.h:31
virtual void SetFluxParticles(const PDGCodeList &particles)
specify list of flux neutrino species
#define pNOTICE
Definition: Messenger.h:62
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:67
enum BeamMode string
void genie::flux::GDk2NuFlux::SetEntryReuse ( long int  nuse = 1)

of times to use entry before moving to next

void GDk2NuFlux::SetEntryReuse ( long int  nuse = 1)

of times to use entry before moving to next

Definition at line 856 of file GDk2NuFlux.cxx.

References fNUse, and CLHEP::L.

Referenced by SetDefaults(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

857 {
858 // With nuse > 1 then the same entry in the file is used "nuse" times
859 // before moving on to the next entry in the ntuple
860 
861  fNUse = TMath::Max(1L, nuse);
862 }
long int fNUse
how often to use same entry in a row
Definition: GDk2NuFlux.h:299
static constexpr double L
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 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::GDk2NuFlux::SetFluxSphere ( TVector3  center,
double  radius,
bool  inDetCoord = true 
)

specification of a sphere

void GDk2NuFlux::SetFluxSphere ( TVector3  center,
double  radius,
bool  inDetCoord = true 
)

specification of a sphere

Definition at line 902 of file GDk2NuFlux.cxx.

References ana::assert(), Beam2UserPos(), fFluxSphereCenterBeam, fFluxSphereCenterUser, fFluxSphereRadius, fIsSphere, LOG, pFATAL, radius, and User2BeamPos().

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

904 {
905  fIsSphere = true;
907  if ( inDetCoord ) {
908  fFluxSphereCenterUser = center;
909  TLorentzVector v4beam;
910  User2BeamPos(TLorentzVector(center,0),v4beam);
911  fFluxSphereCenterBeam = v4beam.Vect();
912  } else {
913  fFluxSphereCenterBeam = center;
914  TLorentzVector v4user;
915  Beam2UserPos(TLorentzVector(center,0),v4user);
916  fFluxSphereCenterBeam = v4user.Vect();
917  }
918 
919  // not yet supported
920  LOG("Flux", pFATAL) << "use of spherical flux window not yet fully supported";
921  assert(0);
922 
923 }
#define pFATAL
Definition: Messenger.h:57
bool fIsSphere
doing this on a sphere rather than a flat window?
Definition: GDk2NuFlux.h:318
TVector3 fFluxSphereCenterBeam
center for flux sphere - beam coords
Definition: GDk2NuFlux.h:327
double fFluxSphereRadius
radius for flux sphere
Definition: GDk2NuFlux.h:328
void User2BeamPos(const TLorentzVector &usrxyz, TLorentzVector &beamxyz) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
void Beam2UserPos(const TLorentzVector &beamxyz, TLorentzVector &usrxyz) const
Double_t radius
assert(nhit_max >=nhit_nbins)
TVector3 fFluxSphereCenterUser
center for flux sphere - user coords
Definition: GDk2NuFlux.h:326
void genie::flux::GDk2NuFlux::SetFluxWindow ( TVector3  p1,
TVector3  p2,
TVector3  p3 
)

3 points define a plane (by default in user coordinates)

void GDk2NuFlux::SetFluxWindow ( TVector3  p1,
TVector3  p2,
TVector3  p3 
)

3 points define a plane (by default in user coordinates)

Definition at line 865 of file GDk2NuFlux.cxx.

References CalcEffPOTsPerNu(), stan::math::dot(), e, fDetLocIsSet, fFluxWindowBase, fFluxWindowDir1, fFluxWindowDir2, fFluxWindowLen1, fFluxWindowLen2, fFluxWindowNormal, fFluxWindowPtUser, fIsSphere, LOG, PandAna.Demos.pi0_spectra::p0, plot_validation_datamc::p1, plot_validation_datamc::p2, pNOTICE, pWARN, Unit(), and User2BeamPos().

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

867 {
868  // set flux window
869  // NOTE: internally these are in "cm", but user might have set a preference
870  fDetLocIsSet = true;
871  fIsSphere = false;
872 
873  fFluxWindowPtUser[0] = p0;
874  fFluxWindowPtUser[1] = p1;
875  fFluxWindowPtUser[2] = p2;
876 
877  // convert from user to beam coord and from 3 points to base + 2 directions
878  // apply units conversion
879  TLorentzVector ptbm0, ptbm1, ptbm2;
880  User2BeamPos(TLorentzVector(fFluxWindowPtUser[0],0),ptbm0);
881  User2BeamPos(TLorentzVector(fFluxWindowPtUser[1],0),ptbm1);
882  User2BeamPos(TLorentzVector(fFluxWindowPtUser[2],0),ptbm2);
883 
884  fFluxWindowBase = ptbm0;
885  fFluxWindowDir1 = ptbm1 - ptbm0;
886  fFluxWindowDir2 = ptbm2 - ptbm0;
887 
890  fFluxWindowNormal = fFluxWindowDir1.Vect().Cross(fFluxWindowDir2.Vect()).Unit();
891 
892  double dot = fFluxWindowDir1.Dot(fFluxWindowDir2);
893  if ( TMath::Abs(dot) > 1.0e-8 )
894  LOG("Flux",pWARN) << "Dot product between window direction vectors was "
895  << dot << "; please check for orthoganality";
896 
897  LOG("Flux",pNOTICE) << "about to CalcEffPOTsPerNu";
898  this->CalcEffPOTsPerNu();
899 }
TVector3 fFluxWindowPtUser[3]
user points of flux window
Definition: GDk2NuFlux.h:319
bool fIsSphere
doing this on a sphere rather than a flat window?
Definition: GDk2NuFlux.h:318
void User2BeamPos(const TLorentzVector &usrxyz, TLorentzVector &beamxyz) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
TVector3 Unit() const
#define pWARN
Definition: Messenger.h:61
TLorentzVector fFluxWindowDir1
extent for flux window (direction 1)
Definition: GDk2NuFlux.h:321
double dot(const std::vector< double > &x, const std::vector< double > &y)
Definition: dot.hpp:10
TVector3 fFluxWindowNormal
normal direction for flux window – beam coord
Definition: GDk2NuFlux.h:325
TLorentzVector fFluxWindowBase
base point for flux window - beam coord
Definition: GDk2NuFlux.h:320
TLorentzVector fFluxWindowDir2
extent for flux window (direction 2)
Definition: GDk2NuFlux.h:322
bool fDetLocIsSet
is a flux location (near/far) set?
Definition: GDk2NuFlux.h:308
#define pNOTICE
Definition: Messenger.h:62
Float_t e
Definition: plot.C:35
void genie::flux::GDk2NuFlux::SetGenWeighted ( bool  genwgt = false)
inline

toggle whether GenerateNext() returns weight=1 flux (initial default false)

Definition at line 163 of file GDk2NuFlux.h.

void genie::flux::GDk2NuFlux::SetGenWeighted ( bool  genwgt = false)
inline

toggle whether GenerateNext() returns weight=1 flux (initial default false)

Definition at line 163 of file GDk2NuFlux.h.

void GDk2NuFlux::SetLengthUnits ( double  user_units)

Set units assumed by user.

Definition at line 1248 of file GDk2NuFlux.cxx.

References Munits::cm, fBeamZero, fCurNuChoice, fFluxWindowPtUser, fLengthScaleB2U, fLengthScaleU2B, fLengthUnits, genie::utils::units::UnitFromString(), and bsim::NuChoice::x4NuUser.

Referenced by Initialize(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1249 {
1250  // Set the scale factor for lengths going from beam (cm) to user coordinates
1251 
1252  // GDk2NuFlux uses "cm" as the length unit consistently internally (this is
1253  // the length units used by both the g3 and g4 ntuples). User interactions
1254  // setting the beam-to-detector coordinate transform, flux window, and the
1255  // returned position might need to be in other units. Use:
1256  // double scale = genie::utils::units::UnitFromString("cm");
1257  // ( #include "Utils/UnitUtils.h for declaration )
1258  // to get the correct scale factor to pass in.
1259 
1260  double rescale = fLengthUnits / user_units;
1261  fLengthUnits = user_units;
1262  double cm = genie::utils::units::UnitFromString("cm");
1263  fLengthScaleB2U = cm / user_units;
1264  fLengthScaleU2B = user_units / cm;
1265 
1266  // in case we're changing units without resetting transform/window
1267  // not recommended, but should work
1268  if (fCurNuChoice) fCurNuChoice->x4NuUser *= rescale;
1269  fBeamZero *= rescale;
1270  fFluxWindowPtUser[0] *= rescale;
1271  fFluxWindowPtUser[1] *= rescale;
1272  fFluxWindowPtUser[2] *= rescale;
1273 
1274  // case GDk2NuFlux::kmeter: fLengthScaleB2U = 0.01 ; break;
1275  // case GDk2NuFlux::kcm: fLengthScaleB2U = 1. ; break;
1276  // case GDk2NuFlux::kmm: fLengthScaleB2U = 10. ; break;
1277  // case GDk2NuFlux::kfm: fLengthScaleB2U = 1.e13 ; break; // 10e-2m -> 10e-15m
1278 
1279 }
double fLengthScaleB2U
scale factor beam (cm) –> user
Definition: GDk2NuFlux.h:311
TVector3 fFluxWindowPtUser[3]
user points of flux window
Definition: GDk2NuFlux.h:319
TLorentzVector fBeamZero
beam origin in user coords
Definition: GDk2NuFlux.h:314
double UnitFromString(string u)
Definition: UnitUtils.cxx:26
double fLengthScaleU2B
scale factor beam user –> (cm)
Definition: GDk2NuFlux.h:312
double fLengthUnits
units for coord in user exchanges
Definition: GDk2NuFlux.h:310
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
TLorentzVector x4NuUser
generated nu 4-position in user/det coord
Definition: NuChoice.h:58
static constexpr Double_t cm
Definition: Munits.h:140
void genie::flux::GDk2NuFlux::SetLengthUnits ( double  user_units)

Set units assumed by user.

void genie::flux::GDk2NuFlux::SetMaxEFudge ( double  fudge = 1.05)
inline
Parameters
fudgeextra fudge factor in estimating maximum energy

Definition at line 170 of file GDk2NuFlux.h.

171  { fMaxEFudge = fudge; }
double fMaxEFudge
fudge factor for estmating max enu (0=> use fixed 120GeV)
Definition: GDk2NuFlux.h:295
void genie::flux::GDk2NuFlux::SetMaxEFudge ( double  fudge = 1.05)
inline
Parameters
fudgeextra fudge factor in estimating maximum energy

Definition at line 170 of file GDk2NuFlux.h.

171  { fMaxEFudge = fudge; }
double fMaxEFudge
fudge factor for estmating max enu (0=> use fixed 120GeV)
Definition: GDk2NuFlux.h:295
void genie::flux::GDk2NuFlux::SetMaxEnergy ( double  Ev)

specify max flx nu energy

void GDk2NuFlux::SetMaxEnergy ( double  Ev)

specify max flx nu energy

Definition at line 848 of file GDk2NuFlux.cxx.

References fMaxEv, LOG, and pINFO.

Referenced by SetDefaults(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

849 {
850  fMaxEv = TMath::Max(0.,Ev);
851 
852  LOG("Flux", pINFO)
853  << "Declared maximum flux neutrino energy: " << fMaxEv;
854 }
double fMaxEv
maximum energy
Definition: GDk2NuFlux.h:255
#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 genie::flux::GDk2NuFlux::SetMaxWeightFailModel ( int  i = 0)
inline
Parameters
i0=bump, 1=leave frozen, 2=abort

Definition at line 175 of file GDk2NuFlux.h.

References MECModelEnuComparisons::i.

176  { fMaxWgtFailModel = i; }
int fMaxWgtFailModel
what to do ... 0=bump, 1=frozen, 2=abort
Definition: GDk2NuFlux.h:297
void genie::flux::GDk2NuFlux::SetMaxWeightFailModel ( int  i = 0)
inline
Parameters
i0=bump, 1=leave frozen, 2=abort

Definition at line 175 of file GDk2NuFlux.h.

References MECModelEnuComparisons::i.

176  { fMaxWgtFailModel = i; }
int fMaxWgtFailModel
what to do ... 0=bump, 1=frozen, 2=abort
Definition: GDk2NuFlux.h:297
void genie::flux::GDk2NuFlux::SetMaxWgtScan ( double  fudge = 1.05,
long int  nentries = 2500000 
)
inline
Parameters
nentriesconfiguration when estimating max weight

Definition at line 168 of file GDk2NuFlux.h.

References nentries.

169  { fMaxWgtFudge = fudge; fMaxWgtEntries = nentries; }
double fMaxWgtFudge
fudge factor for estimating max wgt
Definition: GDk2NuFlux.h:293
Long64_t nentries
long int fMaxWgtEntries
of entries in estimating max wgt
Definition: GDk2NuFlux.h:294
void genie::flux::GDk2NuFlux::SetMaxWgtScan ( double  fudge = 1.05,
long int  nentries = 2500000 
)
inline
Parameters
nentriesconfiguration when estimating max weight

Definition at line 168 of file GDk2NuFlux.h.

References nentries.

169  { fMaxWgtFudge = fudge; fMaxWgtEntries = nentries; }
double fMaxWgtFudge
fudge factor for estimating max wgt
Definition: GDk2NuFlux.h:293
Long64_t nentries
long int fMaxWgtEntries
of entries in estimating max wgt
Definition: GDk2NuFlux.h:294
void genie::flux::GDk2NuFlux::SetMinMaxWeight ( double  minwgt)
inline
Parameters
minwgtuser floor on estimating maxweight (to avoid bumping)

Definition at line 173 of file GDk2NuFlux.h.

174  { fMinMaxWeight = minwgt; }
double fMinMaxWeight
user set lower limit on estimate
Definition: GDk2NuFlux.h:289
void genie::flux::GDk2NuFlux::SetMinMaxWeight ( double  minwgt)
inline
Parameters
minwgtuser floor on estimating maxweight (to avoid bumping)

Definition at line 173 of file GDk2NuFlux.h.

174  { fMinMaxWeight = minwgt; }
double fMinMaxWeight
user set lower limit on estimate
Definition: GDk2NuFlux.h:289
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(), SetDefaults(), and genie::flux::GSimpleNtpFlux::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::GDk2NuFlux::SetTreeNames ( std::string  fname = "dk2nuTree",
std::string  mname = "dkmetaTree" 
)
inline

Definition at line 154 of file GDk2NuFlux.h.

References plot_validation_datamc::fname, and string.

156  { fTreeNames[0] = fname; fTreeNames[1] = mname; }
std::string fTreeNames[2]
pair of names "dk2nuTree", "dkmetaTree"
Definition: GDk2NuFlux.h:271
void genie::flux::GDk2NuFlux::SetTreeNames ( std::string  fname = "dk2nuTree",
std::string  mname = "dkmetaTree" 
)
inline

Definition at line 154 of file GDk2NuFlux.h.

References plot_validation_datamc::fname, and string.

156  { fTreeNames[0] = fname; fTreeNames[1] = mname; }
std::string fTreeNames[2]
pair of names "dk2nuTree", "dkmetaTree"
Definition: GDk2NuFlux.h:271
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(), SetDefaults(), and genie::flux::GSimpleNtpFlux::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 SetDefaults().

31  { fXMLbasename = xmlbasename; }
std::string fXMLbasename
XML file that might hold config param_sets.
TVector3 GDk2NuFlux::SphereNormal ( ) const

Definition at line 978 of file GDk2NuFlux.cxx.

References dir, fCurNuChoice, fFluxSphereCenterBeam, and bsim::NuChoice::x4NuBeam.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

979 {
980  // return the normal for this current location on the sphere
981  TVector3 dir = (fCurNuChoice->x4NuBeam.Vect() - fFluxSphereCenterBeam);
982  return dir.Unit();
983 }
TLorentzVector x4NuBeam
generated nu 4-position in beam coord
Definition: NuChoice.h:56
TVector3 fFluxSphereCenterBeam
center for flux sphere - beam coords
Definition: GDk2NuFlux.h:327
bsim::NuChoice * fCurNuChoice
Definition: GDk2NuFlux.h:277
TDirectory * dir
Definition: macro.C:5
TVector3 genie::flux::GDk2NuFlux::SphereNormal ( ) const
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::GDk2NuFlux::SumWeight ( void  ) const
inline

integrated weight for flux neutrinos looped so far

Definition at line 127 of file GDk2NuFlux.h.

References site_stats_from_log::filenames, and string.

double genie::flux::GDk2NuFlux::SumWeight ( void  ) const
inline

integrated weight for flux neutrinos looped so far

Definition at line 127 of file GDk2NuFlux.h.

References site_stats_from_log::filenames, and string.

double genie::flux::GDk2NuFlux::UsedPOTs ( void  ) const

of protons-on-target used

double GDk2NuFlux::UsedPOTs ( void  ) const

of protons-on-target used

Definition at line 552 of file GDk2NuFlux.cxx.

References fAccumPOTs, fNuFluxTree, LOG, and pWARN.

Referenced by GetTotalExposure(), POT_curr(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

553 {
554 // Compute current number of flux POTs
555 
556  if (!fNuFluxTree) {
557  LOG("Flux", pWARN)
558  << "The flux driver has not been properly configured";
559  return 0;
560  }
561  return fAccumPOTs;
562 }
TChain * fNuFluxTree
TTree // REF ONLY!
Definition: GDk2NuFlux.h:272
#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.
Definition: GDk2NuFlux.h:304
void genie::flux::GDk2NuFlux::User2BeamDir ( const TLorentzVector &  usrdir,
TLorentzVector &  beamdir 
) const
void GDk2NuFlux::User2BeamDir ( const TLorentzVector &  usrdir,
TLorentzVector &  beamdir 
) const

Definition at line 1030 of file GDk2NuFlux.cxx.

References fBeamRotInv, and fLengthScaleU2B.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1032 {
1033  beamdir = fLengthScaleU2B*(fBeamRotInv*usrdir);
1034 }
TLorentzRotation fBeamRotInv
Definition: GDk2NuFlux.h:316
double fLengthScaleU2B
scale factor beam user –> (cm)
Definition: GDk2NuFlux.h:312
void genie::flux::GDk2NuFlux::User2BeamP4 ( const TLorentzVector &  usrp4,
TLorentzVector &  beamp4 
) const
void GDk2NuFlux::User2BeamP4 ( const TLorentzVector &  usrp4,
TLorentzVector &  beamp4 
) const

Definition at line 1035 of file GDk2NuFlux.cxx.

References fBeamRotInv.

Referenced by genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1037 {
1038  beamp4 = fBeamRotInv*usrp4;
1039 }
TLorentzRotation fBeamRotInv
Definition: GDk2NuFlux.h:316
void GDk2NuFlux::User2BeamPos ( const TLorentzVector &  usrxyz,
TLorentzVector &  beamxyz 
) const

Definition at line 1025 of file GDk2NuFlux.cxx.

References fBeamRotInv, fBeamZero, and fLengthScaleU2B.

Referenced by PrintConfig(), SetFluxSphere(), SetFluxWindow(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

1027 {
1028  beamxyz = fLengthScaleU2B*(fBeamRotInv*(usrxyz-fBeamZero));
1029 }
TLorentzRotation fBeamRotInv
Definition: GDk2NuFlux.h:316
TLorentzVector fBeamZero
beam origin in user coords
Definition: GDk2NuFlux.h:314
double fLengthScaleU2B
scale factor beam user –> (cm)
Definition: GDk2NuFlux.h:312
void genie::flux::GDk2NuFlux::User2BeamPos ( const TLorentzVector &  usrxyz,
TLorentzVector &  beamxyz 
) const
double genie::flux::GDk2NuFlux::Weight ( void  )
inlinevirtual

returns the flux neutrino weight (if any)

Implements genie::GFluxI.

Definition at line 86 of file GDk2NuFlux.h.

86 { return fWeight; }
double fWeight
current neutrino weight, =1 if generating unweighted entries
Definition: GDk2NuFlux.h:287
double genie::flux::GDk2NuFlux::Weight ( void  )
inlinevirtual

returns the flux neutrino weight (if any)

Implements genie::GFluxI.

Definition at line 86 of file GDk2NuFlux.h.

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

86 { return fWeight; }
double fWeight
current neutrino weight, =1 if generating unweighted entries
Definition: GDk2NuFlux.h:287

Member Data Documentation

double genie::flux::GDk2NuFlux::fAccumPOTs
private

POTs used so far.

Definition at line 304 of file GDk2NuFlux.h.

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

bool genie::flux::GDk2NuFlux::fApplyTiltWeight
private

wgt due to window normal not || beam

Definition at line 307 of file GDk2NuFlux.h.

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

TLorentzRotation genie::flux::GDk2NuFlux::fBeamRot
private

rotation applied beam –> user coord

Definition at line 315 of file GDk2NuFlux.h.

Referenced by Beam2UserDir(), Beam2UserP4(), Beam2UserPos(), GetBeamRotation(), PrintConfig(), and SetBeamRotation().

TLorentzRotation genie::flux::GDk2NuFlux::fBeamRotInv
private

Definition at line 316 of file GDk2NuFlux.h.

Referenced by PrintConfig(), SetBeamRotation(), User2BeamDir(), User2BeamP4(), and User2BeamPos().

TLorentzVector genie::flux::GDk2NuFlux::fBeamZero
private

beam origin in user coords

Definition at line 314 of file GDk2NuFlux.h.

Referenced by Beam2UserPos(), GetBeamCenter(), PrintConfig(), SetBeamCenter(), SetLengthUnits(), and User2BeamPos().

bsim::Dk2Nu * genie::flux::GDk2NuFlux::fCurDk2Nu
private
bsim::DkMeta * genie::flux::GDk2NuFlux::fCurDkMeta
private

Definition at line 276 of file GDk2NuFlux.h.

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

bsim::NuChoice * genie::flux::GDk2NuFlux::fCurNuChoice
private
bool genie::flux::GDk2NuFlux::fDetLocIsSet
private

is a flux location (near/far) set?

Definition at line 308 of file GDk2NuFlux.h.

Referenced by Initialize(), LoadBeamSimData(), PrintConfig(), ScanForMaxWeight(), and SetFluxWindow().

double genie::flux::GDk2NuFlux::fEffPOTsPerNu
private

what a entry is worth ...

Definition at line 303 of file GDk2NuFlux.h.

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

bool genie::flux::GDk2NuFlux::fEnd
private

end condition reached

Definition at line 257 of file GDk2NuFlux.h.

Referenced by GenerateNext_weighted(), and Initialize().

Long64_t genie::flux::GDk2NuFlux::fFilePOTs
private

of protons-on-target represented by all files

Definition at line 283 of file GDk2NuFlux.h.

Referenced by AddFile(), CalcEffPOTsPerNu(), Initialize(), and PrintConfig().

TVector3 genie::flux::GDk2NuFlux::fFluxSphereCenterBeam
private

center for flux sphere - beam coords

Definition at line 327 of file GDk2NuFlux.h.

Referenced by GetFluxSphere(), PrintConfig(), SetFluxSphere(), and SphereNormal().

TVector3 genie::flux::GDk2NuFlux::fFluxSphereCenterUser
private

center for flux sphere - user coords

Definition at line 326 of file GDk2NuFlux.h.

Referenced by GetFluxSphere(), PrintConfig(), and SetFluxSphere().

double genie::flux::GDk2NuFlux::fFluxSphereRadius
private

radius for flux sphere

Definition at line 328 of file GDk2NuFlux.h.

Referenced by GetFluxSphere(), PrintConfig(), and SetFluxSphere().

TLorentzVector genie::flux::GDk2NuFlux::fFluxWindowBase
private

base point for flux window - beam coord

Definition at line 320 of file GDk2NuFlux.h.

Referenced by GenerateNext_weighted(), PrintConfig(), and SetFluxWindow().

TLorentzVector genie::flux::GDk2NuFlux::fFluxWindowDir1
private

extent for flux window (direction 1)

Definition at line 321 of file GDk2NuFlux.h.

Referenced by CalcEffPOTsPerNu(), GenerateNext_weighted(), PrintConfig(), and SetFluxWindow().

TLorentzVector genie::flux::GDk2NuFlux::fFluxWindowDir2
private

extent for flux window (direction 2)

Definition at line 322 of file GDk2NuFlux.h.

Referenced by CalcEffPOTsPerNu(), GenerateNext_weighted(), PrintConfig(), and SetFluxWindow().

double genie::flux::GDk2NuFlux::fFluxWindowLen1
private

Definition at line 323 of file GDk2NuFlux.h.

Referenced by PrintConfig(), and SetFluxWindow().

double genie::flux::GDk2NuFlux::fFluxWindowLen2
private

Definition at line 324 of file GDk2NuFlux.h.

Referenced by PrintConfig(), and SetFluxWindow().

TVector3 genie::flux::GDk2NuFlux::fFluxWindowNormal
private

normal direction for flux window – beam coord

Definition at line 325 of file GDk2NuFlux.h.

Referenced by SetFluxWindow().

TVector3 genie::flux::GDk2NuFlux::fFluxWindowPtUser
private

user points of flux window

Definition at line 319 of file GDk2NuFlux.h.

Referenced by GetFluxWindow(), PrintConfig(), SetFluxWindow(), and SetLengthUnits().

bool genie::flux::GDk2NuFlux::fGenWeighted
private

does GenerateNext() give weights?

Definition at line 306 of file GDk2NuFlux.h.

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

TLorentzVector genie::flux::GDk2NuFlux::fgX4dkvtx
private

decay 4-position beam coord

Definition at line 330 of file GDk2NuFlux.h.

Referenced by GenerateNext_weighted(), and GetDecayDist().

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

current flux ntuple entry

Definition at line 281 of file GDk2NuFlux.h.

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

bool genie::flux::GDk2NuFlux::fIsSphere
private

doing this on a sphere rather than a flat window?

Definition at line 318 of file GDk2NuFlux.h.

Referenced by Initialize(), SetFluxSphere(), and SetFluxWindow().

long int genie::flux::GDk2NuFlux::fIUse
private

current # of times an entry has been used

Definition at line 300 of file GDk2NuFlux.h.

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

std::map< int, int > genie::flux::GDk2NuFlux::fJobToMetaIndex
private

quick lookup from job# to meta chain

Definition at line 285 of file GDk2NuFlux.h.

Referenced by LoadDkMeta().

double genie::flux::GDk2NuFlux::fLengthScaleB2U
private

scale factor beam (cm) –> user

Definition at line 311 of file GDk2NuFlux.h.

Referenced by Beam2UserDir(), Beam2UserPos(), GetDecayDist(), LengthUnits(), PrintConfig(), and SetLengthUnits().

double genie::flux::GDk2NuFlux::fLengthScaleU2B
private

scale factor beam user –> (cm)

Definition at line 312 of file GDk2NuFlux.h.

Referenced by MoveToZ0(), PrintConfig(), SetLengthUnits(), User2BeamDir(), and User2BeamPos().

double genie::flux::GDk2NuFlux::fLengthUnits
private

units for coord in user exchanges

Definition at line 310 of file GDk2NuFlux.h.

Referenced by PrintConfig(), and SetLengthUnits().

double genie::flux::GDk2NuFlux::fMaxEFudge
private

fudge factor for estmating max enu (0=> use fixed 120GeV)

Definition at line 295 of file GDk2NuFlux.h.

Referenced by Initialize(), and ScanForMaxWeight().

double genie::flux::GDk2NuFlux::fMaxEv
private

maximum energy

Definition at line 255 of file GDk2NuFlux.h.

Referenced by GenerateNext_weighted(), Initialize(), PrintConfig(), ScanForMaxWeight(), and SetMaxEnergy().

double genie::flux::GDk2NuFlux::fMaxWeight
private

max flux neutrino weight in input file

Definition at line 288 of file GDk2NuFlux.h.

Referenced by GenerateNext(), GenerateNext_weighted(), Initialize(), LoadBeamSimData(), PrintConfig(), and ScanForMaxWeight().

double genie::flux::GDk2NuFlux::fMaxWeightInit
private

max of scan & minmaxweight

Definition at line 291 of file GDk2NuFlux.h.

Referenced by PrintConfig(), and ScanForMaxWeight().

double genie::flux::GDk2NuFlux::fMaxWeightMax
private

if "frozen" this is what bump would given

Definition at line 292 of file GDk2NuFlux.h.

Referenced by GenerateNext(), PrintConfig(), and ScanForMaxWeight().

double genie::flux::GDk2NuFlux::fMaxWeightScan
private

initial estimate from scan

Definition at line 290 of file GDk2NuFlux.h.

Referenced by PrintConfig(), and ScanForMaxWeight().

long int genie::flux::GDk2NuFlux::fMaxWgtEntries
private

of entries in estimating max wgt

Definition at line 294 of file GDk2NuFlux.h.

Referenced by Initialize(), PrintConfig(), and ScanForMaxWeight().

long int genie::flux::GDk2NuFlux::fMaxWgtExceeded
private

track failures of estimate

Definition at line 296 of file GDk2NuFlux.h.

Referenced by GenerateNext(), Initialize(), PrintConfig(), and ScanForMaxWeight().

int genie::flux::GDk2NuFlux::fMaxWgtFailModel
private

what to do ... 0=bump, 1=frozen, 2=abort

Definition at line 297 of file GDk2NuFlux.h.

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

double genie::flux::GDk2NuFlux::fMaxWgtFudge
private

fudge factor for estimating max wgt

Definition at line 293 of file GDk2NuFlux.h.

Referenced by GenerateNext(), Initialize(), PrintConfig(), and ScanForMaxWeight().

double genie::flux::GDk2NuFlux::fMinMaxWeight
private

user set lower limit on estimate

Definition at line 289 of file GDk2NuFlux.h.

Referenced by Initialize(), PrintConfig(), and ScanForMaxWeight().

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

number of flux ntuple entries

Definition at line 280 of file GDk2NuFlux.h.

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

int genie::flux::GDk2NuFlux::fNFiles
private

number of files in chain

Definition at line 279 of file GDk2NuFlux.h.

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

long int genie::flux::GDk2NuFlux::fNNeutrinos
private

number of flux neutrinos thrown so far

Definition at line 302 of file GDk2NuFlux.h.

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

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

(potentially wildcarded) path(s)

Definition at line 269 of file GDk2NuFlux.h.

Referenced by LoadBeamSimData(), and PrintConfig().

TChain * genie::flux::GDk2NuFlux::fNuFluxTree
private

TTree // REF ONLY!

Definition at line 272 of file GDk2NuFlux.h.

Referenced by AddFile(), CalcEffPOTsPerNu(), GenerateNext_weighted(), GetFileList(), Initialize(), LoadBeamSimData(), and UsedPOTs().

TChain * genie::flux::GDk2NuFlux::fNuMetaTree
private

TTree // REF ONLY!

Definition at line 273 of file GDk2NuFlux.h.

Referenced by AddFile(), GetMetaDataTree(), Initialize(), LoadBeamSimData(), and LoadDkMeta().

long int genie::flux::GDk2NuFlux::fNUse
private

how often to use same entry in a row

Definition at line 299 of file GDk2NuFlux.h.

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

Long64_t genie::flux::GDk2NuFlux::fNuTot
private

cummulative # of entries (=fNEntries)

Definition at line 282 of file GDk2NuFlux.h.

Referenced by AddFile(), and Initialize().

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

sum of weights for nus thrown so far

Definition at line 301 of file GDk2NuFlux.h.

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

std::string genie::flux::GDk2NuFlux::fTreeNames
private

pair of names "dk2nuTree", "dkmetaTree"

Definition at line 271 of file GDk2NuFlux.h.

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

double genie::flux::GDk2NuFlux::fWeight
private

current neutrino weight, =1 if generating unweighted entries

Definition at line 287 of file GDk2NuFlux.h.

Referenced by GenerateNext(), and GenerateNext_weighted().

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 GenerateNext_weighted(), genie::flux::GSimpleNtpFlux::GenerateNext_weighted(), PrintConfig(), and genie::flux::GFluxFileConfigI::SetUpstreamZ().


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