Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-18 08:23:36

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 private:
0024   static constexpr unsigned offset_roz_ = 1;
0025   static constexpr unsigned mask_roz_ = 0x3f;  // 6 bits, max 64 bins
0026   static constexpr unsigned mask_phi_ = 1;
0027 
0028   bool do_truncate_;
0029   double roz_min_ = 0.;
0030   double roz_max_ = 0.;
0031   unsigned roz_bins_ = 42;
0032   std::vector<unsigned> max_tcs_per_bin_;
0033   std::vector<double> phi_edges_;
0034 
0035   uint32_t packBin(unsigned roverzbin, unsigned phibin) const;
0036   void unpackBin(unsigned packedbin, unsigned& roverzbin, unsigned& phibin) const;
0037   int phiBin(unsigned roverzbin, double phi, const std::vector<double>& phiedges) const;
0038   double rotatedphi(double x, double y, double z, int sector) const;
0039 };
0040 
0041 #endif