LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
fluxr::GSimpleInterface Class Reference

#include "GSimpleInterface.h"

Inheritance diagram for fluxr::GSimpleInterface:
fluxr::FluxInterface

Public Member Functions

 GSimpleInterface ()
 
 ~GSimpleInterface ()
 
Long64_t GetEntries () const
 
int GetRun () const
 
float GetPOT () const
 
TLorentzVector GetNuPosition () const
 
TLorentzVector GetNuMomentum () const
 
void SetRootFile (TFile *rootFileName)
 
bool FillMCFlux (Long64_t ientry, simb::MCFlux &mcflux)
 

Private Attributes

TTree * fFluxTree
 
TTree * fMetaTree
 
genie::flux::GSimpleNtpEntry * fGSimpleEntry
 
genie::flux::GSimpleNtpNuMI * fGSimpleNuMI
 
genie::flux::GSimpleNtpAux * fGSimpleAux
 
genie::flux::GSimpleNtpMeta * fGSimpleMeta
 
Long64_t fNEntries
 
int fRun
 
float fPOT
 
TLorentzVector fNuPos
 
TLorentzVector fNuMom
 

Detailed Description

Definition at line 13 of file GSimpleInterface.h.

Constructor & Destructor Documentation

fluxr::GSimpleInterface::GSimpleInterface ( )

Definition at line 6 of file GSimpleInterface.cxx.

6 {}
fluxr::GSimpleInterface::~GSimpleInterface ( )

Definition at line 8 of file GSimpleInterface.cxx.

8 {}

Member Function Documentation

bool fluxr::GSimpleInterface::FillMCFlux ( Long64_t  ientry,
simb::MCFlux mcflux 
)
virtual

Implements fluxr::FluxInterface.

Definition at line 30 of file GSimpleInterface.cxx.

References simb::MCFlux::fdk2gen, simb::MCFlux::fevtno, fFluxTree, fGSimpleAux, fGSimpleEntry, fGSimpleMeta, fGSimpleNuMI, simb::MCFlux::fmupare, simb::MCFlux::fmuparpx, simb::MCFlux::fmuparpy, simb::MCFlux::fmuparpz, simb::MCFlux::fndecay, simb::MCFlux::fnecm, simb::MCFlux::fnenergyf, simb::MCFlux::fnenergyn, simb::MCFlux::fnimpwt, simb::MCFlux::fntype, fNuMom, fNuPos, simb::MCFlux::fnwtfar, simb::MCFlux::fnwtnear, simb::MCFlux::fpdpx, simb::MCFlux::fpdpy, simb::MCFlux::fpdpz, simb::MCFlux::fppdxdz, simb::MCFlux::fppdydz, simb::MCFlux::fppmedium, simb::MCFlux::fpppz, simb::MCFlux::fptype, simb::MCFlux::frun, simb::MCFlux::ftgen, simb::MCFlux::ftgptype, simb::MCFlux::ftptype, simb::MCFlux::ftpx, simb::MCFlux::ftpy, simb::MCFlux::ftpz, simb::MCFlux::fvx, simb::MCFlux::fvy, and simb::MCFlux::fvz.

Referenced by GetNuMomentum().

31  {
32  if (!fFluxTree->GetEntry(ientry)) return false;
33 
34  fNuPos = TLorentzVector(
35  fGSimpleEntry->vtxx * 100, fGSimpleEntry->vtxy * 100, fGSimpleEntry->vtxz * 100, 0);
36  fNuMom =
37  TLorentzVector(fGSimpleEntry->px, fGSimpleEntry->py, fGSimpleEntry->pz, fGSimpleEntry->E);
38 
39  //stealing code from GenieHelper (nutools/EventGeneratorBase/GENIE/GENIEHelper.cxx)
40  flux.fntype = fGSimpleEntry->pdg;
41  flux.fnimpwt = fGSimpleEntry->wgt;
42  flux.fdk2gen = fGSimpleEntry->dist;
43  flux.fnenergyn = flux.fnenergyf = fGSimpleEntry->E;
44 
45  if (fGSimpleNuMI) {
46  flux.frun = fGSimpleNuMI->run;
47  flux.fevtno = fGSimpleNuMI->evtno;
48  flux.ftpx = fGSimpleNuMI->tpx;
49  flux.ftpy = fGSimpleNuMI->tpy;
50  flux.ftpz = fGSimpleNuMI->tpz;
51  flux.ftptype = fGSimpleNuMI->tptype; // converted to PDG
52  flux.fvx = fGSimpleNuMI->vx;
53  flux.fvy = fGSimpleNuMI->vy;
54  flux.fvz = fGSimpleNuMI->vz;
55 
56  flux.fndecay = fGSimpleNuMI->ndecay;
57  flux.fppmedium = fGSimpleNuMI->ppmedium;
58 
59  flux.fpdpx = fGSimpleNuMI->pdpx;
60  flux.fpdpy = fGSimpleNuMI->pdpy;
61  flux.fpdpz = fGSimpleNuMI->pdpz;
62 
63  double apppz = fGSimpleNuMI->pppz;
64  if (TMath::Abs(fGSimpleNuMI->pppz) < 1.0e-30) apppz = 1.0e-30;
65  flux.fppdxdz = fGSimpleNuMI->pppx / apppz;
66  flux.fppdydz = fGSimpleNuMI->pppy / apppz;
67  flux.fpppz = fGSimpleNuMI->pppz;
68 
69  flux.fptype = fGSimpleNuMI->ptype;
70  }
71 
72  // anything useful stuffed into vdbl or vint?
73  // need to check the metadata auxintname, auxdblname
74  if (fGSimpleAux && fGSimpleMeta) {
75  // references just for reducing complexity
76  const std::vector<std::string>& auxdblname = fGSimpleMeta->auxdblname;
77  const std::vector<std::string>& auxintname = fGSimpleMeta->auxintname;
78  const std::vector<int>& auxint = fGSimpleAux->auxint;
79  const std::vector<double>& auxdbl = fGSimpleAux->auxdbl;
80 
81  for (size_t id = 0; id < auxdblname.size(); ++id) {
82  if ("muparpx" == auxdblname[id]) flux.fmuparpx = auxdbl[id];
83  if ("muparpy" == auxdblname[id]) flux.fmuparpy = auxdbl[id];
84  if ("muparpz" == auxdblname[id]) flux.fmuparpz = auxdbl[id];
85  if ("mupare" == auxdblname[id]) flux.fmupare = auxdbl[id];
86  if ("necm" == auxdblname[id]) flux.fnecm = auxdbl[id];
87  if ("nimpwt" == auxdblname[id]) flux.fnimpwt = auxdbl[id];
88  if ("fgXYWgt" == auxdblname[id]) { flux.fnwtnear = flux.fnwtfar = auxdbl[id]; }
89  }
90  for (size_t ii = 0; ii < auxintname.size(); ++ii) {
91  if ("tgen" == auxintname[ii]) flux.ftgen = auxint[ii];
92  if ("tgptype" == auxintname[ii]) flux.ftgptype = auxint[ii];
93  }
94  }
95  return true;
96  }
genie::flux::GSimpleNtpEntry * fGSimpleEntry
genie::flux::GSimpleNtpNuMI * fGSimpleNuMI
genie::flux::GSimpleNtpMeta * fGSimpleMeta
genie::flux::GSimpleNtpAux * fGSimpleAux
Long64_t fluxr::GSimpleInterface::GetEntries ( ) const
inlinevirtual

Implements fluxr::FluxInterface.

Definition at line 18 of file GSimpleInterface.h.

References fNEntries.

18 { return fNEntries; };
TLorentzVector fluxr::GSimpleInterface::GetNuMomentum ( ) const
inlinevirtual

Implements fluxr::FluxInterface.

Definition at line 22 of file GSimpleInterface.h.

References FillMCFlux(), fNuMom, and SetRootFile().

22 { return fNuMom; };
TLorentzVector fluxr::GSimpleInterface::GetNuPosition ( ) const
inlinevirtual

Implements fluxr::FluxInterface.

Definition at line 21 of file GSimpleInterface.h.

References fNuPos.

21 { return fNuPos; };
float fluxr::GSimpleInterface::GetPOT ( ) const
inlinevirtual

Implements fluxr::FluxInterface.

Definition at line 20 of file GSimpleInterface.h.

References fPOT.

20 { return fPOT; };
int fluxr::GSimpleInterface::GetRun ( ) const
inlinevirtual

Implements fluxr::FluxInterface.

Definition at line 19 of file GSimpleInterface.h.

References fRun.

19 { return fRun; };
void fluxr::GSimpleInterface::SetRootFile ( TFile *  rootFileName)

Definition at line 10 of file GSimpleInterface.cxx.

References fFluxTree, fGSimpleAux, fGSimpleEntry, fGSimpleMeta, fGSimpleNuMI, fMetaTree, fNEntries, fPOT, and fRun.

Referenced by GetNuMomentum().

11  {
12  fFluxTree = dynamic_cast<TTree*>(fluxInputFile->Get("flux"));
13  fMetaTree = dynamic_cast<TTree*>(fluxInputFile->Get("meta"));
14  fGSimpleEntry = new genie::flux::GSimpleNtpEntry;
15  fGSimpleNuMI = new genie::flux::GSimpleNtpNuMI;
16  fGSimpleAux = new genie::flux::GSimpleNtpAux;
17  fGSimpleMeta = new genie::flux::GSimpleNtpMeta;
18  fFluxTree->SetBranchAddress("entry", &fGSimpleEntry);
19  fFluxTree->SetBranchAddress("numi", &fGSimpleNuMI);
20  fFluxTree->SetBranchAddress("aux", &fGSimpleAux);
21  fMetaTree->SetBranchAddress("meta", &fGSimpleMeta);
22 
23  fNEntries = fFluxTree->GetEntries();
24  fFluxTree->GetEntry(0);
25  fRun = fGSimpleNuMI->run;
26  fMetaTree->GetEntry(0);
27  fPOT = fGSimpleMeta->protons;
28  }
genie::flux::GSimpleNtpEntry * fGSimpleEntry
genie::flux::GSimpleNtpNuMI * fGSimpleNuMI
genie::flux::GSimpleNtpMeta * fGSimpleMeta
genie::flux::GSimpleNtpAux * fGSimpleAux

Member Data Documentation

TTree* fluxr::GSimpleInterface::fFluxTree
private

Definition at line 28 of file GSimpleInterface.h.

Referenced by FillMCFlux(), and SetRootFile().

genie::flux::GSimpleNtpAux* fluxr::GSimpleInterface::fGSimpleAux
private

Definition at line 32 of file GSimpleInterface.h.

Referenced by FillMCFlux(), and SetRootFile().

genie::flux::GSimpleNtpEntry* fluxr::GSimpleInterface::fGSimpleEntry
private

Definition at line 30 of file GSimpleInterface.h.

Referenced by FillMCFlux(), and SetRootFile().

genie::flux::GSimpleNtpMeta* fluxr::GSimpleInterface::fGSimpleMeta
private

Definition at line 33 of file GSimpleInterface.h.

Referenced by FillMCFlux(), and SetRootFile().

genie::flux::GSimpleNtpNuMI* fluxr::GSimpleInterface::fGSimpleNuMI
private

Definition at line 31 of file GSimpleInterface.h.

Referenced by FillMCFlux(), and SetRootFile().

TTree* fluxr::GSimpleInterface::fMetaTree
private

Definition at line 29 of file GSimpleInterface.h.

Referenced by SetRootFile().

Long64_t fluxr::GSimpleInterface::fNEntries
private

Definition at line 34 of file GSimpleInterface.h.

Referenced by GetEntries(), and SetRootFile().

TLorentzVector fluxr::GSimpleInterface::fNuMom
private

Definition at line 38 of file GSimpleInterface.h.

Referenced by FillMCFlux(), and GetNuMomentum().

TLorentzVector fluxr::GSimpleInterface::fNuPos
private

Definition at line 37 of file GSimpleInterface.h.

Referenced by FillMCFlux(), and GetNuPosition().

float fluxr::GSimpleInterface::fPOT
private

Definition at line 36 of file GSimpleInterface.h.

Referenced by GetPOT(), and SetRootFile().

int fluxr::GSimpleInterface::fRun
private

Definition at line 35 of file GSimpleInterface.h.

Referenced by GetRun(), and SetRootFile().


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