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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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, TPtoRecoTrack &TPRT) const
 
void SetTrackingParticleD0Dz (TrackingParticleRef tp, const reco::BeamSpot &bs, const MagneticField *bf, RecoTracktoTP &RTTP) 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
 
const edm::EDGetTokenT< reco::BeamSpotbeamSpotLabel
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagField
 
const edm::EDGetTokenT< TrackingParticleCollectiontrackingParticleLabel_effic
 
const edm::EDGetTokenT< TrackingParticleCollectiontrackingParticleLabel_fakes
 
const edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoA
 
const 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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

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.

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.

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"))),
16  UseAssociators(iConfig.getParameter<bool>("UseAssociators")),
17  UseVertex(iConfig.getParameter<bool>("UseVertex")) {
18  //now do what ever other initialization is needed
19  if (UseVertex) {
20  vertexLabel_algoA = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexLabel_algoA"));
21  vertexLabel_algoB = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexLabel_algoB"));
22  }
23 
24  if (UseAssociators) {
25  assocLabel_algoA = consumes<reco::TrackToTrackingParticleAssociator>(
26  iConfig.getUntrackedParameter<std::string>("assocLabel_algoA", "trackAssociatorByHits"));
27  assocLabel_algoB = consumes<reco::TrackToTrackingParticleAssociator>(
28  iConfig.getUntrackedParameter<std::string>("assocLabel_algoB", "trackAssociatorByHits"));
29  } else {
30  edm::InputTag algoA = iConfig.getParameter<edm::InputTag>("associatormap_algoA");
31  edm::InputTag algoB = iConfig.getParameter<edm::InputTag>("associatormap_algoB");
32 
33  associatormap_algoA_recoToSim = consumes<reco::RecoToSimCollection>(algoA);
34  associatormap_algoB_recoToSim = consumes<reco::RecoToSimCollection>(algoB);
35  associatormap_algoA_simToReco = consumes<reco::SimToRecoCollection>(algoA);
36  associatormap_algoB_simToReco = consumes<reco::SimToRecoCollection>(algoB);
37  }
38 
39  produces<RecoTracktoTPCollection>("AlgoA");
40  produces<RecoTracktoTPCollection>("AlgoB");
41  produces<TPtoRecoTrackCollection>("TP");
42 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magField
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoB_simToReco
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoA
edm::EDGetTokenT< reco::VertexCollection > vertexLabel_algoA
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticleLabel_effic
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::RecoToSimCollection > associatormap_algoA_recoToSim
const edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoA
edm::EDGetTokenT< reco::VertexCollection > vertexLabel_algoB
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticleLabel_fakes
const edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoB
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoA_simToReco
const edm::EDGetTokenT< reco::BeamSpot > beamSpotLabel
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoB
edm::EDGetTokenT< reco::RecoToSimCollection > associatormap_algoB_recoToSim

◆ ~TrackAlgoCompareUtil()

TrackAlgoCompareUtil::~TrackAlgoCompareUtil ( )
override

Definition at line 44 of file TrackAlgoCompareUtil.cc.

44 {}

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 47 of file TrackAlgoCompareUtil.cc.

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::getData(), mps_fire::i, iEvent, magField, HLT_2023v12_cff::magneticField, eostools::move(), edm::Handle< 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.

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

◆ SetTrackingParticleD0Dz() [1/2]

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

Definition at line 232 of file TrackAlgoCompareUtil.cc.

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().

235  {
236  GlobalPoint trackingParticleVertex(tp->vertex().x(), tp->vertex().y(), tp->vertex().z());
237  GlobalVector trackingParticleP3(
238  tp->g4Track_begin()->momentum().x(), tp->g4Track_begin()->momentum().y(), tp->g4Track_begin()->momentum().z());
239  TrackCharge trackingParticleCharge(tp->charge());
240 
241  FreeTrajectoryState ftsAtProduction(trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf);
242  TSCBLBuilderNoMaterial tscblBuilder;
243  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
244  tscblBuilder(ftsAtProduction, bs); //as in TrackProducerAlgorithm
245 
246  if (tsAtClosestApproach.isValid()) {
247  GlobalPoint v1 = tsAtClosestApproach.trackStateAtPCA().position();
248  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
249 
251  TPRT.SetTrackingParticlePCA(v1);
252  } else {
253  TPRT.SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
254  TPRT.SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
255  }
256 }
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: TPtoRecoTrack.h:82
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: TPtoRecoTrack.h:83
GlobalPoint position() const
int TrackCharge
Definition: TrackCharge.h:4
GlobalVector momentum() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ SetTrackingParticleD0Dz() [2/2]

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

Definition at line 258 of file TrackAlgoCompareUtil.cc.

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

261  {
262  GlobalPoint trackingParticleVertex(tp->vertex().x(), tp->vertex().y(), tp->vertex().z());
263  GlobalVector trackingParticleP3(
264  tp->g4Track_begin()->momentum().x(), tp->g4Track_begin()->momentum().y(), tp->g4Track_begin()->momentum().z());
265  TrackCharge trackingParticleCharge(tp->charge());
266 
267  FreeTrajectoryState ftsAtProduction(trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf);
268  TSCBLBuilderNoMaterial tscblBuilder;
269  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
270  tscblBuilder(ftsAtProduction, bs); //as in TrackProducerAlgorithm
271 
272  if (tsAtClosestApproach.isValid()) {
273  GlobalPoint v1 = tsAtClosestApproach.trackStateAtPCA().position();
274  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
275 
277  RTTP.SetTrackingParticlePCA(v1);
278  } else {
279  RTTP.SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
280  RTTP.SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
281  }
282 }
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: RecoTracktoTP.h:55
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: RecoTracktoTP.h:56
GlobalPoint position() const
int TrackCharge
Definition: TrackCharge.h:4
GlobalVector momentum() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10

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

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

Definition at line 73 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ magField

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TrackAlgoCompareUtil::magField
private

Definition at line 80 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackingParticleLabel_effic

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

Definition at line 70 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackingParticleLabel_fakes

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

Definition at line 69 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackLabel_algoA

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

Definition at line 67 of file TrackAlgoCompareUtil.h.

Referenced by produce().

◆ trackLabel_algoB

const 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 81 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

◆ UseVertex

const bool TrackAlgoCompareUtil::UseVertex
private

Definition at line 82 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().