CMS 3D CMS Logo

GEMCSCSegment.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 
10 namespace {
11  // Get CSCDetId from one of the rechits, but then remove the layer part so it's a _chamber_ id
12  inline DetId buildDetId(CSCDetId id) { return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), 0); }
13 } // namespace
14 
16  // Aider class to make the return of the projection Matrix thread-safe
17 protected:
19 
20 public:
22  theProjectionMatrix[0][1] = 1;
23  theProjectionMatrix[1][2] = 1;
24  theProjectionMatrix[2][3] = 1;
25  theProjectionMatrix[3][4] = 1;
26  }
27  const AlgebraicMatrix& getMatrix() const { return (theProjectionMatrix); }
28 };
29 
31  const std::vector<const GEMRecHit*> gem_rhs,
32  LocalPoint origin,
33  LocalVector direction,
35  double chi2)
36  :
37 
38  RecSegment(buildDetId(csc_segment->cscDetId())),
39  theOrigin(origin),
40  theLocalDirection(direction),
41  theCovMatrix(errors),
42  theChi2(chi2) {
43  for (unsigned int i = 0; i < gem_rhs.size(); ++i) {
44  theGEMRecHits.push_back((*gem_rhs[i]));
45  }
46  theCSCSegment = *csc_segment;
47  // LogDebug
48  edm::LogVerbatim("GEMCSCSegment")
49  << "[GEMCSCSegment :: ctor] CSCDetId: " << csc_segment->cscDetId()
50  << " CSC RecHits: " << csc_segment->specificRecHits().size() << " GEM RecHits: " << gem_rhs.size()
51  << "\n" // << " Fit chi2: "<<chi2<<" Position: "<<origin<<" Direction: "<<direction
52  << " CSC Segment Details: \n"
53  << *csc_segment << "\n"
54  << " GEMCSC Segment Details: \n"
55  << *this << "\n"
56  << "[GEMCSCSegment :: ctor] ------------------------------------------------------------";
57 }
58 
60 
61 std::vector<const TrackingRecHit*> GEMCSCSegment::recHits() const {
62  std::vector<const TrackingRecHit*> pointersOfRecHits;
63  for (std::vector<GEMRecHit>::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
64  pointersOfRecHits.push_back(&(*irh));
65  }
66  for (std::vector<CSCRecHit2D>::const_iterator irh = theCSCSegment.specificRecHits().begin();
67  irh != theCSCSegment.specificRecHits().end();
68  ++irh) {
69  pointersOfRecHits.push_back(&(*irh));
70  }
71  return pointersOfRecHits;
72 }
73 
74 std::vector<TrackingRecHit*> GEMCSCSegment::recHits() {
75  std::vector<TrackingRecHit*> pointersOfRecHits;
76  for (std::vector<GEMRecHit>::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
77  pointersOfRecHits.push_back(&(*irh));
78  }
79  return pointersOfRecHits;
80 }
81 
83  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
84 }
85 
87  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
88 }
89 
91  // For consistency with DT, CSC and what we require for the TrackingRecHit interface,
92  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
93 
95  if (theLocalDirection.z() != 0) {
98  }
99  result[2] = theOrigin.x();
100  result[3] = theOrigin.y();
101  return result;
102 }
103 
106  return (theProjectionMatrix.getMatrix());
107 }
108 
109 std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg) {
110  os << "GEMCSCSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx())
111  << "," << sqrt(seg.localPositionError().yy()) << "0,)\n"
112  << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << ","
113  << sqrt(seg.localDirectionError().yy()) << "0,)\n"
114  << " chi2/ndf = "
115  << ((seg.degreesOfFreedom() != 0) ? (seg.chi2() / double(seg.degreesOfFreedom())) : 0.0)
116  << " #rechits = " << seg.nRecHits();
117  return os;
118 }
CSCSegment::specificRecHits
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:66
Vector3DBase< float, LocalTag >
mps_fire.i
i
Definition: mps_fire.py:355
GEMCSCSegment::projectionMatrix
AlgebraicMatrix projectionMatrix() const override
The projection matrix relates the trajectory state parameters to the segment parameters().
Definition: GEMCSCSegment.cc:104
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
relativeConstraints.station
station
Definition: relativeConstraints.py:67
RecSegment
Definition: RecSegment.h:27
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
GEMCSCSegment::chi2
double chi2() const override
Chi2 of the segment fit.
Definition: GEMCSCSegment.h:60
ProjectionMatrixDiag
Definition: GEMCSCSegment.cc:15
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
GEMCSCSegment::recHits
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: GEMCSCSegment.cc:61
errors
Definition: errors.py:1
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
LocalError::xx
float xx() const
Definition: LocalError.h:22
GEMCSCSegment::nRecHits
int nRecHits() const
Definition: GEMCSCSegment.h:66
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GEMCSCSegment::theLocalDirection
LocalVector theLocalDirection
Definition: GEMCSCSegment.h:93
GEMCSCSegment::parameters
AlgebraicVector parameters() const override
Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
Definition: GEMCSCSegment.cc:90
Point3DBase< float, LocalTag >
CSCSegment
Definition: CSCSegment.h:21
GEMCSCSegment
Definition: GEMCSCSegment.h:26
ProjectionMatrixDiag::getMatrix
const AlgebraicMatrix & getMatrix() const
Definition: GEMCSCSegment.cc:27
LocalError
Definition: LocalError.h:12
GEMCSCSegment::theGEMRecHits
std::vector< GEMRecHit > theGEMRecHits
Definition: GEMCSCSegment.h:86
CSCDetId
Definition: CSCDetId.h:26
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GEMCSCSegment::localDirectionError
LocalError localDirectionError() const override
Error on the local direction.
Definition: GEMCSCSegment.cc:86
GEMCSCSegment::localPositionError
LocalError localPositionError() const override
Definition: GEMCSCSegment.cc:82
edm::LogVerbatim
Definition: MessageLogger.h:297
ProjectionMatrixDiag::theProjectionMatrix
AlgebraicMatrix theProjectionMatrix
Definition: GEMCSCSegment.cc:18
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
GEMCSCSegment::~GEMCSCSegment
~GEMCSCSegment() override
Destructor.
Definition: GEMCSCSegment.cc:59
GEMCSCSegment::theOrigin
LocalPoint theOrigin
Definition: GEMCSCSegment.h:92
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
GEMCSCSegment::theCSCSegment
CSCSegment theCSCSegment
Definition: GEMCSCSegment.h:87
GEMCSCSegment::localPosition
LocalPoint localPosition() const override
Definition: GEMCSCSegment.h:45
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
operator<<
std::ostream & operator<<(std::ostream &os, const GEMCSCSegment &seg)
Definition: GEMCSCSegment.cc:109
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
theProjectionMatrix
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:79
CSCSegment::cscDetId
CSCDetId cscDetId() const
Definition: CSCSegment.h:70
GEMCSCSegment.h
mps_fire.result
result
Definition: mps_fire.py:303
GEMCSCSegment::localDirection
LocalVector localDirection() const override
Local direction.
Definition: GEMCSCSegment.h:48
GEMCSCSegment::GEMCSCSegment
GEMCSCSegment()
Default constructor.
Definition: GEMCSCSegment.h:29
ProjectionMatrixDiag::ProjectionMatrixDiag
ProjectionMatrixDiag()
Definition: GEMCSCSegment.cc:21
LocalError::yy
float yy() const
Definition: LocalError.h:24
GEMCSCSegment::degreesOfFreedom
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: GEMCSCSegment.h:64
GEMCSCSegment::theCovMatrix
AlgebraicSymMatrix theCovMatrix
Definition: GEMCSCSegment.h:94