File indexing completed on 2025-08-05 08:17:03
0001
0002
0003
0004
0005
0006
0007 #ifndef TRACKBASE_TRKRDEFS_H
0008 #define TRACKBASE_TRKRDEFS_H
0009
0010 #include <cstdint>
0011 #include <iostream>
0012 #include <map>
0013 #include <string>
0014
0015
0016
0017
0018 namespace TrkrDefs
0019 {
0020 [[maybe_unused]] static constexpr double EdepScaleFactor = 0.25;
0021 [[maybe_unused]] static constexpr double MvtxEnergyScaleup = 5.0e8;
0022 [[maybe_unused]] static constexpr double InttEnergyScaleup = 5.0e7;
0023
0024
0025 using hitkey = uint32_t;
0026 using hitsetkey = uint32_t;
0027 using cluskey = uint64_t;
0028 using clushitkey = uint32_t;
0029 using subsurfkey = uint16_t;
0030
0031
0032 [[maybe_unused]] static constexpr hitkey HITKEYMAX = UINT32_MAX;
0033 [[maybe_unused]] static constexpr hitsetkey HITSETKEYMAX = UINT32_MAX;
0034 [[maybe_unused]] static constexpr cluskey CLUSKEYMAX = UINT64_MAX;
0035 [[maybe_unused]] static constexpr clushitkey CLUSHITKEYMAX = UINT32_MAX;
0036 [[maybe_unused]] static constexpr subsurfkey SUBSURFKEYMAX = UINT16_MAX;
0037
0038
0039 enum TrkrId
0040 {
0041 mvtxId = 0,
0042 inttId = 1,
0043 tpcId = 2,
0044 micromegasId = 3
0045 };
0046
0047
0048 static const std::map<TrkrId, std::string> TrkrNames =
0049 {
0050 {mvtxId, "MVTX"},
0051 {inttId, "INTT"},
0052 {tpcId, "TPC"},
0053 {micromegasId, "MICROMEGAS"}
0054 };
0055
0056
0057 void printBits(const TrkrDefs::hitsetkey key, std::ostream& os = std::cout);
0058 void printBits(const TrkrDefs::cluskey key, std::ostream& os = std::cout);
0059
0060
0061
0062 uint8_t getTrkrId(const TrkrDefs::hitsetkey key);
0063 uint8_t getTrkrId(const TrkrDefs::cluskey key);
0064
0065
0066 uint8_t getLayer(const TrkrDefs::hitsetkey key);
0067 uint8_t getLayer(const TrkrDefs::cluskey key);
0068
0069
0070 uint32_t getClusIndex(const TrkrDefs::cluskey key);
0071
0072
0073 TrkrDefs::hitsetkey genHitSetKey(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
0074
0075
0076 TrkrDefs::cluskey genClusKey(const TrkrDefs::hitsetkey hskey, const uint32_t clusid);
0077
0078
0079 uint32_t getHitSetKeyFromClusKey(const TrkrDefs::cluskey key);
0080
0081
0082 TrkrDefs::hitsetkey getHitSetKeyLo(const TrkrDefs::TrkrId trkrId);
0083 TrkrDefs::hitsetkey getHitSetKeyHi(const TrkrDefs::TrkrId trkrId);
0084 TrkrDefs::hitsetkey getHitSetKeyLo(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
0085 TrkrDefs::hitsetkey getHitSetKeyHi(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
0086
0087
0088 TrkrDefs::cluskey getClusKeyLo(const TrkrDefs::TrkrId trkrId);
0089 TrkrDefs::cluskey getClusKeyHi(const TrkrDefs::TrkrId trkrId);
0090 TrkrDefs::cluskey getClusKeyLo(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
0091 TrkrDefs::cluskey getClusKeyHi(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
0092
0093 [[maybe_unused]] static constexpr unsigned int kBitShiftPhiElement = 8;
0094 [[maybe_unused]] static constexpr unsigned int kBitShiftZElement = 0;
0095
0096 uint8_t getPhiElement(TrkrDefs::hitsetkey key);
0097 uint8_t getZElement(TrkrDefs::hitsetkey key);
0098 uint8_t getPhiElement(TrkrDefs::cluskey key);
0099 uint8_t getZElement(TrkrDefs::cluskey key);
0100
0101 }
0102
0103 #endif