Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-08 08:16:23

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 "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0006 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0007 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0008 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0009 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
0010 #include "Geometry/HcalTowerAlgo/interface/HcalFlexiHardcodeGeometryLoader.h"
0011 #include "Geometry/HcalTowerAlgo/interface/HcalHardcodeGeometryLoader.h"
0012 #include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h"
0013 #include "DataFormats/HcalDetId/interface/HcalTrigTowerDetId.h"
0014 #include <iostream>
0015 #include <string>
0016 
0017 class HcalCellSizeCheck : public edm::one::EDAnalyzer<> {
0018 public:
0019   explicit HcalCellSizeCheck(const edm::ParameterSet&);
0020   ~HcalCellSizeCheck(void) override {}
0021 
0022   void beginJob() override {}
0023   void analyze(edm::Event const&, edm::EventSetup const&) override;
0024   void endJob() override {}
0025 
0026 private:
0027   edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_ddrec_;
0028   edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tok_htopo_;
0029 };
0030 
0031 HcalCellSizeCheck::HcalCellSizeCheck(const edm::ParameterSet& iConfig) {
0032   tok_ddrec_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>();
0033   tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
0034 }
0035 
0036 void HcalCellSizeCheck::analyze(const edm::Event& /*iEvent*/, const edm::EventSetup& iSetup) {
0037   const HcalDDDRecConstants hcons = iSetup.getData(tok_ddrec_);
0038   const HcalTopology topology = iSetup.getData(tok_htopo_);
0039 
0040   HcalFlexiHardcodeGeometryLoader m_loader;
0041   CaloSubdetectorGeometry* geom = m_loader.load(topology, hcons);
0042 
0043   const std::vector<DetId>& idsb = geom->getValidDetIds(DetId::Hcal, HcalBarrel);
0044   for (auto id : idsb) {
0045     HcalDetId hid(id.rawId());
0046     std::pair<double, double> rz = hcons.getRZ(hid);
0047     edm::LogVerbatim("HCalGeom") << hid << " Front " << rz.first << " Back " << rz.second;
0048   }
0049 
0050   const std::vector<DetId>& idse = geom->getValidDetIds(DetId::Hcal, HcalEndcap);
0051   for (auto id : idse) {
0052     HcalDetId hid(id.rawId());
0053     std::pair<double, double> rz = hcons.getRZ(hid);
0054     edm::LogVerbatim("HCalGeom") << hid << " Front " << rz.first << " Back " << rz.second;
0055   }
0056 }
0057 
0058 DEFINE_FWK_MODULE(HcalCellSizeCheck);