File indexing completed on 2024-04-06 12:20:39
0001 #ifndef __L1Trigger_L1THGCal_HGCalTriggerTowerGeometryHelper_h__
0002 #define __L1Trigger_L1THGCal_HGCalTriggerTowerGeometryHelper_h__
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "DataFormats/L1THGCal/interface/HGCalTowerID.h"
0015 #include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
0016 #include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
0017 #include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"
0018 #include "DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h"
0019
0020 #include <vector>
0021 #include <unordered_map>
0022
0023 namespace l1t {
0024 class HGCalTowerID;
0025 struct HGCalTowerCoord;
0026 }
0027
0028 class HGCalTriggerTowerGeometryHelper {
0029 public:
0030 HGCalTriggerTowerGeometryHelper(const edm::ParameterSet& conf);
0031
0032 ~HGCalTriggerTowerGeometryHelper() {}
0033
0034 void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }
0035
0036 unsigned packLayerSubdetWaferId(int subdet, int layer, int moduleU, int moduleV) const;
0037 unsigned packTowerIDandShare(int towerEta, int towerPhi, int towerShare) const;
0038 void unpackTowerIDandShare(unsigned towerIDandShare, int& towerEta_raw, int& towerPhi_raw, int& towerShare) const;
0039 int moveToCorrectSector(int towerPhi_raw, int sector) const;
0040 void reverseXaxis(int& towerPhi) const;
0041
0042 const std::vector<l1t::HGCalTowerCoord>& getTowerCoordinates() const;
0043
0044 unsigned short getTriggerTowerFromEtaPhi(const float& eta, const float& phi) const;
0045 std::unordered_map<unsigned short, float> getTriggerTower(const l1t::HGCalTriggerCell&) const;
0046 std::unordered_map<unsigned short, float> getTriggerTower(const l1t::HGCalTriggerSums&) const;
0047
0048 const bool isNose() { return doNose_; }
0049
0050 private:
0051 static const int towerShareMask = 0x7F;
0052 static const int towerShareShift = 14;
0053 static const int signMask = 0x1;
0054 static const int sign1Shift = 21;
0055 static const int sign2Shift = 22;
0056 std::vector<l1t::HGCalTowerCoord> tower_coords_;
0057 std::unordered_map<unsigned, short> cells_to_trigger_towers_;
0058 std::unordered_map<unsigned, std::vector<unsigned>> modules_to_trigger_towers_;
0059
0060 bool doNose_;
0061 double minEta_;
0062 double maxEta_;
0063 double minPhi_;
0064 double maxPhi_;
0065 unsigned int nBinsEta_;
0066 unsigned int nBinsPhi_;
0067
0068 std::vector<double> binsEta_;
0069 std::vector<double> binsPhi_;
0070
0071 bool splitModuleSum_;
0072 int splitDivisorSilic_;
0073 int splitDivisorScint_;
0074 int rotate180Deg_;
0075 int rotate120Deg_;
0076 int reverseX_;
0077
0078 HGCalTriggerTools triggerTools_;
0079 };
0080
0081 #endif