25 using namespace genie;
26 using namespace genie::evtlib;
29 EventLibraryInterface::EventLibraryInterface() :
74 TLorentzVector probe_p4 ( * probe->
P4() ) ;
76 LOG(
"ELI",
pINFO) <<
"Difference between requested neutrino E and used neutrino energy: " << probe_p4.E() - rec -> E ;
78 probe_p4 *= rec -> E / probe_p4.
E() ;
79 probe -> SetMomentum( probe_p4 ) ;
90 TVector3 unit_nudir = probe->
P4()->Vect().Unit();
94 const auto & parts = rec -> parts ;
96 for (
unsigned int i = 0; i < parts.size() ; ++i ) {
98 const auto & part = parts[i] ;
103 if ( firstLep == -1 ) {
105 interaction -> KinePtr() -> SetFSLeptonP4( part.px, part.py, part.pz, part.E ) ;
113 if (
int(i) == firstLep ) {
121 TLorentzVector p4(part.px, part.py, part.pz, part.E) ;
124 p4.RotateZ( alpha ) ;
127 p4.RotateUz(unit_nudir);
129 event->AddParticle(pdg,
133 TLorentzVector(0, 0, 0, 0));
140 if ( firstLep < 0 ) {
164 LOG(
"ELI",
pINFO) <<
"Skippping non-nuclear target " << init_state;
168 const int tgt_pdgc = init_state.
TgtPdg();
173 LOG(
"ELI",
pINFO) <<
"Skipping unknown process " << proc;
177 int probe_pdgc = init_state.
ProbePdg();
182 if(probe_pdgc > 0) probe_pdgc =
kPdgNuMu;
186 const Key key(tgt_pdgc, probe_pdgc, proc.
IsWeakCC());
188 const auto rec_it =
fRecords.find(key);
191 LOG(
"ELI",
pINFO) <<
"Skippping " << key <<
" -- not found in library";
195 const EvtLibRecord* rec = rec_it->second->GetRecord(probe_E);
198 LOG(
"ELI",
pINFO) <<
"Skippping " << key <<
" at " << probe_E <<
" GeV -- not found in library";
221 for(
auto it:
fRecords)
delete it.second;
233 GetParam(
"EventLibraryPath", libPath);
245 while(TObject*
dir = next()){
246 const std::string& tgtName =
dir->GetName();
247 const TParticlePDG* tgtPart = pdglib->
DBase()->GetParticle(tgtName.c_str());
249 LOG(
"ELI",
pWARN) <<
"Unknown nucleus " << tgtName
250 <<
" found in " << libPath
259 for(
bool iscc: {
true,
false}){
262 if(!iscc && abs(pdg) !=
kPdgNuMu)
continue;
264 std::string nuName = pdglib->
Find(pdg)->GetName();
267 const std::string treeName =
271 nuName.c_str()).Data();
273 const Key key(tgtPart->PdgCode(), pdg, iscc);
275 TTree* tr = (TTree*)
fRecordFile->Get(treeName.c_str());
278 LOG(
"ELI",
pINFO) << treeName <<
" not found in "
279 << libPath <<
" -- skipping";
298 int primary_lep_id )
const {
301 const TLorentzVector & p_probe = *
event.Particle( 0 ) -> P4() ;
303 const TLorentzVector & p_lep = *
event.Particle( primary_lep_id ) -> P4() ;
305 const TLorentzVector q = p_probe - p_lep;
308 const TLorentzVector & p_tgt = *
event.Particle( 1 ) -> P4() ;
310 kine.
SetQ2(-q.Mag2(),
true);
311 kine.
SetW((q + p_tgt).Mag(),
true);
312 kine.
Setx(-q.Mag2() / (2*p_tgt.Dot(q)),
true);
313 kine.
Sety( p_tgt.Dot( q ) / p_tgt.Dot( p_probe ), true ) ;
bool IsWeakCC(void) const
std::map< Key, const IEvtLibRecordList * > fRecords
static RandomGen * Instance()
Access instance.
void SetQ2(double Q2, bool selected=false)
const TLorentzVector * P4(void) const
Kinematics * KinePtr(void) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
void Expand(std::string &s)
Expand env vars/homedirs/wildcards in s.
bool IsNucleus(void) const
TDatabasePDG * DBase(void)
void Configure(const Registry &config) override
Generated/set kinematical variables for an event.
Summary information for an interaction.
void ProcessEventRecord(GHepRecord *event) const override
bool IsWeakNC(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
bool IsAntiNeutrino(int pdgc)
virtual void Configure(const Registry &config)
TRandom3 & RndEvg(void) const
rnd number generator used by the event generation drivers
void Setx(double x, bool selected=false)
void SetW(double W, bool selected=false)
static PDGLibrary * Instance(void)
Singleton class to load & serve a TDatabasePDG.
A registry. Provides the container for algorithm configuration parameters.
void Sety(double y, bool selected=false)
const InitialState & InitState(void) const
const ProcessInfo & ProcInfo(void) const
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
TParticlePDG * Find(int pdgc, bool must_exist=true)
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
const Target & Tgt(void) const
const EvtLibRecord * GetRecord(const Interaction *interaction) const
double ProbeE(RefFrame_t rf) const
GENIE's GHEP MC event record.
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
STDHEP-like event record entry that can fit a particle or a nucleus.
void FillKinematics(const GHepRecord &, genie::Kinematics &kine, int primary_lep_id) const
Initial State information.