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 <cmath>
11 #include <iostream>
12 #include <memory>
13 
14 //#define EDM_ML_DEBUG
15 
16 HcalTestHistoManager::HcalTestHistoManager(const std::string& file) : tree_(nullptr), kount_(0) {
17  if (fs_.isAvailable()) {
18  h_ = std::make_unique<HcalTestHistoClass>();
19 
20  tree_ = fs_->make<TTree>("HcalTest", "HcalTest");
21  tree_->SetAutoSave(10000);
22  tree_->Branch("HcalTestHisto", "HcalTestHistoClass", &h_);
23  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> Book the Tree";
24  } else {
25  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager:===>>> No file provided";
26  }
27 }
28 
30  edm::LogVerbatim("HcalSim") << "================================================================="
31  << "====================\n=== HcalTestHistoManager: Start writing user "
32  << "histograms after " << kount_ << " events ";
33 }
34 
36  ++kount_;
37 #ifdef EDM_ML_DEBUG
38  edm::LogVerbatim("HcalSim") << "HcalTestHistoManager: tree pointer for " << kount_ << " = " << histos;
39 #endif
40  if (tree_) {
41  h_.reset(histos);
42  tree_->Fill();
43  }
44 }
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:16
HcalTestHistoManager::tree_
TTree * tree_
Definition: HcalTestHistoManager.h:31
HcalTestHistoClass
Definition: HcalTestHistoClass.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
HcalTestHistoManager.h
HcalTestHistoManager::~HcalTestHistoManager
virtual ~HcalTestHistoManager()
Definition: HcalTestHistoManager.cc:29
HcalTestHistoManager::fillTree
void fillTree(HcalTestHistoClass *histos)
Definition: HcalTestHistoManager.cc:35
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
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64