Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jul 21, 2022
1 parent c8c054e commit 6599371
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions RecoLocalCalo/HGCalRecAlgos/test/HGCalRecHitToolsPartialWafer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ HGCalRecHitToolsPartialWafer::HGCalRecHitToolsPartialWafer(const edm::ParameterS
digiToken_(consumes<HGCalDigiCollection>(source_)),
recHitToken_(consumes<HGCRecHitCollection>(source_)),
geomToken_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {
edm::LogVerbatim("HGCalSim") << "Test Hit ID using Digi(1)/RecHit(0): " << checkDigi_ << " for " << nameSense_ << " with module Label: " << source_;
edm::LogVerbatim("HGCalSim") << "Test Hit ID using Digi(1)/RecHit(0): " << checkDigi_ << " for " << nameSense_
<< " with module Label: " << source_;
}

void HGCalRecHitToolsPartialWafer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
Expand All @@ -74,23 +75,29 @@ void HGCalRecHitToolsPartialWafer::fillDescriptions(edm::ConfigurationDescriptio
void HGCalRecHitToolsPartialWafer::analyze(const edm::Event& e, const edm::EventSetup& iS) {
// get HGCal geometry constant
const CaloGeometry geo = iS.getData(geomToken_);
const HGCalGeometry* geom = (nameSense_ == "HGCalEESensitive") ? static_cast<const HGCalGeometry*>(geo.getSubdetectorGeometry(DetId::HGCalEE, ForwardSubdetector::ForwardEmpty)) : static_cast<const HGCalGeometry*>(geo.getSubdetectorGeometry(DetId::HGCalHSi, ForwardSubdetector::ForwardEmpty));
const HGCalGeometry* geom = (nameSense_ == "HGCalEESensitive")
? static_cast<const HGCalGeometry*>(
geo.getSubdetectorGeometry(DetId::HGCalEE, ForwardSubdetector::ForwardEmpty))
: static_cast<const HGCalGeometry*>(
geo.getSubdetectorGeometry(DetId::HGCalHSi, ForwardSubdetector::ForwardEmpty));
//Setup the tool
tool_.setGeometry(geo);

// get the hit collection
if (checkDigi_) {
const auto& collection = e.getHandle(digiToken_);
if (collection.isValid()) {
edm::LogVerbatim("HGCalSim") << "HGCalRecHitToolsPartialWafer: Finds Digi Collection for " << nameSense_ << " with " << collection->size() << " hits";
edm::LogVerbatim("HGCalSim") << "HGCalRecHitToolsPartialWafer: Finds Digi Collection for " << nameSense_
<< " with " << collection->size() << " hits";
analyze(*(collection.product()), geom);
} else {
edm::LogVerbatim("HGCalSim") << "HGCalRecHitToolsPartialWafer: Cannot find Digi collection for " << nameSense_;
}
} else {
const auto& collection = e.getHandle(recHitToken_);
if (collection.isValid()) {
edm::LogVerbatim("HGCalSim") << "HGCalRecHitToolsPartialWafer: Finds RecHit Collection for " << nameSense_ << " with " << collection->size() << " hits";
edm::LogVerbatim("HGCalSim") << "HGCalRecHitToolsPartialWafer: Finds RecHit Collection for " << nameSense_
<< " with " << collection->size() << " hits";
analyze(*(collection.product()), geom);
} else {
edm::LogVerbatim("HGCalSim") << "HGCalRecHitToolsPartialWafer: Cannot find RecHit collection for " << nameSense_;
Expand All @@ -114,14 +121,14 @@ void HGCalRecHitToolsPartialWafer::analyze(const T& collection, const HGCalGeome
const auto& info = hgc.waferInfo(hid.layer(), hid.waferU(), hid.waferV());
// Only partial wafers
if (info.part != HGCalTypes::WaferFull) {
++good;
GlobalPoint pos1 = geom->getPosition(id);
GlobalPoint pos2 = tool_.getPosition(id);
edm::LogVerbatim("HGCalSim") << "Hit[" << all << ":" << allSi << ":" << good << "]" << HGCSiliconDetId(id)
<< " Wafer Type:Part:Orient:Cassette " << info.type << ":" << info.part << ":"
<< info.orient << ":" << info.cassette << " at (" << pos1.x() << ", "
<< pos1.y() << ", " << pos1.z() << ") or (" << pos2.x() << ", " << pos2.y()
<< ", " << pos2.z() << ")";
++good;
GlobalPoint pos1 = geom->getPosition(id);
GlobalPoint pos2 = tool_.getPosition(id);
edm::LogVerbatim("HGCalSim") << "Hit[" << all << ":" << allSi << ":" << good << "]" << HGCSiliconDetId(id)
<< " Wafer Type:Part:Orient:Cassette " << info.type << ":" << info.part << ":"
<< info.orient << ":" << info.cassette << " at (" << pos1.x() << ", " << pos1.y()
<< ", " << pos1.z() << ") or (" << pos2.x() << ", " << pos2.y() << ", " << pos2.z()
<< ")";
}
}
}
Expand Down

0 comments on commit 6599371

Please sign in to comment.