Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
#include "DataFormats/TrackingRecHit/interface/KfComponentsHolder.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"

#include "FWCore/Utilities/interface/Exception.h"
#include <string>
#include <typeinfo>

void TrackingRecHit::recHitsV(std::vector<const TrackingRecHit*>& v) const { v = recHits(); }
void TrackingRecHit::recHitsV(std::vector<TrackingRecHit*>& v) { v = recHits(); }

bool TrackingRecHit::sharesInput(const TrackingRecHit* other, SharedInputType what) const {
  //
  // for the time being: don't force implementation in all derived classes
  // but throw exception to indicate missing implementation
  //
  std::string msg("Missing implementation of TrackingRecHit::sharedInput in ");
  msg += typeid(*this).name();
  throw cms::Exception(msg);
  return false;
}

void TrackingRecHit::getKfComponents(KfComponentsHolder& holder) const { holder.genericFill(*this); }

namespace {
  inline void throwError() { throw cms::Exception("Global coordinates missing from this TrackingRecHit used"); }
}  // namespace

const GeomDetUnit* TrackingRecHit::detUnit() const { return det(); }

GlobalPoint TrackingRecHit::globalPosition() const {
  throwError();
  return GlobalPoint();
}
GlobalError TrackingRecHit::globalPositionError() const {
  throwError();
  return GlobalError();
}

float TrackingRecHit::errorGlobalR() const {
  throwError();
  return 0;
}
float TrackingRecHit::errorGlobalZ() const {
  throwError();
  return 0;
}
float TrackingRecHit::errorGlobalRPhi() const {
  throwError();
  return 0;
}