Marlin  01.17.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Statusmonitor.cc
Go to the documentation of this file.
1 #include "marlin/Statusmonitor.h"
2 #include <iostream>
3 #include <iomanip>
4 
5 using namespace std;
6 
7 // ----- include for verbosity dependend logging ---------
9 
10 
11 using namespace lcio ;
12 using namespace marlin ;
13 
14 
16 
17 
19 
20  // modify processor description
21  _description = "Statusmonitor prints out information on running Marlin Job: Prints number of runs run and current number of the event. Counting is sequential and not the run or event ID." ;
22 
23  registerProcessorParameter("HowOften",
24  "Print the event number every N events",
25  _howOften,
26  int(10000) ) ;
27 
28 
29 }
30 
31 
33  streamlog_out(DEBUG) << "INIT CALLED " << std::endl ;
34 
35  // usually a good idea to
36  printParameters() ;
37 
38  _nRun = 0 ;
39  _nEvt = 0 ;
40 
41 }
42 
43 void Statusmonitor::processRunHeader( LCRunHeader* ) {
44  _nRun++ ;
45 }
46 
47 void Statusmonitor::processEvent( LCEvent * ) {
48 
49  if (_nEvt % _howOften == 0) {
50  streamlog_out(MESSAGE)
51  << " ===== Run : " << std::setw(7) << _nRun
52  << " Event: " << std::setw(7) << _nEvt << endl;
53  }
54  _nEvt ++ ;
55 
56 }
57 
58 
59 
60 void Statusmonitor::check( LCEvent * ) {
61 }
62 
63 
65 
66  streamlog_out(MESSAGE) << "Statusmonitor::end() " << name() << " processed " << _nEvt << " events in " << _nRun << " runs " << std::endl ;
67 
68 }
69 
void registerProcessorParameter(const std::string &parameterName, const std::string &parameterDescription, T &parameter, const T &defaultVal, int setSize=0)
Register a steering variable for this processor - call in constructor of processor.
Definition: Processor.h:254
virtual void processEvent(LCEvent *evt)
Called for every event - the working horse.
virtual const std::string & name() const
Return name of this processor.
Definition: Processor.h:132
T endl(T...args)
virtual void end()
Called after data processing for clean up.
T setw(T...args)
Statusmonitor aStatusmonitor
void printParameters()
Print the parameters and their values depending on the given verbosity level.
Definition: Processor.h:156
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
virtual void init()
Called at the begin of the job before anything is read.
Base class for Marlin processors.
Definition: Processor.h:64
std::string _description
Describes what the processor does.
Definition: Processor.h:452
virtual void check(LCEvent *evt)
Called for every event - right after processEvent() has been called for this processor.
Simple processor for writing out a status message every n-th event.
Definition: Statusmonitor.h:22