CMS 3D CMS Logo

GsfVertexConstraintProducer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 
4 // user include files
7 
10 
16 
17 //
18 // class decleration
19 //
20 
22 public:
24  ~GsfVertexConstraintProducer() override = default;
25 
26 private:
27  void produce(edm::StreamID streamid, edm::Event&, const edm::EventSetup&) const override;
28 
29  // ----------member data ---------------------------
32 };
33 
34 //
35 // constants, enums and typedefs
36 //
37 
38 //
39 // static data member definitions
40 //
41 
42 //
43 // constructors and destructor
44 //
46  : srcTrkTag_(iConfig.getParameter<edm::InputTag>("src")) {
47  //declare the consumes
48  trkToken_ = consumes<reco::GsfTrackCollection>(edm::InputTag(srcTrkTag_));
49 
50  //register your products
51  produces<std::vector<VertexConstraint> >();
52  produces<GsfTrackVtxConstraintAssociationCollection>();
53 
54  //now do what ever other initialization is needed
55 }
56 
57 //
58 // member functions
59 //
60 
61 // ------------ method called to produce the data ------------
64  const edm::EventSetup& iSetup) const {
65  using namespace edm;
66 
67  Handle<reco::GsfTrackCollection> theTCollection;
68  iEvent.getByToken(trkToken_, theTCollection);
69 
70  edm::RefProd<std::vector<VertexConstraint> > rPairs = iEvent.getRefBeforePut<std::vector<VertexConstraint> >();
71  std::unique_ptr<std::vector<VertexConstraint> > pairs(new std::vector<VertexConstraint>);
72  std::unique_ptr<GsfTrackVtxConstraintAssociationCollection> output(
73  new GsfTrackVtxConstraintAssociationCollection(theTCollection, rPairs));
74 
75  int index = 0;
76  for (reco::GsfTrackCollection::const_iterator i = theTCollection->begin(); i != theTCollection->end(); i++) {
77  VertexConstraint tmp(GlobalPoint(0, 0, 0), GlobalError(0.01, 0, 0.01, 0, 0, 0.001));
78  pairs->push_back(tmp);
79  output->insert(reco::GsfTrackRef(theTCollection, index), edm::Ref<std::vector<VertexConstraint> >(rPairs, index));
80  index++;
81  }
82 
83  iEvent.put(std::move(pairs));
84  iEvent.put(std::move(output));
85 }
86 
87 //define this as a plug-in
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13
edm::AssociationMap< edm::OneToOne< reco::GsfTrackCollection, std::vector< VertexConstraint > > > GsfTrackVtxConstraintAssociationCollection
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::GsfTrackCollection > trkToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::pair< GlobalPoint, GlobalError > VertexConstraint
HLT enums.
void produce(edm::StreamID streamid, edm::Event &, const edm::EventSetup &) const override
tmp
align.sh
Definition: createJobs.py:716
GsfVertexConstraintProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:511
~GsfVertexConstraintProducer() override=default