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 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
32 
35 
38 
42 
43 //
44 // class declaration
45 //
46 
48 
50 public:
53 
54  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
55 
56 private:
57  void beginJob() override;
58  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
59  void endJob() override;
60 
61  // ----------member data ---------------------------
65  const double quality_SimToReco;
66  const double purity_SimToReco;
67  const double cut_RecoToSim;
68  const bool UsePixels;
69  const bool UseGrouped;
70  const bool UseSplitting;
73 };
74 
75 //
76 // constants, enums and typedefs
77 //
78 
79 
80 //
81 // static data member definitions
82 //
83 
84 //
85 // constructors and destructor
86 //
89  simHitTpMapToken_(consumes<SimHitTPAssociationList>(iConfig.getParameter<edm::InputTag>("simHitTpMapTag"))),
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 {
100  std::string tmp = iConfig.getParameter<std::string>("SimToRecoDenominator");
101  if (tmp=="sim") {
103  } else if (tmp == "reco") {
105  }
106 
108  throw cms::Exception("TrackAssociatorByHitsImpl") << "SimToRecoDenominator not specified as sim or reco";
109  }
110 
111  //register your products
112  produces<reco::TrackToTrackingParticleAssociator>();
113 }
114 
115 
117 {
118 
119  // do anything here that needs to be done at desctruction time
120  // (e.g. close files, deallocate resources etc.)
121 
122 }
123 
124 
125 //
126 // member functions
127 //
128 
129 // ------------ method called to produce the data ------------
130 void
132 {
133  using namespace edm;
134 
135  std::unique_ptr<TrackerHitAssociator> thAssoc( new TrackerHitAssociator(iEvent,trackerHitAssociatorConfig_));
136 
138  iSetup.get<TrackerTopologyRcd>().get(tTopoHand);
139 
141  //warning: make sure the TP collection used in the map is the same used in the associator!
142  iEvent.getByToken(simHitTpMapToken_,simHitsTPAssoc);
143 
144  std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl> impl(
146  std::move(thAssoc),
147  &(*tTopoHand),
148  &(*simHitsTPAssoc),
153  UsePixels,
154  UseGrouped,
155  UseSplitting,
158  std::unique_ptr<reco::TrackToTrackingParticleAssociator> toPut( new reco::TrackToTrackingParticleAssociator(std::move(impl)));
159  iEvent.put(std::move(toPut));
160 }
161 
162 // ------------ method called once each job just before starting event loop ------------
163 void
165 {
166 }
167 
168 // ------------ method called once each job just after ending the event loop ------------
169 void
171 }
172 
173 
174 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
175 void
177  //The following says we do not know what parameters are allowed so do no validation
178  // Please change this to state exactly what you do use, even if it is no parameters
180  desc.setUnknown();
181  descriptions.addDefault(desc);
182 }
183 
184 //define this as a plug-in
T getParameter(std::string const &) const
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
TrackerHitAssociator::Config trackerHitAssociatorConfig_
TrackAssociatorByHitsImpl::SimToRecoDenomType SimToRecoDenominator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDProductGetter const & productGetter() const
Definition: Event.cc:81
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< SimHitTPPair > SimHitTPAssociationList
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const T & get() const
Definition: EventSetup.h:55
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HLT enums.
TrackAssociatorByHitsProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< SimHitTPAssociationList > simHitTpMapToken_