CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes
HGCalCoarseTriggerCellMapping Class Reference

#include <HGCalCoarseTriggerCellMapping.h>

Public Member Functions

void checkSizeValidity (int ctcSize) const
 
uint32_t getCoarseTriggerCellId (uint32_t detid) const
 
GlobalPoint getCoarseTriggerCellPosition (uint32_t ctcId) const
 
std::vector< uint32_t > getConstituentTriggerCells (uint32_t ctcId) const
 
uint32_t getRepresentativeDetId (uint32_t tcid) const
 
 HGCalCoarseTriggerCellMapping (const std::vector< unsigned > &ctcSize)
 
void setGeometry (const HGCalTriggerGeometryBase *const geom)
 

Static Public Attributes

static constexpr int kCTCsizeCoarse_ = 16
 
static constexpr int kCTCsizeFine_ = 4
 
static constexpr int kCTCsizeIndividual_ = 1
 
static constexpr int kCTCsizeMid_ = 8
 
static constexpr int kCTCsizeVeryFine_ = 2
 

Private Attributes

std::vector< unsigned > ctcSize_
 
HGCSiliconDetIdToROC detIdToROC_
 
HGCalTriggerTools triggerTools_
 

Static Private Attributes

static constexpr int kHGCalCellMaskInv_ = ~0xff
 
static constexpr int kHGCalScinCellMaskInv_ = ~0x1ffff
 
static constexpr int kNHGCalLayersMax_ = 52
 
static constexpr int kNThicknesses_ = 4
 
static constexpr int kRoc0deg_ = 1
 
static constexpr int kRoc120deg_ = 2
 
static constexpr int kRoc240deg_ = 3
 
static constexpr int kRocMask_ = 0xf
 
static constexpr int kRocShift_ = 4
 
static constexpr int kRotate4_ = 4
 
static constexpr int kRotate7_ = 7
 
static const std::map< int, int > kSplit_
 
static constexpr int kSplit_Coarse_ = 0
 
static constexpr int kSplit_Fine_ = 0xa
 
static constexpr int kSplit_Individual_ = 0xf
 
static constexpr int kSplit_Mid_ = 0x2
 
static const std::map< int, int > kSplit_Scin_
 
static constexpr int kSplit_Scin_Coarse_ = 0x1f9fc
 
static constexpr int kSplit_Scin_Fine_ = 0x1fdfe
 
static constexpr int kSplit_Scin_Individual_ = 0x1ffff
 
static constexpr int kSplit_Scin_Mid_ = 0x1fdfc
 
static constexpr int kSplit_Scin_VeryFine_ = 0x1fffe
 
static constexpr int kSplit_VeryFine_ = 0xb
 
static constexpr int kSTCidMaskInv_ = ~0xf
 
static constexpr int kUMask_ = 0x3
 
static constexpr int kUShift_ = 2
 
static constexpr int kVMask_ = 0x3
 
static constexpr int kVShift_ = 0
 

Detailed Description

Definition at line 9 of file HGCalCoarseTriggerCellMapping.h.

Constructor & Destructor Documentation

◆ HGCalCoarseTriggerCellMapping()

HGCalCoarseTriggerCellMapping::HGCalCoarseTriggerCellMapping ( const std::vector< unsigned > &  ctcSize)

Definition at line 4 of file HGCalCoarseTriggerCellMapping.cc.

References kCTCsizeVeryFine_, kNHGCalLayersMax_, and kNThicknesses_.

5  : ctcSize_(!ctcSize.empty() ? ctcSize
6  : std::vector<unsigned>{kNHGCalLayersMax_ * kNThicknesses_, kCTCsizeVeryFine_}) {
7  if (ctcSize_.size() != (kNHGCalLayersMax_ + 1) * kNThicknesses_) {
8  throw cms::Exception("HGCTriggerParameterError")
9  << "Inconsistent size of coarse trigger cell size vector " << ctcSize_.size();
10  }
11 
12  for (auto ctc : ctcSize_)
13  checkSizeValidity(ctc);
14 }

Member Function Documentation

◆ checkSizeValidity()

void HGCalCoarseTriggerCellMapping::checkSizeValidity ( int  ctcSize) const

◆ getCoarseTriggerCellId()

uint32_t HGCalCoarseTriggerCellMapping::getCoarseTriggerCellId ( uint32_t  detid) const

Definition at line 54 of file HGCalCoarseTriggerCellMapping.cc.

References l1tHGCalConcentratorProducer_cfi::ctcSize, ctcSize_, DetId::det(), detIdToROC_, HGCSiliconDetIdToROC::getROCNumber(), DetId::HGCalHSc, DetId::HGCalTrigger, HGCScintillatorDetId::ietaAbs(), HGCScintillatorDetId::iphi(), HGCalTriggerTools::isScintillator(), kHGCalCellMaskInv_, HGCScintillatorDetId::kHGCalRadiusOffset, kHGCalScinCellMaskInv_, kNHGCalLayersMax_, kRoc0deg_, kRoc120deg_, kRoc240deg_, kRocShift_, kRotate4_, kRotate7_, kSplit_, kSplit_Scin_, kUShift_, pixelTopology::layer, HGCalTriggerTools::layerWithOffset(), Calorimetry_cff::thickness, HGCalTriggerTools::thicknessIndex(), HGCalTriggerDetId::triggerCellU(), HGCalTriggerDetId::triggerCellV(), and triggerTools_.

Referenced by HGCalConcentratorSuperTriggerCellImpl::assignSuperTriggerCellEnergyAndPosition(), HGCalConcentratorCoarsenerImpl::coarsen(), HGCalConcentratorSuperTriggerCellImpl::createAllTriggerCells(), getRepresentativeDetId(), and HGCalConcentratorSuperTriggerCellImpl::select().

54  {
55  unsigned int layer = triggerTools_.layerWithOffset(detid);
57 
59 
60  DetId tc_Id(detid);
61  if (tc_Id.det() == DetId::HGCalTrigger || tc_Id.det() == DetId::HGCalHSc) {
62  if (triggerTools_.isScintillator(detid)) {
63  HGCScintillatorDetId tc_Id(detid);
64 
65  int tcSplit = (((tc_Id.ietaAbs() - 1) << HGCScintillatorDetId::kHGCalRadiusOffset) | (tc_Id.iphi() - 1)) &
67 
68  detid = (detid & kHGCalScinCellMaskInv_) | tcSplit;
69 
70  return detid;
71 
72  } else {
73  HGCalTriggerDetId tc_Id(detid);
74 
75  int uPrime = 0;
76  int vPrime = 0;
77  int rocnum = detIdToROC_.getROCNumber(tc_Id.triggerCellU(), tc_Id.triggerCellV(), 1);
78 
79  if (rocnum == kRoc0deg_) {
80  uPrime = tc_Id.triggerCellU();
81  vPrime = tc_Id.triggerCellV() - tc_Id.triggerCellU();
82 
83  } else if (rocnum == kRoc120deg_) {
84  uPrime = tc_Id.triggerCellU() - tc_Id.triggerCellV() - 1;
85  vPrime = tc_Id.triggerCellV();
86 
87  } else if (rocnum == kRoc240deg_) {
88  uPrime = tc_Id.triggerCellV() - kRotate4_;
89  vPrime = kRotate7_ - tc_Id.triggerCellU();
90  }
91 
92  int tcSplit = (rocnum << kRocShift_) | ((uPrime << kUShift_ | vPrime) & kSplit_.at(ctcSize));
93  detid = (detid & kHGCalCellMaskInv_) | tcSplit;
94  return detid;
95  }
96 
97  } else {
98  return 0;
99  }
100 }
static const std::map< int, int > kSplit_
bool isScintillator(const DetId &id) const
int thicknessIndex(const DetId &) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static const std::map< int, int > kSplit_Scin_
int getROCNumber(HGCalTriggerDetId const &id) const
static const int kHGCalRadiusOffset
unsigned layerWithOffset(const DetId &) const
Definition: DetId.h:17

◆ getCoarseTriggerCellPosition()

GlobalPoint HGCalCoarseTriggerCellMapping::getCoarseTriggerCellPosition ( uint32_t  ctcId) const

Definition at line 162 of file HGCalCoarseTriggerCellMapping.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), getConstituentTriggerCells(), HGCalTriggerTools::getTCPosition(), and triggerTools_.

Referenced by HGCalConcentratorSuperTriggerCellImpl::assignSuperTriggerCellEnergyAndPosition(), and HGCalConcentratorCoarsenerImpl::coarsen().

162  {
163  std::vector<uint32_t> constituentTCs = getConstituentTriggerCells(ctcId);
164  Basic3DVector<float> average_vector(0., 0., 0.);
165 
166  for (const auto constituent : constituentTCs) {
167  average_vector += triggerTools_.getTCPosition(constituent).basicVector();
168  }
169 
170  GlobalPoint average_point(average_vector / constituentTCs.size());
171  return average_point;
172 }
std::vector< uint32_t > getConstituentTriggerCells(uint32_t ctcId) const
GlobalPoint getTCPosition(const DetId &id) const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53

◆ getConstituentTriggerCells()

std::vector< uint32_t > HGCalCoarseTriggerCellMapping::getConstituentTriggerCells ( uint32_t  ctcId) const

Definition at line 102 of file HGCalCoarseTriggerCellMapping.cc.

References l1tHGCalConcentratorProducer_cfi::ctcSize, ctcSize_, DetId::det(), HGCalTriggerTools::getTriggerGeometry(), DetId::HGCalHSc, DetId::HGCalTrigger, mps_fire::i, HGCScintillatorDetId::iphi(), HGCScintillatorDetId::iradiusAbs(), HGCalTriggerTools::isScintillator(), kHGCalCellMaskInv_, HGCalTriggerDetId::kHGCalCellUMask, HGCalTriggerDetId::kHGCalCellUOffset, HGCalTriggerDetId::kHGCalCellVMask, HGCalTriggerDetId::kHGCalCellVOffset, HGCScintillatorDetId::kHGCalRadiusOffset, kHGCalScinCellMaskInv_, kNHGCalLayersMax_, kRoc0deg_, kRoc120deg_, kRoc240deg_, kRocMask_, kRocShift_, kRotate4_, kRotate7_, kSplit_, kSplit_Scin_, kSTCidMaskInv_, kUMask_, kUShift_, kVMask_, kVShift_, pixelTopology::layer, HGCalTriggerTools::layerWithOffset(), Calorimetry_cff::thickness, HGCalTriggerTools::thicknessIndex(), triggerTools_, findQualityFiles::v, and HGCalTriggerGeometryBase::validTriggerCell().

Referenced by HGCalConcentratorSuperTriggerCellImpl::assignSuperTriggerCellEnergyAndPosition(), HGCalConcentratorSuperTriggerCellImpl::createAllTriggerCells(), getCoarseTriggerCellPosition(), and getRepresentativeDetId().

102  {
104  unsigned int layer = triggerTools_.layerWithOffset(ctcId);
106 
107  std::vector<uint32_t> output_ids;
108  DetId tc_Id(ctcId);
109 
110  if (tc_Id.det() == DetId::HGCalTrigger || tc_Id.det() == DetId::HGCalHSc) {
111  if (triggerTools_.isScintillator(ctcId)) {
112  int splitInv = ~(kHGCalScinCellMaskInv_ | kSplit_Scin_.at(ctcSize));
113  for (int i = 0; i < splitInv + 1; i++) {
114  if ((i & splitInv) != i)
115  continue;
116 
117  HGCScintillatorDetId prime = (ctcId | i);
118  unsigned outid = (ctcId & kHGCalScinCellMaskInv_) |
119  (((prime.iradiusAbs() + 1) << HGCScintillatorDetId::kHGCalRadiusOffset) | (prime.iphi() + 1));
120 
122  output_ids.emplace_back(outid);
123  }
124  }
125 
126  } else {
127  int splitInv = ~(kSTCidMaskInv_ | kSplit_.at(ctcSize));
128  for (int i = 0; i < splitInv + 1; i++) {
129  if ((i & splitInv) != i)
130  continue;
131  int uPrime = ((ctcId | i) >> kUShift_) & kUMask_;
132  int vPrime = ((ctcId | i) >> kVShift_) & kVMask_;
133  int rocnum = (ctcId >> kRocShift_) & kRocMask_;
134 
135  int u = 0;
136  int v = 0;
137 
138  if (rocnum == kRoc0deg_) {
139  u = uPrime;
140  v = vPrime + u;
141  } else if (rocnum == kRoc120deg_) {
142  u = uPrime + vPrime + 1;
143  v = vPrime;
144  } else if (rocnum == kRoc240deg_) {
145  u = kRotate7_ - vPrime;
146  v = uPrime + kRotate4_;
147  }
148 
149  uint32_t outid = ctcId & kHGCalCellMaskInv_;
152 
154  output_ids.emplace_back(outid);
155  }
156  }
157  }
158  }
159  return output_ids;
160 }
static const std::map< int, int > kSplit_
bool isScintillator(const DetId &id) const
int thicknessIndex(const DetId &) const
const HGCalTriggerGeometryBase * getTriggerGeometry() const
static const int kHGCalCellVOffset
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static const std::map< int, int > kSplit_Scin_
virtual bool validTriggerCell(const unsigned trigger_cell_id) const =0
int iphi() const
get the phi index
static const int kHGCalRadiusOffset
static const int kHGCalCellVMask
unsigned layerWithOffset(const DetId &) const
Definition: DetId.h:17
static const int kHGCalCellUOffset
static const int kHGCalCellUMask

◆ getRepresentativeDetId()

uint32_t HGCalCoarseTriggerCellMapping::getRepresentativeDetId ( uint32_t  tcid) const

Definition at line 41 of file HGCalCoarseTriggerCellMapping.cc.

References getCoarseTriggerCellId(), getConstituentTriggerCells(), HGCalTriggerTools::getTriggerGeometry(), triggerTools_, and HGCalTriggerGeometryBase::validTriggerCell().

Referenced by HGCalConcentratorCoarsenerImpl::coarsen(), and HGCalConcentratorSuperTriggerCellImpl::createAllTriggerCells().

41  {
42  uint32_t representativeid = 0;
43  //Firstly get coarse trigger cell Id
44  uint32_t ctcId = getCoarseTriggerCellId(tcid);
45  //Get list of the constituent TCs, and choose (arbitrarily) the first one
46  representativeid = getConstituentTriggerCells(ctcId).at(0);
47  if (triggerTools_.getTriggerGeometry()->validTriggerCell(representativeid)) {
48  return representativeid;
49  } else {
50  return tcid;
51  }
52 }
std::vector< uint32_t > getConstituentTriggerCells(uint32_t ctcId) const
const HGCalTriggerGeometryBase * getTriggerGeometry() const
uint32_t getCoarseTriggerCellId(uint32_t detid) const
virtual bool validTriggerCell(const unsigned trigger_cell_id) const =0

◆ setGeometry()

void HGCalCoarseTriggerCellMapping::setGeometry ( const HGCalTriggerGeometryBase *const  geom)
inline

Member Data Documentation

◆ ctcSize_

std::vector<unsigned> HGCalCoarseTriggerCellMapping::ctcSize_
private

◆ detIdToROC_

HGCSiliconDetIdToROC HGCalCoarseTriggerCellMapping::detIdToROC_
private

Definition at line 61 of file HGCalCoarseTriggerCellMapping.h.

Referenced by getCoarseTriggerCellId().

◆ kCTCsizeCoarse_

constexpr int HGCalCoarseTriggerCellMapping::kCTCsizeCoarse_ = 16
static

Definition at line 19 of file HGCalCoarseTriggerCellMapping.h.

Referenced by checkSizeValidity().

◆ kCTCsizeFine_

constexpr int HGCalCoarseTriggerCellMapping::kCTCsizeFine_ = 4
static

Definition at line 21 of file HGCalCoarseTriggerCellMapping.h.

Referenced by checkSizeValidity().

◆ kCTCsizeIndividual_

constexpr int HGCalCoarseTriggerCellMapping::kCTCsizeIndividual_ = 1
static

Definition at line 23 of file HGCalCoarseTriggerCellMapping.h.

Referenced by checkSizeValidity().

◆ kCTCsizeMid_

constexpr int HGCalCoarseTriggerCellMapping::kCTCsizeMid_ = 8
static

Definition at line 20 of file HGCalCoarseTriggerCellMapping.h.

Referenced by checkSizeValidity().

◆ kCTCsizeVeryFine_

constexpr int HGCalCoarseTriggerCellMapping::kCTCsizeVeryFine_ = 2
static

◆ kHGCalCellMaskInv_

constexpr int HGCalCoarseTriggerCellMapping::kHGCalCellMaskInv_ = ~0xff
staticprivate

◆ kHGCalScinCellMaskInv_

constexpr int HGCalCoarseTriggerCellMapping::kHGCalScinCellMaskInv_ = ~0x1ffff
staticprivate

◆ kNHGCalLayersMax_

constexpr int HGCalCoarseTriggerCellMapping::kNHGCalLayersMax_ = 52
staticprivate

◆ kNThicknesses_

constexpr int HGCalCoarseTriggerCellMapping::kNThicknesses_ = 4
staticprivate

Definition at line 29 of file HGCalCoarseTriggerCellMapping.h.

Referenced by HGCalCoarseTriggerCellMapping().

◆ kRoc0deg_

constexpr int HGCalCoarseTriggerCellMapping::kRoc0deg_ = 1
staticprivate

◆ kRoc120deg_

constexpr int HGCalCoarseTriggerCellMapping::kRoc120deg_ = 2
staticprivate

◆ kRoc240deg_

constexpr int HGCalCoarseTriggerCellMapping::kRoc240deg_ = 3
staticprivate

◆ kRocMask_

constexpr int HGCalCoarseTriggerCellMapping::kRocMask_ = 0xf
staticprivate

Definition at line 46 of file HGCalCoarseTriggerCellMapping.h.

Referenced by getConstituentTriggerCells().

◆ kRocShift_

constexpr int HGCalCoarseTriggerCellMapping::kRocShift_ = 4
staticprivate

◆ kRotate4_

constexpr int HGCalCoarseTriggerCellMapping::kRotate4_ = 4
staticprivate

◆ kRotate7_

constexpr int HGCalCoarseTriggerCellMapping::kRotate7_ = 7
staticprivate

◆ kSplit_

const std::map< int, int > HGCalCoarseTriggerCellMapping::kSplit_
staticprivate

◆ kSplit_Coarse_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Coarse_ = 0
staticprivate

Definition at line 32 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Fine_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Fine_ = 0xa
staticprivate

Definition at line 34 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Individual_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Individual_ = 0xf
staticprivate

Definition at line 36 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Mid_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Mid_ = 0x2
staticprivate

Definition at line 33 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Scin_

const std::map< int, int > HGCalCoarseTriggerCellMapping::kSplit_Scin_
staticprivate

◆ kSplit_Scin_Coarse_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Scin_Coarse_ = 0x1f9fc
staticprivate

Definition at line 38 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Scin_Fine_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Scin_Fine_ = 0x1fdfe
staticprivate

Definition at line 40 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Scin_Individual_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Scin_Individual_ = 0x1ffff
staticprivate

Definition at line 42 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Scin_Mid_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Scin_Mid_ = 0x1fdfc
staticprivate

Definition at line 39 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_Scin_VeryFine_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_Scin_VeryFine_ = 0x1fffe
staticprivate

Definition at line 41 of file HGCalCoarseTriggerCellMapping.h.

◆ kSplit_VeryFine_

constexpr int HGCalCoarseTriggerCellMapping::kSplit_VeryFine_ = 0xb
staticprivate

Definition at line 35 of file HGCalCoarseTriggerCellMapping.h.

◆ kSTCidMaskInv_

constexpr int HGCalCoarseTriggerCellMapping::kSTCidMaskInv_ = ~0xf
staticprivate

Definition at line 28 of file HGCalCoarseTriggerCellMapping.h.

Referenced by getConstituentTriggerCells().

◆ kUMask_

constexpr int HGCalCoarseTriggerCellMapping::kUMask_ = 0x3
staticprivate

Definition at line 51 of file HGCalCoarseTriggerCellMapping.h.

Referenced by getConstituentTriggerCells().

◆ kUShift_

constexpr int HGCalCoarseTriggerCellMapping::kUShift_ = 2
staticprivate

◆ kVMask_

constexpr int HGCalCoarseTriggerCellMapping::kVMask_ = 0x3
staticprivate

Definition at line 52 of file HGCalCoarseTriggerCellMapping.h.

Referenced by getConstituentTriggerCells().

◆ kVShift_

constexpr int HGCalCoarseTriggerCellMapping::kVShift_ = 0
staticprivate

Definition at line 50 of file HGCalCoarseTriggerCellMapping.h.

Referenced by getConstituentTriggerCells().

◆ triggerTools_

HGCalTriggerTools HGCalCoarseTriggerCellMapping::triggerTools_
private