|
| 1 | +#ifndef PixelSimHitExtraInfoLite_h |
| 2 | +#define PixelSimHitExtraInfoLite_h |
| 3 | + |
| 4 | +#include "DataFormats/GeometryVector/interface/LocalPoint.h" |
| 5 | +#include "DataFormats/Math/interface/libminifloat.h" |
| 6 | +#include <vector> |
| 7 | +#include <cstdint> |
| 8 | + |
| 9 | +class PixelSimHitExtraInfoLite { |
| 10 | +public: |
| 11 | + PixelSimHitExtraInfoLite(size_t Hindex, const Local3DPoint& entryP, const Local3DPoint& exitP, unsigned int ch) { |
| 12 | + index_ = Hindex; |
| 13 | + // theEntryPoint_ = entryP; |
| 14 | + // theExitPoint_ = exitP; |
| 15 | + theEntryPointX_ = MiniFloatConverter::float32to16(entryP.x()); |
| 16 | + theEntryPointY_ = MiniFloatConverter::float32to16(entryP.y()); |
| 17 | + theEntryPointZ_ = MiniFloatConverter::float32to16(entryP.z()); |
| 18 | + theExitPointX_ = MiniFloatConverter::float32to16(exitP.x()); |
| 19 | + theExitPointY_ = MiniFloatConverter::float32to16(exitP.y()); |
| 20 | + theExitPointZ_ = MiniFloatConverter::float32to16(exitP.z()); |
| 21 | + chan_.push_back(ch); |
| 22 | + }; |
| 23 | + PixelSimHitExtraInfoLite() = default; |
| 24 | + ~PixelSimHitExtraInfoLite() = default; |
| 25 | + size_t hitIndex() const { return index_; }; |
| 26 | + const uint16_t& entryPointX() const { return theEntryPointX_; } |
| 27 | + const uint16_t& entryPointY() const { return theEntryPointY_; } |
| 28 | + const uint16_t& entryPointZ() const { return theEntryPointZ_; } |
| 29 | + const uint16_t& exitPointX() const { return theExitPointX_; } |
| 30 | + const uint16_t& exitPointY() const { return theExitPointY_; } |
| 31 | + const uint16_t& exitPointZ() const { return theExitPointZ_; } |
| 32 | + |
| 33 | + Local3DPoint& entryPoint() { |
| 34 | + UncompressedEntryPoint_ = Local3DPoint(MiniFloatConverter::float16to32(theEntryPointX_), |
| 35 | + MiniFloatConverter::float16to32(theEntryPointY_), |
| 36 | + MiniFloatConverter::float16to32(theEntryPointZ_)); |
| 37 | + return UncompressedEntryPoint_; |
| 38 | + } |
| 39 | + Local3DPoint& exitPoint() { |
| 40 | + UncompressedExitPoint_ = Local3DPoint(MiniFloatConverter::float16to32(theExitPointX_), |
| 41 | + MiniFloatConverter::float16to32(theExitPointY_), |
| 42 | + MiniFloatConverter::float16to32(theExitPointZ_)); |
| 43 | + return UncompressedExitPoint_; |
| 44 | + } |
| 45 | + |
| 46 | + const std::vector<unsigned int>& channel() const { return chan_; }; |
| 47 | + |
| 48 | + inline bool operator<(const PixelSimHitExtraInfoLite& other) const { return hitIndex() < other.hitIndex(); } |
| 49 | + |
| 50 | + void addDigiInfo(unsigned int theDigiChannel) { chan_.push_back(theDigiChannel); } |
| 51 | + bool isInTheList(unsigned int channelToCheck) { |
| 52 | + bool result_in_the_list = false; |
| 53 | + for (unsigned int icheck = 0; icheck < chan_.size(); icheck++) { |
| 54 | + if (channelToCheck == chan_[icheck]) { |
| 55 | + result_in_the_list = true; |
| 56 | + break; |
| 57 | + } |
| 58 | + } |
| 59 | + return result_in_the_list; |
| 60 | + } |
| 61 | + |
| 62 | +private: |
| 63 | + size_t index_; |
| 64 | + uint16_t theEntryPointX_; |
| 65 | + uint16_t theEntryPointY_; |
| 66 | + uint16_t theEntryPointZ_; |
| 67 | + uint16_t theExitPointX_; |
| 68 | + uint16_t theExitPointY_; |
| 69 | + uint16_t theExitPointZ_; |
| 70 | + Local3DPoint UncompressedEntryPoint_; |
| 71 | + Local3DPoint UncompressedExitPoint_; |
| 72 | + std::vector<unsigned int> chan_; |
| 73 | +}; |
| 74 | +#endif |
0 commit comments