Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-29 04:28:11

0001 // user include files
0002 #include "FWCore/Framework/interface/Frameworkfwd.h"
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0010 
0011 #include "Geometry/GEMGeometry/interface/ME0Geometry.h"
0012 #include "Geometry/GEMGeometry/interface/ME0Chamber.h"
0013 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0014 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0015 
0016 //STL headers
0017 #include <vector>
0018 #include <sstream>
0019 #include <fstream>
0020 #include <string>
0021 #include <iomanip>
0022 
0023 class ME0GeometryDump : public edm::one::EDAnalyzer<> {
0024 public:
0025   explicit ME0GeometryDump(const edm::ParameterSet&);
0026   static void fillDescriptions(edm::ConfigurationDescriptions&);
0027 
0028 private:
0029   void analyze(const edm::Event&, const edm::EventSetup&) override;
0030 
0031   const bool verbose_;
0032   const edm::ESGetToken<ME0Geometry, MuonGeometryRecord> tokGeom_;
0033   const ME0Geometry* me0Geometry_;
0034 };
0035 
0036 ME0GeometryDump::ME0GeometryDump(const edm::ParameterSet& iC)
0037     : verbose_(iC.getParameter<bool>("verbose")),
0038       tokGeom_{esConsumes<ME0Geometry, MuonGeometryRecord>(edm::ESInputTag{})} {}
0039 
0040 void ME0GeometryDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0041   edm::ParameterSetDescription desc;
0042   desc.add<bool>("verbose", false);
0043   descriptions.add("me0GeometryDump", desc);
0044 }
0045 
0046 void ME0GeometryDump::analyze(const edm::Event& event, const edm::EventSetup& eventSetup) {
0047   me0Geometry_ = &eventSetup.getData(tokGeom_);
0048 
0049   auto const& chambers = me0Geometry_->chambers();
0050   edm::LogVerbatim("ME0Geometry") << "ME0Geometry found with " << chambers.size() << " chambers\n";
0051   for (unsigned int k1 = 0; k1 < chambers.size(); ++k1) {
0052     edm::LogVerbatim("ME0Geometry") << "\nChamber " << k1 << ":" << chambers[k1]->id() << " with "
0053                                     << chambers[k1]->nLayers() << " layers";
0054     auto const& layers = chambers[k1]->layers();
0055 
0056     for (unsigned int k2 = 0; k2 < layers.size(); ++k2) {
0057       edm::LogVerbatim("ME0Geometry") << "\nLayer " << k2 << ":" << layers[k2]->id() << " with "
0058                                       << layers[k2]->nEtaPartitions() << " etaPartitions";
0059       auto const& etaPartitions = layers[k2]->etaPartitions();
0060 
0061       for (unsigned int k3 = 0; k3 < etaPartitions.size(); ++k3) {
0062         edm::LogVerbatim("ME0Geometry") << "\nEtaPartition " << k3 << ":" << etaPartitions[k3]->id()
0063                                         << etaPartitions[k3]->type().name() << " with " << etaPartitions[k3]->nstrips()
0064                                         << " strips of pitch " << std::setprecision(4) << etaPartitions[k3]->pitch()
0065                                         << " and " << etaPartitions[k3]->npads() << " pads of pitch "
0066                                         << std::setprecision(4) << etaPartitions[k3]->padPitch();
0067         if (verbose_) {
0068           for (int k = 0; k < etaPartitions[k3]->nstrips(); ++k)
0069             edm::LogVerbatim("ME0Geometry")
0070                 << "Strip[" << k << "] " << std::setprecision(4) << etaPartitions[k3]->centreOfStrip(k);
0071           for (int k = 0; k < etaPartitions[k3]->npads(); ++k)
0072             edm::LogVerbatim("ME0Geometry")
0073                 << "Pad[" << k << "] " << std::setprecision(4) << etaPartitions[k3]->centreOfPad(k);
0074         }
0075       }
0076     }
0077   }
0078 }
0079 
0080 DEFINE_FWK_MODULE(ME0GeometryDump);