Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:14

0001 #ifndef FUN4ALLRAW_MICROMEGASRAWTHITV2_H
0002 #define FUN4ALLRAW_MICROMEGASRAWTHITV2_H
0003 
0004 #include "MicromegasRawHit.h"
0005 
0006 #include <phool/PHObject.h>
0007 
0008 #include <cassert>
0009 #include <limits>
0010 #include <map>
0011 
0012 class MicromegasRawHitv2 : public MicromegasRawHit
0013 {
0014  public:
0015   explicit MicromegasRawHitv2() = default;
0016   explicit MicromegasRawHitv2(MicromegasRawHit *);
0017 
0018   /** identify Function from PHObject
0019       @param os Output Stream
0020    */
0021   void identify(std::ostream &os = std::cout) const override;
0022 
0023   void Clear(Option_t *) override;
0024 
0025   uint64_t get_bco() const override { return bco; }
0026   // cppcheck-suppress virtualCallInConstructor
0027   void set_bco(const uint64_t val) override { bco = val; }
0028 
0029   uint64_t get_gtm_bco() const override { return gtm_bco; }
0030   // cppcheck-suppress virtualCallInConstructor
0031   void set_gtm_bco(const uint64_t val) override { gtm_bco = val; }
0032 
0033   int32_t get_packetid() const override { return packetid; }
0034   // cppcheck-suppress virtualCallInConstructor
0035   void set_packetid(const int32_t val) override { packetid = val; }
0036 
0037   uint16_t get_fee() const override { return fee; }
0038   // cppcheck-suppress virtualCallInConstructor
0039   void set_fee(const uint16_t val) override { fee = val; }
0040 
0041   uint16_t get_channel() const override { return channel; }
0042   // cppcheck-suppress virtualCallInConstructor
0043   void set_channel(const uint16_t val) override { channel = val; }
0044 
0045   uint16_t get_sampaaddress() const override { return sampaaddress; }
0046   // cppcheck-suppress virtualCallInConstructor
0047   void set_sampaaddress(const uint16_t val) override { sampaaddress = val; }
0048 
0049   uint16_t get_sampachannel() const override { return sampachannel; }
0050   // cppcheck-suppress virtualCallInConstructor
0051   void set_sampachannel(const uint16_t val) override { sampachannel = val; }
0052 
0053   // index of the first sample with data
0054   uint16_t get_sample_begin() const override
0055   {
0056     return adcmap.empty() ? 0 : adcmap.begin()->first;
0057   }
0058 
0059   // index of the next to last sample with data
0060   uint16_t get_sample_end() const override
0061   {
0062     return adcmap.empty() ? 0 : adcmap.rbegin()->first + 1;
0063   }
0064 
0065   // adc value for a given sample index
0066   uint16_t get_adc(const uint16_t sample) const override;
0067 
0068   // cppcheck-suppress virtualCallInConstructor
0069   void set_adc(const uint16_t sample, const uint16_t val) override
0070   {
0071     adcmap[sample] = val;
0072   }
0073 
0074  private:
0075   uint64_t bco{std::numeric_limits<uint64_t>::max()};
0076   uint64_t gtm_bco{std::numeric_limits<uint64_t>::max()};
0077   int32_t packetid{std::numeric_limits<int32_t>::max()};
0078   uint16_t fee{std::numeric_limits<uint16_t>::max()};
0079   uint16_t channel{std::numeric_limits<uint16_t>::max()};
0080   uint16_t sampaaddress{std::numeric_limits<uint16_t>::max()};
0081   uint16_t sampachannel{std::numeric_limits<uint16_t>::max()};
0082 
0083   //! adc value for each sample
0084   std::map<uint16_t, uint16_t> adcmap;
0085 
0086   ClassDefOverride(MicromegasRawHitv2, 1)
0087 };
0088 
0089 #endif