Method called once per event.
72 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
73 <<
"Analyzing new event" <<
"\n"
74 <<
"====================================================\n" <<
"\n";
97 event.getByToken(
bsSrc,recoBeamSpotHandle);
104 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
105 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
106 puinfo=(*puinfoH)[puinfo_ite];
119 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++){
157 <<
label[www].process()<<
":"
158 <<
label[www].label()<<
":"
159 <<
label[www].instance()<<
" with "
162 LogTrace(
"TrackValidator") <<
"Calling associateRecoToGen method" <<
"\n";
163 recGenColl=trackGenAssociator->associateRecoToGen(trackCollection,
165 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method" <<
"\n";
166 genRecColl=trackGenAssociator->associateGenToReco(trackCollection,
171 <<
label[www].process()<<
":"
172 <<
label[www].label()<<
":"
173 <<
label[www].instance()<<
" with "
178 genRecColl= *(gentorecoCollectionH.
product());
182 recGenColl= *(recotogenCollectionH.
product());
193 edm::LogVerbatim(
"TrackValidator") <<
"\n# of GenParticles: " << tPCeff.size() <<
"\n";
218 dxyGen = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
219 dzGen = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
220 * momentum.z()/
sqrt(momentum.perp2());
226 momentumTP = parametersDefinerTP->momentum(event,setup,*tp);
227 vertexTP = parametersDefinerTP->vertex(event,setup,*tp);
228 dxyGen = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
229 dzGen = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
230 * momentumTP.z()/
sqrt(momentumTP.perp2());
254 std::vector<std::pair<RefToBase<Track>,
double> > rt;
255 if(genRecColl.
find(tpr) != genRecColl.
end()){
256 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) genRecColl[tpr];
260 matchedTrackPointer = rt.begin()->first.get();
262 <<
" with pt=" <<
sqrt(momentumTP.perp2())
263 <<
" associated with quality:" << rt.begin()->second <<
"\n";
267 <<
"GenParticle #" << st
268 <<
" with pt,eta,phi: "
269 <<
sqrt(momentumTP.perp2()) <<
" , "
270 << momentumTP.eta() <<
" , "
271 << momentumTP.phi() <<
" , "
272 <<
" NOT associated to any reco::Track" <<
"\n";
278 histoProducerAlgo_->fill_recoAssociated_simTrack_histos(
w,*tp,momentumTP,vertexTP,dxyGen,dzGen,nSimHits,matchedTrackPointer,puinfo.getPU_NumInteractions());
281 if (matchedTrackPointer) asts++;
299 <<
label[www].process()<<
":"
300 <<
label[www].label()<<
":"
301 <<
label[www].instance()
302 <<
": " << trackCollection->size() <<
"\n";
313 bool isSigGenMatched(
false);
314 bool isGenMatched(
false);
315 bool isChargeMatched(
true);
316 int numAssocRecoTracks = 0;
318 double sharedFraction = 0.;
319 std::vector<std::pair<GenParticleRef, double> > tp;
320 if(recGenColl.
find(track) != recGenColl.
end()){
321 tp = recGenColl[track];
327 sharedFraction = tp[0].second;
329 if (tp[0].
first->charge() != track->charge()) isChargeMatched =
false;
330 if(genRecColl.
find(tp[0].first) != genRecColl.
end()) numAssocRecoTracks = genRecColl[tp[0].
first].
size();
333 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
343 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
344 <<
" associated with quality:" << tp.begin()->second <<
"\n";
347 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
348 <<
" NOT associated to any GenParticle" <<
"\n";
353 histoProducerAlgo_->fill_generic_recoTrack_histos(
w,*track, ttopo, bs.position(),
nullptr,
nullptr, isGenMatched,isSigGenMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction,
dR, mvaDummy, 0, 0);
362 if (tp.size()==0)
continue;
386 int chargeTP = tpr->charge();
389 *track,bs.position());
408 <<
"Total Associated (genToReco): " << ats <<
"\n"
409 <<
"Total Reconstructed: " << rT <<
"\n"
410 <<
"Total Associated (recoToGen): " << at <<
"\n"
411 <<
"Total Fakes: " << rT-at <<
"\n";
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
edm::EDGetTokenT< reco::GenToRecoCollection > associatormapGtR
std::vector< edm::InputTag > associators
static const std::string kTrackAssociatorByChi2("trackAssociatorByChi2")
bool ignoremissingtkcollection_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
const_iterator end() const
last iterator over the map (read only)
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual const Point & vertex() const
vertex position (overwritten by PF...)
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
edm::EDGetTokenT< reco::BeamSpot > bsSrc
math::XYZPointD Point
point in the space
edm::EDGetTokenT< reco::TrackToGenParticleAssociator > label_gen_associator
std::vector< edm::InputTag > label
GenParticleCustomSelector gpSelector
Cos< T >::type cos(const T &t)
T const * get() const
Returns C++ pointer to the item.
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
std::string parametersDefiner
virtual Vector momentum() const final
spatial momentum vector
T const * product() const
bool isUninitialized() const
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
math::XYZVectorD Vector
point in the space
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
edm::EDGetTokenT< reco::RecoToGenCollection > associatormapRtG
tuple size
Write out results.
const bool doRecoTrackPlots_
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
const bool parametersDefinerIsCosmic_
const bool doSimTrackPlots_