Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:20

0001 #ifndef FastSingleTrackerRecHit_H
0002 #define FastSingleTrackerRecHit_H
0003 
0004 #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h"
0005 #include <cstdint>
0006 
0007 class FastSingleTrackerRecHit : public FastTrackerRecHit {
0008 public:
0009   FastSingleTrackerRecHit() : FastTrackerRecHit(), id_(-1), eventId_(0) {}
0010 
0011   FastSingleTrackerRecHit(const LocalPoint& p,
0012                           const LocalError& e,
0013                           GeomDet const& idet,
0014                           fastTrackerRecHitType::HitType hitType)
0015       : FastTrackerRecHit(p, e, idet, hitType), id_(-1), eventId_(0) {}
0016 
0017 public:
0018   FastSingleTrackerRecHit* clone() const override {
0019     FastSingleTrackerRecHit* p = new FastSingleTrackerRecHit(*this);
0020     p->load();
0021     return p;
0022   }
0023 
0024   size_t nIds() const override { return 1; }
0025   int32_t id(size_t i = 0) const override { return i == 0 ? id_ : -1; }
0026   int32_t eventId(size_t i = 0) const override { return i == 0 ? eventId_ : -1; }
0027   size_t nSimTrackIds() const override { return simTrackIds_.size(); }  ///< see addSimTrackId(int32_t simTrackId)
0028   int32_t simTrackId(size_t i) const override {
0029     return i < simTrackIds_.size() ? simTrackIds_[i] : -1;
0030   }  ///< see addSimTrackId(int32_t simTrackId)
0031   int32_t simTrackEventId(size_t i) const override {
0032     return i < simTrackIds_.size() ? eventId_ : -1;
0033   }  ///< see addSimTrackId(int32_t simTrackId)
0034 
0035   /// add an id number to the list of id numbers of SimTracks from which the hit originates
0036   /// the SimTrack id numbers are the indices of the SimTracks in the SimTrack collection
0037   void addSimTrackId(int32_t simTrackId) { simTrackIds_.push_back(simTrackId); }
0038 
0039   /// set the hit id number
0040   /// for any particular hit in any particular event,
0041   // the hit id number must be unique within the list of hits in the event
0042   void setId(int32_t id) { id_ = id; }
0043 
0044   /// set the hit's event number
0045   /// there is in principle no reason to play with this variable outside the PU mixing modules
0046   /// see Adjuster::doTheOffset(int bunchSpace, int bcr, TrackingRecHitCollection & trackingrechits, unsigned int evtNr, int vertexOffset)
0047   void setEventId(int32_t eventId) override { eventId_ = eventId; }
0048 
0049 private:
0050   int32_t id_;                        ///< see setId(int32_t id)
0051   int32_t eventId_;                   ///< see setEeId(int32_t eeid)
0052   std::vector<int32_t> simTrackIds_;  ///< see addSimTrackIds(int32_t)
0053 };
0054 
0055 #endif