72 edm::LogInfo(
"TrackValidator") <<
"\n====================================================" <<
"\n"
73 <<
"Analyzing new event" <<
"\n"
74 <<
"====================================================\n" <<
"\n";
93 event.getByToken(
bsSrc,recoBeamSpotHandle);
100 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
101 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
102 puinfo=(*puinfoH)[puinfo_ite];
115 trackGenAssociator = trackGenAssociatorH.
product();
125 std::vector<const edm::ValueMap<reco::DeDxData> *> v_dEdx;
131 v_dEdx.push_back(dEdx1Handle.
product());
132 v_dEdx.push_back(dEdx2Handle.
product());
136 for (
unsigned int www=0;www<
label.size();www++){
151 <<
label[www].process()<<
":"
152 <<
label[www].label()<<
":"
153 <<
label[www].instance()<<
" with "
156 LogTrace(
"TrackValidator") <<
"Calling associateRecoToGen method" <<
"\n";
157 recGenColl=trackGenAssociator->associateRecoToGen(trackCollection,
159 LogTrace(
"TrackValidator") <<
"Calling associateGenToReco method" <<
"\n";
160 genRecColl=trackGenAssociator->associateGenToReco(trackCollection,
165 <<
label[www].process()<<
":"
166 <<
label[www].label()<<
":"
167 <<
label[www].instance()<<
" with "
172 genRecColl= *(gentorecoCollectionH.
product());
176 recGenColl= *(recotogenCollectionH.
product());
187 edm::LogVerbatim(
"TrackValidator") <<
"\n# of GenParticles: " << tPCeff.size() <<
"\n";
212 dxyGen = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
213 dzGen = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
214 * momentum.z()/
sqrt(momentum.perp2());
220 momentumTP = parametersDefinerTP->momentum(event,setup,*tp);
221 vertexTP = parametersDefinerTP->vertex(event,setup,*tp);
222 dxyGen = (-vertexTP.x()*
sin(momentumTP.phi())+vertexTP.y()*
cos(momentumTP.phi()));
223 dzGen = vertexTP.z() - (vertexTP.x()*momentumTP.x()+vertexTP.y()*momentumTP.y())/
sqrt(momentumTP.perp2())
224 * momentumTP.z()/
sqrt(momentumTP.perp2());
248 std::vector<std::pair<RefToBase<Track>,
double> > rt;
249 if(genRecColl.
find(tpr) != genRecColl.
end()){
250 rt = (std::vector<std::pair<RefToBase<Track>,
double> >) genRecColl[tpr];
254 matchedTrackPointer = rt.begin()->first.get();
256 <<
" with pt=" <<
sqrt(momentumTP.perp2())
257 <<
" associated with quality:" << rt.begin()->second <<
"\n";
261 <<
"GenParticle #" << st
262 <<
" with pt,eta,phi: "
263 <<
sqrt(momentumTP.perp2()) <<
" , "
264 << momentumTP.eta() <<
" , "
265 << momentumTP.phi() <<
" , "
266 <<
" NOT associated to any reco::Track" <<
"\n";
272 histoProducerAlgo_->fill_recoAssociated_simTrack_histos(
w,*tp,momentumTP,vertexTP,dxyGen,dzGen,nSimHits,matchedTrackPointer,puinfo.getPU_NumInteractions());
275 if (matchedTrackPointer) asts++;
293 <<
label[www].process()<<
":"
294 <<
label[www].label()<<
":"
295 <<
label[www].instance()
296 <<
": " << trackCollection->size() <<
"\n";
307 bool isSigGenMatched(
false);
308 bool isGenMatched(
false);
309 bool isChargeMatched(
true);
310 int numAssocRecoTracks = 0;
312 double sharedFraction = 0.;
313 std::vector<std::pair<GenParticleRef, double> > tp;
314 if(recGenColl.
find(track) != recGenColl.
end()){
315 tp = recGenColl[track];
321 sharedFraction = tp[0].second;
323 if (tp[0].
first->charge() != track->
charge()) isChargeMatched =
false;
324 if(genRecColl.
find(tp[0].first) != genRecColl.
end()) numAssocRecoTracks = genRecColl[tp[0].
first].
size();
327 for (
unsigned int tp_ite=0;tp_ite<tp.size();++tp_ite){
337 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
338 <<
" associated with quality:" << tp.begin()->second <<
"\n";
341 edm::LogVerbatim(
"TrackValidator") <<
"reco::Track #" << rT <<
" with pt=" << track->
pt()
342 <<
" NOT associated to any GenParticle" <<
"\n";
347 histoProducerAlgo_->fill_generic_recoTrack_histos(
w,*track,bs.position(),
nullptr, isGenMatched,isSigGenMatched, isChargeMatched, numAssocRecoTracks, puinfo.getPU_NumInteractions(), nSimHits, sharedFraction,
dR);
356 if (tp.size()==0)
continue;
380 int chargeTP = tpr->charge();
383 *track,bs.position());
402 <<
"Total Associated (genToReco): " << ats <<
"\n"
403 <<
"Total Reconstructed: " << rT <<
"\n"
404 <<
"Total Associated (recoToGen): " << at <<
"\n"
405 <<
"Total Fakes: " << rT-at <<
"\n";
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx1Tag
edm::EDGetTokenT< reco::GenToRecoCollection > associatormapGtR
std::vector< edm::InputTag > associators
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...)
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
MultiTrackValidatorGenPs(const edm::ParameterSet &pset)
Constructor.
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
double pt() const
track transverse momentum
Cos< T >::type cos(const T &t)
T const * get() const
Returns C++ pointer to the item.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::unique_ptr< MTVHistoProducerAlgoForTracker > histoProducerAlgo_
std::string parametersDefiner
virtual Vector momentum() const final
spatial momentum vector
T const * product() const
bool isUninitialized() const
int charge() const
track electric charge
SingleObjectSelector< GenParticleCollection,::GenParticleCustomSelector > GenParticleCustomSelector
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > labelToken
math::XYZVectorD Vector
point in the space
edm::EDGetTokenT< TrackingParticleCollection > label_tp_fake
edm::EDGetTokenT< reco::RecoToGenCollection > associatormapRtG
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
const bool doRecoTrackPlots_
virtual ~MultiTrackValidatorGenPs()
Destructor.
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > m_dEdx2Tag
const bool parametersDefinerIsCosmic_
const bool doSimTrackPlots_