653 LogDebug(
"SiStripHitEfficiencyWorker") <<
"setting iidd = " << iidd <<
" before checking efficiency and ";
655 const auto xloc = tm.
localX();
656 const auto yloc = tm.
localY();
664 const auto TKlayers = ::checkLayer(iidd, tTopo);
666 const bool withinAcceptance =
667 tm.
withinAcceptance() && (!::isInBondingExclusionZone(iidd, TKlayers, yloc, yErr, tTopo));
671 (
layers_ == bounds::k_LayersStart))) {
672 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Looking at layer under study";
673 unsigned int ModIsBad = 2;
674 unsigned int SiStripQualBad = 0;
675 float commonMode = -100;
679 if (!theClusters.
empty()) {
680 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Checking clusters with size = " << theClusters.
size();
681 std::vector<::ClusterInfo> VCluster_info;
682 const auto idsv = theClusters.
find(iidd);
683 if (idsv != theClusters.
end()) {
685 LogDebug(
"SiStripHitEfficiencyWorker")
686 <<
"found (ClusterId == iidd) with ClusterId = " << idsv->id() <<
" and iidd = " << iidd;
695 if (TKlayers > bounds::k_LayersAtTOBEnd) {
696 const BoundPlane& plane = stripdet->surface();
698 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
699 std::array<const float, 4>
const& parameterTrap = (*trapezoidalBounds).
parameters();
700 hbedge = parameterTrap[0];
701 htedge = parameterTrap[1];
702 hapoth = parameterTrap[3];
703 uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
704 uxlden = 1 + yloc * uylfac;
708 if (TrajStrip == -1) {
710 float pitch = stripdet->surface().bounds().width() / nstrips;
711 TrajStrip = xloc / pitch + nstrips / 2.0;
713 if (TKlayers > bounds::k_LayersAtTOBEnd) {
714 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
716 TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
721 for (
const auto& clus : *idsv) {
724 float sigma = ::checkConsistency(
parameters, xloc, xErr);
731 if (TKlayers > bounds::k_LayersAtTOBEnd) {
734 yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
737 VCluster_info.emplace_back(
res, sigma,
parameters.first.x());
739 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Have ID match. residual = " <<
res <<
" res sigma = " << sigma;
742 LogDebug(
"SiStripHitEfficiencyWorker")
744 <<
" trajectory position = " << xloc <<
" traj error = " << xErr;
747 ::ClusterInfo finalCluster{1000.0, 1000.0, 0.0};
748 if (!VCluster_info.empty()) {
749 LogDebug(
"SiStripHitEfficiencyWorker") <<
"found clusters > 0";
750 if (VCluster_info.size() > 1) {
752 for (
const auto&
res : VCluster_info) {
756 LogDebug(
"SiStripHitEfficiencyWorker")
757 <<
"iresidual = " <<
res.xResidual <<
" isigma = " <<
res.xResidualPull
758 <<
" and FinalRes = " << finalCluster.xResidual;
761 finalCluster = VCluster_info[0];
763 VCluster_info.clear();
766 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Final residual in X = " << finalCluster.xResidual <<
"+-" 767 << (finalCluster.xResidual / finalCluster.xResidualPull);
768 LogDebug(
"SiStripHitEfficiencyWorker")
769 <<
"Checking location of trajectory: abs(yloc) = " <<
abs(yloc) <<
" abs(xloc) = " <<
abs(xloc);
777 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is bad from SiStripQuality";
780 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is good from SiStripQuality";
784 for (
unsigned int ii = 0;
ii < fedErrorIds.
size();
ii++) {
785 if (iidd == fedErrorIds[
ii].rawId())
791 if (commonModeDigis.
isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
792 const auto digiframe = commonModeDigis->
find(iidd);
793 if (digiframe != commonModeDigis->
end())
798 LogDebug(
"SiStripHitEfficiencyWorker") <<
"before check good";
800 if (finalCluster.xResidualPull < 999.0) {
802 LogDebug(
"SiStripHitEfficiencyWorker")
803 <<
"hit being counted as good " << finalCluster.xResidual <<
" FinalRecHit " << iidd <<
" TKlayers " 804 << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc <<
" module " << iidd
805 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1) <<
"/" 806 << ((iidd & 0x3) == 2);
809 LogDebug(
"SiStripHitEfficiencyWorker")
810 <<
"hit being counted as bad ######### Invalid RPhi FinalResX " << finalCluster.xResidual
811 <<
" FinalRecHit " << iidd <<
" TKlayers " << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc
812 <<
" module " << iidd <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1)
813 <<
"/" << ((iidd & 0x3) == 2);
815 LogDebug(
"SiStripHitEfficiencyWorker")
816 <<
" RPhi Error " <<
sqrt(xErr * xErr + yErr * yErr) <<
" ErrorX " << xErr <<
" yErr " << yErr;
819 LogDebug(
"SiStripHitEfficiencyWorker")
820 <<
"To avoid them staying unused: ModIsBad=" << ModIsBad <<
", SiStripQualBad=" << SiStripQualBad
821 <<
", commonMode=" << commonMode <<
", highPurity=" <<
highPurity 822 <<
", withinAcceptance=" << withinAcceptance;
824 unsigned int layer = TKlayers;
826 if (
layer <= bounds::k_LayersAtTIDEnd) {
827 layer = bounds::k_LayersAtTOBEnd +
830 layer = bounds::k_LayersAtTIDEnd + tTopo->
tecRing(iidd);
833 unsigned int layerWithSide =
layer;
834 if (
layer > bounds::k_LayersAtTOBEnd &&
layer <= bounds::k_LayersAtTIDEnd) {
835 const auto side = tTopo->
tidSide(iidd);
837 layerWithSide =
layer + 3;
838 }
else if (
layer > bounds::k_LayersAtTIDEnd) {
839 const auto side = tTopo->
tecSide(iidd);
841 layerWithSide =
layer + 3;
842 }
else if (side == 2) {
847 if ((
bunchX_ > 0 &&
bunchX_ != bunchCrossing) || (!withinAcceptance) ||
849 (!
showTOB6TEC9_ && (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd)) ||
853 const bool badquality = (SiStripQualBad == 1);
858 bool badflag =
false;
863 if (ModIsBad == 1 || finalCluster.xResidualPull >
resXSig_)
871 if (finalCluster.xResidualPull ==
881 double stripTrajMid = xloc / Pitch + nstrips / 2.0;
882 double stripCluster = finalCluster.xLocal / Pitch + nstrips / 2.0;
885 if (stripdet &&
layer > bounds::k_LayersAtTOBEnd) {
887 std::array<const float, 4>
const&
parameters = trapezoidalBounds.parameters();
891 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
893 stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
897 LogDebug(
"SiStripHitEfficiencyWorker")
898 <<
"layer " <<
layer <<
" vector index " <<
layer - 1 <<
" before filling h_resolution" << std::endl;
905 if (finalCluster.xResidualPull == 1000.0) {
906 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for resxsig=1000";
912 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for cluster-to-traj distance";
922 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Too close to the edge: " << stripInAPV;
926 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for tapv!=capv";
933 LogDebug(
"SiStripHitEfficiencyWorker")
934 <<
"Filling measurement for " << iidd <<
" in layer " <<
layer <<
" histograms with bx=" << bunchCrossing
935 <<
", lumi=" <<
instLumi <<
", PU=" <<
PU <<
"; bad flag=" << badflag;
939 if (
layer > bounds::k_LayersStart &&
layer <= bounds::k_LayersAtTIBEnd) {
943 }
else if (
layer > bounds::k_LayersAtTIBEnd &&
layer <= bounds::k_LayersAtTOBEnd) {
947 }
else if (
layer > bounds::k_LayersAtTOBEnd &&
layer <= bounds::k_LayersAtTIDEnd) {
950 int side = tTopo->
tidSide(iidd);
955 }
else if (
layer > bounds::k_LayersAtTIDEnd) {
958 int side = tTopo->
tecSide(iidd);
966 LogDebug(
"SiStripHitEfficiencyWorker")
967 <<
"layer " <<
layer <<
" vector index " <<
layer - 1 <<
" before filling h_layer_vsSmthg" << std::endl;
1007 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after good location check";
1009 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after list of clusters";
1011 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.)
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
bool useOnlyHighPurityTracks_
std::vector< EffME1 > h_layer_vsBx
std::vector< MonitorElement * > h_hotcold
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters <p) const
unsigned int tidSide(const DetId &id) const
unsigned int monodet_id() const
std::vector< EffME1 > h_layer_vsCM
unsigned int tecRing(const DetId &id) const
ring id
constexpr std::array< uint8_t, layerIndexSize > layer
const_iterator end(bool update=false) const
double localErrorX() const
unsigned int tecSide(const DetId &id) const
unsigned int clusterMatchingMethod_
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
std::set< uint32_t > badModules_
iterator end()
Return the off-the-end iterator.
const Plane & surface() const
The nominal surface of the GeomDet.
double localErrorY() const
virtual const std::array< const float, 4 > parameters() const
const_iterator find(id_type i, bool update=false) const
static const uint16_t STRIPS_PER_APV
unsigned int tidRing(const DetId &id) const
void fill(uint32_t id, bool found, float weight=1.)
virtual float width() const =0
std::vector< EffME1 > h_layer_vsLumi
bool withinAcceptance() const
short getBadApvs(uint32_t detid) const
const Bounds & bounds() const