GENIEGenerator
Loading...
Searching...
No Matches
ToyInteractionSelector.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
11#include <TLorentzVector.h>
12
22
23using namespace genie;
24
25//___________________________________________________________________________
27InteractionSelectorI("genie::ToyInteractionSelector")
28{
29
30}
31//___________________________________________________________________________
33InteractionSelectorI("genie::ToyInteractionSelector", config)
34{
35
36}
37//___________________________________________________________________________
42//___________________________________________________________________________
44 (const InteractionGeneratorMap * igmap, const TLorentzVector & p4) const
45{
46 if(!igmap) {
47 LOG("IntSel", pERROR)
48 << "\n*** NULL InteractionGeneratorMap! Can't select interaction";
49 return 0;
50 }
51 if(igmap->size() <= 0) {
52 LOG("IntSel", pERROR)
53 << "\n*** Empty InteractionGeneratorMap! Can't select interaction";
54 return 0;
55 }
56
57 // select a random event generator
59
60 const InteractionList & ilst = igmap->GetInteractionList();
61
62 unsigned int nint = ilst.size();
63 unsigned int iint = (unsigned int) rnd->RndISel().Integer(nint);
64
65 Interaction * interaction = ilst[iint];
66
67 // clone interaction
68 Interaction * selected_interaction = new Interaction( *interaction );
69 selected_interaction->InitStatePtr()->SetProbeP4(p4);
70 LOG("IntSel", pINFO)
71 << "Interaction to generate: \n" << *selected_interaction;
72
73 // bootstrap the event record
74 EventRecord * evrec = new EventRecord;
75 evrec->AttachSummary(selected_interaction);
76
77 return evrec;
78}
79//___________________________________________________________________________
#define pINFO
Definition Messenger.h:62
#define pERROR
Definition Messenger.h:59
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition EventRecord.h:37
virtual void AttachSummary(Interaction *interaction)
void SetProbeP4(const TLorentzVector &P4)
An Interaction -> EventGeneratorI associative container. The container is being built for the loaded ...
const InteractionList & GetInteractionList(void) const
A vector of Interaction objects.
Summary information for an interaction.
Definition Interaction.h:56
InitialState * InitStatePtr(void) const
Definition Interaction.h:74
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition RandomGen.h:29
static RandomGen * Instance()
Access instance.
Definition RandomGen.cxx:74
TRandom3 & RndISel(void) const
rnd number generator used by interaction selectors
Definition RandomGen.h:65
EventRecord * SelectInteraction(const InteractionGeneratorMap *igmp, const TLorentzVector &p4) const
implement the InteractionSelectorI interface
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25