CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiTrackerMultiRecHit.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace edm;
5 
7  const LocalError& err,
8  GeomDet const& idet,
9  const std::vector<std::pair<const TrackingRecHit*, float> >& aHitMap,
10  double annealing)
11  : BaseTrackerRecHit(pos, err, idet, trackerHitRTTI::multi) {
12  for (std::vector<std::pair<const TrackingRecHit*, float> >::const_iterator ihit = aHitMap.begin();
13  ihit != aHitMap.end();
14  ihit++) {
15  theHits.push_back(ihit->first->clone());
16  theWeights.push_back(ihit->second);
17  }
18  annealing_ = annealing;
19 }
20 
22  if (geographicalId() != other->geographicalId() && what == all)
23  return false;
24  vector<const TrackingRecHit*> otherhits = other->recHits();
25  if (what == all) {
26  if (theHits.size() != other->recHits().size())
27  return false;
28  for (vector<const TrackingRecHit*>::iterator otherhit = otherhits.begin(); otherhit != otherhits.end();
29  ++otherhit) {
30  bool found = false;
32  if ((hit)->sharesInput(*otherhit, all)) {
33  found = true;
34  break;
35  }
36  }
37  if (found == false) {
38  return false;
39  }
40  }
41  return true;
42  } else {
44  if (!otherhits.empty()) {
45  for (vector<const TrackingRecHit*>::iterator otherhit = otherhits.begin(); otherhit != otherhits.end();
46  ++otherhit) {
47  if ((hit)->sharesInput(*otherhit, some))
48  return true;
49  }
50  } else { //otherwise it should be a single rechit
51  if ((hit)->sharesInput(other, some))
52  return true;
53  }
54  }
55  return false;
56  }
57 }
58 
59 vector<const TrackingRecHit*> SiTrackerMultiRecHit::recHits() const {
60  vector<const TrackingRecHit*> myhits;
61  for (edm::OwnVector<TrackingRecHit>::const_iterator ihit = theHits.begin(); ihit != theHits.end(); ihit++) {
62  myhits.push_back(&*ihit);
63  }
64  return myhits;
65 }
66 
67 vector<TrackingRecHit*> SiTrackerMultiRecHit::recHits() { return theHits.data(); }
68 
70  //supposing all the hits inside of a MRH have the same id == same type
71  int randomComponent = 0;
72  if (theHits[randomComponent].dimension() == 1) {
73  return 1;
74  } else if (theHits[randomComponent].dimension() == 2) {
75  return 2;
76  } else {
77  return 0;
78  }
79 }
80 
82  if (dimension() == 1)
83  getKfComponents1D(holder);
84  if (dimension() == 2)
85  getKfComponents2D(holder);
86 }
SharedInputType
definition of equality via shared input
size_type size() const
Definition: OwnVector.h:300
BaseTrackerRecHit const * hit() const final
edm::OwnVector< TrackingRecHit > theHits
iterator begin()
Definition: OwnVector.h:280
void push_back(D *&d)
Definition: OwnVector.h:326
void getKfComponents2D(KfComponentsHolder &holder) const
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
std::vector< float > theWeights
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const override
iterator end()
Definition: OwnVector.h:285
void getKfComponents(KfComponentsHolder &holder) const override
void getKfComponents1D(KfComponentsHolder &holder) const
base const & data() const
Definition: OwnVector.h:476
DetId geographicalId() const
int dimension() const override
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)