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) {
41  return TrackingParticleSelector(param.getParameter<double>("ptMinTP"),
42  param.getParameter<double>("ptMaxTP"),
43  param.getParameter<double>("minRapidityTP"),
44  param.getParameter<double>("maxRapidityTP"),
45  param.getParameter<double>("tipTP"),
46  param.getParameter<double>("lipTP"),
47  param.getParameter<int>("minHitTP"),
48  param.getParameter<bool>("signalOnlyTP"),
49  param.getParameter<bool>("intimeOnlyTP"),
50  param.getParameter<bool>("chargedOnlyTP"),
51  param.getParameter<bool>("stableOnlyTP"),
52  param.getParameter<std::vector<int>>("pdgIdTP"));
53  }
54 } // namespace
55 
57  : R2SMatchedSimRatio_(config.getParameter<double>("R2SMatchedSimRatio")),
58  R2SMatchedRecoRatio_(config.getParameter<double>("R2SMatchedRecoRatio")),
59  S2RMatchedSimRatio_(config.getParameter<double>("S2RMatchedSimRatio")),
60  S2RMatchedRecoRatio_(config.getParameter<double>("S2RMatchedRecoRatio")),
61  selector_(makeSelector(config.getParameter<edm::ParameterSet>("trackingParticleSelector"))),
62  trackQuality_(reco::TrackBase::qualityByName(config.getParameter<std::string>("trackQuality"))),
63  trackRecoToSimAssociationToken_(
64  consumes<reco::RecoToSimCollection>(config.getParameter<edm::InputTag>("trackAssociation"))),
65  trackSimToRecoAssociationToken_(
66  consumes<reco::SimToRecoCollection>(config.getParameter<edm::InputTag>("trackAssociation"))) {
67  produces<reco::VertexToTrackingVertexAssociator>();
68 }
69 
71 
74 
75  // Matching conditions
76  desc.add<double>("R2SMatchedSimRatio", 0.3);
77  desc.add<double>("R2SMatchedRecoRatio", 0.0);
78  desc.add<double>("S2RMatchedSimRatio", 0.0);
79  desc.add<double>("S2RMatchedRecoRatio", 0.3);
80 
81  // RecoTrack selection
82  desc.add<std::string>("trackQuality", "highPurity");
83 
84  // TrackingParticle selection
86 
87  descTp.add<double>("lipTP", 30.0);
88  descTp.add<bool>("chargedOnlyTP", true);
89  descTp.add<std::vector<int>>("pdgIdTP", std::vector<int>());
90  descTp.add<bool>("signalOnlyTP", true);
91  descTp.add<double>("minRapidityTP", -2.4);
92  descTp.add<int>("minHitTP", 0);
93  descTp.add<double>("ptMinTP", 0.9);
94  descTp.add<double>("ptMaxTP", 1e100);
95  descTp.add<double>("maxRapidityTP", 2.4);
96  descTp.add<double>("tipTP", 3.5);
97  desc.add<edm::ParameterSetDescription>("trackingParticleSelector", descTp);
98 
99  // Track-TrackingParticle association
100  desc.add<edm::InputTag>("trackAssociation", edm::InputTag("trackingParticleRecoTrackAsssociation"));
101 
102  descriptions.add("VertexAssociatorByTracks", desc);
103 }
104 
106  edm::Handle<reco::RecoToSimCollection> recotosimCollectionH;
107  iEvent.getByToken(trackRecoToSimAssociationToken_, recotosimCollectionH);
108 
109  edm::Handle<reco::SimToRecoCollection> simtorecoCollectionH;
110  iEvent.getByToken(trackSimToRecoAssociationToken_, simtorecoCollectionH);
111 
112  auto impl = std::make_unique<VertexAssociatorByTracks>(&(iEvent.productGetter()),
117  &selector_,
119  recotosimCollectionH.product(),
120  simtorecoCollectionH.product());
121 
122  auto toPut = std::make_unique<reco::VertexToTrackingVertexAssociator>(std::move(impl));
123  iEvent.put(std::move(toPut));
124 }
125 
ConfigurationDescriptions.h
VertexAssociatorByTracksProducer::S2RMatchedRecoRatio_
const double S2RMatchedRecoRatio_
Definition: VertexAssociatorByTracksProducer.cc:30
edm::StreamID
Definition: StreamID.h:30
Handle.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::Handle::product
T const * product() const
Definition: Handle.h:70
VertexAssociatorByTracksProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: VertexAssociatorByTracksProducer.cc:105
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
VertexAssociatorByTracksProducer
Definition: VertexAssociatorByTracksProducer.cc:16
TrackingParticleSelector.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
TrackingParticleSelector
Definition: TrackingParticleSelector.h:16
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
VertexAssociatorByTracksProducer::R2SMatchedSimRatio_
const double R2SMatchedSimRatio_
Definition: VertexAssociatorByTracksProducer.cc:27
config
Definition: config.py:1
MakerMacros.h
reco::SimToRecoCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > > SimToRecoCollection
Definition: TrackAssociation.h:16
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
reco::RecoToSimCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > > RecoToSimCollection
Definition: TrackAssociation.h:19
reco::modules::TrackingParticleSelector
SingleObjectSelector< TrackingParticleCollection, ::TrackingParticleSelector > TrackingParticleSelector
Definition: TrackingParticleSelector.cc:17
VertexAssociatorByTracksProducer::S2RMatchedSimRatio_
const double S2RMatchedSimRatio_
Definition: VertexAssociatorByTracksProducer.cc:29
VertexAssociatorByTracks.h
ParameterSetDescription.h
EDGetToken.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ParameterSet
Definition: Functions.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
DBConfiguration_cff.toPut
toPut
Definition: DBConfiguration_cff.py:25
VertexAssociatorByTracksProducer::trackQuality_
const reco::TrackBase::TrackQuality trackQuality_
Definition: VertexAssociatorByTracksProducer.cc:33
VertexAssociatorByTracksProducer::~VertexAssociatorByTracksProducer
~VertexAssociatorByTracksProducer() override
Definition: VertexAssociatorByTracksProducer.cc:70
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
impl
Definition: trackAlgoPriorityOrder.h:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
VertexAssociatorByTracksProducer::VertexAssociatorByTracksProducer
VertexAssociatorByTracksProducer(const edm::ParameterSet &)
Definition: VertexAssociatorByTracksProducer.cc:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
VertexAssociatorByTracksProducer::trackSimToRecoAssociationToken_
edm::EDGetTokenT< reco::SimToRecoCollection > trackSimToRecoAssociationToken_
Definition: VertexAssociatorByTracksProducer.cc:36
ParameterSet.h
EDProducer.h
VertexAssociatorByTracksProducer::R2SMatchedRecoRatio_
const double R2SMatchedRecoRatio_
Definition: VertexAssociatorByTracksProducer.cc:28
edm::Event
Definition: Event.h:73
VertexAssociatorByTracksProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: VertexAssociatorByTracksProducer.cc:72
edm::InputTag
Definition: InputTag.h:15
VertexToTrackingVertexAssociator.h
VertexAssociatorByTracksProducer::selector_
const TrackingParticleSelector selector_
Definition: VertexAssociatorByTracksProducer.cc:32
VertexAssociatorByTracksProducer::trackRecoToSimAssociationToken_
edm::EDGetTokenT< reco::RecoToSimCollection > trackRecoToSimAssociationToken_
Definition: VertexAssociatorByTracksProducer.cc:35