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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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)
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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, 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
 
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 
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)
 

Detailed Description

Definition at line 53 of file TrackAlgoCompareUtil.h.

Constructor & Destructor Documentation

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

Definition at line 8 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  :
11  trackingParticleLabel_fakes(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("trackingParticleLabel_fakes"))),
12  trackingParticleLabel_effic(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("trackingParticleLabel_effic"))),
13  beamSpotLabel(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotLabel"))),
14  UseAssociators(iConfig.getParameter< bool >("UseAssociators")),
15  UseVertex(iConfig.getParameter< bool >("UseVertex"))
16 {
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>(iConfig.getUntrackedParameter<std::string>("assocLabel_algoA", "trackAssociatorByHits"));
25  assocLabel_algoB = consumes<reco::TrackToTrackingParticleAssociator>(iConfig.getUntrackedParameter<std::string>("assocLabel_algoB", "trackAssociatorByHits"));
26  }
27  else {
28  edm::InputTag algoA = iConfig.getParameter< edm::InputTag >("associatormap_algoA");
29  edm::InputTag algoB = iConfig.getParameter< edm::InputTag >("associatormap_algoB");
30 
31  associatormap_algoA_recoToSim = consumes<reco::RecoToSimCollection>(algoA);
32  associatormap_algoB_recoToSim = consumes<reco::RecoToSimCollection>(algoB);
33  associatormap_algoA_simToReco = consumes<reco::SimToRecoCollection>(algoA);
34  associatormap_algoB_simToReco = consumes<reco::SimToRecoCollection>(algoB);
35  }
36 
37  produces<RecoTracktoTPCollection>("AlgoA");
38  produces<RecoTracktoTPCollection>("AlgoB");
39  produces<TPtoRecoTrackCollection>("TP");
40 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoB_simToReco
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoA
edm::EDGetTokenT< reco::VertexCollection > vertexLabel_algoA
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleLabel_effic
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::RecoToSimCollection > associatormap_algoA_recoToSim
edm::EDGetTokenT< reco::VertexCollection > vertexLabel_algoB
edm::EDGetTokenT< reco::BeamSpot > beamSpotLabel
edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoA
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoA_simToReco
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleLabel_fakes
edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoB
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoB
edm::EDGetTokenT< reco::RecoToSimCollection > associatormap_algoB_recoToSim
TrackAlgoCompareUtil::~TrackAlgoCompareUtil ( )
override

Definition at line 43 of file TrackAlgoCompareUtil.cc.

44 {
45 }

Member Function Documentation

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

Definition at line 50 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, ecalDrivenElectronSeedsParameters_cff::beamSpot, beamSpotLabel, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, seedCreatorFromRegionConsecutiveHitsEDProducer_cff::magneticField, eostools::move(), reco::BeamSpot::position(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::Event::put(), 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.

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

Definition at line 272 of file TrackAlgoCompareUtil.cc.

References TrajectoryStateClosestToBeamLine::isValid(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), TPtoRecoTrack::SetTrackingParticleMomentumPCA(), TPtoRecoTrack::SetTrackingParticlePCA(), and TrajectoryStateClosestToBeamLine::trackStateAtPCA().

Referenced by produce().

273 {
274  GlobalPoint trackingParticleVertex( tp->vertex().x(), tp->vertex().y(), tp->vertex().z() );
275  GlobalVector trackingParticleP3(tp->g4Track_begin()->momentum().x(),
276  tp->g4Track_begin()->momentum().y(),
277  tp->g4Track_begin()->momentum().z() );
278  TrackCharge trackingParticleCharge(tp->charge());
279 
280  FreeTrajectoryState ftsAtProduction( trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf );
281  TSCBLBuilderNoMaterial tscblBuilder;
282  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction, bs); //as in TrackProducerAlgorithm
283 
284  if(tsAtClosestApproach.isValid())
285  {
286  GlobalPoint v1 = tsAtClosestApproach.trackStateAtPCA().position();
287  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
288 
290  TPRT.SetTrackingParticlePCA(v1);
291  }
292  else
293  {
294  TPRT.SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
295  TPRT.SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
296  }
297 }
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: TPtoRecoTrack.h:81
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: TPtoRecoTrack.h:82
int TrackCharge
Definition: TrackCharge.h:4
GlobalVector momentum() const
GlobalPoint position() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void TrackAlgoCompareUtil::SetTrackingParticleD0Dz ( TrackingParticleRef  tp,
const reco::BeamSpot bs,
const MagneticField bf,
RecoTracktoTP RTTP 
) const
private

Definition at line 300 of file TrackAlgoCompareUtil.cc.

References TrajectoryStateClosestToBeamLine::isValid(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), RecoTracktoTP::SetTrackingParticleMomentumPCA(), RecoTracktoTP::SetTrackingParticlePCA(), and TrajectoryStateClosestToBeamLine::trackStateAtPCA().

301 {
302  GlobalPoint trackingParticleVertex( tp->vertex().x(), tp->vertex().y(), tp->vertex().z() );
303  GlobalVector trackingParticleP3(tp->g4Track_begin()->momentum().x(),
304  tp->g4Track_begin()->momentum().y(),
305  tp->g4Track_begin()->momentum().z() );
306  TrackCharge trackingParticleCharge(tp->charge());
307 
308  FreeTrajectoryState ftsAtProduction( trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf );
309  TSCBLBuilderNoMaterial tscblBuilder;
310  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction, bs); //as in TrackProducerAlgorithm
311 
312  if(tsAtClosestApproach.isValid())
313  {
314  GlobalPoint v1 = tsAtClosestApproach.trackStateAtPCA().position();
315  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
316 
318  RTTP.SetTrackingParticlePCA(v1);
319  }
320  else
321  {
322  RTTP.SetTrackingParticleMomentumPCA(GlobalVector(-9999.0, -9999.0, -9999.0));
323  RTTP.SetTrackingParticlePCA(GlobalPoint(-9999.0, -9999.0, -9999.0));
324  }
325 }
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: RecoTracktoTP.h:56
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: RecoTracktoTP.h:57
int TrackCharge
Definition: TrackCharge.h:4
GlobalVector momentum() const
GlobalPoint position() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

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

Definition at line 75 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 77 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 76 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 78 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 79 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 80 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 74 of file TrackAlgoCompareUtil.h.

Referenced by produce().

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

Definition at line 71 of file TrackAlgoCompareUtil.h.

Referenced by produce().

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

Definition at line 70 of file TrackAlgoCompareUtil.h.

Referenced by produce().

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

Definition at line 68 of file TrackAlgoCompareUtil.h.

Referenced by produce().

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

Definition at line 69 of file TrackAlgoCompareUtil.h.

Referenced by produce().

const bool TrackAlgoCompareUtil::UseAssociators
private

Definition at line 81 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

const bool TrackAlgoCompareUtil::UseVertex
private

Definition at line 82 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 72 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().

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

Definition at line 73 of file TrackAlgoCompareUtil.h.

Referenced by produce(), and TrackAlgoCompareUtil().