CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes | Friends
PhysicsTools::TrainerMonitoring Class Reference

#include <TrainerMonitoring.h>

Classes

class  Module
 
class  Object
 
class  RootObject
 

Public Member Functions

Modulebook (const std::string &name)
 
void close ()
 
 TrainerMonitoring (const std::string &fileName)
 
void write ()
 
 ~TrainerMonitoring ()
 

Private Attributes

std::map< std::string, std::shared_ptr< Module > > modules
 
std::unique_ptr< TFile > rootFile
 

Friends

class Module
 

Detailed Description

Definition at line 21 of file TrainerMonitoring.h.

Constructor & Destructor Documentation

PhysicsTools::TrainerMonitoring::TrainerMonitoring ( const std::string &  fileName)

Definition at line 30 of file TrainerMonitoring.cc.

References indexGen::rootFile.

31 {
32  ROOTContextSentinel ctx;
33 
34  rootFile.reset(TFile::Open(fileName.c_str(), "RECREATE"));
35 }
std::unique_ptr< TFile > rootFile
PhysicsTools::TrainerMonitoring::~TrainerMonitoring ( )

Definition at line 37 of file TrainerMonitoring.cc.

38 {
39 }

Member Function Documentation

TrainerMonitoring::Module * PhysicsTools::TrainerMonitoring::book ( const std::string &  name)

Definition at line 80 of file TrainerMonitoring.cc.

81 {
82  std::shared_ptr<Module> module(new Module);
83  if (!modules.insert(std::make_pair(name, module)).second)
84  throw cms::Exception("DuplicateModule")
85  << "Module \"" << name << "\" already"
86  " exists." << std::endl;
87 
88  return module.get();
89 }
Definition: vlib.h:208
void PhysicsTools::TrainerMonitoring::close ( )
void PhysicsTools::TrainerMonitoring::write ( )

Definition at line 41 of file TrainerMonitoring.cc.

References dir, and indexGen::rootFile.

42 {
43  ROOTContextSentinel ctx;
44 
45  typedef std::map<std::string, std::shared_ptr<Module> > Map;
46  for(Map::const_iterator iter = modules.begin();
47  iter != modules.end(); ++iter) {
48  rootFile->cd();
49  TDirectory *dir = rootFile->mkdir(iter->first.c_str());
50  dir->cd();
51  iter->second->write(dir);
52  }
53 }
std::unique_ptr< TFile > rootFile
dbl *** dir
Definition: mlp_gen.cc:35

Friends And Related Function Documentation

friend class Module
friend

Definition at line 30 of file TrainerMonitoring.h.

Member Data Documentation

std::map<std::string, std::shared_ptr<Module> > PhysicsTools::TrainerMonitoring::modules
private

Definition at line 180 of file TrainerMonitoring.h.

std::unique_ptr<TFile> PhysicsTools::TrainerMonitoring::rootFile
private

Definition at line 179 of file TrainerMonitoring.h.