Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:    RPCGEO2
0004 // Class:      RPCGEO2
0005 //
0006 /**\class RPCGEO2 RPCGEO2.cc rpcgeo/RPCGEO2/src/RPCGEO2.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  pts/91
0015 //         Created:  Wed Sep 26 17:08:29 CEST 2007
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031 
0032 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0033 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0034 
0035 #include <DataFormats/RPCDigi/interface/RPCDigi.h>
0036 #include <DataFormats/RPCDigi/interface/RPCDigiCollection.h>
0037 
0038 #include <DataFormats/MuonDetId/interface/RPCDetId.h>
0039 #include <Geometry/RPCGeometry/interface/RPCGeometry.h>
0040 #include <Geometry/CommonTopologies/interface/RectangularStripTopology.h>
0041 #include <Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h>
0042 
0043 #include <Geometry/Records/interface/MuonGeometryRecord.h>
0044 
0045 #include <Geometry/RPCGeometry/interface/RPCGeomServ.h>
0046 
0047 //
0048 // class decleration
0049 //
0050 
0051 class RPCGEO2 : public edm::one::EDAnalyzer<> {
0052 public:
0053   explicit RPCGEO2(const edm::ParameterSet&);
0054   ~RPCGEO2() override;
0055 
0056   void beginJob() override {}
0057   void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0058   void endJob() override {}
0059 
0060 private:
0061   const edm::ESGetToken<RPCGeometry, MuonGeometryRecord> tokRPC_;
0062 };
0063 
0064 RPCGEO2::RPCGEO2(const edm::ParameterSet& /*iConfig*/)
0065     : tokRPC_{esConsumes<RPCGeometry, MuonGeometryRecord>(edm::ESInputTag{})} {}
0066 
0067 RPCGEO2::~RPCGEO2() {}
0068 
0069 // ------------ method called to for each event  ------------
0070 void RPCGEO2::analyze(const edm::Event& /*iEvent*/, const edm::EventSetup& iSetup) {
0071   using namespace edm;
0072 
0073   edm::LogVerbatim("RPCGeometry") << " Getting the RPC Geometry";
0074   const RPCGeometry* rpcGeo = &iSetup.getData(tokRPC_);
0075 
0076   for (TrackingGeometry::DetContainer::const_iterator it = rpcGeo->dets().begin(); it < rpcGeo->dets().end(); it++) {
0077     if (dynamic_cast<const RPCChamber*>(*it) != nullptr) {
0078       const RPCChamber* ch = dynamic_cast<const RPCChamber*>(*it);
0079       std::vector<const RPCRoll*> roles = (ch->rolls());
0080 
0081       for (std::vector<const RPCRoll*>::const_iterator r = roles.begin(); r != roles.end(); ++r) {
0082         RPCDetId rpcId = (*r)->id();
0083         RPCGeomServ rpcsrv(rpcId);
0084         if (rpcId.region() == 0) {
0085           const BoundPlane& RPCSurface = (*r)->surface();
0086           GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0, 0, 0));
0087           edm::LogVerbatim("RPCGeometry") << rpcsrv.name() << " " << CenterPointRollGlobal.x() << " "
0088                                           << CenterPointRollGlobal.y() << " " << CenterPointRollGlobal.z();
0089           GlobalPoint i = RPCSurface.toGlobal(LocalPoint(1, 0, 0));
0090           GlobalPoint j = RPCSurface.toGlobal(LocalPoint(0, 1, 0));
0091           edm::LogVerbatim("RPCGeometry") << " i " << i.x() << " " << i.y() << " " << i.z();
0092           edm::LogVerbatim("RPCGeometry") << " j " << j.x() << " " << j.y() << " " << j.z();
0093 
0094         } else {
0095           const BoundPlane& RPCSurface = (*r)->surface();
0096           GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0, 0, 0));
0097           edm::LogVerbatim("RPCGeometry") << rpcsrv.name() << " " << CenterPointRollGlobal.x() << " "
0098                                           << CenterPointRollGlobal.y() << " " << CenterPointRollGlobal.z();
0099         }
0100       }
0101     }
0102   }
0103 }
0104 
0105 //define this as a plug-in
0106 DEFINE_FWK_MODULE(RPCGEO2);