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) {
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 }
MessageLogger.h
HcalTestHistoManager::fs_
edm::Service< TFileService > fs_
Definition: HcalTestHistoManager.h:30
HcalTestHistoManager::kount_
int kount_
Definition: HcalTestHistoManager.h:33
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
HcalTestHistoManager::HcalTestHistoManager
HcalTestHistoManager(const std::string &)
Definition: HcalTestHistoManager.cc:17
HcalTestHistoManager::tree_
TTree * tree_
Definition: HcalTestHistoManager.h:31
HcalTestHistoClass
Definition: HcalTestHistoClass.h:14
geometryDiff.file
file
Definition: geometryDiff.py:13
HcalTestHistoManager.h
HcalTestHistoManager::~HcalTestHistoManager
virtual ~HcalTestHistoManager()
Definition: HcalTestHistoManager.cc:30
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalTestHistoManager::fillTree
void fillTree(HcalTestHistoClass *histos)
Definition: HcalTestHistoManager.cc:36
combine.histos
histos
Definition: combine.py:4
HcalTestHistoManager::h_
std::unique_ptr< HcalTestHistoClass > h_
Definition: HcalTestHistoManager.h:32
PluginManager.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128