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 
7 SiTrackerMultiRecHit::SiTrackerMultiRecHit(const LocalPoint& pos, const LocalError& err, const DetId& id, const std::vector< std::pair<const TrackingRecHit*, float> >& aHitMap):
9 {
10  for(std::vector<std::pair<const TrackingRecHit*, float> >::const_iterator ihit = aHitMap.begin(); ihit != aHitMap.end(); ihit++){
11  theHits.push_back(ihit->first->clone());
12  theWeights.push_back(ihit->second);
13  }
14 }
15 
16 float SiTrackerMultiRecHit::weight(unsigned int i) const {
17  if (i < theWeights.size()) return theWeights[i];
18  edm::LogError("SiTrackerMultiRecHit") << "You are requesting a the weight for a hit out of range, returning 0";
19  return 0;
20 }
21 
22 
24  SharedInputType what) const
25 {
26  if(geographicalId() != other->geographicalId()&& what==all ) return false;
27  vector<const TrackingRecHit*> otherhits=other->recHits();
28  if(what==all){
29  if(theHits.size()!=other->recHits().size())return false;
30  for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
31  bool found=false;
33  if((hit)->sharesInput(*otherhit,all)){
34  found=true;
35  break;
36  }
37  }
38  if(found==false){
39  return false;
40  }
41  }
42  return true;
43  }
44  else{
46  if(otherhits.size()!=0){
47  for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
48  if((hit)->sharesInput(*otherhit,some))return true;
49  }
50  }
51  else{//otherwise it should be a simple rechit
52  if((hit)->sharesInput(other,some))return true;
53  }
54  }
55  return false;
56  }
57 }
58 
59 
60 vector<const TrackingRecHit*> SiTrackerMultiRecHit::recHits() const{
61  vector<const TrackingRecHit*> myhits;
63  myhits.push_back(&*ihit);
64  }
65  return myhits;
66 }
67 
68 vector<TrackingRecHit*> SiTrackerMultiRecHit::recHits() {
69  // vector<TrackingRecHit*> myhits;
70 // for(edm::OwnVector<TrackingRecHit>::const_iterator ihit = theHits.begin(); ihit != theHits.end(); ihit++) {
71 // const TrackingRecHit* ahit = &(*ihit);
72 // myhits.push_back(const_cast<TrackingRecHit*>(ahit));
73 // }
74  return theHits.data();
75 }
SharedInputType
definition of equality via shared input
int i
Definition: DBlmapReader.cc:9
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
virtual float weight() const
size_type size() const
Definition: OwnVector.h:260
edm::OwnVector< TrackingRecHit > theHits
iterator begin()
Definition: OwnVector.h:234
void push_back(D *&d)
Definition: OwnVector.h:288
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
Definition: DetId.h:20
iterator end()
Definition: OwnVector.h:241
base const & data() const
Definition: OwnVector.h:391
DetId geographicalId() const