CMS 3D CMS Logo

Classes | Public Member Functions | Private Attributes | Friends

PhysicsTools::TrainerMonitoring Class Reference

#include <TrainerMonitoring.h>

List of all members.

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,
boost::shared_ptr< Module > > 
modules
std::auto_ptr< TFile > rootFile

Friends

class Module

Detailed Description

Definition at line 22 of file TrainerMonitoring.h.


Constructor & Destructor Documentation

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

Definition at line 32 of file TrainerMonitoring.cc.

References rootFile.

{
        ROOTContextSentinel ctx;

        rootFile.reset(TFile::Open(fileName.c_str(), "RECREATE"));
}
PhysicsTools::TrainerMonitoring::~TrainerMonitoring ( )

Definition at line 39 of file TrainerMonitoring.cc.

{
}

Member Function Documentation

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

Definition at line 82 of file TrainerMonitoring.cc.

References module(), and modules.

{
        boost::shared_ptr<Module> module(new Module);
        if (!modules.insert(std::make_pair(name, module)).second)
                throw cms::Exception("DuplicateModule")
                        << "Module \"" << name << "\" already"
                           " exists." << std::endl;

        return module.get();
}
void PhysicsTools::TrainerMonitoring::close ( )
void PhysicsTools::TrainerMonitoring::write ( void  )

Definition at line 43 of file TrainerMonitoring.cc.

References dir, modules, and rootFile.

{
        ROOTContextSentinel ctx;

        typedef std::map<std::string, boost::shared_ptr<Module> > Map;
        for(Map::const_iterator iter = modules.begin();
            iter != modules.end(); ++iter) {
                rootFile->cd();
                TDirectory *dir = rootFile->mkdir(iter->first.c_str());
                dir->cd();
                iter->second->write(dir);
        }
}

Friends And Related Function Documentation

friend class Module [friend]

Definition at line 31 of file TrainerMonitoring.h.


Member Data Documentation

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

Definition at line 181 of file TrainerMonitoring.h.

Referenced by book(), and write().

std::auto_ptr<TFile> PhysicsTools::TrainerMonitoring::rootFile [private]

Definition at line 180 of file TrainerMonitoring.h.

Referenced by TrainerMonitoring(), and write().