CMS 3D CMS Logo

TrackAssociatorByPositionProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SimTracker/TrackAssociatorProducers
4 // Class: TrackAssociatorByPositionProducer
5 //
13 //
14 // Original Author: Christopher Jones
15 // Created: Mon, 05 Jan 2015 22:05:57 GMT
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
30 
35 
36 //
37 // class declaration
38 //
40 
42 public:
44  ~TrackAssociatorByPositionProducer() override = default;
45 
46  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
47 
48 private:
49  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
50 
51  // ----------member data ---------------------------
56  double theQminCut;
57  double theQCut;
62 };
63 
64 //
65 // static data member definitions
66 //
68  if (meth == "chi2") {
70  } else if (meth == "dist") {
72  } else if (meth == "momdr") {
74  } else if (meth == "posdr") {
76  } else {
77  throw cms::Exception("BadParameterName") << meth << " TrackAssociatorByPostionImpl::Method name not recognized.";
78  }
79 }
80 
81 //
82 // constructors and destructor
83 //
85  : theSimHitTpMapToken{consumes<SimHitTPAssociationList>(iConfig.getParameter<edm::InputTag>("simHitTpMapTag"))},
86  thePropagatorToken{esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("propagator")))},
87  theGeometryToken{esConsumes()},
88  thePutToken{produces<reco::TrackToTrackingParticleAssociator>()},
89  theQminCut{iConfig.getParameter<double>("QminCut")},
90  theQCut{iConfig.getParameter<double>("QCut")},
91  thePositionMinimumDistance{iConfig.getParameter<double>("positionMinimumDistance")},
92  theMethod{parseMethodName(iConfig.getParameter<std::string>("method"))},
93  theMinIfNoMatch{iConfig.getParameter<bool>("MinIfNoMatch")},
94  theConsiderAllSimHits{iConfig.getParameter<bool>("ConsiderAllSimHits")} {}
95 
96 //
97 // member functions
98 //
99 
100 // ------------ method called to produce the data ------------
103  const edm::EventSetup& iSetup) const {
104  iEvent.emplace(thePutToken,
105  std::make_unique<TrackAssociatorByPositionImpl>(iEvent.productGetter(),
106  &iSetup.getData(theGeometryToken),
107  &iSetup.getData(thePropagatorToken),
109  theQminCut,
110  theQCut,
112  theMethod,
115 }
116 
117 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
119  //The following says we do not know what parameters are allowed so do no validation
120  // Please change this to state exactly what you do use, even if it is no parameters
122  desc.setUnknown();
123  descriptions.addDefault(desc);
124 }
125 
126 //define this as a plug-in
static TrackAssociatorByPositionImpl::Method parseMethodName(const std::string &meth)
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDPutTokenT< reco::TrackToTrackingParticleAssociator > thePutToken
edm::EDGetTokenT< SimHitTPAssociationList > theSimHitTpMapToken
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > theGeometryToken
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrackAssociatorByPositionImpl::Method theMethod
bool getData(T &iHolder) const
Definition: EventSetup.h:122
~TrackAssociatorByPositionProducer() override=default
TrackAssociatorByPositionProducer(const edm::ParameterSet &)
std::vector< SimHitTPPair > SimHitTPAssociationList