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 
10 
11 #include <cmath>
12 #include <iostream>
13 #include <memory>
14 
15 //#define EDM_ML_DEBUG
16 
17 HcalTestHistoManager::HcalTestHistoManager(const std::string& file) : tree_(nullptr), kount_(0) {
19  if (fs.isAvailable()) {
20  h_ = std::make_unique<HcalTestHistoClass>();
21 
22  tree_ = fs->make<TTree>("HcalTest", "HcalTest");
23  tree_->SetAutoSave(10000);
24  tree_->Branch("HcalTestHisto", "HcalTestHistoClass", &h_);
25  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> Book the Tree";
26  } else {
27  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> No file provided";
28  }
29 }
30 
32  edm::LogVerbatim("HcalSim") << "================================================================="
33  << "====================\n=== HcalTestHistoManager: Start writing user "
34  << "histograms after " << kount_ << " events ";
35 }
36 
38  ++kount_;
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager: tree pointer for " << kount_ << " = " << histos;
41 #endif
42  if (tree_) {
43  h_.reset(histos);
44  tree_->Fill();
45  }
46 }
Log< level::Info, true > LogVerbatim
HcalTestHistoManager(const std::string &)
std::unique_ptr< HcalTestHistoClass > h_
histos
Definition: combine.py:4
void fillTree(HcalTestHistoClass *histos)