10 #include <fmt/printf.h> 13 #include <boost/tokenizer.hpp> 14 #include <boost/range/adaptor/indexed.hpp> 28 <<
"Option has already been set to " <<
m_option <<
". It's not possible to reset it.";
34 m_BaseTrackerMap = std::make_shared<TH2Poly>(
"Summary",
"", -10, 160, -70, 70);
46 LOGINFO(
"Phase1PixelSummaryMap") <<
"barrel, shift: " <<
i <<
" corner: " <<
i << std::endl;
47 LOGINFO(
"Phase1PixelSummaryMap") <<
"translate x: " << 0 << std::endl;
50 int currBarrelTranslateX = 0;
56 for (
int j : {-3, -2, -1}) {
57 LOGINFO(
"Phase1PixelSummaryMap") <<
"negative fwd, shift: " << -
j - 1 <<
" corner: " <<
maxPxForward +
j 68 for (
int k : {1, 2, 3}) {
69 LOGINFO(
"Phase1PixelSummaryMap") <<
"positive fwd, shift: " <<
k <<
" corner: " <<
maxPxForward +
k - 1
79 edm::LogPrint(
"Phase1PixelSummaryMap") <<
"Base Tracker Map: constructed" << std::endl;
92 canvas.SetTopMargin(topMargin);
93 canvas.SetBottomMargin(0.02);
94 canvas.SetLeftMargin(0.02);
95 canvas.SetRightMargin(0.14);
108 arrow = TArrow(0.05, 27.0, 0.05, -30.0, 0.02,
"|>");
109 arrow.SetLineWidth(4);
113 phiArrow = TArrow(0.0, 27.0, 30.0, 27.0, 0.02,
"|>");
118 xArrow = TArrow(25.0, 44.5, 50.0, 44.5, 0.02,
"|>");
123 yArrow = TArrow(25.0, 44.5, 25.0, 69.5, 0.02,
"|>");
134 txt.SetTextAlign(22);
138 txt.SetTextSize(0.03);
139 txt.DrawLatex(0.5, ((
index == 0) ? 0.95 : 0.93), (fmt::sprintf(
"Pixel Tracker Map: %s",
m_title)).c_str());
140 txt.SetTextSize(0.03);
142 txt.DrawLatex(0.55, 0.125,
"-DISK");
143 txt.DrawLatex(0.55, 0.875,
"+DISK");
145 txt.DrawLatex(0.08, 0.28,
"+z");
146 txt.DrawLatex(0.25, 0.70,
"+phi");
147 txt.DrawLatex((
index == 0) ? 0.31 : 0.33, 0.78,
"+x");
148 txt.DrawLatex((
index == 0) ? 0.21 : 0.22, ((
index == 0) ? 0.96 : 0.94),
"+y");
150 txt.SetTextAngle(90);
151 txt.DrawLatex(0.04, 0.5,
"BARREL");
153 edm::LogPrint(
"Phase1PixelSummaryMap") <<
"Base Tracker Map: printed" << std::endl;
161 << __func__ <<
" The following detid " <<
id <<
" is not Pixel!" << std::endl;
181 edm::FileInPath geoFile,
int tX,
int tY,
int sX,
int sY,
bool applyModuleRotation) {
182 auto cornerFileName = geoFile.
fullPath();
183 std::ifstream cornerFile(cornerFileName.c_str());
184 if (!cornerFile.good()) {
185 throw cms::Exception(
"FileError") <<
"Problem opening corner file: " << cornerFileName;
188 while (std::getline(cornerFile,
line)) {
190 std::istringstream iss(
line);
194 for (
unsigned int i = 0;
i < tokens.size();
i++)
195 LOGDEBUG(
"Phase1PixelSummaryMap") << tokens[
i] <<
'\n';
198 unsigned int detId = stoi(detInfo[0]);
201 unsigned int verNum = 1;
202 std::vector<float> xP, yP;
203 for (
const auto& coord :
xy) {
205 if (applyModuleRotation) {
206 xP.push_back(-(std::stof(coordSpl[0]) * sX + tX));
207 yP.push_back(((std::stof(coordSpl[1]) * sY + tY)));
209 xP.push_back(std::stof(coordSpl[0]) * sX + tX);
210 yP.push_back(std::stof(coordSpl[1]) * sY + tY);
219 for (
const auto&
p : xP) {
220 LOGDEBUG(
"Phase1PixelSummaryMap") <<
p <<
",";
222 LOGDEBUG(
"Phase1PixelSummaryMap") <<
"] [ ";
223 for (
const auto&
q : yP) {
224 LOGDEBUG(
"Phase1PixelSummaryMap") <<
q <<
",";
226 LOGDEBUG(
"Phase1PixelSummaryMap") <<
"]" << std::endl;
228 const unsigned int N = verNum;
229 if (applyModuleRotation) {
230 bins[
detId] = std::make_shared<TGraph>(
N, &yP[0], &xP[0]);
232 bins[
detId] = std::make_shared<TGraph>(
N, &xP[0], &yP[0]);
236 bins[
detId]->SetName(detInfo[0].c_str());
const std::string m_zAxisTitle
void resetOption(const char *option)
static const unsigned int maxPxBarrel
const std::array< int, maxPxBarrel > barrelLadderShift
std::map< uint32_t, std::shared_ptr< TGraph > > bins
const std::array< int, maxPxForward > forwardDiskXShift
void createTrackerBaseMap()
std::vector< std::string > tokenize(std::string line, char delimiter)
const std::pair< float, float > getZAxisRange() const
static const unsigned int maxPxForward
Log< level::Error, false > LogError
const std::string m_title
std::shared_ptr< TH2Poly > m_BaseTrackerMap
std::vector< edm::FileInPath > m_cornersBPIX
void setZAxisRange(const double min, const double max)
Log< level::Warning, true > LogPrint
void addNamedBins(edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation=false)
std::vector< edm::FileInPath > m_cornersFPIX
void printTrackerMap(TCanvas &canvas, const float topMargin=0.02, int index=0)
bool fillTrackerMap(unsigned int id, double value)
const int forwardDiskYShift
const std::string & fullPath() const