53 for (
int i = 0;
i < 2;
i++) {
56 for (
int j = 0;
j < 2;
j++) {
88 tree_eff =
new TTree(
"EffTracks",
"Efficiency Tracks Tree");
151 tree_fake =
new TTree(
"FakeTracks",
"Fake Rate Tracks Tree");
212 std::cout <<
"ValidationMisalignedTracker::endJob Processed " <<
eventCount_ <<
" events" << std::endl;
229 std::vector<const reco::TrackToTrackingParticleAssociator*> associatore;
235 associatore.push_back(theAssociator.
product());
239 edm::LogInfo(
"Tracker Misalignment Validation") <<
"\n Starting!";
243 std::vector<int> indmu;
247 iEvent.getByLabel(
"source", evt);
249 bool foundmuons =
false;
252 for (HepMC::GenEvent::particle_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p) {
253 if (!
accepted && ((*p)->pdg_id() == 23) && (*p)->status() == 3) {
255 for (HepMC::GenVertex::particle_iterator aDaughter = (*p)->end_vertex()->particles_begin(HepMC::descendants);
256 aDaughter != (*p)->end_vertex()->particles_end(HepMC::descendants);
258 if (
abs((*aDaughter)->pdg_id()) == 13) {
260 if ((*aDaughter)->status() != 1) {
261 for (HepMC::GenVertex::particle_iterator byaDaughter =
262 (*aDaughter)->end_vertex()->particles_begin(HepMC::descendants);
263 byaDaughter != (*aDaughter)->end_vertex()->particles_end(HepMC::descendants);
265 if ((*byaDaughter)->status() == 1 &&
abs((*byaDaughter)->pdg_id()) == 13) {
266 indmu.push_back((*byaDaughter)->barcode());
267 std::cout <<
"Stable muon from Z with charge " << (*byaDaughter)->pdg_id() <<
" and index "
268 << (*byaDaughter)->barcode() << std::endl;
272 indmu.push_back((*aDaughter)->barcode());
273 std::cout <<
"Stable muon from Z with charge " << (*aDaughter)->pdg_id() <<
" and index "
274 << (*aDaughter)->barcode() << std::endl;
279 std::cout <<
"No muons from Z ...skip event" << std::endl;
285 std::cout <<
"No Z particles in the event ...skip event" << std::endl;
297 auto testGeomDet = trackerGeometry->
detsTOB().front();
298 std::cout << testGeomDet->position() << std::endl;
310 for (
int i = 0;
i < 2;
i++) {
311 for (
int j = 0;
j < 2;
j++) {
335 for (
unsigned int ww = 0; ww <
associators.size(); ww++) {
347 LogTrace(
"TrackValidator") <<
"Calling associateRecoToSim method"
351 LogTrace(
"TrackValidator") <<
"Calling associateSimToReco method"
360 std::cout <<
"Computing Efficiency" << std::endl;
362 edm::LogVerbatim(
"TrackValidator") <<
"\n# of TrackingParticles (before cuts): " << tPCeff.size() <<
"\n";
379 if (
tp->charge() == 0)
386 const SimTrack* simulatedTrack = &(*
tp->g4Track_begin());
398 tscpBuilder(ftsAtProduction,
GlobalPoint(0, 0, 0));
405 double dxySim = (-
v.x() *
sin(
p.phi()) +
v.y() *
cos(
p.phi()));
406 double dszSim =
v.z() *
p.perp() /
p.mag() - (
v.x() *
p.x() +
v.y() *
p.y()) /
p.perp() *
p.z() /
p.mag();
411 std::cout <<
" TRACCIA SIM DI MUONI " << std::endl;
423 std::cout <<
"3) Before assoc: SimTrack of type = " << simulatedTrack->
type() <<
" ,at eta = " <<
eta
424 <<
" ,with pt at vertex = " << simulatedTrack->
momentum().pt() <<
" GeV/c"
425 <<
" ,d0 =" <<
d0 <<
" ,z0 =" <<
z0 <<
" ,nhit=" <<
nhit << std::endl;
430 std::cout <<
" TRACK sim of muons from Z " << std::endl;
448 std::vector<std::pair<edm::RefToBase<reco::Track>,
double> >
rt;
449 if (simRecColl.
find(
tp) != simRecColl.
end()) {
462 edm::LogVerbatim(
"TrackValidator") <<
"TrackingParticle #" << st <<
" with pt=" <<
t->pt()
463 <<
" associated with quality:" <<
rt.begin()->second <<
"\n";
464 std::cout <<
"Reconstructed Track:" <<
t->pt() << std::endl;
465 std::cout <<
"\tpT: " <<
t->pt() << std::endl;
466 std::cout <<
"\timpact parameter:d0: " <<
t->d0() << std::endl;
467 std::cout <<
"\timpact parameter:z0: " <<
t->dz() << std::endl;
468 std::cout <<
"\tAzimuthal angle of point of closest approach:" <<
t->phi() << std::endl;
469 std::cout <<
"\tcharge: " <<
t->charge() << std::endl;
470 std::cout <<
"\teta: " <<
t->eta() << std::endl;
471 std::cout <<
"\tnormalizedChi2: " <<
t->normalizedChi2() << std::endl;
487 <<
", pt at vertex = " <<
recpt <<
" GeV/c, "
488 <<
", recd0 = " <<
recd0 <<
", recz0= " <<
recz0 << std::endl;
499 <<
" ,z0 residual=" <<
resz0 <<
" with eff=" <<
eff << std::endl;
503 std::cout <<
" TRACCIA RECO DI MUONI " << std::endl;
508 std::cout <<
" TRACCIA RECO DI ELETTRONI " << std::endl;
519 sqrt((
t->momentum().x() *
t->momentum().x()) + (
t->momentum().y() *
t->momentum().y()));
527 <<
" and phi= " <<
recphi << std::endl;
531 <<
"TrackingParticle #" << st <<
" with pt=" <<
sqrt(
tp->momentum().perp2())
532 <<
" NOT associated to any reco::Track"
561 (
py[0][0] +
py[0][1]) * (
py[0][0] +
py[0][1]) - (
pz[0][0] +
pz[0][1]) * (
pz[0][0] +
pz[0][1]));
627 std::cout <<
"Computing Fake Rate" << std::endl;
670 std::cout <<
"Track number " <<
i << std::endl;
672 std::cout <<
"\timpact parameter:d0: " <<
track->d0() << std::endl;
673 std::cout <<
"\timpact parameter:z0: " <<
track->dz() << std::endl;
674 std::cout <<
"\tAzimuthal angle of point of closest approach:" <<
track->phi() << std::endl;
677 std::cout <<
"\tnormalizedChi2: " <<
track->normalizedChi2() << std::endl;
679 std::vector<std::pair<TrackingParticleRef, double> >
tp;
686 <<
" associated with quality:" <<
tp.begin()->second <<
"\n";
689 const SimTrack* fakeassocTrack = &(*tpr->g4Track_begin());
694 GlobalPoint(tpr->vertex().x(), tpr->vertex().y(), tpr->vertex().z()),
701 tscpBuilder(ftsAtProduction,
GlobalPoint(0, 0, 0));
708 double dxySim = (-
v.x() *
sin(
p.phi()) +
v.y() *
cos(
p.phi()));
709 double dszSim =
v.z() *
p.perp() /
p.mag() - (
v.x() *
p.x() +
v.y() *
p.y()) /
p.perp() *
p.z() /
p.mag();
721 std::cout <<
"4) After call to associator: the best SimTrack match is of type" << fakeassocTrack->
type()
724 <<
" ,d0 global = " <<
faked0 <<
" ,z0 = " <<
fakez0 << std::endl;
736 <<
"reco::Track #" << rT <<
" with pt=" <<
track->pt() <<
" NOT associated to any TrackingParticle"