Method called once per event.
71 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" 73 <<
"Analyzing new event" 75 <<
"====================================================\n" 99 event.getByToken(
bsSrc, recoBeamSpotHandle);
106 for (
unsigned int puinfo_ite = 0; puinfo_ite < (*puinfoH).size(); ++puinfo_ite) {
107 if ((*puinfoH)[puinfo_ite].getBunchCrossing() == 0) {
108 puinfo = (*puinfoH)[puinfo_ite];
120 trackGenAssociator = trackGenAssociatorH.
product();
129 std::vector<const edm::ValueMap<reco::DeDxData>*> v_dEdx;
135 v_dEdx.push_back(dEdx1Handle.
product());
136 v_dEdx.push_back(dEdx2Handle.
product());
139 std::vector<float> mvaDummy;
142 for (
unsigned int www = 0; www <
label.size(); www++) {
160 LogTrace(
"TrackValidator") <<
"Calling associateRecoToGen method" 162 recGenColl = trackGenAssociator->
associateRecoToGen(trackCollection, TPCollectionHfake);
163 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method" 165 genRecColl = trackGenAssociator->
associateGenToReco(trackCollection, TPCollectionHeff);
172 genRecColl = *(gentorecoCollectionH.
product());
176 recGenColl = *(recotogenCollectionH.
product());
185 edm::LogVerbatim(
"TrackValidator") <<
"\n# of GenParticles: " << tPCeff.size() <<
"\n";
211 dxyGen = (-vertex.x() *
sin(momentum.phi()) + vertex.y() *
cos(momentum.phi()));
212 dzGen = vertex.z() - (vertex.x() * momentum.x() + vertex.y() * momentum.y()) /
sqrt(momentum.perp2()) *
213 momentum.z() /
sqrt(momentum.perp2());
218 momentumTP = parametersDefinerTP->
momentum(event, setup, *tp);
219 vertexTP = parametersDefinerTP->
vertex(event, setup, *tp);
220 dxyGen = (-vertexTP.x() *
sin(momentumTP.phi()) + vertexTP.y() *
cos(momentumTP.phi()));
221 dzGen = vertexTP.z() - (vertexTP.x() * momentumTP.x() + vertexTP.y() * momentumTP.y()) /
222 sqrt(momentumTP.perp2()) * momentumTP.z() /
sqrt(momentumTP.perp2());
248 std::vector<std::pair<RefToBase<Track>,
double> > rt;
249 if (genRecColl.
find(tpr) != genRecColl.
end()) {
250 rt = (std::vector<std::pair<RefToBase<Track>,
double> >)genRecColl[tpr];
254 matchedTrackPointer = rt.begin()->first.get();
255 edm::LogVerbatim(
"TrackValidator") <<
"GenParticle #" << st <<
" with pt=" <<
sqrt(momentumTP.perp2())
256 <<
" associated with quality:" << rt.begin()->second <<
"\n";
259 edm::LogVerbatim(
"TrackValidator") <<
"GenParticle #" << st <<
" with pt,eta,phi: " <<
sqrt(momentumTP.perp2())
260 <<
" , " << momentumTP.eta() <<
" , " << momentumTP.phi() <<
" , " 261 <<
" NOT associated to any reco::Track" 278 if (matchedTrackPointer)
293 <<
label[www].label() <<
":" <<
label[www].instance() <<
": " 294 << trackCollection->size() <<
"\n";
304 bool isSigGenMatched(
false);
305 bool isGenMatched(
false);
306 bool isChargeMatched(
true);
307 int numAssocRecoTracks = 0;
309 double sharedFraction = 0.;
310 std::vector<std::pair<GenParticleRef, double> > tp;
312 tp = recGenColl[
track];
318 sharedFraction = tp[0].second;
321 isChargeMatched =
false;
322 if (genRecColl.
find(tp[0].first) != genRecColl.
end())
323 numAssocRecoTracks = genRecColl[tp[0].
first].
size();
326 for (
unsigned int tp_ite = 0; tp_ite < tp.size(); ++tp_ite) {
337 <<
" associated with quality:" << tp.begin()->second <<
"\n";
341 <<
"reco::Track #" << rT <<
" with pt=" <<
track->pt() <<
" NOT associated to any GenParticle" 397 int chargeTP = tpr->charge();
400 histograms.histoProducerAlgo, w, momentumTP, vertexTP, chargeTP, *
track, bs.
position());
415 histoProducerAlgo_->fill_trackBased_histos(histograms.histoProducerAlgo, w, at, rT, rT, st);
418 <<
"Total Associated (genToReco): " << ats <<
"\n" 419 <<
"Total Reconstructed: " << rT <<
"\n" 420 <<
"Total Associated (recoToGen): " << at <<
"\n" 421 <<
"Total Fakes: " << rT - at <<
"\n";
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
edm::EDGetTokenT< reco::GenToRecoCollection > associatormapGtR
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
static const std::string kTrackAssociatorByChi2("trackAssociatorByChi2")
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
reco::RecoToGenCollection associateRecoToGen(const edm::RefToBaseVector< reco::Track > &tracks, const edm::RefVector< reco::GenParticleCollection > &gens) const
Association Sim To Reco with Collections (Gen Particle version)
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
const bool useAssociators_
std::vector< edm::InputTag > associators
edm::EDGetTokenT< reco::TrackToGenParticleAssociator > label_gen_associator
Vector momentum() const final
spatial momentum vector
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
GenParticleCustomSelector gpSelector
Cos< T >::type cos(const T &t)
const Point & vertex() const override
vertex position (overwritten by PF...)
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
std::vector< edm::InputTag > label
T const * get() const
Returns C++ pointer to the item.
reco::GenToRecoCollection associateGenToReco(const edm::RefToBaseVector< reco::Track > &tracks, const edm::RefVector< reco::GenParticleCollection > &gens) const
Association Sim To Reco with Collections (Gen Particle version)
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
T const * product() const
const bool ignoremissingtkcollection_
const int getPU_NumInteractions() const
std::string parametersDefiner
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
bool isUninitialized() const
const Point & position() const
position
math::XYZVectorD Vector
point in the space
edm::EDGetTokenT< reco::RecoToGenCollection > associatormapRtG
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
const bool doRecoTrackPlots_
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
const bool parametersDefinerIsCosmic_
const bool doSimTrackPlots_