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

Public Types

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

Public Member Functions

 POTSummary (fhicl::ParameterSet const &pset)
 
virtual ~POTSummary ()
 
void event (art::Event const &e)
 
void readResults (art::Results const &r)
 
void writeResults (art::Results &r)
 
void reconfigure (fhicl::ParameterSet const &p)
 
void clear ()
 
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 Attributes

std::string fSpillDataLabel
 label of module storing spill info More...
 
skim::SpillEvaluator fSpillEval
 tool to check the quality of a spill More...
 
std::map< std::string, sumdata::POTSumfEpochToPOTSum
 POT summary for each epoch. More...
 
art::ServiceHandle< nova::dbi::RunHistoryServicefRH
 RunHistory service. More...
 

Detailed Description

Definition at line 27 of file POTSummary_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

skim::POTSummary::POTSummary ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 48 of file POTSummary_plugin.cc.

References reconfigure().

49  : fSpillEval(pset.get<fhicl::ParameterSet>("SpillEvaluation"))
50  {
51  this->reconfigure(pset);
52  produces< std::map<std::string, sumdata::POTSum> >();
53 
54  return;
55  }
skim::SpillEvaluator fSpillEval
tool to check the quality of a spill
void reconfigure(fhicl::ParameterSet const &p)
skim::POTSummary::~POTSummary ( )
virtual

Definition at line 58 of file POTSummary_plugin.cc.

59  {
60  }

Member Function Documentation

void skim::POTSummary::clear ( )
virtual

Implements art::ResultsProducer.

Definition at line 95 of file POTSummary_plugin.cc.

References fEpochToPOTSum.

96  {
97  fEpochToPOTSum.clear();
98  return;
99  }
std::map< std::string, sumdata::POTSum > fEpochToPOTSum
POT summary for each epoch.
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 Munits::sr.

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

188 {
189  SubRun const sr{srp, *moduleDescription_, this};
190  beginSubRun(sr);
191 }
virtual void beginSubRun(SubRun const &)
static constexpr Double_t sr
Definition: Munits.h:164
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 Munits::sr.

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

195 {
196  SubRun const sr{srp, *moduleDescription_, this};
197  endSubRun(sr);
198 }
virtual void endSubRun(SubRun const &)
static constexpr Double_t sr
Definition: Munits.h:164
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
void skim::POTSummary::event ( art::Event const &  e)
virtual

Reimplemented from art::ResultsProducer.

Definition at line 71 of file POTSummary_plugin.cc.

References skim::SpillEvaluator::EvaluateSpill(), fEpochToPOTSum, fRH, fSpillDataLabel, fSpillEval, nova::dbi::RunHistory::GetDataEpoch(), art::DataViewImpl::getValidHandle(), and nova::dbi::DataEpoch::name.

72  {
73  auto spillData = e.getValidHandle<sumdata::SpillData>(fSpillDataLabel);
74 
75 
76  if( !spillData.failedToGet() ){
77 
78  fEpochToPOTSum[fRH->GetDataEpoch().name].totpot += spillData->spillpot;
79  fEpochToPOTSum[fRH->GetDataEpoch().name].totspills += 1;
80 
81  if( fSpillEval.EvaluateSpill(*spillData) ){
82  fEpochToPOTSum[fRH->GetDataEpoch().name].totgoodpot += spillData->spillpot;
83  fEpochToPOTSum[fRH->GetDataEpoch().name].goodspills += 1;
84  }
85 
86  }// end we found a SpillData object
87 
88  return;
89  }
std::map< std::string, sumdata::POTSum > fEpochToPOTSum
POT summary for each epoch.
std::string fSpillDataLabel
label of module storing spill info
art::ServiceHandle< nova::dbi::RunHistoryService > fRH
RunHistory service.
skim::SpillEvaluator fSpillEval
tool to check the quality of a spill
std::string name
Definition: RunHistory.h:59
bool EvaluateSpill(sumdata::SpillData const &spillData)
DataEpoch GetDataEpoch()
Definition: RunHistory.h:484
Float_t e
Definition: plot.C:35
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 skim::POTSummary::readResults ( art::Results const &  r)
virtual

Reimplemented from art::ResultsProducer.

Definition at line 102 of file POTSummary_plugin.cc.

103  {
104 
105  return;
106  }
void skim::POTSummary::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 63 of file POTSummary_plugin.cc.

References fSpillDataLabel, and fhicl::ParameterSet::get().

Referenced by POTSummary().

64  {
65  fSpillDataLabel = pset.get<std::string>("SpillDataLabel");
66 
67  return;
68  }
std::string fSpillDataLabel
label of module storing spill info
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
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 skim::POTSummary::writeResults ( art::Results r)
virtual

Implements art::ResultsProducer.

Definition at line 109 of file POTSummary_plugin.cc.

References skim::DEFINE_ART_RESULTS_PLUGIN(), fEpochToPOTSum, LOG_VERBATIM, pot, and art::Results::put().

110  {
111  std::unique_ptr< std::map<std::string, sumdata::POTSum> > pot(&fEpochToPOTSum);
112 
113  for(auto itr : fEpochToPOTSum)
114  LOG_VERBATIM("POTSummary")
115  << "Epoch "
116  << itr.first
117  << " contains "
118  << itr.second.totgoodpot
119  << " POT";
120 
121  r.put(std::move(pot));
122  } // end writeResults
std::map< std::string, sumdata::POTSum > fEpochToPOTSum
POT summary for each epoch.
art::ProductID put(std::unique_ptr< PROD > &&product)
Definition: Results.h:78
#define pot
#define LOG_VERBATIM(category)

Member Data Documentation

std::map<std::string, sumdata::POTSum> skim::POTSummary::fEpochToPOTSum
private

POT summary for each epoch.

Definition at line 42 of file POTSummary_plugin.cc.

Referenced by clear(), event(), and writeResults().

art::ServiceHandle<nova::dbi::RunHistoryService> skim::POTSummary::fRH
private

RunHistory service.

Definition at line 43 of file POTSummary_plugin.cc.

Referenced by event().

std::string skim::POTSummary::fSpillDataLabel
private

label of module storing spill info

Definition at line 40 of file POTSummary_plugin.cc.

Referenced by event(), and reconfigure().

skim::SpillEvaluator skim::POTSummary::fSpillEval
private

tool to check the quality of a spill

Definition at line 41 of file POTSummary_plugin.cc.

Referenced by event().


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