Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /**
0002  * @file mvtx/MvtxDefs.h
0003  * @author D. McGlinchey
0004  * @date June 2018
0005  * @brief Utility functions for MVTX
0006  */
0007 #ifndef MVTX_MVTXDEFUTIL_H
0008 #define MVTX_MVTXDEFUTIL_H
0009 
0010 #include "TrkrDefs.h"
0011 
0012 #include <cstdint>  // for uint8_t, uint16_t, uint32_t
0013 
0014 /**
0015  * @brief Utility functions for MVTX
0016  *
0017  * Contains the functions for manipulating the various keys
0018  * used by the mvtx for hits, hit sets, and clusters
0019  */
0020 namespace MvtxDefs
0021 {
0022   // max values for col and row index in chip
0023   static constexpr uint16_t MAXCOL __attribute__((unused)) = 1024;
0024   static constexpr uint16_t MAXROW __attribute__((unused)) = 512;
0025 
0026   /**
0027    * @brief Get the stave id from hitsetkey
0028    * @param[in] hitsetkey
0029    * @param[out] stave id
0030    */
0031   uint8_t getStaveId(TrkrDefs::hitsetkey key);
0032 
0033   /**
0034    * @brief Get the stave id from cluskey
0035    * @param[in] cluskey
0036    * @param[out] stave id
0037    */
0038   uint8_t getStaveId(TrkrDefs::cluskey key);
0039 
0040   /**
0041    * @brief Get the chip id from hitsetkey
0042    * @param[in] hitsetkey
0043    * @param[out] chip id
0044    */
0045   uint8_t getChipId(TrkrDefs::hitsetkey key);
0046 
0047   /**
0048    * @brief Get the chip id from cluskey
0049    * @param[in] cluskey
0050    * @param[out] chip id
0051    */
0052   uint8_t getChipId(TrkrDefs::cluskey key);
0053 
0054   /**
0055    * @brief Get the chip id from hitsetkey
0056    * @param[in] hitsetkey
0057    * @param[out] chip id
0058    */
0059   int getStrobeId(TrkrDefs::hitsetkey key);
0060 
0061   /**
0062    * @brief Get the strobe id from hitsetkey
0063    * @param[in] hitsetkey
0064    * @param[out] strobe id
0065    */
0066   int getStrobeId(TrkrDefs::cluskey key);
0067 
0068   /**
0069    * @brief Get the strobe id from the cluskey
0070    * @param[in] cluskey
0071    * @param[out] strobe id
0072    */
0073   uint16_t getCol(TrkrDefs::hitkey key);
0074 
0075   /**
0076    * @brief Get the row index from hitkey
0077    * @param[in] hitkey
0078    * @param[out] row index
0079    */
0080   uint16_t getRow(TrkrDefs::hitkey key);
0081 
0082   /**
0083    * @brief Generate a hitkey from a pixels column and row index
0084    * @param[in] col Column index
0085    * @param[in] row Row index
0086    * @param[out] hitkey
0087    */
0088   TrkrDefs::hitkey genHitKey(const uint16_t col, const uint16_t row);
0089 
0090   /**
0091    * @brief Generate a hitsetkey for the mvtx
0092    * @param[in] lyr Layer index
0093    * @param[in] stave Stave index
0094    * @param[in] chip Chip index
0095    * @param[out] hitsetkey
0096    *
0097    * Generate a hitsetkey for the mvtx. The tracker id is known
0098    * implicitly and used in the function.
0099    */
0100   TrkrDefs::hitsetkey genHitSetKey(const uint8_t lyr, const uint8_t stave, const uint8_t chip, const int strobe);
0101 
0102   /**
0103    * @brief Generate a cluster key from indeces
0104    * @param[in] lyr Layer index
0105    * @param[in] stave Stave index
0106    * @param[in] chip Chip index
0107    * @param[in] crossing bunch crossing
0108    * @param[in] clusid Cluster id
0109    * @param[out] cluskey
0110    */
0111   TrkrDefs::cluskey genClusKey(const uint8_t lyr, const uint8_t stave, const uint8_t chip, const int strobe, const uint32_t clusid);
0112 
0113   /**
0114    * @brief Zero the strobe bits in the cluster key
0115    * @param[in] hskey cluskey
0116    * @param[out] cluskey with strobe bits set to zero
0117    */
0118   TrkrDefs::cluskey resetStrobe(const TrkrDefs::cluskey /*key*/);
0119 
0120   /**
0121    * @brief Zero the strobe bits in the hitsetkey
0122    * @param[in] hskey hitsetkey
0123    * @param[out] hitsetkey with strobe bits set to zero
0124    */
0125   TrkrDefs::hitsetkey resetStrobe(const TrkrDefs::hitsetkey /*hitsetkey*/);
0126 
0127 }  // namespace MvtxDefs
0128 
0129 #endif  // MVTX_MVTXDEFUTIL_H