38 int recHitsEndjob(
const std::vector<MonitorElement *> &hgcalMEs);
42 : nameDetector_(iConfig.getParameter<
std::
string>(
"DetectorName")),
43 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
58 std::vector<MonitorElement *> hgcalMEs;
59 std::vector<std::string> fullDirPath = ig.
getSubdirs();
61 for (
unsigned int i = 0;
i < fullDirPath.size();
i++) {
65 std::vector<std::string> fullSubDirPath = ig.
getSubdirs();
67 for (
unsigned int j = 0;
j < fullSubDirPath.size();
j++) {
71 if (strcmp(fullSubDirPath.at(
j).c_str(), nameDirectory.c_str()) == 0) {
74 edm::LogVerbatim(
"HGCalValidation") <<
"hgcalMES size : " << hgcalMEs.size();
83 std::vector<MonitorElement *> energy_;
84 std::vector<MonitorElement *> EtaPhi_Plus_;
85 std::vector<MonitorElement *> EtaPhi_Minus_;
86 std::vector<MonitorElement *> HitOccupancy_Plus_;
87 std::vector<MonitorElement *> HitOccupancy_Minus_;
88 std::vector<MonitorElement *> MeanHitOccupancy_Plus_;
89 std::vector<MonitorElement *> MeanHitOccupancy_Minus_;
91 std::ostringstream
name;
95 for (
unsigned int ilayer = 0; ilayer <
layers_; ilayer++) {
97 name <<
"energy_layer_" << ilayer;
98 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
99 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
100 energy_.push_back(hgcalMEs[ih]);
105 nevent = energy_.at(ilayer)->getEntries();
106 nbinsx = energy_.at(ilayer)->getNbinsX();
108 double binValue = energy_.at(ilayer)->getBinContent(
i) /
nevent;
109 energy_.at(ilayer)->setBinContent(
i, binValue);
114 name <<
"EtaPhi_Plus_" 115 <<
"layer_" << ilayer;
116 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
117 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
118 EtaPhi_Plus_.push_back(hgcalMEs[ih]);
123 name <<
"EtaPhi_Minus_" 124 <<
"layer_" << ilayer;
125 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
126 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
127 EtaPhi_Minus_.push_back(hgcalMEs[ih]);
132 nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
133 nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
134 nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
137 double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(
i,
j) /
nevent;
138 EtaPhi_Plus_.at(ilayer)->setBinContent(
i,
j, binValue);
142 nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
143 nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
144 nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
147 double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(
i,
j) /
nevent;
148 EtaPhi_Minus_.at(ilayer)->setBinContent(
i,
j, binValue);
154 name <<
"HitOccupancy_Plus_layer_" << ilayer;
155 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
156 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
157 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]);
170 nevent = HitOccupancy_Plus_.at(ilayer)->getEntries();
171 nbinsx = HitOccupancy_Plus_.at(ilayer)->getNbinsX();
173 double binValue = HitOccupancy_Plus_.at(ilayer)->getBinContent(
i) /
nevent;
174 HitOccupancy_Plus_.at(ilayer)->setBinContent(
i, binValue);
177 nevent = HitOccupancy_Minus_.at(ilayer)->getEntries();
178 nbinsx = HitOccupancy_Minus_.at(ilayer)->getNbinsX();
180 double binValue = HitOccupancy_Minus_.at(ilayer)->getBinContent(
i) /
nevent;
181 HitOccupancy_Minus_.at(ilayer)->setBinContent(
i, binValue);
187 name <<
"SUMOfRecHitOccupancy_Plus";
188 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
189 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
190 MeanHitOccupancy_Plus_.push_back(hgcalMEs[ih]);
191 unsigned int indx = MeanHitOccupancy_Plus_.size() - 1;
192 for (
int ilayer = 0; ilayer < static_cast<int>(
layers_); ++ilayer) {
193 double meanVal = HitOccupancy_Plus_.at(ilayer)->getMean();
194 MeanHitOccupancy_Plus_[indx]->setBinContent(ilayer + 1, meanVal);
201 name <<
"SUMOfRecHitOccupancy_Plus";
202 for (
unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
203 if (strcmp(hgcalMEs[ih]->
getName().c_str(),
name.str().c_str()) == 0) {
204 MeanHitOccupancy_Minus_.push_back(hgcalMEs[ih]);
205 unsigned indx = MeanHitOccupancy_Minus_.size() - 1;
206 for (
int ilayer = 0; ilayer < static_cast<int>(
layers_); ++ilayer) {
207 double meanVal = HitOccupancy_Minus_.at(ilayer)->getMean();
208 MeanHitOccupancy_Minus_[indx]->setBinContent(ilayer + 1, meanVal);
Log< level::Info, true > LogVerbatim
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
virtual void setCurrentFolder(std::string const &fullpath)
void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override
int recHitsEndjob(const std::vector< MonitorElement *> &hgcalMEs)
HGCalRecHitsClient(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
unsigned int layers(bool reco) const
const std::string nameDetector_
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
~HGCalRecHitsClient() override=default
std::string getName(const G4String &)
Log< level::Warning, false > LogWarning
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > ddc_token_
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const