Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:28

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/ESHandle.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 
0007 #include "Geometry/Records/interface/PTrackerParametersRcd.h"
0008 #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h"
0009 #include "Geometry/CommonDetUnit/interface/GeomDetEnumerators.h"
0010 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
0011 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0012 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0013 #include "Geometry/TrackerNumberingBuilder/interface/CmsTrackerStringToEnum.h"
0014 
0015 #include <iostream>
0016 
0017 class TrackerParametersGeometryAnalyzer : public edm::one::EDAnalyzer<> {
0018 public:
0019   explicit TrackerParametersGeometryAnalyzer(const edm::ParameterSet&)
0020       : parToken_(esConsumes()), geoToken_(esConsumes()) {}
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<PTrackerParameters, PTrackerParametersRcd> parToken_;
0028   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geoToken_;
0029 };
0030 
0031 void TrackerParametersGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0032   edm::LogInfo("TrackerParametersGeometryAnalyzer") << "Here I am";
0033 
0034   const auto& ptp = iSetup.getHandle(parToken_);
0035   const auto& pDD = iSetup.getHandle(geoToken_);
0036 
0037   GeometricDet const* gd = pDD->trackerDet();
0038   GeometricDet::ConstGeometricDetContainer subdetgd = gd->components();
0039 
0040   for (const auto& git : subdetgd) {
0041     edm::LogVerbatim("TrackerParametersGeometryAnalyzer") << git->name() << ": " << git->type();
0042   }
0043   for (const auto& vitem : ptp->vitems) {
0044     edm::LogVerbatim("TrackerParametersGeometryAnalyzer")
0045         << vitem.id << " is " << pDD->geomDetSubDetector(vitem.id) << " has " << vitem.vpars.size() << ":";
0046     for (const auto& in : vitem.vpars) {
0047       edm::LogVerbatim("TrackerParametersGeometryAnalyzer") << in << ";";
0048     }
0049   }
0050   for (int vpar : ptp->vpars) {
0051     edm::LogVerbatim("TrackerParametersGeometryAnalyzer") << vpar << "; ";
0052   }
0053 }
0054 
0055 DEFINE_FWK_MODULE(TrackerParametersGeometryAnalyzer);