Method called once per event.
73 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
74 <<
"Analyzing new event" <<
"\n"
75 <<
"====================================================\n" <<
"\n";
94 event.getByToken(
bsSrc,recoBeamSpotHandle);
101 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
102 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
103 puinfo=(*puinfoH)[puinfo_ite];
116 trackGenAssociator = trackGenAssociatorH.
product();
126 std::vector<const edm::ValueMap<reco::DeDxData> *> v_dEdx;
132 v_dEdx.push_back(dEdx1Handle.
product());
133 v_dEdx.push_back(dEdx2Handle.
product());
137 for (
unsigned int www=0;www<
label.size();www++){
152 <<
label[www].process()<<
":"
153 <<
label[www].label()<<
":"
154 <<
label[www].instance()<<
" with "
157 LogTrace(
"TrackValidator") <<
"Calling associateRecoToGen method" <<
"\n";
158 recGenColl=trackGenAssociator->associateRecoToGen(trackCollection,
160 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method" <<
"\n";
161 genRecColl=trackGenAssociator->associateGenToReco(trackCollection,
166 <<
label[www].process()<<
":"
167 <<
label[www].label()<<
":"
168 <<
label[www].instance()<<
" with "
173 genRecColl= *(gentorecoCollectionH.
product());
177 recGenColl= *(recotogenCollectionH.
product());
188 edm::LogVerbatim(
"TrackValidator") <<
"\n# of GenParticles: " << tPCeff.size() <<
"\n";
213 dxyGen = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
214 dzGen = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
215 * momentum.z()/
sqrt(momentum.perp2());
221 momentumTP = parametersDefinerTP->momentum(event,setup,*tp);
222 vertexTP = parametersDefinerTP->vertex(event,setup,*tp);
223 dxyGen = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
224 dzGen = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
225 * momentumTP.z()/
sqrt(momentumTP.perp2());
249 std::vector<std::pair<RefToBase<Track>,
double> > rt;
250 if(genRecColl.
find(tpr) != genRecColl.
end()){
251 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) genRecColl[tpr];
255 matchedTrackPointer = rt.begin()->first.get();
257 <<
" with pt=" <<
sqrt(momentumTP.perp2())
258 <<
" associated with quality:" << rt.begin()->second <<
"\n";
262 <<
"GenParticle #" << st
263 <<
" with pt,eta,phi: "
264 <<
sqrt(momentumTP.perp2()) <<
" , "
265 << momentumTP.eta() <<
" , "
266 << momentumTP.phi() <<
" , "
267 <<
" NOT associated to any reco::Track" <<
"\n";
276 if (matchedTrackPointer) asts++;
294 <<
label[www].process()<<
":"
295 <<
label[www].label()<<
":"
296 <<
label[www].instance()
297 <<
": " << trackCollection->size() <<
"\n";
308 bool isSigGenMatched(
false);
309 bool isGenMatched(
false);
310 bool isChargeMatched(
true);
311 int numAssocRecoTracks = 0;
313 double sharedFraction = 0.;
314 std::vector<std::pair<GenParticleRef, double> > tp;
315 if(recGenColl.
find(track) != recGenColl.
end()){
316 tp = recGenColl[track];
322 sharedFraction = tp[0].second;
324 if (tp[0].
first->charge() != track->charge()) isChargeMatched =
false;
325 if(genRecColl.
find(tp[0].first) != genRecColl.
end()) numAssocRecoTracks = genRecColl[tp[0].
first].
size();
328 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
338 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
339 <<
" associated with quality:" << tp.begin()->second <<
"\n";
342 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
343 <<
" NOT associated to any GenParticle" <<
"\n";
348 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isGenMatched,isSigGenMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction,
dR);
357 if (tp.size()==0)
continue;
381 int chargeTP = tpr->charge();
384 *track,bs.position());
403 <<
"Total Associated (genToReco): " << ats <<
"\n"
404 <<
"Total Reconstructed: " << rT <<
"\n"
405 <<
"Total Associated (recoToGen): " <<
at <<
"\n"
406 <<
"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
virtual void fill_recoAssociated_simTrack_histos(int count, const TrackingParticle &tp, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, double dxy, double dz, int nSimHits, int nSimLayers, int nSimPixelLayers, int nSimStripMonoAndStereoLayers, const reco::Track *track, int numVertices, double dR)=0
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
virtual Vector momentum() const
spatial momentum vector
virtual void fill_ResoAndPull_recoTrack_histos(int count, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, int chargeTP, const reco::Track &track, const math::XYZPoint &bsPosition)=0
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.
MTVHistoProducerAlgo * histoProducerAlgo_
std::string parametersDefiner
virtual void fill_simAssociated_recoTrack_histos(int count, const reco::Track &track)=0
T const * product() const
virtual void fill_trackBased_histos(int count, int assTracks, int numRecoTracks, int numSimTracks)=0
virtual void fill_generic_recoTrack_histos(int count, const reco::Track &track, const math::XYZPoint &bsPosition, bool isMatched, bool isSigMatched, bool isChargeMatched, int numAssocRecoTracks, int numVertices, int nSimHits, double sharedFraction, double dR)=0
virtual void fill_simTrackBased_histos(int count, int numSimTracks)=0
bool isUninitialized() const
virtual void fill_dedx_recoTrack_histos(int count, const edm::RefToBase< reco::Track > &trackref, const std::vector< const edm::ValueMap< reco::DeDxData > * > &v_dEdx)=0
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
math::XYZVectorD Vector
point in the space
virtual void fill_generic_simTrack_histos(int counter, const TrackingParticle::Vector &, const TrackingParticle::Point &vertex, int bx)=0
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_