Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:43

0001 #ifndef SimDataFormats_TrackerDigiSimLink_StripDigiSimLink_h
0002 #define SimDataFormats_TrackerDigiSimLink_StripDigiSimLink_h
0003 
0004 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0005 #include <cstdint>
0006 
0007 class StripDigiSimLink {
0008 public:
0009   enum { LowTof, HighTof };
0010 
0011   StripDigiSimLink(
0012       unsigned int ch, unsigned int tkId, unsigned int counter, unsigned int tofBin, EncodedEventId e, float a)
0013       : chan(ch),
0014         simTkId(tkId),
0015         CFpos(tofBin == LowTof ? counter & 0x7FFFFFFF : (counter & 0x7FFFFFFF) | 0x80000000),
0016         eId(e),
0017         fract(a) {
0018     ;
0019   }
0020 
0021   StripDigiSimLink(unsigned int ch, unsigned int tkId, unsigned int counter, EncodedEventId e, float a)
0022       : chan(ch), simTkId(tkId), CFpos(counter & 0x7FFFFFFF), eId(e), fract(a) {
0023     ;
0024   }
0025 
0026   StripDigiSimLink(unsigned int ch, unsigned int tkId, EncodedEventId e, float a)
0027       : chan(ch), simTkId(tkId), CFpos(0), eId(e), fract(a) {
0028     ;
0029   }
0030 
0031   StripDigiSimLink() : chan(0), simTkId(0), CFpos(0), eId(0), fract(0) { ; }
0032 
0033   ~StripDigiSimLink() { ; }
0034 
0035   unsigned int channel() const { return chan; }
0036   unsigned int SimTrackId() const { return simTkId; }
0037   unsigned int CFposition() const { return CFpos & 0x7FFFFFFF; }
0038   unsigned int TofBin() const { return (CFpos & 0x80000000) == 0 ? LowTof : HighTof; }
0039   EncodedEventId eventId() const { return eId; }
0040   float fraction() const { return fract; }
0041 
0042   inline bool operator<(const StripDigiSimLink& other) const { return channel() < other.channel(); }
0043 
0044 private:
0045   unsigned int chan;
0046   unsigned int simTkId;
0047   uint32_t CFpos;  // position of the PSimHit in the CrossingFrame vector
0048                    // for the subdetector collection; bit 31 set if from the HighTof collection
0049   EncodedEventId eId;
0050   float fract;
0051 };
0052 #endif