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

 DAQHeaderSummary (fhicl::ParameterSet const &p)
 
void reconfigure (fhicl::ParameterSet const &p)
 
bool UnpackRawDaqData (art::Event &e, daqdataformats::RawEvent &raw)
 
void produce (art::Event &e)
 
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

std::string fRawDataLabel
 label of where to find RawData More...
 
bool fWarningIssued
 Set to true once a warning is issued; throttles warning messages to 1 per job. More...
 

Detailed Description

Definition at line 38 of file DAQHeaderSummary_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

dq::DAQHeaderSummary::DAQHeaderSummary ( fhicl::ParameterSet const &  p)
explicit

Definition at line 57 of file DAQHeaderSummary_module.cc.

References reconfigure().

58  : fRawDataLabel(p.get< std::string >("RawDataLabel")),
59  fWarningIssued(false)
60  {
61  this->reconfigure(p);
62  produces<dq::DAQEventSummary>();
63  }
void reconfigure(fhicl::ParameterSet const &p)
const char * p
Definition: xmltok.h:285
std::string fRawDataLabel
label of where to find RawData
bool fWarningIssued
Set to true once a warning is issued; throttles warning messages to 1 per job.
enum BeamMode string

Member Function Documentation

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 dq::DAQHeaderSummary::produce ( art::Event e)
virtual

Implements art::EDProducer.

Definition at line 106 of file DAQHeaderSummary_module.cc.

References DEFINE_ART_MODULE(), fRawDataLabel, art::DataViewImpl::getByLabel(), art::DataViewImpl::getManyByType(), art::Event::isRealData(), art::Event::put(), log::success(), rawdata::DAQHeader::TotalMicroSlices(), UnpackRawDaqData(), and dq::DAQEventUnpack::UnpackRawEvent().

107  {
108  DAQEventUnpack daqUnpack;
109  std::unique_ptr<dq::DAQEventSummary> daqSummary(new dq::DAQEventSummary);
110 
111  // If this is MC, put an empty product and move on
112  if(!e.isRealData()) {
113  e.put(std::move(daqSummary));
114  return;
115  }
116 
118 
119  bool success = this->UnpackRawDaqData(e, raw);
120 
121  // If the flat daq data didn't unpack properly, put an empty product and move on
122  if (!success) {
123  e.put(std::move(daqSummary));
124  return;
125  }
126 
127  // Unpack, analyze, and summarize the DAQ data
128  daqUnpack.UnpackRawEvent(raw, daqSummary.get());
129 
130  // Grab dropped microblocks (but only if it exists as a product)
131  std::vector<art::Handle< std::vector<rawdata::RawSumDropMB>>> droppedMBs_vec;
132  e.getManyByType(droppedMBs_vec);
133  if (droppedMBs_vec.size() != 0){
135  e.getByLabel(fRawDataLabel, droppedMBs);
136  daqSummary.get()->fNDroppedMicroBlocks = (*droppedMBs)[0].fSumTrig_NumDroppedMicroblocks;
137  }
138 
139  // Grab microslice information from DAQ Header
141  e.getByLabel(fRawDataLabel, daqheader);
142  daqSummary.get()->fNmicroSlices = daqheader->TotalMicroSlices();
143 
144  // Determine number of diblocks in this event
145  daqSummary.get()->fDiblocks.sort();
146  daqSummary.get()->fDiblocks.unique();
147  daqSummary.get()->fNDiblocks = daqSummary.get()->fDiblocks.size();
148 
149  e.put(std::move(daqSummary));
150  }
bool UnpackRawDaqData(art::Event &e, daqdataformats::RawEvent &raw)
bool isRealData() const
Definition: Event.h:83
int TotalMicroSlices() const
Definition: DAQHeader.h:27
std::string fRawDataLabel
label of where to find RawData
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
def success(message)
Definition: log.py:5
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void dq::DAQHeaderSummary::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 66 of file DAQHeaderSummary_module.cc.

Referenced by DAQHeaderSummary().

66 { }
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

bool dq::DAQHeaderSummary::UnpackRawDaqData ( art::Event e,
daqdataformats::RawEvent raw 
)

Unpack the raw data

Parameters
e: ART event
raw: Raw event

Definition at line 73 of file DAQHeaderSummary_module.cc.

References om::cerr, allTimeWatchdog::endl, fRawDataLabel, fWarningIssued, and art::DataViewImpl::getByLabel().

Referenced by produce().

75  {
76  try {
78  e.getByLabel(fRawDataLabel, flat_hdl);
79  if (flat_hdl->size()!=1) {
80  if (!fWarningIssued){
81  std::cerr << __FILE__ << ":" << __LINE__
82  << " Must have one and only one flat daq object. Supressing further warnings."
83  << " Found " << flat_hdl->size() << std::endl;
84  fWarningIssued = true;
85  }
86  return false;
87  }
88  raw.readData( (*flat_hdl)[0].getRawBufferPointer() );
89  return true;
90  }
91  catch (...) {
92  if (!fWarningIssued){
93  std::cerr << __FILE__ << ":" << __LINE__
94  << " Bad unpack of flat DAQ data! Supressing further warnings."
95  << std::endl;
96  fWarningIssued = true;
97  }
98  return false;
99  }
100 
101  // Only errors fall through to here.
102  return false;
103  }
OStream cerr
Definition: OStream.cxx:7
std::string fRawDataLabel
label of where to find RawData
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
bool fWarningIssued
Set to true once a warning is issued; throttles warning messages to 1 per job.
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

std::string dq::DAQHeaderSummary::fRawDataLabel
private

label of where to find RawData

Definition at line 49 of file DAQHeaderSummary_module.cc.

Referenced by produce(), and UnpackRawDaqData().

bool dq::DAQHeaderSummary::fWarningIssued
private

Set to true once a warning is issued; throttles warning messages to 1 per job.

Definition at line 50 of file DAQHeaderSummary_module.cc.

Referenced by UnpackRawDaqData().


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