Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:38

0001 #ifndef __L1Trigger_L1THGCal_HGCalStage1TruncationImpl_h__
0002 #define __L1Trigger_L1THGCal_HGCalStage1TruncationImpl_h__
0003 
0004 #include "L1Trigger/L1THGCal/interface/backend/HGCalTriggerCell_SA.h"
0005 #include "L1Trigger/L1THGCal/interface/backend/HGCalStage1TruncationConfig_SA.h"
0006 
0007 #include <vector>
0008 #include <cstdint>        // uint32_t, unsigned
0009 #include <unordered_map>  // std::unordered_map
0010 #include <algorithm>      // std::sort
0011 
0012 class HGCalStage1TruncationImplSA {
0013 public:
0014   HGCalStage1TruncationImplSA() = default;
0015   ~HGCalStage1TruncationImplSA() = default;
0016 
0017   void runAlgorithm() const;
0018 
0019   unsigned run(const l1thgcfirmware::HGCalTriggerCellSACollection& tcs_in,
0020                const l1thgcfirmware::Stage1TruncationConfig& theConf,
0021                l1thgcfirmware::HGCalTriggerCellSACollection& tcs_out) const;
0022 
0023   int phiBin(unsigned roverzbin, double phi, const std::vector<double>& phiedges) const;
0024   double rotatedphi(double x, double y, double z, int sector) const;
0025   unsigned rozBin(double roverz, double rozmin, double rozmax, unsigned rozbins) const;
0026 
0027 private:
0028   static constexpr unsigned offset_roz_ = 1;
0029   static constexpr unsigned mask_roz_ = 0x3f;  // 6 bits, max 64 bins
0030   static constexpr unsigned mask_phi_ = 1;
0031 
0032   bool do_truncate_;
0033   double roz_min_ = 0.;
0034   double roz_max_ = 0.;
0035   unsigned roz_bins_ = 42;
0036   std::vector<unsigned> max_tcs_per_bin_;
0037   std::vector<double> phi_edges_;
0038 
0039   uint32_t packBin(unsigned roverzbin, unsigned phibin) const;
0040   void unpackBin(unsigned packedbin, unsigned& roverzbin, unsigned& phibin) const;
0041 };
0042 
0043 #endif