CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiTrackerMultiRecHit.cc
Go to the documentation of this file.
3 
4 using namespace std;
5 using namespace edm;
6 
8  const std::vector< std::pair<const TrackingRecHit*, float> >& aHitMap):
9  BaseTrackerRecHit(pos,err, idet,trackerHitRTTI::multi)
10 {
11  for(std::vector<std::pair<const TrackingRecHit*, float> >::const_iterator ihit = aHitMap.begin(); ihit != aHitMap.end(); ihit++){
12  theHits.push_back(ihit->first->clone());
13  theWeights.push_back(ihit->second);
14  }
15 }
16 
17 
19  SharedInputType what) const
20 {
21  if(geographicalId() != other->geographicalId()&& what==all ) return false;
22  vector<const TrackingRecHit*> otherhits=other->recHits();
23  if(what==all){
24  if(theHits.size()!=other->recHits().size())return false;
25  for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
26  bool found=false;
28  if((hit)->sharesInput(*otherhit,all)){
29  found=true;
30  break;
31  }
32  }
33  if(found==false){
34  return false;
35  }
36  }
37  return true;
38  }
39  else{
41  if(otherhits.size()!=0){
42  for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
43  if((hit)->sharesInput(*otherhit,some))return true;
44  }
45  }
46  else{//otherwise it should be a single rechit
47  if((hit)->sharesInput(other,some))return true;
48  }
49  }
50  return false;
51  }
52 }
53 
54 
55 vector<const TrackingRecHit*> SiTrackerMultiRecHit::recHits() const{
56  vector<const TrackingRecHit*> myhits;
58  myhits.push_back(&*ihit);
59  }
60  return myhits;
61 }
62 
63 vector<TrackingRecHit*> SiTrackerMultiRecHit::recHits() {
64  // vector<TrackingRecHit*> myhits;
65  // for(edm::OwnVector<TrackingRecHit>::const_iterator ihit = theHits.begin(); ihit != theHits.end(); ihit++) {
66  // const TrackingRecHit* ahit = &(*ihit);
67  // myhits.push_back(const_cast<TrackingRecHit*>(ahit));
68  // }
69  return theHits.data();
70 }
SharedInputType
definition of equality via shared input
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
BaseTrackerRecHit const * hit() const
size_type size() const
Definition: OwnVector.h:248
edm::OwnVector< TrackingRecHit > theHits
iterator begin()
Definition: OwnVector.h:228
void push_back(D *&d)
Definition: OwnVector.h:274
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
std::vector< float > theWeights
iterator end()
Definition: OwnVector.h:233
base const & data() const
Definition: OwnVector.h:366
DetId geographicalId() const