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:
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
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::StreamID
Definition: StreamID.h:30
TrackAssociatorByPositionImpl::Method::chi2
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< SimHitTPAssociationList >
TrackAssociatorByPositionProducer::theConsiderAllSimHits
bool theConsiderAllSimHits
Definition: TrackAssociatorByPositionProducer.cc:59
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackAssociatorByPositionProducer::theQminCut
double theQminCut
Definition: TrackAssociatorByPositionProducer.cc:54
TrackAssociatorByPositionImpl::Method::momdr
reco::TrackToTrackingParticleAssociator
Definition: TrackToTrackingParticleAssociator.h:51
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackAssociatorByPositionImpl::Method::dist
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
edm::Handle
Definition: AssociativeIterator.h:50
TrackAssociatorByPositionImpl.h
TtSemiLepEvtBuilder_cfi.meth
meth
Definition: TtSemiLepEvtBuilder_cfi.py:59
TrackAssociatorByPositionImpl::Method::posdr
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESHandle< Propagator >
parseMethodName
static TrackAssociatorByPositionImpl::Method parseMethodName(const std::string &meth)
Definition: TrackAssociatorByPositionProducer.cc:69
TrackAssociatorByPositionProducer::thePositionMinimumDistance
double thePositionMinimumDistance
Definition: TrackAssociatorByPositionProducer.cc:56
GlobalTrackingGeometryRecord.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackToTrackingParticleAssociator.h
TrackAssociatorByPositionProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackAssociatorByPositionProducer.cc:141
edm::ParameterSet
Definition: ParameterSet.h:47
TrackAssociatorByPositionProducer::theMethod
TrackAssociatorByPositionImpl::Method theMethod
Definition: TrackAssociatorByPositionProducer.cc:57
Event.h
TrackAssociatorByPositionProducer::theQCut
double theQCut
Definition: TrackAssociatorByPositionProducer.cc:55
TrackAssociatorByPositionProducer::theMinIfNoMatch
bool theMinIfNoMatch
Definition: TrackAssociatorByPositionProducer.cc:58
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
DBConfiguration_cff.toPut
toPut
Definition: DBConfiguration_cff.py:25
get
#define get
TrackAssociatorByPositionImpl
Definition: TrackAssociatorByPositionImpl.h:30
TrackAssociatorByPositionImpl::Method
Method
Definition: TrackAssociatorByPositionImpl.h:34
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
impl
Definition: trackAlgoPriorityOrder.h:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackAssociatorByPositionProducer::TrackAssociatorByPositionProducer
TrackAssociatorByPositionProducer(const edm::ParameterSet &)
Definition: TrackAssociatorByPositionProducer.cc:86
Frameworkfwd.h
TrackingComponentsRecord.h
Exception
Definition: hltDiff.cc:246
TrackAssociatorByPositionProducer::theSimHitTpMapToken
edm::EDGetTokenT< SimHitTPAssociationList > theSimHitTpMapToken
Definition: TrackAssociatorByPositionProducer.cc:52
TrackAssociatorByPositionProducer::thePname
std::string thePname
Definition: TrackAssociatorByPositionProducer.cc:53
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackAssociatorByPositionProducer::~TrackAssociatorByPositionProducer
~TrackAssociatorByPositionProducer() override
Definition: TrackAssociatorByPositionProducer.cc:99
SimHitTPAssociationList
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
Definition: TrackAssociatorByHitsProducer.cc:46
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
TrackAssociatorByPositionProducer
Definition: TrackAssociatorByPositionProducer.cc:41
edm::InputTag
Definition: InputTag.h:15
TrackAssociatorByPositionProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: TrackAssociatorByPositionProducer.cc:109
TrackAssociatorByPositionImpl::SimHitTPAssociationList
std::vector< SimHitTPPair > SimHitTPAssociationList
Definition: TrackAssociatorByPositionImpl.h:33
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12