test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VertexAssociatorByPositionAndTracksProducer.cc
Go to the documentation of this file.
10 
12 
15 
17 public:
20 
21  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
22 
23 private:
24  virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
25 
26  // ----------member data ---------------------------
27  const double absZ_;
28  const double sigmaZ_;
29  const double maxRecoZ_;
30  const double sharedTrackFraction_;
31 
34 };
35 
37  absZ_(config.getParameter<double>("absZ")),
38  sigmaZ_(config.getParameter<double>("sigmaZ")),
39  maxRecoZ_(config.getParameter<double>("maxRecoZ")),
40  sharedTrackFraction_(config.getParameter<double>("sharedTrackFraction")),
41  trackRecoToSimAssociationToken_(consumes<reco::RecoToSimCollection>(config.getParameter<edm::InputTag>("trackAssociation"))),
42  trackSimToRecoAssociationToken_(consumes<reco::SimToRecoCollection>(config.getParameter<edm::InputTag>("trackAssociation")))
43 {
44  produces<reco::VertexToTrackingVertexAssociator>();
45 }
46 
48 
51 
52  // Matching conditions
53  desc.add<double>("absZ", 0.1);
54  desc.add<double>("sigmaZ", 3.0);
55  desc.add<double>("maxRecoZ", 1000.0);
56  desc.add<double>("sharedTrackFraction", -1.0);
57 
58  // Track-TrackingParticle association
59  desc.add<edm::InputTag>("trackAssociation", edm::InputTag("trackingParticleRecoTrackAsssociation"));
60 
61  descriptions.add("VertexAssociatorByPositionAndTracks", desc);
62 }
63 
65  edm::Handle<reco::RecoToSimCollection > recotosimCollectionH;
66  iEvent.getByToken(trackRecoToSimAssociationToken_, recotosimCollectionH);
67 
68  edm::Handle<reco::SimToRecoCollection > simtorecoCollectionH;
69  iEvent.getByToken(trackSimToRecoAssociationToken_, simtorecoCollectionH);
70 
71  auto impl = std::make_unique<VertexAssociatorByPositionAndTracks>(&(iEvent.productGetter()),
72  absZ_,
73  sigmaZ_,
74  maxRecoZ_,
76  recotosimCollectionH.product(),
77  simtorecoCollectionH.product());
78 
79  auto toPut = std::make_unique<reco::VertexToTrackingVertexAssociator>(std::move(impl));
80  iEvent.put(std::move(toPut));
81 }
82 
edm::EDGetTokenT< reco::RecoToSimCollection > trackRecoToSimAssociationToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDProductGetter const & productGetter() const
Definition: Event.cc:55
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< reco::SimToRecoCollection > trackSimToRecoAssociationToken_
T const * product() const
Definition: Handle.h:81
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > > RecoToSimCollection
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > > SimToRecoCollection
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)