46 for (
unsigned i = 0;
i < 5; ++
i) {
47 if (nChannels_[
i] == 0)
69 std::vector<MonitorElement *> hcalMEs;
74 std::vector<std::string> fullPathHLTFolders = igetter.
getSubdirs();
75 for (
unsigned int i = 0;
i < fullPathHLTFolders.size();
i++) {
77 std::cout <<
"\nfullPath: " << fullPathHLTFolders[
i] << std::endl;
80 std::vector<std::string> fullSubPathHLTFolders = igetter.
getSubdirs();
81 for (
unsigned int j = 0; j < fullSubPathHLTFolders.size(); j++) {
83 std::cout <<
"fullSub: " << fullSubPathHLTFolders[j] << std::endl;
85 if (strcmp(fullSubPathHLTFolders[j].c_str(),
"HcalRecHitsD/HcalRecHitTask") == 0) {
86 hcalMEs = igetter.
getContents(fullSubPathHLTFolders[j]);
88 std::cout <<
"hltMES size : " << hcalMEs.size() << std::endl;
90 std::cout <<
"\nError in HcalRecHitsEndjob!" << std::endl << std::endl;
104 std::vector<MonitorElement *> emap_depths;
108 std::vector<MonitorElement *> occupancy_maps;
109 std::vector<std::string> occupancyID;
113 std::vector<MonitorElement *> emean_vs_ieta;
118 std::vector<MonitorElement *> occupancy_vs_ieta;
119 std::vector<std::string> occupancy_vs_ietaID;
123 std::vector<MonitorElement *> RecHit_StatusWord;
124 std::vector<float> RecHit_StatusWord_Channels;
125 std::vector<MonitorElement *> RecHit_Aux_StatusWord;
126 std::vector<float> RecHit_Aux_StatusWord_Channels;
128 for (
unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
131 if (hcalMEs[ih]->
getName() ==
"N_HF") {
142 if (hcalMEs[ih]->
getName().find(
"emap_depth") != std::string::npos) {
143 emap_depths.push_back(hcalMEs[ih]);
147 if (hcalMEs[ih]->
getName().
find(
"occupancy_map_H") != std::string::npos) {
148 occupancy_maps.push_back(hcalMEs[ih]);
159 occupancyID.push_back(hcalMEs[ih]->
getName().substr(prefix.size()));
164 if (hcalMEs[ih]->
getName().find(
"emean_vs_ieta_H") != std::string::npos) {
165 emean_vs_ieta.push_back(hcalMEs[ih]);
169 if (hcalMEs[ih]->
getName().
find(
"occupancy_vs_ieta_H") != std::string::npos) {
170 occupancy_vs_ieta.push_back(hcalMEs[ih]);
181 occupancy_vs_ietaID.push_back(hcalMEs[ih]->
getName().substr(prefix.size()));
186 if (hcalMEs[ih]->
getName().find(
"HcalRecHitTask_RecHit_StatusWord_H") != std::string::npos) {
187 RecHit_StatusWord.push_back(hcalMEs[ih]);
189 if (hcalMEs[ih]->
getName().
find(
"HB") != std::string::npos) {
190 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[1]);
191 }
else if (hcalMEs[ih]->
getName().
find(
"HE") != std::string::npos) {
192 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[2]);
193 }
else if (hcalMEs[ih]->
getName().
find(
"H0") != std::string::npos) {
194 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[3]);
195 }
else if (hcalMEs[ih]->
getName().
find(
"HF") != std::string::npos) {
196 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[4]);
198 RecHit_StatusWord_Channels.push_back(1.);
204 if (hcalMEs[ih]->
getName().
find(
"HcalRecHitTask_RecHit_Aux_StatusWord_H") != std::string::npos) {
205 RecHit_Aux_StatusWord.push_back(hcalMEs[ih]);
207 if (hcalMEs[ih]->
getName().
find(
"HB") != std::string::npos) {
208 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[1]);
209 }
else if (hcalMEs[ih]->
getName().
find(
"HE") != std::string::npos) {
210 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[2]);
211 }
else if (hcalMEs[ih]->
getName().
find(
"H0") != std::string::npos) {
212 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[3]);
213 }
else if (hcalMEs[ih]->
getName().
find(
"HF") != std::string::npos) {
214 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[4]);
216 RecHit_Aux_StatusWord_Channels.push_back(1.);
229 std::cout <<
"nevtot : " << nevtot << std::endl;
232 float fev =
float(nevtot);
233 double scaleBynevtot = 1 / fev;
237 for (
unsigned int depthIdx = 0; depthIdx < emap_depths.size(); depthIdx++) {
238 int nx = emap_depths[depthIdx]->getNbinsX();
239 int ny = emap_depths[depthIdx]->getNbinsY();
244 for (
int i = 1;
i <= nx;
i++) {
245 for (
int j = 1; j <= ny; j++) {
246 cnorm = emap_depths[depthIdx]->getBinContent(
i, j) * scaleBynevtot;
247 enorm = emap_depths[depthIdx]->getBinError(
i, j) * scaleBynevtot;
248 emap_depths[depthIdx]->setBinContent(
i, j, cnorm);
249 emap_depths[depthIdx]->setBinError(
i, j, enorm);
256 bool omatched =
false;
258 for (
unsigned int occupancyIdx = 0; occupancyIdx < occupancy_maps.size(); occupancyIdx++) {
259 int nx = occupancy_maps[occupancyIdx]->getNbinsX();
260 int ny = occupancy_maps[occupancyIdx]->getNbinsY();
265 unsigned int vsIetaIdx = occupancy_vs_ieta.size();
268 for (vsIetaIdx = 0; vsIetaIdx < occupancy_vs_ieta.size(); vsIetaIdx++) {
269 if (occupancyID[occupancyIdx] == occupancy_vs_ietaID[vsIetaIdx]) {
275 for (
int i = 1;
i <= nx;
i++) {
276 for (
int j = 1; j <= ny; j++) {
277 cnorm = occupancy_maps[occupancyIdx]->getBinContent(
i, j) * scaleBynevtot;
278 enorm = occupancy_maps[occupancyIdx]->getBinError(
i, j) * scaleBynevtot;
279 occupancy_maps[occupancyIdx]->setBinContent(
i, j, cnorm);
280 occupancy_maps[occupancyIdx]->setBinError(
i, j, enorm);
288 for (
int ieta = -41; ieta <= 41; ieta++) {
289 float phi_factor = 1.;
299 for (
int iphi = 0; iphi <= 71; iphi++) {
300 int binIeta = occupancy_maps[occupancyIdx]->getTH2F()->GetXaxis()->FindBin(
float(ieta));
301 int binIphi = occupancy_maps[occupancyIdx]->getTH2F()->GetYaxis()->FindBin(
float(iphi));
303 float content = occupancy_maps[occupancyIdx]->getBinContent(binIeta, binIphi);
304 float econtent = occupancy_maps[occupancyIdx]->getBinError(binIeta, binIphi);
307 sumphie += econtent * econtent;
310 int ietabin = occupancy_vs_ieta[vsIetaIdx]->getTH1F()->GetXaxis()->FindBin(
float(ieta));
313 cnorm = sumphi / phi_factor;
314 enorm =
sqrt(sumphie) / phi_factor;
315 occupancy_vs_ieta[vsIetaIdx]->setBinContent(ietabin, cnorm);
316 occupancy_vs_ieta[vsIetaIdx]->setBinError(ietabin, enorm);
326 for (
unsigned int StatusWordIdx = 0; StatusWordIdx < RecHit_StatusWord.size(); StatusWordIdx++) {
327 int nx = RecHit_StatusWord[StatusWordIdx]->getNbinsX();
332 for (
int i = 1;
i <= nx;
i++) {
333 cnorm = RecHit_StatusWord[StatusWordIdx]->getBinContent(
i) * scaleBynevtot /
334 RecHit_StatusWord_Channels[StatusWordIdx];
336 RecHit_StatusWord[StatusWordIdx]->getBinError(
i) * scaleBynevtot / RecHit_StatusWord_Channels[StatusWordIdx];
337 RecHit_StatusWord[StatusWordIdx]->setBinContent(
i, cnorm);
338 RecHit_StatusWord[StatusWordIdx]->setBinError(
i, enorm);
342 for (
unsigned int AuxStatusWordIdx = 0; AuxStatusWordIdx < RecHit_Aux_StatusWord.size(); AuxStatusWordIdx++) {
343 int nx = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getNbinsX();
348 for (
int i = 1;
i <= nx;
i++) {
349 cnorm = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getBinContent(
i) * scaleBynevtot /
350 RecHit_Aux_StatusWord_Channels[AuxStatusWordIdx];
351 enorm = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getBinError(
i) * scaleBynevtot /
352 RecHit_Aux_StatusWord_Channels[AuxStatusWordIdx];
353 RecHit_Aux_StatusWord[AuxStatusWordIdx]->setBinContent(
i, cnorm);
354 RecHit_Aux_StatusWord[AuxStatusWordIdx]->setBinError(
i, enorm);
364 if (ieta >= -20 && ieta <= 20) {
367 if (ieta >= 40 || ieta <= -40) {
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const HcalDDDRecConstants * hcons
void setCurrentFolder(std::string const &fullpath)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void beginJob(void) override
float phifactor(int ieta)
#define DEFINE_FWK_MODULE(type)
int HcalRecHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
std::vector< MonitorElement * > getContents(Args &&...args)
TString getName(TString structure, int layer, TString geometry)
double getEntries() const
get # of entries
int getMaxDepth(const int &type) const
HcalRecHitsDQMClient(const edm::ParameterSet &)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
ESHandle< TrackerGeometry > geometry
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< std::string > getSubdirs()
~HcalRecHitsDQMClient() override