CMS 3D CMS Logo

RBorderFinder.cc
Go to the documentation of this file.
2 
3 RBorderFinder::RBorderFinder(const std::vector<const Det*>& utheDets)
4  : theNbins(utheDets.size()), isRPeriodic_(false), isROverlapping_(false) {
5  std::vector<const Det*> theDets = utheDets;
6  precomputed_value_sort(theDets.begin(), theDets.end(), DetR());
7 
8  std::vector<ConstReferenceCountingPointer<BoundDisk> > disks(theNbins);
9  for (int i = 0; i < theNbins; i++) {
10  disks[i] = dynamic_cast<const BoundDisk*>(&(theDets[i]->surface()));
11  if (disks[i] == nullptr) {
12  throw cms::Exception("UnexpectedState") << "RBorderFinder: implemented for BoundDisks only";
13  }
14  }
15 
16  if (theNbins == 1) { // Trivial case
17  isRPeriodic_ = true; // meaningless in this case
18  theRBorders.push_back(disks.front()->innerRadius());
19  theRBins.push_back((disks.front()->outerRadius() + disks.front()->innerRadius()));
20  // std::cout << "RBorderFinder: theNbins " << theNbins << std::endl
21  // << " C: " << theRBins[0]
22  // << " Border: " << theRBorders[0] << std::endl;
23  } else { // More than 1 bin
24  double step = (disks.back()->innerRadius() - disks.front()->innerRadius()) / (theNbins - 1);
25  std::vector<double> spread;
26  std::vector<std::pair<double, double> > REdge;
27  REdge.reserve(theNbins);
28  theRBorders.reserve(theNbins);
29  theRBins.reserve(theNbins);
30  spread.reserve(theNbins);
31 
32  for (int i = 0; i < theNbins; i++) {
33  theRBins.push_back((disks[i]->outerRadius() + disks[i]->innerRadius()) / 2.);
34  spread.push_back(theRBins.back() - (theRBins[0] + i * step));
35  REdge.push_back(std::pair<double, double>(disks[i]->innerRadius(), disks[i]->outerRadius()));
36  }
37 
38  theRBorders.push_back(REdge[0].first);
39  for (int i = 1; i < theNbins; i++) {
40  // Average borders of previous and next bins
41  double br = (REdge[(i - 1)].second + REdge[i].first) / 2.;
42  theRBorders.push_back(br);
43  }
44 
45  for (int i = 1; i < theNbins; i++) {
46  if (REdge[i].first - REdge[i - 1].second < 0) {
47  isROverlapping_ = true;
48  break;
49  }
50  }
51 
52  double rms = stat_RMS(spread);
53  if (rms < 0.01 * step) {
54  isRPeriodic_ = true;
55  }
56  }
57 
58  //Check that everything is proper
59  if ((int)theRBorders.size() != theNbins || (int)theRBins.size() != theNbins)
60  throw cms::Exception("UnexpectedState") << "RBorderFinder consistency error";
61 }
alignBH_cfg.disks
tuple disks
Definition: alignBH_cfg.py:13
mps_fire.i
i
Definition: mps_fire.py:428
funct::false
false
Definition: Factorize.h:29
step
step
Definition: StallMonitor.cc:94
stat_RMS
double stat_RMS(const CONT &cont)
Definition: simple_stat.h:23
RBorderFinder.h
interestingEgammaIsoDetIdsSequence_cff.outerRadius
outerRadius
Definition: interestingEgammaIsoDetIdsSequence_cff.py:14
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
RBorderFinder::theRBorders
std::vector< double > theRBorders
Definition: RBorderFinder.h:51
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
RBorderFinder::theNbins
int theNbins
Definition: RBorderFinder.h:48
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
RBorderFinder::isRPeriodic_
bool isRPeriodic_
Definition: RBorderFinder.h:49
interestingEgammaIsoDetIdsSequence_cff.innerRadius
innerRadius
Definition: interestingEgammaIsoDetIdsSequence_cff.py:15
beamvalidation.br
br
Definition: beamvalidation.py:397
createfilelist.int
int
Definition: createfilelist.py:10
RBorderFinder::theRBins
std::vector< double > theRBins
Definition: RBorderFinder.h:52
RBorderFinder::DetR
geomsort::ExtractR< Det, float > DetR
Definition: RBorderFinder.h:25
Exception
Definition: hltDiff.cc:245
RBorderFinder::isROverlapping_
bool isROverlapping_
Definition: RBorderFinder.h:50
cms::Exception
Definition: Exception.h:70
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
RBorderFinder::RBorderFinder
RBorderFinder(const std::vector< const Det * > &utheDets)
Definition: RBorderFinder.cc:3
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443