CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackAssociatorByHitsProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SimTracker/TrackAssociatorProducers
4 // Class: TrackAssociatorByHitsProducer
5 //
13 //
14 // Original Author: Christopher Jones
15 // Created: Mon, 05 Jan 2015 20:38:27 GMT
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
30 
33 
36 
40 
41 //
42 // class declaration
43 //
44 
46 
48 public:
50  ~TrackAssociatorByHitsProducer() override = default;
51 
52  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
53 
54 private:
55  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
56 
57  // ----------member data ---------------------------
62 
64  const double quality_SimToReco;
65  const double purity_SimToReco;
66  const double cut_RecoToSim;
67  const bool UsePixels;
68  const bool UseGrouped;
69  const bool UseSplitting;
72 };
73 
74 //
75 // constants, enums and typedefs
76 //
77 
78 //
79 // static data member definitions
80 //
81 
82 //
83 // constructors and destructor
84 //
86  : trackerHitAssociatorConfig_(iConfig, consumesCollector()),
87  simHitTpMapToken_(consumes<SimHitTPAssociationList>(iConfig.getParameter<edm::InputTag>("simHitTpMapTag"))),
89  putToken_(produces<reco::TrackToTrackingParticleAssociator>()),
90  SimToRecoDenominator(TrackAssociatorByHitsImpl::denomnone),
91  quality_SimToReco(iConfig.getParameter<double>("Quality_SimToReco")),
92  purity_SimToReco(iConfig.getParameter<double>("Purity_SimToReco")),
93  cut_RecoToSim(iConfig.getParameter<double>("Cut_RecoToSim")),
94  UsePixels(iConfig.getParameter<bool>("UsePixels")),
95  UseGrouped(iConfig.getParameter<bool>("UseGrouped")),
96  UseSplitting(iConfig.getParameter<bool>("UseSplitting")),
97  ThreeHitTracksAreSpecial(iConfig.getParameter<bool>("ThreeHitTracksAreSpecial")),
98  AbsoluteNumberOfHits(iConfig.getParameter<bool>("AbsoluteNumberOfHits")) {
99  std::string tmp = iConfig.getParameter<std::string>("SimToRecoDenominator");
100  if (tmp == "sim") {
102  } else if (tmp == "reco") {
104  }
105 
107  throw cms::Exception("TrackAssociatorByHitsImpl") << "SimToRecoDenominator not specified as sim or reco";
108  }
109 }
110 
111 //
112 // member functions
113 //
114 
115 // ------------ method called to produce the data ------------
117  using namespace edm;
118 
119  auto thAssoc = std::make_unique<TrackerHitAssociator>(iEvent, trackerHitAssociatorConfig_);
120 
121  iEvent.emplace(putToken_,
122  std::make_unique<TrackAssociatorByHitsImpl>(
123  iEvent.productGetter(),
124  std::move(thAssoc),
125  &iSetup.getData(tTopoToken_),
126  //warning: make sure the TP collection used in the map is the same used in the associator!
127  &iEvent.get(simHitTpMapToken_),
132  UsePixels,
133  UseGrouped,
134  UseSplitting,
137 }
138 
139 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
141  //The following says we do not know what parameters are allowed so do no validation
142  // Please change this to state exactly what you do use, even if it is no parameters
144  desc.setUnknown();
145  descriptions.addDefault(desc);
146 }
147 
148 //define this as a plug-in
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
TrackerHitAssociator::Config trackerHitAssociatorConfig_
TrackAssociatorByHitsImpl::SimToRecoDenomType SimToRecoDenominator
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EDProductGetter const & productGetter() const
Definition: Event.cc:106
bool getData(T &iHolder) const
Definition: EventSetup.h:122
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
def move
Definition: eostools.py:511
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
std::vector< SimHitTPPair > SimHitTPAssociationList
edm::EDPutTokenT< reco::TrackToTrackingParticleAssociator > putToken_
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackAssociatorByHitsProducer(const edm::ParameterSet &)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
tmp
align.sh
Definition: createJobs.py:716
~TrackAssociatorByHitsProducer() override=default
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
tTopoToken_
edm::EDGetTokenT< SimHitTPAssociationList > simHitTpMapToken_