CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalTestHistoManager Class Reference

#include <HcalTestHistoManager.h>

Public Member Functions

void fillTree (HcalTestHistoClass *histos)
 
 HcalTestHistoManager (const std::string &)
 
virtual ~HcalTestHistoManager ()
 

Private Attributes

edm::Service< TFileServicefs_
 
std::unique_ptr< HcalTestHistoClassh_
 
int kount_
 
TTree * tree_
 

Detailed Description

Definition at line 22 of file HcalTestHistoManager.h.

Constructor & Destructor Documentation

HcalTestHistoManager::HcalTestHistoManager ( const std::string &  file)

Definition at line 15 of file HcalTestHistoManager.cc.

References fs_, h_, edm::Service< T >::isAvailable(), TFileService::make(), and tree_.

15  : tree_(nullptr), kount_(0) {
16  if (fs_.isAvailable()) {
17  h_.reset(new HcalTestHistoClass());
18 
19  tree_ = fs_->make<TTree>("HcalTest", "HcalTest");
20  tree_->SetAutoSave(10000);
21  tree_->Branch("HcalTestHisto", "HcalTestHistoClass", &h_);
22  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> Book the Tree";
23  } else {
24  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> No file provided";
25  }
26 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::unique_ptr< HcalTestHistoClass > h_
bool isAvailable() const
Definition: Service.h:40
edm::Service< TFileService > fs_
HcalTestHistoManager::~HcalTestHistoManager ( )
virtual

Definition at line 28 of file HcalTestHistoManager.cc.

References kount_.

28  {
29  edm::LogVerbatim("HcalSim") << "================================================================="
30  << "====================\n=== HcalTestHistoManager: Start writing user "
31  << "histograms after " << kount_ << " events ";
32 }

Member Function Documentation

void HcalTestHistoManager::fillTree ( HcalTestHistoClass histos)

Definition at line 34 of file HcalTestHistoManager.cc.

References h_, plotFactory::histos, kount_, and tree_.

34  {
35  ++kount_;
36 #ifdef EDM_ML_DEBUG
37  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager: tree pointer for " << kount_ << " = " << histos;
38 #endif
39  if (tree_) {
40  h_.reset(histos);
41  tree_->Fill();
42  }
43 }
std::unique_ptr< HcalTestHistoClass > h_

Member Data Documentation

edm::Service<TFileService> HcalTestHistoManager::fs_
private

Definition at line 30 of file HcalTestHistoManager.h.

Referenced by HcalTestHistoManager().

std::unique_ptr<HcalTestHistoClass> HcalTestHistoManager::h_
private

Definition at line 32 of file HcalTestHistoManager.h.

Referenced by fillTree(), and HcalTestHistoManager().

int HcalTestHistoManager::kount_
private

Definition at line 33 of file HcalTestHistoManager.h.

Referenced by fillTree(), and ~HcalTestHistoManager().

TTree* HcalTestHistoManager::tree_
private

Definition at line 31 of file HcalTestHistoManager.h.

Referenced by fillTree(), and HcalTestHistoManager().