CMS 3D CMS Logo

MuonSegmentProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonSegmentProducer
4 // Class: MuonSegmentProducer
5 //
13 //
14 // Original Author: Rizzi Andrea
15 // Reworked and Ported to CMSSW_3_0_0 by Christophe Delaere
16 // Created: Wed Oct 10 12:01:28 CEST 2007
17 // $Id: MuonSegmentProducer.cc,v 1.1 2012/04/27 20:49:41 farrell3 Exp $
18 //
19 //
20 
21 // user include files
30 
32 
41 
42 #include <vector>
43 #include <iostream>
44 
45 //
46 // class decleration
47 //
49 public:
50  explicit MuonSegmentProducer(const edm::ParameterSet&);
51  ~MuonSegmentProducer() override;
52 
53 private:
54  void beginJob() override;
55  void produce(edm::Event&, const edm::EventSetup&) override;
56  void endJob() override;
57 
60 };
61 
62 using namespace susybsm;
63 
65  using namespace edm;
66  using namespace std;
67 
68  m_cscSegmentToken = consumes<CSCSegmentCollection>(iConfig.getParameter<edm::InputTag>("CSCSegments"));
69  m_dtSegmentToken = consumes<DTRecSegment4DCollection>(iConfig.getParameter<edm::InputTag>("DTSegments"));
70 
71  produces<susybsm::MuonSegmentCollection>();
72 }
73 
75  // do anything here that needs to be done at desctruction time
76  // (e.g. close files, deallocate resources etc.)
77 }
78 
79 //
80 // member functions
81 //
82 
83 // ------------ method called to produce the data ------------
85  using namespace edm;
86  using namespace std;
87  using namespace susybsm;
88 
90  std::unique_ptr<susybsm::MuonSegmentCollection> resultSeg(segments);
91 
93  iSetup.get<MuonGeometryRecord>().get(dtGeom);
94 
96  iSetup.get<MuonGeometryRecord>().get(cscGeom);
97 
99  iEvent.getByToken(m_dtSegmentToken, dtSegments);
100 
101  for (unsigned int d = 0; d < dtSegments->size(); d++) {
102  DTRecSegment4DRef SegRef = DTRecSegment4DRef(dtSegments, d);
103  MuonSegment muonSegment;
104  muonSegment.setDTSegmentRef(SegRef);
105 
106  const GeomDet* dtDet = dtGeom->idToDet(SegRef->geographicalId());
107  GlobalPoint point = dtDet->toGlobal(SegRef->localPosition());
108  muonSegment.setGP(point);
109  segments->push_back(muonSegment);
110  }
111 
113  iEvent.getByToken(m_cscSegmentToken, cscSegments);
114 
115  for (unsigned int c = 0; c < cscSegments->size(); c++) {
117  MuonSegment muonSegment;
118  muonSegment.setCSCSegmentRef(SegRef);
119 
120  const GeomDet* cscDet = cscGeom->idToDet(SegRef->geographicalId());
121  GlobalPoint point = cscDet->toGlobal(SegRef->localPosition());
122  muonSegment.setGP(point);
123  segments->push_back(muonSegment);
124  }
125 
127 }
128 
129 // ------------ method called once each job just before starting event loop ------------
131 
132 // ------------ method called once each job just after ending the event loop ------------
134 
135 //define this as a plug-in
susybsm::MuonSegment::setDTSegmentRef
void setDTSegmentRef(const DTRecSegment4DRef segment)
Definition: MuonSegment.h:22
GeomDet
Definition: GeomDet.h:27
EDProducer.h
susybsm::MuonSegmentCollection
std::vector< MuonSegment > MuonSegmentCollection
Definition: MuonSegment.h:39
ESHandle.h
edm::EDGetTokenT< CSCSegmentCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
CSCGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:91
MuonSegmentProducer::~MuonSegmentProducer
~MuonSegmentProducer() override
Definition: MuonSegmentProducer.cc:74
susybsm
Definition: HSCParticle.h:16
EDFilter.h
dtChamberEfficiency_cfi.cscSegments
cscSegments
Definition: dtChamberEfficiency_cfi.py:15
susybsm::MuonSegment::setCSCSegmentRef
void setCSCSegmentRef(const CSCSegmentRef segment)
Definition: MuonSegment.h:23
edm::Handle< DTRecSegment4DCollection >
CSCSegmentRef
edm::Ref< CSCSegmentCollection > CSCSegmentRef
Definition: CSCSegmentCollection.h:21
edm::Ref< DTRecSegment4DCollection >
MakerMacros.h
MuonSegmentProducer::beginJob
void beginJob() override
Definition: MuonSegmentProducer.cc:130
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
edm::ESHandle< DTGeometry >
Point3DBase< float, GlobalTag >
DTLayer.h
DTGeometry.h
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
MuonSegmentProducer::m_dtSegmentToken
edm::EDGetTokenT< DTRecSegment4DCollection > m_dtSegmentToken
Definition: MuonSegmentProducer.cc:59
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
MuonSegmentProducer
Definition: MuonSegmentProducer.cc:48
iEvent
int iEvent
Definition: GenABIO.cc:224
MuonSegment.h
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
MuonSegmentProducer::MuonSegmentProducer
MuonSegmentProducer(const edm::ParameterSet &)
Definition: MuonSegmentProducer.cc:64
susybsm::MuonSegment::setGP
void setGP(const GlobalPoint point)
Definition: MuonSegment.h:25
MuonSubdetId.h
MuonSegmentProducer::endJob
void endJob() override
Definition: MuonSegmentProducer.cc:133
MuonSegmentProducer::m_cscSegmentToken
edm::EDGetTokenT< CSCSegmentCollection > m_cscSegmentToken
Definition: MuonSegmentProducer.cc:58
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
susybsm::MuonSegment
Definition: MuonSegment.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::OrphanHandle
Definition: EDProductfwd.h:39
MuonSegmentProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: MuonSegmentProducer.cc:84
Frameworkfwd.h
TrackingComponentsRecord.h
DTRecSegment4DRef
edm::Ref< DTRecSegment4DCollection > DTRecSegment4DRef
Definition: DTRecSegment4DCollection.h:24
edm::EDProducer
Definition: EDProducer.h:36
DTChamber.h
ztail.d
d
Definition: ztail.py:151
ParameterSet.h
MuonGeometryRecord.h
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
edm::Event
Definition: Event.h:73
DTGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:77
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTSuperLayer.h
edm::InputTag
Definition: InputTag.h:15
CSCGeometry.h