Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lem::MakeMatches Class Reference

Calculate final PID variables from match details. More...

Inheritance diagram for lem::MakeMatches:
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

 MakeMatches (const fhicl::ParameterSet &pset)
 
 ~MakeMatches ()
 
virtual void beginJob ()
 
virtual void beginRun (art::Run &run)
 
virtual void produce (art::Event &evt)
 
virtual void reconfigure (const fhicl::ParameterSet &pset)
 
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
 

Protected Attributes

bool fTrimMatchLists
 
std::string fMatchesLabel
 
std::string fSummarizeLabel
 

Detailed Description

Calculate final PID variables from match details.

Definition at line 36 of file MakeMatches_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

lem::MakeMatches::MakeMatches ( const fhicl::ParameterSet pset)
explicit

Definition at line 54 of file MakeMatches_module.cc.

References reconfigure().

55  {
56  reconfigure(pset);
57 
58  produces<std::vector<lem::PIDInput>>();
59  produces<art::Assns<lem::PIDInput, rb::Cluster>>();
60  }
virtual void reconfigure(const fhicl::ParameterSet &pset)
lem::MakeMatches::~MakeMatches ( )

Definition at line 63 of file MakeMatches_module.cc.

64  {
65  }

Member Function Documentation

void lem::MakeMatches::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 76 of file MakeMatches_module.cc.

77  {
78  }
void lem::MakeMatches::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 81 of file MakeMatches_module.cc.

References ana::assert(), art::Handle< T >::failedToGet(), fMatchesLabel, and art::DataViewImpl::getByLabel().

82  {
84  run.getByLabel(fMatchesLabel, libsum);
85 
86  assert(!libsum.failedToGet());
87  }
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
assert(nhit_max >=nhit_nbins)
bool failedToGet() const
Definition: Handle.h:196
std::string fMatchesLabel
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 lem::MakeMatches::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 90 of file MakeMatches_module.cc.

References ana::assert(), util::CreateAssn(), DEFINE_ART_MODULE(), lem::PIDInput::enrichedMatches, fMatchesLabel, PandAna.Demos.pi0_spectra::fmt, fSummarizeLabel, art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, dumpEventsToText::inputs, lem::MatchList::matches, lem::PIDInput::matches, overlay_prestage_def::matches, lem::PIDInput::matchList, and art::Event::put().

91  {
92  std::unique_ptr<std::vector<lem::PIDInput> > pidinputcol(new std::vector<lem::PIDInput>);
93  std::unique_ptr<art::Assns<lem::PIDInput, rb::Cluster>> assns(new art::Assns<lem::PIDInput, rb::Cluster>);
94 
96  evt.getByLabel(fMatchesLabel, matchlists);
97 
99  evt.getByLabel(fSummarizeLabel, inputs);
100 
101  assert(inputs->size() == matchlists->size());
102 
104 
105  const unsigned int matchMax = matchlists->size();
106  for(unsigned int matchIdx = 0; matchIdx < matchMax; ++matchIdx){
107  MatchList matchlist = (*matchlists)[matchIdx];
108 
109  // Get all the slices associated with this match list
110  std::vector<art::Ptr<rb::Cluster> > slices = fmt.at(matchIdx);
111  // Associated slices can be empty when we're running over lemsum files,
112  // where the slices have been stripped out. In that case, don't make
113  // associations, LEMAssociator will sort it out later.
114  assert(slices.empty() || slices.size() == 1);
115 
116  std::vector<MatchSummary> matches, enrichedMatches;
117  for(unsigned int i = 0; i < matchlist.matches.size(); ++i){
118  if(matchlist.matches[i].enrich){
119  enrichedMatches.push_back(matchlist.matches[i]);
120  }
121  else{
122  matches.push_back(matchlist.matches[i]);
123  }
124  }
125 
126  if(matches.empty()){
127  lem::PIDInput pidinput;
128  pidinputcol ->push_back(pidinput);
129  if(!slices.empty())
130  util::CreateAssn(*this, evt, *pidinputcol, slices[0], *assns);
131  continue;
132  }
133 
134  lem::PIDInput pidinput;
135  pidinput.matchList = matchlist;
136  pidinput.matches = matches;
137  pidinput.enrichedMatches = enrichedMatches;
138 
139  pidinputcol->push_back(pidinput);
140 
141  if(!slices.empty()){
142  util::CreateAssn(*this, evt, *pidinputcol, slices[0], *assns);
143  }
144  } // end for matchIdx
145 
146  evt.put(std::move(pidinputcol));
147  evt.put(std::move(assns));
148  }
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
lem::MatchList matchList
Definition: PIDInput.h:26
std::vector< lem::MatchSummary > enrichedMatches
Definition: PIDInput.h:28
Attach MatchList and other useful stuff.
Definition: PIDInput.h:20
std::string fSummarizeLabel
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
std::vector< lem::MatchSummary > matches
Definition: PIDInput.h:27
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
assert(nhit_max >=nhit_nbins)
std::string fMatchesLabel
void lem::MakeMatches::reconfigure ( const fhicl::ParameterSet pset)
virtual

Definition at line 68 of file MakeMatches_module.cc.

References fMatchesLabel, fSummarizeLabel, fTrimMatchLists, fhicl::ParameterSet::get(), and string.

Referenced by MakeMatches().

69  {
70  fTrimMatchLists = pset.get<bool>("TrimMatchLists");
71  fMatchesLabel = pset.get<std::string>("MatchesLabel");
72  fSummarizeLabel = pset.get<std::string>("SummarizeLabel");
73  }
std::string fSummarizeLabel
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::string fMatchesLabel
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

std::string lem::MakeMatches::fMatchesLabel
protected

Definition at line 49 of file MakeMatches_module.cc.

Referenced by beginRun(), produce(), and reconfigure().

std::string lem::MakeMatches::fSummarizeLabel
protected

Definition at line 50 of file MakeMatches_module.cc.

Referenced by produce(), and reconfigure().

bool lem::MakeMatches::fTrimMatchLists
protected

Definition at line 48 of file MakeMatches_module.cc.

Referenced by reconfigure().


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