CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
GeometryInterface Class Reference

#include <GeometryInterface.h>

Classes

struct  InterestingQuantities
 

Public Types

typedef ID Column
 
typedef int ID
 
typedef double Value
 
typedef std::vector< std::pair< Column, Value > > Values
 

Public Member Functions

std::vector< InterestingQuantities > const & allModules ()
 
Value binWidth (ID id)
 
std::pair< Column, Valueextract (Column const &col, InterestingQuantities const &iq)
 
Value extract (ID id, DetId did, edm::Event *ev=nullptr, int16_t col=0, int16_t row=0)
 
void extractColumns (std::vector< Column > const &names, InterestingQuantities const &iq, Values &out)
 
std::string formatValue (Column, Value)
 
 GeometryInterface (const edm::ParameterSet &, edm::ConsumesCollector &&, edm::Transition transition=edm::Transition::BeginRun)
 
ID intern (std::string const &id)
 
void load (edm::EventSetup const &iSetup)
 
bool loaded ()
 
Value maxValue (ID id)
 
Value minValue (ID id)
 
std::string pretty (Column col)
 
std::string unintern (ID id)
 

Static Public Attributes

static const Value UNDEFINED = 999999999.9f
 

Private Member Functions

void addExtractor (ID id, std::function< Value(InterestingQuantities const &iq)> func, Value min=UNDEFINED, Value max=UNDEFINED, Value binwidth=1)
 
void loadFEDCabling (const SiPixelFedCablingMap *)
 
void loadFromSiPixelCoordinates (const TrackerGeometry &, const TrackerTopology &, const SiPixelFedCablingMap &, const edm::ParameterSet &)
 
void loadFromTopology (const TrackerGeometry &, const TrackerTopology &, const edm::ParameterSet &)
 
void loadModuleLevel (const edm::ParameterSet &iConfig)
 
void loadTimebased (const edm::ParameterSet &iConfig)
 

Private Attributes

std::vector< InterestingQuantitiesall_modules
 
std::map< ID, Valuebin_width
 
std::string cablingMapLabel_
 
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
 
std::map< std::pair< Column, Value >, std::string > format_value
 
const edm::ParameterSet iConfig
 
std::map< std::string, IDids {std::make_pair(std::string("INVALID"), ID(0))}
 
bool is_loaded = false
 
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcdlabeledSiPixelFedCablingMapToken_
 
ID max_id = 0
 
std::map< ID, Valuemax_value
 
std::map< ID, Valuemin_value
 
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcdsiPixelFedCablingMapToken_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopologyToken_
 

Detailed Description

Definition at line 34 of file GeometryInterface.h.

Member Typedef Documentation

◆ Column

Definition at line 40 of file GeometryInterface.h.

◆ ID

typedef int GeometryInterface::ID

Definition at line 37 of file GeometryInterface.h.

◆ Value

typedef double GeometryInterface::Value

Definition at line 41 of file GeometryInterface.h.

◆ Values

typedef std::vector<std::pair<Column, Value> > GeometryInterface::Values

Definition at line 46 of file GeometryInterface.h.

Constructor & Destructor Documentation

◆ GeometryInterface()

GeometryInterface::GeometryInterface ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  iC,
edm::Transition  transition = edm::Transition::BeginRun 
)

Definition at line 39 of file GeometryInterface.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

Member Function Documentation

◆ addExtractor()

void GeometryInterface::addExtractor ( ID  id,
std::function< Value(InterestingQuantities const &iq)>  func,
Value  min = UNDEFINED,
Value  max = UNDEFINED,
Value  binwidth = 1 
)
inlineprivate

◆ allModules()

std::vector<InterestingQuantities> const& GeometryInterface::allModules ( )
inline

◆ binWidth()

Value GeometryInterface::binWidth ( ID  id)
inline

Definition at line 103 of file GeometryInterface.h.

103 { return bin_width[id]; };

References bin_width, and triggerObjects_cff::id.

Referenced by HistogramManager::book().

◆ extract() [1/2]

std::pair<Column, Value> GeometryInterface::extract ( Column const &  col,
InterestingQuantities const &  iq 
)
inline

Definition at line 76 of file GeometryInterface.h.

76  {
77  assert(col != 0 || !"Extracting invalid column.");
78  ID id = col;
79  assert(ID(extractors.size()) > id || !"extractors vector too small!");
80  auto& ex = extractors[id];
81  if (!ex) { // we have never heard about this. This is a typo for sure.
82  edm::LogError("GeometryInterface") << "Undefined column used: " << unintern(id) << ". Check your spelling.\n";
83  } else {
84  auto val = ex(iq);
85  if (val != UNDEFINED) {
86  return std::make_pair(Column{id}, val);
87  }
88  }
89  return std::make_pair(col, UNDEFINED);
90  }

References cms::cuda::assert(), cuy::col, extractors, triggerObjects_cff::id, UNDEFINED, unintern(), and heppy_batch::val.

Referenced by SiPixelPhase1GeometryDebug::analyze(), HistogramManager::book(), extractColumns(), and HistogramManager::fillInternal().

◆ extract() [2/2]

Value GeometryInterface::extract ( ID  id,
DetId  did,
edm::Event ev = nullptr,
int16_t  col = 0,
int16_t  row = 0 
)
inline

Definition at line 92 of file GeometryInterface.h.

92  {
93  InterestingQuantities iq = {ev, did, col, row};
94  return extractors[id](iq);
95  }

References cuy::col, ev, extractors, and triggerObjects_cff::id.

◆ extractColumns()

void GeometryInterface::extractColumns ( std::vector< Column > const &  names,
InterestingQuantities const &  iq,
Values out 
)
inline

◆ formatValue()

std::string GeometryInterface::formatValue ( Column  col,
Value  val 
)

Definition at line 490 of file GeometryInterface.cc.

490  {
491  auto it = format_value.find(std::make_pair(col, val));
492  if (it != format_value.end())
493  return it->second;
494 
495  // non-number output names (_pO etc.) are hardwired here.
497  std::string value = "_" + std::to_string(int(val));
498  if (val == 0)
499  value = ""; // hide Barrel_0 etc.
500  if (name == "PXDisk" && val > 0) // +/- sign for disk num
501  value = "_+" + std::to_string(int(val));
502  // pretty (legacy?) names for Shells and HalfCylinders
503  std::map<int, std::string> shellname{{11, "_mI"}, {12, "_mO"}, {21, "_pI"}, {22, "_pO"}};
504  if (name == "HalfCylinder" || name == "Shell")
505  value = shellname[int(val)];
506  if (val == UNDEFINED)
507  value = "_UNDEFINED";
508  return format_value[std::make_pair(col, val)] = name + value;
509 }

References cuy::col, format_value, createfilelist::int, Skims_PA_cff::name, pretty(), AlCaHLTBitMon_QueryRunRegistry::string, UNDEFINED, heppy_batch::val, and relativeConstraints::value.

Referenced by HistogramManager::makePathName().

◆ intern()

ID GeometryInterface::intern ( std::string const &  id)
inline

Definition at line 106 of file GeometryInterface.h.

106  {
107  auto it = ids.find(id);
108  if (it == ids.end()) {
109  ids[id] = ++max_id;
110  extractors.resize(max_id + 1);
111  }
112  return ids[id];
113  };

References extractors, triggerObjects_cff::id, ids, and max_id.

Referenced by SiPixelPhase1GeometryDebug::analyze(), loadFEDCabling(), loadFromSiPixelCoordinates(), loadFromTopology(), loadModuleLevel(), loadTimebased(), and SummationSpecification::parse_columns().

◆ load()

void GeometryInterface::load ( edm::EventSetup const &  iSetup)

Definition at line 67 of file GeometryInterface.cc.

67  {
68  const TrackerGeometry& trackerGeometry = iSetup.getData(trackerGeometryToken_);
69  const TrackerTopology& trackerTopology = iSetup.getData(trackerTopologyToken_);
70  const SiPixelFedCablingMap& siPixelFedCablingMap = iSetup.getData(siPixelFedCablingMapToken_);
71 
72  const SiPixelFedCablingMap* labeledSiPixelFedCablingMap = &siPixelFedCablingMap;
73  if (!cablingMapLabel_.empty()) {
74  labeledSiPixelFedCablingMap = &iSetup.getData(labeledSiPixelFedCablingMapToken_);
75  }
76 
77  //loadFromAlignment(iSetup, iConfig);
78  loadFromTopology(trackerGeometry, trackerTopology, iConfig);
81  loadFEDCabling(labeledSiPixelFedCablingMap);
82  loadFromSiPixelCoordinates(trackerGeometry, trackerTopology, siPixelFedCablingMap, iConfig);
83  edm::LogInfo log("GeometryInterface");
84  log << "Known colum names:\n";
85  for (auto e : ids)
86  log << "+++ column: " << e.first << " ok " << bool(extractors[e.second]) << " min " << min_value[e.second]
87  << " max " << max_value[e.second] << "\n";
88  is_loaded = true;
89 }

References electrons_cff::bool, cablingMapLabel_, MillePedeFileConverter_cfg::e, extractors, edm::EventSetup::getData(), iConfig, ids, is_loaded, labeledSiPixelFedCablingMapToken_, loadFEDCabling(), loadFromSiPixelCoordinates(), loadFromTopology(), loadModuleLevel(), loadTimebased(), dqm-mbProfile::log, max_value, min_value, siPixelFedCablingMapToken_, trackerGeometryToken_, and trackerTopologyToken_.

Referenced by HistogramManager::book(), and HistogramManager::executePerLumiHarvesting().

◆ loaded()

bool GeometryInterface::loaded ( )
inline

Definition at line 52 of file GeometryInterface.h.

52 { return is_loaded; };

References is_loaded.

Referenced by HistogramManager::book(), and HistogramManager::executePerLumiHarvesting().

◆ loadFEDCabling()

void GeometryInterface::loadFEDCabling ( const SiPixelFedCablingMap labeledSiPixelFedCablingMap)
private

Definition at line 458 of file GeometryInterface.cc.

458  {
459  std::shared_ptr<SiPixelFrameReverter> siPixelFrameReverter =
460  // I think passing the bare pointer here is safe, but who knows...
461  std::make_shared<SiPixelFrameReverter>(labeledSiPixelFedCablingMap);
462 
463  addExtractor(intern("FED"), [siPixelFrameReverter](InterestingQuantities const& iq) {
464  if (iq.sourceModule == 0xFFFFFFFF)
465  return Value(iq.col); // hijacked for the raw data plugin
466  return Value(siPixelFrameReverter->findFedId(iq.sourceModule.rawId()));
467  });
468 
469  // TODO: ranges should be set manually below, since booking probably cannot
470  // infer them correctly (no ROC-level granularity)
471  // PERF: this is slow. Prefer SiPixelCordinates versions here.
472  addExtractor(intern("LinkInFed"), [siPixelFrameReverter](InterestingQuantities const& iq) {
473  if (iq.sourceModule == 0xFFFFFFFF)
474  return Value(iq.row); // hijacked for the raw data plugin
475  sipixelobjects::GlobalPixel gp = {iq.row, iq.col};
476  return Value(siPixelFrameReverter->findLinkInFed(iq.sourceModule.rawId(), gp));
477  });
478  // not sure if this is useful anywhere.
479  addExtractor(intern("RocInLink"), [siPixelFrameReverter](InterestingQuantities const& iq) {
480  sipixelobjects::GlobalPixel gp = {iq.row, iq.col};
481  return Value(siPixelFrameReverter->findRocInLink(iq.sourceModule.rawId(), gp));
482  });
483  // This might be equivalent to our ROC numbering.
484  addExtractor(intern("RocInDet"), [siPixelFrameReverter](InterestingQuantities const& iq) {
485  sipixelobjects::GlobalPixel gp = {iq.row, iq.col};
486  return Value(siPixelFrameReverter->findRocInDet(iq.sourceModule.rawId(), gp));
487  });
488 }

References addExtractor(), GeometryInterface::InterestingQuantities::col, runTauDisplay::gp, intern(), DetId::rawId(), GeometryInterface::InterestingQuantities::row, and GeometryInterface::InterestingQuantities::sourceModule.

Referenced by load().

◆ loadFromSiPixelCoordinates()

void GeometryInterface::loadFromSiPixelCoordinates ( const TrackerGeometry trackerGeometry,
const TrackerTopology trackerTopology,
const SiPixelFedCablingMap siPixelFedCablingMap,
const edm::ParameterSet iConfig 
)
private

Definition at line 202 of file GeometryInterface.cc.

205  {
206  // TODO: SiPixelCoordinates has a large overlap with theis GeometryInterface
207  // in general.
208  // Rough convention is to use own code for things that are easy and fast to
209  // determine, and use SiPixelCoordinates for complicated things.
210  // SiPixelCoordinates uses lookup maps for everything, so it is faster than
211  // most other code, but still slow on DQM scales.
212  int phase = iConfig.getParameter<int>("upgradePhase");
213 
214  // this shared pointer is kept alive by the references in the lambdas that follow.
215  // That is a bit less obvious than keeping it as a member but more correct.
216  auto coord = std::make_shared<SiPixelCoordinates>(phase);
217 
218  // note that we should reeinit for each event. But this probably won't explode
219  // thanks to the massive memoization in SiPixelCoordinates which is completely
220  // initialized while booking.
221  coord->init(&trackerTopology, &trackerGeometry, &siPixelFedCablingMap);
222 
223  // SiPixelCoordinates uses a different convention for UNDEFINED:
224  auto from_coord = [](double in) { return (in == -9999.0) ? UNDEFINED : Value(in); };
225 
226  // Rings are a concept that cannot be derived from bitmasks.
227  addExtractor(intern("PXRing"), [coord, from_coord](InterestingQuantities const& iq) {
228  return from_coord(coord->ring(iq.sourceModule));
229  });
230 
231  // Quadrant names.
232  auto pxbarrel = extractors[intern("PXBarrel")];
233  addExtractor(
234  intern("HalfCylinder"),
235  [coord, pxbarrel](InterestingQuantities const& iq) {
236  if (pxbarrel(iq) != UNDEFINED)
237  return UNDEFINED;
238  int quadrant = coord->quadrant(iq.sourceModule);
239  switch (quadrant) {
240  case 1:
241  return Value(12); // mO
242  case 2:
243  return Value(11); // mI
244  case 3:
245  return Value(22); // pO
246  case 4:
247  return Value(21); // pI
248  default:
249  return UNDEFINED;
250  }
251  },
252  0,
253  0 // N/A
254  );
255  addExtractor(
256  intern("Shell"),
257  [coord, pxbarrel](InterestingQuantities const& iq) {
258  if (pxbarrel(iq) == UNDEFINED)
259  return UNDEFINED;
260  int quadrant = coord->quadrant(iq.sourceModule);
261  switch (quadrant) {
262  case 1:
263  return Value(12); // mO
264  case 2:
265  return Value(11); // mI
266  case 3:
267  return Value(22); // pO
268  case 4:
269  return Value(21); // pI
270  default:
271  return UNDEFINED;
272  }
273  },
274  0,
275  0 // N/A
276  );
277 
278  // Online Numbering.
279  addExtractor(intern("SignedLadder"), [coord, from_coord](InterestingQuantities const& iq) {
280  return from_coord(coord->signed_ladder(iq.sourceModule()));
281  });
282  addExtractor(intern("SignedModule"), [coord, from_coord](InterestingQuantities const& iq) {
283  return from_coord(coord->signed_module(iq.sourceModule()));
284  });
285  addExtractor(intern("SignedBlade"), [coord, from_coord](InterestingQuantities const& iq) {
286  return from_coord(coord->signed_blade(iq.sourceModule()));
287  });
288 
289  // Flipped and Outer ladders
290  addExtractor(intern("OuterLadder"), [coord, from_coord](InterestingQuantities const& iq) {
291  return from_coord(coord->outer(iq.sourceModule()));
292  });
293  addExtractor(intern("FlippedLadder"), [coord, from_coord](InterestingQuantities const& iq) {
294  return from_coord(coord->flipped(iq.sourceModule()));
295  });
296 
297  // Pixel Map axis.
298  // TODO: automatic range and binning for phase0 are incorrect.
299  // Should be set manually here.
300  addExtractor(
301  intern("SignedModuleCoord"), // BPIX x
302  [coord, from_coord](InterestingQuantities const& iq) {
303  return from_coord(coord->signed_module_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
304  },
305  UNDEFINED,
306  UNDEFINED,
307  1.0 / 8.0);
308  addExtractor(
309  intern("SignedLadderCoord"), // BPIX y
310  [coord, from_coord](InterestingQuantities const& iq) {
311  return from_coord(coord->signed_ladder_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
312  },
313  UNDEFINED,
314  UNDEFINED,
315  1.0 / 2.0);
316  addExtractor(
317  intern("SignedDiskCoord"), // FPIX x (per-ring)
318  [coord, from_coord](InterestingQuantities const& iq) {
319  return from_coord(coord->signed_disk_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
320  },
321  UNDEFINED,
322  UNDEFINED,
323  1.0 / 8.0);
324  addExtractor(
325  intern("SignedDiskRingCoord"), // FPIX x (FPIX-as-one-plot)
326  [coord, from_coord](InterestingQuantities const& iq) {
327  return from_coord(coord->signed_disk_ring_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
328  },
329  UNDEFINED,
330  UNDEFINED,
331  1.0 / 16.0);
332  addExtractor(
333  intern("SignedBladePanelCoord"), // FPIX y
334  [coord, from_coord, phase](InterestingQuantities const& iq) {
335  if (phase == 0) {
336  return from_coord(coord->signed_blade_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
337  } else if (phase == 1) {
338  return from_coord(
339  coord->signed_blade_panel_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
340  } else {
341  return UNDEFINED; // TODO: phase2
342  }
343  },
344  UNDEFINED,
345  UNDEFINED,
346  phase == 1 ? 0.25 : 0.2);
347  addExtractor(
348  intern("SignedShiftedBladePanelCoord"), // FPIX-as-one y
349  [coord, from_coord, phase](InterestingQuantities const& iq) {
350  if (phase == 0) {
351  return from_coord(coord->signed_blade_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
352  } else if (phase == 1) {
353  return from_coord(
354  coord->signed_shifted_blade_panel_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
355  } else {
356  return UNDEFINED; // TODO: phase2
357  }
358  },
359  UNDEFINED,
360  UNDEFINED,
361  phase == 1 ? 0.25 : 0.1 // half-roc for phase0
362  );
363  addExtractor(
364  intern("SignedBladePanel"), // per-module FPIX y
365  [coord, from_coord](InterestingQuantities const& iq) {
366  return from_coord(coord->signed_blade_panel_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
367  },
368  UNDEFINED,
369  UNDEFINED,
370  1.0 / 2.0);
371 
372  addExtractor(
373  intern("SignedBladePanel"),
374  [coord, from_coord](InterestingQuantities const& iq) {
375  return from_coord(coord->signed_blade_panel_coord(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
376  },
377  UNDEFINED,
378  UNDEFINED,
379  1.0 / 2.0);
380 
381  // more readout-related things.
382  addExtractor(intern("ROC"), [coord, from_coord](InterestingQuantities const& iq) {
383  return from_coord(coord->roc(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
384  });
385  addExtractor(intern("Sector"), [coord, from_coord](InterestingQuantities const& iq) {
386  return from_coord(coord->sector(iq.sourceModule()));
387  });
388  addExtractor(intern("Channel"), [coord, from_coord](InterestingQuantities const& iq) {
389  return from_coord(coord->channel(iq.sourceModule(), std::make_pair(int(iq.row), int(iq.col))));
390  });
391 }

References addExtractor(), GeometryInterface::InterestingQuantities::col, extractors, edm::ParameterSet::getParameter(), iConfig, recoMuon::in, intern(), HLT_2018_cff::phase, SiPixelPI::quadrant(), GeometryInterface::InterestingQuantities::row, GeometryInterface::InterestingQuantities::sourceModule, and UNDEFINED.

Referenced by load().

◆ loadFromTopology()

void GeometryInterface::loadFromTopology ( const TrackerGeometry trackerGeometry,
const TrackerTopology trackerTopology,
const edm::ParameterSet iConfig 
)
private

Definition at line 91 of file GeometryInterface.cc.

93  {
94  std::vector<ID> geomquantities;
95 
96  struct TTField {
97  const TrackerTopology* tt;
99  Value operator()(InterestingQuantities const& iq) {
100  if (tt->hasField(iq.sourceModule, field))
101  return tt->getField(iq.sourceModule, field);
102  else
103  return UNDEFINED;
104  };
105  };
106 
107  const TrackerTopology* tt = &trackerTopology;
108 
109  std::vector<std::pair<std::string, TTField>> namedPartitions{
110  {"PXEndcap", {tt, TrackerTopology::PFSide}},
111 
112  {"PXLayer", {tt, TrackerTopology::PBLayer}},
113  {"PXLadder", {tt, TrackerTopology::PBLadder}},
114  {"PXBModule", {tt, TrackerTopology::PBModule}},
115 
116  {"PXBlade", {tt, TrackerTopology::PFBlade}},
117  {"PXDisk", {tt, TrackerTopology::PFDisk}},
118  {"PXPanel", {tt, TrackerTopology::PFPanel}},
119  {"PXFModule", {tt, TrackerTopology::PFModule}},
120  };
121 
122  for (auto& e : namedPartitions) {
123  geomquantities.push_back(intern(e.first));
124  addExtractor(intern(e.first), e.second, UNDEFINED, UNDEFINED);
125  }
126 
127  auto pxbarrel = [](InterestingQuantities const& iq) {
128  return iq.sourceModule.subdetId() == PixelSubdetector::PixelBarrel ? 0 : UNDEFINED;
129  };
130  auto pxforward = [](InterestingQuantities const& iq) {
131  return iq.sourceModule.subdetId() == PixelSubdetector::PixelEndcap ? 0 : UNDEFINED;
132  };
133  auto pxall = [](InterestingQuantities const& iq) { return 0; };
134  addExtractor(intern("PXBarrel"), pxbarrel, 0, 0);
135  addExtractor(intern("PXForward"), pxforward, 0, 0);
136  addExtractor(intern("PXAll"), pxall, 0, 0);
137 
138  // Redefine the disk numbering to use the sign
139  auto pxendcap = extractors[intern("PXEndcap")];
140  auto diskid = intern("PXDisk");
141  auto pxdisk = extractors[diskid];
142  extractors[diskid] = [pxdisk, pxendcap](InterestingQuantities const& iq) {
143  auto disk = pxdisk(iq);
144  if (disk == UNDEFINED)
145  return UNDEFINED;
146  auto endcap = pxendcap(iq);
147  return endcap == 1 ? -disk : disk;
148  };
149 
150  // DetId and module names
151  auto detid = [](InterestingQuantities const& iq) {
152  uint32_t id = iq.sourceModule.rawId();
153  return Value(id);
154  };
155  addExtractor(intern("DetId"), detid, 0, 0 // No sane value possible here.
156  );
157  // these are just aliases with special handling in formatting
158  // the names are created with PixelBarrelName et. al. later
159  addExtractor(intern("PXModuleName"), detid, 0, 0);
160 
161  int phase = iConfig.getParameter<int>("upgradePhase");
162  bool isUpgrade = phase == 1;
163 
164  // Now traverse the detector and collect whatever we need.
165  auto detids = trackerGeometry.detIds();
166  for (DetId id : detids) {
167  if (id.subdetId() != PixelSubdetector::PixelBarrel && id.subdetId() != PixelSubdetector::PixelEndcap)
168  continue;
169  auto iq = InterestingQuantities{nullptr, id, 0, 0};
170 
171  // prepare pretty names
172  std::string name = "";
173  if (id.subdetId() == PixelSubdetector::PixelBarrel) { // Barrel
175  name = mod.name();
176  } else { // assume Endcap
178  name = mod.name();
179  }
180  format_value[std::make_pair(intern("PXModuleName"), Value(id.rawId()))] = name;
181 
182  // we record each module 4 times, one for each corner, so we also get ROCs
183  // in booking (at least for the ranges)
184  const PixelGeomDetUnit* detUnit = dynamic_cast<const PixelGeomDetUnit*>(trackerGeometry.idToDetUnit(id));
185  assert(detUnit);
186  const PixelTopology* topo = &detUnit->specificTopology();
187  iq.row = 0;
188  iq.col = 0;
189  all_modules.push_back(iq);
190  iq.row = topo->nrows() - 1;
191  iq.col = 0;
192  all_modules.push_back(iq);
193  iq.row = 0;
194  iq.col = topo->ncolumns() - 1;
195  all_modules.push_back(iq);
196  iq.row = topo->nrows() - 1;
197  iq.col = topo->ncolumns() - 1;
198  all_modules.push_back(iq);
199  }
200 }

References addExtractor(), all_modules, cms::cuda::assert(), TrackerGeometry::detIds(), MillePedeFileConverter_cfg::e, makeMuonMisalignmentScenario::endcap, extractors, format_value, edm::ParameterSet::getParameter(), iConfig, triggerObjects_cff::id, TrackerGeometry::idToDetUnit(), intern(), SiPixelOfflineDQM_client_cff::isUpgrade, mod(), Skims_PA_cff::name, PixelTopology::ncolumns(), PixelTopology::nrows(), TrackerTopology::PBLadder, TrackerTopology::PBLayer, TrackerTopology::PBModule, TrackerTopology::PFBlade, TrackerTopology::PFDisk, TrackerTopology::PFModule, TrackerTopology::PFPanel, TrackerTopology::PFSide, HLT_2018_cff::phase, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GeometryInterface::InterestingQuantities::sourceModule, PixelGeomDetUnit::specificTopology(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::tt, and UNDEFINED.

Referenced by load().

◆ loadModuleLevel()

void GeometryInterface::loadModuleLevel ( const edm::ParameterSet iConfig)
private

Definition at line 444 of file GeometryInterface.cc.

444  {
445  // stuff that is within modules. Might require some phase0/phase1/strip switching later
446  addExtractor(
447  intern("row"),
448  [](InterestingQuantities const& iq) { return Value(iq.row); },
449  0,
450  iConfig.getParameter<int>("module_rows") - 1);
451  addExtractor(
452  intern("col"),
453  [](InterestingQuantities const& iq) { return Value(iq.col); },
454  0,
455  iConfig.getParameter<int>("module_cols") - 1);
456 }

References addExtractor(), GeometryInterface::InterestingQuantities::col, edm::ParameterSet::getParameter(), iConfig, intern(), and GeometryInterface::InterestingQuantities::row.

Referenced by load().

◆ loadTimebased()

void GeometryInterface::loadTimebased ( const edm::ParameterSet iConfig)
private

Definition at line 393 of file GeometryInterface.cc.

393  {
394  // extractors for quantities that are roughly time-based. We cannot book plots based on these; they have to
395  // be grouped away in step1.
396  addExtractor(
397  intern("Lumisection"),
398  [](InterestingQuantities const& iq) {
399  if (!iq.sourceEvent)
400  return UNDEFINED;
401  return Value(iq.sourceEvent->luminosityBlock());
402  },
403  1,
404  iConfig.getParameter<int>("max_lumisection"));
405 
406  int onlineblock = iConfig.getParameter<int>("onlineblock");
407  int n_onlineblocks = iConfig.getParameter<int>("n_onlineblocks");
408  addExtractor(
409  intern("OnlineBlock"),
410  [onlineblock](InterestingQuantities const& iq) {
411  if (!iq.sourceEvent)
412  return UNDEFINED;
413  return Value(onlineblock + iq.sourceEvent->luminosityBlock() / onlineblock);
414  },
415  // note: this range is not visible anywhere (if the RenderPlugin does its job),
416  // but the strange range allows the RenderPlugin to know the block size.
417  onlineblock,
419 
420  int lumiblock = iConfig.getParameter<int>("lumiblock");
421  addExtractor(
422  intern("LumiBlock"),
423  [lumiblock](InterestingQuantities const& iq) {
424  if (!iq.sourceEvent)
425  return UNDEFINED;
426  // The '-1' is for making 1-10 the same block rather than 0-9
427  // The '+0.5' makes the block span an integer range rather n.5-m.5
428  return Value(((iq.sourceEvent->luminosityBlock() - 1) / lumiblock) + 0.5);
429  },
430  -0.5,
431  iConfig.getParameter<int>("max_lumisection") / lumiblock);
432 
433  addExtractor(
434  intern("BX"),
435  [](InterestingQuantities const& iq) {
436  if (!iq.sourceEvent)
437  return UNDEFINED;
438  return Value(iq.sourceEvent->bunchCrossing());
439  },
440  1,
441  iConfig.getParameter<int>("max_bunchcrossing"));
442 }

References addExtractor(), edm::EventBase::bunchCrossing(), edm::ParameterSet::getParameter(), iConfig, intern(), HistogramManager_cfi::lumiblock, edm::EventBase::luminosityBlock(), HistogramManager_cfi::n_onlineblocks, HistogramManager_cfi::onlineblock, GeometryInterface::InterestingQuantities::sourceEvent, and UNDEFINED.

Referenced by load().

◆ maxValue()

Value GeometryInterface::maxValue ( ID  id)
inline

Definition at line 101 of file GeometryInterface.h.

101 { return max_value[id]; };

References triggerObjects_cff::id, and max_value.

Referenced by HistogramManager::book().

◆ minValue()

Value GeometryInterface::minValue ( ID  id)
inline

Definition at line 102 of file GeometryInterface.h.

102 { return min_value[id]; };

References triggerObjects_cff::id, and min_value.

Referenced by HistogramManager::book().

◆ pretty()

std::string GeometryInterface::pretty ( Column  col)
inline

◆ unintern()

std::string GeometryInterface::unintern ( ID  id)
inline

Definition at line 118 of file GeometryInterface.h.

118  {
119  for (auto& e : ids)
120  if (e.second == id)
121  return e.first;
122  return "INVALID";
123  }

References MillePedeFileConverter_cfg::e, and ids.

Referenced by extract(), and pretty().

Member Data Documentation

◆ all_modules

std::vector<InterestingQuantities> GeometryInterface::all_modules
private

Definition at line 180 of file GeometryInterface.h.

Referenced by allModules(), and loadFromTopology().

◆ bin_width

std::map<ID, Value> GeometryInterface::bin_width
private

Definition at line 163 of file GeometryInterface.h.

Referenced by addExtractor(), and binWidth().

◆ cablingMapLabel_

std::string GeometryInterface::cablingMapLabel_
private

Definition at line 152 of file GeometryInterface.h.

Referenced by load().

◆ extractors

std::vector<std::function<Value(InterestingQuantities const& iq)> > GeometryInterface::extractors
private

◆ format_value

std::map<std::pair<Column, Value>, std::string> GeometryInterface::format_value
private

Definition at line 167 of file GeometryInterface.h.

Referenced by formatValue(), and loadFromTopology().

◆ iConfig

const edm::ParameterSet GeometryInterface::iConfig
private

◆ ids

std::map<std::string, ID> GeometryInterface::ids {std::make_pair(std::string("INVALID"), ID(0))}
private

Definition at line 183 of file GeometryInterface.h.

Referenced by intern(), load(), and unintern().

◆ is_loaded

bool GeometryInterface::is_loaded = false
private

Definition at line 154 of file GeometryInterface.h.

Referenced by load(), and loaded().

◆ labeledSiPixelFedCablingMapToken_

edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> GeometryInterface::labeledSiPixelFedCablingMapToken_
private

Definition at line 151 of file GeometryInterface.h.

Referenced by load().

◆ max_id

ID GeometryInterface::max_id = 0
private

Definition at line 184 of file GeometryInterface.h.

Referenced by intern().

◆ max_value

std::map<ID, Value> GeometryInterface::max_value
private

Definition at line 161 of file GeometryInterface.h.

Referenced by addExtractor(), load(), and maxValue().

◆ min_value

std::map<ID, Value> GeometryInterface::min_value
private

Definition at line 162 of file GeometryInterface.h.

Referenced by addExtractor(), load(), and minValue().

◆ siPixelFedCablingMapToken_

edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> GeometryInterface::siPixelFedCablingMapToken_
private

Definition at line 150 of file GeometryInterface.h.

Referenced by load().

◆ trackerGeometryToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> GeometryInterface::trackerGeometryToken_
private

Definition at line 141 of file GeometryInterface.h.

Referenced by load().

◆ trackerTopologyToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> GeometryInterface::trackerTopologyToken_
private

Definition at line 142 of file GeometryInterface.h.

Referenced by load().

◆ UNDEFINED

const GeometryInterface::Value GeometryInterface::UNDEFINED = 999999999.9f
static
electrons_cff.bool
bool
Definition: electrons_cff.py:372
GeometryInterface::max_value
std::map< ID, Value > max_value
Definition: GeometryInterface.h:161
edm::ESInputTag
Definition: ESInputTag.h:87
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
TrackerTopology::PBModule
Definition: TrackerTopology.h:102
GeometryInterface::cablingMapLabel_
std::string cablingMapLabel_
Definition: GeometryInterface.h:152
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
min
T min(T a, T b)
Definition: MathUtil.h:58
TrackerTopology::PFPanel
Definition: TrackerTopology.h:106
GeometryInterface::ids
std::map< std::string, ID > ids
Definition: GeometryInterface.h:183
TrackerTopology
Definition: TrackerTopology.h:16
TrackerTopology::PBLadder
Definition: TrackerTopology.h:103
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
cuy.col
col
Definition: cuy.py:1010
edm::LogInfo
Definition: MessageLogger.h:254
PixelBarrelName
Definition: PixelBarrelName.h:16
GeometryInterface::format_value
std::map< std::pair< Column, Value >, std::string > format_value
Definition: GeometryInterface.h:167
cms::cuda::assert
assert(be >=bs)
GeometryInterface::loadFromTopology
void loadFromTopology(const TrackerGeometry &, const TrackerTopology &, const edm::ParameterSet &)
Definition: GeometryInterface.cc:91
TrackerTopology::DetIdFields
DetIdFields
Definition: TrackerTopology.h:101
GeometryInterface::pretty
std::string pretty(Column col)
Definition: GeometryInterface.h:125
HLT_2018_cff.phase
phase
Definition: HLT_2018_cff.py:5346
Column
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:86
GeometryInterface::Value
double Value
Definition: GeometryInterface.h:41
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
DetId
Definition: DetId.h:17
GeometryInterface::addExtractor
void addExtractor(ID id, std::function< Value(InterestingQuantities const &iq)> func, Value min=UNDEFINED, Value max=UNDEFINED, Value binwidth=1)
Definition: GeometryInterface.h:169
PixelEndcapName
Definition: PixelEndcapName.h:16
SiPixelPI::quadrant
int quadrant(const DetId &detid, const TrackerTopology *tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:54
sipixelobjects::GlobalPixel
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
GeometryInterface::bin_width
std::map< ID, Value > bin_width
Definition: GeometryInterface.h:163
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:122
GeometryInterface::labeledSiPixelFedCablingMapToken_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > labeledSiPixelFedCablingMapToken_
Definition: GeometryInterface.h:151
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
PixelTopology::ncolumns
virtual int ncolumns() const =0
GeometryInterface::trackerTopologyToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
Definition: GeometryInterface.h:142
GeometryInterface::loadModuleLevel
void loadModuleLevel(const edm::ParameterSet &iConfig)
Definition: GeometryInterface.cc:444
GeometryInterface::ID
int ID
Definition: GeometryInterface.h:37
PixelTopology
Definition: PixelTopology.h:10
GeometryInterface::unintern
std::string unintern(ID id)
Definition: GeometryInterface.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerTopology::PFSide
Definition: TrackerTopology.h:109
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
GeometryInterface::max_id
ID max_id
Definition: GeometryInterface.h:184
edm::LogError
Definition: MessageLogger.h:183
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
TrackerTopology::PBLayer
Definition: TrackerTopology.h:104
recoMuon::in
Definition: RecoMuonEnumerators.h:6
GeometryInterface::is_loaded
bool is_loaded
Definition: GeometryInterface.h:154
GeometryInterface::UNDEFINED
static const Value UNDEFINED
Definition: GeometryInterface.h:42
createfilelist.int
int
Definition: createfilelist.py:10
TrackerTopology::PFModule
Definition: TrackerTopology.h:105
value
Definition: value.py:1
GeometryInterface::loadFromSiPixelCoordinates
void loadFromSiPixelCoordinates(const TrackerGeometry &, const TrackerTopology &, const SiPixelFedCablingMap &, const edm::ParameterSet &)
Definition: GeometryInterface.cc:202
GeometryInterface::iConfig
const edm::ParameterSet iConfig
Definition: GeometryInterface.h:139
GeometryInterface::all_modules
std::vector< InterestingQuantities > all_modules
Definition: GeometryInterface.h:180
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
GeometryInterface::trackerGeometryToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
Definition: GeometryInterface.h:141
SiPixelFedCablingMap
Definition: SiPixelFedCablingMap.h:19
GeometryInterface::loadTimebased
void loadTimebased(const edm::ParameterSet &iConfig)
Definition: GeometryInterface.cc:393
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::Transition::EndLuminosityBlock
heppy_batch.val
val
Definition: heppy_batch.py:351
GeometryInterface::loadFEDCabling
void loadFEDCabling(const SiPixelFedCablingMap *)
Definition: GeometryInterface.cc:458
GeometryInterface::intern
ID intern(std::string const &id)
Definition: GeometryInterface.h:106
GeometryInterface::extract
std::pair< Column, Value > extract(Column const &col, InterestingQuantities const &iq)
Definition: GeometryInterface.h:76
HistogramManager_cfi.n_onlineblocks
n_onlineblocks
Definition: HistogramManager_cfi.py:28
GeometryInterface::extractors
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
Definition: GeometryInterface.h:158
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
edm::Transition::BeginRun
relativeConstraints.value
value
Definition: relativeConstraints.py:53
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TrackerGeometry::detIds
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: TrackerGeometry.h:64
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
TrackerTopology::PFDisk
Definition: TrackerTopology.h:108
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiPixelFedCablingMapRcd
Definition: SiPixelFedCablingMapRcd.h:5
SiPixelOfflineDQM_client_cff.isUpgrade
isUpgrade
Definition: SiPixelOfflineDQM_client_cff.py:19
PixelTopology::nrows
virtual int nrows() const =0
HistogramManager_cfi.lumiblock
lumiblock
Definition: HistogramManager_cfi.py:31
GeometryInterface::min_value
std::map< ID, Value > min_value
Definition: GeometryInterface.h:162
GeometryInterface::siPixelFedCablingMapToken_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > siPixelFedCablingMapToken_
Definition: GeometryInterface.h:150
HistogramManager_cfi.onlineblock
onlineblock
Definition: HistogramManager_cfi.py:27
TrackerTopology::PFBlade
Definition: TrackerTopology.h:107
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerGeometry
Definition: TrackerGeometry.h:14