FastSingleTrackerRecHit

Macros

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
#ifndef FastSingleTrackerRecHit_H
#define FastSingleTrackerRecHit_H

#include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h"
#include <cstdint>

class FastSingleTrackerRecHit : public FastTrackerRecHit {
public:
  FastSingleTrackerRecHit() : FastTrackerRecHit(), id_(-1), eventId_(0) {}

  FastSingleTrackerRecHit(const LocalPoint& p,
                          const LocalError& e,
                          GeomDet const& idet,
                          fastTrackerRecHitType::HitType hitType)
      : FastTrackerRecHit(p, e, idet, hitType), id_(-1), eventId_(0) {}

public:
  FastSingleTrackerRecHit* clone() const override {
    FastSingleTrackerRecHit* p = new FastSingleTrackerRecHit(*this);
    p->load();
    return p;
  }

  size_t nIds() const override { return 1; }
  int32_t id(size_t i = 0) const override { return i == 0 ? id_ : -1; }
  int32_t eventId(size_t i = 0) const override { return i == 0 ? eventId_ : -1; }
  size_t nSimTrackIds() const override { return simTrackIds_.size(); }  ///< see addSimTrackId(int32_t simTrackId)
  int32_t simTrackId(size_t i) const override {
    return i < simTrackIds_.size() ? simTrackIds_[i] : -1;
  }  ///< see addSimTrackId(int32_t simTrackId)
  int32_t simTrackEventId(size_t i) const override {
    return i < simTrackIds_.size() ? eventId_ : -1;
  }  ///< see addSimTrackId(int32_t simTrackId)

  /// add an id number to the list of id numbers of SimTracks from which the hit originates
  /// the SimTrack id numbers are the indices of the SimTracks in the SimTrack collection
  void addSimTrackId(int32_t simTrackId) { simTrackIds_.push_back(simTrackId); }

  /// set the hit id number
  /// for any particular hit in any particular event,
  // the hit id number must be unique within the list of hits in the event
  void setId(int32_t id) { id_ = id; }

  /// set the hit's event number
  /// there is in principle no reason to play with this variable outside the PU mixing modules
  /// see Adjuster::doTheOffset(int bunchSpace, int bcr, TrackingRecHitCollection & trackingrechits, unsigned int evtNr, int vertexOffset)
  void setEventId(int32_t eventId) override { eventId_ = eventId; }

private:
  int32_t id_;                        ///< see setId(int32_t id)
  int32_t eventId_;                   ///< see setEeId(int32_t eeid)
  std::vector<int32_t> simTrackIds_;  ///< see addSimTrackIds(int32_t)
};

#endif