CMS 3D CMS Logo

HcalTestHistoManager.cc
Go to the documentation of this file.
1 // File: HcalTestHistoManager.cc
3 // Description: Histogram managing class in HcalTestAnalysis (HcalTest)
5 
7 
9 
10 #include <iostream>
11 #include <cmath>
12 
13 //#define EDM_ML_DEBUG
14 
15 HcalTestHistoManager::HcalTestHistoManager(const std::string& file) : 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 }
27 
29  edm::LogVerbatim("HcalSim") << "================================================================="
30  << "====================\n=== HcalTestHistoManager: Start writing user "
31  << "histograms after " << kount_ << " events ";
32 }
33 
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 }
HcalTestHistoManager::fs_
edm::Service< TFileService > fs_
Definition: HcalTestHistoManager.h:30
HcalTestHistoManager::kount_
int kount_
Definition: HcalTestHistoManager.h:33
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
HcalTestHistoManager::HcalTestHistoManager
HcalTestHistoManager(const std::string &)
Definition: HcalTestHistoManager.cc:15
HcalTestHistoManager::tree_
TTree * tree_
Definition: HcalTestHistoManager.h:31
HcalTestHistoClass
Definition: HcalTestHistoClass.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
edm::LogVerbatim
Definition: MessageLogger.h:297
HcalTestHistoManager.h
HcalTestHistoManager::~HcalTestHistoManager
virtual ~HcalTestHistoManager()
Definition: HcalTestHistoManager.cc:28
HcalTestHistoManager::fillTree
void fillTree(HcalTestHistoClass *histos)
Definition: HcalTestHistoManager.cc:34
combine.histos
histos
Definition: combine.py:4
HcalTestHistoManager::h_
std::unique_ptr< HcalTestHistoClass > h_
Definition: HcalTestHistoManager.h:32
PluginManager.h
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64