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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
/*
 *  See header file for a description of this class.
 *
 *  \author M. Maggi -- INFN Bari
 */

#include "DataFormats/GEMRecHit/interface/GEMRecHit.h"

GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx)
    : RecHit2DLocalPos(gemId),
      theGEMId(gemId),
      theBx(bx),
      theFirstStrip(99),
      theClusterSize(99),
      theLocalPosition(),
      theLocalError() {}

GEMRecHit::GEMRecHit()
    : RecHit2DLocalPos(),
      theGEMId(),
      theBx(99),
      theFirstStrip(99),
      theClusterSize(99),
      theLocalPosition(),
      theLocalError() {}

GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos)
    : RecHit2DLocalPos(gemId), theGEMId(gemId), theBx(bx), theFirstStrip(99), theClusterSize(99), theLocalPosition(pos) {
  float stripResolution = 3.0;  //cm  this sould be taken from trimmed cluster size times strip size
                                //    taken out from geometry service i.e. topology
  theLocalError = LocalError(stripResolution * stripResolution, 0., 0.);  //FIXME: is it really needed?
}

// Constructor from a local position and error, wireId and digi time.
GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos, const LocalError& err)
    : RecHit2DLocalPos(gemId),
      theGEMId(gemId),
      theBx(bx),
      theFirstStrip(99),
      theClusterSize(99),
      theLocalPosition(pos),
      theLocalError(err) {}

// Constructor from a local position and error, wireId, bx and cluster size.
GEMRecHit::GEMRecHit(
    const GEMDetId& gemId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err)
    : RecHit2DLocalPos(gemId),
      theGEMId(gemId),
      theBx(bx),
      theFirstStrip(firstStrip),
      theClusterSize(clustSize),
      theLocalPosition(pos),
      theLocalError(err) {}

// Destructor
GEMRecHit::~GEMRecHit() {}

GEMRecHit* GEMRecHit::clone() const { return new GEMRecHit(*this); }

// Access to component RecHits.
// No components rechits: it returns a null vector
std::vector<const TrackingRecHit*> GEMRecHit::recHits() const {
  std::vector<const TrackingRecHit*> nullvector;
  return nullvector;
}

// Non-const access to component RecHits.
// No components rechits: it returns a null vector
std::vector<TrackingRecHit*> GEMRecHit::recHits() {
  std::vector<TrackingRecHit*> nullvector;
  return nullvector;
}

// Comparison operator, based on the wireId and the digi time
bool GEMRecHit::operator==(const GEMRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); }

// The ostream operator
std::ostream& operator<<(std::ostream& os, const GEMRecHit& hit) {
  os << "pos: " << hit.localPosition().x();
  os << " +/- " << sqrt(hit.localPositionError().xx());
  return os;
}