Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
cmf::CombineResults Class Reference
Inheritance diagram for cmf::CombineResults:
art::ResultsProducer art::ProductRegistryHelper art::Consumer

Public Types

template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::PluginConfig, KeysToIgnore >
 

Public Member Functions

 CombineResults (fhicl::ParameterSet const &pset)
 
virtual ~CombineResults ()
 
void readResults (art::Results const &r) override
 
void writeResults (art::Results &r) override
 
void clear () override
 
void doBeginJob ()
 
void doEndJob ()
 
void doBeginSubRun (SubRunPrincipal const &)
 
void doEndSubRun (SubRunPrincipal const &)
 
void doBeginRun (RunPrincipal const &)
 
void doEndRun (RunPrincipal const &)
 
void doEvent (EventPrincipal const &)
 
void doReadResults (ResultsPrincipal const &)
 
void doWriteResults (ResultsPrincipal &)
 
void doClear ()
 
void registerProducts (MasterProductRegistry &mpr, ProductDescriptions &producedProducts, ModuleDescription const &md)
 
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)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

template<class P >
void produces (std::string const &instanceName={})
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void setModuleDescription (ModuleDescription const &md)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

void ReadFakeUniverses (art::Results const &r)
 
void ReadPointResults (art::Results const &r)
 
void ReadOscParamPoints (art::Results const &r)
 
template<class T >
void WriteResultsVec (art::Results &r, std::vector< T > &resultsVec)
 

Private Attributes

std::string fInputDataProductLabel
 Name of the label for the input and result points. More...
 
std::string fDataProductType
 type of data product to combine More...
 
cmf::OscParm_t fXParamEnum
 
cmf::OscParm_t fYParamEnum
 
std::vector< cmf::FCUniverseCollectionfFakeUniverses
 
std::vector< cmf::FCResultCollectionfPointResultVec
 
std::vector< cmf::OscParamPointfOscParamPointVec
 

Detailed Description

Definition at line 25 of file CMFCombineResults_plugin.cc.

Member Typedef Documentation

template<typename UserConfig , typename KeysToIgnore = void>
using art::ResultsProducer::Table = ProducerTable<UserConfig, detail::PluginConfig, KeysToIgnore>
inherited

Definition at line 114 of file ResultsProducer.h.

Constructor & Destructor Documentation

cmf::CombineResults::CombineResults ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 58 of file CMFCombineResults_plugin.cc.

References fDataProductType, fXParamEnum, fYParamEnum, fhicl::ParameterSet::get(), string, and cmf::StringToOscParmType().

59  : fInputDataProductLabel(pset.get<std::string> ("InputDataProductLabel"))
60  , fDataProductType (pset.get<std::string> ("DataProductType" ))
63  {
64  if(fDataProductType == "FakeUniverse"){
65  produces< std::vector<cmf::FCUniverseCollection> >();
66  fXParamEnum = cmf::StringToOscParmType(pset.get<std::string>("XParameter", "Th23" ));
67  fYParamEnum = cmf::StringToOscParmType(pset.get<std::string>("YParameter", "Dmsq32"));
68  }
69  else if(fDataProductType == "PointResult"){
70  produces< std::vector<cmf::FCResultCollection> >();
71  fXParamEnum = cmf::StringToOscParmType(pset.get<std::string>("XParameter", "Th23" ));
72  fYParamEnum = cmf::StringToOscParmType(pset.get<std::string>("YParameter", "Dmsq32"));
73  }
74  else if(fDataProductType == "OscParamPoint") produces< std::vector<cmf::OscParamPoint> >();
75  }
std::string fInputDataProductLabel
Name of the label for the input and result points.
std::string fDataProductType
type of data product to combine
static cmf::OscParm_t StringToOscParmType(std::string const &str)
enum BeamMode string
cmf::CombineResults::~CombineResults ( )
virtual

Definition at line 78 of file CMFCombineResults_plugin.cc.

79  {
80  }

Member Function Documentation

void cmf::CombineResults::clear ( )
overridevirtual

Implements art::ResultsProducer.

Definition at line 85 of file CMFCombineResults_plugin.cc.

86  {
87  }
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
void art::ResultsProducer::doBeginJob ( )
inlineinherited

Definition at line 165 of file ResultsProducer.h.

References ana::assert(), breakpoints::beginJob(), fhicl::ParameterSetRegistry::get(), and art::Consumer::setModuleDescription().

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

166 {
168  // Preparing the consumer for the job must be done after the
169  // constructer has been called.
170  auto const& mainID = moduleDescription_->mainParameterSetID();
171  auto const& scheduler_pset =
173  "services.scheduler");
175  prepareForJob(scheduler_pset);
176  beginJob();
177 }
static collection_type const & get() noexcept
void setModuleDescription(ModuleDescription const &md)
void prepareForJob(fhicl::ParameterSet const &pset)
assert(nhit_max >=nhit_nbins)
virtual void beginJob()
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doBeginRun ( RunPrincipal const &  rp)
inlineinherited

Definition at line 201 of file ResultsProducer.h.

References r().

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

202 {
203  Run const r{rp, *moduleDescription_, this};
204  beginRun(r);
205 }
virtual void beginRun(Run const &)
TRandom3 r(0)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doBeginSubRun ( SubRunPrincipal const &  srp)
inlineinherited

Definition at line 187 of file ResultsProducer.h.

References sr.

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

188 {
189  SubRun const sr{srp, *moduleDescription_, this};
190  beginSubRun(sr);
191 }
virtual void beginSubRun(SubRun const &)
caf::StandardRecord * sr
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doClear ( )
inlineinherited

Definition at line 229 of file ResultsProducer.h.

References clear.

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

230 {
231  clear();
232 }
virtual void clear()=0
void art::ResultsProducer::doEndJob ( )
inlineinherited

Definition at line 180 of file ResultsProducer.h.

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

181 {
182  endJob();
184 }
virtual void endJob()
void showMissingConsumes() const
void art::ResultsProducer::doEndRun ( RunPrincipal const &  rp)
inlineinherited

Definition at line 208 of file ResultsProducer.h.

References r().

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

209 {
210  Run const r{rp, *moduleDescription_, this};
211  endRun(r);
212 }
virtual void endRun(Run const &)
TRandom3 r(0)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doEndSubRun ( SubRunPrincipal const &  srp)
inlineinherited

Definition at line 194 of file ResultsProducer.h.

References sr.

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

195 {
196  SubRun const sr{srp, *moduleDescription_, this};
197  endSubRun(sr);
198 }
caf::StandardRecord * sr
virtual void endSubRun(SubRun const &)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doEvent ( EventPrincipal const &  ep)
inlineinherited

Definition at line 215 of file ResultsProducer.h.

References e, and lem_server::ep.

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

216 {
217  Event const e{ep, *moduleDescription_, this};
218  event(e);
219 }
Float_t e
Definition: plot.C:35
virtual void event(Event const &)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doReadResults ( ResultsPrincipal const &  resp)
inlineinherited

Definition at line 222 of file ResultsProducer.h.

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

223 {
224  Results const res{resp, *moduleDescription_, this};
225  readResults(res);
226 }
virtual void readResults(Results const &)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doWriteResults ( ResultsPrincipal )
inherited
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
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
template<class P >
void art::ResultsProducer::produces ( std::string const &  instanceName = {})
inlineprotectedinherited

Definition at line 159 of file ResultsProducer.h.

160 {
161  ProductRegistryHelper::produces<P, InResults>(instanceName);
162 }
void cmf::CombineResults::ReadFakeUniverses ( art::Results const &  r)
private

Definition at line 103 of file CMFCombineResults_plugin.cc.

References fFakeUniverses, fInputDataProductLabel, fXParamEnum, fYParamEnum, MECModelEnuComparisons::gp, LOG_VERBATIM, and cmf::readVectorResults().

Referenced by readResults().

104  {
105  std::vector<cmf::FakeUniverse> fakeUVec;
106 
107  if(cmf::readVectorResults(r, fInputDataProductLabel, fakeUVec, false)){
108  LOG_VERBATIM("LibraryContourMaker")
109  << "Valid handle to std::vector<cmf::FakeUniverse> objects found in "
111  << " vector size "
112  << fakeUVec.size();
113  }
114 
115  // loop over the entries in the vector and add them to the map
116  for(auto const& itr : fakeUVec){
117  cmf::GridPoint gp(itr.OscParMap().find(fXParamEnum)->second,
118  itr.OscParMap().find(fYParamEnum)->second,
119  fXParamEnum,
120  fYParamEnum);
121 
122  auto fcCollItr = std::find(fFakeUniverses.begin(), fFakeUniverses.end(), gp);
123  if(fcCollItr == fFakeUniverses.end()){
124  fFakeUniverses.emplace_back(gp);
125  fFakeUniverses.back().AppendFakeUniverse(itr);
126  }
127  else
128  fcCollItr->AppendFakeUniverse(itr);
129  }
130  }
std::string fInputDataProductLabel
Name of the label for the input and result points.
static bool readVectorResults(art::Results const &r, std::string const &module, std::string const &instance, std::vector< T > &resvec, bool clearResVec=true)
std::vector< cmf::FCUniverseCollection > fFakeUniverses
TRandom3 r(0)
#define LOG_VERBATIM(category)
void cmf::CombineResults::ReadOscParamPoints ( art::Results const &  r)
private

Definition at line 90 of file CMFCombineResults_plugin.cc.

References fInputDataProductLabel, fOscParamPointVec, LOG_VERBATIM, and cmf::readVectorResults().

Referenced by readResults().

91  {
93  LOG_VERBATIM("LibraryContourMaker")
94  << "Valid handle to std::vector<cmf::OscParamPoint> "
95  << "objects found in "
97  << " vector size "
98  << fOscParamPointVec.size();
99  }
100  }
std::string fInputDataProductLabel
Name of the label for the input and result points.
static bool readVectorResults(art::Results const &r, std::string const &module, std::string const &instance, std::vector< T > &resvec, bool clearResVec=true)
std::vector< cmf::OscParamPoint > fOscParamPointVec
TRandom3 r(0)
#define LOG_VERBATIM(category)
void cmf::CombineResults::ReadPointResults ( art::Results const &  r)
private

Definition at line 133 of file CMFCombineResults_plugin.cc.

References fInputDataProductLabel, fPointResultVec, MECModelEnuComparisons::i, LOG_VERBATIM, and cmf::readVectorResults().

Referenced by readResults().

134  {
135  std::vector<cmf::FCResultCollection> resVec;
136 
137  if(cmf::readVectorResults(r, fInputDataProductLabel, resVec, false)){
138  LOG_VERBATIM("LibraryContourMaker")
139  << "Valid handle to std::vector<cmf::PointResult> objects found in "
141  << " vector size "
142  << resVec.size();
143  }
144 
145  // loop over the entries in the vector and add them to the map
146  auto fcCollItr = fPointResultVec.begin();
147  for(auto const& itr : resVec){
148  fcCollItr = std::find(fPointResultVec.begin(), fPointResultVec.end(), itr);
149  if(fcCollItr == fPointResultVec.end()){
150  fPointResultVec.emplace_back(itr);
151  for(size_t i = 0; i < itr.PointResultVec().size(); ++i)
152  fPointResultVec.back().AppendPointResultAndSpectrum(itr.PointResultVec()[i],
153  itr.SpectrumVec()[i]);
154  }
155  else{
156  for(size_t i = 0; i < itr.PointResultVec().size(); ++i)
157  fcCollItr->AppendPointResultAndSpectrum(itr.PointResultVec()[i],
158  itr.SpectrumVec()[i]);
159  }
160  }
161  }
std::vector< cmf::FCResultCollection > fPointResultVec
std::string fInputDataProductLabel
Name of the label for the input and result points.
static bool readVectorResults(art::Results const &r, std::string const &module, std::string const &instance, std::vector< T > &resvec, bool clearResVec=true)
TRandom3 r(0)
#define LOG_VERBATIM(category)
void cmf::CombineResults::readResults ( art::Results const &  r)
overridevirtual

Reimplemented from art::ResultsProducer.

Definition at line 164 of file CMFCombineResults_plugin.cc.

References fDataProductType, ReadFakeUniverses(), ReadOscParamPoints(), and ReadPointResults().

165  {
166  if (fDataProductType == "FakeUniverse" ) this->ReadFakeUniverses(r);
167  else if(fDataProductType == "PointResult" ) this->ReadPointResults(r);
168  else if(fDataProductType == "OscParamPoint") this->ReadOscParamPoints(r);
169  }
void ReadPointResults(art::Results const &r)
void ReadOscParamPoints(art::Results const &r)
void ReadFakeUniverses(art::Results const &r)
std::string fDataProductType
type of data product to combine
TRandom3 r(0)
void art::ResultsProducer::registerProducts ( MasterProductRegistry mpr,
ProductDescriptions producedProducts,
ModuleDescription const &  md 
)
inlineinherited

Definition at line 128 of file ResultsProducer.h.

References fetch_tb_beamline_files::md, and art::ProductRegistryHelper::registerProducts().

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

131  {
132  ProductRegistryHelper::registerProducts(mpr, producedProducts, md);
134  }
void registerProducts(MasterProductRegistry &mpr, ProductDescriptions &productsToRegister, ModuleDescription const &md)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::Consumer::setModuleDescription ( ModuleDescription const &  md)
protectedinherited
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
void cmf::CombineResults::writeResults ( art::Results r)
overridevirtual

Implements art::ResultsProducer.

Definition at line 180 of file CMFCombineResults_plugin.cc.

References DEFINE_ART_RESULTS_PLUGIN, fDataProductType, fFakeUniverses, fOscParamPointVec, fPointResultVec, LOG_DEBUG, and WriteResultsVec().

181  {
182  LOG_DEBUG("CombineResults")
183  << "Start writeResults";
184 
185  if (fDataProductType == "FakeUniverse" ) this->WriteResultsVec(r, fFakeUniverses );
186  else if(fDataProductType == "PointResult" ) this->WriteResultsVec(r, fPointResultVec );
187  else if(fDataProductType == "OscParamPoint") this->WriteResultsVec(r, fOscParamPointVec);
188 
189  } // end writeResults
std::vector< cmf::FCResultCollection > fPointResultVec
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
std::vector< cmf::OscParamPoint > fOscParamPointVec
std::string fDataProductType
type of data product to combine
std::vector< cmf::FCUniverseCollection > fFakeUniverses
void WriteResultsVec(art::Results &r, std::vector< T > &resultsVec)
template<class T >
void cmf::CombineResults::WriteResultsVec ( art::Results r,
std::vector< T > &  resultsVec 
)
private

Definition at line 172 of file CMFCombineResults_plugin.cc.

References art::Results::put().

Referenced by writeResults().

174  {
175  std::unique_ptr<std::vector<T>> combVec = std::make_unique<std::vector<T>>(resultsVec);
176  r.put(std::move(combVec));
177  }
art::ProductID put(std::unique_ptr< PROD > &&product)
Definition: Results.h:78

Member Data Documentation

std::string cmf::CombineResults::fDataProductType
private

type of data product to combine

Definition at line 44 of file CMFCombineResults_plugin.cc.

Referenced by CombineResults(), readResults(), and writeResults().

std::vector<cmf::FCUniverseCollection> cmf::CombineResults::fFakeUniverses
private

Definition at line 52 of file CMFCombineResults_plugin.cc.

Referenced by ReadFakeUniverses(), and writeResults().

std::string cmf::CombineResults::fInputDataProductLabel
private

Name of the label for the input and result points.

Definition at line 43 of file CMFCombineResults_plugin.cc.

Referenced by ReadFakeUniverses(), ReadOscParamPoints(), and ReadPointResults().

std::vector<cmf::OscParamPoint> cmf::CombineResults::fOscParamPointVec
private

Definition at line 54 of file CMFCombineResults_plugin.cc.

Referenced by ReadOscParamPoints(), and writeResults().

std::vector<cmf::FCResultCollection> cmf::CombineResults::fPointResultVec
private

Definition at line 53 of file CMFCombineResults_plugin.cc.

Referenced by ReadPointResults(), and writeResults().

cmf::OscParm_t cmf::CombineResults::fXParamEnum
private

Definition at line 47 of file CMFCombineResults_plugin.cc.

Referenced by CombineResults(), and ReadFakeUniverses().

cmf::OscParm_t cmf::CombineResults::fYParamEnum
private

Definition at line 48 of file CMFCombineResults_plugin.cc.

Referenced by CombineResults(), and ReadFakeUniverses().


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