File indexing completed on 2024-09-10 02:59:05
0001 #ifndef TRACKINGOBJECTS_PIXELDIGISIMLINK_H
0002 #define TRACKINGOBJECTS_PIXELDIGISIMLINK_H
0003
0004 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0005 #include <cstdint>
0006
0007
0008 class PixelDigiSimLink {
0009 public:
0010 enum { LowTof, HighTof };
0011
0012 PixelDigiSimLink(
0013 unsigned int ch, unsigned int tkId, unsigned int counter, unsigned int tofBin, EncodedEventId e, float a) {
0014 chan = ch;
0015 simTkId = tkId;
0016 CFpos = tofBin == LowTof ? counter & 0x7FFFFFFF : (counter & 0x7FFFFFFF) | 0x80000000;
0017 fract = a;
0018 eId = e;
0019 };
0020 PixelDigiSimLink(unsigned int ch, unsigned int tkId, EncodedEventId e, float a) {
0021 chan = ch;
0022 simTkId = tkId;
0023 CFpos = 0;
0024 fract = a;
0025 eId = e;
0026 };
0027 PixelDigiSimLink() : eId(0) {
0028 chan = 0;
0029 simTkId = 0;
0030 CFpos = 0;
0031 fract = 0;
0032 };
0033 ~PixelDigiSimLink() {}
0034 unsigned int channel() const { return chan; };
0035 unsigned int SimTrackId() const { return simTkId; };
0036 unsigned int CFposition() const { return CFpos & 0x7FFFFFFF; }
0037 unsigned int TofBin() const { return (CFpos & 0x80000000) == 0 ? LowTof : HighTof; }
0038 EncodedEventId eventId() const { return eId; }
0039 float fraction() const { return fract; };
0040
0041 inline bool operator<(const PixelDigiSimLink& other) const { return fraction() < other.fraction(); }
0042
0043 private:
0044 unsigned int chan;
0045 unsigned int simTkId;
0046 uint32_t CFpos;
0047
0048 EncodedEventId eId;
0049 float fract;
0050 };
0051 #endif