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 
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(const std::string &)
#define nullptr
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
void fillTree(HcalTestHistoClass *histos)
edm::Service< TFileService > fs_