Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
om::OnMonProd Class Reference
Inheritance diagram for om::OnMonProd:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 OnMonProd (fhicl::ParameterSet const &p)
 
virtual ~OnMonProd ()
 
void beginRun (const art::Run &R)
 
void beginJob ()
 
void endJob ()
 
void analyze (art::Event const &e)
 
void reconfigure (fhicl::ParameterSet const &p)
 
void NewRunNumber (unsigned int run, unsigned int subrun)
 
void NewSubrunNumber (unsigned int run, unsigned int subrun)
 
bool UnpackRawDaqData (art::Event const &evt, daqdataformats::RawEvent &rawevt)
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) 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
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

OnMonProdIPCfIPC
 Communicates with viewer. More...
 
std::string fSHMname
 Shared memory for communication. More...
 
bool fuseSHM
 Use SHM to communicate with a viewer? More...
 
unsigned int fLastRun
 Last run number analyzed. More...
 
unsigned int fLastSubrun
 Last subrun number analyzed. More...
 
unsigned int fPartition
 Partition of last event analyzed. More...
 
bool fWriteToFile
 Output histogram file? More...
 
bool fTickerOn
 Turned on in the control room. More...
 
TTree * fHeader
 Header object to be written to disk with the histograms. More...
 
int fFirstEvent
 Header: first event processed. More...
 
int fLastEvent
 Header: last event processed. More...
 
int fNevents
 Header: number of events processed. More...
 
unsigned long int fStartNOvATime
 Header: time of first processed event (in NOvA time - 64 MHz clock ticks) - initalized to -1 to make it a HUGE positive number. More...
 
unsigned long int fEndNOvATime
 Header: time of last processed event (in NOvA time - 64 MHz clock ticks) More...
 
uint32_t fStartYear
 Header: year of first processed event (actual years since 0 A.D.) More...
 
uint16_t fStartMonth
 Header: month of first processed event (actual month 1-12) More...
 
uint16_t fStartDay
 Header: day of first processed event (day of the month 1-31) More...
 
double fStartHour
 Header: hour of first processed event (since midnight 0.0 - 23.99999) More...
 
uint32_t fEndYear
 Header: year of last processed event (actual years since 0 A.D.) More...
 
uint16_t fEndMonth
 Header: month of last processed event (actual month 1-12) More...
 
uint16_t fEndDay
 Header: day of last processed event (day of the month 1-31) More...
 
double fEndHour
 Header: hour of last processed event (since midnight 0.0 - 23.99999) More...
 
std::vector< intfIncompleteEvents
 Header: a list of incomplete events. More...
 

Detailed Description

Top level module for online monitoring

Definition at line 67 of file OnMonProd_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

OnMonProd::OnMonProd ( fhicl::ParameterSet const &  p)
explicit

Definition at line 144 of file OnMonProd_module.cc.

References om::Settings::fDet, om::Settings::Instance(), om::HistoTable::Instance(), PandAna.Demos.pi0_spectra::mcerr, and reconfigure().

144  :
145  EDAnalyzer(p),
146  fIPC(0),
147  fSHMname(""),
148  fuseSHM(false),
149  fLastRun(0),
150  fLastSubrun(0),
151  fPartition(4),
152  fWriteToFile(false),
153  fTickerOn(false),
154  fHeader(0),
155  fFirstEvent(1e9),
156  fLastEvent(-1),
157  fNevents(0),
158  fStartNOvATime(-1),
159  fEndNOvATime(0)
160 {
161  this->reconfigure(p);
162 
163  HistoTable::Instance(Settings::Instance().fCSVFile.c_str(),
165 
166  // Histogram fillers
167  static FEBRatesByDiblock fbdb;
168  static HitCounts hc;
169  static HitMaps hm;
170  static TQPlots tqp;
171  static WLPlots wlp;
172  static TriggerPlots trig;
173  static NanoErrors nerr;
174  static MicroErrors mcerr;
175  static DataBlockErrors dberr;
176  static RawEventErrors reerr;
177 }
std::string fSHMname
Shared memory for communication.
int fLastEvent
Header: last event processed.
const char * p
Definition: xmltok.h:285
bool fWriteToFile
Output histogram file?
unsigned int fPartition
Partition of last event analyzed.
unsigned int fLastSubrun
Last subrun number analyzed.
TTree * fHeader
Header object to be written to disk with the histograms.
int fNevents
Header: number of events processed.
Detector_t fDet
Definition: Settings.h:18
unsigned long int fStartNOvATime
Header: time of first processed event (in NOvA time - 64 MHz clock ticks) - initalized to -1 to make ...
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
int fFirstEvent
Header: first event processed.
unsigned int fLastRun
Last run number analyzed.
void reconfigure(fhicl::ParameterSet const &p)
bool fTickerOn
Turned on in the control room.
static HistoTable & Instance(const char *f=0, Detector_t d=kALLDET)
Definition: HistoTable.cxx:21
OnMonProdIPC * fIPC
Communicates with viewer.
unsigned long int fEndNOvATime
Header: time of last processed event (in NOvA time - 64 MHz clock ticks)
static Settings & Instance()
Definition: Settings.cxx:12
bool fuseSHM
Use SHM to communicate with a viewer?
OnMonProd::~OnMonProd ( )
virtual

Definition at line 181 of file OnMonProd_module.cc.

181 { }

Member Function Documentation

void OnMonProd::analyze ( art::Event const &  e)
virtual

Implements art::EDAnalyzer.

Definition at line 493 of file OnMonProd_module.cc.

References confusionMatrixTree::count, om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, fEndNOvATime, fFirstEvent, fIncompleteEvents, fIPC, fLastEvent, fLastRun, fLastSubrun, fNevents, fPartition, fStartNOvATime, fTickerOn, fuseSHM, om::IPC::HandleRequests(), om::Settings::Instance(), om::Ticker::Instance(), om::RawEventUnpacker::Instance(), om::kFARDET, NewRunNumber(), NewSubrunNumber(), parsePQSLOutput::partition, om::IPC::PostResources(), updateRunHistoryTables::run, getGoodRuns4SAM::subrun, UnpackRawDaqData(), om::RawEventUnpacker::UnpackRawEvent(), and om::Ticker::Update().

494 {
495  bool aok;
496 
497  //
498  // Handle any pending requests for histograms
499  //
500  if (fuseSHM) fIPC->HandleRequests();
501 
502  static daqdataformats::RawEvent rawevt;
503  aok = this->UnpackRawDaqData(evt, rawevt);
504  if (aok==false) return;
505 
506  unsigned int run = rawevt.getRunNumber();
507  unsigned int subrun = rawevt.getSubrun();
508  unsigned int event = rawevt.getEventNumber();
509  unsigned int partition = rawevt.getPartition();
510  unsigned long int time = rawevt.getTrigger()->getTriggerStart();
511 
512 
513 
514  //
515  // Check if the run/subrun number has changed
516  //
517  if ( (subrun != fLastSubrun) && (Settings::Instance().fDet != kFARDET) ) {
519  }
520  if ( (run != fLastRun) && (Settings::Instance().fDet == kFARDET) ) {
522  }
523 
524  //
525  // update Header variables.
526  //
527  fNevents++;
528  fLastRun = run;
531 
532  // first/last event are not necessarily coorelated with earliest/latest time
533  if(time < fStartNOvATime)
535  if((int)event < fFirstEvent)
536  fFirstEvent = event;
537  if(time > fEndNOvATime)
538  fEndNOvATime = time;
539  if((int)event > fLastEvent)
540  fLastEvent = event;
541 
542  if( rawevt.getHeader()->isEventIncomplete() ) {
543  fIncompleteEvents.push_back(event);
544  }
545 
546 
547 
548 
549  static unsigned int count = 0;
550  if (++count%10==0) {
551  if (fuseSHM) fIPC->PostResources(run, subrun, event);
552  std::cout << "onmon_prod: run/sub/evt="
553  << run << "/" << subrun << "/" << event << " "
554  << " type:size="
555  << rawevt.getEventType() << ":"
556  << rawevt.getEventSize()
557  << std::endl;
558  }
559 
560  //
561  // Update the ticker so it can notify its subscribers.
562  // Do this BEFORE unpacking so that there are no overlaps in plots
563  // reset every 24 hours.
564  //
565  if (fTickerOn) Ticker::Instance().Update(run, subrun);
566 
567  //
568  // Unpack the raw event and publish results to plot-making
569  // subscribers
570  //
572 }
std::vector< int > fIncompleteEvents
Header: a list of incomplete events.
bool UnpackRawDaqData(art::Event const &evt, daqdataformats::RawEvent &rawevt)
void PostResources(unsigned int run, unsigned int subrun, unsigned int event)
Definition: IPC.cxx:528
int fLastEvent
Header: last event processed.
void Update(unsigned int run, unsigned int subrun)
Definition: Ticker.cxx:34
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
unsigned int fPartition
Partition of last event analyzed.
void NewRunNumber(unsigned int run, unsigned int subrun)
unsigned int fLastSubrun
Last subrun number analyzed.
int fNevents
Header: number of events processed.
int HandleRequests()
Definition: IPC.cxx:516
void NewSubrunNumber(unsigned int run, unsigned int subrun)
void UnpackRawEvent(daqdataformats::RawEvent &rawevt)
int evt
unsigned long int fStartNOvATime
Header: time of first processed event (in NOvA time - 64 MHz clock ticks) - initalized to -1 to make ...
Definition: run.py:1
static Ticker & Instance()
Definition: Ticker.cxx:26
OStream cout
Definition: OStream.cxx:6
int fFirstEvent
Header: first event processed.
unsigned int fLastRun
Last run number analyzed.
static RawEventUnpacker & Instance()
bool fTickerOn
Turned on in the control room.
OnMonProdIPC * fIPC
Communicates with viewer.
unsigned long int fEndNOvATime
Header: time of last processed event (in NOvA time - 64 MHz clock ticks)
static Settings & Instance()
Definition: Settings.cxx:12
bool fuseSHM
Use SHM to communicate with a viewer?
void OnMonProd::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 451 of file OnMonProd_module.cc.

References fEndDay, fEndHour, fEndMonth, fEndYear, fFirstEvent, fHeader, fIncompleteEvents, fLastEvent, fLastRun, fLastSubrun, fNevents, fPartition, fStartDay, fStartHour, fStartMonth, and fStartYear.

452 {
453  if(fHeader) { delete fHeader; fHeader = 0; }
454  fHeader = new TTree("Header","Header Information");
455 
456  fHeader->Branch("Run",&fLastRun);
457  fHeader->Branch("Subrun",&fLastSubrun);
458  fHeader->Branch("Partition",&fPartition);
459  fHeader->Branch("FirstEvent",&fFirstEvent);
460  fHeader->Branch("LastEvent",&fLastEvent);
461  fHeader->Branch("Nevents",&fNevents);
462  fHeader->Branch("StartYear",&fStartYear);
463  fHeader->Branch("StartMonth",&fStartMonth);
464  fHeader->Branch("StartDay",&fStartDay);
465  fHeader->Branch("StartHour",&fStartHour);
466  fHeader->Branch("EndYear",&fEndYear);
467  fHeader->Branch("EndMonth",&fEndMonth);
468  fHeader->Branch("EndDay",&fEndDay);
469  fHeader->Branch("EndHour",&fEndHour);
470  fHeader->Branch("IncompleteEvents",&fIncompleteEvents);
471 
472  // I would like to add these two variables to the header object but
473  // root complains that an unsigned long int is an unacceptable type.
474  //
475  // fHeader->Branch("StartNovaTime", &fStartNOvATime);
476  // fHeader->Branch("EndNovaTime", &fEndNOvATime);
477 }
std::vector< int > fIncompleteEvents
Header: a list of incomplete events.
uint16_t fEndDay
Header: day of last processed event (day of the month 1-31)
int fLastEvent
Header: last event processed.
unsigned int fPartition
Partition of last event analyzed.
unsigned int fLastSubrun
Last subrun number analyzed.
TTree * fHeader
Header object to be written to disk with the histograms.
int fNevents
Header: number of events processed.
double fStartHour
Header: hour of first processed event (since midnight 0.0 - 23.99999)
double fEndHour
Header: hour of last processed event (since midnight 0.0 - 23.99999)
uint32_t fStartYear
Header: year of first processed event (actual years since 0 A.D.)
int fFirstEvent
Header: first event processed.
uint16_t fStartMonth
Header: month of first processed event (actual month 1-12)
uint16_t fStartDay
Header: day of first processed event (day of the month 1-31)
unsigned int fLastRun
Last run number analyzed.
uint32_t fEndYear
Header: year of last processed event (actual years since 0 A.D.)
uint16_t fEndMonth
Header: month of last processed event (actual month 1-12)
void OnMonProd::beginRun ( const art::Run R)

Definition at line 447 of file OnMonProd_module.cc.

447 { }
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
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::EDAnalyzer::currentContext ( ) const
protectedinherited
void OnMonProd::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 481 of file OnMonProd_module.cc.

References fHeader, fIPC, fLastRun, fLastSubrun, om::Settings::Instance(), om::kFARDET, NewRunNumber(), and NewSubrunNumber().

482 {
483  if(Settings::Instance().fDet != kFARDET)
485  if(Settings::Instance().fDet == kFARDET)
487  if(fIPC) { delete fIPC; fIPC = 0; }
488  if(fHeader) { delete fHeader; fHeader = 0; }
489 }
void NewRunNumber(unsigned int run, unsigned int subrun)
unsigned int fLastSubrun
Last subrun number analyzed.
TTree * fHeader
Header object to be written to disk with the histograms.
void NewSubrunNumber(unsigned int run, unsigned int subrun)
unsigned int fLastRun
Last run number analyzed.
OnMonProdIPC * fIPC
Communicates with viewer.
static Settings & Instance()
Definition: Settings.cxx:12
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
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
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
void OnMonProd::NewRunNumber ( unsigned int  run,
unsigned int  subrun 
)

Definition at line 211 of file OnMonProd_module.cc.

References novadaq::timeutils::convertNovaTimeToUnixTime(), novadaq::timeutils::convertUnixTimeToNovaTime(), om::cout, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, om::Settings::fDet, fEndDay, fEndHour, fEndMonth, fEndNOvATime, fEndYear, fFirstEvent, fHeader, fIncompleteEvents, fLastEvent, fNevents, fSHMname, fStartDay, fStartHour, fStartMonth, fStartNOvATime, fStartYear, fuseSHM, fWriteToFile, febshutoff_auto::hour, om::Settings::Instance(), om::HistoSet::Instance(), om::kFARDET, om::kNDOS, om::kNEARDET, om::kTESTBEAM, min(), updateRunHistoryTables::run, getGoodRuns4SAM::subrun, and om::HistoSet::WriteToRootFile().

Referenced by analyze(), and endJob().

212 {
213  if (run==0 && subrun==0) return;
214 
215  if(fWriteToFile) {
216 
217  char buff[1024];
218 
219  if(fuseSHM)
220  sprintf(buff, "%s_CR_r%.8d_s%.3d.onmon.root", fSHMname.c_str(), run, subrun);
221  else {
223  sprintf(buff, "fardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
225  sprintf(buff, "neardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
226  if(Settings::Instance().fDet == kNDOS)
227  sprintf(buff, "ndos_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
229  sprintf(buff, "testbeam_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
230  }
231 
232  std::cout << "Writing end-of-run histograms to root file "
233  << buff << "...";
234 
235  // Convert times from NOvA times to unix times.
236  // using unsigned long long rather than uint64_t to ensure consistent behavior between OSX and LINUX
237  uint16_t hour = 0;
238  uint16_t min = 0;
239  uint16_t sec = 0;
240 
241 #ifndef DARWINBUILD
242  uint64_t RoundedTime = 0.; // We need this to have > 1 second precision.
243 #else
244  unsigned long long RoundedTime = 0; // We need this to have > 1 second precision.
245 #endif
246 
250  fStartMonth, fStartYear, RoundedTime);
251 
252  fStartHour = (double)hour + (double)min/60.0 + (double)sec/3600.0
253  + (long double)(fStartNOvATime-RoundedTime)/64.0e6/3600.0;
254 
255  hour = 0;
256  min = 0;
257  sec = 0;
258  RoundedTime = 0;
262  fEndMonth, fEndYear, RoundedTime);
263 
264  fEndHour = (double)hour + (double)min/60.0 + (double)sec/3600.0
265  + (long double)(fEndNOvATime-RoundedTime)/64.0e6/3600.0;
266 
267  // Convert to "normal" time units
268  fStartYear += 1900;
269  fStartMonth += 1;
270  fEndYear += 1900;
271  fEndMonth += 1;
272 
273  // sort incomplete event numbers
274  std::sort(fIncompleteEvents.begin(),fIncompleteEvents.end());
275 
276  // Write histos and header to disk.
277  TFile* f = new TFile(buff,"RECREATE");
279  fHeader->Fill();
280  fHeader->Write("Header",TObject::kOverwrite,0);
281  f->Close();
282  delete f; f=0;
283 
284  // reset header varaibles
285  fHeader->Reset();
286  fFirstEvent = 1e9;
287  fLastEvent = -1;
288  fNevents = 0;
289  fStartNOvATime = -1;
290  fEndNOvATime = 0;
291  fIncompleteEvents.clear();
292 
293  std::cout << "done." << std::endl;
294 
295  }
296 
297 }
std::vector< int > fIncompleteEvents
Header: a list of incomplete events.
uint16_t fEndDay
Header: day of last processed event (day of the month 1-31)
std::string fSHMname
Shared memory for communication.
int fLastEvent
Header: last event processed.
void WriteToRootFile(TFile *f)
Definition: HistoSet.cxx:129
bool fWriteToFile
Output histogram file?
bool convertNovaTimeToUnixTime(uint64_t const &inputNovaTime, struct timespec &outputUnixTime)
TTree * fHeader
Header object to be written to disk with the histograms.
int fNevents
Header: number of events processed.
Detector_t fDet
Definition: Settings.h:18
double fStartHour
Header: hour of first processed event (since midnight 0.0 - 23.99999)
double fEndHour
Header: hour of last processed event (since midnight 0.0 - 23.99999)
unsigned long int fStartNOvATime
Header: time of first processed event (in NOvA time - 64 MHz clock ticks) - initalized to -1 to make ...
Definition: run.py:1
OStream cout
Definition: OStream.cxx:6
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
uint32_t fStartYear
Header: year of first processed event (actual years since 0 A.D.)
int fFirstEvent
Header: first event processed.
uint16_t fStartMonth
Header: month of first processed event (actual month 1-12)
uint16_t fStartDay
Header: day of first processed event (day of the month 1-31)
static HistoSet & Instance()
Definition: HistoSet.cxx:24
uint32_t fEndYear
Header: year of last processed event (actual years since 0 A.D.)
unsigned long int fEndNOvATime
Header: time of last processed event (in NOvA time - 64 MHz clock ticks)
static Settings & Instance()
Definition: Settings.cxx:12
bool fuseSHM
Use SHM to communicate with a viewer?
uint16_t fEndMonth
Header: month of last processed event (actual month 1-12)
bool convertUnixTimeToNovaTime(struct timespec const &inputUnixTime, uint64_t &outputNovaTime)
void OnMonProd::NewSubrunNumber ( unsigned int  run,
unsigned int  subrun 
)

Definition at line 301 of file OnMonProd_module.cc.

References novadaq::timeutils::convertNovaTimeToUnixTime(), novadaq::timeutils::convertUnixTimeToNovaTime(), om::cout, allTimeWatchdog::endl, om::WatchListManager::EndSubrunCleanUp(), MakeMiniprodValidationCuts::f, om::Settings::fDet, fEndDay, fEndHour, fEndMonth, fEndNOvATime, fEndYear, fFirstEvent, fHeader, fIncompleteEvents, fLastEvent, fNevents, fSHMname, fStartDay, fStartHour, fStartMonth, fStartNOvATime, fStartYear, fuseSHM, fWriteToFile, febshutoff_auto::hour, om::Settings::Instance(), om::HistoSet::Instance(), om::WatchListManager::Instance(), om::kFARDET, om::kNDOS, om::kNEARDET, om::kTESTBEAM, min(), updateRunHistoryTables::run, getGoodRuns4SAM::subrun, and om::HistoSet::WriteToRootFile().

Referenced by analyze(), and endJob().

302 {
303  if (run==0 && subrun==0) return;
304 
305  if(fWriteToFile) {
306 
307  char buff[1024];
308 
309  if(fuseSHM)
310  sprintf(buff, "%s_CR_r%.8d_s%.3d.onmon.root", fSHMname.c_str(), run, subrun);
311  else {
313  sprintf(buff, "fardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
315  sprintf(buff, "neardet_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
316  if(Settings::Instance().fDet == kNDOS)
317  sprintf(buff, "ndos_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
319  sprintf(buff, "testbeam_nearline_r%.8d_s%.3d.onmon.root", run, subrun);
320  }
321 
322  std::cout << "Writing end-of-subrun histograms to root file "
323  << buff << "...";
324 
325  // Convert times from NOvA times to unix times.
326  // using unsigned long long rather than uint64_t to ensure consistent behavior on OSX and LINUX
327  uint16_t hour = 0;
328  uint16_t min = 0;
329  uint16_t sec = 0;
330 
331 #ifndef DARWINBUILD
332  uint64_t RoundedTime = 0.; // We need this to have > 1 second precision.
333 #else
334  unsigned long long RoundedTime = 0; // We need this to have > 1 second precision.
335 #endif
336 
340  fStartMonth, fStartYear, RoundedTime);
341 
342  fStartHour = (double)hour + (double)min/60.0 + (double)sec/3600.0
343  + (long double)(fStartNOvATime-RoundedTime)/64.0e6/3600.0;
344 
345  hour = 0;
346  min = 0;
347  sec = 0;
348  RoundedTime = 0;
352  fEndMonth, fEndYear, RoundedTime);
353 
354  fEndHour = (double)hour + (double)min/60.0 + (double)sec/3600.0
355  + (long double)(fEndNOvATime-RoundedTime)/64.0e6/3600.0;
356 
357  // Convert to "normal" time units
358  fStartYear += 1900;
359  fStartMonth += 1;
360  fEndYear += 1900;
361  fEndMonth += 1;
362 
363  // sort incomplete event numbers
364  std::sort(fIncompleteEvents.begin(),fIncompleteEvents.end());
365 
366  // Write histos and header to disk.
367  TFile* f = new TFile(buff,"RECREATE");
369  fHeader->Fill();
370  fHeader->Write("Header",TObject::kOverwrite,0);
371  f->Close();
372  delete f; f=0;
373 
374  // reset header varaibles
375  fHeader->Reset();
376  fFirstEvent = 1e9;
377  fLastEvent = -1;
378  fNevents = 0;
379  fStartNOvATime = -1;
380  fEndNOvATime = 0;
381  fIncompleteEvents.clear();
382 
383  std::cout << "done." << std::endl;
384 
385  }
386 
387  std::cout << "Removing inactive WatchList items: ";
389  std::cout << "done." << std::endl;
390 
391 }
std::vector< int > fIncompleteEvents
Header: a list of incomplete events.
uint16_t fEndDay
Header: day of last processed event (day of the month 1-31)
std::string fSHMname
Shared memory for communication.
int fLastEvent
Header: last event processed.
void WriteToRootFile(TFile *f)
Definition: HistoSet.cxx:129
bool fWriteToFile
Output histogram file?
bool convertNovaTimeToUnixTime(uint64_t const &inputNovaTime, struct timespec &outputUnixTime)
TTree * fHeader
Header object to be written to disk with the histograms.
int fNevents
Header: number of events processed.
Detector_t fDet
Definition: Settings.h:18
double fStartHour
Header: hour of first processed event (since midnight 0.0 - 23.99999)
double fEndHour
Header: hour of last processed event (since midnight 0.0 - 23.99999)
unsigned long int fStartNOvATime
Header: time of first processed event (in NOvA time - 64 MHz clock ticks) - initalized to -1 to make ...
Definition: run.py:1
OStream cout
Definition: OStream.cxx:6
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
uint32_t fStartYear
Header: year of first processed event (actual years since 0 A.D.)
int fFirstEvent
Header: first event processed.
uint16_t fStartMonth
Header: month of first processed event (actual month 1-12)
uint16_t fStartDay
Header: day of first processed event (day of the month 1-31)
static WatchListManager & Instance()
static HistoSet & Instance()
Definition: HistoSet.cxx:24
uint32_t fEndYear
Header: year of last processed event (actual years since 0 A.D.)
unsigned long int fEndNOvATime
Header: time of last processed event (in NOvA time - 64 MHz clock ticks)
static Settings & Instance()
Definition: Settings.cxx:12
bool fuseSHM
Use SHM to communicate with a viewer?
uint16_t fEndMonth
Header: month of last processed event (actual month 1-12)
bool convertUnixTimeToNovaTime(struct timespec const &inputUnixTime, uint64_t &outputNovaTime)
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void OnMonProd::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 395 of file OnMonProd_module.cc.

References d, gen_hdf5record::debug, om::Settings::fCSVFile, om::Settings::fDet, shutoffs::filename, fIPC, fSHMname, fTickerOn, fuseSHM, fWriteToFile, fhicl::ParameterSet::get(), cet::getenv(), MECModelEnuComparisons::i, om::Settings::Instance(), om::RawEventUnpacker::Instance(), om::kFARDET, om::kIPC_SERVER, om::kNDOS, om::kNEARDET, om::kTESTBEAM, om::RawEventUnpacker::SetDebug(), and string.

Referenced by OnMonProd().

396 {
397  //
398  // Define the values in the Settings object
399  //
400 
401  // try to find the correct path to the .csv file.
402  std::string filename = p.get< std::string > ("CSVFile");
403  std::string csvpath;
404  for(int i = 0; i < 4; ++i) {
405  switch(i) {
406  case 0: csvpath = "./"; break;
407  case 1: csvpath = "./util/"; break;
408  case 2:
409  csvpath = getenv("SRT_PRIVATE_CONTEXT");
410  csvpath += "/OnlineMonitoring/util/";
411  break;
412  case 3:
413  csvpath = getenv("SRT_PUBLIC_CONTEXT");
414  csvpath += "/OnlineMonitoring/util/";
415  break;
416  }
417  csvpath += filename;
418  if(access(csvpath.c_str(), F_OK) != -1) {
419  Settings::Instance().fCSVFile = csvpath;
420  break;
421  }
422  } // end for i
423 
424  std::string d = p.get< std::string > ("Detector");
425  if (d == "NDOS") Settings::Instance().fDet = kNDOS;
426  else if (d == "ND") Settings::Instance().fDet = kNEARDET;
427  else if (d == "FD") Settings::Instance().fDet = kFARDET;
428  else if (d == "TB") Settings::Instance().fDet = kTESTBEAM;
429  else abort();
430 
431  fSHMname = p.get<std::string>("SHMHandle");
432  fuseSHM = p.get<bool >("useSHM");
433 
434  if (fIPC) delete fIPC;
435  if (fuseSHM) fIPC = new OnMonProdIPC(kIPC_SERVER, fSHMname.c_str());
436 
437  bool debug = p.get< bool > ("Debug");
439 
440  fWriteToFile = p.get<bool>("WriteToFile");
441  fTickerOn = p.get<bool>("TickerOn");
442 }
std::string fCSVFile
Definition: Settings.h:17
std::string fSHMname
Shared memory for communication.
const char * p
Definition: xmltok.h:285
bool fWriteToFile
Output histogram file?
void SetDebug(bool debug)
string filename
Definition: shutoffs.py:106
static const int kIPC_SERVER
Definition: IPC.h:23
Detector_t fDet
Definition: Settings.h:18
std::string getenv(std::string const &name)
Float_t d
Definition: plot.C:236
static RawEventUnpacker & Instance()
bool fTickerOn
Turned on in the control room.
OnMonProdIPC * fIPC
Communicates with viewer.
static Settings & Instance()
Definition: Settings.cxx:12
bool fuseSHM
Use SHM to communicate with a viewer?
enum BeamMode string
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

bool OnMonProd::UnpackRawDaqData ( art::Event const &  evt,
daqdataformats::RawEvent rawevt 
)

Definition at line 188 of file OnMonProd_module.cc.

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

Referenced by analyze().

190 {
191  try {
193  evt.getByLabel("daq",flatdaq_handle);
194  if (flatdaq_handle->size()!=1) {
195  std::cerr << "Required to have one and only one flat daq data object"
196  << std::endl;
197  return false;
198  }
199  rawevt.readData((*flatdaq_handle)[0].getRawBufferPointer());
200  return true;
201  }
202  catch (...) {
203  std::cerr << "arf! Bad unpack of flatdaq!" << std::endl;
204  return false;
205  }
206  return false;
207 }
OStream cerr
Definition: OStream.cxx:7
int evt
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

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

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

uint16_t om::OnMonProd::fEndDay
private

Header: day of last processed event (day of the month 1-31)

Definition at line 110 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

double om::OnMonProd::fEndHour
private

Header: hour of last processed event (since midnight 0.0 - 23.99999)

Definition at line 111 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

uint16_t om::OnMonProd::fEndMonth
private

Header: month of last processed event (actual month 1-12)

Definition at line 109 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

unsigned long int om::OnMonProd::fEndNOvATime
private

Header: time of last processed event (in NOvA time - 64 MHz clock ticks)

Definition at line 101 of file OnMonProd_module.cc.

Referenced by analyze(), NewRunNumber(), and NewSubrunNumber().

uint32_t om::OnMonProd::fEndYear
private

Header: year of last processed event (actual years since 0 A.D.)

Definition at line 108 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

int om::OnMonProd::fFirstEvent
private

Header: first event processed.

Definition at line 96 of file OnMonProd_module.cc.

Referenced by analyze(), beginJob(), NewRunNumber(), and NewSubrunNumber().

TTree* om::OnMonProd::fHeader
private

Header object to be written to disk with the histograms.

Definition at line 95 of file OnMonProd_module.cc.

Referenced by beginJob(), endJob(), NewRunNumber(), and NewSubrunNumber().

std::vector<int> om::OnMonProd::fIncompleteEvents
private

Header: a list of incomplete events.

Definition at line 113 of file OnMonProd_module.cc.

Referenced by analyze(), beginJob(), NewRunNumber(), and NewSubrunNumber().

OnMonProdIPC* om::OnMonProd::fIPC
private

Communicates with viewer.

Definition at line 86 of file OnMonProd_module.cc.

Referenced by analyze(), endJob(), and reconfigure().

int om::OnMonProd::fLastEvent
private

Header: last event processed.

Definition at line 97 of file OnMonProd_module.cc.

Referenced by analyze(), beginJob(), NewRunNumber(), and NewSubrunNumber().

unsigned int om::OnMonProd::fLastRun
private

Last run number analyzed.

Definition at line 89 of file OnMonProd_module.cc.

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

unsigned int om::OnMonProd::fLastSubrun
private

Last subrun number analyzed.

Definition at line 90 of file OnMonProd_module.cc.

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

int om::OnMonProd::fNevents
private

Header: number of events processed.

Definition at line 98 of file OnMonProd_module.cc.

Referenced by analyze(), beginJob(), NewRunNumber(), and NewSubrunNumber().

unsigned int om::OnMonProd::fPartition
private

Partition of last event analyzed.

Definition at line 91 of file OnMonProd_module.cc.

Referenced by analyze(), and beginJob().

std::string om::OnMonProd::fSHMname
private

Shared memory for communication.

Definition at line 87 of file OnMonProd_module.cc.

Referenced by NewRunNumber(), NewSubrunNumber(), and reconfigure().

uint16_t om::OnMonProd::fStartDay
private

Header: day of first processed event (day of the month 1-31)

Definition at line 105 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

double om::OnMonProd::fStartHour
private

Header: hour of first processed event (since midnight 0.0 - 23.99999)

Definition at line 106 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

uint16_t om::OnMonProd::fStartMonth
private

Header: month of first processed event (actual month 1-12)

Definition at line 104 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

unsigned long int om::OnMonProd::fStartNOvATime
private

Header: time of first processed event (in NOvA time - 64 MHz clock ticks) - initalized to -1 to make it a HUGE positive number.

Definition at line 100 of file OnMonProd_module.cc.

Referenced by analyze(), NewRunNumber(), and NewSubrunNumber().

uint32_t om::OnMonProd::fStartYear
private

Header: year of first processed event (actual years since 0 A.D.)

Definition at line 103 of file OnMonProd_module.cc.

Referenced by beginJob(), NewRunNumber(), and NewSubrunNumber().

bool om::OnMonProd::fTickerOn
private

Turned on in the control room.

Definition at line 93 of file OnMonProd_module.cc.

Referenced by analyze(), and reconfigure().

bool om::OnMonProd::fuseSHM
private

Use SHM to communicate with a viewer?

Definition at line 88 of file OnMonProd_module.cc.

Referenced by analyze(), NewRunNumber(), NewSubrunNumber(), and reconfigure().

bool om::OnMonProd::fWriteToFile
private

Output histogram file?

Definition at line 92 of file OnMonProd_module.cc.

Referenced by NewRunNumber(), NewSubrunNumber(), and reconfigure().


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