CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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_
def move
Definition: eostools.py:511
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
std::pair< GlobalPoint, GlobalError > VertexConstraint
void produce(edm::StreamID streamid, edm::Event &, const edm::EventSetup &) const override
tmp
align.sh
Definition: createJobs.py:716
GsfVertexConstraintProducer(const edm::ParameterSet &)
~GsfVertexConstraintProducer() override=default