CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalTestHistoManager.cc
Go to the documentation of this file.
1 // File: HcalTestHistoManager.cc
3 // Description: Histogram managing class in HcalTestAnalysis (HcalTest)
5 
7 
10 
11 #include <cmath>
12 #include <iostream>
13 #include <memory>
14 
15 //#define EDM_ML_DEBUG
16 
18  if (fs_.isAvailable()) {
19  h_ = std::make_unique<HcalTestHistoClass>();
20 
21  tree_ = fs_->make<TTree>("HcalTest", "HcalTest");
22  tree_->SetAutoSave(10000);
23  tree_->Branch("HcalTestHisto", "HcalTestHistoClass", &h_);
24  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> Book the Tree";
25  } else {
26  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> No file provided";
27  }
28 }
29 
31  edm::LogVerbatim("HcalSim") << "================================================================="
32  << "====================\n=== HcalTestHistoManager: Start writing user "
33  << "histograms after " << kount_ << " events ";
34 }
35 
37  ++kount_;
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager: tree pointer for " << kount_ << " = " << histos;
40 #endif
41  if (tree_) {
42  h_.reset(histos);
43  tree_->Fill();
44  }
45 }
Log< level::Info, true > LogVerbatim
kount_(0)
HcalTestHistoManager(const std::string &)
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_