Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
tut::yn2020::FancyScience Class Reference
Inheritance diagram for tut::yn2020::FancyScience:
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

 FancyScience (fhicl::ParameterSet const &p)
 
 FancyScience (FancyScience const &)=delete
 
 FancyScience (FancyScience &&)=delete
 
FancyScienceoperator= (FancyScience const &)=delete
 
FancyScienceoperator= (FancyScience &&)=delete
 
void produce (art::Event &e) override
 
void beginJob () override
 
void endJob () override
 
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

unsigned int fRun
 Run number. More...
 
unsigned int fSubRun
 Subrun number. More...
 
unsigned int fEvent
 Event number. More...
 
unsigned int fRawADC
 Raw ADC value to be written into TTree. More...
 
std::string fRawDataLabel
 ART module label for Raw Data. More...
 
art::ServiceHandle< art::TFileServicetfs
 
TTree * fRawDigitTree
 

Detailed Description

Definition at line 33 of file FancyScience_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

tut::yn2020::FancyScience::FancyScience ( fhicl::ParameterSet const &  p)
explicit

Definition at line 64 of file FancyScience_module.cc.

65  :
66  fRun(0),
67  fSubRun(0),
68  fEvent(0),
69  fRawADC(0),
70  fRawDataLabel(p.get<std::string>("RawDataLabel"))
71 {
72  produces<std::vector<int>>();
73 }
std::string fRawDataLabel
ART module label for Raw Data.
const char * p
Definition: xmltok.h:285
unsigned int fRun
Run number.
unsigned int fSubRun
Subrun number.
unsigned int fEvent
Event number.
unsigned int fRawADC
Raw ADC value to be written into TTree.
enum BeamMode string
tut::yn2020::FancyScience::FancyScience ( FancyScience const &  )
delete
tut::yn2020::FancyScience::FancyScience ( FancyScience &&  )
delete

Member Function Documentation

void tut::yn2020::FancyScience::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 108 of file FancyScience_module.cc.

References om::cout, allTimeWatchdog::endl, fEvent, fRawADC, fRawDigitTree, fRun, fSubRun, art::TFileDirectory::make(), and tfs.

109 {
110  std::cout << "This is the beginJob() function. Declaring TTree..." << std::endl;
111 
112  fRawDigitTree = tfs->make<TTree>("RawDigits", "Raw Digits");
113 
114  fRawDigitTree->Branch("Run", &fRun);
115  fRawDigitTree->Branch("SubRun", &fSubRun);
116  fRawDigitTree->Branch("Event", &fEvent);
117  fRawDigitTree->Branch("ADC", &fRawADC);
118 
119  return;
120 }
unsigned int fRun
Run number.
unsigned int fSubRun
Subrun number.
unsigned int fEvent
Event number.
OStream cout
Definition: OStream.cxx:6
T * make(ARGS...args) const
art::ServiceHandle< art::TFileService > tfs
unsigned int fRawADC
Raw ADC value to be written into TTree.
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
void tut::yn2020::FancyScience::endJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 122 of file FancyScience_module.cc.

References om::cout, DEFINE_ART_MODULE(), and allTimeWatchdog::endl.

123 {
124  // Implementation of optional member function here.
125  std::cout << "This is the endJob() function." << std::endl;
126 
127  return;
128 }
OStream cout
Definition: OStream.cxx:6
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
FancyScience& tut::yn2020::FancyScience::operator= ( FancyScience const &  )
delete
FancyScience& tut::yn2020::FancyScience::operator= ( FancyScience &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void tut::yn2020::FancyScience::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 75 of file FancyScience_module.cc.

References om::cout, allTimeWatchdog::endl, art::Event::event(), fEvent, fRawADC, fRawDataLabel, fRawDigitTree, fRun, fSubRun, art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, art::Event::put(), art::Event::run(), and art::Event::subRun().

76 {
77  // ART gives us access to some basic information from the event, like
78  // the run, subrun, and event numbers. Let's grab those:
79  fRun = e.run();
80  fSubRun = e.subRun();
81  fEvent = e.event();
82 
83  // Get the RawDigits from the event
85  e.getByLabel(fRawDataLabel, rawHits);
86 
87  // How many are there in this event?
88  std::cout << rawHits->size() << " RawDigits in event " << fEvent << "." << std::endl;
89 
90  // Now I have a rawdata::RawDigit vector and I can do whatever I want with it.
91  // let's loop over them all and get the ADC.
92  for (rawdata::RawDigit aDigit : *rawHits) {
93  fRawADC = aDigit.ADC();
94  fRawDigitTree->Fill();
95  }
96 
97  // Declare a unique pointer and fill our vector
98  std::unique_ptr<std::vector<int>> intProduct(new std::vector<int>);
99  for (size_t i=0; i<42; ++i) { intProduct->push_back(42); }
100 
101  // Put it into the event
102  e.put(std::move(intProduct));
103 
104 
105  return;
106 }
SubRunNumber_t subRun() const
Definition: Event.h:72
std::string fRawDataLabel
ART module label for Raw Data.
unsigned int fRun
Run number.
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
unsigned int fSubRun
Subrun number.
unsigned int fEvent
Event number.
EventNumber_t event() const
Definition: Event.h:67
OStream cout
Definition: OStream.cxx:6
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
unsigned int fRawADC
Raw ADC value to be written into TTree.
RunNumber_t run() const
Definition: Event.h:77
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

unsigned int tut::yn2020::FancyScience::fEvent
private

Event number.

Definition at line 52 of file FancyScience_module.cc.

Referenced by beginJob(), and produce().

unsigned int tut::yn2020::FancyScience::fRawADC
private

Raw ADC value to be written into TTree.

Definition at line 54 of file FancyScience_module.cc.

Referenced by beginJob(), and produce().

std::string tut::yn2020::FancyScience::fRawDataLabel
private

ART module label for Raw Data.

Definition at line 56 of file FancyScience_module.cc.

Referenced by produce().

TTree* tut::yn2020::FancyScience::fRawDigitTree
private

Definition at line 60 of file FancyScience_module.cc.

Referenced by beginJob(), and produce().

unsigned int tut::yn2020::FancyScience::fRun
private

Run number.

Definition at line 50 of file FancyScience_module.cc.

Referenced by beginJob(), and produce().

unsigned int tut::yn2020::FancyScience::fSubRun
private

Subrun number.

Definition at line 51 of file FancyScience_module.cc.

Referenced by beginJob(), and produce().

art::ServiceHandle<art::TFileService> tut::yn2020::FancyScience::tfs
private

Definition at line 59 of file FancyScience_module.cc.

Referenced by beginJob().


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