Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
SimTracker
TrackAssociation
plugins
TrackMCQuality.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: TrackMCQuality
4
// Class: TrackMCQuality
5
//
14
//
15
// Original Author: Jean-Roch Vlimant
16
// Created: Fri Mar 27 15:19:03 CET 2009
17
//
18
//
19
20
// system include files
21
#include <memory>
22
23
// user include files
24
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
25
#include "
FWCore/Framework/interface/global/EDProducer.h
"
26
27
#include "
FWCore/Framework/interface/Event.h
"
28
#include "
FWCore/Framework/interface/MakerMacros.h
"
29
30
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
31
32
#include "
SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h
"
33
34
#include "
DataFormats/TrackReco/interface/Track.h
"
35
#include "
SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h
"
36
37
//
38
// class decleration
39
//
40
41
class
TrackMCQuality
final :
public
edm::global::EDProducer
<> {
42
public
:
43
explicit
TrackMCQuality
(
const
edm::ParameterSet
&);
44
~TrackMCQuality
()
override
;
45
46
private
:
47
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
48
49
// ----------member data ---------------------------
50
51
edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator>
label_assoc
;
52
edm::EDGetTokenT<TrackingParticleCollection>
label_tp
;
53
edm::EDGetTokenT<edm::View<reco::Track>
>
label_tr
;
54
55
using
Product
= std::vector<float>;
56
};
57
58
//
59
// constants, enums and typedefs
60
//
61
62
//
63
// static data member definitions
64
//
65
66
//
67
// constructors and destructor
68
//
69
TrackMCQuality::TrackMCQuality
(
const
edm::ParameterSet
&
pset
)
70
: label_assoc(consumes<
reco
::
TrackToTrackingParticleAssociator
>(pset.getParameter<edm::
InputTag
>(
"associator"
))),
71
label_tp
(consumes<
TrackingParticleCollection
>(pset.getParameter<edm::
InputTag
>(
"trackingParticles"
))),
72
label_tr(consumes<edm::
View
<
reco
::Track>>(pset.getParameter<edm::
InputTag
>(
"tracks"
))) {
73
produces<Product>();
74
}
75
76
TrackMCQuality::~TrackMCQuality
() {}
77
78
//
79
// member functions
80
//
81
82
// ------------ method called to produce the data ------------
83
void
TrackMCQuality::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup)
const
{
84
using namespace
edm;
85
Handle<reco::TrackToTrackingParticleAssociator>
associator;
86
iEvent.
getByToken
(
label_assoc
, associator);
87
88
Handle<TrackingParticleCollection>
TPCollection
;
89
iEvent.
getByToken
(
label_tp
,
TPCollection
);
90
91
Handle<edm::View<reco::Track>
>
trackCollection
;
92
iEvent.
getByToken
(
label_tr
,
trackCollection
);
93
94
reco::RecoToSimCollection
recSimColl = associator->associateRecoToSim(
trackCollection
,
TPCollection
);
95
96
// then loop the track collection
97
std::unique_ptr<Product> product(
new
Product
(
trackCollection
->size(), 0));
98
99
for
(
unsigned
int
iT = 0; iT !=
trackCollection
->size(); ++iT) {
100
auto
&prod = (*product)[iT];
101
102
edm::RefToBase<reco::Track>
track
(
trackCollection
, iT);
103
104
// find it in the map
105
if
(recSimColl.find(track) == recSimColl.end())
106
continue
;
107
108
auto
const
&
tp
= recSimColl[
track
];
109
110
if
(
tp
.empty())
111
continue
;
// can it be?
112
// nSimHits = tp[0].first->numberOfTrackerHits();
113
prod =
tp
[0].second;
114
// if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
115
if
((
tp
[0].
first
->eventId().event() != 0) || (
tp
[0].
first
->eventId().bunchCrossing() != 0))
116
prod = -prod;
117
}
118
119
iEvent.
put
(
std::move
(product));
120
}
121
122
// define this as a plug-in
123
DEFINE_FWK_MODULE
(
TrackMCQuality
);
first
auto first
Definition:
CAHitNtupletGeneratorKernelsImpl.h:127
ecalTPGAnalyzer_cfg.TPCollection
tuple TPCollection
Definition:
ecalTPGAnalyzer_cfg.py:137
EDProducer.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
TrackMCQuality::label_tr
edm::EDGetTokenT< edm::View< reco::Track > > label_tr
Definition:
TrackMCQuality.cc:53
TrackToTrackingParticleAssociator.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:539
TrackToTrackingParticleAssociator
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::StreamID
Definition:
StreamID.h:30
Event.h
MakerMacros.h
edm::Handle< reco::TrackToTrackingParticleAssociator >
TrackValidation_cff.pset
tuple pset
Definition:
TrackValidation_cff.py:591
TrackingParticle.h
HLT_FULL_cff.track
tuple track
Definition:
HLT_FULL_cff.py:9710
dt_dqm_sourceclient_common_cff.reco
tuple reco
Definition:
dt_dqm_sourceclient_common_cff.py:111
MuonTrackValidator_cfi.label_tp
string label_tp
Definition:
MuonTrackValidator_cfi.py:60
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator >
Frameworkfwd.h
edm::RefToBase< reco::Track >
TrackMCQuality::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
TrackMCQuality.cc:83
TrackMCQuality
Definition:
TrackMCQuality.cc:41
ParameterSet.h
TrackMCQuality::TrackMCQuality
TrackMCQuality(const edm::ParameterSet &)
Definition:
TrackMCQuality.cc:69
iEvent
int iEvent
Definition:
GenABIO.cc:224
TrackMCQuality::Product
std::vector< float > Product
Definition:
TrackMCQuality.cc:55
eostools.move
def move
Definition:
eostools.py:511
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >
edm::EventSetup
Definition:
EventSetup.h:59
edm::global::EDProducer
Definition:
EDProducer.h:32
HLT_FULL_cff.trackCollection
tuple trackCollection
Definition:
HLT_FULL_cff.py:65897
TrackMCQuality::label_assoc
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_assoc
Definition:
TrackMCQuality.cc:51
TrackMCQuality::~TrackMCQuality
~TrackMCQuality() override
Definition:
TrackMCQuality.cc:76
HLT_FULL_cff.InputTag
tuple InputTag
Definition:
HLT_FULL_cff.py:71427
Track.h
edm::ParameterSet
Definition:
ParameterSet.h:47
TrackingParticleCollection
std::vector< TrackingParticle > TrackingParticleCollection
Definition:
TrackingParticleFwd.h:9
TrackMCQuality::label_tp
edm::EDGetTokenT< TrackingParticleCollection > label_tp
Definition:
TrackMCQuality.cc:52
edm::Event
Definition:
Event.h:73
sistrip::View
View
Definition:
ConstantsForView.h:26
cmsswSequenceInfo.tp
tuple tp
Definition:
cmsswSequenceInfo.py:17
Generated for CMSSW Reference Manual by
1.8.5