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 
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
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)