CMS 3D CMS Logo

TBPLayer.cc
Go to the documentation of this file.
1 #include "TBPLayer.h"
2 
4 
5 #include "LayerCrossingSide.h"
6 #include "DetGroupMerger.h"
8 #include "BarrelUtil.h"
9 
15 
16 using namespace std;
17 
19 
21  theComps.assign(theInnerComps.begin(), theInnerComps.end());
22  theComps.insert(theComps.end(), theOuterComps.begin(), theOuterComps.end());
23 
24  for (vector<const GeometricSearchDet*>::const_iterator it = theComps.begin(); it != theComps.end(); it++) {
25  theBasicComps.insert(theBasicComps.end(), (**it).basicComponents().begin(), (**it).basicComponents().end());
26  }
27 
28  theInnerCylinder = cylinder(theInnerComps);
29  theOuterCylinder = cylinder(theOuterComps);
30 
31  if (!theInnerComps.empty())
32  theInnerBinFinder = BinFinderType(theInnerComps.front()->position().phi(), theInnerComps.size());
33 
34  if (!theOuterComps.empty())
35  theOuterBinFinder = BinFinderType(theOuterComps.front()->position().phi(), theOuterComps.size());
36 
38 
39  //--------- DEBUG INFO --------------
40  LogDebug("TkDetLayers") << "==== DEBUG TBPLayer =====";
41  LogDebug("TkDetLayers") << "innerCyl radius, thickness, lenght: " << theInnerCylinder->radius() << " , "
42  << theInnerCylinder->bounds().thickness() << " , " << theInnerCylinder->bounds().length();
43 
44  LogDebug("TkDetLayers") << "outerCyl radius, thickness, lenght: " << theOuterCylinder->radius() << " , "
45  << theOuterCylinder->bounds().thickness() << " , " << theOuterCylinder->bounds().length();
46 
47  LogDebug("TkDetLayers") << "Cyl radius, thickness, lenght: " << specificSurface().radius() << " , "
48  << specificSurface().bounds().thickness() << " , " << specificSurface().bounds().length();
49 
50  for (vector<const GeometricSearchDet*>::const_iterator i = theInnerComps.begin(); i != theInnerComps.end(); i++) {
51  LogDebug("TkDetLayers") << "inner Rod pos z,perp,eta,phi: " << (**i).position().z() << " , "
52  << (**i).position().perp() << " , " << (**i).position().eta() << " , "
53  << (**i).position().phi();
54  }
55 
56  for (vector<const GeometricSearchDet*>::const_iterator i = theOuterComps.begin(); i != theOuterComps.end(); i++) {
57  LogDebug("TkDetLayers") << "outer Rod pos z,perp,eta,phi: " << (**i).position().z() << " , "
58  << (**i).position().perp() << " , " << (**i).position().eta() << " , "
59  << (**i).position().phi();
60  }
61  LogDebug("TkDetLayers") << "==== end DEBUG TBPLayer =====";
62 }
63 
65 
66 BoundCylinder* TBPLayer::cylinder(const vector<const GeometricSearchDet*>& rods) const {
67  vector<const GeomDet*> tmp;
68  for (vector<const GeometricSearchDet*>::const_iterator it = rods.begin(); it != rods.end(); it++) {
69  tmp.insert(tmp.end(), (*it)->basicComponents().begin(), (*it)->basicComponents().end());
70  }
71  return CylinderBuilderFromDet()(tmp.begin(), tmp.end());
72 }
73 
74 // private methods for the implementation of groupedCompatibleDets()
75 
76 std::tuple<bool, int, int> TBPLayer::computeIndexes(GlobalPoint gInnerPoint, GlobalPoint gOuterPoint) const {
77  int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.barePhi());
78  float innerDist = theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.barePhi();
79 
80  int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.barePhi());
81  float outerDist = theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.barePhi();
82 
83  innerDist *= Geom::phiLess(theInnerBinFinder.binPosition(innerIndex), gInnerPoint.barePhi()) ? -1.f : 1.f;
84  outerDist *= Geom::phiLess(theOuterBinFinder.binPosition(outerIndex), gOuterPoint.barePhi()) ? -1.f : 1.f;
85  if (innerDist < 0.f) {
86  innerDist += Geom::ftwoPi();
87  }
88  if (outerDist < 0.f) {
89  outerDist += Geom::ftwoPi();
90  }
91 
92  return std::make_tuple(innerDist < outerDist, innerIndex, outerIndex);
93 }
94 
96  const TrajectoryStateOnSurface& tsos,
97  const MeasurementEstimator& est) const {
98  return barrelUtil::computeWindowSize(det, tsos, est);
99 }
100 
102  const Propagator& prop,
103  const MeasurementEstimator& est,
104  const SubLayerCrossing& crossing,
105  float window,
106  vector<DetGroup>& result,
107  bool checkClosest) const {
108  using barrelUtil::overlap;
109 
110  const GlobalPoint& gCrossingPos = crossing.position();
111  auto gphi = gCrossingPos.barePhi();
112 
113  const vector<const GeometricSearchDet*>& sLayer(subLayer(crossing.subLayerIndex()));
114 
115  int closestIndex = crossing.closestDetIndex();
116  int negStartIndex = closestIndex - 1;
117  int posStartIndex = closestIndex + 1;
118 
119  if (checkClosest) { // must decide if the closest is on the neg or pos side
120  if (Geom::phiLess(gphi, sLayer[closestIndex]->surface().phi())) {
121  posStartIndex = closestIndex;
122  } else {
123  negStartIndex = closestIndex;
124  }
125  }
126 
127  const BinFinderType& binFinder = (crossing.subLayerIndex() == 0 ? theInnerBinFinder : theOuterBinFinder);
128 
129  typedef CompatibleDetToGroupAdder Adder;
130  int quarter = sLayer.size() / 4;
131  for (int idet = negStartIndex; idet >= negStartIndex - quarter; idet--) {
132  const GeometricSearchDet& neighborRod = *sLayer[binFinder.binIndex(idet)];
133  if (!overlap(gphi, neighborRod, window))
134  break;
135  if (!Adder::add(neighborRod, tsos, prop, est, result))
136  break;
137  // maybe also add shallow crossing angle test here???
138  }
139  for (int idet = posStartIndex; idet < posStartIndex + quarter; idet++) {
140  const GeometricSearchDet& neighborRod = *sLayer[binFinder.binIndex(idet)];
141  if (!overlap(gphi, neighborRod, window))
142  break;
143  if (!Adder::add(neighborRod, tsos, prop, est, result))
144  break;
145  // maybe also add shallow crossing angle test here???
146  }
147 }
SubLayerCrossing::position
const GlobalPoint & position() const
Definition: SubLayerCrossings.h:14
MeasurementEstimator
Definition: MeasurementEstimator.h:19
HelixBarrelCylinderCrossing.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
TBPLayer::~TBPLayer
~TBPLayer() override __attribute__((cold))
Definition: TBPLayer.cc:64
LayerCrossingSide.h
TBPLayer::computeIndexes
std::tuple< bool, int, int > computeIndexes(GlobalPoint gInnerPoint, GlobalPoint gOuterPoint) const override __attribute__((hot))
Definition: TBPLayer.cc:76
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
TBPLayer.h
TBPLayer::construct
void construct() __attribute__((cold))
Definition: TBPLayer.cc:20
VectorUtil.h
CylinderBuilderFromDet.h
BarrelDetLayer::initialize
virtual void initialize()
Definition: BarrelDetLayer.cc:18
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
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TBPLayer::cylinder
BoundCylinder * cylinder(const std::vector< const GeometricSearchDet * > &rods) const __attribute__((cold))
Definition: TBPLayer.cc:66
DetLayerException.h
MeasurementEstimator.h
CylinderBuilderFromDet
Definition: CylinderBuilderFromDet.h:18
DetGroupMerger.h
Point3DBase< float, GlobalTag >
BarrelUtil.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
Geom::phiLess
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
PV3DBase::barePhi
T barePhi() const
Definition: PV3DBase.h:65
barrelUtil::overlap
bool overlap(float phi, const GeometricSearchDet &gsdet, float phiWin)
Definition: BarrelUtil.h:38
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
SubLayerCrossing::closestDetIndex
int closestDetIndex() const
Definition: SubLayerCrossings.h:13
muon::overlap
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
Definition: MuonSelectors.cc:791
GeometricSearchDet::DetWithState
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Definition: GeometricSearchDet.h:19
DetWithState
GeometricSearchDet::DetWithState DetWithState
Definition: TBPLayer.cc:18
CompatibleDetToGroupAdder.h
std
Definition: JetResolutionObject.h:76
PeriodicBinFinderInPhi< float >
Geom::ftwoPi
constexpr float ftwoPi()
Definition: Pi.h:36
CompatibleDetToGroupAdder
Definition: CompatibleDetToGroupAdder.h:13
barrelUtil::computeWindowSize
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: BarrelUtil.h:31
BoundCylinder
PeriodicBinFinderInPhi::binIndex
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
Definition: PeriodicBinFinderInPhi.h:25
SubLayerCrossing
Definition: SubLayerCrossings.h:7
SubLayerCrossing::subLayerIndex
int subLayerIndex() const
Definition: SubLayerCrossings.h:12
mps_fire.result
result
Definition: mps_fire.py:311
GeometricSearchDet
Definition: GeometricSearchDet.h:17
TBPLayer::computeWindowSize
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const override __attribute__((hot))
Definition: TBPLayer.cc:95
TBPLayer::searchNeighbors
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const override __attribute__((hot))
Definition: TBPLayer.cc:101