Method called once per event.
59 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
60 <<
"Analyzing new event" <<
"\n"
61 <<
"====================================================\n" <<
"\n";
80 event.getByToken(
bsSrc,recoBeamSpotHandle);
87 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
88 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
89 puinfo=(*puinfoH)[puinfo_ite];
100 for (
unsigned int www=0;www<
label.size();www++){
115 <<
label[www].process()<<
":"
116 <<
label[www].label()<<
":"
117 <<
label[www].instance()<<
" with "
120 LogTrace(
"TrackValidator") <<
"Calling associateRecoToGen method" <<
"\n";
124 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method" <<
"\n";
131 <<
label[www].process()<<
":"
132 <<
label[www].label()<<
":"
133 <<
label[www].instance()<<
" with "
140 genRecColl= *(gentorecoCollectionH.
product());
144 recGenColl= *(recotogenCollectionH.
product());
155 edm::LogVerbatim(
"TrackValidator") <<
"\n# of GenParticles: " << tPCeff.size() <<
"\n";
180 dxyGen = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
181 dzGen = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
182 * momentum.z()/
sqrt(momentum.perp2());
188 momentumTP = parametersDefinerTP->momentum(event,setup,*tp);
189 vertexTP = parametersDefinerTP->vertex(event,setup,*tp);
190 dxyGen = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
191 dzGen = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
192 * momentumTP.z()/
sqrt(momentumTP.perp2());
212 std::vector<std::pair<RefToBase<Track>,
double> > rt;
213 if(genRecColl.
find(tpr) != genRecColl.
end()){
214 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) genRecColl[tpr];
218 matchedTrackPointer = rt.begin()->first.get();
220 <<
" with pt=" <<
sqrt(momentumTP.perp2())
221 <<
" associated with quality:" << rt.begin()->second <<
"\n";
225 <<
"GenParticle #" << st
226 <<
" with pt,eta,phi: "
227 <<
sqrt(momentumTP.perp2()) <<
" , "
228 << momentumTP.eta() <<
" , "
229 << momentumTP.phi() <<
" , "
230 <<
" NOT associated to any reco::Track" <<
"\n";
239 if (matchedTrackPointer) asts++;
253 <<
label[www].process()<<
":"
254 <<
label[www].label()<<
":"
255 <<
label[www].instance()
256 <<
": " << trackCollection->size() <<
"\n";
268 std::vector<edm::ValueMap<reco::DeDxData> > v_dEdx;
277 v_dEdx.push_back(dEdx1);
278 v_dEdx.push_back(dEdx2);
280 LogTrace(
"TrackValidator") <<
"exception found: " << e.
what() <<
"\n";
290 bool isSigGenMatched(
false);
291 bool isGenMatched(
false);
292 bool isChargeMatched(
true);
293 int numAssocRecoTracks = 0;
295 double sharedFraction = 0.;
296 std::vector<std::pair<GenParticleRef, double> > tp;
297 if(recGenColl.
find(track) != recGenColl.
end()){
298 tp = recGenColl[track];
304 sharedFraction = tp[0].second;
306 if (tp[0].
first->charge() != track->charge()) isChargeMatched =
false;
307 if(genRecColl.
find(tp[0].first) != genRecColl.
end()) numAssocRecoTracks = genRecColl[tp[0].
first].
size();
310 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
320 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
321 <<
" associated with quality:" << tp.begin()->second <<
"\n";
324 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->pt()
325 <<
" NOT associated to any GenParticle" <<
"\n";
330 histoProducerAlgo_->
fill_generic_recoTrack_histos(
w,*track,bs.position(),isGenMatched,isSigGenMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction,
dR);
341 if (tp.size()==0)
continue;
365 int chargeTP = tpr->charge();
368 *track,bs.position());
387 <<
"Total Associated (genToReco): " << ats <<
"\n"
388 <<
"Total Reconstructed: " << rT <<
"\n"
389 <<
"Total Associated (recoToGen): " <<
at <<
"\n"
390 <<
"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
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
std::vector< const TrackAssociatorBase * > associator
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
const TrackAssociatorByChi2 * associatorByChi2
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
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
reco::RecoToGenCollection associateRecoToGen(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections (Gen Particle version)
reco::GenToRecoCollection associateGenToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections (Gen Particle version)
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
std::vector< std::string > associators
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