Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-28 23:48:16

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/ESHandle.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 
0006 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0007 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0008 #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
0009 #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
0010 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
0011 #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"
0012 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
0013 #include "Geometry/HcalTowerAlgo/interface/CaloTowerGeometry.h"
0014 #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
0015 #include "Geometry/ForwardGeometry/interface/CastorGeometry.h"
0016 
0017 class PCaloGeometryBuilder : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0018 public:
0019   PCaloGeometryBuilder(const edm::ParameterSet& pset)
0020       : m_ecalE(pset.getUntrackedParameter<bool>("EcalE", true)),
0021         m_ecalP(pset.getUntrackedParameter<bool>("EcalP", true)),
0022         m_hgcal(pset.getUntrackedParameter<bool>("HGCal", false)) {
0023     const std::string toDB("_toDB");
0024     ebGeomToken_ = esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", EcalBarrelGeometry::producerTag() + toDB));
0025     eeGeomToken_ = esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", EcalEndcapGeometry::producerTag() + toDB));
0026     esGeomToken_ =
0027         esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", EcalPreshowerGeometry::producerTag() + toDB));
0028     hgcalGeomToken_ = esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", HGCalGeometry::producerTag() + toDB));
0029     hcalGeomToken_ = esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", HcalGeometry::producerTag() + toDB));
0030     ctGeomToken_ = esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", CaloTowerGeometry::producerTag() + toDB));
0031     zdcGeomToken_ = esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", ZdcGeometry::producerTag() + toDB));
0032     castGeomToken_ = esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", CastorGeometry::producerTag() + toDB));
0033   }
0034 
0035   void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
0036   void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
0037   void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
0038 
0039 private:
0040   bool m_ecalE;
0041   bool m_ecalP;
0042   bool m_hgcal;
0043   edm::ESGetToken<CaloSubdetectorGeometry, EcalBarrelGeometry::AlignedRecord> ebGeomToken_;
0044   edm::ESGetToken<CaloSubdetectorGeometry, EcalEndcapGeometry::AlignedRecord> eeGeomToken_;
0045   edm::ESGetToken<CaloSubdetectorGeometry, EcalPreshowerGeometry::AlignedRecord> esGeomToken_;
0046   edm::ESGetToken<CaloSubdetectorGeometry, HGCalGeometry::AlignedRecord> hgcalGeomToken_;
0047   edm::ESGetToken<CaloSubdetectorGeometry, HcalGeometry::AlignedRecord> hcalGeomToken_;
0048   edm::ESGetToken<CaloSubdetectorGeometry, CaloTowerGeometry::AlignedRecord> ctGeomToken_;
0049   edm::ESGetToken<CaloSubdetectorGeometry, ZdcGeometry::AlignedRecord> zdcGeomToken_;
0050   edm::ESGetToken<CaloSubdetectorGeometry, CastorGeometry::AlignedRecord> castGeomToken_;
0051 };
0052 
0053 void PCaloGeometryBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) {
0054   edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalBarrelGeometry::producerTag() << std::endl;
0055   auto pGeb = es.getHandle(ebGeomToken_);
0056   if (m_ecalE) {
0057     edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalEndcapGeometry::producerTag() << std::endl;
0058     auto pGeb = es.getHandle(eeGeomToken_);
0059   }
0060 
0061   if (m_ecalP) {
0062     edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalPreshowerGeometry::producerTag() << std::endl;
0063     auto pGes = es.getHandle(esGeomToken_);
0064   }
0065 
0066   if (m_hgcal) {
0067     edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << HGCalGeometry::producerTag() << std::endl;
0068     auto pGhgcal = es.getHandle(hgcalGeomToken_);
0069     ;
0070   }
0071 
0072   edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << HcalGeometry::producerTag() << std::endl;
0073   auto pGhcal = es.getHandle(hcalGeomToken_);
0074 
0075   edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << CaloTowerGeometry::producerTag() << std::endl;
0076   auto pGct = es.getHandle(ctGeomToken_);
0077 
0078   edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << ZdcGeometry::producerTag() << std::endl;
0079   auto pGzdc = es.getHandle(zdcGeomToken_);
0080 
0081   edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << CastorGeometry::producerTag() << std::endl;
0082   auto pGcast = es.getHandle(castGeomToken_);
0083 }
0084 
0085 DEFINE_FWK_MODULE(PCaloGeometryBuilder);