CMS 3D CMS Logo

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