Method called once per event.
67 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
68 <<
"Analyzing new event" <<
"\n"
69 <<
"====================================================\n" <<
"\n";
88 event.getByToken(
bsSrc,recoBeamSpotHandle);
95 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
96 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
97 puinfo=(*puinfoH)[puinfo_ite];
106 trackGenAssociator = trackGenAssociatorH.
product();
109 if ( not trackGenAssociator) {
return ; }
112 for (
unsigned int www=0;www<
label.size();www++){
127 <<
label[www].process()<<
":"
128 <<
label[www].label()<<
":"
129 <<
label[www].instance()<<
" with "
132 LogTrace(
"TrackValidator") <<
"Calling associateRecoToGen method" <<
"\n";
133 recGenColl=trackGenAssociator->associateRecoToGen(trackCollection,
135 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method" <<
"\n";
136 genRecColl=trackGenAssociator->associateGenToReco(trackCollection,
141 <<
label[www].process()<<
":"
142 <<
label[www].label()<<
":"
143 <<
label[www].instance()<<
" with "
150 genRecColl= *(gentorecoCollectionH.
product());
154 recGenColl= *(recotogenCollectionH.
product());
165 edm::LogVerbatim(
"TrackValidator") <<
"\n# of GenParticles: " << tPCeff.size() <<
"\n";
190 dxyGen = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
191 dzGen = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
192 * momentum.z()/
sqrt(momentum.perp2());
198 momentumTP = parametersDefinerTP->momentum(event,setup,*tp);
199 vertexTP = parametersDefinerTP->vertex(event,setup,*tp);
200 dxyGen = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
201 dzGen = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
202 * momentumTP.z()/
sqrt(momentumTP.perp2());
222 std::vector<std::pair<RefToBase<Track>,
double> > rt;
223 if(genRecColl.
find(tpr) != genRecColl.
end()){
224 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) genRecColl[tpr];
228 matchedTrackPointer = rt.begin()->first.get();
230 <<
" with pt=" <<
sqrt(momentumTP.perp2())
231 <<
" associated with quality:" << rt.begin()->second <<
"\n";
235 <<
"GenParticle #" << st
236 <<
" with pt,eta,phi: "
237 <<
sqrt(momentumTP.perp2()) <<
" , "
238 << momentumTP.eta() <<
" , "
239 << momentumTP.phi() <<
" , "
240 <<
" NOT associated to any reco::Track" <<
"\n";
249 if (matchedTrackPointer) asts++;
263 <<
label[www].process()<<
":"
264 <<
label[www].label()<<
":"
265 <<
label[www].instance()
266 <<
": " << trackCollection->size() <<
"\n";
278 std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
287 v_dEdx.push_back(dEdx1);
288 v_dEdx.push_back(dEdx2);
290 LogTrace(
"TrackValidator") <<
"exception found: " << e.
what() <<
"\n";
300 bool isSigGenMatched(
false);
301 bool isGenMatched(
false);
302 bool isChargeMatched(
true);
303 int numAssocRecoTracks = 0;
305 double sharedFraction = 0.;
306 std::vector<std::pair<GenParticleRef, double> > tp;
307 if(recGenColl.
find(track) != recGenColl.
end()){
308 tp = recGenColl[track];
314 sharedFraction = tp[0].second;
316 if (tp[0].
first->charge() != track->charge()) isChargeMatched =
false;
317 if(genRecColl.
find(tp[0].first) != genRecColl.
end()) numAssocRecoTracks = genRecColl[tp[0].
first].
size();
320 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
330 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
331 <<
" associated with quality:" << tp.begin()->second <<
"\n";
334 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
335 <<
" NOT associated to any GenParticle" <<
"\n";
340 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isGenMatched,isSigGenMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction,
dR);
351 if (tp.size()==0)
continue;
375 int chargeTP = tpr->charge();
378 *track,bs.position());
397 <<
"Total Associated (genToReco): " << ats <<
"\n"
398 <<
"Total Reconstructed: " << rT <<
"\n"
399 <<
"Total Associated (recoToGen): " <<
at <<
"\n"
400 <<
"Total Fakes: " << rT-
at <<
"\n";
virtual char const * what() const
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
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...)
virtual void fill_dedx_recoTrack_histos(int count, edm::RefToBase< reco::Track > &trackref, const std::vector< edm::ValueMap< reco::DeDxData > > &v_dEdx)=0
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
edm::EDGetTokenT< reco::RecoToSimCollection > associatormapRtS
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
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, const reco::Track *track, int numVertices, double dR)=0
edm::EDGetTokenT< reco::SimToRecoCollection > associatormapStR
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.
edm::InputTag assMapInput
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
bool isUninitialized() const
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
tuple size
Write out results.
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag