File indexing completed on 2024-04-06 12:28:14
0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003 #include "FWCore/Framework/interface/ESTransientHandle.h"
0004 #include "FWCore/Framework/interface/ESHandle.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006
0007 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0008
0009 #include "RecoTracker/MkFit/interface/MkFitGeometry.h"
0010
0011 #include "RecoTracker/MkFitCore/interface/TrackerInfo.h"
0012
0013 class DumpMkFitGeometry : public edm::one::EDAnalyzer<> {
0014 public:
0015 explicit DumpMkFitGeometry(const edm::ParameterSet& config);
0016
0017 private:
0018 void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override;
0019
0020 edm::ESGetToken<MkFitGeometry, TrackerRecoGeometryRecord> mkfGeoToken_;
0021
0022 int level_;
0023 std::string outputFileName_;
0024 };
0025
0026 DumpMkFitGeometry::DumpMkFitGeometry(const edm::ParameterSet& config)
0027 : mkfGeoToken_{esConsumes()},
0028 level_(config.getUntrackedParameter<int>("level", 1)),
0029 outputFileName_(config.getUntrackedParameter<std::string>("outputFileName", "cmsRecoGeo.root")) {}
0030
0031 void DumpMkFitGeometry::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0032 const auto& mkfg = iSetup.getData(mkfGeoToken_);
0033 const mkfit::TrackerInfo& ti = mkfg.trackerInfo();
0034
0035 edm::LogInfo("DumpMkFitGeometry") << "geom_ptr=" << &mkfg << "n_layers = " << ti.n_layers();
0036 if (outputFileName_.empty()) {
0037 edm::LogInfo("DumpMkFitGeometry") << "no file-name specified, not dumping binary file";
0038 } else {
0039 edm::LogInfo("DumpMkFitGeometry") << "binary file = '" << outputFileName_ << "'";
0040 ti.write_bin_file(outputFileName_);
0041 }
0042
0043 ti.print_tracker(level_);
0044 edm::LogInfo("DumpMkFitGeometry") << "finished, n_modules=" << ti.n_total_modules();
0045 }
0046
0047 DEFINE_FWK_MODULE(DumpMkFitGeometry);