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, double annealing):
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  annealing_ = annealing;
16 }
17 
18 
20  SharedInputType what) const
21 {
22  if(geographicalId() != other->geographicalId()&& what==all ) return false;
23  vector<const TrackingRecHit*> otherhits=other->recHits();
24  if(what==all){
25  if(theHits.size()!=other->recHits().size())return false;
26  for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
27  bool found=false;
29  if((hit)->sharesInput(*otherhit,all)){
30  found=true;
31  break;
32  }
33  }
34  if(found==false){
35  return false;
36  }
37  }
38  return true;
39  }
40  else{
42  if(otherhits.size()!=0){
43  for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
44  if((hit)->sharesInput(*otherhit,some))return true;
45  }
46  }
47  else{//otherwise it should be a single rechit
48  if((hit)->sharesInput(other,some))return true;
49  }
50  }
51  return false;
52  }
53 }
54 
55 
56 vector<const TrackingRecHit*> SiTrackerMultiRecHit::recHits() const{
57  vector<const TrackingRecHit*> myhits;
59  myhits.push_back(&*ihit);
60  }
61  return myhits;
62 }
63 
64 vector<TrackingRecHit*> SiTrackerMultiRecHit::recHits() {
65  // vector<TrackingRecHit*> myhits;
66  // for(edm::OwnVector<TrackingRecHit>::const_iterator ihit = theHits.begin(); ihit != theHits.end(); ihit++) {
67  // const TrackingRecHit* ahit = &(*ihit);
68  // myhits.push_back(const_cast<TrackingRecHit*>(ahit));
69  // }
70  return theHits.data();
71 }
72 
73 /*
74 void TrackingRecHit::recHitsV(std::vector<const TrackingRecHit*> & v) const {
75  v = recHits();
76 }
77 
78 void TrackingRecHit::recHitsV(std::vector<TrackingRecHit*> & v) {
79  v = recHits();
80 }
81 */
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:254
edm::OwnVector< TrackingRecHit > theHits
iterator begin()
Definition: OwnVector.h:234
void push_back(D *&d)
Definition: OwnVector.h:280
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:239
base const & data() const
Definition: OwnVector.h:372
DetId geographicalId() const