File indexing completed on 2024-04-06 12:14:28
0001 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0002 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.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/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0010 #include "Geometry/CaloGeometry/interface/EZArrayFL.h"
0011
0012 #include <iomanip>
0013 #include <iostream>
0014 #include <sstream>
0015
0016 typedef EZArrayFL<GlobalPoint> CornersVec;
0017
0018 class EcalEndcapCellParameterDump : public edm::one::EDAnalyzer<> {
0019 public:
0020 explicit EcalEndcapCellParameterDump(const edm::ParameterSet&);
0021
0022 void beginJob() override {}
0023 void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0024 void endJob() override {}
0025
0026 private:
0027 const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_;
0028 };
0029
0030 EcalEndcapCellParameterDump::EcalEndcapCellParameterDump(const edm::ParameterSet&)
0031 : tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {}
0032
0033 void EcalEndcapCellParameterDump::analyze(const edm::Event& , const edm::EventSetup& iSetup) {
0034 const CaloGeometry* geo = &iSetup.getData(tok_geom_);
0035 const CaloSubdetectorGeometry* ecalGeom =
0036 static_cast<const CaloSubdetectorGeometry*>(geo->getSubdetectorGeometry(DetId::Ecal, EcalEndcap));
0037
0038 edm::LogVerbatim("EcalGeom") << "\n\nStudy Detector = Ecal SubDetector = EE"
0039 << "\n======================================\n";
0040 const std::vector<DetId>& ids = ecalGeom->getValidDetIds(DetId::Ecal, EcalEndcap);
0041 int nall(0);
0042 for (auto id : ids) {
0043 ++nall;
0044 std::shared_ptr<const CaloCellGeometry> geom = ecalGeom->getGeometry(id);
0045 EEDetId ebid(id.rawId());
0046
0047 std::ostringstream st1;
0048 st1 << "IX = " << ebid.ix() << "; IY = " << ebid.iy() << " geom->getPosition " << std::setprecision(4)
0049 << geom->getPosition() << " BackPoint " << geom->getBackPoint() << " [rho,eta:etaSpan,phi:phiSpan] ("
0050 << geom->rhoPos() << ", " << geom->etaPos() << ":" << geom->etaSpan() << ", " << geom->phiPos() << ":"
0051 << geom->phiSpan() << ")";
0052
0053 const CaloCellGeometry::CornersVec& corners(geom->getCorners());
0054
0055 for (unsigned int ci(0); ci != corners.size(); ci++) {
0056 st1 << " Corner: " << ci << " Location" << corners[ci] << " ; ";
0057 }
0058
0059 edm::LogVerbatim("EcalGeom") << st1.str();
0060 }
0061 edm::LogVerbatim("EcalGeom") << "\n\nDumps a total of : " << nall << " cells of the detector\n";
0062 }
0063
0064 DEFINE_FWK_MODULE(EcalEndcapCellParameterDump);