Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:59

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 
0015 typedef EZArrayFL<GlobalPoint> CornersVec;
0016 
0017 class EcalEndcapCellParameterDump : public edm::one::EDAnalyzer<> {
0018 public:
0019   explicit EcalEndcapCellParameterDump(const edm::ParameterSet&);
0020 
0021   void beginJob() override {}
0022   void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0023   void endJob() override {}
0024 
0025 private:
0026   const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_;
0027 };
0028 
0029 EcalEndcapCellParameterDump::EcalEndcapCellParameterDump(const edm::ParameterSet&)
0030     : tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {}
0031 
0032 void EcalEndcapCellParameterDump::analyze(const edm::Event& /*iEvent*/, const edm::EventSetup& iSetup) {
0033   const CaloGeometry* geo = &iSetup.getData(tok_geom_);
0034   const CaloSubdetectorGeometry* ecalGeom =
0035       static_cast<const CaloSubdetectorGeometry*>(geo->getSubdetectorGeometry(DetId::Ecal, EcalEndcap));
0036 
0037   std::cout << "\n\nStudy Detector = Ecal SubDetector = EE"
0038             << "\n======================================\n\n";
0039   const std::vector<DetId>& ids = ecalGeom->getValidDetIds(DetId::Ecal, EcalEndcap);
0040   int nall(0);
0041   for (auto id : ids) {
0042     ++nall;
0043     std::shared_ptr<const CaloCellGeometry> geom = ecalGeom->getGeometry(id);
0044     EEDetId ebid(id.rawId());
0045 
0046     std::cout << "IX = " << ebid.ix() << ";  IY = " << ebid.iy() << " geom->getPosition " << std::setprecision(4)
0047               << geom->getPosition() << " BackPoint " << geom->getBackPoint() << " [rho,eta:etaSpan,phi:phiSpan] ("
0048               << geom->rhoPos() << ", " << geom->etaPos() << ":" << geom->etaSpan() << ", " << geom->phiPos() << ":"
0049               << geom->phiSpan() << ")";
0050 
0051     const CaloCellGeometry::CornersVec& corners(geom->getCorners());
0052 
0053     for (unsigned int ci(0); ci != corners.size(); ci++) {
0054       std::cout << " Corner: " << ci << "  Location" << corners[ci] << " ; ";
0055     }
0056 
0057     std::cout << std::endl;
0058   }
0059   std::cout << "\n\nDumps a total of : " << nall << " cells of the detector\n" << std::endl;
0060 }
0061 
0062 DEFINE_FWK_MODULE(EcalEndcapCellParameterDump);