Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:14

0001 #ifndef FUN4ALLRAW_INTT_POOL_H
0002 #define FUN4ALLRAW_INTT_POOL_H
0003 
0004 #include <Event/packet.h>
0005 
0006 #include <algorithm>
0007 #include <array>
0008 #include <cstdint>
0009 #include <functional>
0010 #include <map>
0011 #include <set>
0012 #include <string>
0013 #include <vector>
0014 
0015 
0016 class  intt_pool  {
0017 
0018 
0019 public:
0020   intt_pool( const unsigned int required_depth=30000, const unsigned int low_mark =1000);
0021   // delete copy ctor and assignment operator (cppcheck)
0022   explicit intt_pool(const intt_pool &) = delete;
0023   intt_pool &operator=(const intt_pool &) = delete;
0024 
0025   virtual ~intt_pool();
0026 
0027   virtual int addPacket( Packet *p);
0028 
0029   virtual void drain() { _low_mark = 0;};
0030 
0031   virtual unsigned int  rawValue(const int fee, const int index);
0032 
0033 
0034   virtual int iValue(const int hit, const int field);
0035   virtual int iValue(const int hit, const char *what);
0036   virtual int iValue(const int, const int, const char *what);
0037   virtual long long lValue(const int hit, const int field);
0038   virtual long long lValue(const int hit, const char *what);
0039   virtual long long lValue(const int, const int, const char * what);
0040 
0041 
0042   virtual unsigned int min_depth() const; // the lowest vector length
0043   virtual bool depth_ok() const;
0044   virtual int next();
0045 
0046   virtual void  dump ( OSTREAM& os = std::cout);
0047   virtual int getIdentifier() const {return _myPacketid;};
0048 
0049   
0050 
0051   void Verbosity(const int i) {verbosity = i;}
0052   void Name(const std::string &n) {name = n;}
0053   const std::string &Name() const {return name;}
0054 
0055 
0056 protected:
0057   int intt_decode ();
0058 
0059   int intt_decode_hitlist (std::vector<unsigned int> & /*hitlist*/ , const int /*fee*/);
0060 
0061   unsigned long long calcBCO(unsigned int *hitlist) const;
0062 
0063   static const int MAX_FEECOUNT {14};
0064   
0065   int verbosity {0};
0066   int _is_decoded {0};
0067   
0068   unsigned int _required_depth;
0069   unsigned int _low_mark;
0070   int _myPacketid {-1};  // we are not locked in yet
0071 
0072   int currentpos {0};
0073   int writeindex {0};
0074 
0075   struct intt_hit
0076   {
0077     uint64_t bco;
0078     uint16_t fee;
0079     uint16_t channel_id;
0080     uint16_t chip_id;
0081     uint16_t adc;
0082     uint16_t FPHX_BCO;
0083     uint16_t full_FPHX;
0084     uint16_t full_ROC;
0085     uint16_t amplitude;
0086     uint16_t full_fphx;
0087     uint32_t event_counter;
0088     uint32_t word;
0089   };
0090 
0091     
0092   //std::vector<unsigned int> packetData;
0093   unsigned int * packetData;
0094   int _allocated_size{0};
0095 
0096   std::vector<unsigned int> fee_data[MAX_FEECOUNT];
0097   std::vector<intt_hit *> intt_hits;
0098 
0099   std::array<unsigned int,MAX_FEECOUNT> last_index{};
0100   std::map<unsigned int, uint64_t> last_bco;
0101   std::string name;
0102 
0103   std::set<unsigned int> FEE_List;
0104   std::set<unsigned long long> BCO_List;
0105   // a list of FEEs with data belonging to a given BCO
0106   std::map<unsigned long long, std::set<unsigned int>> FEEs_by_BCO;
0107   // a list of BCOs with data belonging to a given FEE
0108   std::map<unsigned int, std::set<unsigned long long>> BCOs_by_FEE;
0109 
0110 };
0111 
0112  
0113 #endif