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

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

art::InputTag _InputDataLabel
 
bool _IsSimulation
 
unsigned int _NumberOfCHitsThreshold
 
int _ContainmentMinX
 
int _ContainmentMaxX
 
int _ContainmentMinY
 
int _ContainmentMaxY
 
int _ContainmentMinZ
 
int _ContainmentMaxZ
 
unsigned int _TotalNumberOfEvents
 
unsigned int _TotalNumberOfShowers
 

Detailed Description

Definition at line 32 of file ShowerProducer_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

nnbar::ShowerProducer::ShowerProducer ( fhicl::ParameterSet const &  p)
explicit

Definition at line 59 of file ShowerProducer_module.cc.

References reconfigure().

59  {
60  produces< std::vector<rb::Cluster> >("showers");
61  produces< std::vector<rb::Cluster> >("cosmics");
62 
63  reconfigure(p);
64 }
void reconfigure(const fhicl::ParameterSet &p)
const char * p
Definition: xmltok.h:285

Member Function Documentation

void nnbar::ShowerProducer::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 66 of file ShowerProducer_module.cc.

References _TotalNumberOfEvents, and _TotalNumberOfShowers.

66  {
69 }
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 nnbar::ShowerProducer::endJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 122 of file ShowerProducer_module.cc.

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

122  {
123  std::cout << "_TotalNumberOfEvents: " << _TotalNumberOfEvents << std::endl;
124  std::cout << "_TotalNumberOfShowers: " << _TotalNumberOfShowers << std::endl;
125 }
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
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void nnbar::ShowerProducer::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 84 of file ShowerProducer_module.cc.

References _ContainmentMaxX, _ContainmentMaxY, _ContainmentMaxZ, _ContainmentMinX, _ContainmentMinY, _ContainmentMinZ, _InputDataLabel, _IsSimulation, _NumberOfCHitsThreshold, _TotalNumberOfEvents, _TotalNumberOfShowers, art::fill_ptr_vector(), art::DataViewImpl::getByLabel(), nnbar::NNbarUtilities::isShowerCluster(), and art::Event::put().

84  {
85  std::unique_ptr< std::vector<rb::Cluster> > showerClusters(new std::vector<rb::Cluster>);
86  std::unique_ptr< std::vector<rb::Cluster> > cosmicClusters(new std::vector<rb::Cluster>);
87 
89  std::vector<art::Ptr<rb::Cluster> > clusters;
90  if (e.getByLabel(_InputDataLabel, clusterHandle)) art::fill_ptr_vector(clusters, clusterHandle);
92 
93  for (std::vector<art::Ptr<rb::Cluster> >::const_iterator clusterItr = clusters.begin(); clusterItr != clusters.end(); ++clusterItr) {
94  auto cluster = *clusterItr;
95  if (_IsSimulation) {
96  if (cluster->IsNoise()) continue;
97  if (cluster->AllCells().size() > _NumberOfCHitsThreshold) continue;
98  showerClusters->push_back(*cluster);
100  } else {
101  if (cluster->IsNoise()) continue;
102  if (cluster->AllCells().size() > _NumberOfCHitsThreshold) continue;
103 
104  // Actually no containment cuts (see values of the containment cuts above)
105  bool isShower = NNbarUtilities::isShowerCluster(*cluster,
109  if (isShower) {
110  showerClusters->push_back(*cluster);
112  } else {
113  cosmicClusters->push_back(*cluster);
114  }
115  }
116  }
117 
118  e.put(std::move(showerClusters), "showers");
119  e.put(std::move(cosmicClusters), "cosmics");
120 }
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
static bool isShowerCluster(rb::Cluster cluster, int containXmin, int containXmax, int containYmin, int containYmax, int containZmin, int containZmax)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
void nnbar::ShowerProducer::reconfigure ( const fhicl::ParameterSet p)

Definition at line 71 of file ShowerProducer_module.cc.

References _ContainmentMaxX, _ContainmentMaxY, _ContainmentMaxZ, _ContainmentMinX, _ContainmentMinY, _ContainmentMinZ, _InputDataLabel, _IsSimulation, _NumberOfCHitsThreshold, and fhicl::ParameterSet::get().

Referenced by ShowerProducer().

71  {
72  _InputDataLabel = p.get<art::InputTag> ("InputDataLabel");
73  _IsSimulation = p.get<bool> ("IsSimulation");
74  _NumberOfCHitsThreshold = p.get<unsigned int> ("NumberOfCHitsThreshold");
75 
76  _ContainmentMinX = p.get<double> ("ContainmentMinX");
77  _ContainmentMaxX = p.get<double> ("ContainmentMaxX");
78  _ContainmentMinY = p.get<double> ("ContainmentMinY");
79  _ContainmentMaxY = p.get<double> ("ContainmentMaxY");
80  _ContainmentMinZ = p.get<double> ("ContainmentMinZ");
81  _ContainmentMaxZ = p.get<double> ("ContainmentMaxZ");
82 }
T get(std::string const &key) const
Definition: ParameterSet.h:231
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

int nnbar::ShowerProducer::_ContainmentMaxX
private

Definition at line 49 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

int nnbar::ShowerProducer::_ContainmentMaxY
private

Definition at line 51 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

int nnbar::ShowerProducer::_ContainmentMaxZ
private

Definition at line 53 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

int nnbar::ShowerProducer::_ContainmentMinX
private

Definition at line 48 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

int nnbar::ShowerProducer::_ContainmentMinY
private

Definition at line 50 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

int nnbar::ShowerProducer::_ContainmentMinZ
private

Definition at line 52 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

art::InputTag nnbar::ShowerProducer::_InputDataLabel
private

Definition at line 42 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

bool nnbar::ShowerProducer::_IsSimulation
private

Definition at line 44 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

unsigned int nnbar::ShowerProducer::_NumberOfCHitsThreshold
private

Definition at line 46 of file ShowerProducer_module.cc.

Referenced by produce(), and reconfigure().

unsigned int nnbar::ShowerProducer::_TotalNumberOfEvents
private

Definition at line 55 of file ShowerProducer_module.cc.

Referenced by beginJob(), endJob(), and produce().

unsigned int nnbar::ShowerProducer::_TotalNumberOfShowers
private

Definition at line 56 of file ShowerProducer_module.cc.

Referenced by beginJob(), endJob(), and produce().


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