CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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),
108  &iEvent.get(theSimHitTpMapToken),
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
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EDProductGetter const & productGetter() const
Definition: Event.cc:106
edm::EDPutTokenT< reco::TrackToTrackingParticleAssociator > thePutToken
edm::EDGetTokenT< SimHitTPAssociationList > theSimHitTpMapToken
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > theGeometryToken
bool getData(T &iHolder) const
Definition: EventSetup.h:128
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 get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
~TrackAssociatorByPositionProducer() override=default
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackAssociatorByPositionProducer(const edm::ParameterSet &)
std::vector< SimHitTPPair > SimHitTPAssociationList
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283