CMS 3D CMS Logo

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"))),
88  tTopoToken_(esConsumes()),
89  putToken_(produces<reco::TrackToTrackingParticleAssociator>()),
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!
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
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
TrackerHitAssociator::Config trackerHitAssociatorConfig_
TrackAssociatorByHitsImpl::SimToRecoDenomType SimToRecoDenominator
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< SimHitTPPair > SimHitTPAssociationList
edm::EDPutTokenT< reco::TrackToTrackingParticleAssociator > putToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
fixed size matrix
HLT enums.
TrackAssociatorByHitsProducer(const edm::ParameterSet &)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
tmp
align.sh
Definition: createJobs.py:716
~TrackAssociatorByHitsProducer() override=default
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< SimHitTPAssociationList > simHitTpMapToken_