68 edm::LogInfo(
"TrackValidator") <<
"\n===================================================="
70 <<
"Analyzing new event"
72 <<
"====================================================\n"
91 event.getByToken(
bsSrc, recoBeamSpotHandle);
98 for (
unsigned int puinfo_ite = 0; puinfo_ite < (*puinfoH).size(); ++puinfo_ite) {
99 if ((*puinfoH)[puinfo_ite].getBunchCrossing() == 0) {
100 puinfo = (*puinfoH)[puinfo_ite];
112 trackGenAssociator = trackGenAssociatorH.
product();
121 std::vector<const edm::ValueMap<reco::DeDxData>*> v_dEdx;
127 v_dEdx.push_back(dEdx1Handle.
product());
128 v_dEdx.push_back(dEdx2Handle.
product());
131 std::vector<float> mvaDummy;
134 for (
unsigned int www = 0; www <
label.size(); www++) {
152 LogTrace(
"TrackValidator") <<
"Calling associateRecoToGen method"
154 recGenColl = trackGenAssociator->associateRecoToGen(trackCollection, TPCollectionHfake);
155 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method"
157 genRecColl = trackGenAssociator->associateGenToReco(trackCollection, TPCollectionHeff);
164 genRecColl = *(gentorecoCollectionH.
product());
168 recGenColl = *(recotogenCollectionH.
product());
177 edm::LogVerbatim(
"TrackValidator") <<
"\n# of GenParticles: " << tPCeff.size() <<
"\n";
203 dxyGen = (-vertex.x() *
sin(momentum.phi()) + vertex.y() *
cos(momentum.phi()));
204 dzGen = vertex.z() - (vertex.x() * momentum.x() + vertex.y() * momentum.y()) /
sqrt(momentum.perp2()) *
205 momentum.z() /
sqrt(momentum.perp2());
212 dxyGen = (-vertexTP.x() *
sin(momentumTP.phi()) + vertexTP.y() *
cos(momentumTP.phi()));
213 dzGen = vertexTP.z() - (vertexTP.x() * momentumTP.x() + vertexTP.y() * momentumTP.y()) /
214 sqrt(momentumTP.perp2()) * momentumTP.z() /
sqrt(momentumTP.perp2());
240 std::vector<std::pair<RefToBase<Track>,
double> >
rt;
241 if (genRecColl.
find(tpr) != genRecColl.
end()) {
242 rt = (std::vector<std::pair<RefToBase<Track>,
double> >)genRecColl[tpr];
246 matchedTrackPointer = rt.begin()->first.get();
247 edm::LogVerbatim(
"TrackValidator") <<
"GenParticle #" << st <<
" with pt=" <<
sqrt(momentumTP.perp2())
248 <<
" associated with quality:" << rt.begin()->second <<
"\n";
251 edm::LogVerbatim(
"TrackValidator") <<
"GenParticle #" << st <<
" with pt,eta,phi: " <<
sqrt(momentumTP.perp2())
252 <<
" , " << momentumTP.eta() <<
" , " << momentumTP.phi() <<
" , "
253 <<
" NOT associated to any reco::Track"
267 puinfo.getPU_NumInteractions());
270 if (matchedTrackPointer)
285 <<
label[www].label() <<
":" <<
label[www].instance() <<
": "
286 << trackCollection->size() <<
"\n";
296 bool isSigGenMatched(
false);
297 bool isGenMatched(
false);
298 bool isChargeMatched(
true);
299 int numAssocRecoTracks = 0;
301 double sharedFraction = 0.;
302 std::vector<std::pair<GenParticleRef, double> >
tp;
303 if (recGenColl.
find(track) != recGenColl.
end()) {
304 tp = recGenColl[
track];
310 sharedFraction = tp[0].second;
313 isChargeMatched =
false;
314 if (genRecColl.
find(tp[0].first) != genRecColl.
end())
315 numAssocRecoTracks = genRecColl[tp[0].
first].
size();
318 for (
unsigned int tp_ite = 0; tp_ite < tp.size(); ++tp_ite) {
328 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
329 <<
" associated with quality:" << tp.begin()->second <<
"\n";
333 <<
"reco::Track #" << rT <<
" with pt=" << track->
pt() <<
" NOT associated to any GenParticle"
349 puinfo.getPU_NumInteractions(),
389 int chargeTP = tpr->charge();
410 <<
"Total Associated (genToReco): " << ats <<
"\n"
411 <<
"Total Reconstructed: " << rT <<
"\n"
412 <<
"Total Associated (recoToGen): " << at <<
"\n"
413 <<
"Total Fakes: " << rT - at <<
"\n";
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoEsToken
Log< level::Info, true > LogVerbatim
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
edm::EDGetTokenT< reco::GenToRecoCollection > associatormapGtR
Vector momentum() const final
spatial momentum vector
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
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
constexpr bool isUninitialized() const noexcept
const Point & vertex() const override
vertex position (overwritten by PF...)
void dqmAnalyze(const edm::Event &, const edm::EventSetup &, const Histograms &) const override
Method called once per event.
edm::EDGetTokenT< reco::BeamSpot > bsSrc
MultiTrackValidatorGenPs(const edm::ParameterSet &pset)
Constructor.
math::XYZPointD Point
point in the space
bool getData(T &iHolder) const
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)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > label_pileupinfo
std::vector< edm::InputTag > label
T const * get() const
Returns C++ pointer to the item.
SingleObjectSelector< GenParticleCollection,::GenParticleCustomSelector > GenParticleCustomSelector
std::unique_ptr< ParametersDefinerForTP > parametersDefinerTP_
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
Log< level::Info, false > LogInfo
T const * product() const
~MultiTrackValidatorGenPs() override
Destructor.
T getParameter(std::string const &) const
const bool ignoremissingtkcollection_
MTVHistoProducerAlgoForTrackerHistograms histoProducerAlgo
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
int charge() const
track electric charge
math::XYZVectorD Vector
point in the space
edm::EDGetTokenT< reco::RecoToGenCollection > associatormapRtG
edm::EDGetTokenT< TrackingParticleCollection > label_tp_effic
tuple size
Write out results.
const bool doRecoTrackPlots_
const bool parametersDefinerIsCosmic_
const bool doSimTrackPlots_