Classes | Public Types | Public Member Functions | Private Attributes | List of all members
evgen::MarleyGen Class Reference
Inheritance diagram for evgen::MarleyGen:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 Collection of configuration parameters for the module. More...
 
struct  KeysToIgnore
 

Public Types

using Name = fhicl::Name
 
using Comment = fhicl::Comment
 
using Parameters = art::EDProducer::Table< Config, KeysToIgnore >
 
- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 

Public Member Functions

 MarleyGen (const Parameters &p)
 
virtual void produce (art::Event &e) override
 
virtual void beginRun (art::Run &run) override
 
virtual void reconfigure (const Parameters &p)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::unique_ptr< evgen::MARLEYHelperfMarleyHelper
 
std::unique_ptr< evgen::ActiveVolumeVertexSamplerfVertexSampler
 
std::unique_ptr< marley::Event > fEvent
 
TTree * fEventTree
 
uint_fast32_t fRunNumber
 
uint_fast32_t fSubRunNumber
 
uint_fast32_t fEventNumber
 

Additional Inherited Members

- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 39 of file MARLEYGen_module.cc.

Member Typedef Documentation

Definition at line 44 of file MARLEYGen_module.cc.

Definition at line 43 of file MARLEYGen_module.cc.

Definition at line 72 of file MARLEYGen_module.cc.

Constructor & Destructor Documentation

evgen::MarleyGen::MarleyGen ( const Parameters p)
explicit

Definition at line 104 of file MARLEYGen_module.cc.

105  : EDProducer{ p.get_PSet() },
106  fEvent(new marley::Event), fRunNumber(0), fSubRunNumber(0), fEventNumber(0)
107 {
108  // Configure the module (including MARLEY itself) using the FHiCL parameters
109  this->reconfigure( p );
110 
111  // Create a ROOT TTree using the TFileService that will store the MARLEY
112  // event objects (useful for debugging purposes)
114  fEventTree = tfs->make<TTree>("MARLEY_event_tree",
115  "Neutrino events generated by MARLEY");
116  fEventTree->Branch("event", "marley::Event", fEvent.get());
117 
118  // Add branches that give the art::Event run, subrun, and event numbers for
119  // easy match-ups between the MARLEY and art TTrees. All three are recorded
120  // as 32-bit unsigned integers.
121  fEventTree->Branch("run_number", &fRunNumber, "run_number/i");
122  fEventTree->Branch("subrun_number", &fSubRunNumber, "subrun_number/i");
123  fEventTree->Branch("event_number", &fEventNumber, "event_number/i");
124 
125  produces< std::vector<simb::MCTruth> >();
126  produces< sumdata::RunData, art::InRun >();
127 }
virtual void reconfigure(const Parameters &p)
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
uint_fast32_t fRunNumber
uint_fast32_t fSubRunNumber
p
Definition: test.py:223
uint_fast32_t fEventNumber
std::unique_ptr< marley::Event > fEvent

Member Function Documentation

void evgen::MarleyGen::beginRun ( art::Run run)
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 130 of file MARLEYGen_module.cc.

131 {
133  run.put(std::make_unique<sumdata::RunData>(geo->DetectorName()));
134 }
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void evgen::MarleyGen::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 137 of file MARLEYGen_module.cc.

138 {
139  // Get the run, subrun, and event numbers from the current art::Event
140  fRunNumber = e.run();
141  fSubRunNumber = e.subRun();
142  fEventNumber = e.event();
143 
144  std::unique_ptr< std::vector<simb::MCTruth> >
145  truthcol(new std::vector<simb::MCTruth>);
146 
147  // Get the primary vertex location for this event
149  TLorentzVector vertex_pos = fVertexSampler->sample_vertex_pos(*geo);
150 
151  // Create the MCTruth object, and retrieve the marley::Event object
152  // that was generated as it was created
153  simb::MCTruth truth = fMarleyHelper->create_MCTruth(vertex_pos,
154  fEvent.get());
155 
156  // Write the marley::Event object to the event tree
157  fEventTree->Fill();
158 
159  truthcol->push_back(truth);
160 
161  e.put(std::move(truthcol));
162 }
EventNumber_t event() const
Definition: DataViewImpl.cc:85
std::unique_ptr< evgen::MARLEYHelper > fMarleyHelper
uint_fast32_t fRunNumber
def move(depos, offset)
Definition: depos.py:107
uint_fast32_t fSubRunNumber
std::unique_ptr< evgen::ActiveVolumeVertexSampler > fVertexSampler
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
RunNumber_t run() const
Definition: DataViewImpl.cc:71
uint_fast32_t fEventNumber
Event generator information.
Definition: MCTruth.h:32
LArSoft geometry interface.
Definition: ChannelGeo.h:16
std::unique_ptr< marley::Event > fEvent
void evgen::MarleyGen::reconfigure ( const Parameters p)
virtual

Definition at line 165 of file MARLEYGen_module.cc.

166 {
167  const auto& seed_service = art::ServiceHandle<rndm::NuRandomService>();
168  const auto& geom_service = art::ServiceHandle<geo::Geometry const>();
169 
170  // Create a new evgen::ActiveVolumeVertexSampler object based on the current
171  // configuration
172  fVertexSampler = std::make_unique<evgen::ActiveVolumeVertexSampler>(
173  p().vertex_, *seed_service, *geom_service, "MARLEY_Vertex_Sampler");
174 
175  // Create a new marley::Generator object based on the current configuration
176  fhicl::ParameterSet marley_pset = p.get_PSet().get< fhicl::ParameterSet >(
177  "marley_parameters" );
178  fMarleyHelper = std::make_unique<MARLEYHelper>( marley_pset,
179  *seed_service, "MARLEY" );
180 }
std::unique_ptr< evgen::MARLEYHelper > fMarleyHelper
std::unique_ptr< evgen::ActiveVolumeVertexSampler > fVertexSampler
p
Definition: test.py:223

Member Data Documentation

std::unique_ptr<marley::Event> evgen::MarleyGen::fEvent
private

Definition at line 92 of file MARLEYGen_module.cc.

uint_fast32_t evgen::MarleyGen::fEventNumber
private

Definition at line 100 of file MARLEYGen_module.cc.

TTree* evgen::MarleyGen::fEventTree
private

Definition at line 95 of file MARLEYGen_module.cc.

std::unique_ptr<evgen::MARLEYHelper> evgen::MarleyGen::fMarleyHelper
private

Definition at line 85 of file MARLEYGen_module.cc.

uint_fast32_t evgen::MarleyGen::fRunNumber
private

Definition at line 98 of file MARLEYGen_module.cc.

uint_fast32_t evgen::MarleyGen::fSubRunNumber
private

Definition at line 99 of file MARLEYGen_module.cc.

std::unique_ptr<evgen::ActiveVolumeVertexSampler> evgen::MarleyGen::fVertexSampler
private

Definition at line 89 of file MARLEYGen_module.cc.


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