Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-27 22:37:20

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/RPCGeometry/interface/RPCGeometry.h"
0012 #include "Geometry/RPCGeometry/interface/RPCChamber.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 RPCGeometryDump : public edm::one::EDAnalyzer<> {
0024 public:
0025   explicit RPCGeometryDump(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<RPCGeometry, MuonGeometryRecord> tokRPC_;
0033   const RPCGeometry* rpcGeometry_;
0034 };
0035 
0036 RPCGeometryDump::RPCGeometryDump(const edm::ParameterSet& iC)
0037     : verbose_(iC.getParameter<bool>("verbose")),
0038       tokRPC_{esConsumes<RPCGeometry, MuonGeometryRecord>(edm::ESInputTag{})} {}
0039 
0040 void RPCGeometryDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0041   edm::ParameterSetDescription desc;
0042   desc.add<bool>("verbose", false);
0043   descriptions.add("rpcGeometryDump", desc);
0044 }
0045 
0046 void RPCGeometryDump::analyze(const edm::Event& event, const edm::EventSetup& eventSetup) {
0047   rpcGeometry_ = &eventSetup.getData(tokRPC_);
0048 
0049   auto const& chambers = rpcGeometry_->chambers();
0050   edm::LogVerbatim("RPCGeometry") << "RPCGeometry found with " << chambers.size() << " chambers\n";
0051 
0052   for (unsigned int k1 = 0; k1 < chambers.size(); ++k1) {
0053     edm::LogVerbatim("RPCGeometry") << "\nChamber " << k1 << ":" << chambers[k1]->id() << " with "
0054                                     << chambers[k1]->nrolls() << " rolls";
0055 
0056     auto const& rolls = chambers[k1]->rolls();
0057     for (unsigned int k2 = 0; k2 < rolls.size(); ++k2) {
0058       edm::LogVerbatim("RPCGeometry") << "\nRoll " << k2 << ":" << rolls[k2]->id() << " Barrel|Endcap "
0059                                       << rolls[k2]->isBarrel() << ":" << rolls[k2]->isForward() << ":"
0060                                       << rolls[k2]->isIRPC() << " with " << rolls[k2]->nstrips() << " of pitch "
0061                                       << rolls[k2]->pitch();
0062       if (verbose_) {
0063         for (int k = 0; k < rolls[k2]->nstrips(); ++k)
0064           edm::LogVerbatim("RPCGeometry") << "Strip[" << k << "] " << rolls[k2]->centreOfStrip(k + 1);
0065       }
0066     }
0067   }
0068 }
0069 
0070 DEFINE_FWK_MODULE(RPCGeometryDump);