|
| 1 | +// -*- C++ -*- |
| 2 | +// |
| 3 | +// Package: HGCalWaferInfo |
| 4 | +// Class: HGCalWaferInfo |
| 5 | +// |
| 6 | +/**\class HGCalWaferInfo HGCalWaferInfo.cc |
| 7 | + test/HGCalWaferInfo.cc |
| 8 | +
|
| 9 | + Description: <one line class summary> |
| 10 | +
|
| 11 | + Implementation: |
| 12 | + <Notes on implementation> |
| 13 | +*/ |
| 14 | +// |
| 15 | +// Original Author: Sunanda Banerjee |
| 16 | +// Created: Mon 2025/05/02 |
| 17 | +// |
| 18 | +// |
| 19 | + |
| 20 | +// system include files |
| 21 | +#include <fstream> |
| 22 | +#include <iostream> |
| 23 | +#include <memory> |
| 24 | +#include <string> |
| 25 | +#include <vector> |
| 26 | + |
| 27 | +// user include files |
| 28 | +#include "FWCore/Framework/interface/Frameworkfwd.h" |
| 29 | +#include "FWCore/Framework/interface/one/EDAnalyzer.h" |
| 30 | +#include "FWCore/Framework/interface/Event.h" |
| 31 | +#include "FWCore/Framework/interface/EventSetup.h" |
| 32 | +#include "FWCore/Framework/interface/MakerMacros.h" |
| 33 | +#include "FWCore/MessageLogger/interface/MessageLogger.h" |
| 34 | +#include "FWCore/ParameterSet/interface/ParameterSet.h" |
| 35 | +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" |
| 36 | + |
| 37 | +#include "DataFormats/DetId/interface/DetId.h" |
| 38 | +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" |
| 39 | +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" |
| 40 | +#include "Geometry/Records/interface/IdealGeometryRecord.h" |
| 41 | + |
| 42 | +class HGCalWaferInfo : public edm::one::EDAnalyzer<> { |
| 43 | +public: |
| 44 | + explicit HGCalWaferInfo(const edm::ParameterSet&); |
| 45 | + ~HGCalWaferInfo() override = default; |
| 46 | + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); |
| 47 | + |
| 48 | + void beginJob() override {} |
| 49 | + void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; |
| 50 | + void endJob() override {} |
| 51 | + |
| 52 | +private: |
| 53 | + const std::string name_; |
| 54 | + const edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> geomToken_; |
| 55 | +}; |
| 56 | + |
| 57 | +HGCalWaferInfo::HGCalWaferInfo(const edm::ParameterSet& iC) |
| 58 | + : name_(iC.getParameter<std::string>("detector")), |
| 59 | + geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag("", name_))) {} |
| 60 | + |
| 61 | +void HGCalWaferInfo::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { |
| 62 | + edm::ParameterSetDescription desc; |
| 63 | + desc.add<std::string>("detector", "HGCalEESensitive"); |
| 64 | + descriptions.add("hgcalWaferInfoEE", desc); |
| 65 | +} |
| 66 | + |
| 67 | +// ------------ method called to produce the data ------------ |
| 68 | +void HGCalWaferInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { |
| 69 | + const auto& geom = &iSetup.getData(geomToken_); |
| 70 | + DetId::Detector det = (name_ == "HGCalHESiliconSensitive") ? DetId::HGCalHSi : DetId::HGCalEE; |
| 71 | + edm::LogVerbatim("HGCalGeom") << "Perform test for " << name_ << " Detector " << det; |
| 72 | + |
| 73 | + const std::vector<DetId>& ids = geom->getValidDetIds(); |
| 74 | + edm::LogVerbatim("HGCalGeom") << "Use " << ids.size() << " valid ids for " << geom->cellElement(); |
| 75 | + std::string parts[26] = {"Full", "Five", "ChopTwo", "ChopTwoM", "Half", "Semi", |
| 76 | + "Semi2", "Three", "Half2", "Five2", "????", "LDTop", |
| 77 | + "LDBottom", "LDLeft", "LDRight", "LDFive", "LDThree", |
| 78 | + "????", "????", "????", "????", "HDTop", "HDBottom", |
| 79 | + "HDLeft", "HDRight", "HDFive"}; |
| 80 | + std::string types[4] = {"HD120", "LD200", "LD300", "HD200"}; |
| 81 | + |
| 82 | + for (auto const& id : ids) { |
| 83 | + if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) { |
| 84 | + HGCSiliconDetId detId(id); |
| 85 | + HGCalParameters::waferInfo info = geom->topology().dddConstants().waferInfo(detId.layer(), detId.waferU(), detId.waferV()); |
| 86 | + edm::LogVerbatim("HGCalGeom") << "ID: " << detId << " Type " << info.type << ":" << types[info.type] << " Part " << info.part << ":" << parts[info.part] << " Orient " << info.orient << " Cassette " << info.cassette << " at " << geom->getPosition(id, true, false); |
| 87 | + } else { |
| 88 | + edm::LogVerbatim("HGCalGeom") << "Illegal Det " << id.det() << " in " << std::hex << id.rawId() << std::dec << " ERROR"; |
| 89 | + } |
| 90 | + } |
| 91 | +} |
| 92 | + |
| 93 | +// define this as a plug-in |
| 94 | +DEFINE_FWK_MODULE(HGCalWaferInfo); |
0 commit comments