37 ttree_all_hits_(nullptr),
38 ttree_track_hits_(nullptr),
39 ttree_track_hits_strip_(nullptr),
40 trackerHitAssociatorConfig_(consumesCollector()) {
380 evt =
e.id().event();
383 cout <<
"evt = " <<
evt << endl;
386 float radtodeg = 180.0 /
math_pi;
390 float mindist = 999999.9;
414 for (vector<Trajectory>::const_iterator it = trajCollectionHandle->begin(); it != trajCollectionHandle->end(); ++it) {
415 vector<TrajectoryMeasurement> tmColl = it->measurements();
416 for (vector<TrajectoryMeasurement>::const_iterator itTraj = tmColl.begin(); itTraj != tmColl.end(); ++itTraj) {
417 if (!itTraj->updatedState().isValid())
505 if (trans_trk_rec_hit_point ==
nullptr)
510 if (trk_rec_hit ==
nullptr)
513 DetId detid = (trk_rec_hit)->geographicalId();
522 dynamic_cast<const SiStripMatchedRecHit2D*>((*trans_trk_rec_hit_point).hit());
523 const SiStripRecHit2D* hit2d = dynamic_cast<const SiStripRecHit2D*>((*trans_trk_rec_hit_point).hit());
524 const SiStripRecHit1D* hit1d = dynamic_cast<const SiStripRecHit1D*>((*trans_trk_rec_hit_point).hit());
526 if (!matchedhit && !hit2d && !hit1d)
529 position = (trk_rec_hit)->localPosition();
530 error = (trk_rec_hit)->localPositionError();
553 float locx = localDir.
x();
554 float locy = localDir.
y();
555 float locz = localDir.
z();
565 if (StripSubdet.
stereo() == 0)
575 if (strip_geom_det_unit !=
nullptr) {
652 if (cluster->getSplitClusterError() > 0.0)
661 const auto& stripCharges = cluster->amplitudes();
663 for (
unsigned int i = 0;
i < stripCharges.size(); ++
i) {
671 float mindist = 999999.9;
683 int strip_nprimaries = 0;
684 int current_index = 0;
686 for (vector<PSimHit>::const_iterator
m =
matched.begin();
m <
matched.end(); ++
m) {
689 if ((*m).processType() == 2)
692 if (current_index == 1) {
695 }
else if (current_index == 2) {
698 }
else if (current_index == 3) {
701 }
else if (current_index == 4) {
704 }
else if (current_index == 5) {
709 float dist =
abs((hit1d)->localPosition().
x() - (*m).localPosition().x());
711 if (dist < mindist) {
777 auto& stripCharges = cluster->amplitudes();
779 for (
unsigned int i = 0;
i < stripCharges.size(); ++
i) {
787 float mindist = 999999.9;
799 for (vector<PSimHit>::const_iterator
m =
matched.begin();
m <
matched.end(); ++
m) {
800 float dist =
abs((hit2d)->localPosition().
x() - (*m).localPosition().x());
802 if (dist < mindist) {
846 for (TrackerGeometry::DetContainer::const_iterator it = pDD->
dets().begin(); it != pDD->
dets().end(); it++) {
847 DetId detId = ((*it)->geographicalId());
850 if (dsmatch == recHitColl->
end())
860 for (; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
866 cout <<
"SiPixelErrorEstimation::analyze: rechits without associated simhit !!!!!!!" << endl;
1007 cout <<
"SiPixelErrorEstimation::analyze: Not in a pixel detector !!!!!" << endl;
1015 if (pixeliter->cluster()->getSplitClusterErrorX() > 0.0 && pixeliter->cluster()->getSplitClusterErrorY() > 0.0) {
1024 const int maxPixelCol = pixeliter->cluster()->maxPixelCol();
1025 const int maxPixelRow = pixeliter->cluster()->maxPixelRow();
1026 const int minPixelCol = pixeliter->cluster()->minPixelCol();
1027 const int minPixelRow = pixeliter->cluster()->minPixelRow();
1036 if (topol->isItEdgePixelInX(minPixelRow) || topol->isItEdgePixelInX(maxPixelRow))
1041 if (topol->isItEdgePixelInY(minPixelCol) || topol->isItEdgePixelInY(maxPixelCol))
1047 if (topol->containsBigPixelInX(minPixelRow, maxPixelRow))
1052 if (topol->containsBigPixelInY(minPixelCol, maxPixelCol))
1063 if (tmp_nrows == 80)
1065 else if (tmp_nrows == 160)
1068 cout <<
"-------------------------------------------------- Wrong module size !!!" << endl;
1097 LocalError le = pixeliter->localPositionError();
1101 bool found_hit_from_generated_particle =
false;
1104 float closest_dist = 99999.9;
1105 std::vector<PSimHit>::const_iterator closest_simhit =
matched.begin();
1107 for (std::vector<PSimHit>::const_iterator
m =
matched.begin();
m <
matched.end();
m++) {
1109 int pid = (*m).particleType();
1114 float simhitx = 0.5 * ((*m).entryPoint().x() + (*m).exitPoint().x());
1115 float simhity = 0.5 * ((*m).entryPoint().y() + (*m).exitPoint().y());
1120 float dist =
sqrt(x_res * x_res + y_res * y_res);
1122 if (dist < closest_dist) {
1123 closest_dist = dist;
1125 found_hit_from_generated_particle =
true;
1131 if (
checkType_ && !found_hit_from_generated_particle)
1134 all_x1 = (*closest_simhit).entryPoint().x();
1135 all_y1 = (*closest_simhit).entryPoint().y();
1136 all_z1 = (*closest_simhit).entryPoint().z();
1137 all_x2 = (*closest_simhit).exitPoint().x();
1138 all_y2 = (*closest_simhit).exitPoint().y();
1139 all_z2 = (*closest_simhit).exitPoint().z();
1141 (*closest_simhit).entryPoint().x(), (*closest_simhit).entryPoint().y(), (*closest_simhit).entryPoint().z()));
1143 (*closest_simhit).exitPoint().x(), (*closest_simhit).exitPoint().y(), (*closest_simhit).exitPoint().z()));
1152 (*closest_simhit).entryPoint().x(), (*closest_simhit).entryPoint().y(), (*closest_simhit).entryPoint().z()));
1154 (*closest_simhit).exitPoint().x(), (*closest_simhit).exitPoint().y(), (*closest_simhit).exitPoint().z()));
1191 all_simpx = (*closest_simhit).momentumAtEntry().x();
1192 all_simpy = (*closest_simhit).momentumAtEntry().y();
1193 all_simpz = (*closest_simhit).momentumAtEntry().z();
1194 all_eloss = (*closest_simhit).energyLoss();
1197 all_pidhit = (*closest_simhit).particleType();
1198 all_trkid = (*closest_simhit).trackId();
1207 SimTrackContainer::const_iterator trksiter;
1208 for (trksiter = trks.begin(); trksiter != trks.end(); trksiter++)
1209 if ((
int)trksiter->trackId() ==
all_trkid) {
1221 const std::vector<SiPixelCluster::Pixel>& pixvector = clust->pixels();
1222 for (
int i = 0;
i < (
int)pixvector.size(); ++
i) {
1253 reco::TrackCollection::const_iterator tciter;
1257 for (tciter =
tracks->begin(); tciter !=
tracks->end(); ++tciter) {
1259 for (
auto const hit : tciter->recHits()) {
1337 if (matchedhit->
cluster()->getSplitClusterErrorX() > 0.0 &&
1338 matchedhit->
cluster()->getSplitClusterErrorY() > 0.0)
1360 float distx, disty, dist;
1361 bool found_hit_from_generated_particle =
false;
1363 int n_assoc_muon = 0;
1365 vector<PSimHit>::const_iterator closestit =
matched.begin();
1366 for (vector<PSimHit>::const_iterator
m =
matched.begin();
m <
matched.end(); ++
m) {
1368 int pid = (*m).particleType();
1373 float simhitx = 0.5 * ((*m).entryPoint().x() + (*m).exitPoint().x());
1374 float simhity = 0.5 * ((*m).entryPoint().y() + (*m).exitPoint().y());
1378 dist =
sqrt(distx * distx + disty * disty);
1380 if (dist < mindist) {
1385 found_hit_from_generated_particle =
true;
1391 if (
checkType_ && !found_hit_from_generated_particle)
1400 DetId detId =
hit->geographicalId();
1402 const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>((*tracker).idToDet(detId));
1406 pidhit = (*closestit).particleType();
1409 simhitx = 0.5 * ((*closestit).entryPoint().x() + (*closestit).exitPoint().x());
1410 simhity = 0.5 * ((*closestit).entryPoint().y() + (*closestit).exitPoint().y());
1417 float simhitpx = (*closestit).momentumAtEntry().x();
1418 float simhitpy = (*closestit).momentumAtEntry().y();
1419 float simhitpz = (*closestit).momentumAtEntry().z();
1421 beta = atan2(simhitpz, simhitpy) * radtodeg;
1422 alpha = atan2(simhitpz, simhitpx) * radtodeg;
1428 float locx = simhitpx;
1429 float locy = simhitpy;
1430 float locz = simhitpz;
1432 bool isFlipped =
false;
1440 trk_alpha = acos(locx /
sqrt(locx * locx + locz * locz)) * radtodeg;
1444 trk_beta = acos(locy /
sqrt(locy * locy + locz * locz)) * radtodeg;
1446 phi = tciter->momentum().phi() /
math_pi * 180.0;
1447 eta = tciter->momentum().eta();
1449 const int maxPixelCol = (*matchedhit).cluster()->maxPixelCol();
1450 const int maxPixelRow = (*matchedhit).cluster()->maxPixelRow();
1451 const int minPixelCol = (*matchedhit).cluster()->minPixelCol();
1452 const int minPixelRow = (*matchedhit).cluster()->minPixelRow();
1455 if (theTopol->isItEdgePixelInX(minPixelRow) || theTopol->isItEdgePixelInX(maxPixelRow))
1460 if (theTopol->isItEdgePixelInY(minPixelCol) || theTopol->isItEdgePixelInY(maxPixelCol))
1466 if (theTopol->containsBigPixelInX(minPixelRow, maxPixelRow))
1471 if (theTopol->containsBigPixelInY(minPixelCol, maxPixelCol))
1480 if (tmp_nrows == 80)
1482 else if (tmp_nrows == 160)
1485 cout <<
"-------------------------------------------------- Wrong module size !!!" << endl;
1520 cout <<
"---------------- RecHit with no associated SimHit !!! -------------------------- " << endl;
1540 const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit*>(&det);
1542 cout <<
"---------------------------------------------- Not a pixel detector !!!!!!!!!!!!!!" << endl;
1549 float xcenter =
cl.x();
1550 float ycenter =
cl.y();
1561 float gpx =
gp.x() / gp_mod;
1562 float gpy =
gp.y() / gp_mod;
1563 float gpz =
gp.z() / gp_mod;
1590 float gv_dot_gvx = gv.
x() * gvx.
x() + gv.
y() * gvx.
y() + gv.
z() * gvx.
z();
1591 float gv_dot_gvy = gv.
x() * gvy.
x() + gv.
y() * gvy.
y() + gv.
z() * gvy.
z();
1592 float gv_dot_gvz = gv.
x() * gvz.
x() + gv.
y() * gvz.
y() + gv.
z() * gvz.
z();
1595 alpha = atan2(gv_dot_gvz, gv_dot_gvx);
1596 beta = atan2(gv_dot_gvz, gv_dot_gvy);