Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce SiPixelDynamicInefficiency payload inspector #34457

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add SiPixelDetInfoFileReader default files and use them in the SiPixe…
…l Payload Inspector
  • Loading branch information
mmusich committed Jul 13, 2021
commit fbece9506e710316eb9452388589e8534fe7fd39
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class SiPixelDetInfoFileReader {
const std::vector<uint32_t>& getAllDetIds() const;
const std::pair<int, int>& getDetUnitDimensions(uint32_t detId) const;

constexpr static char const* const kPh0DefaultFile = "CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt";
constexpr static char const* const kPh1DefaultFile =
"SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt";

private:
std::ifstream inputFile_;
// std::string filePath_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
namespace {

using namespace cond::payloadInspector;

const std::string k_Ph0_geo = "CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt";
const std::string k_Ph1_geo = "SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt";

namespace SiPixDynIneff {

// constants for ROC level simulation for Phase1
Expand Down Expand Up @@ -90,7 +86,8 @@ namespace {

//_________________________________________________
bool isPhase0(const BRFractions& fractions) {
SiPixelDetInfoFileReader reader = SiPixelDetInfoFileReader(edm::FileInPath(k_Ph0_geo).fullPath());
SiPixelDetInfoFileReader reader =
SiPixelDetInfoFileReader(edm::FileInPath(SiPixelDetInfoFileReader::kPh0DefaultFile).fullPath());
const auto& p0detIds = reader.getAllDetIds();
std::vector<uint32_t> ownDetIds;

Expand Down Expand Up @@ -300,11 +297,10 @@ namespace {
std::string headerText;

if (this->m_plotAnnotations.ntags == 2) {
headerText = fmt::sprintf(
"#Delta #color[2]{A: %s, %s} - #color[4]{B: %s, %s}", f_tagname, f_IOVstring, l_tagname, l_IOVstring);
} else {
headerText =
fmt::sprintf("%s, #Delta IOV #color[2]{A: %s} - #color[4]{B: %s} ", f_tagname, f_IOVstring, l_IOVstring);
fmt::sprintf("#color[2]{A: %s, %s} - #color[4]{B: %s, %s}", f_tagname, f_IOVstring, l_tagname, l_IOVstring);
} else {
headerText = fmt::sprintf("%s,IOV #color[2]{A: %s} - #color[4]{B: %s} ", f_tagname, f_IOVstring, l_IOVstring);
}

switch (myType) {
Expand Down Expand Up @@ -356,7 +352,7 @@ namespace {
if ((subid == PixelSubdetector::PixelBarrel && myType == SiPixelPI::t_barrel) ||
(subid == PixelSubdetector::PixelEndcap && myType == SiPixelPI::t_forward) ||
(myType == SiPixelPI::t_all)) {
theMap.fillSelectedRocs(rawid, rocToMark, badRocsF[i] * 100.f * (subtract ? -1. : 1.));
theMap.fillSelectedRocs(rawid, rocToMark, badRocsF[i] * (subtract ? -1. : 1.));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ namespace {

using namespace cond::payloadInspector;

const std::string k_Ph0_geo = "CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt";
const std::string k_Ph1_geo = "SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt";

/************************************************
test class
*************************************************/
Expand Down Expand Up @@ -228,7 +225,8 @@ namespace {

//_________________________________________________
bool isPhase0(std::vector<SiPixelQuality::disabledModuleType> mods) {
SiPixelDetInfoFileReader reader = SiPixelDetInfoFileReader(edm::FileInPath(k_Ph0_geo).fullPath());
SiPixelDetInfoFileReader reader =
SiPixelDetInfoFileReader(edm::FileInPath(SiPixelDetInfoFileReader::kPh0DefaultFile).fullPath());
const auto& p0detIds = reader.getAllDetIds();

std::vector<uint32_t> ownDetIds;
Expand Down Expand Up @@ -360,7 +358,8 @@ namespace {
//_________________________________________________
bool isPhase0(const std::shared_ptr<SiPixelQuality>& payload) {
const auto mods = payload->getBadComponentList();
SiPixelDetInfoFileReader reader = SiPixelDetInfoFileReader(edm::FileInPath(k_Ph0_geo).fullPath());
SiPixelDetInfoFileReader reader =
SiPixelDetInfoFileReader(edm::FileInPath(SiPixelDetInfoFileReader::kPh0DefaultFile).fullPath());
const auto& p0detIds = reader.getAllDetIds();

std::vector<uint32_t> ownDetIds;
Expand Down
13 changes: 13 additions & 0 deletions CondCore/SiPixelPlugins/test/testSiPixelDynamicInefficiency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,16 @@ getPayloadData.py \
--test;

mv *.png $W_DIR/plots_DynIneff/SiPixelFullIneffROCfromDynIneffMap.png

getPayloadData.py \
--plugin pluginSiPixelDynamicInefficiency_PayloadInspector \
--plot plot_SiPixelFullIneffROCsMapCompareTwoTags \
--tag SiPixelDynamicInefficiency_PhaseI_Run3Studies_v2 \
--tagtwo SiPixelDynamicInefficiency_PhaseI_v9 \
--time_type Run \
--iovs '{"start_iov": "1", "end_iov": "1"}' \
--iovstwo '{"start_iov": "1", "end_iov": "1"}' \
--db Prod \
--test;

mv *.png $W_DIR/plots_DynIneff/SiPixelFullIneffROCfromDynIneffMapDelta.png
26 changes: 23 additions & 3 deletions CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include "CondCore/SiPixelPlugins/plugins/SiPixelTemplateDBObject_PayloadInspector.cc"
#include "CondCore/SiPixelPlugins/plugins/SiPixelGenErrorDBObject_PayloadInspector.cc"
#include "CondCore/SiPixelPlugins/plugins/SiPixelVCal_PayloadInspector.cc"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "CondCore/SiPixelPlugins/plugins/SiPixelQualityProbabilities_PayloadInspector.cc"
#include "CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/PluginManager/interface/PluginManager.h"
#include "FWCore/PluginManager/interface/standard.h"
#include "FWCore/PluginManager/interface/SharedLibrary.h"
Expand Down Expand Up @@ -195,11 +196,30 @@ int main(int argc, char** argv) {
start = boost::lexical_cast<unsigned long long>(1);
end = boost::lexical_cast<unsigned long long>(1);

std::cout << "## Exercising SiPixelQualityProbabilities plots " << std::endl;
edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelQualityProbabilities plots " << std::endl;

SiPixelQualityProbabilitiesScenariosCount histo25;
histo25.process(connectionString, PI::mk_input(tag, start, end));
std::cout << histo25.data() << std::endl;
edm::LogPrint("testSiPixelPayloadInspector") << histo25.data() << std::endl;

// SiPixelDynamicInefficiency

tag = "SiPixelDynamicInefficiency_PhaseI_v9";
start = boost::lexical_cast<unsigned long long>(1);
end = boost::lexical_cast<unsigned long long>(1);

edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixeDynamicInefficiency plots " << std::endl;

SiPixelFullIneffROCfromDynIneffMap histo26;
histo26.process(connectionString, PI::mk_input(tag, start, end));
edm::LogPrint("testSiPixelPayloadInspector") << histo26.data() << std::endl;

tag2 = "SiPixelDynamicInefficiency_PhaseI_v6";
start2 = boost::lexical_cast<unsigned long long>(1);

SiPixelFullIneffROCsMapCompareTwoTags histo27;
histo27.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2));
edm::LogPrint("testSiPixelPayloadInspector") << histo27.data() << std::endl;

inputs.clear();
#if PY_MAJOR_VERSION >= 3
Expand Down