567 LogDebug(
"SiStripHitEfficiencyWorker") <<
"setting iidd = " << iidd <<
" before checking efficiency and ";
569 const auto xloc = tm.
localX();
570 const auto yloc = tm.
localY();
578 const auto TKlayers = ::checkLayer(iidd, tTopo);
580 const bool withinAcceptance =
581 tm.
withinAcceptance() && (!::isInBondingExclusionZone(iidd, TKlayers, yloc, yErr, tTopo));
585 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Looking at layer under study";
586 unsigned int ModIsBad = 2;
587 unsigned int SiStripQualBad = 0;
588 float commonMode = -100;
592 if (!theClusters.
empty()) {
593 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Checking clusters with size = " << theClusters.
size();
594 std::vector<::ClusterInfo> VCluster_info;
595 const auto idsv = theClusters.
find(iidd);
596 if (idsv != theClusters.
end()) {
598 LogDebug(
"SiStripHitEfficiencyWorker")
599 <<
"found (ClusterId == iidd) with ClusterId = " << idsv->id() <<
" and iidd = " << iidd;
608 if (TKlayers >= 11) {
609 const BoundPlane& plane = stripdet->surface();
611 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
612 std::array<const float, 4>
const& parameterTrap = (*trapezoidalBounds).
parameters();
613 hbedge = parameterTrap[0];
614 htedge = parameterTrap[1];
615 hapoth = parameterTrap[3];
616 uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
617 uxlden = 1 + yloc * uylfac;
621 if (TrajStrip == -1) {
623 float pitch = stripdet->surface().bounds().width() / nstrips;
624 TrajStrip = xloc / pitch + nstrips / 2.0;
626 if (TKlayers >= 11) {
627 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
629 TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
634 for (
const auto& clus : *idsv) {
636 float res = (parameters.first.x() - xloc);
637 float sigma = ::checkConsistency(parameters, xloc, xErr);
644 if (TKlayers >= 11) {
645 res = parameters.first.x() - xloc / uxlden;
646 sigma =
abs(res) /
sqrt(parameters.second.xx() + xErr * xErr / uxlden / uxlden +
647 yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
650 VCluster_info.emplace_back(res, sigma, parameters.first.x());
652 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Have ID match. residual = " << res <<
" res sigma = " << sigma;
655 LogDebug(
"SiStripHitEfficiencyWorker")
656 <<
"hit position = " << parameters.first.x() <<
" hit error = " <<
sqrt(parameters.second.xx())
657 <<
" trajectory position = " << xloc <<
" traj error = " << xErr;
660 ::ClusterInfo finalCluster{1000.0, 1000.0, 0.0};
661 if (!VCluster_info.empty()) {
662 LogDebug(
"SiStripHitEfficiencyWorker") <<
"found clusters > 0";
663 if (VCluster_info.size() > 1) {
665 for (
const auto& res : VCluster_info) {
669 LogDebug(
"SiStripHitEfficiencyWorker")
670 <<
"iresidual = " << res.xResidual <<
" isigma = " << res.xResidualPull
671 <<
" and FinalRes = " << finalCluster.xResidual;
674 finalCluster = VCluster_info[0];
676 VCluster_info.clear();
679 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Final residual in X = " << finalCluster.xResidual <<
"+-"
680 << (finalCluster.xResidual / finalCluster.xResidualPull);
681 LogDebug(
"SiStripHitEfficiencyWorker")
682 <<
"Checking location of trajectory: abs(yloc) = " <<
abs(yloc) <<
" abs(xloc) = " <<
abs(xloc);
690 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is bad from SiStripQuality";
693 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is good from SiStripQuality";
697 for (
unsigned int ii = 0;
ii < fedErrorIds.
size();
ii++) {
698 if (iidd == fedErrorIds[
ii].rawId())
704 if (commonModeDigis.
isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
705 const auto digiframe = commonModeDigis->
find(iidd);
706 if (digiframe != commonModeDigis->
end())
711 LogDebug(
"SiStripHitEfficiencyWorker") <<
"before check good";
713 if (finalCluster.xResidualPull < 999.0) {
715 LogDebug(
"SiStripHitEfficiencyWorker")
716 <<
"hit being counted as good " << finalCluster.xResidual <<
" FinalRecHit " << iidd <<
" TKlayers "
717 << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc <<
" module " << iidd
718 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1) <<
"/"
719 << ((iidd & 0x3) == 2);
722 LogDebug(
"SiStripHitEfficiencyWorker")
723 <<
"hit being counted as bad ######### Invalid RPhi FinalResX " << finalCluster.xResidual
724 <<
" FinalRecHit " << iidd <<
" TKlayers " << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc
725 <<
" module " << iidd <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1)
726 <<
"/" << ((iidd & 0x3) == 2);
728 LogDebug(
"SiStripHitEfficiencyWorker")
729 <<
" RPhi Error " <<
sqrt(xErr * xErr + yErr * yErr) <<
" ErrorX " << xErr <<
" yErr " << yErr;
732 LogDebug(
"SiStripHitEfficiencyWorker")
733 <<
"To avoid them staying unused: ModIsBad=" << ModIsBad <<
", SiStripQualBad=" << SiStripQualBad
734 <<
", commonMode=" << commonMode <<
", highPurity=" <<
highPurity
735 <<
", withinAcceptance=" << withinAcceptance;
737 unsigned int layer = TKlayers;
740 layer = 10 + ((iidd >> 9) & 0x3);
742 layer = 13 + ((iidd >> 5) & 0x7);
745 unsigned int layerWithSide =
layer;
746 if (layer > 10 && layer < 14) {
747 const auto side = (iidd >> 13) & 0x3;
749 layerWithSide = layer + 3;
750 }
else if (layer > 13) {
751 const auto side = (iidd >> 18) & 0x3;
753 layerWithSide = layer + 3;
754 }
else if (side == 2) {
755 layerWithSide = layer + 3 + (
showRings_ ? 7 : 9);
759 if ((
bunchX_ > 0 &&
bunchX_ != bunchCrossing) || (!withinAcceptance) ||
764 const bool badquality = (SiStripQualBad == 1);
769 bool badflag =
false;
774 if (ModIsBad == 1 || finalCluster.xResidualPull >
resXSig_)
782 if (finalCluster.xResidualPull ==
792 double stripTrajMid = xloc / Pitch + nstrips / 2.0;
793 double stripCluster = finalCluster.xLocal / Pitch + nstrips / 2.0;
796 if (stripdet && layer >= 11) {
798 std::array<const float, 4>
const& parameters = trapezoidalBounds.
parameters();
799 const float hbedge = parameters[0];
800 const float htedge = parameters[1];
801 const float hapoth = parameters[3];
802 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
804 stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
808 h_resolution[
layer]->Fill(finalCluster.xResidualPull != 1000.0 ? stripTrajMid - stripCluster : 1000);
814 if (finalCluster.xResidualPull == 1000.0) {
815 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for resxsig=1000";
821 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for cluster-to-traj distance";
830 if (stripInAPV < stripsApvEdge_ || stripInAPV > sistrip::STRIPS_PER_APV -
stripsApvEdge_) {
831 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Too close to the edge: " << stripInAPV;
835 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for tapv!=capv";
842 LogDebug(
"SiStripHitEfficiencyWorker")
843 <<
"Filling measurement for " << iidd <<
" in layer " << layer <<
" histograms with bx=" << bunchCrossing
844 <<
", lumi=" << instLumi <<
", PU=" <<
PU <<
"; bad flag=" << badflag;
848 if (layer > 0 && layer <= 10) {
851 }
else if (layer > 10 && layer <= 13) {
853 const int side = layer > 13 ? (iidd >> 13) & 0x3 : (iidd >> 18) & 0x3;
897 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after good location check";
899 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after list of clusters";
901 LogDebug(
"SiStripHitEfficiencyWorker") <<
"After layers=TKLayers if with TKlayers=" << TKlayers
std::pair< LocalPoint, LocalError > LocalValues
virtual int nstrips() const =0
void fill(double x, bool found, float weight=1.)
const_iterator end(bool update=false) const
iterator find(det_id_type id)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< EffME1 > h_layer_vsPU
std::vector< MonitorElement * > h_resolution
unsigned int monodet_id() const
bool useOnlyHighPurityTracks_
std::vector< EffME1 > h_layer_vsBx
virtual const std::array< const float, 4 > parameters() const
std::vector< MonitorElement * > h_hotcold
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters <p) const
std::vector< EffME1 > h_layer_vsCM
const Bounds & bounds() const
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned int clusterMatchingMethod_
Abs< T >::type abs(const T &t)
std::set< uint32_t > badModules_
iterator end()
Return the off-the-end iterator.
bool withinAcceptance() const
double localErrorY() const
const_iterator find(id_type i, bool update=false) const
static const uint16_t STRIPS_PER_APV
void fill(uint32_t id, bool found, float weight=1.)
short getBadApvs(uint32_t detid) const
double localErrorX() const
virtual float width() const =0
std::vector< EffME1 > h_layer_vsLumi