CMS 3D CMS Logo

TrackAssociatorByChi2Producer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SimTracker/TrackAssociatorProducers
4 // Class: TrackAssociatorByChi2Producer
5 //
13 //
14 // Original Author: Christopher Jones
15 // Created: Tue, 06 Jan 2015 16:13:00 GMT
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
29 
31 
35 
37 
40 
41 //
42 // class declaration
43 //
44 
46 public:
49 
50  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
51 
52 private:
53  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
54 
55  // ----------member data ---------------------------
57  const double chi2cut_;
58  const bool onlyDiagonal_;
59 };
60 
61 //
62 // constants, enums and typedefs
63 //
64 
65 //
66 // static data member definitions
67 //
68 
69 //
70 // constructors and destructor
71 //
73  : bsToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
74  chi2cut_(iConfig.getParameter<double>("chi2cut")),
75  onlyDiagonal_(iConfig.getParameter<bool>("onlyDiagonal")) {
76  //register your products
77  produces<reco::TrackToTrackingParticleAssociator>();
78  produces<reco::TrackToGenParticleAssociator>();
79 }
80 
82  // do anything here that needs to be done at desctruction time
83  // (e.g. close files, deallocate resources etc.)
84 }
85 
86 //
87 // member functions
88 //
89 
90 // ------------ method called to produce the data ------------
92  using namespace edm;
93 
95  iSetup.get<IdealMagneticFieldRecord>().get(magField);
96 
98  iEvent.getByToken(bsToken_, beamSpot);
99 
100  {
101  std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl> impl(
102  new TrackAssociatorByChi2Impl(iEvent.productGetter(), *magField, *beamSpot, chi2cut_, onlyDiagonal_));
103 
104  std::unique_ptr<reco::TrackToTrackingParticleAssociator> assoc(
106 
107  iEvent.put(std::move(assoc));
108  }
109 
110  {
111  std::unique_ptr<reco::TrackToGenParticleAssociatorBaseImpl> impl(
113 
114  std::unique_ptr<reco::TrackToGenParticleAssociator> assoc(new reco::TrackToGenParticleAssociator(std::move(impl)));
115 
116  iEvent.put(std::move(assoc));
117  }
118 }
119 
120 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
122  //The following says we do not know what parameters are allowed so do no validation
123  // Please change this to state exactly what you do use, even if it is no parameters
125  desc.setUnknown();
126  descriptions.addDefault(desc);
127 }
128 
129 //define this as a plug-in
edm::StreamID
Definition: StreamID.h:30
TrackAssociatorByChi2Producer::~TrackAssociatorByChi2Producer
~TrackAssociatorByChi2Producer() override
Definition: TrackAssociatorByChi2Producer.cc:81
TrackToTrackingParticleAssociatorBaseImpl.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
ESHandle.h
align::BeamSpot
Definition: StructureType.h:95
TrackGenAssociatorByChi2Impl.h
edm::EDGetTokenT< reco::BeamSpot >
TrackAssociatorByChi2Impl.h
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
reco::TrackToTrackingParticleAssociator
Definition: TrackToTrackingParticleAssociator.h:51
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackAssociatorByChi2Producer
Definition: TrackAssociatorByChi2Producer.cc:45
reco::TrackToGenParticleAssociator
Definition: TrackToGenParticleAssociator.h:34
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
TrackAssociatorByChi2Producer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackAssociatorByChi2Producer.cc:121
edm::Handle< reco::BeamSpot >
trackingPlots.assoc
assoc
Definition: trackingPlots.py:183
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
MakerMacros.h
TrackAssociatorByChi2Producer::TrackAssociatorByChi2Producer
TrackAssociatorByChi2Producer(const edm::ParameterSet &)
Definition: TrackAssociatorByChi2Producer.cc:72
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TrackAssociatorByChi2Impl
Definition: TrackAssociatorByChi2Impl.h:38
IdealMagneticFieldRecord.h
edm::ESHandle< MagneticField >
TrackAssociatorByChi2Producer::chi2cut_
const double chi2cut_
Definition: TrackAssociatorByChi2Producer.cc:57
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
TrackToTrackingParticleAssociator.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
impl
Definition: trackAlgoPriorityOrder.h:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackAssociatorByChi2Producer::bsToken_
edm::EDGetTokenT< reco::BeamSpot > bsToken_
Definition: TrackAssociatorByChi2Producer.cc:56
Frameworkfwd.h
TrackAssociatorByChi2Producer::onlyDiagonal_
const bool onlyDiagonal_
Definition: TrackAssociatorByChi2Producer.cc:58
TrackToGenParticleAssociator.h
TrackGenAssociatorByChi2Impl
Definition: TrackGenAssociatorByChi2Impl.h:35
TrackAssociatorByChi2Producer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: TrackAssociatorByChi2Producer.cc:91
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99