Back to home page

sPhenix code displayed by LXR

 
 

    


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

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