Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:01

0001 /**
0002  * @file trackbase/TpcDefs.h
0003  * @author D. McGlinchey
0004  * @date June 2018
0005  * @brief Utility functions for TPC
0006  */
0007 #ifndef TPC_TPCDEFS_H
0008 #define TPC_TPCDEFS_H
0009 
0010 #include "TrkrDefs.h"
0011 
0012 #include <cstdint>  // for uint8_t, uint16_t, uint32_t
0013 
0014 /**
0015  * @brief Utility functions for TPC
0016  *
0017  * Contains the functions for manipulating the various keys
0018  * used by the tpc for hits, hit sets, and clusters
0019  */
0020 namespace TpcDefs
0021 {
0022   constexpr int NSides = 2;
0023   constexpr int NSectors = 12;
0024   constexpr int NRSectors = 3;
0025 
0026   //! in memory representation of TPC ADC data: 10bit ADC value as 16bit signed integer.
0027   // This is signed to allow pedestal subtraction when needed
0028   using ADCDataType = int16_t;
0029 
0030   //! in memory representation of BCO clock using standard 64bit sPHENIX time stamp precision
0031   using BCODataType = uint64_t;
0032 
0033   // max values for pad and time bin
0034   static constexpr uint16_t MAXPAD __attribute__((unused)) = 1024;
0035   static constexpr uint16_t MAXTBIN __attribute__((unused)) = 512;
0036 
0037   /**
0038    * @brief Get the sector id from hitsetkey
0039    * @param[in] hitsetkey
0040    * @param[out] sector id
0041    */
0042   uint8_t getSectorId(TrkrDefs::hitsetkey key);
0043 
0044   /**
0045    * @brief Get the sector id from cluskey
0046    * @param[in] cluskey
0047    * @param[out] sector id
0048    */
0049   uint8_t getSectorId(TrkrDefs::cluskey key);
0050 
0051   /**
0052    * @brief Get the side from hitsetkey
0053    * @param[in] hitsetkey
0054    * @param[out] side
0055    */
0056   uint8_t getSide(TrkrDefs::hitsetkey key);
0057 
0058   /**
0059    * @brief Get the side id from cluskey
0060    * @param[in] cluskey
0061    * @param[out] side id
0062    */
0063   uint8_t getSide(TrkrDefs::cluskey key);
0064 
0065   /**
0066    * @brief Get the pad index from hitkey
0067    * @param[in] hitkey
0068    * @param[out] pad index
0069    */
0070   uint16_t getPad(TrkrDefs::hitkey key);
0071 
0072   /**
0073    * @brief Get the time bin from hitkey
0074    * @param[in] hitkey
0075    * @param[out] time bin
0076    */
0077   uint16_t getTBin(TrkrDefs::hitkey key);
0078 
0079   /**
0080    * @brief Generate a hitkey from a pad index and time bin
0081    * @param[in] pad Pad index
0082    * @param[in] tbin Time bin
0083    * @param[out] hitkey
0084    */
0085   TrkrDefs::hitkey genHitKey(const uint16_t pad, const uint16_t tbin);
0086 
0087   /**
0088    * @brief Generate a hitsetkey for the tpc
0089    * @param[in] lyr Layer index
0090    * @param[in] sector Sector index
0091    * @param[in] side Side index
0092    * @param[out] hitsetkey
0093    *
0094    * Generate a hitsetkey for the tpc. The tracker id is known
0095    * implicitly and used in the function.
0096    */
0097   TrkrDefs::hitsetkey genHitSetKey(const uint8_t lyr, const uint8_t sector, const uint8_t side);
0098 
0099   /**
0100    * @brief Generate a cluster key from indeces
0101    * @param[in] lyr Layer index
0102    * @param[in] sector Sector index
0103    * @param[in] side Side index
0104    * @param[in] clusid Cluster id
0105    * @param[out] cluskey
0106    */
0107   TrkrDefs::cluskey genClusKey(const uint8_t lyr, const uint8_t sector, const uint8_t side, const uint32_t clusid);
0108 
0109 }  // namespace TpcDefs
0110 
0111 #endif  // TPC_TPCDEFS_H