test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
struct  Values
 

Public Types

typedef std::array< ID, 2 > Column
 
typedef int ID
 
typedef int Value
 

Public Member Functions

std::vector
< InterestingQuantities >
const & 
allModules ()
 
std::pair< Column, Valueextract (Column const &col, InterestingQuantities const &iq)
 
Value extract (ID id, DetId did, edm::Event *ev=0, int16_t col=0, int16_t row=0)
 
void extractColumns (std::vector< Column > const &names, InterestingQuantities const &iq, Values &out)
 
 GeometryInterface (const edm::ParameterSet &conf)
 
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 = 0x0FFFFFFF
 

Private Member Functions

void addExtractor (ID id, std::function< Value(InterestingQuantities const &iq)> func, Value min=UNDEFINED, Value max=UNDEFINED)
 
void loadFEDCabling (edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
 
void loadFromTopology (edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
 
void loadModuleLevel (edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
 
void loadTimebased (edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
 

Private Attributes

std::vector
< InterestingQuantities
all_modules
 
std::vector< std::function
< Value(InterestingQuantities
const &iq)> > 
extractors
 
const edm::ParameterSet iConfig
 
std::map< std::string, IDids {std::make_pair(std::string("INVALID"), ID(0))}
 
bool is_loaded = false
 
ID max_id = 0
 
std::map< ID, Valuemax_value
 
std::map< ID, Valuemin_value
 

Detailed Description

Definition at line 27 of file GeometryInterface.h.

Member Typedef Documentation

typedef std::array<ID, 2> GeometryInterface::Column

Definition at line 37 of file GeometryInterface.h.

typedef int GeometryInterface::ID

Definition at line 30 of file GeometryInterface.h.

Definition at line 38 of file GeometryInterface.h.

Constructor & Destructor Documentation

GeometryInterface::GeometryInterface ( const edm::ParameterSet conf)
inline

Definition at line 83 of file GeometryInterface.h.

83 : iConfig(conf){};
const edm::ParameterSet iConfig

Member Function Documentation

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

Definition at line 197 of file GeometryInterface.h.

References extractors, RecoJets_EventContent_cff::func, bookConverter::max, max_value, min(), and min_value.

Referenced by loadFEDCabling(), loadFromTopology(), loadModuleLevel(), and loadTimebased().

199  {
200  max_value[id] = max;
201  min_value[id] = min;
202  extractors[id] = func;
203  }
std::map< ID, Value > max_value
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
std::map< ID, Value > min_value
std::vector<InterestingQuantities> const& GeometryInterface::allModules ( )
inline

Definition at line 137 of file GeometryInterface.h.

References all_modules.

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

137  {
138  return all_modules;
139  };
std::vector< InterestingQuantities > all_modules
std::pair<Column, Value> GeometryInterface::extract ( Column const &  col,
InterestingQuantities const &  iq 
)
inline

Definition at line 110 of file GeometryInterface.h.

References assert(), extractors, UNDEFINED, unintern(), and SpecificationBuilder_cfi::val().

Referenced by BeautifulSoup.PageElement::_invert(), SiPixelPhase1Clusters::analyze(), SiPixelPhase1Digis::analyze(), HistogramManager::book(), BeautifulSoup.Tag::decompose(), extractColumns(), HistogramManager::fillInternal(), and HistogramManager::makeName().

110  {
111  assert(col[0] != 0 || !"Extracting invalid column.");
112  for (ID id : col) {
113  if (id == 0) break; // all set columns failed
114  assert(ID(extractors.size()) > id || !"extractors vector too small!");
115  auto& ex = extractors[id];
116  if (!ex) { // we have never heard about this. This is a typo for sure.
117  edm::LogError("GeometryInterface")
118  << "Undefined column used: " << unintern(id)
119  << ". Check your spelling.\n";
120  } else {
121  auto val = ex(iq);
122  if (val != UNDEFINED) {
123  return std::make_pair(Column{{id, 0}}, val); // double braces for g++
124  break;
125  }
126  }
127  }
128  return std::make_pair(col, UNDEFINED);
129  }
assert(m_qm.get())
std::string unintern(ID id)
static const Value UNDEFINED
std::array< ID, 2 > Column
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
int col
Definition: cuy.py:1008
Value GeometryInterface::extract ( ID  id,
DetId  did,
edm::Event ev = 0,
int16_t  col = 0,
int16_t  row = 0 
)
inline

Definition at line 131 of file GeometryInterface.h.

References cuy::col, ev, and extractors.

Referenced by BeautifulSoup.PageElement::_invert(), and BeautifulSoup.Tag::decompose().

132  {
133  InterestingQuantities iq = {ev, did, col, row};
134  return extractors[id](iq);
135  }
bool ev
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
int col
Definition: cuy.py:1008
void GeometryInterface::extractColumns ( std::vector< Column > const &  names,
InterestingQuantities const &  iq,
Values out 
)
inline

Definition at line 101 of file GeometryInterface.h.

References GeometryInterface::Values::clear(), cuy::col, extract(), GeometryInterface::Values::put(), and SpecificationBuilder_cfi::val().

Referenced by HistogramManager::book(), HistogramManager::executeExtend(), HistogramManager::executeGroupBy(), HistogramManager::executePerEventHarvesting(), HistogramManager::fill(), and HistogramManager::loadFromDQMStore().

102  {
103  out.clear();
104  for (Column const& col : names) {
105  auto val = extract(col, iq);
106  out.put(val.first, val.second);
107  }
108  };
static const HistoName names[]
std::array< ID, 2 > Column
std::pair< Column, Value > extract(Column const &col, InterestingQuantities const &iq)
int col
Definition: cuy.py:1008
ID GeometryInterface::intern ( std::string const &  id)
inline

Definition at line 146 of file GeometryInterface.h.

References extractors, ids, and max_id.

Referenced by SiPixelPhase1Clusters::analyze(), SiPixelPhase1Digis::analyze(), loadFEDCabling(), loadFromTopology(), loadModuleLevel(), loadTimebased(), and SummationSpecification::parse_columns().

146  {
147  auto it = ids.find(id);
148  if (it == ids.end()) {
149  ids[id] = ++max_id;
150  extractors.resize(max_id + 1);
151  }
152  return ids[id];
153  };
std::map< std::string, ID > ids
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
void GeometryInterface::load ( edm::EventSetup const &  iSetup)

Definition at line 34 of file GeometryInterface.cc.

References alignCSCRings::e, extractors, iConfig, ids, is_loaded, loadFEDCabling(), loadFromTopology(), loadModuleLevel(), loadTimebased(), dqm-mbProfile::log, max_value, and min_value.

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

34  {
35  //loadFromAlignment(iSetup, iConfig);
36  loadFromTopology(iSetup, iConfig);
37  loadTimebased(iSetup, iConfig);
38  loadModuleLevel(iSetup, iConfig);
39  loadFEDCabling(iSetup, iConfig);
40  edm::LogInfo log("GeometryInterface");
41  log << "Known colum names:\n";
42  for (auto e : ids) log << "+++ column: " << e.first
43  << " ok " << bool(extractors[e.second]) << " min " << min_value[e.second] << " max " << max_value[e.second] << "\n";
44  is_loaded = true;
45 }
std::map< ID, Value > max_value
std::map< std::string, ID > ids
void loadFromTopology(edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
const edm::ParameterSet iConfig
void loadFEDCabling(edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
void loadModuleLevel(edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
std::map< ID, Value > min_value
void loadTimebased(edm::EventSetup const &iSetup, const edm::ParameterSet &iConfig)
bool GeometryInterface::loaded ( )
inline

Definition at line 85 of file GeometryInterface.h.

References is_loaded.

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

85 { return is_loaded; };
void GeometryInterface::loadFEDCabling ( edm::EventSetup const &  iSetup,
const edm::ParameterSet iConfig 
)
private

Definition at line 315 of file GeometryInterface.cc.

References addExtractor(), all_modules, GeometryInterface::InterestingQuantities::col, edm::EventSetup::get(), edm::ParameterSet::getParameter(), intern(), AlCaHLTBitMon_ParallelJobs::p, mergeAndRegister::paths, GeometryInterface::InterestingQuantities::row, GeometryInterface::InterestingQuantities::sourceModule, AlCaHLTBitMon_QueryRunRegistry::string, and UNDEFINED.

Referenced by load().

315  {
316  auto cablingMapLabel = iConfig.getParameter<std::string>("CablingMapLabel");
318  iSetup.get<SiPixelFedCablingMapRcd>().get(cablingMapLabel, theCablingMap);
319  std::map<DetId, Value> fedmap;
320  uint32_t minFED = UNDEFINED, maxFED = 0;
321 
322  if (theCablingMap.isValid()) {
323  auto map = theCablingMap.product();
324 
325  for(auto iq : all_modules) {
326  std::vector<sipixelobjects::CablingPathToDetUnit> paths = map->pathToDetUnit(iq.sourceModule.rawId());
327  for (auto p : paths) {
328  //std::cout << "+++ cabling " << iq.sourceModule.rawId() << " " << p.fed << " " << p.link << " " << p.roc << "\n";
329  fedmap[iq.sourceModule] = Value(p.fed);
330  if (p.fed > maxFED) maxFED = p.fed;
331  if (p.fed < minFED) minFED = p.fed;
332  }
333  }
334  } else {
335  edm::LogError("GeometryInterface") << "+++ No cabling map. Cannot extract FEDs.\n";
336  }
337 
338  addExtractor(intern("FED"),
339  [fedmap] (InterestingQuantities const& iq) {
340  if (iq.sourceModule == 0xFFFFFFFF)
341  return Value(iq.col); // hijacked for the raw data plugin
342  auto it = fedmap.find(iq.sourceModule);
343  if (it == fedmap.end()) return GeometryInterface::UNDEFINED;
344  return it->second;
345  }
346  );
347  addExtractor(intern("FEDChannel"),
348  [] (InterestingQuantities const& iq) {
349  // TODO: we also should be able to compute the channel from the ROC.
350  // But for raw data, we only need this hack.
351  //if (iq.sourceModule == 0xFFFFFFFF)
352  return Value(iq.row); // hijacked for the raw data plugin
353  },
354  0, 39 // TODO: real range
355  );
356 }
T getParameter(std::string const &) const
void addExtractor(ID id, std::function< Value(InterestingQuantities const &iq)> func, Value min=UNDEFINED, Value max=UNDEFINED)
std::vector< InterestingQuantities > all_modules
static const Value UNDEFINED
ID intern(std::string const &id)
void GeometryInterface::loadFromTopology ( edm::EventSetup const &  iSetup,
const edm::ParameterSet iConfig 
)
private

Definition at line 47 of file GeometryInterface.cc.

References addExtractor(), all_modules, assert(), alignCSCRings::e, Reference_intrackfit_cff::endcap, extractors, cropTnPTrees::frac, edm::EventSetup::get(), edm::ParameterSet::getParameter(), intern(), edm::ESHandleBase::isValid(), mod(), python.rootplot.argparse::module, TrackerTopology::PBLadder, TrackerTopology::PBLayer, TrackerTopology::PBModule, TrackerTopology::PFBlade, TrackerTopology::PFDisk, TrackerTopology::PFModule, TrackerTopology::PFPanel, TrackerTopology::PFSide, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GeometryInterface::InterestingQuantities::sourceModule, groupFilesInBlocks::tt, and UNDEFINED.

Referenced by load().

47  {
48  // Get a Topology
49  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
50  iSetup.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
51  assert(trackerTopologyHandle.isValid());
52 
53  std::vector<ID> geomquantities;
54 
55  struct TTField {
56  const TrackerTopology* tt;
58  Value operator()(InterestingQuantities const& iq) {
59  if (tt->hasField(iq.sourceModule, field))
60  return tt->getField(iq.sourceModule, field);
61  else
62  return UNDEFINED;
63  };
64  };
65 
66  const TrackerTopology* tt = trackerTopologyHandle.operator->();
67 
68 
69  std::vector<std::pair<std::string, TTField>> namedPartitions {
70  {"PXEndcap" , {tt, TrackerTopology::PFSide}},
71 
72  {"PXLayer" , {tt, TrackerTopology::PBLayer}},
73  {"PXLadder" , {tt, TrackerTopology::PBLadder}},
74  {"PXBModule", {tt, TrackerTopology::PBModule}},
75 
76  {"PXBlade" , {tt, TrackerTopology::PFBlade}},
77  {"PXDisk" , {tt, TrackerTopology::PFDisk}},
78  {"PXPanel" , {tt, TrackerTopology::PFPanel}},
79  {"PXFModule", {tt, TrackerTopology::PFModule}},
80  };
81 
82  for (auto& e : namedPartitions) {
83  geomquantities.push_back(intern(e.first));
84  addExtractor(intern(e.first), e.second, UNDEFINED, UNDEFINED);
85  }
86 
87  auto pxbarrel = [] (InterestingQuantities const& iq) { return iq.sourceModule.subdetId() == PixelSubdetector::PixelBarrel ? 0 : UNDEFINED; };
88  auto pxforward = [] (InterestingQuantities const& iq) { return iq.sourceModule.subdetId() == PixelSubdetector::PixelEndcap ? 0 : UNDEFINED; };
89  addExtractor(intern("PXBarrel"), pxbarrel, 0, 0);
90  addExtractor(intern("PXForward"), pxforward, 0, 0);
91 
92  // Redefine the disk numbering to use the sign
93  auto pxendcap = extractors[intern("PXEndcap")];
94  auto diskid = intern("PXDisk");
95  auto pxdisk = extractors[diskid];
96  extractors[diskid] = [pxdisk, pxendcap] (InterestingQuantities const& iq) {
97  auto disk = pxdisk(iq);
98  if (disk == UNDEFINED) return UNDEFINED;
99  auto endcap = pxendcap(iq);
100  return endcap == 1 ? -disk : disk;
101  };
102 
103  // Get a Geometry
104  edm::ESHandle<TrackerGeometry> trackerGeometryHandle;
105  iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeometryHandle);
106  assert(trackerGeometryHandle.isValid());
107 
108  // some parameters to record the ROCs here
109  auto module_rows = iConfig.getParameter<int>("module_rows") - 1;
110  auto module_cols = iConfig.getParameter<int>("module_cols") - 1;
111 
112  // We need to track some extra stuff here for the Shells later.
113  auto pxlayer = extractors[intern("PXLayer")];
114  auto pxladder = extractors[intern("PXLadder")];
115  auto pxmodule = extractors[intern("PXBModule")];
116  auto pxblade = extractors[intern("PXBlade")];
117  std::vector<Value> maxladders;
118  Value maxmodule = 0;
119  Value innerring = iConfig.getParameter<int>("n_inner_ring_blades");
120  Value outerring = 0;
121 
122  // Now travrse the detector and collect whatever we need.
123  auto detids = trackerGeometryHandle->detIds();
124  for (DetId id : detids) {
125  if (id.subdetId() != PixelSubdetector::PixelBarrel && id.subdetId() != PixelSubdetector::PixelEndcap) continue;
126  auto iq = InterestingQuantities{nullptr, id, 0, 0};
127  auto layer = pxlayer(iq);
128  if (layer != UNDEFINED) {
129  if (layer >= Value(maxladders.size())) maxladders.resize(layer+1);
130  auto ladder = pxladder(iq);
131  if (ladder > maxladders[layer]) maxladders[layer] = ladder;
132  }
133  auto module = pxmodule(iq);
134  if (module != UNDEFINED && module > maxmodule) maxmodule = module;
135  auto blade = pxblade(iq);
136  if (blade != UNDEFINED && blade > outerring) outerring = blade;
137 
138  // we record each module 4 times, one for each corner, so we also get ROCs
139  // in booking (at least for the ranges)
140  iq.row = 0; iq.col = 0;
141  all_modules.push_back(iq);
142  iq.row = module_rows; iq.col = 0;
143  all_modules.push_back(iq);
144  iq.row = 0; iq.col = module_cols;
145  all_modules.push_back(iq);
146  iq.row = module_rows; iq.col = module_cols;
147  all_modules.push_back(iq);
148  }
149 
150  outerring = outerring - innerring;
151 
152  // Shells are a concept that cannot be derived from bitmasks.
153  // Use hardcoded logic here.
154  // This contains a lot more assumptions about general geometry than the rest
155  // of the code, but it might work for Phase0 as well.
156  addExtractor(intern("PXRing"),
157  [pxblade, innerring] (InterestingQuantities const& iq) {
158  auto blade = pxblade(iq);
159  if (blade == UNDEFINED) return UNDEFINED;
160  if (blade <= innerring) return Value(1);
161  else return Value(2);
162  }
163  );
164 
165  addExtractor(intern("HalfCylinder"),
166  [pxendcap, pxblade, innerring, outerring] (InterestingQuantities const& iq) {
167  auto ec = pxendcap(iq);
168  if (ec == UNDEFINED) return UNDEFINED;
169  auto blade = pxblade(iq);
170  // blade 1 and 56 are at 3 o'clock. This is a mess.
171  auto inring = blade > innerring ? (innerring+outerring+1) - blade : blade;
172  auto perring = blade > innerring ? outerring : innerring;
173  // inring is now 1-based, 1 at 3 o'clock, upto perring.
174  int frac = (int) ((inring-1) / float(perring) * 4); // floor semantics here
175  if (frac == 0 || frac == 3) return 10*ec + 1; // inner half
176  if (frac == 1 || frac == 2) return 10*ec + 2; // outer half
177  assert(!"HalfCylinder logic problem");
178  return UNDEFINED;
179  }, 0, 0 // N/A
180  );
181 
182  // For the '+-shape' (ladder vs. module) plots, we need signed numbers with
183  // (unused) 0-ladder/module at x=0/z=0. This means a lot of messing with the
184  // ladder/shell numbering...
185  addExtractor(intern("signedLadder"),
186  [pxbarrel, pxladder, pxlayer, maxladders, maxmodule] (InterestingQuantities const& iq) {
187  if(pxbarrel(iq) == UNDEFINED) return UNDEFINED;
188  auto layer = pxlayer(iq);
189  auto ladder = pxladder(iq);
190  int frac = (int) ((ladder-1) / float(maxladders[layer]) * 4); // floor semantics
191  Value quarter = maxladders[layer] / 4;
192  if (frac == 0) return -ladder + quarter + 1; // top right - +1 for gap
193  if (frac == 1) return -ladder + quarter; // top left -
194  if (frac == 2) return -ladder + quarter; // bot left - same
195  if (frac == 3) return -ladder + 4*quarter + quarter + 1; // bot right - like top right but wrap around
196  assert(!"Shell logic problem");
197  return UNDEFINED;
198  }
199  );
200 
201  addExtractor(intern("signedModule"),
202  [pxmodule, maxmodule] (InterestingQuantities const& iq) {
203  Value mod = pxmodule(iq); // range 1..maxmodule
204  if (mod == UNDEFINED) return UNDEFINED;
205  mod -= (maxmodule/2 + 1); // range -(max_module/2)..-1, 0..
206  if (mod >= 0) mod += 1; // range -(max_module/2)..-1, 1..
207  return mod;
208  }
209  );
210 
211  auto signedladder = extractors[intern("signedLadder")];
212  auto signedmodule = extractors[intern("signedModule")];
213  addExtractor(intern("Shell"),
214  [signedladder, signedmodule] (InterestingQuantities const& iq) {
215  auto sl = signedladder(iq);
216  auto sm = signedmodule(iq);
217  if (sl == UNDEFINED) return UNDEFINED;
218  return Value((sm < 0 ? 10 : 20) + (sl < 0 ? 2 : 1)); // negative means outer shell!?
219  }, 0, 0 // N/A
220  );
221 
222  addExtractor(intern(""), // A dummy column. Not much special handling required.
223  [] (InterestingQuantities const& iq) { return 0; },
224  0, 0
225  );
226 
227 }
T getParameter(std::string const &) const
void addExtractor(ID id, std::function< Value(InterestingQuantities const &iq)> func, Value min=UNDEFINED, Value max=UNDEFINED)
assert(m_qm.get())
std::vector< InterestingQuantities > all_modules
static const Value UNDEFINED
Definition: DetId.h:18
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
bool isValid() const
Definition: ESHandle.h:47
ID intern(std::string const &id)
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:208
void GeometryInterface::loadModuleLevel ( edm::EventSetup const &  iSetup,
const edm::ParameterSet iConfig 
)
private

Definition at line 259 of file GeometryInterface.cc.

References addExtractor(), GeometryInterface::InterestingQuantities::col, extractors, edm::ParameterSet::getParameter(), intern(), mod(), DetId::rawId(), GeometryInterface::InterestingQuantities::row, GeometryInterface::InterestingQuantities::sourceModule, and UNDEFINED.

Referenced by load().

259  {
260  // stuff that is within modules. Might require some phase0/phase1/strip switching later
261  addExtractor(intern("row"),
262  [] (InterestingQuantities const& iq) {
263  return Value(iq.row);
264  },
265  0, iConfig.getParameter<int>("module_rows") - 1
266  );
267  addExtractor(intern("col"),
268  [] (InterestingQuantities const& iq) {
269  return Value(iq.col);
270  },
271  0, iConfig.getParameter<int>("module_cols") - 1
272  );
273 
274  int n_rocs = iConfig.getParameter<int>("n_rocs");
275  float roc_cols = iConfig.getParameter<int>("roc_cols");
276  float roc_rows = iConfig.getParameter<int>("roc_rows");
277  auto pxmodule = extractors[intern("PXBModule")];
278  auto pxpanel = extractors[intern("PXPanel")];
279  addExtractor(intern("ROC"),
280  [n_rocs, roc_cols, roc_rows] (InterestingQuantities const& iq) {
281  int fedrow = int(iq.row / roc_rows);
282  int fedcol = int(iq.col / roc_cols);
283  if (fedrow == 0) return Value(fedcol);
284  if (fedrow == 1) return Value(n_rocs - 1 - fedcol);
285  return UNDEFINED;
286  }
287  );
288 
289  // arbitrary per-ladder numbering (for inefficiencies)
290  auto roc = extractors[intern("ROC")];
291  addExtractor(intern("ROCinLadder"),
292  [pxmodule, roc, n_rocs] (InterestingQuantities const& iq) {
293  auto mod = pxmodule(iq);
294  if (mod == UNDEFINED) return UNDEFINED;
295  return Value(roc(iq) + n_rocs * (mod-1));
296  }
297  );
298  addExtractor(intern("ROCinBlade"),
299  [pxmodule, pxpanel, roc, n_rocs] (InterestingQuantities const& iq) {
300  auto mod = pxpanel(iq);
301  if (mod == UNDEFINED) return UNDEFINED;
302  return Value(roc(iq) + n_rocs * (mod-1));
303  }
304  );
305 
306  addExtractor(intern("DetId"),
307  [] (InterestingQuantities const& iq) {
308  uint32_t id = iq.sourceModule.rawId();
309  return Value(id);
310  },
311  0, 0 // No sane value possible here.
312  );
313 }
T getParameter(std::string const &) const
void addExtractor(ID id, std::function< Value(InterestingQuantities const &iq)> func, Value min=UNDEFINED, Value max=UNDEFINED)
static const Value UNDEFINED
std::vector< std::function< Value(InterestingQuantities const &iq)> > extractors
ID intern(std::string const &id)
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void GeometryInterface::loadTimebased ( edm::EventSetup const &  iSetup,
const edm::ParameterSet iConfig 
)
private

Definition at line 229 of file GeometryInterface.cc.

References addExtractor(), edm::EventBase::bunchCrossing(), edm::ParameterSet::getParameter(), intern(), edm::EventBase::luminosityBlock(), GeometryInterface::InterestingQuantities::sourceEvent, and UNDEFINED.

Referenced by load().

229  {
230  // extractors for quantities that are roughly time-based. We cannot book plots based on these; they have to
231  // be grouped away in step1.
232  addExtractor(intern("Lumisection"),
233  [] (InterestingQuantities const& iq) {
234  if(!iq.sourceEvent) return UNDEFINED;
235  return Value(iq.sourceEvent->luminosityBlock());
236  },
237  1, iConfig.getParameter<int>("max_lumisection")
238  );
239  int onlineblock = iConfig.getParameter<int>("onlineblock");
240  int n_onlineblocks = iConfig.getParameter<int>("n_onlineblocks");
241  addExtractor(intern("OnlineBlock"),
242  [onlineblock] (InterestingQuantities const& iq) {
243  if(!iq.sourceEvent) return UNDEFINED;
244  return Value(onlineblock + iq.sourceEvent->luminosityBlock() / onlineblock);
245  },
246  // note: this range is not visible anywhere (if the RenderPlugin does its job),
247  // but the strange range allows the RenderPlugin to know the block size.
248  onlineblock, onlineblock+n_onlineblocks-1
249  );
250  addExtractor(intern("BX"),
251  [] (InterestingQuantities const& iq) {
252  if(!iq.sourceEvent) return UNDEFINED;
253  return Value(iq.sourceEvent->bunchCrossing());
254  },
255  1, iConfig.getParameter<int>("max_bunchcrossing")
256  );
257 }
T getParameter(std::string const &) const
void addExtractor(ID id, std::function< Value(InterestingQuantities const &iq)> func, Value min=UNDEFINED, Value max=UNDEFINED)
static const Value UNDEFINED
ID intern(std::string const &id)
Value GeometryInterface::maxValue ( ID  id)
inline

Definition at line 140 of file GeometryInterface.h.

References max_value.

Referenced by HistogramManager::book().

140 { return max_value[id]; };
std::map< ID, Value > max_value
Value GeometryInterface::minValue ( ID  id)
inline

Definition at line 141 of file GeometryInterface.h.

References min_value.

Referenced by HistogramManager::book().

141 { return min_value[id]; };
std::map< ID, Value > min_value
std::string GeometryInterface::pretty ( Column  col)
inline

Definition at line 164 of file GeometryInterface.h.

References unintern().

Referenced by HistogramManager::book(), HistogramManager::executeExtend(), HistogramManager::makeName(), and HistogramManager::makePath().

164  {
165  if (col[1] == 0) // normal column
166  return unintern(col[0]);
167  else
168  return unintern(col[0]) +
169  /*"|" +*/ unintern(col[1]); // TODO: should loop.
170  }
std::string unintern(ID id)
int col
Definition: cuy.py:1008
std::string GeometryInterface::unintern ( ID  id)
inline

Definition at line 158 of file GeometryInterface.h.

References alignCSCRings::e, and ids.

Referenced by extract(), and pretty().

158  {
159  for (auto& e : ids)
160  if (e.second == id) return e.first;
161  return "INVALID";
162  }
std::map< std::string, ID > ids

Member Data Documentation

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

Definition at line 205 of file GeometryInterface.h.

Referenced by allModules(), loadFEDCabling(), and loadFromTopology().

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

Definition at line 184 of file GeometryInterface.h.

Referenced by load().

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

Definition at line 208 of file GeometryInterface.h.

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

bool GeometryInterface::is_loaded = false
private

Definition at line 186 of file GeometryInterface.h.

Referenced by load(), and loaded().

ID GeometryInterface::max_id = 0
private

Definition at line 209 of file GeometryInterface.h.

Referenced by intern().

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

Definition at line 194 of file GeometryInterface.h.

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

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

Definition at line 195 of file GeometryInterface.h.

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

const GeometryInterface::Value GeometryInterface::UNDEFINED = 0x0FFFFFFF
static