File indexing completed on 2024-04-06 12:25:53
0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0007 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0008 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0009 #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h"
0010 #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h"
0011 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0012
0013 #include <vector>
0014
0015 class HGCalTestRecHitTools : public edm::one::EDAnalyzer<> {
0016 public:
0017 explicit HGCalTestRecHitTools(const edm::ParameterSet&);
0018 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0019
0020 void beginJob() override {}
0021 void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0022 void endJob() override {}
0023
0024 private:
0025 const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_;
0026 hgcal::RecHitTools tool_;
0027 };
0028
0029 HGCalTestRecHitTools::HGCalTestRecHitTools(const edm::ParameterSet&)
0030 : tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {}
0031
0032 void HGCalTestRecHitTools::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0033 edm::ParameterSetDescription desc;
0034 descriptions.add("hgcalRecHitTools", desc);
0035 }
0036
0037 void HGCalTestRecHitTools::analyze(const edm::Event& , const edm::EventSetup& iSetup) {
0038 const CaloGeometry geo = iSetup.getData(tok_geom_);
0039 tool_.setGeometry(geo);
0040
0041 edm::LogVerbatim("HGCalGeom") << "EE: Last Layer " << tool_.lastLayerEE();
0042 edm::LogVerbatim("HGCalGeom") << "FH: Last Layer " << tool_.lastLayerFH();
0043 edm::LogVerbatim("HGCalGeom") << "BH: First & Last Layer " << tool_.firstLayerBH() << ":" << tool_.lastLayerBH();
0044 edm::LogVerbatim("HGCalGeom") << "Last Layer " << tool_.lastLayer();
0045 std::vector<DetId::Detector> dets = {DetId::HGCalEE, DetId::HGCalHSi, DetId::HGCalHSc};
0046 for (const auto& det : dets) {
0047 auto layer = tool_.firstAndLastLayer(det, 0);
0048 edm::LogVerbatim("HGCalGeom") << "First & Last Layer for Det " << det << " are " << layer.first << ":"
0049 << layer.second;
0050 }
0051
0052 edm::LogVerbatim("HGCalGeom") << "Maximum # of wafers per layer " << tool_.maxNumberOfWafersPerLayer();
0053 edm::LogVerbatim("HGCalGeom") << "Maximum # of iphi: " << tool_.getScintMaxIphi();
0054 edm::LogVerbatim("HGCalGeom") << "Geometry type " << tool_.getGeometryType();
0055 }
0056
0057 DEFINE_FWK_MODULE(HGCalTestRecHitTools);