CMS 3D CMS Logo

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 absT_;
31  const double sigmaT_;
32  const double maxRecoT_;
33  const double sharedTrackFraction_;
34 
37 };
38 
40  absZ_(config.getParameter<double>("absZ")),
41  sigmaZ_(config.getParameter<double>("sigmaZ")),
42  maxRecoZ_(config.getParameter<double>("maxRecoZ")),
43  absT_(config.getParameter<double>("absT")),
44  sigmaT_(config.getParameter<double>("sigmaT")),
45  maxRecoT_(config.getParameter<double>("maxRecoT")),
46  sharedTrackFraction_(config.getParameter<double>("sharedTrackFraction")),
47  trackRecoToSimAssociationToken_(consumes<reco::RecoToSimCollection>(config.getParameter<edm::InputTag>("trackAssociation"))),
48  trackSimToRecoAssociationToken_(consumes<reco::SimToRecoCollection>(config.getParameter<edm::InputTag>("trackAssociation")))
49 {
50  produces<reco::VertexToTrackingVertexAssociator>();
51 }
52 
54 
57 
58  // Matching conditions
59  desc.add<double>("absZ", 0.1);
60  desc.add<double>("sigmaZ", 3.0);
61  desc.add<double>("maxRecoZ", 1000.0);
62  desc.add<double>("absT", -1.0);
63  desc.add<double>("sigmaT", -1.0);
64  desc.add<double>("maxRecoT", -1.0);
65  desc.add<double>("sharedTrackFraction", -1.0);
66 
67  // Track-TrackingParticle association
68  desc.add<edm::InputTag>("trackAssociation", edm::InputTag("trackingParticleRecoTrackAsssociation"));
69 
70  descriptions.add("VertexAssociatorByPositionAndTracks", desc);
71 }
72 
74  edm::Handle<reco::RecoToSimCollection > recotosimCollectionH;
75  iEvent.getByToken(trackRecoToSimAssociationToken_, recotosimCollectionH);
76 
77  edm::Handle<reco::SimToRecoCollection > simtorecoCollectionH;
78  iEvent.getByToken(trackSimToRecoAssociationToken_, simtorecoCollectionH);
79 
80  std::unique_ptr<VertexAssociatorByPositionAndTracks> impl;
81  if( sigmaT_ < 0.0 ) {
82  impl = std::make_unique<VertexAssociatorByPositionAndTracks>(&(iEvent.productGetter()),
83  absZ_,
84  sigmaZ_,
85  maxRecoZ_,
87  recotosimCollectionH.product(),
88  simtorecoCollectionH.product());
89  } else {
90  impl = std::make_unique<VertexAssociatorByPositionAndTracks>(&(iEvent.productGetter()),
91  absZ_,
92  sigmaZ_,
93  maxRecoZ_,
94  absT_,
95  sigmaT_,
96  maxRecoT_,
98  recotosimCollectionH.product(),
99  simtorecoCollectionH.product());
100  }
101 
102  auto toPut = std::make_unique<reco::VertexToTrackingVertexAssociator>(std::move(impl));
103  iEvent.put(std::move(toPut));
104 }
105 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
edm::EDGetTokenT< reco::RecoToSimCollection > trackRecoToSimAssociationToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDProductGetter const & productGetter() const
Definition: Event.cc:56
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
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)
fixed size matrix
HLT enums.
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)
def move(src, dest)
Definition: eostools.py:510