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++) {
116  CSCSegmentRef SegRef = CSCSegmentRef(cscSegments, 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 
126  edm::OrphanHandle<susybsm::MuonSegmentCollection> putHandleSeg = iEvent.put(std::move(resultSeg));
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
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< MuonSegment > MuonSegmentCollection
Definition: MuonSegment.h:39
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:91
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:49
MuonSegmentProducer(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
void setDTSegmentRef(const DTRecSegment4DRef segment)
Definition: MuonSegment.h:22
void setCSCSegmentRef(const CSCSegmentRef segment)
Definition: MuonSegment.h:23
edm::EDGetTokenT< CSCSegmentCollection > m_cscSegmentToken
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
d
Definition: ztail.py:151
edm::Ref< DTRecSegment4DCollection > DTRecSegment4DRef
void setGP(const GlobalPoint point)
Definition: MuonSegment.h:25
HLT enums.
T get() const
Definition: EventSetup.h:73
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:77
edm::EDGetTokenT< DTRecSegment4DCollection > m_dtSegmentToken
def move(src, dest)
Definition: eostools.py:511
*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