CMS 3D CMS Logo

DegradeBend.cc
Go to the documentation of this file.
3 
7 
8 #include <map>
9 #include <set>
10 #include <utility>
11 #include <cmath>
12 #include <algorithm>
13 #include <iostream>
14 
15 using namespace std;
16 
17 namespace tmtt {
18 
19  //--- Given the original bend, flag indicating if this is a PS or 2S module, & detector identifier,
20  //--- this returns the degraded stub bend, a boolean indicatng if stub bend was outside the assumed window
21  //--- size programmed below, and an integer indicating how many values of the original bend
22  //--- were grouped together into this single value of the degraded bend.
23 
24  void DegradeBend::degrade(float bend,
25  bool psModule,
26  const DetId& stDetId,
27  float windowFEnew,
28  float& degradedBend,
29  unsigned int& numInGroup) const {
30  // Get degraded bend value.
31  unsigned int windowHalfStrips;
32  this->work(bend, psModule, stDetId, windowFEnew, degradedBend, numInGroup, windowHalfStrips);
33  }
34 
35  //--- Does the actual work of degrading the bend.
36 
37  void DegradeBend::work(float bend,
38  bool psModule,
39  const DetId& stDetId,
40  float windowFEnew,
41  float& degradedBend,
42  unsigned int& numInGroup,
43  unsigned int& windowHalfStrips) const {
44  // Calculate stub window size in half-strip units used to produce stubs.
45  // Code accessing geometry inspired by L1Trigger/TrackTrigger/src/TTStubAlgorithm_official.cc
46 
47  const double* storedHalfWindow = sw_->storedWindowSize(theTrackerTopo_, stDetId);
48 
49  // Compare this with the possibly tighter window provided by the user, converting to half-strip units.
50  const double window = std::min(*storedHalfWindow, double(windowFEnew));
51  windowHalfStrips = (unsigned int)(2 * window);
52 
53  // Bend is measured with granularity of 0.5 strips.
54  // Convert it to integer measured in half-strip units for this calculation!
55  int b = std::round(2 * bend);
56 
57  if ((unsigned int)(std::abs(b)) <= windowHalfStrips) {
58  // Call the official CMS bend encoding algorithm.
59  degradedBend = stubAlgo_->degradeBend(psModule, windowHalfStrips, b);
60  } else {
61  // This should only happen for stubs subsequently rejected by the FE.
62  numInGroup = 0;
63  constexpr float rejectedStubBend = 99999.;
64  degradedBend = rejectedStubBend;
65  }
66  }
67 } // namespace tmtt
min
T min(T a, T b)
Definition: MathUtil.h:58
svgfig.window
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
edmIntegrityCheck.work
work
Definition: edmIntegrityCheck.py:75
DetId
Definition: DetId.h:17
TrackerTopology.h
TrackerModule.h
b
double b
Definition: hdecay.h:118
createfilelist.int
int
Definition: createfilelist.py:10
std
Definition: JetResolutionObject.h:76
Exception.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DegradeBend.h
tmtt
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
StripSubdetector.h