Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
demo::DemoModule Class Reference
Inheritance diagram for demo::DemoModule:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 DemoModule (fhicl::ParameterSet const &pset)
 
 ~DemoModule ()
 
void produce (art::Event &evt)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void beginJob ()
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

int fInt
 < Sample configurable module parameters More...
 
std::vector< intfVecInt
 
float fFloat
 
double fDouble
 
std::string fInputModuleLabel
 
TH1F * fHisto
 

label for module that made the data products you need for this module

More...
 

Detailed Description

Definition at line 32 of file DemoModule_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

demo::DemoModule::DemoModule ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 64 of file DemoModule_module.cc.

References reconfigure().

65  {
66  //======================================================================
67  // This is the constructor "nova" will use to create your module.
68  //
69  // Modules use configurations which have the same name as the
70  // module. The variable "version" sets which version of this
71  // configuration to use. Users are required to supply a configuration
72  // called "default" but other versions ("test" eg.) are allowed.
73  //
74  // Which version to use is set at run time by the job description XML
75  // file.
76  //======================================================================
77 
78  this->reconfigure(pset);
79 
80  // tell the module what it is making as this is a EDProducer
81  produces< std::vector<int> >();
82 
83  // Be noisy to demonstrate what's happening
84  mf::LogInfo("DemoModule") << " DemoModule::DemoModule()\n";
85  }
void reconfigure(const fhicl::ParameterSet &pset)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
demo::DemoModule::~DemoModule ( )

Definition at line 88 of file DemoModule_module.cc.

89  {
90  //======================================================================
91  // Clean up any memory allocated by your module
92  //======================================================================
93  }

Member Function Documentation

void demo::DemoModule::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 107 of file DemoModule_module.cc.

References fHisto, and art::TFileDirectory::make().

108  {
109  //
110  // Book histograms, ntuples, initialize counts etc., etc., ...
111  //
113 
114  fHisto = tfs->make<TH1F>("fHisto",
115  "Histo Title;x-axis title (units);y-axis title (units)",
116  100,0.,100.);
117 
118  }
T * make(ARGS...args) const
TH1F * fHisto
label for module that made the data products you need for this module
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDProducer::currentContext ( ) const
protectedinherited
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void demo::DemoModule::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 121 of file DemoModule_module.cc.

References DEFINE_ART_MODULE(), fHisto, fInputModuleLabel, art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, art::PtrVector< T >::push_back(), art::Event::put(), and art::PtrVector< T >::size().

122  {
123  //======================================================================
124  // Called for every event. "Reco" implies that you are adding
125  // information to the event
126  //======================================================================
127  mf::LogInfo("DemoModule") << "DemoModule::Reco()"
128  << "\n"
129  << "New Reco Event ";
130 
131  // get rb::CellHit from the event
133  evt.getByLabel(fInputModuleLabel, digitcol);
135  for(unsigned int i = 0; i < digitcol->size(); ++i){
136  art::Ptr<rb::CellHit> dig(digitcol, i);
137  digits.push_back(dig);
138  }
139 
140  // make the collection of ints we want to store
141  std::unique_ptr< std::vector<int> > adccol(new std::vector<int>);
142 
143  // fill a histogram with the size of each MCTruth
144  for(unsigned int i = 0; i < digits.size(); ++i){
145  adccol->push_back( digits[i]->ADC() );
146  fHisto->Fill( digits[i]->ADC() );
147  }
148 
149  // put the collection of adc values into the event
150  evt.put(std::move(adccol));
151 
152  // maybe I really wanted to still keep that collection around for later
153  // use in a const fashion. Then I could have done
154  // art::OrphanHandle< std::vector<int> > adcoh = evt.put(adccol);
155 
156  return;
157  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
size_type size() const
Definition: PtrVector.h:308
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
TH1F * fHisto
label for module that made the data products you need for this module
std::string fInputModuleLabel
void demo::DemoModule::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 96 of file DemoModule_module.cc.

References fDouble, fFloat, fInputModuleLabel, fInt, fVecInt, fhicl::ParameterSet::get(), and string.

Referenced by DemoModule().

97  {
98  // Keep everything lined up for clarity (stylistic)
99  fInt = pset.get< int >("MyInt");
100  fVecInt = pset.get< std::vector<int> >("MyVectorInt");
101  fFloat = pset.get< float >("MyFloat");
102  fDouble = pset.get< double >("MyDouble");
103  fInputModuleLabel = pset.get< std::string >("MyInputModuleLabel");
104  }
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::vector< int > fVecInt
std::string fInputModuleLabel
int fInt
< Sample configurable module parameters
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

double demo::DemoModule::fDouble
private

Definition at line 51 of file DemoModule_module.cc.

Referenced by reconfigure().

float demo::DemoModule::fFloat
private

Definition at line 50 of file DemoModule_module.cc.

Referenced by reconfigure().

TH1F* demo::DemoModule::fHisto
private

label for module that made the data products you need for this module

Definition at line 53 of file DemoModule_module.cc.

Referenced by beginJob(), and produce().

std::string demo::DemoModule::fInputModuleLabel
private

Definition at line 52 of file DemoModule_module.cc.

Referenced by produce(), and reconfigure().

int demo::DemoModule::fInt
private

< Sample configurable module parameters

Definition at line 48 of file DemoModule_module.cc.

Referenced by reconfigure().

std::vector<int> demo::DemoModule::fVecInt
private

Definition at line 49 of file DemoModule_module.cc.

Referenced by reconfigure().


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