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 
69  m_cscSegmentToken = consumes< CSCSegmentCollection >( iConfig.getParameter<edm::InputTag>("CSCSegments" ) );
70  m_dtSegmentToken = consumes< DTRecSegment4DCollection >(iConfig.getParameter<edm::InputTag>("DTSegments" ) );
71 
72  produces<susybsm::MuonSegmentCollection >();
73 }
74 
76  // do anything here that needs to be done at desctruction time
77  // (e.g. close files, deallocate resources etc.)
78 }
79 
80 //
81 // member functions
82 //
83 
84 // ------------ method called to produce the data ------------
85 void
87 
88  using namespace edm;
89  using namespace std;
90  using namespace susybsm;
91 
93  std::unique_ptr<susybsm::MuonSegmentCollection> resultSeg(segments);
94 
96  iSetup.get<MuonGeometryRecord>().get(dtGeom);
97 
99  iSetup.get<MuonGeometryRecord>().get(cscGeom);
100 
102  iEvent.getByToken(m_dtSegmentToken, dtSegments);
103 
104  for (unsigned int d=0; d<dtSegments->size(); d++) {
105  DTRecSegment4DRef SegRef = DTRecSegment4DRef( dtSegments, d );
106  MuonSegment muonSegment;
107  muonSegment.setDTSegmentRef(SegRef);
108 
109  const GeomDet* dtDet = dtGeom->idToDet(SegRef->geographicalId());
110  GlobalPoint point = dtDet->toGlobal(SegRef->localPosition());
111  muonSegment.setGP(point);
112  segments->push_back(muonSegment);
113  }
114 
116  iEvent.getByToken(m_cscSegmentToken, cscSegments);
117 
118  for (unsigned int c=0; c<cscSegments->size(); c++) {
119  CSCSegmentRef SegRef = CSCSegmentRef( cscSegments, c );
120  MuonSegment muonSegment;
121  muonSegment.setCSCSegmentRef(SegRef);
122 
123  const GeomDet* cscDet = cscGeom->idToDet(SegRef->geographicalId());
124  GlobalPoint point = cscDet->toGlobal(SegRef->localPosition());
125  muonSegment.setGP(point);
126  segments->push_back(muonSegment);
127  }
128 
129  edm::OrphanHandle<susybsm::MuonSegmentCollection> putHandleSeg = iEvent.put(std::move(resultSeg));
130 }
131 
132 // ------------ method called once each job just before starting event loop ------------
133 void
135 }
136 
137 // ------------ method called once each job just after ending the event loop ------------
138 void
140 }
141 
142 //define this as a plug-in
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
std::vector< MuonSegment > MuonSegmentCollection
Definition: MuonSegment.h:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:99
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::Ref< CSCSegmentCollection > CSCSegmentRef
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
MuonSegmentProducer(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
void setDTSegmentRef(const DTRecSegment4DRef segment)
Definition: MuonSegment.h:23
void setCSCSegmentRef(const CSCSegmentRef segment)
Definition: MuonSegment.h:24
edm::EDGetTokenT< CSCSegmentCollection > m_cscSegmentToken
int iEvent
Definition: GenABIO.cc:230
edm::Ref< DTRecSegment4DCollection > DTRecSegment4DRef
void setGP(const GlobalPoint point)
Definition: MuonSegment.h:26
const T & get() const
Definition: EventSetup.h:55
HLT enums.
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:75
def move(src, dest)
Definition: eostools.py:510
*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::EDGetTokenT< DTRecSegment4DCollection > m_dtSegmentToken