CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
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  virtual void beginJob() override;
58  virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
59  virtual 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 //
88  conf_(iConfig),
89  simHitTpMapToken_(consumes<SimHitTPAssociationList>(conf_.getParameter<edm::InputTag>("simHitTpMapTag"))),
90  SimToRecoDenominator(TrackAssociatorByHitsImpl::denomnone),
91  quality_SimToReco(conf_.getParameter<double>("Quality_SimToReco")),
92  purity_SimToReco(conf_.getParameter<double>("Purity_SimToReco")),
93  cut_RecoToSim(conf_.getParameter<double>("Cut_RecoToSim")),
94  UsePixels(conf_.getParameter<bool>("UsePixels")),
95  UseGrouped(conf_.getParameter<bool>("UseGrouped")),
96  UseSplitting(conf_.getParameter<bool>("UseSplitting")),
97  ThreeHitTracksAreSpecial(conf_.getParameter<bool>("ThreeHitTracksAreSpecial")),
98  AbsoluteNumberOfHits(conf_.getParameter<bool>("AbsoluteNumberOfHits"))
99 {
100  std::string tmp = conf_.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 
115 }
116 
117 
119 {
120 
121  // do anything here that needs to be done at desctruction time
122  // (e.g. close files, deallocate resources etc.)
123 
124 }
125 
126 
127 //
128 // member functions
129 //
130 
131 // ------------ method called to produce the data ------------
132 void
134 {
135  using namespace edm;
136 
137  std::unique_ptr<TrackerHitAssociator> thAssoc( new TrackerHitAssociator(iEvent,conf_));
138 
140  iSetup.get<IdealGeometryRecord>().get(tTopoHand);
141 
143  //warning: make sure the TP collection used in the map is the same used in the associator!
144  iEvent.getByToken(simHitTpMapToken_,simHitsTPAssoc);
145 
146  std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl> impl(
147  new TrackAssociatorByHitsImpl( std::move(thAssoc),
148  &(*tTopoHand),
149  &(*simHitsTPAssoc),
154  UsePixels,
155  UseGrouped,
156  UseSplitting,
159  std::unique_ptr<reco::TrackToTrackingParticleAssociator> toPut( new reco::TrackToTrackingParticleAssociator(std::move(impl)));
160  iEvent.put(std::move(toPut));
161 }
162 
163 // ------------ method called once each job just before starting event loop ------------
164 void
166 {
167 }
168 
169 // ------------ method called once each job just after ending the event loop ------------
170 void
172 }
173 
174 
175 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
176 void
178  //The following says we do not know what parameters are allowed so do no validation
179  // Please change this to state exactly what you do use, even if it is no parameters
181  desc.setUnknown();
182  descriptions.addDefault(desc);
183 }
184 
185 //define this as a plug-in
T getParameter(std::string const &) const
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
TrackAssociatorByHitsImpl::SimToRecoDenomType SimToRecoDenominator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
def move
Definition: eostools.py:508
std::vector< SimHitTPPair > SimHitTPAssociationList
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const T & get() const
Definition: EventSetup.h:55
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TrackAssociatorByHitsProducer(const edm::ParameterSet &)
edm::EDGetTokenT< SimHitTPAssociationList > simHitTpMapToken_