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 
31 
34 
37 
41 
42 //
43 // class declaration
44 //
45 
47 
49 public:
52 
53  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
54 
55 private:
56  void beginJob() override;
57  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
58  void endJob() override;
59 
60  // ----------member data ---------------------------
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 //
87  simHitTpMapToken_(consumes<SimHitTPAssociationList>(iConfig.getParameter<edm::InputTag>("simHitTpMapTag"))),
89  quality_SimToReco(iConfig.getParameter<double>("Quality_SimToReco")),
90  purity_SimToReco(iConfig.getParameter<double>("Purity_SimToReco")),
91  cut_RecoToSim(iConfig.getParameter<double>("Cut_RecoToSim")),
92  UsePixels(iConfig.getParameter<bool>("UsePixels")),
93  UseGrouped(iConfig.getParameter<bool>("UseGrouped")),
94  UseSplitting(iConfig.getParameter<bool>("UseSplitting")),
95  ThreeHitTracksAreSpecial(iConfig.getParameter<bool>("ThreeHitTracksAreSpecial")),
96  AbsoluteNumberOfHits(iConfig.getParameter<bool>("AbsoluteNumberOfHits")) {
97  std::string tmp = iConfig.getParameter<std::string>("SimToRecoDenominator");
98  if (tmp == "sim") {
100  } else if (tmp == "reco") {
102  }
103 
105  throw cms::Exception("TrackAssociatorByHitsImpl") << "SimToRecoDenominator not specified as sim or reco";
106  }
107 
108  //register your products
109  produces<reco::TrackToTrackingParticleAssociator>();
110 }
111 
113  // do anything here that needs to be done at desctruction time
114  // (e.g. close files, deallocate resources etc.)
115 }
116 
117 //
118 // member functions
119 //
120 
121 // ------------ method called to produce the data ------------
123  using namespace edm;
124 
125  std::unique_ptr<TrackerHitAssociator> thAssoc(new TrackerHitAssociator(iEvent, trackerHitAssociatorConfig_));
126 
128  iSetup.get<TrackerTopologyRcd>().get(tTopoHand);
129 
131  //warning: make sure the TP collection used in the map is the same used in the associator!
132  iEvent.getByToken(simHitTpMapToken_, simHitsTPAssoc);
133 
134  std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl> impl(
136  std::move(thAssoc),
137  &(*tTopoHand),
138  &(*simHitsTPAssoc),
143  UsePixels,
144  UseGrouped,
145  UseSplitting,
148  std::unique_ptr<reco::TrackToTrackingParticleAssociator> toPut(
150  iEvent.put(std::move(toPut));
151 }
152 
153 // ------------ method called once each job just before starting event loop ------------
155 
156 // ------------ method called once each job just after ending the event loop ------------
158 
159 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
161  //The following says we do not know what parameters are allowed so do no validation
162  // Please change this to state exactly what you do use, even if it is no parameters
164  desc.setUnknown();
165  descriptions.addDefault(desc);
166 }
167 
168 //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:131
TrackerHitAssociator::Config trackerHitAssociatorConfig_
TrackAssociatorByHitsImpl::SimToRecoDenomType SimToRecoDenominator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
EDProductGetter const & productGetter() const
Definition: Event.cc:102
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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)
HLT enums.
T get() const
Definition: EventSetup.h:73
TrackAssociatorByHitsProducer(const edm::ParameterSet &)
tmp
align.sh
Definition: createJobs.py:716
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< SimHitTPAssociationList > simHitTpMapToken_