659 LogDebug(
"SiStripHitEfficiencyWorker") <<
"setting iidd = " << iidd <<
" before checking efficiency and ";
661 const auto xloc = tm.
localX();
662 const auto yloc = tm.
localY();
670 const auto TKlayers = ::checkLayer(iidd, tTopo);
672 const bool withinAcceptance =
673 tm.
withinAcceptance() && (!::isInBondingExclusionZone(iidd, TKlayers, yloc, yErr, tTopo));
677 (
layers_ == bounds::k_LayersStart))) {
678 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Looking at layer under study";
679 unsigned int ModIsBad = 2;
680 unsigned int SiStripQualBad = 0;
681 float commonMode = -100;
685 if (!theClusters.
empty()) {
686 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Checking clusters with size = " << theClusters.
size();
687 std::vector<::ClusterInfo> VCluster_info;
688 const auto idsv = theClusters.
find(iidd);
689 if (idsv != theClusters.
end()) {
691 LogDebug(
"SiStripHitEfficiencyWorker")
692 <<
"found (ClusterId == iidd) with ClusterId = " << idsv->id() <<
" and iidd = " << iidd;
701 if (TKlayers > bounds::k_LayersAtTOBEnd) {
702 const BoundPlane& plane = stripdet->surface();
704 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
705 std::array<const float, 4>
const& parameterTrap = (*trapezoidalBounds).
parameters();
706 hbedge = parameterTrap[0];
707 htedge = parameterTrap[1];
708 hapoth = parameterTrap[3];
709 uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
710 uxlden = 1 + yloc * uylfac;
714 if (TrajStrip == -1) {
716 float pitch = stripdet->surface().bounds().width() / nstrips;
717 TrajStrip = xloc / pitch + nstrips / 2.0;
719 if (TKlayers > bounds::k_LayersAtTOBEnd) {
720 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
722 TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
727 for (
const auto& clus : *idsv) {
730 float sigma = ::checkConsistency(
parameters, xloc, xErr);
737 if (TKlayers > bounds::k_LayersAtTOBEnd) {
740 yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
743 VCluster_info.emplace_back(
res, sigma,
parameters.first.x());
745 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Have ID match. residual = " <<
res <<
" res sigma = " << sigma;
748 LogDebug(
"SiStripHitEfficiencyWorker")
750 <<
" trajectory position = " << xloc <<
" traj error = " << xErr;
753 ::ClusterInfo finalCluster{1000.0, 1000.0, 0.0};
754 if (!VCluster_info.empty()) {
755 LogDebug(
"SiStripHitEfficiencyWorker") <<
"found clusters > 0";
756 if (VCluster_info.size() > 1) {
758 for (
const auto&
res : VCluster_info) {
762 LogDebug(
"SiStripHitEfficiencyWorker")
763 <<
"iresidual = " <<
res.xResidual <<
" isigma = " <<
res.xResidualPull
764 <<
" and FinalRes = " << finalCluster.xResidual;
767 finalCluster = VCluster_info[0];
769 VCluster_info.clear();
772 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Final residual in X = " << finalCluster.xResidual <<
"+-" 773 << (finalCluster.xResidual / finalCluster.xResidualPull);
774 LogDebug(
"SiStripHitEfficiencyWorker")
775 <<
"Checking location of trajectory: abs(yloc) = " <<
abs(yloc) <<
" abs(xloc) = " <<
abs(xloc);
783 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is bad from SiStripQuality";
786 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is good from SiStripQuality";
790 for (
unsigned int ii = 0;
ii < fedErrorIds.
size();
ii++) {
791 if (iidd == fedErrorIds[
ii].rawId())
797 if (commonModeDigis.
isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
798 const auto digiframe = commonModeDigis->
find(iidd);
799 if (digiframe != commonModeDigis->
end())
804 LogDebug(
"SiStripHitEfficiencyWorker") <<
"before check good";
806 if (finalCluster.xResidualPull < 999.0) {
808 LogDebug(
"SiStripHitEfficiencyWorker")
809 <<
"hit being counted as good " << finalCluster.xResidual <<
" FinalRecHit " << iidd <<
" TKlayers " 810 << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc <<
" module " << iidd
811 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1) <<
"/" 812 << ((iidd & 0x3) == 2);
815 LogDebug(
"SiStripHitEfficiencyWorker")
816 <<
"hit being counted as bad ######### Invalid RPhi FinalResX " << finalCluster.xResidual
817 <<
" FinalRecHit " << iidd <<
" TKlayers " << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc
818 <<
" module " << iidd <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1)
819 <<
"/" << ((iidd & 0x3) == 2);
821 LogDebug(
"SiStripHitEfficiencyWorker")
822 <<
" RPhi Error " <<
sqrt(xErr * xErr + yErr * yErr) <<
" ErrorX " << xErr <<
" yErr " << yErr;
825 LogDebug(
"SiStripHitEfficiencyWorker")
826 <<
"To avoid them staying unused: ModIsBad=" << ModIsBad <<
", SiStripQualBad=" << SiStripQualBad
827 <<
", commonMode=" << commonMode <<
", highPurity=" <<
highPurity 828 <<
", withinAcceptance=" << withinAcceptance;
830 unsigned int layer = TKlayers;
832 if (
layer <= bounds::k_LayersAtTIDEnd) {
833 layer = bounds::k_LayersAtTOBEnd +
836 layer = bounds::k_LayersAtTIDEnd + tTopo->
tecRing(iidd);
839 unsigned int layerWithSide =
layer;
840 if (
layer > bounds::k_LayersAtTOBEnd &&
layer <= bounds::k_LayersAtTIDEnd) {
841 const auto side = tTopo->
tidSide(iidd);
843 layerWithSide =
layer + 3;
844 }
else if (
layer > bounds::k_LayersAtTIDEnd) {
845 const auto side = tTopo->
tecSide(iidd);
847 layerWithSide =
layer + 3;
848 }
else if (side == 2) {
853 if ((
bunchX_ > 0 &&
bunchX_ != bunchCrossing) || (!withinAcceptance) ||
855 (!
showTOB6TEC9_ && (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd)) ||
859 const bool badquality = (SiStripQualBad == 1);
864 bool badflag =
false;
869 if (ModIsBad == 1 || finalCluster.xResidualPull >
resXSig_)
877 if (finalCluster.xResidualPull ==
887 double stripTrajMid = xloc / Pitch + nstrips / 2.0;
888 double stripCluster = finalCluster.xLocal / Pitch + nstrips / 2.0;
891 if (stripdet &&
layer > bounds::k_LayersAtTOBEnd) {
893 std::array<const float, 4>
const&
parameters = trapezoidalBounds.parameters();
897 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
899 stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
903 LogDebug(
"SiStripHitEfficiencyWorker")
904 <<
"layer " <<
layer <<
" vector index " <<
layer - 1 <<
" before filling h_resolution" << std::endl;
911 if (finalCluster.xResidualPull == 1000.0) {
912 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for resxsig=1000";
918 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for cluster-to-traj distance";
928 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Too close to the edge: " << stripInAPV;
932 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for tapv!=capv";
939 LogDebug(
"SiStripHitEfficiencyWorker")
940 <<
"Filling measurement for " << iidd <<
" in layer " <<
layer <<
" histograms with bx=" << bunchCrossing
941 <<
", lumi=" <<
instLumi <<
", PU=" <<
PU <<
"; bad flag=" << badflag;
945 if (
layer > bounds::k_LayersStart &&
layer <= bounds::k_LayersAtTIBEnd) {
949 }
else if (
layer > bounds::k_LayersAtTIBEnd &&
layer <= bounds::k_LayersAtTOBEnd) {
953 }
else if (
layer > bounds::k_LayersAtTOBEnd &&
layer <= bounds::k_LayersAtTIDEnd) {
956 int side = tTopo->
tidSide(iidd);
961 }
else if (
layer > bounds::k_LayersAtTIDEnd) {
964 int side = tTopo->
tecSide(iidd);
972 LogDebug(
"SiStripHitEfficiencyWorker")
973 <<
"layer " <<
layer <<
" vector index " <<
layer - 1 <<
" before filling h_layer_vsSmthg" << std::endl;
1013 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after good location check";
1015 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after list of clusters";
1017 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
const_iterator end(bool update=false) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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