CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Private Member Functions
MuonGeometrySanityCheckPoint Class Reference

Public Types

enum  {
  kDTChamber, kDTSuperLayer, kDTLayer, kCSCChamber,
  kCSCLayer
}
 
enum  { kGlobal, kLocal, kChamber, kCustom }
 

Public Member Functions

std::string detName () const
 
 MuonGeometrySanityCheckPoint (const edm::ParameterSet &iConfig, const std::map< std::string, const MuonGeometrySanityCheckCustomFrame * > &frames)
 

Public Attributes

const
MuonGeometrySanityCheckCustomFrame
customFrame
 
DetId detector
 
GlobalPoint displacement
 
GlobalPoint expectation
 
int frame
 
bool has_expectation
 
std::string name
 
const
MuonGeometrySanityCheckCustomFrame
outputCustomFrame
 
int outputFrame
 
int type
 

Private Member Functions

int number (std::string s)
 
bool numeric (std::string s)
 

Detailed Description

Definition at line 57 of file MuonGeometrySanityCheck.cc.

Member Enumeration Documentation

anonymous enum
anonymous enum

Constructor & Destructor Documentation

MuonGeometrySanityCheckPoint::MuonGeometrySanityCheckPoint ( const edm::ParameterSet iConfig,
const std::map< std::string, const MuonGeometrySanityCheckCustomFrame * > &  frames 
)

Definition at line 226 of file MuonGeometrySanityCheck.cc.

References funct::abs(), Reference_intrackfit_cff::barrel, CSCDetId, customFrame, detector, detName(), displacement, DTChamberId, DTLayerId, DTSuperLayerId, Reference_intrackfit_cff::endcap, mps_splice::entry, Exception, expectation, frame, relativeConstraints::frameName, edm::ParameterSet::getParameter(), has_expectation, kChamber, kCSCChamber, kCSCLayer, kCustom, kDTChamber, kDTLayer, kDTSuperLayer, kGlobal, kLocal, phase1PixelTopology::layer, name, number(), numeric(), outputCustomFrame, outputFrame, reco::HaloData::plus, point, edm::ParameterSet::retrieveUnknown(), relativeConstraints::ring, relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

227  {
228  std::string detName = iConfig.getParameter<std::string>("detector");
229 
230  bool parsing_error = false;
231 
232  bool barrel = (detName.substr(0, 2) == std::string("MB"));
233  bool endcap = (detName.substr(0, 2) == std::string("ME"));
234  if (!barrel && !endcap)
235  parsing_error = true;
236 
237  if (!parsing_error && barrel) {
238  int index = 2;
239 
240  bool plus = true;
241  if (detName.substr(index, 1) == std::string("+")) {
242  plus = true;
243  index++;
244  } else if (detName.substr(index, 1) == std::string("-")) {
245  plus = false;
246  index++;
247  }
248 
249  int wheel = 0;
250  bool wheel_digit = false;
251  while (!parsing_error && numeric(detName.substr(index, 1))) {
252  wheel *= 10;
253  wheel += number(detName.substr(index, 1));
254  wheel_digit = true;
255  index++;
256  }
257  if (!plus)
258  wheel *= -1;
259  if (!wheel_digit)
260  parsing_error = true;
261 
262  if (detName.substr(index, 1) != std::string("/"))
263  parsing_error = true;
264  index++;
265 
266  int station = 0;
267  bool station_digit = false;
268  while (!parsing_error && numeric(detName.substr(index, 1))) {
269  station *= 10;
270  station += number(detName.substr(index, 1));
271  station_digit = true;
272  index++;
273  }
274  if (!station_digit)
275  parsing_error = true;
276 
277  if (detName.substr(index, 1) != std::string("/"))
278  parsing_error = true;
279  index++;
280 
281  int sector = 0;
282  bool sector_digit = false;
283  while (!parsing_error && numeric(detName.substr(index, 1))) {
284  sector *= 10;
285  sector += number(detName.substr(index, 1));
286  sector_digit = true;
287  index++;
288  }
289  if (!sector_digit)
290  parsing_error = true;
291 
292  // these are optional
293  int superlayer = 0;
294  bool superlayer_digit = false;
295  int layer = 0;
296  if (detName.substr(index, 1) == std::string("/")) {
297  index++;
298  while (!parsing_error && numeric(detName.substr(index, 1))) {
299  superlayer *= 10;
300  superlayer += number(detName.substr(index, 1));
301  superlayer_digit = true;
302  index++;
303  }
304  if (!superlayer_digit)
305  parsing_error = true;
306 
307  if (detName.substr(index, 1) == std::string("/")) {
308  index++;
309  while (!parsing_error && numeric(detName.substr(index, 1))) {
310  layer *= 10;
311  layer += number(detName.substr(index, 1));
312  index++;
313  }
314  }
315  }
316 
317  if (!parsing_error) {
318  bool no_such_chamber = false;
319 
320  if (wheel < -2 || wheel > 2)
321  no_such_chamber = true;
322  if (station < 1 || station > 4)
323  no_such_chamber = true;
324  if (station == 4 && (sector < 1 || sector > 14))
325  no_such_chamber = true;
326  if (station < 4 && (sector < 1 || sector > 12))
327  no_such_chamber = true;
328 
329  if (no_such_chamber) {
330  throw cms::Exception("BadConfig") << "Chamber doesn't exist: MB" << (plus ? "+" : "-") << wheel << "/"
331  << station << "/" << sector << std::endl;
332  }
333 
334  if (superlayer == 0) {
335  detector = DTChamberId(wheel, station, sector);
336  type = kDTChamber;
337  } else {
338  bool no_such_superlayer = false;
339  if (superlayer < 1 || superlayer > 3)
340  no_such_superlayer = true;
341  if (station == 4 && superlayer == 2)
342  no_such_superlayer = true;
343 
344  if (no_such_superlayer) {
345  throw cms::Exception("BadConfig") << "Superlayer doesn't exist: MB" << (plus ? "+" : "-") << wheel << "/"
346  << station << "/" << sector << "/" << superlayer << std::endl;
347  }
348 
349  if (layer == 0) {
350  detector = DTSuperLayerId(wheel, station, sector, superlayer);
352  } else {
353  bool no_such_layer = false;
354  if (layer < 1 || layer > 4)
355  no_such_layer = true;
356 
357  if (no_such_layer) {
358  throw cms::Exception("BadConfig")
359  << "Layer doesn't exist: MB" << (plus ? "+" : "-") << wheel << "/" << station << "/" << sector << "/"
360  << superlayer << "/" << layer << std::endl;
361  }
362 
363  detector = DTLayerId(wheel, station, sector, superlayer, layer);
364  type = kDTLayer;
365  }
366  }
367  }
368  } else if (!parsing_error && endcap) {
369  int index = 2;
370 
371  bool plus = true;
372  if (detName.substr(index, 1) == std::string("+")) {
373  plus = true;
374  index++;
375  } else if (detName.substr(index, 1) == std::string("-")) {
376  plus = false;
377  index++;
378  } else
379  parsing_error = true;
380 
381  int station = 0;
382  bool station_digit = false;
383  while (!parsing_error && numeric(detName.substr(index, 1))) {
384  station *= 10;
385  station += number(detName.substr(index, 1));
386  station_digit = true;
387  index++;
388  }
389  if (!plus)
390  station *= -1;
391  if (!station_digit)
392  parsing_error = true;
393 
394  if (detName.substr(index, 1) != std::string("/"))
395  parsing_error = true;
396  index++;
397 
398  int ring = 0;
399  bool ring_digit = false;
400  while (!parsing_error && numeric(detName.substr(index, 1))) {
401  ring *= 10;
402  ring += number(detName.substr(index, 1));
403  ring_digit = true;
404  index++;
405  }
406  if (!ring_digit)
407  parsing_error = true;
408 
409  if (detName.substr(index, 1) != std::string("/"))
410  parsing_error = true;
411  index++;
412 
413  int chamber = 0;
414  bool chamber_digit = false;
415  while (!parsing_error && numeric(detName.substr(index, 1))) {
416  chamber *= 10;
417  chamber += number(detName.substr(index, 1));
418  chamber_digit = true;
419  index++;
420  }
421  if (!chamber_digit)
422  parsing_error = true;
423 
424  // this is optional
425  int layer = 0;
426  bool layer_digit = false;
427  if (detName.substr(index, 1) == std::string("/")) {
428  index++;
429  while (!parsing_error && numeric(detName.substr(index, 1))) {
430  layer *= 10;
431  layer += number(detName.substr(index, 1));
432  layer_digit = true;
433  index++;
434  }
435  if (!layer_digit)
436  parsing_error = true;
437  }
438 
439  if (!parsing_error) {
440  bool no_such_chamber = false;
441 
442  int endcap = (station > 0 ? 1 : 2);
443  station = abs(station);
444  if (station < 1 || station > 4)
445  no_such_chamber = true;
446  if (station == 1 && (ring < 1 || ring > 4))
447  no_such_chamber = true;
448  if (station > 1 && (ring < 1 || ring > 2))
449  no_such_chamber = true;
450  if (station == 1 && (chamber < 1 || chamber > 36))
451  no_such_chamber = true;
452  if (station > 1 && ring == 1 && (chamber < 1 || chamber > 18))
453  no_such_chamber = true;
454  if (station > 1 && ring == 2 && (chamber < 1 || chamber > 36))
455  no_such_chamber = true;
456 
457  if (no_such_chamber) {
458  throw cms::Exception("BadConfig") << "Chamber doesn't exist: ME" << (endcap == 1 ? "+" : "-") << station << "/"
459  << ring << "/" << chamber << std::endl;
460  }
461 
462  if (layer == 0) {
463  detector = CSCDetId(endcap, station, ring, chamber);
464  type = kCSCChamber;
465  } else {
466  bool no_such_layer = false;
467  if (layer < 1 || layer > 6)
468  no_such_layer = true;
469 
470  if (no_such_layer) {
471  throw cms::Exception("BadConfig") << "Layer doesn't exist: ME" << (endcap == 1 ? "+" : "-") << station << "/"
472  << ring << "/" << chamber << "/" << layer << std::endl;
473  }
474 
475  detector = CSCDetId(endcap, station, ring, chamber, layer);
476  type = kCSCLayer;
477  }
478  }
479  }
480 
481  if (parsing_error) {
482  throw cms::Exception("BadConfig") << "Detector name is malformed: " << detName << std::endl;
483  }
484 
485  std::string frameName = iConfig.getParameter<std::string>("frame");
486  const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::const_iterator frameIter =
487  frames.find(frameName);
488  if (frameName == std::string("global")) {
489  frame = kGlobal;
490  customFrame = nullptr;
491  } else if (frameName == std::string("local")) {
492  frame = kLocal;
493  customFrame = nullptr;
494  } else if (frameName == std::string("chamber")) {
495  frame = kChamber;
496  customFrame = nullptr;
497  } else if (frameIter != frames.end()) {
498  frame = kCustom;
499  customFrame = frameIter->second;
500  } else {
501  throw cms::Exception("BadConfig") << "Frame \"" << frameName << "\" has not been defined." << std::endl;
502  }
503 
504  std::vector<double> point = iConfig.getParameter<std::vector<double> >("displacement");
505  if (point.size() != 3) {
506  throw cms::Exception("BadConfig") << "Displacement relative to detector " << detName
507  << " doesn't have exactly three components." << std::endl;
508  }
509 
510  displacement = GlobalPoint(point[0], point[1], point[2]);
511 
512  const edm::Entry *entry = iConfig.retrieveUnknown("expectation");
513  if (entry != nullptr) {
514  has_expectation = true;
515 
516  point = iConfig.getParameter<std::vector<double> >("expectation");
517  if (point.size() != 3) {
518  throw cms::Exception("BadConfig") << "Expectation for detector " << detName << ", displacement " << displacement
519  << " doesn't have exactly three components." << std::endl;
520  }
521 
522  expectation = GlobalPoint(point[0], point[1], point[2]);
523  } else {
524  has_expectation = false;
525  }
526 
527  entry = iConfig.retrieveUnknown("name");
528  if (entry != nullptr) {
529  name = iConfig.getParameter<std::string>("name");
530  } else {
531  name = std::string("anonymous");
532  }
533 
534  entry = iConfig.retrieveUnknown("outputFrame");
535  if (entry != nullptr) {
536  frameName = iConfig.getParameter<std::string>("outputFrame");
537  const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::const_iterator frameIter =
538  frames.find(frameName);
539  if (frameName == std::string("global")) {
541  outputCustomFrame = nullptr;
542  } else if (frameName == std::string("local")) {
544  outputCustomFrame = nullptr;
545  } else if (frameName == std::string("chamber")) {
547  outputCustomFrame = nullptr;
548  } else if (frameIter != frames.end()) {
550  outputCustomFrame = frameIter->second;
551  } else {
552  throw cms::Exception("BadConfig") << "Frame \"" << frameName << "\" has not been defined." << std::endl;
553  }
554  } else {
556  outputCustomFrame = nullptr;
557  }
558 }
const MuonGeometrySanityCheckCustomFrame * outputCustomFrame
DTSuperLayerId
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
constexpr std::array< uint8_t, layerIndexSize > layer
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
list entry
Definition: mps_splice.py:68
Entry const * retrieveUnknown(char const *) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
const MuonGeometrySanityCheckCustomFrame * customFrame

Member Function Documentation

std::string MuonGeometrySanityCheckPoint::detName ( ) const

Definition at line 560 of file MuonGeometrySanityCheck.cc.

References cms::cuda::assert(), detector, gpuClustering::id, kCSCChamber, kCSCLayer, kDTChamber, kDTLayer, kDTSuperLayer, convertSQLitetoXML_cfg::output, and relativeConstraints::station.

Referenced by MuonGeometrySanityCheckPoint().

560  {
561  std::stringstream output;
562  if (type == kDTChamber) {
564  output << "MB" << (id.wheel() > 0 ? "+" : "") << id.wheel() << "/" << id.station() << "/" << id.sector();
565  } else if (type == kDTSuperLayer) {
567  output << "MB" << (id.wheel() > 0 ? "+" : "") << id.wheel() << "/" << id.station() << "/" << id.sector() << "/"
568  << id.superlayer();
569  } else if (type == kDTLayer) {
571  output << "MB" << (id.wheel() > 0 ? "+" : "") << id.wheel() << "/" << id.station() << "/" << id.sector() << "/"
572  << id.superlayer() << "/" << id.layer();
573  } else if (type == kCSCChamber) {
575  output << "ME" << (id.endcap() == 1 ? "+" : "-") << id.station() << "/" << id.ring() << "/" << id.chamber();
576  } else if (type == kCSCLayer) {
578  output << "ME" << (id.endcap() == 1 ? "+" : "-") << id.station() << "/" << id.ring() << "/" << id.chamber() << "/"
579  << id.layer();
580  } else
581  assert(false);
582  return output.str();
583 }
uint16_t *__restrict__ id
assert(be >=bs)
int MuonGeometrySanityCheckPoint::number ( std::string  s)
private

Definition at line 201 of file MuonGeometrySanityCheck.cc.

References cms::cuda::assert(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MuonGeometrySanityCheckPoint().

201  {
202  if (s == std::string("0"))
203  return 0;
204  else if (s == std::string("1"))
205  return 1;
206  else if (s == std::string("2"))
207  return 2;
208  else if (s == std::string("3"))
209  return 3;
210  else if (s == std::string("4"))
211  return 4;
212  else if (s == std::string("5"))
213  return 5;
214  else if (s == std::string("6"))
215  return 6;
216  else if (s == std::string("7"))
217  return 7;
218  else if (s == std::string("8"))
219  return 8;
220  else if (s == std::string("9"))
221  return 9;
222  else
223  assert(false);
224 }
assert(be >=bs)
bool MuonGeometrySanityCheckPoint::numeric ( std::string  s)
private

Definition at line 195 of file MuonGeometrySanityCheck.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MuonGeometrySanityCheckPoint().

195  {
196  return (s == std::string("0") || s == std::string("1") || s == std::string("2") || s == std::string("3") ||
197  s == std::string("4") || s == std::string("5") || s == std::string("6") || s == std::string("7") ||
198  s == std::string("8") || s == std::string("9"));
199 }

Member Data Documentation

const MuonGeometrySanityCheckCustomFrame* MuonGeometrySanityCheckPoint::customFrame

Definition at line 71 of file MuonGeometrySanityCheck.cc.

Referenced by MuonGeometrySanityCheckPoint().

DetId MuonGeometrySanityCheckPoint::detector

Definition at line 69 of file MuonGeometrySanityCheck.cc.

Referenced by detName(), and MuonGeometrySanityCheckPoint().

GlobalPoint MuonGeometrySanityCheckPoint::displacement

Definition at line 72 of file MuonGeometrySanityCheck.cc.

Referenced by MuonGeometrySanityCheckPoint().

GlobalPoint MuonGeometrySanityCheckPoint::expectation

Definition at line 74 of file MuonGeometrySanityCheck.cc.

Referenced by MuonGeometrySanityCheckPoint().

int MuonGeometrySanityCheckPoint::frame

Definition at line 70 of file MuonGeometrySanityCheck.cc.

Referenced by MuonGeometrySanityCheckPoint().

bool MuonGeometrySanityCheckPoint::has_expectation

Definition at line 73 of file MuonGeometrySanityCheck.cc.

Referenced by MuonGeometrySanityCheckPoint().

std::string MuonGeometrySanityCheckPoint::name

Definition at line 75 of file MuonGeometrySanityCheck.cc.

Referenced by ElectronMVAID.ElectronMVAID::__call__(), FWLite.ElectronMVAID::__call__(), dirstructure.Directory::__create_pie_image(), DisplayManager.DisplayManager::__del__(), dqm_interfaces.DirID::__eq__(), BeautifulSoup.Tag::__eq__(), dirstructure.Directory::__get_full_path(), dirstructure.Comparison::__get_img_name(), dataset.Dataset::__getDataType(), dataset.Dataset::__getFileInfoList(), dirstructure.Comparison::__make_image(), core.autovars.NTupleVariable::__repr__(), core.autovars.NTupleObjectType::__repr__(), core.autovars.NTupleObject::__repr__(), core.autovars.NTupleCollection::__repr__(), dirstructure.Directory::__repr__(), dqm_interfaces.DirID::__repr__(), dirstructure.Comparison::__repr__(), config.Service::__setattr__(), config.CFG::__str__(), counter.Counter::__str__(), average.Average::__str__(), BeautifulSoup.Tag::__str__(), BeautifulSoup.SoupStrainer::__str__(), FWLite.WorkingPoints::_reformat_cut_definitions(), core.autovars.NTupleObjectType::addSubObjects(), core.autovars.NTupleObjectType::addVariables(), core.autovars.NTupleObjectType::allVars(), dirstructure.Directory::calcStats(), genericValidation.GenericValidationData::cfgName(), crabFunctions.CrabTask::crabConfig(), crabFunctions.CrabTask::crabFolder(), genericValidation.GenericValidationData::createCrabCfg(), geometryComparison.GeometryComparison::createScript(), genericValidation.GenericValidationData::createScript(), validation.Sample::digest(), python.rootplot.utilities.Hist::divide(), python.rootplot.utilities.Hist::divide_wilson(), DisplayManager.DisplayManager::Draw(), TreeCrawler.Package::dump(), core.autovars.NTupleVariable::fillBranch(), core.autovars.NTupleObject::fillBranches(), core.autovars.NTupleCollection::fillBranchesScalar(), core.autovars.NTupleCollection::fillBranchesVector(), core.autovars.NTupleCollection::get_cpp_declaration(), core.autovars.NTupleCollection::get_cpp_wrapper_class(), core.autovars.NTupleCollection::get_py_wrapper_class(), utils.StatisticalTest::get_status(), production_tasks.Task::getname(), dataset.CMSDataset::getPrimaryDatasetEntries(), dataset.PrivateDataset::getPrimaryDatasetEntries(), primaryVertexResolution.PrimaryVertexResolution::getRepMap(), primaryVertexValidation.PrimaryVertexValidation::getRepMap(), zMuMuValidation.ZMuMuValidation::getRepMap(), alignment.Alignment::getRepMap(), genericValidation.GenericValidationData::getRepMap(), crabFunctions.CrabTask::handleNoState(), VIDSelectorBase.VIDSelectorBase::initialize(), personalPlayback.Applet::log(), core.autovars.NTupleVariable::makeBranch(), core.autovars.NTupleObject::makeBranches(), core.autovars.NTupleCollection::makeBranchesScalar(), core.autovars.NTupleCollection::makeBranchesVector(), MuonGeometrySanityCheckPoint(), plotscripts.SawTeethFunction::pp(), dirstructure.Directory::print_report(), dataset.BaseDataset::printInfo(), dataset.Dataset::printInfo(), crabFunctions.CrabTask::resubmit_failed(), production_tasks.MonitorJobs::run(), BeautifulSoup.SoupStrainer::searchTag(), python.rootplot.utilities.Hist::TGraph(), python.rootplot.utilities.Hist::TH1F(), crabFunctions.CrabTask::update(), crabFunctions.CrabTask::updateJobStats(), counter.Counter::write(), and average.Average::write().

const MuonGeometrySanityCheckCustomFrame* MuonGeometrySanityCheckPoint::outputCustomFrame

Definition at line 77 of file MuonGeometrySanityCheck.cc.

Referenced by MuonGeometrySanityCheckPoint().

int MuonGeometrySanityCheckPoint::outputFrame

Definition at line 76 of file MuonGeometrySanityCheck.cc.

Referenced by MuonGeometrySanityCheckPoint().

int MuonGeometrySanityCheckPoint::type