39 produces<RecoTracktoTPCollection>(
"AlgoA");
40 produces<RecoTracktoTPCollection>(
"AlgoB");
41 produces<TPtoRecoTrackCollection>(
"TP");
49 auto outputAlgoA = std::make_unique<RecoTracktoTPCollection>();
50 auto outputAlgoB = std::make_unique<RecoTracktoTPCollection>();
51 auto outputTP = std::make_unique<TPtoRecoTrackCollection>();
91 recSimColl_AlgoA = theAssociator_algoA->
associateRecoToSim(trackCollAlgoA, trackingParticleCollFakes);
92 recSimColl_AlgoB = theAssociator_algoB->
associateRecoToSim(trackCollAlgoB, trackingParticleCollFakes);
94 simRecColl_AlgoA = theAssociator_algoA->
associateSimToReco(trackCollAlgoA, trackingParticleCollEffic);
95 simRecColl_AlgoB = theAssociator_algoB->
associateSimToReco(trackCollAlgoB, trackingParticleCollEffic);
99 recSimColl_AlgoA = *(recotosimCollectionH_AlgoA.
product());
103 recSimColl_AlgoB = *(recotosimCollectionH_AlgoB.
product());
107 simRecColl_AlgoA = *(simtorecoCollectionH_AlgoA.
product());
111 simRecColl_AlgoB = *(simtorecoCollectionH_AlgoB.
product());
115 std::vector<std::pair<TrackingParticleRef, double>> associatedTrackingParticles;
118 std::vector<std::pair<reco::TrackBaseRef, double>> associatedRecoTracks;
132 if (recSimColl_AlgoA.
find(recoTrack) != recSimColl_AlgoA.
end()) {
133 associatedTrackingParticles = recSimColl_AlgoA[recoTrack];
135 recoTracktoTP.
SetShared(associatedTrackingParticles.begin()->second);
143 if (
UseVertex && !vertexCollAlgoA->empty()) {
149 outputAlgoA->push_back(recoTracktoTP);
161 if (recSimColl_AlgoB.
find(recoTrack) != recSimColl_AlgoB.
end()) {
162 associatedTrackingParticles = recSimColl_AlgoB[recoTrack];
164 recoTracktoTP.
SetShared(associatedTrackingParticles.begin()->second);
172 if (
UseVertex && !vertexCollAlgoB->empty()) {
178 outputAlgoB->push_back(recoTracktoTP);
190 if (simRecColl_AlgoA.
find(tparticle) != simRecColl_AlgoA.
end()) {
191 associatedRecoTracks = simRecColl_AlgoA[tparticle];
200 if (
UseVertex && !vertexCollAlgoA->empty()) {
207 if (simRecColl_AlgoB.
find(tparticle) != simRecColl_AlgoB.
end()) {
208 associatedRecoTracks = simRecColl_AlgoB[tparticle];
216 if (
UseVertex && !vertexCollAlgoB->empty()) {
222 outputTP->push_back(tptoRecoTrack);
236 GlobalPoint trackingParticleVertex(
tp->vertex().x(),
tp->vertex().y(),
tp->vertex().z());
238 tp->g4Track_begin()->momentum().x(),
tp->g4Track_begin()->momentum().y(),
tp->g4Track_begin()->momentum().z());
241 FreeTrajectoryState ftsAtProduction(trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf);
244 tscblBuilder(ftsAtProduction,
bs);
246 if (tsAtClosestApproach.
isValid()) {
262 GlobalPoint trackingParticleVertex(
tp->vertex().x(),
tp->vertex().y(),
tp->vertex().z());
264 tp->g4Track_begin()->momentum().x(),
tp->g4Track_begin()->momentum().y(),
tp->g4Track_begin()->momentum().z());
267 FreeTrajectoryState ftsAtProduction(trackingParticleVertex, trackingParticleP3, trackingParticleCharge, bf);
270 tscblBuilder(ftsAtProduction,
bs);
272 if (tsAtClosestApproach.
isValid()) {
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
void SetTrackingParticle(TrackingParticleRef tp)
T getParameter(std::string const &) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magField
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
trackingParticleLabel_fakes
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
void SetTrackingParticle(TrackingParticleRef tp)
~TrackAlgoCompareUtil() override
void SetShared_AlgoA(const float &mA)
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoB_simToReco
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoA
T const * product() const
void SetShared(const float &m)
Global3DPoint GlobalPoint
edm::EDGetTokenT< reco::VertexCollection > vertexLabel_algoA
void SetTrackingParticlePCA(const GlobalPoint &v)
void SetRecoVertex(reco::VertexRef vertex)
void SetRecoTrack_AlgoA(reco::TrackBaseRef track)
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticleLabel_effic
void SetTrackingParticlePCA(const GlobalPoint &v)
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)
T getUntrackedParameter(std::string const &, T const &) const
GlobalPoint position() 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
void SetRecoVertex_AlgoB(reco::VertexRef vertex)
const edm::EDGetTokenT< edm::View< reco::Track > > trackLabel_algoB
GlobalVector momentum() const
void SetRecoVertex_AlgoA(reco::VertexRef vertex)
TrackAlgoCompareUtil(const edm::ParameterSet &)
FTS const & trackStateAtPCA() const
edm::EDGetTokenT< reco::SimToRecoCollection > associatormap_algoA_simToReco
const edm::EDGetTokenT< reco::BeamSpot > beamSpotLabel
trackingParticleLabel_effic
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > assocLabel_algoB
void SetShared_AlgoB(const float &mB)
void SetRecoTrack(reco::TrackBaseRef track)
void SetBeamSpot(const math::XYZPoint &bs)
void SetBeamSpot(const math::XYZPoint &bs)
void SetTrackingParticleD0Dz(TrackingParticleRef tp, const reco::BeamSpot &bs, const MagneticField *bf, TPtoRecoTrack &TPRT) const
const bool UseAssociators
void SetRecoTrack_AlgoB(reco::TrackBaseRef track)
std::vector< TrackingParticle > TrackingParticleCollection
edm::EDGetTokenT< reco::RecoToSimCollection > associatormap_algoB_recoToSim
edm::Ref< TrackingParticleCollection > TrackingParticleRef
Global3DVector GlobalVector
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override