File indexing completed on 2024-04-06 12:15:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <fstream>
0022 #include <iostream>
0023 #include <memory>
0024 #include <string>
0025 #include <vector>
0026
0027
0028 #include "FWCore/Framework/interface/Frameworkfwd.h"
0029 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0030 #include "FWCore/Framework/interface/Event.h"
0031 #include "FWCore/Framework/interface/EventSetup.h"
0032 #include "FWCore/Framework/interface/MakerMacros.h"
0033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0034 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0035 #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"
0036 #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"
0037 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0038
0039 class HGCalWaferCheck : public edm::one::EDAnalyzer<> {
0040 public:
0041 explicit HGCalWaferCheck(const edm::ParameterSet&);
0042 ~HGCalWaferCheck() override;
0043
0044 void beginJob() override {}
0045 void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0046 void endJob() override {}
0047
0048 private:
0049 const std::string nameSense_, nameDetector_;
0050 const bool reco_;
0051 const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> dddToken_;
0052 const edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> geomToken_;
0053 };
0054
0055 HGCalWaferCheck::HGCalWaferCheck(const edm::ParameterSet& iC)
0056 : nameSense_(iC.getParameter<std::string>("NameSense")),
0057 nameDetector_(iC.getParameter<std::string>("NameDevice")),
0058 reco_(iC.getParameter<bool>("Reco")),
0059 dddToken_(esConsumes<HGCalDDDConstants, IdealGeometryRecord>(edm::ESInputTag{"", nameSense_})),
0060 geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameSense_})) {
0061 edm::LogVerbatim("HGCalGeomX") << "Test numbering for " << nameDetector_ << " using constants of " << nameSense_
0062 << " for RecoFlag " << reco_;
0063 }
0064
0065 HGCalWaferCheck::~HGCalWaferCheck() {}
0066
0067
0068 void HGCalWaferCheck::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0069 const HGCalDDDConstants& hgdc = iSetup.getData(dddToken_);
0070 const auto& geomR = iSetup.getData(geomToken_);
0071 const HGCalGeometry* geom = &geomR;
0072 edm::LogVerbatim("HGCalGeomX") << nameDetector_ << " Layers = " << hgdc.layers(reco_)
0073 << " Sectors = " << hgdc.sectors() << " Valid Cells " << geomR.getValidDetIds().size()
0074 << " Valid Geometry Cells " << geomR.getValidGeomDetIds().size();
0075 if (hgdc.waferHexagon8()) {
0076 DetId::Detector det = (nameSense_ == "HGCalHESiliconSensitive") ? DetId::HGCalHSi : DetId::HGCalEE;
0077 for (int layer = 1; layer <= 2; ++layer) {
0078 for (int waferU = -12; waferU <= 12; ++waferU) {
0079 int waferV(0);
0080 int type = hgdc.waferType(layer, waferU, waferV, false);
0081 int cell = (type == 0) ? 12 : 8;
0082 HGCSiliconDetId id1(det, 1, type, layer, waferU, waferV, cell, cell);
0083 if (geom->topology().valid(id1))
0084 edm::LogVerbatim("HGCalGeomX") << " ID: " << id1 << " Position " << geom->getPosition(id1);
0085 HGCSiliconDetId id2(det, -1, type, layer, waferU, waferV, cell, cell);
0086 if (geom->topology().valid(id2))
0087 edm::LogVerbatim("HGCalGeomX") << " ID: " << id2 << " Position " << geom->getPosition(id2);
0088 }
0089 for (int waferV = -12; waferV <= 12; ++waferV) {
0090 int waferU(0);
0091 int type = hgdc.waferType(layer, waferU, waferV, false);
0092 int cell = (type == 0) ? 12 : 8;
0093 HGCSiliconDetId id1(det, 1, type, layer, waferU, waferV, cell, cell);
0094 if (geom->topology().valid(id1))
0095 edm::LogVerbatim("HGCalGeomX") << " ID: " << id1 << " Position " << geom->getPosition(id1);
0096 HGCSiliconDetId id2(det, -1, type, layer, waferU, waferV, cell, cell);
0097 if (geom->topology().valid(id2))
0098 edm::LogVerbatim("HGCalGeomX") << " ID: " << id2 << " Position " << geom->getPosition(id2);
0099 }
0100 }
0101 }
0102 }
0103
0104
0105 DEFINE_FWK_MODULE(HGCalWaferCheck);