Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::GMCJMonitor Class Reference

Simple class to create & update MC job status files and env. vars. This is used to be able to keep track of an MC job status even when all output is suppressed or redirected to /dev/null. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Framework/EventGen/GMCJMonitor.h"

Public Member Functions

 GMCJMonitor (Long_t runnu)
 
 ~GMCJMonitor ()
 
void SetRefreshRate (int rate)
 
void Update (int iev, const EventRecord *event)
 
void CustomizeFilename (string filename)
 

Private Member Functions

void Init (void)
 

Private Attributes

Long_t fRunNu
 run number More...
 
string fStatusFile
 name of output status file More...
 
TStopwatch fWatch
 
double fCpuTime
 total cpu time so far More...
 
int fRefreshRate
 update output every so many events More...
 

Detailed Description

Simple class to create & update MC job status files and env. vars. This is used to be able to keep track of an MC job status even when all output is suppressed or redirected to /dev/null.

Author
Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

July 13, 2005

Copyright (c) 2003-2019, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 30 of file GMCJMonitor.h.

Constructor & Destructor Documentation

GMCJMonitor::GMCJMonitor ( Long_t  runnu)

Definition at line 42 of file GMCJMonitor.cxx.

References Init().

42  :
43 fRunNu(runnu)
44 {
45  this->Init();
46 }
Long_t fRunNu
run number
Definition: GMCJMonitor.h:44
GMCJMonitor::~GMCJMonitor ( )

Definition at line 48 of file GMCJMonitor.cxx.

49 {
50 
51 }

Member Function Documentation

void GMCJMonitor::CustomizeFilename ( string  filename)

Definition at line 107 of file GMCJMonitor.cxx.

References shutoffs::filename, and fStatusFile.

Referenced by GenerateEventsAtFixedInitState().

108 {
110 }
string filename
Definition: shutoffs.py:106
string fStatusFile
name of output status file
Definition: GMCJMonitor.h:45
void GMCJMonitor::Init ( void  )
private

Definition at line 86 of file GMCJMonitor.cxx.

References fCpuTime, shutoffs::filename, fRefreshRate, fRunNu, fStatusFile, and fWatch.

Referenced by GMCJMonitor().

87 {
88  // build the filename of the GENIE status file
89  ostringstream filename;
90  filename << "genie-mcjob-" << fRunNu << ".status";
91  fStatusFile = filename.str();
92 
93  // create a stopwatch
94  fWatch.Reset();
95  fWatch.Start();
96  fCpuTime = 0;
97 
98  // get rehreah rate of set default / protect from invalid refresh rates
99  if( gSystem->Getenv("GMCJMONREFRESH") ) {
100  fRefreshRate = atoi( gSystem->Getenv("GMCJMONREFRESH") );
101  } else fRefreshRate = 100;
102 
103  fRefreshRate = TMath::Max(1,fRefreshRate);
104 }
TStopwatch fWatch
Definition: GMCJMonitor.h:46
Long_t fRunNu
run number
Definition: GMCJMonitor.h:44
string filename
Definition: shutoffs.py:106
string fStatusFile
name of output status file
Definition: GMCJMonitor.h:45
double fCpuTime
total cpu time so far
Definition: GMCJMonitor.h:47
int fRefreshRate
update output every so many events
Definition: GMCJMonitor.h:48
void GMCJMonitor::SetRefreshRate ( int  rate)

Definition at line 53 of file GMCJMonitor.cxx.

References fRefreshRate.

Referenced by GenerateEventsAtFixedInitState(), and main().

54 {
55  fRefreshRate = TMath::Max(1,rate);
56 }
int fRefreshRate
update output every so many events
Definition: GMCJMonitor.h:48
void GMCJMonitor::Update ( int  iev,
const EventRecord event 
)

Definition at line 58 of file GMCJMonitor.cxx.

References allTimeWatchdog::endl, fCpuTime, fRefreshRate, fStatusFile, fWatch, confusionMatrixTree::out, and fabricate::status.

Referenced by progbar.ProgressBar::Finish(), GenerateEventsAtFixedInitState(), main(), and progbar.ProgressBar::Start().

59 {
60  if(iev%fRefreshRate) return; // continue only every fRefreshRate events
61 
62  fWatch.Stop();
63  fCpuTime += (fWatch.CpuTime());
64 
65  ofstream out(fStatusFile.c_str(), ios::out);
66 
67  ostringstream status;
68 
69  status << endl;
70  status << "Current Event Number: " << iev << endl;
71 
72  status << "Approximate total processing time: "
73  << fCpuTime << " s" << endl;
74  status << "Approximate processing time/event: "
75  << fCpuTime/(iev+1) << " s" << endl;
76 
77  if(!event) status << "NULL" << endl;
78  else status << *event << endl;
79 
80  out << status.str();
81  out.close();
82 
83  fWatch.Start();
84 }
int iev
Definition: runWimpSim.h:118
TStopwatch fWatch
Definition: GMCJMonitor.h:46
int status
Definition: fabricate.py:1613
string fStatusFile
name of output status file
Definition: GMCJMonitor.h:45
double fCpuTime
total cpu time so far
Definition: GMCJMonitor.h:47
int fRefreshRate
update output every so many events
Definition: GMCJMonitor.h:48

Member Data Documentation

double genie::GMCJMonitor::fCpuTime
private

total cpu time so far

Definition at line 47 of file GMCJMonitor.h.

Referenced by Init(), and Update().

int genie::GMCJMonitor::fRefreshRate
private

update output every so many events

Definition at line 48 of file GMCJMonitor.h.

Referenced by Init(), SetRefreshRate(), and Update().

Long_t genie::GMCJMonitor::fRunNu
private

run number

Definition at line 44 of file GMCJMonitor.h.

Referenced by Init().

string genie::GMCJMonitor::fStatusFile
private

name of output status file

Definition at line 45 of file GMCJMonitor.h.

Referenced by CustomizeFilename(), Init(), and Update().

TStopwatch genie::GMCJMonitor::fWatch
private

Definition at line 46 of file GMCJMonitor.h.

Referenced by Init(), and Update().


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