CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackAlgoCompareUtil Class Reference

#include <TrackAlgoCompareUtil.h>

Inheritance diagram for TrackAlgoCompareUtil:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackAlgoCompareUtil (const edm::ParameterSet &)
 
 ~TrackAlgoCompareUtil () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
void SetTrackingParticleD0Dz (TrackingParticleRef tp, const reco::BeamSpot &bs, const MagneticField *bf, RecoTracktoTP &RTTP) const
 
void SetTrackingParticleD0Dz (TrackingParticleRef tp, const reco::BeamSpot &bs, const MagneticField *bf, TPtoRecoTrack &TPRT) const
 

Private Attributes

edm::EDGetTokenT< reco::RecoToSimCollectionassociatormap_algoA_recoToSim
 
edm::EDGetTokenT< reco::SimToRecoCollectionassociatormap_algoA_simToReco
 
edm::EDGetTokenT< reco::RecoToSimCollectionassociatormap_algoB_recoToSim
 
edm::EDGetTokenT< reco::SimToRecoCollectionassociatormap_algoB_simToReco
 
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatorassocLabel_algoA
 
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatorassocLabel_algoB
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotLabel
 
edm::EDGetTokenT< TrackingParticleCollectiontrackingParticleLabel_effic
 
edm::EDGetTokenT< TrackingParticleCollectiontrackingParticleLabel_fakes
 
edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoA
 
edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoB
 
const bool UseAssociators
 
const bool UseVertex
 
edm::EDGetTokenT< reco::VertexCollectionvertexLabel_algoA
 
edm::EDGetTokenT< reco::VertexCollectionvertexLabel_algoB
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 49 of file TrackAlgoCompareUtil.h.

Constructor & Destructor Documentation

◆ TrackAlgoCompareUtil()

TrackAlgoCompareUtil::TrackAlgoCompareUtil ( const edm::ParameterSet iConfig)
explicit

Definition at line 7 of file TrackAlgoCompareUtil.cc.

8  : trackLabel_algoA(consumes<View<reco::Track>>(iConfig.getParameter<edm::InputTag>("trackLabel_algoA"))),
11  consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("trackingParticleLabel_fakes"))),
13  consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("trackingParticleLabel_effic"))),
14  beamSpotLabel(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotLabel"))),
15  UseAssociators(iConfig.getParameter<bool>("UseAssociators")),
16  UseVertex(iConfig.getParameter<bool>("UseVertex")) {
17  //now do what ever other initialization is needed
18  if (UseVertex) {
19  vertexLabel_algoA = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexLabel_algoA"));
20  vertexLabel_algoB = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexLabel_algoB"));
21  }
22 
23  if (UseAssociators) {
24  assocLabel_algoA = consumes<reco::TrackToTrackingParticleAssociator>(
25  iConfig.getUntrackedParameter<std::string>("assocLabel_algoA", "trackAssociatorByHits"));
26  assocLabel_algoB = consumes<reco::TrackToTrackingParticleAssociator>(
27  iConfig.getUntrackedParameter<std::string>("assocLabel_algoB", "trackAssociatorByHits"));
28  } else {
29  edm::InputTag algoA = iConfig.getParameter<edm::InputTag>("associatormap_algoA");
30  edm::InputTag algoB = iConfig.getParameter<edm::InputTag>("associatormap_algoB");
31 
32  associatormap_algoA_recoToSim = consumes<reco::RecoToSimCollection>(algoA);
33  associatormap_algoB_recoToSim = consumes<reco::RecoToSimCollection>(algoB);
34  associatormap_algoA_simToReco = consumes<reco::SimToRecoCollection>(algoA);
35  associatormap_algoB_simToReco = consumes<reco::SimToRecoCollection>(algoB);
36  }
37 
38  produces<RecoTracktoTPCollection>("AlgoA");
39  produces<RecoTracktoTPCollection>("AlgoB");
40  produces<TPtoRecoTrackCollection>("TP");
41 }

References associatormap_algoA_recoToSim, associatormap_algoA_simToReco, associatormap_algoB_recoToSim, associatormap_algoB_simToReco, assocLabel_algoA, assocLabel_algoB, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, UseAssociators, UseVertex, vertexLabel_algoA, and vertexLabel_algoB.

◆ ~TrackAlgoCompareUtil()

TrackAlgoCompareUtil::~TrackAlgoCompareUtil ( )
override

Definition at line 43 of file TrackAlgoCompareUtil.cc.

43 {}

Member Function Documentation

◆ produce()

void TrackAlgoCompareUtil::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 46 of file TrackAlgoCompareUtil.cc.

46  {
47  // create output collection instance
48  auto outputAlgoA = std::make_unique<RecoTracktoTPCollection>();
49  auto outputAlgoB = std::make_unique<RecoTracktoTPCollection>();
50  auto outputTP = std::make_unique<TPtoRecoTrackCollection>();
51 
52  // Get Inputs
53  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
54  iEvent.getByToken(beamSpotLabel, recoBeamSpotHandle);
55  reco::BeamSpot beamSpot = *recoBeamSpotHandle;
56 
57  edm::Handle<View<reco::Track>> trackCollAlgoA;
58  iEvent.getByToken(trackLabel_algoA, trackCollAlgoA);
59 
60  edm::Handle<View<reco::Track>> trackCollAlgoB;
61  iEvent.getByToken(trackLabel_algoB, trackCollAlgoB);
62 
63  edm::Handle<TrackingParticleCollection> trackingParticleCollFakes;
64  iEvent.getByToken(trackingParticleLabel_fakes, trackingParticleCollFakes);
65 
66  edm::Handle<TrackingParticleCollection> trackingParticleCollEffic;
67  iEvent.getByToken(trackingParticleLabel_effic, trackingParticleCollEffic);
68 
71  if (UseVertex) {
72  iEvent.getByToken(vertexLabel_algoA, vertexCollAlgoA);
73  iEvent.getByToken(vertexLabel_algoB, vertexCollAlgoB);
74  }
75 
76  // call the associator functions:
77  reco::RecoToSimCollection recSimColl_AlgoA;
78  reco::RecoToSimCollection recSimColl_AlgoB;
79 
80  reco::SimToRecoCollection simRecColl_AlgoA;
81  reco::SimToRecoCollection simRecColl_AlgoB;
82 
83  if (UseAssociators) {
85  iEvent.getByToken(assocLabel_algoA, theAssociator_algoA);
86 
88  iEvent.getByToken(assocLabel_algoB, theAssociator_algoB);
89 
90  recSimColl_AlgoA = theAssociator_algoA->associateRecoToSim(trackCollAlgoA, trackingParticleCollFakes);
91  recSimColl_AlgoB = theAssociator_algoB->associateRecoToSim(trackCollAlgoB, trackingParticleCollFakes);
92 
93  simRecColl_AlgoA = theAssociator_algoA->associateSimToReco(trackCollAlgoA, trackingParticleCollEffic);
94  simRecColl_AlgoB = theAssociator_algoB->associateSimToReco(trackCollAlgoB, trackingParticleCollEffic);
95  } else {
96  Handle<reco::RecoToSimCollection> recotosimCollectionH_AlgoA;
97  iEvent.getByToken(associatormap_algoA_recoToSim, recotosimCollectionH_AlgoA);
98  recSimColl_AlgoA = *(recotosimCollectionH_AlgoA.product());
99 
100  Handle<reco::RecoToSimCollection> recotosimCollectionH_AlgoB;
101  iEvent.getByToken(associatormap_algoB_recoToSim, recotosimCollectionH_AlgoB);
102  recSimColl_AlgoB = *(recotosimCollectionH_AlgoB.product());
103 
104  Handle<reco::SimToRecoCollection> simtorecoCollectionH_AlgoA;
105  iEvent.getByToken(associatormap_algoA_simToReco, simtorecoCollectionH_AlgoA);
106  simRecColl_AlgoA = *(simtorecoCollectionH_AlgoA.product());
107 
108  Handle<reco::SimToRecoCollection> simtorecoCollectionH_AlgoB;
109  iEvent.getByToken(associatormap_algoB_simToReco, simtorecoCollectionH_AlgoB);
110  simRecColl_AlgoB = *(simtorecoCollectionH_AlgoB.product());
111  }
112 
113  // define the vector of references to trackingParticleColl associated with a given reco::Track
114  std::vector<std::pair<TrackingParticleRef, double>> associatedTrackingParticles;
115 
116  // define the vector of references to trackColl associated with a given TrackingParticle
117  std::vector<std::pair<reco::TrackBaseRef, double>> associatedRecoTracks;
118 
119  // Get the magnetic field data from the event (used to calculate the point of closest TrackingParticle)
120  edm::ESHandle<MagneticField> theMagneticField;
121  iSetup.get<IdealMagneticFieldRecord>().get(theMagneticField);
122  const MagneticField* magneticField = theMagneticField.product();
123 
124  // fill collection algoA
125  for (View<reco::Track>::size_type i = 0; i < trackCollAlgoA->size(); ++i) {
126  // get recoTrack algo A
127  reco::TrackBaseRef recoTrack(trackCollAlgoA, i);
128  RecoTracktoTP recoTracktoTP;
129  recoTracktoTP.SetRecoTrack(recoTrack);
130  recoTracktoTP.SetBeamSpot(beamSpot.position());
131 
132  // get the associated trackingParticle
133  if (recSimColl_AlgoA.find(recoTrack) != recSimColl_AlgoA.end()) {
134  associatedTrackingParticles = recSimColl_AlgoA[recoTrack];
135  recoTracktoTP.SetTrackingParticle(associatedTrackingParticles.begin()->first);
136  recoTracktoTP.SetShared(associatedTrackingParticles.begin()->second);
137  SetTrackingParticleD0Dz(associatedTrackingParticles.begin()->first, beamSpot, magneticField, recoTracktoTP);
138  } else {
139  recoTracktoTP.SetTrackingParticle(TrackingParticleRef());
140  recoTracktoTP.SetShared(-1.0);
141  }
142 
143  // get the reco primary vertex info
144  if (UseVertex && !vertexCollAlgoA->empty()) {
145  recoTracktoTP.SetRecoVertex(reco::VertexRef(vertexCollAlgoA, 0));
146  } else {
147  recoTracktoTP.SetRecoVertex(reco::VertexRef());
148  }
149 
150  outputAlgoA->push_back(recoTracktoTP);
151  }
152 
153  // fill collection algoB
154  for (reco::TrackCollection::size_type i = 0; i < trackCollAlgoB->size(); ++i) {
155  // get recoTrack algo B
156  reco::TrackBaseRef recoTrack(trackCollAlgoB, i);
157  RecoTracktoTP recoTracktoTP;
158  recoTracktoTP.SetRecoTrack(recoTrack);
159  recoTracktoTP.SetBeamSpot(beamSpot.position());
160 
161  // get the associated trackingParticle
162  if (recSimColl_AlgoB.find(recoTrack) != recSimColl_AlgoB.end()) {
163  associatedTrackingParticles = recSimColl_AlgoB[recoTrack];
164  recoTracktoTP.SetTrackingParticle(associatedTrackingParticles.begin()->first);
165  recoTracktoTP.SetShared(associatedTrackingParticles.begin()->second);
166  SetTrackingParticleD0Dz(associatedTrackingParticles.begin()->first, beamSpot, magneticField, recoTracktoTP);
167  } else {
168  recoTracktoTP.SetTrackingParticle(TrackingParticleRef());
169  recoTracktoTP.SetShared(-1.0);
170  }
171 
172  // get the reco primary vertex info
173  if (UseVertex && !vertexCollAlgoB->empty()) {
174  recoTracktoTP.SetRecoVertex(reco::VertexRef(vertexCollAlgoB, 0));
175  } else {
176  recoTracktoTP.SetRecoVertex(reco::VertexRef());
177  }
178 
179  outputAlgoB->push_back(recoTracktoTP);
180  }
181 
182  for (TrackingParticleCollection::size_type i = 0; i < trackingParticleCollEffic->size(); ++i) {
183  // initialize the trackingParticle (sim) info
184  TrackingParticleRef tparticle(trackingParticleCollEffic, i);
185  TPtoRecoTrack tptoRecoTrack;
186  tptoRecoTrack.SetBeamSpot(beamSpot.position());
187  tptoRecoTrack.SetTrackingParticle(tparticle);
188  SetTrackingParticleD0Dz(tparticle, beamSpot, magneticField, tptoRecoTrack);
189 
190  // get the assocated recoTrack algoA
191  if (simRecColl_AlgoA.find(tparticle) != simRecColl_AlgoA.end()) {
192  associatedRecoTracks = simRecColl_AlgoA[tparticle];
193  tptoRecoTrack.SetRecoTrack_AlgoA(associatedRecoTracks.begin()->first);
194  tptoRecoTrack.SetShared_AlgoA(associatedRecoTracks.begin()->second);
195  } else {
196  tptoRecoTrack.SetRecoTrack_AlgoA(reco::TrackBaseRef());
197  tptoRecoTrack.SetShared_AlgoA(-1.0);
198  }
199 
200  // get the recoVertex algo A
201  if (UseVertex && !vertexCollAlgoA->empty()) {
202  tptoRecoTrack.SetRecoVertex_AlgoA(reco::VertexRef(vertexCollAlgoA, 0));
203  } else {
204  tptoRecoTrack.SetRecoVertex_AlgoA(reco::VertexRef());
205  }
206 
207  // get the assocated recoTrack algoB
208  if (simRecColl_AlgoB.find(tparticle) != simRecColl_AlgoB.end()) {
209  associatedRecoTracks = simRecColl_AlgoB[tparticle];
210  tptoRecoTrack.SetRecoTrack_AlgoB(associatedRecoTracks.begin()->first);
211  tptoRecoTrack.SetShared_AlgoB(associatedRecoTracks.begin()->second);
212  } else {
213  tptoRecoTrack.SetRecoTrack_AlgoB(reco::TrackBaseRef());
214  tptoRecoTrack.SetShared_AlgoB(-1.0);
215  }
216  // get the recoVertex algo B
217  if (UseVertex && !vertexCollAlgoB->empty()) {
218  tptoRecoTrack.SetRecoVertex_AlgoB(reco::VertexRef(vertexCollAlgoB, 0));
219  } else {
220  tptoRecoTrack.SetRecoVertex_AlgoB(reco::VertexRef());
221  }
222 
223  outputTP->push_back(tptoRecoTrack);
224  }
225 
226  // put the collection in the event record
227  iEvent.put(std::move(outputAlgoA), "AlgoA");
228  iEvent.put(std::move(outputAlgoB), "AlgoB");
229  iEvent.put(std::move(outputTP), "TP");
230 }

References reco::TrackToTrackingParticleAssociator::associateRecoToSim(), reco::TrackToTrackingParticleAssociator::associateSimToReco(), associatormap_algoA_recoToSim, associatormap_algoA_simToReco, associatormap_algoB_recoToSim, associatormap_algoB_simToReco, assocLabel_algoA, assocLabel_algoB, pwdgSkimBPark_cfi::beamSpot, beamSpotLabel, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), edm::EventSetup::get(), get, mps_fire::i, iEvent, HLT_2018_cff::magneticField, eostools::move(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), RecoTracktoTP::SetBeamSpot(), TPtoRecoTrack::SetBeamSpot(), RecoTracktoTP::SetRecoTrack(), TPtoRecoTrack::SetRecoTrack_AlgoA(), TPtoRecoTrack::SetRecoTrack_AlgoB(), RecoTracktoTP::SetRecoVertex(), TPtoRecoTrack::SetRecoVertex_AlgoA(), TPtoRecoTrack::SetRecoVertex_AlgoB(), RecoTracktoTP::SetShared(), TPtoRecoTrack::SetShared_AlgoA(), TPtoRecoTrack::SetShared_AlgoB(), TPtoRecoTrack::SetTrackingParticle(), RecoTracktoTP::SetTrackingParticle(), SetTrackingParticleD0Dz(), trackingParticleLabel_effic, trackingParticleLabel_fakes, trackLabel_algoA, trackLabel_algoB, UseAssociators, UseVertex, vertexLabel_algoA, and vertexLabel_algoB.

◆ SetTrackingParticleD0Dz() [1/2]

void TrackAlgoCompareUtil::SetTrackingParticleD0Dz ( TrackingParticleRef  tp,
const reco::BeamSpot bs,
const MagneticField bf,
RecoTracktoTP RTTP 
) const
private

Definition at line 259 of file TrackAlgoCompareUtil.cc.

262  {
263  GlobalPoint trackingParticleVertex(tp->vertex().x(), tp->vertex().y(), tp->vertex().z());
264  GlobalVector trackingParticleP3(
265  tp->g4Track_begin()->momentum().x(), tp->g4Track_begin()->momentum().y(), tp->g4Track_begin()->momentum().z());
266  TrackCharge trackingParticleCharge(tp->charge());
267 
268  FreeTrajectoryState ftsAtProduction(trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf);
269  TSCBLBuilderNoMaterial tscblBuilder;
270  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
271  tscblBuilder(ftsAtProduction, bs); //as in TrackProducerAlgorithm
272 
273  if (tsAtClosestApproach.isValid()) {
274  GlobalPoint v1 = tsAtClosestApproach.trackStateAtPCA().position();
275  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
276 
278  RTTP.SetTrackingParticlePCA(v1);
279  } else {
280  RTTP.SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
281  RTTP.SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
282  }
283 }

References cms::cuda::bs, TrajectoryStateClosestToBeamLine::isValid(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), RecoTracktoTP::SetTrackingParticleMomentumPCA(), RecoTracktoTP::SetTrackingParticlePCA(), cmsswSequenceInfo::tp, and TrajectoryStateClosestToBeamLine::trackStateAtPCA().

◆ SetTrackingParticleD0Dz() [2/2]

void TrackAlgoCompareUtil::SetTrackingParticleD0Dz ( TrackingParticleRef  tp,
const reco::BeamSpot bs,
const MagneticField bf,
TPtoRecoTrack TPRT 
) const
private

Definition at line 233 of file TrackAlgoCompareUtil.cc.

236  {
237  GlobalPoint trackingParticleVertex(tp->vertex().x(), tp->vertex().y(), tp->vertex().z());
238  GlobalVector trackingParticleP3(
239  tp->g4Track_begin()->momentum().x(), tp->g4Track_begin()->momentum().y(), tp->g4Track_begin()->momentum().z());
240  TrackCharge trackingParticleCharge(tp->charge());
241 
242  FreeTrajectoryState ftsAtProduction(trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf);
243  TSCBLBuilderNoMaterial tscblBuilder;
244  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
245  tscblBuilder(ftsAtProduction, bs); //as in TrackProducerAlgorithm
246 
247  if (tsAtClosestApproach.isValid()) {
248  GlobalPoint v1 = tsAtClosestApproach.trackStateAtPCA().position();
249  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
250 
252  TPRT.SetTrackingParticlePCA(v1);
253  } else {
254  TPRT.SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
255  TPRT.SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
256  }
257 }

References cms::cuda::bs, TrajectoryStateClosestToBeamLine::isValid(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), TPtoRecoTrack::SetTrackingParticleMomentumPCA(), TPtoRecoTrack::SetTrackingParticlePCA(), cmsswSequenceInfo::tp, and TrajectoryStateClosestToBeamLine::trackStateAtPCA().

Referenced by produce().

Member Data Documentation

◆ associatormap_algoA_recoToSim

edm::EDGetTokenT<reco::RecoToSimCollection> TrackAlgoCompareUtil::associatormap_algoA_recoToSim
private

Definition at line 74 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ associatormap_algoA_simToReco

edm::EDGetTokenT<reco::SimToRecoCollection> TrackAlgoCompareUtil::associatormap_algoA_simToReco
private

Definition at line 76 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ associatormap_algoB_recoToSim

edm::EDGetTokenT<reco::RecoToSimCollection> TrackAlgoCompareUtil::associatormap_algoB_recoToSim
private

Definition at line 75 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ associatormap_algoB_simToReco

edm::EDGetTokenT<reco::SimToRecoCollection> TrackAlgoCompareUtil::associatormap_algoB_simToReco
private

Definition at line 77 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ assocLabel_algoA

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> TrackAlgoCompareUtil::assocLabel_algoA
private

Definition at line 78 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ assocLabel_algoB

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> TrackAlgoCompareUtil::assocLabel_algoB
private

Definition at line 79 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ beamSpotLabel

edm::EDGetTokenT<reco::BeamSpot> TrackAlgoCompareUtil::beamSpotLabel
private

Definition at line 73 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackingParticleLabel_effic

edm::EDGetTokenT<TrackingParticleCollection> TrackAlgoCompareUtil::trackingParticleLabel_effic
private

Definition at line 70 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackingParticleLabel_fakes

edm::EDGetTokenT<TrackingParticleCollection> TrackAlgoCompareUtil::trackingParticleLabel_fakes
private

Definition at line 69 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackLabel_algoA

edm::EDGetTokenT<edm::View<reco::Track> > TrackAlgoCompareUtil::trackLabel_algoA
private

Definition at line 67 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackLabel_algoB

edm::EDGetTokenT<edm::View<reco::Track> > TrackAlgoCompareUtil::trackLabel_algoB
private

Definition at line 68 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ UseAssociators

const bool TrackAlgoCompareUtil::UseAssociators
private

Definition at line 80 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ UseVertex

const bool TrackAlgoCompareUtil::UseVertex
private

Definition at line 81 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ vertexLabel_algoA

edm::EDGetTokenT<reco::VertexCollection> TrackAlgoCompareUtil::vertexLabel_algoA
private

Definition at line 71 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ vertexLabel_algoB

edm::EDGetTokenT<reco::VertexCollection> TrackAlgoCompareUtil::vertexLabel_algoB
private

Definition at line 72 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

Vector3DBase
Definition: Vector3DBase.h:8
TPtoRecoTrack::SetShared_AlgoB
void SetShared_AlgoB(const float &mB)
Definition: TPtoRecoTrack.h:31
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
TrajectoryStateClosestToBeamLine
Definition: TrajectoryStateClosestToBeamLine.h:15
TPtoRecoTrack::SetRecoVertex_AlgoA
void SetRecoVertex_AlgoA(reco::VertexRef vertex)
Definition: TPtoRecoTrack.h:33
edm::AssociationMap::find
const_iterator find(const key_type &k) const
find element with specified reference key
Definition: AssociationMap.h:173
mps_fire.i
i
Definition: mps_fire.py:355
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
TPtoRecoTrack::SetTrackingParticleMomentumPCA
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: TPtoRecoTrack.h:82
TrackCharge
int TrackCharge
Definition: TrackCharge.h:4
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HLT_2018_cff.magneticField
magneticField
Definition: HLT_2018_cff.py:348
TrackAlgoCompareUtil::associatormap_algoA_simToReco
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoA_simToReco
Definition: TrackAlgoCompareUtil.h:76
TPtoRecoTrack::SetRecoTrack_AlgoA
void SetRecoTrack_AlgoA(reco::TrackBaseRef track)
Definition: TPtoRecoTrack.h:27
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
reco::TrackToTrackingParticleAssociator::associateRecoToSim
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
Definition: TrackToTrackingParticleAssociator.h:64
TPtoRecoTrack::SetRecoTrack_AlgoB
void SetRecoTrack_AlgoB(reco::TrackBaseRef track)
Definition: TPtoRecoTrack.h:28
RecoTracktoTP::SetRecoTrack
void SetRecoTrack(reco::TrackBaseRef track)
Definition: RecoTracktoTP.h:26
RecoTracktoTP::SetTrackingParticleMomentumPCA
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: RecoTracktoTP.h:55
TrackAlgoCompareUtil::SetTrackingParticleD0Dz
void SetTrackingParticleD0Dz(TrackingParticleRef tp, const reco::BeamSpot &bs, const MagneticField *bf, TPtoRecoTrack &TPRT) const
Definition: TrackAlgoCompareUtil.cc:233
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
edm::Handle< reco::BeamSpot >
edm::Ref< VertexCollection >
RecoTracktoTP::SetShared
void SetShared(const float &m)
Definition: RecoTracktoTP.h:29
TrackAlgoCompareUtil::trackingParticleLabel_effic
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleLabel_effic
Definition: TrackAlgoCompareUtil.h:70
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
cms::cuda::bs
bs
Definition: HistoContainer.h:127
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackAlgoCompareUtil::beamSpotLabel
edm::EDGetTokenT< reco::BeamSpot > beamSpotLabel
Definition: TrackAlgoCompareUtil.h:73
reco::BeamSpot
Definition: BeamSpot.h:21
TrackAlgoCompareUtil::vertexLabel_algoA
edm::EDGetTokenT< reco::VertexCollection > vertexLabel_algoA
Definition: TrackAlgoCompareUtil.h:71
edm::ESHandle< MagneticField >
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
TPtoRecoTrack::SetBeamSpot
void SetBeamSpot(const math::XYZPoint &bs)
Definition: TPtoRecoTrack.h:36
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
TPtoRecoTrack
Definition: TPtoRecoTrack.h:20
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
TrackAlgoCompareUtil::UseAssociators
const bool UseAssociators
Definition: TrackAlgoCompareUtil.h:80
RecoTracktoTP::SetTrackingParticle
void SetTrackingParticle(TrackingParticleRef tp)
Definition: RecoTracktoTP.h:25
TrackAlgoCompareUtil::assocLabel_algoA
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoA
Definition: TrackAlgoCompareUtil.h:78
TrackAlgoCompareUtil::assocLabel_algoB
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoB
Definition: TrackAlgoCompareUtil.h:79
TrackAlgoCompareUtil::UseVertex
const bool UseVertex
Definition: TrackAlgoCompareUtil.h:81
RecoTracktoTP
Definition: RecoTracktoTP.h:20
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >
iEvent
int iEvent
Definition: GenABIO.cc:224
TPtoRecoTrack::SetTrackingParticle
void SetTrackingParticle(TrackingParticleRef tp)
Definition: TPtoRecoTrack.h:25
TrackAlgoCompareUtil::associatormap_algoA_recoToSim
edm::EDGetTokenT< reco::RecoToSimCollection > associatormap_algoA_recoToSim
Definition: TrackAlgoCompareUtil.h:74
TrackAlgoCompareUtil::trackLabel_algoB
edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoB
Definition: TrackAlgoCompareUtil.h:68
RecoTracktoTP::SetBeamSpot
void SetBeamSpot(const math::XYZPoint &bs)
Definition: RecoTracktoTP.h:28
TrackAlgoCompareUtil::associatormap_algoB_recoToSim
edm::EDGetTokenT< reco::RecoToSimCollection > associatormap_algoB_recoToSim
Definition: TrackAlgoCompareUtil.h:75
get
#define get
RecoTracktoTP::SetTrackingParticlePCA
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: RecoTracktoTP.h:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackAlgoCompareUtil::trackLabel_algoA
edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoA
Definition: TrackAlgoCompareUtil.h:67
eostools.move
def move(src, dest)
Definition: eostools.py:511
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
TSCBLBuilderNoMaterial
Definition: TSCBLBuilderNoMaterial.h:13
TPtoRecoTrack::SetTrackingParticlePCA
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: TPtoRecoTrack.h:83
edm::RefToBase< reco::Track >
TrackAlgoCompareUtil::trackingParticleLabel_fakes
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleLabel_fakes
Definition: TrackAlgoCompareUtil.h:69
reco::TrackToTrackingParticleAssociator::associateSimToReco
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
Definition: TrackToTrackingParticleAssociator.h:71
TrackAlgoCompareUtil::associatormap_algoB_simToReco
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoB_simToReco
Definition: TrackAlgoCompareUtil.h:77
TPtoRecoTrack::SetShared_AlgoA
void SetShared_AlgoA(const float &mA)
Definition: TPtoRecoTrack.h:30
TrajectoryStateClosestToBeamLine::isValid
bool isValid() const
Definition: TrajectoryStateClosestToBeamLine.h:50
TrackingParticleRef
edm::Ref< TrackingParticleCollection > TrackingParticleRef
Definition: TrackingParticleFwd.h:10
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
RecoTracktoTP::SetRecoVertex
void SetRecoVertex(reco::VertexRef vertex)
Definition: RecoTracktoTP.h:27
TrajectoryStateClosestToBeamLine::trackStateAtPCA
FTS const & trackStateAtPCA() const
Definition: TrajectoryStateClosestToBeamLine.h:32
TrackAlgoCompareUtil::vertexLabel_algoB
edm::EDGetTokenT< reco::VertexCollection > vertexLabel_algoB
Definition: TrackAlgoCompareUtil.h:72
MagneticField
Definition: MagneticField.h:19
edm::InputTag
Definition: InputTag.h:15
TPtoRecoTrack::SetRecoVertex_AlgoB
void SetRecoVertex_AlgoB(reco::VertexRef vertex)
Definition: TPtoRecoTrack.h:34
edm::View::size_type
unsigned int size_type
Definition: View.h:90