CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
fwlite::AnalyzerWrapper< T > Class Template Reference

#include <FWLiteAnalyzerWrapper.h>

Public Member Functions

virtual void analyze ()
 everything which has to be done during the event loop. NOTE: the event will be looped inside this function More...
 
 AnalyzerWrapper (const edm::ParameterSet &cfg, std::string analyzerName, std::string directory="")
 default constructor More...
 
virtual void beginJob ()
 everything which has to be done before the event loop More...
 
virtual void endJob ()
 everything which has to be done after the event loop More...
 
virtual ~AnalyzerWrapper ()
 default destructor More...
 

Protected Attributes

std::shared_ptr< Tanalyzer_
 derived class of type BasicAnalyzer More...
 
fwlite::TFileService fileService_
 TFileService for histogram management. More...
 
fwlite::InputSource inputHandler_
 helper class for input parameter handling More...
 
int maxEvents_
 maximal number of events to be processed (-1 means to loop over all event) More...
 
fwlite::OutputFiles outputHandler_
 helper class for output file handling More...
 
unsigned int reportAfter_
 number of events after which the progress will be reported (0 means no report) More...
 

Detailed Description

template<class T>
class fwlite::AnalyzerWrapper< T >

Definition at line 101 of file FWLiteAnalyzerWrapper.h.

Constructor & Destructor Documentation

◆ AnalyzerWrapper()

template<class T >
fwlite::AnalyzerWrapper< T >::AnalyzerWrapper ( const edm::ParameterSet cfg,
std::string  analyzerName,
std::string  directory = "" 
)

default constructor

default contructor

Definition at line 131 of file FWLiteAnalyzerWrapper.h.

132  : inputHandler_(cfg),
137  // analysis specific parameters
138  const edm::ParameterSet& ana = cfg.getParameter<edm::ParameterSet>(analyzerName.c_str());
139  if (directory.empty()) {
140  // create analysis class of type BasicAnalyzer
141  analyzer_ = std::shared_ptr<T>(new T(ana, fileService_));
142  } else {
143  // create a directory in the file if directory string is non empty
145  analyzer_ = std::shared_ptr<T>(new T(ana, dir));
146  }
147  }

References fwlite::AnalyzerWrapper< T >::analyzer_, cosmicPhotonAnalyzer_cfi::analyzerName, looper::cfg, DeadROC_duringRun::dir, createBeamHaloJobs::directory, fwlite::AnalyzerWrapper< T >::fileService_, and TFileDirectory::mkdir().

◆ ~AnalyzerWrapper()

template<class T >
virtual fwlite::AnalyzerWrapper< T >::~AnalyzerWrapper ( )
inlinevirtual

default destructor

Definition at line 106 of file FWLiteAnalyzerWrapper.h.

106 {};

Member Function Documentation

◆ analyze()

template<class T >
void fwlite::AnalyzerWrapper< T >::analyze ( )
virtual

everything which has to be done during the event loop. NOTE: the event will be looped inside this function

Definition at line 151 of file FWLiteAnalyzerWrapper.h.

151  {
152  int ievt = 0;
153  std::vector<std::string> const& inputFiles = inputHandler_.files();
154  // loop the vector of input files
156  for (event.toBegin(); !event.atEnd(); ++event, ++ievt) {
157  // break loop if maximal number of events is reached
158  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
159  break;
160  // simple event counter
161  if (reportAfter_ != 0 ? (ievt > 0 && ievt % reportAfter_ == 0) : false)
162  std::cout << " processing event: " << ievt << std::endl;
163  // analyze event
164  analyzer_->analyze(event);
165  }
166  }

References gather_cfg::cout, edmPickEvents::event, and submitPVValidationJobs::inputFiles.

Referenced by main().

◆ beginJob()

template<class T >
virtual void fwlite::AnalyzerWrapper< T >::beginJob ( void  )
inlinevirtual

everything which has to be done before the event loop

Definition at line 108 of file FWLiteAnalyzerWrapper.h.

108 { analyzer_->beginJob(); }

References fwlite::AnalyzerWrapper< T >::analyzer_.

Referenced by main().

◆ endJob()

template<class T >
virtual void fwlite::AnalyzerWrapper< T >::endJob ( void  )
inlinevirtual

everything which has to be done after the event loop

Definition at line 112 of file FWLiteAnalyzerWrapper.h.

112 { analyzer_->endJob(); }

References fwlite::AnalyzerWrapper< T >::analyzer_.

Referenced by main().

Member Data Documentation

◆ analyzer_

template<class T >
std::shared_ptr<T> fwlite::AnalyzerWrapper< T >::analyzer_
protected

◆ fileService_

template<class T >
fwlite::TFileService fwlite::AnalyzerWrapper< T >::fileService_
protected

TFileService for histogram management.

Definition at line 124 of file FWLiteAnalyzerWrapper.h.

Referenced by fwlite::AnalyzerWrapper< T >::AnalyzerWrapper().

◆ inputHandler_

template<class T >
fwlite::InputSource fwlite::AnalyzerWrapper< T >::inputHandler_
protected

helper class for input parameter handling

Definition at line 116 of file FWLiteAnalyzerWrapper.h.

◆ maxEvents_

template<class T >
int fwlite::AnalyzerWrapper< T >::maxEvents_
protected

maximal number of events to be processed (-1 means to loop over all event)

Definition at line 120 of file FWLiteAnalyzerWrapper.h.

◆ outputHandler_

template<class T >
fwlite::OutputFiles fwlite::AnalyzerWrapper< T >::outputHandler_
protected

helper class for output file handling

Definition at line 118 of file FWLiteAnalyzerWrapper.h.

◆ reportAfter_

template<class T >
unsigned int fwlite::AnalyzerWrapper< T >::reportAfter_
protected

number of events after which the progress will be reported (0 means no report)

Definition at line 122 of file FWLiteAnalyzerWrapper.h.

fwlite::AnalyzerWrapper::maxEvents_
int maxEvents_
maximal number of events to be processed (-1 means to loop over all event)
Definition: FWLiteAnalyzerWrapper.h:120
TFileDirectory::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileDirectory.cc:112
fwlite::AnalyzerWrapper::fileService_
fwlite::TFileService fileService_
TFileService for histogram management.
Definition: FWLiteAnalyzerWrapper.h:124
gather_cfg.cout
cout
Definition: gather_cfg.py:144
fwlite::AnalyzerWrapper::inputHandler_
fwlite::InputSource inputHandler_
helper class for input parameter handling
Definition: FWLiteAnalyzerWrapper.h:116
fwlite::AnalyzerWrapper::analyzer_
std::shared_ptr< T > analyzer_
derived class of type BasicAnalyzer
Definition: FWLiteAnalyzerWrapper.h:126
TFileDirectory
Definition: TFileDirectory.h:24
edm::ParameterSet
Definition: ParameterSet.h:47
fwlite::InputSource::maxEvents
int maxEvents() const
return maxEvetns_
Definition: InputSource.h:40
fwlite::InputSource::reportAfter
unsigned int reportAfter() const
return reportAfter_
Definition: InputSource.h:42
edmPickEvents.event
event
Definition: edmPickEvents.py:273
fwlite::AnalyzerWrapper::outputHandler_
fwlite::OutputFiles outputHandler_
helper class for output file handling
Definition: FWLiteAnalyzerWrapper.h:118
looper.cfg
cfg
Definition: looper.py:296
T
long double T
Definition: Basic3DVectorLD.h:48
fwlite::OutputFiles::file
std::string const & file() const
return output fuke name
Definition: OutputFiles.h:27
createBeamHaloJobs.directory
string directory
Definition: createBeamHaloJobs.py:211
fwlite::InputSource::files
const std::vector< std::string > & files() const
return vector of files_
Definition: InputSource.h:38
fwlite::AnalyzerWrapper::reportAfter_
unsigned int reportAfter_
number of events after which the progress will be reported (0 means no report)
Definition: FWLiteAnalyzerWrapper.h:122
submitPVValidationJobs.inputFiles
list inputFiles
Definition: submitPVValidationJobs.py:929
cosmicPhotonAnalyzer_cfi.analyzerName
analyzerName
Definition: cosmicPhotonAnalyzer_cfi.py:7
fwlite::ChainEvent
Definition: ChainEvent.h:46
event
Definition: event.py:1
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23