CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
Phase1PixelSummaryMap Class Reference

#include <Phase1PixelSummaryMap.h>

Public Member Functions

void createTrackerBaseMap ()
 
bool fillTrackerMap (unsigned int id, double value)
 
 Phase1PixelSummaryMap (const char *option, std::string title, std::string zAxisTitle)
 
void printTrackerMap (TCanvas &canvas)
 
void resetOption (const char *option)
 
 ~Phase1PixelSummaryMap ()=default
 

Protected Member Functions

void addNamedBins (edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation=false)
 

Private Attributes

TArrow arrow
 
const std::array< int, maxPxBarrelbarrelLadderShift = {{0, 14, 44, 90}}
 
std::map< uint32_t, std::shared_ptr< TGraph > > bins
 
const std::array< int, maxPxForwardforwardDiskXShift = {{25, 75, 125}}
 
const int forwardDiskYShift = 45
 
std::shared_ptr< TH2Poly > m_BaseTrackerMap
 
std::vector< edm::FileInPathm_cornersBPIX
 
std::vector< edm::FileInPathm_cornersFPIX
 
Option_t * m_option
 
const std::string m_title
 
TrackerTopology m_trackerTopo
 
const std::string m_zAxisTitle
 
TArrow phiArrow
 
const int plotHeight = 2000
 
const int plotWidth = 3000
 
TArrow xArrow
 
TArrow yArrow
 

Static Private Attributes

static const unsigned int maxPxBarrel = 4
 
static const unsigned int maxPxForward = 3
 

Detailed Description

Definition at line 56 of file Phase1PixelSummaryMap.h.

Constructor & Destructor Documentation

◆ Phase1PixelSummaryMap()

Phase1PixelSummaryMap::Phase1PixelSummaryMap ( const char *  option,
std::string  title,
std::string  zAxisTitle 
)
inline

Definition at line 58 of file Phase1PixelSummaryMap.h.

59  : m_option{option},
60  m_title{title},
61  m_zAxisTitle{zAxisTitle},
63  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
64  // store the file in path for the corners (BPIX)
65  for (unsigned int i = 1; i <= 4; i++) {
66  m_cornersBPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_%i", i)));
67  }
68 
69  // store the file in path for the corners (BPIX)
70  for (int j : {-3, -2, -1, 1, 2, 3}) {
71  m_cornersFPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_%i", j)));
72  }
73  }

References fileinputsource_cfi::option.

◆ ~Phase1PixelSummaryMap()

Phase1PixelSummaryMap::~Phase1PixelSummaryMap ( )
default

Member Function Documentation

◆ addNamedBins()

void Phase1PixelSummaryMap::addNamedBins ( edm::FileInPath  geoFile,
int  tX,
int  tY,
int  sX,
int  sY,
bool  applyModuleRotation = false 
)
protected

Definition at line 156 of file Phase1PixelSummaryMap.cc.

157  {
158  auto cornerFileName = geoFile.fullPath();
159  std::ifstream cornerFile(cornerFileName.c_str());
160  if (!cornerFile.good()) {
161  throw cms::Exception("FileError") << "Problem opening corner file: " << cornerFileName;
162  }
164  while (std::getline(cornerFile, line)) {
165  if (!line.empty()) {
166  std::istringstream iss(line);
167 
168  auto tokens = Ph1PMapSummaryHelper::tokenize(line, '"');
169  // Printing the token vector
170  for (unsigned int i = 0; i < tokens.size(); i++)
171  LOGDEBUG("Phase1PixelSummaryMap") << tokens[i] << '\n';
172 
173  auto detInfo = Ph1PMapSummaryHelper::tokenize(tokens[0], ' ');
174  unsigned int detId = stoi(detInfo[0]);
175  std::string detIdName = detInfo[1];
176  auto xy = Ph1PMapSummaryHelper::tokenize(tokens[1], ' ');
177  unsigned int verNum = 1;
178  std::vector<float> xP, yP;
179  for (const auto& coord : xy) {
180  auto coordSpl = Ph1PMapSummaryHelper::tokenize(coord, ',');
181  if (applyModuleRotation) {
182  xP.push_back(-(std::stof(coordSpl[0]) * sX + tX));
183  yP.push_back(((std::stof(coordSpl[1]) * sY + tY)));
184  } else {
185  xP.push_back(std::stof(coordSpl[0]) * sX + tX);
186  yP.push_back(std::stof(coordSpl[1]) * sY + tY);
187  }
188  verNum++;
189  }
190  //close the polygon
191  xP.push_back(xP[0]);
192  yP.push_back(yP[0]);
193 
194  LOGDEBUG("Phase1PixelSummaryMap") << detId << "[";
195  for (const auto& p : xP) {
196  LOGDEBUG("Phase1PixelSummaryMap") << p << ",";
197  }
198  LOGDEBUG("Phase1PixelSummaryMap") << "] [ ";
199  for (const auto& q : yP) {
200  LOGDEBUG("Phase1PixelSummaryMap") << q << ",";
201  }
202  LOGDEBUG("Phase1PixelSummaryMap") << "]" << std::endl;
203 
204  const unsigned int N = verNum;
205  if (applyModuleRotation) {
206  bins[detId] = std::make_shared<TGraph>(N, &yP[0], &xP[0]);
207  } else {
208  bins[detId] = std::make_shared<TGraph>(N, &xP[0], &yP[0]);
209  //bins[detId] = std::make_shared<TGraph>(N, &yP[0], &xP[0]); // rotation by 90 deg (so that it had the same layout as for the strips)
210  }
211 
212  bins[detId]->SetName(detInfo[0].c_str());
213  m_BaseTrackerMap->AddBin(bins[detId]->Clone());
214  }
215  }
216  return;
217 }

References bins, Exception, edm::FileInPath::fullPath(), mps_fire::i, mps_splice::line, LOGDEBUG, m_BaseTrackerMap, N, AlCaHLTBitMon_ParallelJobs::p, submitPVResolutionJobs::q, AlCaHLTBitMon_QueryRunRegistry::string, Ph1PMapSummaryHelper::tokenize(), and geometryCSVtoXML::xy.

Referenced by createTrackerBaseMap().

◆ createTrackerBaseMap()

void Phase1PixelSummaryMap::createTrackerBaseMap ( )

Definition at line 33 of file Phase1PixelSummaryMap.cc.

33  {
34  m_BaseTrackerMap = std::make_shared<TH2Poly>("Summary", "", -10, 160, -70, 70);
35  m_BaseTrackerMap->SetFloat(true);
36  m_BaseTrackerMap->GetXaxis()->SetTitle("");
37  m_BaseTrackerMap->GetYaxis()->SetTitle("");
38  m_BaseTrackerMap->GetZaxis()->SetTitle(m_zAxisTitle.c_str());
39  m_BaseTrackerMap->GetZaxis()->CenterTitle();
40  m_BaseTrackerMap->GetZaxis()->SetTitleOffset(1.2);
41  m_BaseTrackerMap->SetOption("COLZ L");
42  m_BaseTrackerMap->SetStats(false);
43 
44  //BARREL FIRST
45  for (unsigned int i = 0; i < maxPxBarrel; i++) {
46  LOGINFO("Phase1PixelSummaryMap") << "barrel, shift: " << i << " corner: " << i << std::endl;
47  LOGINFO("Phase1PixelSummaryMap") << "translate x: " << 0 << std::endl;
48  LOGINFO("Phase1PixelSummaryMap") << "translate y: " << barrelLadderShift[i] << std::endl;
49 
50  int currBarrelTranslateX = 0;
51  int currBarrelTranslateY = barrelLadderShift[i];
52  addNamedBins(m_cornersBPIX[i], currBarrelTranslateX, currBarrelTranslateY, 1, 1, true);
53  }
54 
55  //MINUS FORWARD
56  for (int j : {-3, -2, -1}) {
57  LOGINFO("Phase1PixelSummaryMap") << "negative fwd, shift: " << -j - 1 << " corner: " << maxPxForward + j
58  << std::endl;
59  LOGINFO("Phase1PixelSummaryMap") << "translate x: " << forwardDiskXShift[-j - 1] << std::endl;
60  LOGINFO("Phase1PixelSummaryMap") << "translate y: " << -forwardDiskYShift << std::endl;
61 
62  int currForwardTranslateX = forwardDiskXShift[-j - 1];
63  int currForwardTranslateY = -forwardDiskYShift;
64  addNamedBins(m_cornersFPIX[maxPxForward + j], currForwardTranslateX, currForwardTranslateY, 1, 1);
65  }
66 
67  //PLUS FORWARD
68  for (int k : {1, 2, 3}) {
69  LOGINFO("Phase1PixelSummaryMap") << "positive fwd, shift: " << k << " corner: " << maxPxForward + k - 1
70  << std::endl;
71  LOGINFO("Phase1PixelSummaryMap") << "translate x: " << forwardDiskXShift[k - 1] << std::endl;
72  LOGINFO("Phase1PixelSummaryMap") << "translate y: " << forwardDiskYShift << std::endl;
73 
74  int currForwardTranslateX = forwardDiskXShift[k - 1];
75  int currForwardTranslateY = forwardDiskYShift;
76  addNamedBins(m_cornersFPIX[maxPxForward + k - 1], currForwardTranslateX, currForwardTranslateY, 1, 1);
77  }
78 
79  edm::LogPrint("Phase1PixelSummaryMap") << "Base Tracker Map: constructed" << std::endl;
80  return;
81 }

References addNamedBins(), barrelLadderShift, forwardDiskXShift, forwardDiskYShift, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, LOGINFO, m_BaseTrackerMap, m_cornersBPIX, m_cornersFPIX, m_zAxisTitle, maxPxBarrel, and maxPxForward.

Referenced by templateHelper::SiPixelFullPixelIDMap< PayloadType, StoreType, TransientType >::fill().

◆ fillTrackerMap()

bool Phase1PixelSummaryMap::fillTrackerMap ( unsigned int  id,
double  value 
)

Definition at line 143 of file Phase1PixelSummaryMap.cc.

143  {
144  auto detid = DetId(id);
145  if (detid.subdetId() != PixelSubdetector::PixelBarrel && detid.subdetId() != PixelSubdetector::PixelEndcap) {
146  edm::LogError("Phase1PixelSummaryMap")
147  << __func__ << " The following detid " << id << " is not Pixel!" << std::endl;
148  return false;
149  } else {
150  m_BaseTrackerMap->Fill(TString::Format("%u", id), value);
151  return true;
152  }
153 }

References m_BaseTrackerMap, PixelSubdetector::PixelBarrel, and PixelSubdetector::PixelEndcap.

Referenced by templateHelper::SiPixelFullPixelIDMap< PayloadType, StoreType, TransientType >::fill().

◆ printTrackerMap()

void Phase1PixelSummaryMap::printTrackerMap ( TCanvas &  canvas)

Definition at line 84 of file Phase1PixelSummaryMap.cc.

84  {
85  //canvas = TCanvas("c1","c1",plotWidth,plotHeight);
86  canvas.cd();
87  canvas.SetTopMargin(0.02);
88  canvas.SetBottomMargin(0.02);
89  canvas.SetLeftMargin(0.02);
90  canvas.SetRightMargin(0.14);
91  m_BaseTrackerMap->Draw("AC COLZ L");
92 
93  //### z arrow
94  arrow = TArrow(0.05, 27.0, 0.05, -30.0, 0.02, "|>");
95  arrow.SetLineWidth(4);
96  arrow.Draw();
97  arrow.SetAngle(30);
98  //### phi arrow
99  phiArrow = TArrow(0.0, 27.0, 30.0, 27.0, 0.02, "|>");
100  phiArrow.SetLineWidth(4);
101  phiArrow.Draw();
102  phiArrow.SetAngle(30);
103  //### x arrow
104  xArrow = TArrow(25.0, 44.5, 50.0, 44.5, 0.02, "|>");
105  xArrow.SetLineWidth(4);
106  xArrow.Draw();
107  xArrow.SetAngle(30);
108  //### y arrow
109  yArrow = TArrow(25.0, 44.5, 25.0, 69.5, 0.02, "|>");
110  yArrow.SetLineWidth(4);
111  yArrow.Draw();
112  yArrow.SetAngle(30);
113 
114  //###################################################
115  //# add some captions
116  auto txt = TLatex();
117  txt.SetNDC();
118  txt.SetTextFont(1);
119  txt.SetTextColor(1);
120  txt.SetTextAlign(22);
121  txt.SetTextAngle(0);
122 
123  //# draw new-style title
124  txt.SetTextSize(0.05);
125  txt.DrawLatex(0.5, 0.95, (fmt::sprintf("Pixel Tracker Map: %s", m_title)).c_str());
126  txt.SetTextSize(0.03);
127 
128  txt.DrawLatex(0.55, 0.125, "-DISK");
129  txt.DrawLatex(0.55, 0.875, "+DISK");
130 
131  txt.DrawLatex(0.08, 0.28, "+z");
132  txt.DrawLatex(0.25, 0.70, "+phi");
133  txt.DrawLatex(0.31, 0.78, "+x");
134  txt.DrawLatex(0.21, 0.96, "+y");
135 
136  txt.SetTextAngle(90);
137  txt.DrawLatex(0.04, 0.5, "BARREL");
138 
139  edm::LogPrint("Phase1PixelSummaryMap") << "Base Tracker Map: printed" << std::endl;
140 }

References arrow, svgfig::canvas(), m_BaseTrackerMap, m_title, phiArrow, xArrow, and yArrow.

Referenced by templateHelper::SiPixelFullPixelIDMap< PayloadType, StoreType, TransientType >::fill().

◆ resetOption()

void Phase1PixelSummaryMap::resetOption ( const char *  option)

Definition at line 23 of file Phase1PixelSummaryMap.cc.

23  {
24  if (m_option != nullptr && !m_option[0]) {
25  m_option = option;
26  } else {
27  edm::LogError("Phase1PixelSummaryMap")
28  << "Option has already been set to " << m_option << ". It's not possible to reset it.";
29  }
30 }

References m_option, and fileinputsource_cfi::option.

Member Data Documentation

◆ arrow

TArrow Phase1PixelSummaryMap::arrow
private

Definition at line 107 of file Phase1PixelSummaryMap.h.

Referenced by printTrackerMap().

◆ barrelLadderShift

const std::array<int, maxPxBarrel> Phase1PixelSummaryMap::barrelLadderShift = {{0, 14, 44, 90}}
private

Definition at line 99 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ bins

std::map<uint32_t, std::shared_ptr<TGraph> > Phase1PixelSummaryMap::bins
private

Definition at line 92 of file Phase1PixelSummaryMap.h.

Referenced by addNamedBins().

◆ forwardDiskXShift

const std::array<int, maxPxForward> Phase1PixelSummaryMap::forwardDiskXShift = {{25, 75, 125}}
private

Definition at line 100 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ forwardDiskYShift

const int Phase1PixelSummaryMap::forwardDiskYShift = 45
private

Definition at line 102 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ m_BaseTrackerMap

std::shared_ptr<TH2Poly> Phase1PixelSummaryMap::m_BaseTrackerMap
private

◆ m_cornersBPIX

std::vector<edm::FileInPath> Phase1PixelSummaryMap::m_cornersBPIX
private

Definition at line 94 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ m_cornersFPIX

std::vector<edm::FileInPath> Phase1PixelSummaryMap::m_cornersFPIX
private

Definition at line 95 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ m_option

Option_t* Phase1PixelSummaryMap::m_option
private

Definition at line 86 of file Phase1PixelSummaryMap.h.

Referenced by resetOption().

◆ m_title

const std::string Phase1PixelSummaryMap::m_title
private

Definition at line 87 of file Phase1PixelSummaryMap.h.

Referenced by printTrackerMap().

◆ m_trackerTopo

TrackerTopology Phase1PixelSummaryMap::m_trackerTopo
private

Definition at line 90 of file Phase1PixelSummaryMap.h.

◆ m_zAxisTitle

const std::string Phase1PixelSummaryMap::m_zAxisTitle
private

Definition at line 88 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ maxPxBarrel

const unsigned int Phase1PixelSummaryMap::maxPxBarrel = 4
staticprivate

Definition at line 97 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ maxPxForward

const unsigned int Phase1PixelSummaryMap::maxPxForward = 3
staticprivate

Definition at line 98 of file Phase1PixelSummaryMap.h.

Referenced by createTrackerBaseMap().

◆ phiArrow

TArrow Phase1PixelSummaryMap::phiArrow
private

Definition at line 107 of file Phase1PixelSummaryMap.h.

Referenced by printTrackerMap().

◆ plotHeight

const int Phase1PixelSummaryMap::plotHeight = 2000
private

Definition at line 105 of file Phase1PixelSummaryMap.h.

◆ plotWidth

const int Phase1PixelSummaryMap::plotWidth = 3000
private

Definition at line 104 of file Phase1PixelSummaryMap.h.

◆ xArrow

TArrow Phase1PixelSummaryMap::xArrow
private

Definition at line 107 of file Phase1PixelSummaryMap.h.

Referenced by printTrackerMap().

◆ yArrow

TArrow Phase1PixelSummaryMap::yArrow
private

Definition at line 107 of file Phase1PixelSummaryMap.h.

Referenced by printTrackerMap().

svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
Phase1PixelSummaryMap::addNamedBins
void addNamedBins(edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation=false)
Definition: Phase1PixelSummaryMap.cc:156
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Phase1PixelSummaryMap::arrow
TArrow arrow
Definition: Phase1PixelSummaryMap.h:107
Phase1PixelSummaryMap::bins
std::map< uint32_t, std::shared_ptr< TGraph > > bins
Definition: Phase1PixelSummaryMap.h:92
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
Phase1PixelSummaryMap::xArrow
TArrow xArrow
Definition: Phase1PixelSummaryMap.h:107
Phase1PixelSummaryMap::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: Phase1PixelSummaryMap.h:90
Phase1PixelSummaryMap::maxPxBarrel
static const unsigned int maxPxBarrel
Definition: Phase1PixelSummaryMap.h:97
LOGDEBUG
#define LOGDEBUG(x)
Definition: Phase1PixelMaps.h:21
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
Phase1PixelSummaryMap::m_title
const std::string m_title
Definition: Phase1PixelSummaryMap.h:87
Phase1PixelSummaryMap::m_cornersBPIX
std::vector< edm::FileInPath > m_cornersBPIX
Definition: Phase1PixelSummaryMap.h:94
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:64
Phase1PixelSummaryMap::m_zAxisTitle
const std::string m_zAxisTitle
Definition: Phase1PixelSummaryMap.h:88
Phase1PixelSummaryMap::barrelLadderShift
const std::array< int, maxPxBarrel > barrelLadderShift
Definition: Phase1PixelSummaryMap.h:99
LOGINFO
#define LOGINFO(x)
Definition: SiPixelGenError.cc:37
N
#define N
Definition: blowfish.cc:9
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Phase1PixelSummaryMap::forwardDiskYShift
const int forwardDiskYShift
Definition: Phase1PixelSummaryMap.h:102
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
Phase1PixelSummaryMap::m_cornersFPIX
std::vector< edm::FileInPath > m_cornersFPIX
Definition: Phase1PixelSummaryMap.h:95
Phase1PixelSummaryMap::m_BaseTrackerMap
std::shared_ptr< TH2Poly > m_BaseTrackerMap
Definition: Phase1PixelSummaryMap.h:91
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Phase1PixelSummaryMap::forwardDiskXShift
const std::array< int, maxPxForward > forwardDiskXShift
Definition: Phase1PixelSummaryMap.h:100
Phase1PixelSummaryMap::m_option
Option_t * m_option
Definition: Phase1PixelSummaryMap.h:86
Phase1PixelSummaryMap::maxPxForward
static const unsigned int maxPxForward
Definition: Phase1PixelSummaryMap.h:98
value
Definition: value.py:1
Phase1PixelSummaryMap::phiArrow
TArrow phiArrow
Definition: Phase1PixelSummaryMap.h:107
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
Phase1PixelSummaryMap::yArrow
TArrow yArrow
Definition: Phase1PixelSummaryMap.h:107
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
Exception
Definition: hltDiff.cc:245
Ph1PMapSummaryHelper::tokenize
std::vector< std::string > tokenize(std::string line, char delimiter)
Definition: Phase1PixelSummaryMap.h:39
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
mps_splice.line
line
Definition: mps_splice.py:76
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161