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 
14  tree(0), h(0), kount(0) {
15  if (fs.isAvailable()) {
16  h = new HcalTestHistoClass();
17 
18  tree = fs->make<TTree>("HcalTest", "HcalTest");
19  tree->SetAutoSave(10000);
20  tree->Branch("HcalTestHisto", "HcalTestHistoClass", &h);
21  edm::LogInfo("HcalSim") << "HcalTestHistoManager:===>>> Book the Tree";
22  } else {
23  edm::LogInfo("HcalSim") << "HcalTestHistoManager:===>>> No file provided";
24  }
25 }
26 
28 
29  edm::LogInfo("HcalSim") << "============================================="
30  << "========================================\n"
31  << "=== HcalTestHistoManager: Start writing user "
32  << "histograms after " << kount << " events ";
33  if (h) delete h;
34 }
35 
37 
38  kount++;
39  LogDebug("HcalSim") << "HcalTestHistoManager: tree pointer for " << kount
40  << " = " << histos;
41  if (tree) {
42  h = histos;
43  tree->Fill();
44  }
45 }
#define LogDebug(id)
HcalTestHistoManager(const std::string &)
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
HcalTestHistoClass * h
edm::Service< TFileService > fs
bool isAvailable() const
Definition: Service.h:46
Definition: tree.py:1
void fillTree(HcalTestHistoClass *histos)