CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripRecHit2D.cc
Go to the documentation of this file.
5 
6 
8  const DetId& id,
9  ClusterRef const & cluster):
10 
11  BaseSiTrackerRecHit2DLocalPos(pos,err,id),
12  cluster_(cluster),
13  clusterRegional_(),
14  sigmaPitch_(-1.)
15  {}
16 
17 
19  const DetId& id,
20  ClusterRegionalRef const& cluster):
21  BaseSiTrackerRecHit2DLocalPos(pos,err,id),
22  cluster_(),
23  clusterRegional_(cluster),
24  sigmaPitch_(-1.) {}
25 
26 
27 bool
29  SharedInputType what) const
30 {
31  //here we exclude non si-strip subdetectors
32  if( ((geographicalId().rawId()) >> (DetId::kSubdetOffset) ) != ( (other->geographicalId().rawId())>> (DetId::kSubdetOffset)) ) return false;
33 
34  //Protection against invalid hits
35  if(! other->isValid()) return false;
36 
37  const std::type_info & otherType = typeid(*other);
38  if (otherType == typeid(SiStripRecHit2D)) {
39  const SiStripRecHit2D* otherCast = static_cast<const SiStripRecHit2D*>(other);
40  // as 'null == null' is true, we can't just "or" the two equality tests: one of the two refs is always null! (gpetrucc)
41  if (cluster_.isNonnull()) {
42  return (cluster_ == otherCast->cluster());
43  } else {
44  return (clusterRegional_ == otherCast->cluster_regional());
45  }
46  } else if (otherType == typeid(SiStripRecHit1D)) {
47  const SiStripRecHit1D* otherCast = static_cast<const SiStripRecHit1D*>(other);
48  // as 'null == null' is true, we can't just "or" the two equality tests: one of the two refs is always null! (gpetrucc)
49  if (cluster_.isNonnull()) {
50  return (cluster_ == otherCast->cluster());
51  } else {
52  return (clusterRegional_ == otherCast->cluster_regional());
53  }
54  } else if (otherType == typeid(ProjectedSiStripRecHit2D)) {
55  const SiStripRecHit2D* otherCast = & (static_cast<const ProjectedSiStripRecHit2D*>(other)->originalHit());
56  // as 'null == null' is true, we can't just "or" the two equality tests: one of the two refs is always null! (gpetrucc)
57  if (cluster_.isNonnull()) {
58  return (cluster_ == otherCast->cluster());
59  } else {
60  return (clusterRegional_ == otherCast->cluster_regional());
61  }
62  } else if ((otherType == typeid(SiStripMatchedRecHit2D)) && (what == all)) {
63  return false;
64  } else {
65  // last resort, recur to 'recHits()', even if it returns a vector by value
66  std::vector<const TrackingRecHit*> otherHits = other->recHits();
67  int ncomponents=otherHits.size();
68  if(ncomponents==0)return false;
69  else if(ncomponents==1)return sharesInput(otherHits.front(),what);
70  else if (ncomponents>1){
71  if(what == all )return false;
72  else{
73  for(int i=0;i<ncomponents;i++){
74  if(sharesInput(otherHits[i],what))return true;
75  }
76  return false;
77  }
78  }
79  return false;
80  }
81 }
82 
SharedInputType
definition of equality via shared input
ClusterRegionalRef clusterRegional_
int i
Definition: DBlmapReader.cc:9
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
ClusterRegionalRef const & cluster_regional() const
static const int kSubdetOffset
Definition: DetId.h:23
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:249
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
Definition: DetId.h:20
ClusterRef const & cluster() const
bool isValid() const
ClusterRegionalRef const & cluster_regional() const
ClusterRef cluster_
ClusterRef const & cluster() const
DetId geographicalId() const