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";
165 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method" <<
"\n";
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";
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();
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
T getParameter(std::string const &) const
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
virtual const Point & vertex() const
vertex position (overwritten by PF...)
void analyze(const edm::Event &, const edm::EventSetup &)
Method called once per event.
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
def setup(process, global_tag, zero_tesla=False)
virtual Vector momentum() const final
spatial momentum vector
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
MultiTrackValidatorGenPs(const edm::ParameterSet &pset)
Constructor.
math::XYZPointD Point
point in the space
const bool useAssociators_
std::vector< edm::InputTag > associators
edm::EDGetTokenT< reco::TrackToGenParticleAssociator > label_gen_associator
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
GenParticleCustomSelector gpSelector
double pt() const
track transverse momentum
Cos< T >::type cos(const T &t)
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
int charge() const
track electric charge
const Point & position() const
position
SingleObjectSelector< GenParticleCollection,::GenParticleCustomSelector > GenParticleCustomSelector
math::XYZVectorD Vector
point in the space
edm::EDGetTokenT< reco::RecoToGenCollection > associatormapRtG
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
const bool doRecoTrackPlots_
virtual ~MultiTrackValidatorGenPs()
Destructor.
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_