37 ttree_all_hits_(nullptr),
38 ttree_track_hits_(nullptr),
39 ttree_track_hits_strip_(nullptr),
40 trackerHitAssociatorConfig_(consumesCollector()) {
382 evt =
e.id().event();
385 cout <<
"evt = " <<
evt << endl;
387 float math_pi = 3.14159265;
388 float radtodeg = 180.0 / math_pi;
392 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();
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) {
773 auto& stripCharges = cluster->amplitudes();
775 for (
unsigned int i = 0;
i < stripCharges.size(); ++
i) {
783 float mindist = 999999.9;
795 for (vector<PSimHit>::const_iterator
m =
matched.begin();
m <
matched.end(); ++
m) {
796 float dist =
abs((hit2d)->localPosition().
x() - (*m).localPosition().x());
798 if (dist < mindist) {
842 for (TrackerGeometry::DetContainer::const_iterator it = pDD->
dets().begin(); it != pDD->
dets().end(); it++) {
846 if (dsmatch == recHitColl->
end())
856 for (; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
862 cout <<
"SiPixelErrorEstimation::analyze: rechits without associated simhit !!!!!!!" << endl;
1003 cout <<
"SiPixelErrorEstimation::analyze: Not in a pixel detector !!!!!" << endl;
1011 if (pixeliter->cluster()->getSplitClusterErrorX() > 0.0 && pixeliter->cluster()->getSplitClusterErrorY() > 0.0) {
1020 const int maxPixelCol = pixeliter->cluster()->maxPixelCol();
1021 const int maxPixelRow = pixeliter->cluster()->maxPixelRow();
1022 const int minPixelCol = pixeliter->cluster()->minPixelCol();
1023 const int minPixelRow = pixeliter->cluster()->minPixelRow();
1059 if (tmp_nrows == 80)
1061 else if (tmp_nrows == 160)
1064 cout <<
"-------------------------------------------------- Wrong module size !!!" << endl;
1082 std::cout <<
"We are not in the pixel detector" << (
int)
detId.subdetId() << endl;
1093 LocalError le = pixeliter->localPositionError();
1097 bool found_hit_from_generated_particle =
false;
1100 float closest_dist = 99999.9;
1101 std::vector<PSimHit>::const_iterator closest_simhit =
matched.begin();
1103 for (std::vector<PSimHit>::const_iterator
m =
matched.begin();
m <
matched.end();
m++) {
1105 int pid = (*m).particleType();
1110 float simhitx = 0.5 * ((*m).entryPoint().x() + (*m).exitPoint().x());
1111 float simhity = 0.5 * ((*m).entryPoint().y() + (*m).exitPoint().y());
1116 float dist =
sqrt(x_res * x_res + y_res * y_res);
1118 if (dist < closest_dist) {
1119 closest_dist = dist;
1121 found_hit_from_generated_particle =
true;
1127 if (
checkType_ && !found_hit_from_generated_particle)
1130 all_x1 = (*closest_simhit).entryPoint().x();
1131 all_y1 = (*closest_simhit).entryPoint().y();
1132 all_z1 = (*closest_simhit).entryPoint().z();
1133 all_x2 = (*closest_simhit).exitPoint().x();
1134 all_y2 = (*closest_simhit).exitPoint().y();
1135 all_z2 = (*closest_simhit).exitPoint().z();
1137 (*closest_simhit).entryPoint().x(), (*closest_simhit).entryPoint().y(), (*closest_simhit).entryPoint().z()));
1139 (*closest_simhit).exitPoint().x(), (*closest_simhit).exitPoint().y(), (*closest_simhit).exitPoint().z()));
1148 (*closest_simhit).entryPoint().x(), (*closest_simhit).entryPoint().y(), (*closest_simhit).entryPoint().z()));
1150 (*closest_simhit).exitPoint().x(), (*closest_simhit).exitPoint().y(), (*closest_simhit).exitPoint().z()));
1187 all_simpx = (*closest_simhit).momentumAtEntry().x();
1188 all_simpy = (*closest_simhit).momentumAtEntry().y();
1189 all_simpz = (*closest_simhit).momentumAtEntry().z();
1190 all_eloss = (*closest_simhit).energyLoss();
1193 all_pidhit = (*closest_simhit).particleType();
1194 all_trkid = (*closest_simhit).trackId();
1203 SimTrackContainer::const_iterator trksiter;
1204 for (trksiter =
trks.begin(); trksiter !=
trks.end(); trksiter++)
1205 if ((
int)trksiter->trackId() ==
all_trkid) {
1217 const std::vector<SiPixelCluster::Pixel>& pixvector = clust->pixels();
1218 for (
int i = 0;
i < (
int)pixvector.size(); ++
i) {
1249 reco::TrackCollection::const_iterator tciter;
1253 for (tciter =
tracks->begin(); tciter !=
tracks->end(); ++tciter) {
1255 for (
auto const hit : tciter->recHits()) {
1333 if (matchedhit->
cluster()->getSplitClusterErrorX() > 0.0 &&
1334 matchedhit->
cluster()->getSplitClusterErrorY() > 0.0)
1356 float distx, disty, dist;
1357 bool found_hit_from_generated_particle =
false;
1359 vector<PSimHit>::const_iterator closestit =
matched.begin();
1360 for (vector<PSimHit>::const_iterator
m =
matched.begin();
m <
matched.end(); ++
m) {
1362 int pid = (*m).particleType();
1367 float simhitx = 0.5 * ((*m).entryPoint().x() + (*m).exitPoint().x());
1368 float simhity = 0.5 * ((*m).entryPoint().y() + (*m).exitPoint().y());
1372 dist =
sqrt(distx * distx + disty * disty);
1374 if (dist < mindist) {
1377 found_hit_from_generated_particle =
true;
1383 if (
checkType_ && !found_hit_from_generated_particle)
1392 pidhit = (*closestit).particleType();
1395 simhitx = 0.5 * ((*closestit).entryPoint().x() + (*closestit).exitPoint().x());
1396 simhity = 0.5 * ((*closestit).entryPoint().y() + (*closestit).exitPoint().y());
1403 float simhitpx = (*closestit).momentumAtEntry().x();
1404 float simhitpy = (*closestit).momentumAtEntry().y();
1405 float simhitpz = (*closestit).momentumAtEntry().z();
1407 beta = atan2(simhitpz, simhitpy) * radtodeg;
1408 alpha = atan2(simhitpz, simhitpx) * radtodeg;
1414 float locx = simhitpx;
1415 float locy = simhitpy;
1416 float locz = simhitpz;
1418 bool isFlipped =
false;
1426 trk_alpha = acos(locx /
sqrt(locx * locx + locz * locz)) * radtodeg;
1430 trk_beta = acos(locy /
sqrt(locy * locy + locz * locz)) * radtodeg;
1432 phi = tciter->momentum().phi() / math_pi * 180.0;
1433 eta = tciter->momentum().eta();
1435 const int maxPixelCol = (*matchedhit).cluster()->maxPixelCol();
1436 const int maxPixelRow = (*matchedhit).cluster()->maxPixelRow();
1437 const int minPixelCol = (*matchedhit).cluster()->minPixelCol();
1438 const int minPixelRow = (*matchedhit).cluster()->minPixelRow();
1466 if (tmp_nrows == 80)
1468 else if (tmp_nrows == 160)
1471 cout <<
"-------------------------------------------------- Wrong module size !!!" << endl;
1506 cout <<
"---------------- RecHit with no associated SimHit !!! -------------------------- " << endl;
1528 cout <<
"---------------------------------------------- Not a pixel detector !!!!!!!!!!!!!!" << endl;
1535 float xcenter =
cl.x();
1536 float ycenter =
cl.y();
1547 float gpx =
gp.x() / gp_mod;
1548 float gpy =
gp.y() / gp_mod;
1549 float gpz =
gp.z() / gp_mod;
1576 float gv_dot_gvx = gv.
x() * gvx.
x() + gv.
y() * gvx.
y() + gv.
z() * gvx.
z();
1577 float gv_dot_gvy = gv.
x() * gvy.
x() + gv.
y() * gvy.
y() + gv.
z() * gvy.
z();
1578 float gv_dot_gvz = gv.
x() * gvz.
x() + gv.
y() * gvz.
y() + gv.
z() * gvz.
z();
1581 alpha = atan2(gv_dot_gvz, gv_dot_gvx);
1582 beta = atan2(gv_dot_gvz, gv_dot_gvy);
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
ClusterRef cluster() const
bool tibIsDoubleSide(const DetId &id) const
T getParameter(std::string const &) const
unsigned int tobLayer(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tibSide(const DetId &id) const
Point3DBase< Scalar, LocalTag > LocalPoint
bool tibIsZPlusSide(const DetId &id) const
unsigned int tobSide(const DetId &id) const
int strip_tib_is_internal_string
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
TTree * ttree_track_hits_
bool tobIsZMinusSide(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
virtual int ncolumns() const =0
unsigned int tibOrder(const DetId &id) const
TrackerHitAssociator::Config trackerHitAssociatorConfig_
unsigned int stereo() const
stereo
int strip_tib_is_z_minus_side
int strip_tob_is_z_minus_side
unsigned int tibModule(const DetId &id) const
SiStripModuleGeometry moduleGeometry() const
edm::EDGetTokenT< reco::TrackCollection > tTrackCollection
int closest(std::vector< int > const &vec, int value)
unsigned int pxfModule(const DetId &id) const
bool tibIsExternalString(const DetId &id) const
bool tibIsZMinusSide(const DetId &id) const
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
virtual int nrows() const =0
unsigned int tibString(const DetId &id) const
void analyze(const edm::Event &, const edm::EventSetup &) override
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
unsigned int pxbLadder(const DetId &id) const
int strip_tob_is_z_plus_side
ClusterRef cluster() const
bool tibIsStereo(const DetId &id) const
bool tobIsDoubleSide(const DetId &id) const
int strip_tob_is_double_side
const_iterator end(bool update=false) const
T getUntrackedParameter(std::string const &, T const &) const
bool tobIsStereo(const DetId &id) const
bool tibIsRPhi(const DetId &id) const
int strip_tob_module_number
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual bool isItEdgePixelInX(int ixbin) const =0
T const * product() const
edm::EDGetTokenT< edm::SimTrackContainer > tSimTrackContainer
virtual bool containsBigPixelInY(int iymin, int iymax) const =0
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
LocalVector momentum() const
Momentum vector in the local frame.
unsigned int pxfDisk(const DetId &id) const
Abs< T >::type abs(const T &t)
virtual bool containsBigPixelInX(int ixmin, int ixmax) const =0
SiPixelErrorEstimation(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
int strip_tob_layer_number
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
static constexpr auto TOB
bool tobIsZPlusSide(const DetId &id) const
float clusterProbability(unsigned int flags=0) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
bool tobIsRPhi(const DetId &id) const
edm::EDGetTokenT< std::vector< Trajectory > > tTrajectory
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
unsigned int pxfPanel(const DetId &id) const
Detector identifier class for the strip tracker.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
unsigned int pxfSide(const DetId &id) const
static constexpr auto TIB
const Plane & surface() const
The nominal surface of the GeomDet.
const PositionType & position() const
float all_pixel_clst_err_y
int strip_tib_is_z_plus_side
void computeAnglesFromDetPosition(const SiPixelCluster &cl, const GeomDetUnit &det, float &alpha, float &beta)
bool tibIsInternalString(const DetId &id) const
unsigned int tobRod(const DetId &id) const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
int strip_tib_string_number
Pixel cluster – collection of neighboring pixels above threshold.
virtual bool isItEdgePixelInY(int iybin) const =0
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
const_iterator find(id_type i, bool update=false) const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
static int position[264][3]
int strip_tib_module_number
~SiPixelErrorEstimation() override
int strip_tib_layer_number
virtual TrackingRecHit const * hit() const
edm::EDGetTokenT< SiPixelRecHitCollection > tPixRecHitCollection
TTree * ttree_track_hits_strip_
int strip_tib_is_external_string
unsigned int tibLayer(const DetId &id) const
unsigned int tobModule(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
float all_pixel_clst_err_x
ClusterRef cluster() const
std::vector< SimTrack > SimTrackContainer
int strip_tib_is_double_side
Point3DBase< float, LocalTag > Local3DPoint