23 #ifndef _GNUMI_NEUTRINO_FLUX_H_
24 #define _GNUMI_NEUTRINO_FLUX_H_
32 #include <TLorentzVector.h>
33 #include <TLorentzRotation.h>
56 class GNuMIFluxPassThroughInfo;
57 ostream &
operator << (ostream & stream,
const GNuMIFluxPassThroughInfo & info);
88 void Print(
const Option_t* opt =
"")
const;
90 int CalcEnuWgt(
const TLorentzVector& xyz,
double& enu,
double& wgt_xy)
const;
173 #ifndef SKIP_MINERVA_MODS
239 void Clear (Option_t * opt);
277 virtual void LoadBeamSimData(
const std::vector<std::string>& filenames,
278 const std::string& det_loc);
280 virtual void GetBranchInfo(std::vector<std::string>& branchNames,
281 std::vector<std::string>& branchClassNames,
282 std::vector<void**>& branchObjPointers);
346 void GetFluxWindow(TVector3& p1, TVector3& p2, TVector3& p3)
const;
356 TLorentzVector& usrxyz )
const;
358 TLorentzVector& usrdir )
const;
360 TLorentzVector& usrp4 )
const;
362 TLorentzVector& beamxyz )
const;
364 TLorentzVector& beamdir )
const;
366 TLorentzVector& beamp4 )
const;
379 void AddFile (TTree* tree,
string fname);
441 #ifdef GNUMI_TEST_XY_WGT
444 friend ostream &
operator << (ostream & stream,
const xypartials & info);
447 void ReadStream(std::ifstream& myfile);
448 int Compare(
const xypartials& other)
const;
449 void Print(
const Option_t* opt =
"")
const;
450 static xypartials& GetStaticInstance();
452 double xdet, ydet, zdet;
453 double parent_mass, parentp, parent_energy;
454 double gamma, beta_mag, enuzr,
rad;
455 double costh_pardet, theta_pardet, emrat, eneu;
457 double betanu[3], p_nu[3], partial1, p_dcm_nu[4];
458 double muparent_px, muparent_py, muparent_pz;
459 double gammamp, betamp[3], partial2, p_pcm_mp[3], p_pcm;
460 double costhmu, wgt_ratio;
469 #endif // _GNUMI_NEUTRINO_FLUX_H_
double fSumWeight
sum of weights for nus thrown so far
long int Index(void)
returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current ent...
void User2BeamP4(const TLorentzVector &usrp4, TLorentzVector &beamp4) const
static constexpr double rad
TVector3 GetBeamCenter() const
beam origin in user frame
virtual void GetBranchInfo(std::vector< std::string > &branchNames, std::vector< std::string > &branchClassNames, std::vector< void ** > &branchObjPointers)
TLorentzVector fgP4
generated nu 4-momentum beam coord
void GetFluxWindow(TVector3 &p1, TVector3 &p2, TVector3 &p3) const
3 points define a plane in beam coordinate
void SetEntryReuse(long int nuse=1)
of times to use entry before moving to next
virtual void LoadBeamSimData(const std::vector< std::string > &filenames, const std::string &det_loc)=0
double fLengthUnits
units for coord in user exchanges
void SetApplyWindowTiltWeight(bool apply=true)
long int fIUse
current # of times an entry has been used
Long64_t fFilePOTs
of protons-on-target represented by all files
static const unsigned int MAX_N_TRAJ
Maximum number of trajectories to store.
double POT_curr(void)
current average POT (RWH?)
void SetLengthUnits(double user_units)
Set units assumed by user.
Long64_t GetEntryNumber()
index in chain
void UseFluxAtNearDetCenter(void)
force weights at MINOS detector "center" as found in ntuple
double pprodpx[MAX_N_TRAJ]
Long64_t fIEntry
current flux ntuple entry
bool fGenWeighted
does GenerateNext() give weights?
double fMaxEFudge
fudge factor for estmating max enu (0=> use fixed 120GeV)
TVector3 fFluxWindowPtUser[3]
user points of flux window
TLorentzVector fgX4User
generated nu 4-position user coord
bool LoadConfig(string cfg)
load a named configuration
double stoppz[MAX_N_TRAJ]
bool fApplyTiltWeight
wgt due to window normal not || beam
virtual ~GNuMIFluxPassThroughInfo()
TLorentzVector fFluxWindowDir2
extent for flux window (direction 2)
double stoppy[MAX_N_TRAJ]
void SetTreeName(string name)
set input tree name (default: "h10")
Long64_t fNEntries
number of flux ntuple entries
virtual double GetTotalExposure() const
void Beam2UserP4(const TLorentzVector &beamp4, TLorentzVector &usrp4) const
double SumWeight(void) const
integrated weight for flux neutrinos looped so far
TRotation GetBeamRotation() const
rotation to apply from beam->user
double startx[MAX_N_TRAJ]
bool fEnd
end condition reached
double pprodpy[MAX_N_TRAJ]
TLorentzVector fBeamZero
beam origin in user coords
void MakeCopy(const g3numi *)
pull in from g3 ntuple
double fMaxWgtFudge
fudge factor for estimating max wgt
friend ostream & operator<<(ostream &stream, const GNuMIFluxPassThroughInfo &info)
TChain * fNuFluxTree
TTree in g3numi or g4numi // REF ONLY!
bool End(void)
true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
ostream & operator<<(ostream &stream, const genie::flux::GJPARCNuFluxPassThroughInfo &info)
A GENIE flux driver encapsulating the NuMI neutrino flux. It reads-in the official GNUMI neutrino flu...
double Weight(void)
returns the flux neutrino weight (if any)
string fNuFluxTreeName
Tree name "h10" (g3) or "nudata" (g4)
void User2BeamPos(const TLorentzVector &usrxyz, TLorentzVector &beamxyz) const
TLorentzVector fgX4
generated nu 4-position beam coord
double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
virtual void LoadBeamSimData(const std::vector< std::string > &filenames, const std::string &det_loc)
void MoveToZ0(double z0)
move ray origin to user coord Z0
g4numi * fG4NuMI
g4numi ntuple
TLorentzVector fgX4dkvtx
decay 4-position beam coord
std::vector< string > fNuFluxFilePatterns
(potentially wildcarded) path(s)
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
std::vector< std::string > GetFileList()
list of files currently part of chain
TLorentzVector fFluxWindowDir1
extent for flux window (direction 1)
const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units) ...
const GNuMIFluxPassThroughInfo & PassThroughInfo(void)
GNuMIFluxPassThroughInfo.
int PdgCode(void)
returns the flux neutrino pdg code
void SetBeamRotation(TRotation beamrot)
< beam (0,0,0) relative to user frame, beam direction in user frame
void SetMaxWgtScan(double fudge=1.05, long int nentries=2500000)
GENIE interface for uniform flux exposure iterface.
double pprodpz[MAX_N_TRAJ]
int CalcEnuWgt(const TLorentzVector &xyz, double &enu, double &wgt_xy) const
void SetBeamCenter(TVector3 beam0)
const PDGCodeList & FluxParticles(void)
declare list of flux neutrinos that can be generated (for init. purposes)
bool GenerateNext_weighted(void)
int getVolID(TString sval)
bool fDetLocIsSet
is a flux location (near/far) set?
GNuMIFluxPassThroughInfo()
int fNFiles
number of files in chain
void PrintCurrent(void)
print current entry from leaves
bool SetFluxWindow(StdFluxWindow_t stdwindow, double padding=0)
return false if unhandled
flugg * fFlugg
flugg ntuple
bool GenerateNext(void)
generate the next flux neutrino (return false in err)
GNuMIFluxPassThroughInfo * fCurEntry
copy of current ntuple entry info (owned structure)
double fAccumPOTs
POTs used so far.
double startpz[MAX_N_TRAJ]
double LengthUnits(void) const
Return user units.
double startz[MAX_N_TRAJ]
void Print(const Option_t *opt="") const
void Clear(Option_t *opt)
reset state variables based on opt
double GetDecayDist() const
dist (user units) from dk to current pos
void Beam2UserPos(const TLorentzVector &beamxyz, TLorentzVector &usrxyz) const
double fMaxWeight
max flux neutrino weight in input file
double startpx[MAX_N_TRAJ]
double startpy[MAX_N_TRAJ]
double fLengthScaleB2U
scale factor beam (cm) –> user
long int fMaxWgtEntries
of entries in estimating max wgt
int fgPdgC
generated nu pdg-code
enum genie::flux::GNuMIFlux::EStdFluxWindow StdFluxWindow_t
g3numi * fG3NuMI
g3numi ntuple
const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
virtual TTree * GetMetaDataTree()
double stoppx[MAX_N_TRAJ]
TVector3 fWindowNormal
normal direction for flux window
double fLengthScaleU2B
scale factor beam user –> (cm)
void SetMaxEFudge(double fudge=1.05)
int fUseFluxAtDetCenter
use flux at near (-1) or far (+1) det center from ntuple?
void User2BeamDir(const TLorentzVector &usrdir, TLorentzVector &beamdir) const
double fEffPOTsPerNu
what a entry is worth ...
void PrintConfig()
print the current configuration
void ScanForMaxWeight(void)
scan for max flux weight (before generating unweighted flux neutrinos)
int getProcessID(TString sval)
void SetMaxEnergy(double Ev)
specify maximum flx neutrino energy
TLorentzRotation fBeamRotInv
TVector3 FluxWindowNormal()
TLorentzVector fgP4User
generated nu 4-momentum user coord
string fNuFluxGen
"g3numi" "g4numi" or "flugg"
double starty[MAX_N_TRAJ]
virtual long int NFluxNeutrinos() const
of rays generated
double fWeight
current neutrino weight, =1 if generating unweighted entries
void Beam2UserDir(const TLorentzVector &beamdir, TLorentzVector &usrdir) const
TLorentzRotation fBeamRot
rotation applied beam –> user coord
long int fNUse
how often to use same entry in a row
Long64_t fNuTot
cummulative # of entries (=fNEntries)
double fMaxEv
maximum energy
void AddFile(TTree *tree, string fname)
void UseFluxAtFarDetCenter(void)
void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
TLorentzVector fFluxWindowBase
base point for flux window - beam coord
long int fNNeutrinos
number of flux neutrinos thrown so far
void CalcEffPOTsPerNu(void)
void SetGenWeighted(bool genwgt=false)
toggle whether GenerateNext() returns weight=1 flux (initial default false)
GENIE Interface for user-defined flux classes.
double UsedPOTs(void) const
of protons-on-target used