CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripRecHit1D.cc
Go to the documentation of this file.
4 
6  const DetId& id,
7  ClusterRef const & cluster):
8  RecHit1D(id),pos_(pos),err_(err),
9  cluster_(cluster),
10  clusterRegional_(),
11  sigmaPitch_(-1.)
12  {}
13 
14 
16  const DetId& id,
17  ClusterRegionalRef const& cluster):
18  RecHit1D(id),pos_(pos),err_(err),
19  cluster_(),
20  clusterRegional_(cluster),
21  sigmaPitch_(-1.) {}
22 
24  RecHit1D(hit2D->geographicalId()),pos_(hit2D->localPosition()),err_(),
25  cluster_(),clusterRegional_(),sigmaPitch_(-1)
26 {
27  err_ = LocalError (hit2D->localPositionError().xx(),0.,DBL_MAX);
28  if(hit2D->cluster().isNonnull()) cluster_ = hit2D->cluster();
30 }
31 
32 
34  return (err_.xx() != 0) || (err_.yy() != 0) || (err_.xy() != 0) ||
35  (pos_.x() != 0) || (pos_.y() != 0) || (pos_.z() != 0);
36 }
37 
39  if (!hasPositionAndError()) throwExceptionUninitialized("localPosition");
40  return pos_;
41 }
42 
44  if (!hasPositionAndError()) throwExceptionUninitialized("localPositionError");
45  return err_;
46 }
47 
48 void
50 {
51  if (!hasPositionAndError()) throwExceptionUninitialized("getKfComponents");
52  AlgebraicVector1 & pars = holder.params<1>();
53  pars[0] = pos_.x();
54 
55  AlgebraicSymMatrix11 & errs = holder.errors<1>();
56  errs(0,0) = err_.xx();
57 
58  AlgebraicMatrix15 & proj = holder.projection<1>();
59  proj(0,3) = 1;
60 
61  holder.measuredParams<1>() = AlgebraicVector1( holder.tsosLocalParameters().At(3) );
62  holder.measuredErrors<1>() = holder.tsosLocalErrors().Sub<AlgebraicSymMatrix11>( 3, 3 );
63 }
64 
65 
66 
67 bool
69  SharedInputType what) const
70 {
71  //here we exclude non si-strip subdetectors
72  if( ((geographicalId().rawId()) >> (DetId::kSubdetOffset) ) != ( (other->geographicalId().rawId())>> (DetId::kSubdetOffset)) ) return false;
73 
74  //Protection against invalid hits
75  if(! other->isValid()) return false;
76 
77  const std::type_info & otherType = typeid(*other);
78  if (otherType == typeid(SiStripRecHit2D)) {
79  const SiStripRecHit2D* otherCast = static_cast<const SiStripRecHit2D*>(other);
80  // as 'null == null' is true, we can't just "or" the two equality tests: one of the two refs is always null! (gpetrucc)
81  if (cluster_.isNonnull()) {
82  return (cluster_ == otherCast->cluster());
83  } else {
84  return (clusterRegional_ == otherCast->cluster_regional());
85  }
86  } else if (otherType == typeid(SiStripRecHit1D)) {
87  const SiStripRecHit1D* otherCast = static_cast<const SiStripRecHit1D*>(other);
88  // as 'null == null' is true, we can't just "or" the two equality tests: one of the two refs is always null! (gpetrucc)
89  if (cluster_.isNonnull()) {
90  return (cluster_ == otherCast->cluster());
91  } else {
92  return (clusterRegional_ == otherCast->cluster_regional());
93  }
94  } else if (otherType == typeid(ProjectedSiStripRecHit2D)) {
95  const SiStripRecHit2D* otherCast = & (static_cast<const ProjectedSiStripRecHit2D*>(other)->originalHit());
96  // as 'null == null' is true, we can't just "or" the two equality tests: one of the two refs is always null! (gpetrucc)
97  if (cluster_.isNonnull()) {
98  return (cluster_ == otherCast->cluster());
99  } else {
100  return (clusterRegional_ == otherCast->cluster_regional());
101  }
102  } else if ((otherType == typeid(SiStripMatchedRecHit2D)) && (what == all)) {
103  return false;
104  } else {
105  // last resort, recur to 'recHits()', even if it returns a vector by value
106  std::vector<const TrackingRecHit*> otherHits = other->recHits();
107  int ncomponents=otherHits.size();
108  if(ncomponents==0)return false;
109  else if(ncomponents==1)return sharesInput(otherHits.front(),what);
110  else if (ncomponents>1){
111  if(what == all )return false;
112  else{
113  for(int i=0;i<ncomponents;i++){
114  if(sharesInput(otherHits[i],what))return true;
115  }
116  return false;
117  }
118  }
119  return false;
120  }
121 }
122 
123 
124 std::vector<const TrackingRecHit*> SiStripRecHit1D::recHits() const {
125  std::vector<const TrackingRecHit*> nullvector;
126  return nullvector;
127 }
128 std::vector<TrackingRecHit*> SiStripRecHit1D::recHits() {
129  std::vector<TrackingRecHit*> nullvector;
130  return nullvector;
131 }
132 
133 void
135 {
136  throw cms::Exception("SiStripRecHit1D") <<
137  "Trying to access " << where << " for a RecHit that was read from disk, but since CMSSW_2_1_X local positions are transient.\n" <<
138  "If you want to get coarse position/error estimation from disk, please set: ComputeCoarseLocalPositionFromDisk = True \n " <<
139  " to the TransientTrackingRecHitBuilder you are using from RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py";
140 }
SharedInputType
definition of equality via shared input
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:19
virtual LocalError localPositionError() const
AlgebraicROOTObject< D, D >::SymMatrix & measuredErrors()
ClusterRef cluster_
ROOT::Math::SVector< double, 1 > AlgebraicVector1
bool hasPositionAndError() const
T y() const
Definition: PV3DBase.h:57
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
ClusterRegionalRef const & cluster_regional() const
virtual void getKfComponents(KfComponentsHolder &holder) const
static const int kSubdetOffset
Definition: DetId.h:23
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void throwExceptionUninitialized(const char *where) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:249
float xy() const
Definition: LocalError.h:20
float yy() const
Definition: LocalError.h:21
T z() const
Definition: PV3DBase.h:58
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
ROOT::Math::SMatrix< double, 1, 5, ROOT::Math::MatRepStd< double, 1, 5 > > AlgebraicMatrix15
virtual LocalError localPositionError() const
Error on the local position.
virtual LocalPoint localPosition() const
Local position.
AlgebraicROOTObject< D >::Vector & params()
Definition: DetId.h:20
ClusterRef const & cluster() const
bool isValid() const
const AlgebraicVector5 & tsosLocalParameters() const
ClusterRegionalRef const & cluster_regional() const
AlgebraicROOTObject< D >::Vector & measuredParams()
ClusterRef const & cluster() const
DetId geographicalId() const
AlgebraicROOTObject< D, D >::SymMatrix & errors()
AlgebraicROOTObject< D, 5 >::Matrix & projection()
T x() const
Definition: PV3DBase.h:56
const AlgebraicSymMatrix55 & tsosLocalErrors() const
ClusterRegionalRef clusterRegional_
ROOT::Math::SMatrix< double, 1, 1, ROOT::Math::MatRepSym< double, 1 > > AlgebraicSymMatrix11