CMS 3D CMS Logo

MTDRingForwardDoubleLayer.cc
Go to the documentation of this file.
1 
12 
14 
15 #include <algorithm>
16 #include <iostream>
17 #include <vector>
18 
19 using namespace std;
20 
21 MTDRingForwardDoubleLayer::MTDRingForwardDoubleLayer(const vector<const ForwardDetRing*>& frontRings,
22  const vector<const ForwardDetRing*>& backRings)
24  theFrontLayer(frontRings),
25  theBackLayer(backRings),
26  theRings(frontRings), // add back later
27  theComponents(),
28  theBasicComponents() {
29  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDRingForwardDoubleLayer";
30 
31  theRings.insert(theRings.end(), backRings.begin(), backRings.end());
32  theComponents = std::vector<const GeometricSearchDet*>(theRings.begin(), theRings.end());
33 
34  // Cache chamber pointers (the basic components_)
35  // and find extension in R and Z
36  for (vector<const ForwardDetRing*>::const_iterator it = theRings.begin(); it != theRings.end(); it++) {
37  vector<const GeomDet*> tmp2 = (*it)->basicComponents();
38  theBasicComponents.insert(theBasicComponents.end(), tmp2.begin(), tmp2.end());
39  }
40 
41  setSurface(computeSurface());
42 
43  LogTrace(metname) << "Constructing MTDRingForwardDoubleLayer: " << basicComponents().size() << " Dets "
44  << theRings.size() << " Rings "
45  << " Z: " << specificSurface().position().z() << " R1: " << specificSurface().innerRadius()
46  << " R2: " << specificSurface().outerRadius();
47 
48  selfTest();
49 }
50 
52  const BoundDisk& frontDisk = theFrontLayer.specificSurface();
53  const BoundDisk& backDisk = theBackLayer.specificSurface();
54 
55  float rmin = min(frontDisk.innerRadius(), backDisk.innerRadius());
56  float rmax = max(frontDisk.outerRadius(), backDisk.outerRadius());
57  float zmin = frontDisk.position().z();
58  float halfThickness = frontDisk.bounds().thickness() / 2.;
59  zmin = (zmin > 0) ? zmin - halfThickness : zmin + halfThickness;
60  float zmax = backDisk.position().z();
61  halfThickness = backDisk.bounds().thickness() / 2.;
62  zmax = (zmax > 0) ? zmax + halfThickness : zmax - halfThickness;
63  float zPos = (zmax + zmin) / 2.;
64  PositionType pos(0., 0., zPos);
66 
67  return new BoundDisk(pos, rot, new SimpleDiskBounds(rmin, rmax, zmin - zPos, zmax - zPos));
68 }
69 
71  return tsos.globalPosition().basicVector().dot(tsos.globalMomentum().basicVector()) > 0;
72 }
73 
74 std::pair<bool, TrajectoryStateOnSurface> MTDRingForwardDoubleLayer::compatible(
75  const TrajectoryStateOnSurface& startingState, const Propagator& prop, const MeasurementEstimator& est) const {
76  // mostly copied from ForwardDetLayer, except propagates to closest surface,
77  // not to center
78  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDRingForwardDoubleLayer";
79 
80  bool insideOut = isInsideOut(startingState);
81  const MTDRingForwardLayer& closerLayer = (insideOut) ? theFrontLayer : theBackLayer;
82  LogTrace(metname) << "MTDRingForwardDoubleLayer::compatible is assuming inside-out direction: " << insideOut;
83 
84  TrajectoryStateOnSurface myState = prop.propagate(startingState, closerLayer.specificSurface());
85  if (!myState.isValid())
86  return make_pair(false, myState);
87 
88  // take into account the thickness of the layer
89  float deltaR = surface().bounds().thickness() / 2. * fabs(tan(myState.localDirection().theta()));
90 
91  // take into account the error on the predicted state
92  const float nSigma = 3.;
93  if (myState.hasError()) {
94  LocalError err = myState.localError().positionError();
95  // ignore correlation for the moment...
96  deltaR += nSigma * sqrt(err.xx() + err.yy());
97  }
98 
99  float zPos = (zmax() + zmin()) / 2.;
100  SimpleDiskBounds tmp(rmin() - deltaR, rmax() + deltaR, zmin() - zPos, zmax() - zPos);
101 
102  return make_pair(tmp.inside(myState.localPosition()), myState);
103 }
104 
105 vector<GeometricSearchDet::DetWithState> MTDRingForwardDoubleLayer::compatibleDets(
106  const TrajectoryStateOnSurface& startingState, const Propagator& prop, const MeasurementEstimator& est) const {
107  vector<DetWithState> result;
108  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDRingForwardDoubleLayer";
109  pair<bool, TrajectoryStateOnSurface> compat = compatible(startingState, prop, est);
110 
111  if (!compat.first) {
112  LogTrace(metname) << " MTDRingForwardDoubleLayer::compatibleDets: not compatible"
113  << " (should not have been selected!)";
114  return result;
115  }
116 
117  TrajectoryStateOnSurface& tsos = compat.second;
118 
119  // standard implementation of compatibleDets() for class which have
120  // groupedCompatibleDets implemented.
121  // This code should be moved in a common place intead of being
122  // copied many times.
123  vector<DetGroup> vectorGroups = groupedCompatibleDets(tsos, prop, est);
124  for (vector<DetGroup>::const_iterator itDG = vectorGroups.begin(); itDG != vectorGroups.end(); itDG++) {
125  for (vector<DetGroupElement>::const_iterator itDGE = itDG->begin(); itDGE != itDG->end(); itDGE++) {
126  result.push_back(DetWithState(itDGE->det(), itDGE->trajectoryState()));
127  }
128  }
129  return result;
130 }
131 
133  const Propagator& prop,
134  const MeasurementEstimator& est) const {
135  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDRingForwardDoubleLayer";
136  vector<GeometricSearchDet::DetWithState> detWithStates1, detWithStates2;
137 
138  LogTrace(metname) << "groupedCompatibleDets are currently given always in inside-out order";
139  // this should be fixed either in RecoMTD/MeasurementDet/MTDDetLayerMeasurements or
140  // RecoMTD/DetLayers/MTDRingForwardDoubleLayer
141 
142  detWithStates1 = theFrontLayer.compatibleDets(startingState, prop, est);
143  detWithStates2 = theBackLayer.compatibleDets(startingState, prop, est);
144 
145  vector<DetGroup> result;
146  if (!detWithStates1.empty())
147  result.push_back(DetGroup(detWithStates1));
148  if (!detWithStates2.empty())
149  result.push_back(DetGroup(detWithStates2));
150  LogTrace(metname) << "DoubleLayer Compatible dets: " << result.size();
151  return result;
152 }
153 
155  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDRingForwardDoubleLayer";
156  // approximate
157  bool result = false;
158  double r = gp.perp();
159  const std::vector<const ForwardDetRing*>& backRings = theBackLayer.rings();
160  if (backRings.size() > 1) {
161  const MTDDetRing* innerRing = dynamic_cast<const MTDDetRing*>(backRings[0]);
162  const MTDDetRing* outerRing = dynamic_cast<const MTDDetRing*>(backRings[1]);
163  assert(innerRing && outerRing);
164  float crackInner = innerRing->specificSurface().outerRadius();
165  float crackOuter = outerRing->specificSurface().innerRadius();
166  LogTrace(metname) << "In a crack:" << crackInner << " " << r << " " << crackOuter;
167  if (r > crackInner && r < crackOuter)
168  return true;
169  }
170  // non-overlapping rings
171  return result;
172 }
173 
175  const std::vector<const GeomDet*>& frontDets = theFrontLayer.basicComponents();
176  const std::vector<const GeomDet*>& backDets = theBackLayer.basicComponents();
177 
178  std::vector<const GeomDet*>::const_iterator frontItr = frontDets.begin(), lastFront = frontDets.end(),
179  backItr = backDets.begin(), lastBack = backDets.end();
180 
181  // test that each front z is less than each back z
182  for (; frontItr != lastFront; ++frontItr) {
183  float frontz = fabs((**frontItr).surface().position().z());
184  for (; backItr != lastBack; ++backItr) {
185  float backz = fabs((**backItr).surface().position().z());
186  assert(frontz < backz);
187  }
188  }
189 }
Propagator.h
MeasurementEstimator
Definition: MeasurementEstimator.h:19
ForwardDetRing::specificSurface
const BoundDisk & specificSurface() const
Return the ring surface as a BoundDisk.
Definition: ForwardDetRing.h:27
MessageLogger.h
align::RotationType
TkRotation< Scalar > RotationType
Definition: Definitions.h:27
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
MTDRingForwardLayer
Definition: MTDRingForwardLayer.h:18
min
T min(T a, T b)
Definition: MathUtil.h:58
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
pos
Definition: PixelAliasList.h:18
align::PositionType
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:28
cms::cuda::assert
assert(be >=bs)
MTDRingForwardDoubleLayer::compatibleDets
std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDRingForwardDoubleLayer.cc:105
MTDRingForwardDoubleLayer::theBasicComponents
std::vector< const GeomDet * > theBasicComponents
Definition: MTDRingForwardDoubleLayer.h:71
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
BoundDisk
SimpleDiskBounds
Definition: SimpleDiskBounds.h:11
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MTDRingForwardDoubleLayer::theRings
std::vector< const ForwardDetRing * > theRings
Definition: MTDRingForwardDoubleLayer.h:69
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
TrajectoryStateOnSurface::hasError
bool hasError() const
Definition: TrajectoryStateOnSurface.h:56
MTDRingForwardDoubleLayer::basicComponents
const std::vector< const GeomDet * > & basicComponents() const override
Definition: MTDRingForwardDoubleLayer.h:29
MeasurementEstimator.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Basic3DVector::dot
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Definition: extBasic3DVector.h:189
Point3DBase< float, GlobalTag >
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
MTDRingForwardDoubleLayer::theBackLayer
MTDRingForwardLayer theBackLayer
Definition: MTDRingForwardDoubleLayer.h:68
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
funct::true
true
Definition: Factorize.h:173
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
MTDRingForwardDoubleLayer.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MTDDetRing.h
runTheMatrix.err
err
Definition: runTheMatrix.py:288
LocalError
Definition: LocalError.h:12
MTDRingForwardDoubleLayer::compatible
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const override
Definition: MTDRingForwardDoubleLayer.cc:74
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
RingedForwardLayer
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
DetWithState
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Definition: RPCRecHitFilter.h:58
MTDRingForwardDoubleLayer::groupedCompatibleDets
std::vector< DetGroup > groupedCompatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDRingForwardDoubleLayer.cc:132
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
alignCSCRings.r
r
Definition: alignCSCRings.py:93
MTDRingForwardDoubleLayer::selfTest
void selfTest() const
Definition: MTDRingForwardDoubleLayer.cc:174
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
GeomDet.h
std
Definition: JetResolutionObject.h:76
MTDRingForwardDoubleLayer::MTDRingForwardDoubleLayer
MTDRingForwardDoubleLayer(const std::vector< const ForwardDetRing * > &frontRings, const std::vector< const ForwardDetRing * > &backRings)
Constructor, takes ownership of pointers.
Definition: MTDRingForwardDoubleLayer.cc:21
MTDRingForwardDoubleLayer::theComponents
std::vector< const GeometricSearchDet * > theComponents
Definition: MTDRingForwardDoubleLayer.h:70
MTDRingForwardDoubleLayer::theFrontLayer
MTDRingForwardLayer theFrontLayer
Definition: MTDRingForwardDoubleLayer.h:67
MTDRingForwardLayer::compatibleDets
std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDRingForwardLayer.cc:78
MTDRingForwardLayer::basicComponents
const std::vector< const GeomDet * > & basicComponents() const override
Definition: MTDRingForwardLayer.h:27
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
MTDRingForwardLayer::rings
virtual const std::vector< const ForwardDetRing * > & rings() const
Return the vector of rings.
Definition: MTDRingForwardLayer.h:45
insideOut
Definition: NavigationDirection.h:4
MTDRingForwardDoubleLayer::computeSurface
BoundDisk * computeSurface() override
Definition: MTDRingForwardDoubleLayer.cc:51
DetGroup
Definition: DetGroup.h:41
mps_fire.result
result
Definition: mps_fire.py:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
SimpleDiskBounds.h
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
MTDRingForwardDoubleLayer::isCrack
bool isCrack(const GlobalPoint &gp) const
Definition: MTDRingForwardDoubleLayer.cc:154
BoundDisk
Disk BoundDisk
Definition: BoundDisk.h:54
MTDRingForwardDoubleLayer::isInsideOut
bool isInsideOut(const TrajectoryStateOnSurface &tsos) const
Definition: MTDRingForwardDoubleLayer.cc:70
MTDDetRing
Definition: MTDDetRing.h:16
HLTSiStripMonitoring_cff.nSigma
nSigma
Definition: HLTSiStripMonitoring_cff.py:151
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43