CMS 3D CMS Logo

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

#include <HcalTrigTowerGeometry.h>

Public Member Functions

std::vector< HcalDetIddetIds (const HcalTrigTowerDetId &) const
 
int firstHFTower (int version) const
 
 HcalTrigTowerGeometry (const HcalTopology *topology)
 
int nTowers (int version) const
 number of towers (version dependent) More...
 
const HcalTopologytopology () const
 
void towerEtaBounds (int ieta, int version, double &eta1, double &eta2) const
 where this tower begins and ends in eta More...
 
std::vector< HcalTrigTowerDetIdtowerIds (const HcalDetId &cellId) const
 the mapping to and from DetIds More...
 
bool use1x1 () const
 
bool useRCT () const
 

Private Member Functions

int firstHFRingInTower (int ietaTower) const
 since the towers are irregular in eta in HF More...
 
int hfTowerEtaSize (int ieta) const
 
int nPhiBins (int ieta, int version) const
 the number of phi bins in this eta ring More...
 

Private Attributes

const HcalTopologytheTopology
 
bool use1x1_
 
bool use2017_
 
bool useRCT_
 

Detailed Description

Definition at line 10 of file HcalTrigTowerGeometry.h.

Constructor & Destructor Documentation

HcalTrigTowerGeometry::HcalTrigTowerGeometry ( const HcalTopology topology)

Definition at line 8 of file HcalTrigTowerGeometry.cc.

References or, theTopology, HcalTopology::triggerMode(), HcalTopologyMode::TriggerMode_2016, HcalTopologyMode::TriggerMode_2017, HcalTopologyMode::TriggerMode_2018legacy, use1x1_, use2017_, and useRCT_.

9  : theTopology(topology)
10 {
11  auto tmode = theTopology->triggerMode();
16 }
const HcalTopology * theTopology
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:32
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12

Member Function Documentation

std::vector< HcalDetId > HcalTrigTowerGeometry::detIds ( const HcalTrigTowerDetId hcalTrigTowerDetId) const

Definition at line 85 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HcalTopology::depthBinInformation(), HcalTopology::firstHEDoublePhiRing(), HcalTopology::firstHERing(), HcalTopology::firstHFRing(), firstHFRingInTower(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, hfTowerEtaSize(), HcalTrigTowerDetId::ieta(), HcalTrigTowerDetId::iphi(), HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::lastHORing(), nPhiBins(), mps_update::results, theTopology, use2017_, HcalTrigTowerDetId::version(), HcalDigiParam_cfi::zside, and HcalTrigTowerDetId::zside().

85  {
86  // Written, tested by E. Berry (Princeton)
87  std::vector<HcalDetId> results;
88 
89  int tower_ieta = hcalTrigTowerDetId.ieta();
90  int tower_iphi = hcalTrigTowerDetId.iphi();
91 
92  int cell_ieta = tower_ieta;
93  int cell_iphi = tower_iphi;
94 
95  int min_depth, n_depths;
96 
97  // HB
98 
99  if (abs(cell_ieta) <= theTopology->lastHBRing()){
100  theTopology->depthBinInformation(HcalBarrel, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
101  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
102  results.emplace_back(HcalDetId(HcalBarrel,cell_ieta,cell_iphi,cell_depth));
103  }
104 
105  // HO
106 
107  if (abs(cell_ieta) <= theTopology->lastHORing()){
108  theTopology->depthBinInformation(HcalOuter , abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
109  for (int ho_depth = min_depth; ho_depth <= min_depth + n_depths - 1; ho_depth++)
110  results.emplace_back(HcalDetId(HcalOuter, cell_ieta,cell_iphi,ho_depth));
111  }
112 
113  // HE
114 
115  if (abs(cell_ieta) >= theTopology->firstHERing() &&
116  abs(cell_ieta) < theTopology->lastHERing()){
117 
118  theTopology->depthBinInformation(HcalEndcap, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
119 
120  // Special for double-phi cells
121  if (abs(cell_ieta) >= theTopology->firstHEDoublePhiRing())
122  if (tower_iphi%2 == 0) cell_iphi = tower_iphi - 1;
123 
124  if (use2017_) {
125  if (abs(tower_ieta) == 26)
126  --n_depths;
127  if (tower_ieta == 27)
128  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta - 1, cell_iphi, 7));
129  if (tower_ieta == -27)
130  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta + 1, cell_iphi, 7));
131  }
132 
133  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
134  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta, cell_iphi, cell_depth));
135 
136  // Special for split-eta cells
137  if (abs(tower_ieta) == 28){
138  theTopology->depthBinInformation(HcalEndcap, abs(tower_ieta)+1, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
139  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++){
140  if (tower_ieta < 0) results.emplace_back(HcalDetId(HcalEndcap, tower_ieta - 1, cell_iphi, cell_depth));
141  if (tower_ieta > 0) results.emplace_back(HcalDetId(HcalEndcap, tower_ieta + 1, cell_iphi, cell_depth));
142  }
143  }
144 
145  }
146 
147  // HF
148 
149  if (abs(cell_ieta) >= theTopology->firstHFRing()){
150 
151  if (hcalTrigTowerDetId.version()==0) {
152 
153  int HfTowerPhiSize = 72 / nPhiBins(tower_ieta,0);
154 
155  int HfTowerEtaSize = hfTowerEtaSize(tower_ieta);
156  int FirstHFRingInTower = firstHFRingInTower(abs(tower_ieta));
157 
158  for (int iHFTowerPhiSegment = 0; iHFTowerPhiSegment < HfTowerPhiSize; iHFTowerPhiSegment++){
159 
160  cell_iphi = (tower_iphi / HfTowerPhiSize) * HfTowerPhiSize; // Find the minimum phi segment
161  cell_iphi -= 2; // The first trigger tower starts at HCAL iphi = 71, not HCAL iphi = 1
162  cell_iphi += iHFTowerPhiSegment; // Get all of the HCAL iphi values in this trigger tower
163  cell_iphi += 72; // Don't want to take the mod of a negative number
164  cell_iphi = cell_iphi % 72; // There are, at most, 72 cells.
165  cell_iphi += 1;// There is no cell at iphi = 0
166 
167  if (cell_iphi%2 == 0) continue; // These cells don't exist.
168 
169  for (int iHFTowerEtaSegment = 0; iHFTowerEtaSegment < HfTowerEtaSize; iHFTowerEtaSegment++){
170 
171  cell_ieta = FirstHFRingInTower + iHFTowerEtaSegment;
172 
173  if (cell_ieta >= 40 && cell_iphi%4 == 1) continue; // These cells don't exist.
174 
175  theTopology->depthBinInformation(HcalForward, cell_ieta, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
176 
177  // Negative tower_ieta -> negative cell_ieta
178  int zside = 1;
179  if (tower_ieta < 0) zside = -1;
180 
181  cell_ieta *= zside;
182 
183  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
184  results.emplace_back(HcalDetId(HcalForward, cell_ieta, cell_iphi, cell_depth));
185 
186  if ( zside * cell_ieta == 30 ) {
187  theTopology->depthBinInformation(HcalForward, 29 * zside, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
188  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
189  results.emplace_back(HcalDetId(HcalForward, 29 * zside , cell_iphi, cell_depth));
190  }
191  }
192  }
193  } else if (hcalTrigTowerDetId.version()==1) {
194  theTopology->depthBinInformation(HcalForward, tower_ieta, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
195  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
196  results.emplace_back(HcalDetId(HcalForward, tower_ieta, tower_iphi, cell_depth));
197  if (abs(tower_ieta)==30) {
198  int i29 = 29;
199  if (tower_ieta < 0) i29 = -29;
200  theTopology->depthBinInformation(HcalForward, i29, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
201  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
202  results.emplace_back(HcalDetId(HcalForward, i29, tower_iphi, cell_depth));
203  }
204  }
205  }
206 
207  return results;
208 }
int firstHFRing() const
Definition: HcalTopology.h:91
int zside() const
get the z-side of the tower (1/-1)
const HcalTopology * theTopology
int lastHBRing() const
Definition: HcalTopology.h:88
int ieta() const
get the tower ieta
int hfTowerEtaSize(int ieta) const
int nPhiBins(int ieta, int version) const
the number of phi bins in this eta ring
void depthBinInformation(HcalSubdetector subdet, int etaRing, int iphi, int zside, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
int version() const
get the version code for the trigger tower
int firstHERing() const
Definition: HcalTopology.h:89
int lastHORing() const
Definition: HcalTopology.h:94
int iphi() const
get the tower iphi
int lastHERing() const
Definition: HcalTopology.h:90
int HcalTrigTowerGeometry::firstHFRingInTower ( int  ietaTower) const
private

since the towers are irregular in eta in HF

Definition at line 221 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HcalTopology::firstHFRing(), firstHFTower(), hfTowerEtaSize(), mps_fire::result, and theTopology.

Referenced by detIds(), nPhiBins(), and towerIds().

221  {
222  // count up to the correct HF ring
223  int inputTower = abs(ietaTower);
224  int result = theTopology->firstHFRing();
225  for(int iTower = firstHFTower(0); iTower != inputTower; ++iTower) {
226  result += hfTowerEtaSize(iTower);
227  }
228 
229  // negative in, negative out.
230  if(ietaTower < 0) result *= -1;
231  return result;
232 }
int firstHFRing() const
Definition: HcalTopology.h:91
const HcalTopology * theTopology
int hfTowerEtaSize(int ieta) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int firstHFTower(int version) const
int HcalTrigTowerGeometry::firstHFTower ( int  version) const
inline
int HcalTrigTowerGeometry::hfTowerEtaSize ( int  ieta) const
private

the number of HF eta rings in this trigger tower ieta starts at firstHFTower()

Definition at line 211 of file HcalTrigTowerGeometry.cc.

References funct::abs(), firstHFTower(), and nTowers().

Referenced by detIds(), firstHFRingInTower(), and nPhiBins().

211  {
212 
213  int ietaAbs = abs(ieta);
214  assert(ietaAbs >= firstHFTower(0) && ietaAbs <= nTowers(0));
215  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
216  return (ietaAbs == nTowers(0)) ? 4 : 3;
217 
218 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int nTowers(int version) const
number of towers (version dependent)
int firstHFTower(int version) const
int HcalTrigTowerGeometry::nPhiBins ( int  ieta,
int  version 
) const
inlineprivate

the number of phi bins in this eta ring

Definition at line 37 of file HcalTrigTowerGeometry.h.

References funct::abs(), firstHFRingInTower(), firstHFTower(), and hfTowerEtaSize().

Referenced by detIds().

37  {
38  int nPhiBinsHF = ( 18 );
39  return (abs(ieta) < firstHFTower(version)) ? 72 : nPhiBinsHF;
40  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int firstHFTower(int version) const
int HcalTrigTowerGeometry::nTowers ( int  version) const
inline

number of towers (version dependent)

Definition at line 25 of file HcalTrigTowerGeometry.h.

Referenced by hfTowerEtaSize().

25 {return (version==0)?(32):(41);}
const HcalTopology& HcalTrigTowerGeometry::topology ( ) const
inline

Definition at line 28 of file HcalTrigTowerGeometry.h.

References theTopology.

28 { return *theTopology; }
const HcalTopology * theTopology
void HcalTrigTowerGeometry::towerEtaBounds ( int  ieta,
int  version,
double &  eta1,
double &  eta2 
) const

where this tower begins and ends in eta

Definition at line 235 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HcalTopology::etaRange(), EnergyCorrector::etas, firstHFTower(), HcalBarrel, HcalForward, theTopology, and tmp.

Referenced by firstHFTower(), CaloTPGTranscoderULUT::loadHCALCompress(), and L1CaloHcalScaleConfigOnlineProd::newObject().

235  {
236  int ietaAbs = abs(ieta);
237  std::pair<double,double> etas =
238  (ietaAbs < firstHFTower(version)) ? theTopology->etaRange(HcalBarrel,ietaAbs) :
239  theTopology->etaRange(HcalForward,ietaAbs);
240  eta1 = etas.first;
241  eta2 = etas.second;
242 
243  // get the signs and order right
244  if(ieta < 0) {
245  double tmp = eta1;
246  eta1 = -eta2;
247  eta2 = -tmp;
248  }
249 }
const HcalTopology * theTopology
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
int firstHFTower(int version) const
std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds ( const HcalDetId cellId) const

the mapping to and from DetIds

Definition at line 19 of file HcalTrigTowerGeometry.cc.

References particleFlowClusterECALTimeSelected_cfi::depth, HcalDetId::depth(), HcalTopology::firstHEDoublePhiRing(), firstHFRingInTower(), firstHFTower(), HcalForward, hcalTTPDigis_cfi::id, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), HcalTopology::lastHERing(), mps_update::results, HcalDetId::subdet(), theTopology, use1x1_, use2017_, useRCT_, and HcalDetId::zside().

Referenced by HcalTriggerPrimitiveAlgo::addSignal(), HcalTriggerPrimitiveAlgo::analyze2017(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and CaloTPGTranscoderULUT::setup().

19  {
20 
21  std::vector<HcalTrigTowerDetId> results;
22 
23  if(cellId.subdet() == HcalForward) {
24 
25  if (useRCT_) {
26  // first do eta
27  int hfRing = cellId.ietaAbs();
28  int ieta = firstHFTower(0);
29  // find the tower that contains this ring
30  while(hfRing >= firstHFRingInTower(ieta+1)) {
31  ++ieta;
32  }
33 
34  ieta *= cellId.zside();
35 
36  // now for phi
37  // HF towers are quad, 18 in phi.
38  // go two cells per trigger tower.
39 
40  int iphi = (((cellId.iphi()+1)/4) * 4 + 1)%72; // 71+1 --> 1, 3+5 --> 5
41  results.emplace_back( HcalTrigTowerDetId(ieta, iphi) );
42  }
43  if (use1x1_) {
44  int hfRing = cellId.ietaAbs();
45  if (hfRing==29) hfRing=30; // sum 29 into 30.
46 
47  int ieta = hfRing*cellId.zside();
48  int iphi = cellId.iphi();
49 
50  HcalTrigTowerDetId id(ieta,iphi);
51  id.setVersion(1); // version 1 for 1x1 HF granularity
52  results.emplace_back(id);
53  }
54 
55  } else {
56  // the first twenty rings are one-to-one
57  if(cellId.ietaAbs() < theTopology->firstHEDoublePhiRing()) {
58  results.emplace_back( HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()) );
59  } else {
60  // the remaining rings are two-to-one in phi
61  int iphi1 = cellId.iphi();
62  int ieta = cellId.ieta();
63  int depth = cellId.depth();
64  // the last eta ring in HE is split. Recombine.
65  if(ieta == theTopology->lastHERing()) --ieta;
66  if(ieta == -theTopology->lastHERing()) ++ieta;
67 
68  if (use2017_) {
69  if (ieta == 26 and depth == 7)
70  ++ieta;
71  if (ieta == -26 and depth == 7)
72  --ieta;
73  }
74 
75  results.emplace_back( HcalTrigTowerDetId(ieta, iphi1) );
76  results.emplace_back( HcalTrigTowerDetId(ieta, iphi1+1) );
77  }
78  }
79 
80  return results;
81 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
const HcalTopology * theTopology
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.cc:93
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.cc:98
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:103
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
int lastHERing() const
Definition: HcalTopology.h:90
int firstHFTower(int version) const
bool HcalTrigTowerGeometry::use1x1 ( ) const
inline

Definition at line 32 of file HcalTrigTowerGeometry.h.

References use1x1_.

Referenced by L1TCaloLayer1FetchLUTs().

32 { return use1x1_; }
bool HcalTrigTowerGeometry::useRCT ( ) const
inline

Definition at line 31 of file HcalTrigTowerGeometry.h.

References useRCT_.

31 { return useRCT_; }

Member Data Documentation

const HcalTopology* HcalTrigTowerGeometry::theTopology
private
bool HcalTrigTowerGeometry::use1x1_
private

Definition at line 53 of file HcalTrigTowerGeometry.h.

Referenced by HcalTrigTowerGeometry(), towerIds(), and use1x1().

bool HcalTrigTowerGeometry::use2017_
private

Definition at line 54 of file HcalTrigTowerGeometry.h.

Referenced by detIds(), HcalTrigTowerGeometry(), and towerIds().

bool HcalTrigTowerGeometry::useRCT_
private

Definition at line 52 of file HcalTrigTowerGeometry.h.

Referenced by HcalTrigTowerGeometry(), towerIds(), and useRCT().