Skip to content

Commit

Permalink
Merge pull request #21919 from bsunanda/Phase2-hgx97
Browse files Browse the repository at this point in the history
Phase2-hgx97 Correct DetId types in validation code
  • Loading branch information
cmsbuild committed Jan 25, 2018
2 parents e61430c + 8b4c49b commit 8f83266
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 55 deletions.
42 changes: 17 additions & 25 deletions Validation/HGCalValidation/plugins/HGCalDigiValidation.cc
Expand Up @@ -14,8 +14,6 @@

#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
#include "DataFormats/ForwardDetId/interface/HGCEEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCHEDetId.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h"
Expand Down Expand Up @@ -163,12 +161,11 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
<< theHGCEEDigiContainers->size()
<< " element(s)";

for (HGCEEDigiCollection::const_iterator it =theHGCEEDigiContainers->begin();
it !=theHGCEEDigiContainers->end(); ++it) {
for (const auto & it: *(theHGCEEDigiContainers.product())) {
ntot++; nused++;
HGCEEDetId detId = (it->id());
HGCalDetId detId = it.id();
int layer = detId.layer();
HGCSample hgcSample = it->sample(SampleIndx_);
HGCSample hgcSample = it.sample(SampleIndx_);
uint16_t gain = hgcSample.toa();
uint16_t adc = hgcSample.data();
double charge = adc*gain;
Expand All @@ -190,12 +187,11 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
<< theHGCHEDigiContainers->size()
<< " element(s)";

for (HGCHEDigiCollection::const_iterator it =theHGCHEDigiContainers->begin();
it !=theHGCHEDigiContainers->end(); ++it) {
for (const auto & it: *(theHGCHEDigiContainers.product())) {
ntot++; nused++;
HGCHEDetId detId = (it->id());
HGCalDetId detId = it.id();
int layer = detId.layer();
HGCSample hgcSample = it->sample(SampleIndx_);
HGCSample hgcSample = it.sample(SampleIndx_);
uint16_t gain = hgcSample.toa();
uint16_t adc = hgcSample.data();
double charge = adc*gain;
Expand All @@ -216,12 +212,11 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
<< theHGCBHDigiContainers->size()
<< " element(s)";

for (HGCBHDigiCollection::const_iterator it =theHGCBHDigiContainers->begin();
it !=theHGCBHDigiContainers->end(); ++it) {
for (const auto & it: *(theHGCBHDigiContainers.product())) {
ntot++; nused++;
HcalDetId detId = (it->id());
HcalDetId detId = it.id();
int layer = detId.depth();
HGCSample hgcSample = it->sample(SampleIndx_);
HGCSample hgcSample = it.sample(SampleIndx_);
uint16_t gain = hgcSample.toa();
uint16_t adc = hgcSample.data();
double charge = adc*gain;
Expand All @@ -244,9 +239,8 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent,
edm::ESHandle<HcalDbService> conditions;
iSetup.get<HcalDbRecord > ().get(conditions);

for (QIE11DigiCollection::const_iterator it =theHEDigiContainers->begin();
it !=theHEDigiContainers->end(); ++it) {
QIE11DataFrame df(*it);
for (const auto & it: *(theHEDigiContainers.product())) {
QIE11DataFrame df(it);
HcalDetId detId = (df.id());
ntot++;
if (detId.subdet() == HcalEndcap) {
Expand Down Expand Up @@ -323,16 +317,14 @@ void HGCalDigiValidation::fillDigiInfo(digiInfo& hinfo) {
}

void HGCalDigiValidation::fillDigiInfo() {
for (auto itr = OccupancyMap_plus_.begin();
itr != OccupancyMap_plus_.end(); ++itr) {
int layer = (*itr).first;
int occupancy = (*itr).second;
for (const auto & itr : OccupancyMap_plus_) {
int layer = itr.first;
int occupancy = itr.second;
DigiOccupancy_Plus_.at(layer)->Fill(occupancy);
}
for (auto itr = OccupancyMap_minus_.begin();
itr != OccupancyMap_minus_.end(); ++itr) {
int layer = (*itr).first;
int occupancy = (*itr).second;
for (const auto & itr : OccupancyMap_minus_) {
int layer = itr.first;
int occupancy = itr.second;
DigiOccupancy_Minus_.at(layer)->Fill(occupancy);
}
}
Expand Down
6 changes: 2 additions & 4 deletions Validation/HGCalValidation/plugins/HGCalHitCalibration.cc
Expand Up @@ -12,8 +12,6 @@

#include "DQMServices/Core/interface/MonitorElement.h"

#include "DataFormats/ForwardDetId/interface/HGCEEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCHEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"
#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"

Expand Down Expand Up @@ -279,8 +277,8 @@ void HGCalHitCalibration::analyze(const edm::Event& iEvent,
// dump raw RecHits and match
if (rawRecHits_) {
if ((hitid.det() == DetId::Forward &&
(hitid.subdetId() == HGCEE or hitid.subdetId() == HGCHEF or
hitid.subdetId() == HGCHEB)) ||
(hitid.subdetId() == HGCEE || hitid.subdetId() == HGCHEF ||
hitid.subdetId() == HGCHEB)) ||
(hitid.det() == DetId::Hcal && hitid.subdetId() == HcalEndcap))
fillWithRecHits(hitmap, hitid, hitlayer, it_haf.second, seedDet,
seedEnergy);
Expand Down
23 changes: 10 additions & 13 deletions Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc
Expand Up @@ -143,14 +143,13 @@ void HGCalRecHitValidation::analyze(const edm::Event& iEvent,
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< hbhecoll->size()
<< " element(s)";
for (HBHERecHitCollection::const_iterator it=hbhecoll->begin();
it != hbhecoll->end(); ++it) {
DetId detId = it->id();
for (const auto & it : *(hbhecoll.product())) {
DetId detId = it.id();
ntot++;
if (detId.subdetId() == HcalEndcap) {
nused++;
int layer = HcalDetId(detId).depth();
recHitValidation(detId, layer, geom0, it);
recHitValidation(detId, layer, geom0, &it);
}
}
} else {
Expand All @@ -165,12 +164,11 @@ void HGCalRecHitValidation::analyze(const edm::Event& iEvent,
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< hbhecoll->size()
<< " element(s)";
for (HGChebRecHitCollection::const_iterator it=hbhecoll->begin();
it != hbhecoll->end(); ++it) {
DetId detId = it->id();
for (const auto & it : *(hbhecoll.product())) {
DetId detId = it.id();
ntot++; nused++;
int layer = HcalDetId(detId).depth();
recHitValidation(detId, layer, geom0, it);
recHitValidation(detId, layer, geom0, &it);
}
} else {
ok = false;
Expand All @@ -190,12 +188,11 @@ void HGCalRecHitValidation::analyze(const edm::Event& iEvent,
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< theRecHitContainers->size()
<< " element(s)";
for (HGCRecHitCollection::const_iterator it=theRecHitContainers->begin();
it !=theRecHitContainers->end(); ++it) {
for (const auto & it : *(theRecHitContainers.product())) {
ntot++; nused++;
DetId detId = it->id();
int layer = (detId.subdetId() == HGCEE) ? (HGCEEDetId(detId).layer()) : (HGCHEDetId(detId).layer());
recHitValidation(detId, layer, geom0, it);
DetId detId = it.id();
int layer = HGCalDetId(detId).layer();
recHitValidation(detId, layer, geom0, &it);
}
} else {
ok = false;
Expand Down
2 changes: 0 additions & 2 deletions Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc
Expand Up @@ -12,8 +12,6 @@

#include "DQMServices/Core/interface/MonitorElement.h"

#include "DataFormats/ForwardDetId/interface/HGCEEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCHEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"
#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"

Expand Down
21 changes: 10 additions & 11 deletions Validation/HGCalValidation/test/HGCalRecHitStudy.cc
Expand Up @@ -154,13 +154,13 @@ void HGCalRecHitStudy::analyze(const edm::Event& iEvent,
if (verbosity_>0)
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< hbhecoll->size() << " element(s)";
for (auto it=hbhecoll->begin(); it != hbhecoll->end(); ++it) {
DetId detId = it->id();
for (const auto & it : *(hbhecoll.product())) {
DetId detId = it.id();
ntot++;
if (detId.subdetId() == HcalEndcap) {
nused++;
int layer = HcalDetId(detId).depth();
recHitValidation(detId, layer, geom0, it);
recHitValidation(detId, layer, geom0, &it);
}
}
} else {
Expand All @@ -174,11 +174,11 @@ void HGCalRecHitStudy::analyze(const edm::Event& iEvent,
if (verbosity_>0)
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< hbhecoll->size() << " element(s)";
for (auto it=hbhecoll->begin(); it != hbhecoll->end(); ++it) {
DetId detId = it->id();
for (const auto & it : *(hbhecoll.product())) {
DetId detId = it.id();
ntot++; nused++;
int layer = HcalDetId(detId).depth();
recHitValidation(detId, layer, geom0, it);
recHitValidation(detId, layer, geom0, &it);
}
} else {
ok = false;
Expand All @@ -198,12 +198,11 @@ void HGCalRecHitStudy::analyze(const edm::Event& iEvent,
edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
<< theRecHitContainers->size()
<< " element(s)";
for (auto it=theRecHitContainers->begin();
it !=theRecHitContainers->end(); ++it) {
for (const auto & it : *(theRecHitContainers.product())) {
ntot++; nused++;
DetId detId = it->id();
int layer = (detId.subdetId() == HGCEE) ? (HGCEEDetId(detId).layer()) : (HGCHEDetId(detId).layer());
recHitValidation(detId, layer, geom0, it);
DetId detId = it.id();
int layer = HGCalDetId(detId).layer();
recHitValidation(detId, layer, geom0, &it);
}
} else {
ok = false;
Expand Down

0 comments on commit 8f83266

Please sign in to comment.