Skip to content

Commit

Permalink
Merge pull request #40989 from mmusich/13_1_X_fixInnerOuterLaddersInP…
Browse files Browse the repository at this point in the history
…hase1

Fix Phase-1 Barrel Pixel Inner / Outer ladders numbering in several monitoring tools
  • Loading branch information
rappoccio authored Mar 16, 2023
2 parents 730b959 + 2473559 commit 45cadb9
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Alignment/OfflineValidation/plugins/PixelBaryCentreAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,19 +400,19 @@ void PixelBaryCentreAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
if (phase_ == 1) {
if (layer != 4) { // layer 1-3

if (ladder % 2 != 0) { // odd ladder = inner = flipped
nmodulesLayer_Flipped += nmodules_bpix[layer][ladder];
BPIXLayer_Flipped += barycentreLayer[ladder];
} else {
if (ladder % 2 != 0) { // odd ladder = outer ladder = unflipped
nmodulesLayer_NonFlipped += nmodules_bpix[layer][ladder];
BPIXLayer_NonFlipped += barycentreLayer[ladder];
} else { // even ladder = inner ladder = flipped
nmodulesLayer_Flipped += nmodules_bpix[layer][ladder];
BPIXLayer_Flipped += barycentreLayer[ladder];
}
} else { // layer-4

if (ladder % 2 == 0) { // even ladder = inner = flipped
if (ladder % 2 != 0) { // odd ladder = inner = flipped
nmodulesLayer_Flipped += nmodules_bpix[layer][ladder];
BPIXLayer_Flipped += barycentreLayer[ladder];
} else { // odd ladder = outer = non-flipped
} else { //even ladder = outer ladder = unflipped
nmodulesLayer_NonFlipped += nmodules_bpix[layer][ladder];
BPIXLayer_NonFlipped += barycentreLayer[ladder];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ namespace AlignmentPI {
inline bool isBPixOuterLadder(const DetId& detid, const TrackerTopology& tTopo, bool isPhase0)
/*--------------------------------------------------------------------*/
{
// Using TrackerTopology
// Ladders have a staggered structure
// Non-flipped ladders are on the outer radius
// Phase 0: Outer ladders are odd for layer 1,3 and even for layer 2
// Phase 1: Outer ladders are odd for layer 1,2,3 and even for layer 4
bool isOuter = false;
int layer = tTopo.pxbLayer(detid.rawId());
bool odd_ladder = tTopo.pxbLadder(detid.rawId()) % 2;
Expand All @@ -340,9 +345,9 @@ namespace AlignmentPI {
isOuter = odd_ladder;
} else {
if (layer == 4)
isOuter = odd_ladder;
else
isOuter = !odd_ladder;
else
isOuter = odd_ladder;
}
return isOuter;
}
Expand Down
23 changes: 17 additions & 6 deletions CondCore/SiPixelPlugins/interface/SiPixelPayloadInspectorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ namespace SiPixelPI {
inline bool isBPixOuterLadder(const DetId& detid, const TrackerTopology& tTopo, bool isPhase0)
/*--------------------------------------------------------------------*/
{
// Using TrackerTopology
// Ladders have a staggered structure
// Non-flipped ladders are on the outer radius
// Phase 0: Outer ladders are odd for layer 1,3 and even for layer 2
// Phase 1: Outer ladders are odd for layer 1,2,3 and even for layer 4
bool isOuter = false;
int layer = tTopo.pxbLayer(detid.rawId());
bool odd_ladder = tTopo.pxbLadder(detid.rawId()) % 2;
Expand All @@ -646,9 +651,9 @@ namespace SiPixelPI {
isOuter = odd_ladder;
} else {
if (layer == 4)
isOuter = odd_ladder;
else
isOuter = !odd_ladder;
else
isOuter = odd_ladder;
}
return isOuter;
}
Expand All @@ -671,16 +676,22 @@ namespace SiPixelPI {
void fillGeometryInfo(const DetId& detId, const TrackerTopology& tTopo, const SiPixelPI::phase& ph);
SiPixelPI::regions filterThePartition();
bool sanityCheck();
void printAll();
int subDetId() { return m_subdetid; }
int layer() { return m_layer; }
int side() { return m_side; }
int ring() { return m_ring; }
bool isInternal() { return m_isInternal; }

void printAll(std::stringstream& ss) const;
virtual ~topolInfo() {}
};

/*--------------------------------------------------------------------*/
inline void topolInfo::printAll()
inline void topolInfo::printAll(std::stringstream& ss) const
/*--------------------------------------------------------------------*/
{
std::cout << " detId:" << m_rawid << " subdetid: " << m_subdetid << " layer: " << m_layer << " side: " << m_side
<< " ring: " << m_ring << " isInternal:" << m_isInternal << std::endl;
ss << " detId: " << m_rawid << " subdetid: " << m_subdetid << " layer: " << m_layer << " side: " << m_side
<< " ring: " << m_ring << " isInternal: " << m_isInternal;
}

/*--------------------------------------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,26 @@ namespace {
const auto& regName = this->attachLocationLabel(modules, PhInfo);
namesOfParts.push_back(regName);

edm::LogVerbatim(label_) << "region name: " << regName << " has the following modules attached: ";
/*
* The following is needed for internal
* debug / cross-check
*/

std::stringstream ss;
ss << "region name: " << regName << " has the following modules attached: [";
for (const auto& module : modules) {
edm::LogVerbatim(label_) << module << ", ";
ss << module << ", ";
}
ss.seekp(-2, std::ios_base::end); // remove last two chars
ss << "] "
<< " has representation (";
for (const auto& param : listOfParametrizations[index]) {
ss << param << ", ";
}
edm::LogVerbatim(label_) << "\n\n";
ss.seekp(-2, std::ios_base::end); // remove last two chars
ss << ") ";
edm::LogPrint(label_) << ss.str() << "\n\n";
ss.str(std::string()); /* clear the stringstream */
}

// functional for polynomial of n-th degree
Expand Down
44 changes: 44 additions & 0 deletions CondCore/SiPixelPlugins/plugins/SiPixelQuality_PayloadInspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,49 @@ namespace {
} // fill
};

/************************************************
Debugging class, to not be displayed
*************************************************/

class SiPixelQualityDebugger : public Histogram1D<SiPixelQuality, SINGLE_IOV> {
public:
SiPixelQualityDebugger()
: Histogram1D<SiPixelQuality, SINGLE_IOV>("SiPixelQuality test", "SiPixelQuality test", 10, 0.0, 10.0) {}

bool fill() override {
auto tag = PlotBase::getTag<0>();
for (auto const& iov : tag.iovs) {
std::shared_ptr<SiPixelQuality> payload = Base::fetchPayload(std::get<1>(iov));
if (payload.get()) {
fillWithValue(1.);

SiPixelPI::topolInfo t_info_fromXML;
t_info_fromXML.init();

auto theDisabledModules = payload->getBadComponentList();
for (const auto& mod : theDisabledModules) {
DetId detid(mod.DetID);
auto PhInfo = SiPixelPI::PhaseInfo(SiPixelPI::phase1size);
const char* path_toTopologyXML = PhInfo.pathToTopoXML();
auto tTopo =
StandaloneTrackerTopology::fromTrackerParametersXMLFile(edm::FileInPath(path_toTopologyXML).fullPath());
t_info_fromXML.fillGeometryInfo(detid, tTopo, PhInfo.phase());
std::stringstream ss;
t_info_fromXML.printAll(ss);
std::bitset<16> bad_rocs(mod.BadRocs);

if (t_info_fromXML.subDetId() == 1 && t_info_fromXML.layer() == 1) {
std::cout << ss.str() << " s_module: " << SiPixelPI::signed_module(mod.DetID, tTopo, true)
<< " s_ladder: " << SiPixelPI::signed_ladder(mod.DetID, tTopo, true)
<< " error type:" << mod.errorType << " BadRocs: " << bad_rocs.to_string('O', 'X') << std::endl;
}
}
} // payload
} // iovs
return true;
} // fill
};

/************************************************
summary class
*************************************************/
Expand Down Expand Up @@ -412,6 +455,7 @@ PAYLOAD_INSPECTOR_MODULE(SiPixelQuality) {
PAYLOAD_INSPECTOR_CLASS(SiPixelQualityTest);
PAYLOAD_INSPECTOR_CLASS(SiPixelQualityBadRocsSummary);
PAYLOAD_INSPECTOR_CLASS(SiPixelQualityBadRocsTimeHistory);
//PAYLOAD_INSPECTOR_CLASS(SiPixelQualityDebugger);
PAYLOAD_INSPECTOR_CLASS(SiPixelBPixQualityMap);
PAYLOAD_INSPECTOR_CLASS(SiPixelFPixQualityMap);
PAYLOAD_INSPECTOR_CLASS(SiPixelFullQualityMap);
Expand Down

0 comments on commit 45cadb9

Please sign in to comment.