CMS 3D CMS Logo

VertexAssociatorByTracksProducer.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  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
25 
26  // ----------member data ---------------------------
27  const double R2SMatchedSimRatio_;
28  const double R2SMatchedRecoRatio_;
29  const double S2RMatchedSimRatio_;
30  const double S2RMatchedRecoRatio_;
31 
34 
37 };
38 
39 namespace {
40  TrackingParticleSelector makeSelector(const edm::ParameterSet& param) {
42  param.getParameter<double>("ptMinTP"),
43  param.getParameter<double>("ptMaxTP"),
44  param.getParameter<double>("minRapidityTP"),
45  param.getParameter<double>("maxRapidityTP"),
46  param.getParameter<double>("tipTP"),
47  param.getParameter<double>("lipTP"),
48  param.getParameter<int>("minHitTP"),
49  param.getParameter<bool>("signalOnlyTP"),
50  param.getParameter<bool>("intimeOnlyTP"),
51  param.getParameter<bool>("chargedOnlyTP"),
52  param.getParameter<bool>("stableOnlyTP"),
53  param.getParameter<std::vector<int> >("pdgIdTP")
54  );
55  }
56 }
57 
59  R2SMatchedSimRatio_(config.getParameter<double>("R2SMatchedSimRatio")),
60  R2SMatchedRecoRatio_(config.getParameter<double>("R2SMatchedRecoRatio")),
61  S2RMatchedSimRatio_(config.getParameter<double>("S2RMatchedSimRatio")),
62  S2RMatchedRecoRatio_(config.getParameter<double>("S2RMatchedRecoRatio")),
63  selector_(makeSelector(config.getParameter<edm::ParameterSet>("trackingParticleSelector"))),
64  trackQuality_(reco::TrackBase::qualityByName(config.getParameter<std::string>("trackQuality"))),
65  trackRecoToSimAssociationToken_(consumes<reco::RecoToSimCollection>(config.getParameter<edm::InputTag>("trackAssociation"))),
66  trackSimToRecoAssociationToken_(consumes<reco::SimToRecoCollection>(config.getParameter<edm::InputTag>("trackAssociation")))
67 {
68  produces<reco::VertexToTrackingVertexAssociator>();
69 }
70 
72 
75 
76  // Matching conditions
77  desc.add<double>("R2SMatchedSimRatio", 0.3);
78  desc.add<double>("R2SMatchedRecoRatio", 0.0);
79  desc.add<double>("S2RMatchedSimRatio", 0.0);
80  desc.add<double>("S2RMatchedRecoRatio", 0.3);
81 
82  //RecoTrack selection
83  desc.add<std::string>("trackQuality", "highPurity");
84 
85  // TrackingParticle selection
87 
88  descTp.add<double>("lipTP", 30.0);
89  descTp.add<bool>("chargedOnlyTP", true);
90  descTp.add<std::vector<int>>("pdgIdTP", std::vector<int>());
91  descTp.add<bool>("signalOnlyTP", true);
92  descTp.add<double>("minRapidityTP", -2.4);
93  descTp.add<int>("minHitTP", 0);
94  descTp.add<double>("ptMinTP", 0.9);
95  descTp.add<double>("ptMaxTP", 1e100);
96  descTp.add<double>("maxRapidityTP", 2.4);
97  descTp.add<double>("tipTP", 3.5);
98  desc.add<edm::ParameterSetDescription>("trackingParticleSelector", descTp);
99 
100  // Track-TrackingParticle association
101  desc.add<edm::InputTag>("trackAssociation", edm::InputTag("trackingParticleRecoTrackAsssociation"));
102 
103  descriptions.add("VertexAssociatorByTracks", desc);
104 }
105 
107  edm::Handle<reco::RecoToSimCollection > recotosimCollectionH;
108  iEvent.getByToken(trackRecoToSimAssociationToken_, recotosimCollectionH);
109 
110  edm::Handle<reco::SimToRecoCollection > simtorecoCollectionH;
111  iEvent.getByToken(trackSimToRecoAssociationToken_, simtorecoCollectionH);
112 
113  auto impl = std::make_unique<VertexAssociatorByTracks>(&(iEvent.productGetter()),
118  &selector_,
120  recotosimCollectionH.product(),
121  simtorecoCollectionH.product());
122 
123  auto toPut = std::make_unique<reco::VertexToTrackingVertexAssociator>(std::move(impl));
124  iEvent.put(std::move(toPut));
125 }
126 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
TrackQuality
track quality
Definition: TrackBase.h:151
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDProductGetter const & productGetter() const
Definition: Event.cc:104
const reco::TrackBase::TrackQuality trackQuality_
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
int iEvent
Definition: GenABIO.cc:230
VertexAssociatorByTracksProducer(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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.
edm::EDGetTokenT< reco::SimToRecoCollection > trackSimToRecoAssociationToken_
edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > > SimToRecoCollection
edm::EDGetTokenT< reco::RecoToSimCollection > trackRecoToSimAssociationToken_
def move(src, dest)
Definition: eostools.py:510
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)