CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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:
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 ---------------------------
54  double theQminCut;
55  double theQCut;
60 };
61 
62 //
63 // constants, enums and typedefs
64 //
65 
66 //
67 // static data member definitions
68 //
70  if (meth == "chi2") {
72  } else if (meth == "dist") {
74  } else if (meth == "momdr") {
76  } else if (meth == "posdr") {
78  } else {
79  throw cms::Exception("BadParameterName") << meth << " TrackAssociatorByPostionImpl::Method name not recognized.";
80  }
81 }
82 
83 //
84 // constructors and destructor
85 //
87  : theSimHitTpMapToken{consumes<SimHitTPAssociationList>(iConfig.getParameter<edm::InputTag>("simHitTpMapTag"))},
88  thePname{iConfig.getParameter<std::string>("propagator")},
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  //register your products
96  produces<reco::TrackToTrackingParticleAssociator>();
97 }
98 
100  // do anything here that needs to be done at desctruction time
101  // (e.g. close files, deallocate resources etc.)
102 }
103 
104 //
105 // member functions
106 //
107 
108 // ------------ method called to produce the data ------------
111  const edm::EventSetup& iSetup) const {
112  using namespace edm;
113 
115  iEvent.getByToken(theSimHitTpMapToken, assocList);
116 
118  iSetup.get<TrackingComponentsRecord>().get(thePname, theP);
119 
121  iSetup.get<GlobalTrackingGeometryRecord>().get(theG);
122 
123  std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl> impl{
125  theP.product(),
126  assocList.product(),
127  theQminCut,
128  theQCut,
130  theMethod,
133 
134  std::unique_ptr<reco::TrackToTrackingParticleAssociator> toPut{
136 
137  iEvent.put(std::move(toPut));
138 }
139 
140 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
142  //The following says we do not know what parameters are allowed so do no validation
143  // Please change this to state exactly what you do use, even if it is no parameters
145  desc.setUnknown();
146  descriptions.addDefault(desc);
147 }
148 
149 //define this as a plug-in
static TrackAssociatorByPositionImpl::Method parseMethodName(const std::string &meth)
T getParameter(std::string const &) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< SimHitTPAssociationList > theSimHitTpMapToken
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrackAssociatorByPositionImpl::Method theMethod
T const * product() const
Definition: Handle.h:69
HLT enums.
T get() const
Definition: EventSetup.h:73
TrackAssociatorByPositionProducer(const edm::ParameterSet &)
std::vector< SimHitTPPair > SimHitTPAssociationList
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511