38 int simHitsEndjob(
const std::vector<MonitorElement *> &hgcalMEs);
42 : nameDetector_(iConfig.getParameter<
std::
string>(
"DetectorName")),
43 nTimes_(iConfig.getParameter<
int>(
"TimeSlices")),
44 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
61 std::vector<MonitorElement *> hgcalMEs;
62 std::vector<std::string> fullDirPath = ig.
getSubdirs();
64 for (
unsigned int i = 0;
i < fullDirPath.size();
i++) {
68 std::vector<std::string> fullSubDirPath = ig.
getSubdirs();
70 for (
unsigned int j = 0;
j < fullSubDirPath.size();
j++) {
75 if (strcmp(fullSubDirPath.at(
j).c_str(), nameDirectory.c_str()) == 0) {
78 edm::LogVerbatim(
"HGCalValidation") <<
"hgcalMES size : " << hgcalMEs.size();
87 std::vector<MonitorElement *> energy_[6];
88 std::vector<MonitorElement *> EtaPhi_Plus_, EtaPhi_Minus_;
89 std::vector<MonitorElement *> HitOccupancy_Plus_, HitOccupancy_Minus_;
92 std::ostringstream
name;
95 for (
unsigned int ilayer = 0; ilayer <
layers_; ilayer++) {
96 for (
int itimeslice = 0; itimeslice <
nTimes_; itimeslice++) {
99 name <<
"energy_time_" << itimeslice <<
"_layer_" << ilayer;
100 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
101 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
102 energy_[itimeslice].push_back(hgcalMEs[ih]);
106 nevent = energy_[itimeslice].at(ilayer)->getEntries();
107 nbinsx = energy_[itimeslice].at(ilayer)->getNbinsX();
109 double binValue = energy_[itimeslice].at(ilayer)->getBinContent(
i) /
nevent;
110 energy_[itimeslice].at(ilayer)->setBinContent(
i, binValue);
116 name <<
"EtaPhi_Plus_" 117 <<
"layer_" << ilayer;
118 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
119 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
120 EtaPhi_Plus_.push_back(hgcalMEs[ih]);
125 name <<
"EtaPhi_Minus_" 126 <<
"layer_" << ilayer;
127 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
128 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
129 EtaPhi_Minus_.push_back(hgcalMEs[ih]);
133 nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
134 nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
135 nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
138 double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(
i,
j) /
nevent;
139 EtaPhi_Plus_.at(ilayer)->setBinContent(
i,
j, binValue);
143 nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
144 nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
145 nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
148 double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(
i,
j) /
nevent;
149 EtaPhi_Minus_.at(ilayer)->setBinContent(
i,
j, binValue);
155 name <<
"HitOccupancy_Plus_layer_" << ilayer;
156 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
157 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
158 HitOccupancy_Plus_.push_back(hgcalMEs[ih]);
162 name <<
"HitOccupancy_Minus_layer_" << ilayer;
163 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
164 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
165 HitOccupancy_Minus_.push_back(hgcalMEs[ih]);
169 nevent = HitOccupancy_Plus_.at(ilayer)->getEntries();
170 nbinsx = HitOccupancy_Plus_.at(ilayer)->getNbinsX();
172 double binValue = HitOccupancy_Plus_.at(ilayer)->getBinContent(
i) /
nevent;
173 HitOccupancy_Plus_.at(ilayer)->setBinContent(
i, binValue);
176 nevent = HitOccupancy_Minus_.at(ilayer)->getEntries();
177 nbinsx = HitOccupancy_Minus_.at(ilayer)->getNbinsX();
179 double binValue = HitOccupancy_Minus_.at(ilayer)->getBinContent(
i) /
nevent;
180 HitOccupancy_Minus_.at(ilayer)->setBinContent(
i, binValue);
186 name <<
"MeanHitOccupancy_Plus";
187 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
188 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
189 MeanHitOccupancy_Plus_ = hgcalMEs[ih];
190 for (
int ilayer = 0; ilayer < static_cast<int>(
layers_); ++ilayer) {
191 double meanVal = HitOccupancy_Plus_.at(ilayer)->
getMean();
199 name <<
"MeanHitOccupancy_Minus";
200 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
201 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
202 MeanHitOccupancy_Minus_ = hgcalMEs[ih];
203 for (
int ilayer = 0; ilayer < static_cast<int>(
layers_); ++ilayer) {
204 double meanVal = HitOccupancy_Minus_.at(ilayer)->
getMean();
Log< level::Info, true > LogVerbatim
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
virtual void setCurrentFolder(std::string const &fullpath)
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
int simHitsEndjob(const std::vector< MonitorElement *> &hgcalMEs)
void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
#define DEFINE_FWK_MODULE(type)
unsigned int layers(bool reco) const
HGCalSimHitsClient(const edm::ParameterSet &)
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
std::string getName(const G4String &)
~HGCalSimHitsClient() override=default
const std::string nameDetector_
Log< level::Warning, false > LogWarning
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const