CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HcalTrigTowerGeometry Class Reference

#include <HcalTrigTowerGeometry.h>

Public Member Functions

std::vector< HcalDetIddetIds (const HcalTrigTowerDetId &) const
 
int firstHFRingInTower (int ietaTower) const
 since the towers are irregular in eta in HF More...
 
int firstHFTower () const
 
 HcalTrigTowerGeometry ()
 
int hfTowerEtaSize (int ieta) const
 
int nPhiBins (int ieta) const
 an interface for CaloSubdetectorGeometry More...
 
int nTowers () const
 
void setupHF (bool useShortFibers, bool useQuadRings)
 
void towerEtaBounds (int ieta, 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...
 

Private Attributes

HcalTopology theTopology
 
bool useHFQuadPhiRings_
 
bool useShortFibers_
 

Detailed Description

Definition at line 10 of file HcalTrigTowerGeometry.h.

Constructor & Destructor Documentation

HcalTrigTowerGeometry::HcalTrigTowerGeometry ( )

Definition at line 9 of file HcalTrigTowerGeometry.cc.

References useHFQuadPhiRings_, and useShortFibers_.

Member Function Documentation

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

Definition at line 67 of file HcalTrigTowerGeometry.cc.

References 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(), python.entryComment::results, and theTopology.

67  {
68  // Written, tested by E. Berry (Princeton)
69  std::vector<HcalDetId> results;
70 
71  int tower_ieta = hcalTrigTowerDetId.ieta();
72  int tower_iphi = hcalTrigTowerDetId.iphi();
73 
74  int cell_ieta = tower_ieta;
75  int cell_iphi = tower_iphi;
76 
77  int min_depth, n_depths;
78 
79  // HB
80 
81  if (abs(cell_ieta) <= theTopology.lastHBRing()){
82  theTopology.depthBinInformation(HcalBarrel, abs(tower_ieta), n_depths, min_depth);
83  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
84  results.push_back(HcalDetId(HcalBarrel,cell_ieta,cell_iphi,cell_depth));
85  }
86 
87  // HO
88 
89  if (abs(cell_ieta) <= theTopology.lastHORing()){
90  theTopology.depthBinInformation(HcalOuter , abs(tower_ieta), n_depths, min_depth);
91  for (int ho_depth = min_depth; ho_depth <= min_depth + n_depths - 1; ho_depth++)
92  results.push_back(HcalDetId(HcalOuter, cell_ieta,cell_iphi,ho_depth));
93  }
94 
95  // HE
96 
97  if (abs(cell_ieta) >= theTopology.firstHERing() &&
98  abs(cell_ieta) < theTopology.lastHERing()){
99 
100  theTopology.depthBinInformation(HcalEndcap, abs(tower_ieta), n_depths, min_depth);
101 
102  // Special for double-phi cells
103  if (abs(cell_ieta) >= theTopology.firstHEDoublePhiRing())
104  if (tower_iphi%2 == 0) cell_iphi = tower_iphi - 1;
105 
106  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
107  results.push_back(HcalDetId(HcalEndcap, cell_ieta, cell_iphi, cell_depth));
108 
109  // Special for split-eta cells
110  if (abs(tower_ieta) == 28){
111  theTopology.depthBinInformation(HcalEndcap, abs(tower_ieta)+1, n_depths, min_depth);
112  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++){
113  if (tower_ieta < 0) results.push_back(HcalDetId(HcalEndcap, tower_ieta - 1, cell_iphi, cell_depth));
114  if (tower_ieta > 0) results.push_back(HcalDetId(HcalEndcap, tower_ieta + 1, cell_iphi, cell_depth));
115  }
116  }
117 
118  }
119 
120  // HF
121 
122  if (abs(cell_ieta) >= theTopology.firstHFRing()){
123 
124  int HfTowerPhiSize = 72 / nPhiBins(tower_ieta);
125  int HfTowerEtaSize = hfTowerEtaSize(tower_ieta);
126  int FirstHFRingInTower = firstHFRingInTower(abs(tower_ieta));
127 
128  for (int iHFTowerPhiSegment = 0; iHFTowerPhiSegment < HfTowerPhiSize; iHFTowerPhiSegment++){
129 
130  cell_iphi = (tower_iphi / HfTowerPhiSize) * HfTowerPhiSize; // Find the minimum phi segment
131  cell_iphi -= 2; // The first trigger tower starts at HCAL iphi = 71, not HCAL iphi = 1
132  cell_iphi += iHFTowerPhiSegment; // Get all of the HCAL iphi values in this trigger tower
133  cell_iphi += 72; // Don't want to take the mod of a negative number
134  cell_iphi = cell_iphi % 72; // There are, at most, 72 cells.
135  cell_iphi += 1; // There is no cell at iphi = 0
136 
137  if (cell_iphi%2 == 0) continue; // These cells don't exist.
138 
139  for (int iHFTowerEtaSegment = 0; iHFTowerEtaSegment < HfTowerEtaSize; iHFTowerEtaSegment++){
140 
141  cell_ieta = FirstHFRingInTower + iHFTowerEtaSegment;
142 
143  if (cell_ieta >= 40 && cell_iphi%4 == 1) continue; // These cells don't exist.
144 
145  theTopology.depthBinInformation(HcalForward, cell_ieta, n_depths, min_depth);
146 
147  // Negative tower_ieta -> negative cell_ieta
148  if (tower_ieta < 0) cell_ieta *= -1;
149 
150  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
151  results.push_back(HcalDetId(HcalForward, cell_ieta, cell_iphi, cell_depth));
152 
153  }
154  }
155  }
156 
157  return results;
158 }
int firstHFRing() const
Definition: HcalTopology.h:65
#define abs(x)
Definition: mlp_lapack.h:159
int lastHBRing() const
Definition: HcalTopology.h:62
int ieta() const
get the tower ieta
int hfTowerEtaSize(int ieta) const
int nPhiBins(int ieta) const
an interface for CaloSubdetectorGeometry
void depthBinInformation(HcalSubdetector subdet, int etaRing, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
int firstHERing() const
Definition: HcalTopology.h:63
int lastHORing() const
Definition: HcalTopology.h:68
int iphi() const
get the tower iphi
int lastHERing() const
Definition: HcalTopology.h:64
int HcalTrigTowerGeometry::firstHFRingInTower ( int  ietaTower) const

since the towers are irregular in eta in HF

Definition at line 169 of file HcalTrigTowerGeometry.cc.

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

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

169  {
170  // count up to the correct HF ring
171  int inputTower = abs(ietaTower);
173  for(int iTower = firstHFTower(); iTower != inputTower; ++iTower) {
174  result += hfTowerEtaSize(iTower);
175  }
176 
177  // negative in, negative out.
178  if(ietaTower < 0) result *= -1;
179  return result;
180 }
int firstHFRing() const
Definition: HcalTopology.h:65
#define abs(x)
Definition: mlp_lapack.h:159
int hfTowerEtaSize(int ieta) const
tuple result
Definition: query.py:137
int HcalTrigTowerGeometry::firstHFTower ( ) const
inline
int HcalTrigTowerGeometry::hfTowerEtaSize ( int  ieta) const

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

Definition at line 161 of file HcalTrigTowerGeometry.cc.

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

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

161  {
162  int ietaAbs = abs(ieta);
163  assert(ietaAbs >= firstHFTower() && ietaAbs <= nTowers());
164  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
165  return (ietaAbs == nTowers()) ? 4 : 3;
166 }
#define abs(x)
Definition: mlp_lapack.h:159
int HcalTrigTowerGeometry::nPhiBins ( int  ieta) const
inline

an interface for CaloSubdetectorGeometry

the number of phi bins in this eta ring

Definition at line 25 of file HcalTrigTowerGeometry.h.

References abs, and firstHFTower().

Referenced by detIds().

25  {
26  return (abs(ieta) < firstHFTower()) ? 72 : 18;
27  }
#define abs(x)
Definition: mlp_lapack.h:159
int HcalTrigTowerGeometry::nTowers ( ) const
inline

Definition at line 30 of file HcalTrigTowerGeometry.h.

Referenced by hfTowerEtaSize(), and CaloTPGTranscoderULUT::printDecompression().

30 {return 32;}
void HcalTrigTowerGeometry::setupHF ( bool  useShortFibers,
bool  useQuadRings 
)

Definition at line 14 of file HcalTrigTowerGeometry.cc.

References useHFQuadPhiRings_, and useShortFibers_.

14  {
15  useShortFibers_=useShortFibers;
16  useHFQuadPhiRings_=useQuadRings;
17 }
void HcalTrigTowerGeometry::towerEtaBounds ( int  ieta,
double &  eta1,
double &  eta2 
) const

where this tower begins and ends in eta

Definition at line 183 of file HcalTrigTowerGeometry.cc.

References abs, HcalTopology::firstHFRing(), firstHFRingInTower(), firstHFTower(), hfTowerEtaSize(), HcalTopology::lastHERing(), theHBHEEtaBounds, theHFEtaBounds, theTopology, and tmp.

Referenced by CaloTPGTranscoderULUT::loadHCALUncompress(), and L1CaloHcalScaleConfigOnlineProd::newObject().

183  {
184  int ietaAbs = abs(ieta);
185  if(ietaAbs < firstHFTower()) {
186  eta1 = theHBHEEtaBounds[ietaAbs-1];
187  eta2 = theHBHEEtaBounds[ietaAbs];
188  // the last tower is split, so get tower 29, too
189  if(ietaAbs == theTopology.lastHERing()-1) {
190  eta2 = theHBHEEtaBounds[ietaAbs+1];
191  }
192  } else {
193  // count from 0
194  int hfIndex = firstHFRingInTower(ietaAbs) - theTopology.firstHFRing();
195  eta1 = theHFEtaBounds[hfIndex];
196  eta2 = theHFEtaBounds[hfIndex + hfTowerEtaSize(ieta)];
197  }
198 
199  // get the signs and order right
200  if(ieta < 0) {
201  double tmp = eta1;
202  eta1 = -eta2;
203  eta2 = -tmp;
204  }
205 }
int firstHFRing() const
Definition: HcalTopology.h:65
#define abs(x)
Definition: mlp_lapack.h:159
int hfTowerEtaSize(int ieta) const
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
static const double theHFEtaBounds[]
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
static const double theHBHEEtaBounds[]
int lastHERing() const
Definition: HcalTopology.h:64
std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds ( const HcalDetId cellId) const

the mapping to and from DetIds

Definition at line 20 of file HcalTrigTowerGeometry.cc.

References HcalDetId::depth(), HcalTopology::firstHEDoublePhiRing(), HcalTopology::firstHFQuadPhiRing(), firstHFRingInTower(), firstHFTower(), HcalForward, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), HcalTopology::lastHERing(), python.entryComment::results, HcalDetId::subdet(), theTopology, useHFQuadPhiRings_, useShortFibers_, and HcalDetId::zside().

Referenced by HcalTriggerPrimitiveAlgo::addSignal(), and HcalTriggerPrimitiveAlgo::runFEFormatError().

20  {
21 
22  std::vector<HcalTrigTowerDetId> results;
23 
24  if(cellId.subdet() == HcalForward) {
25  // short fibers don't count
26  if(cellId.depth() == 1 || useShortFibers_) {
27  // first do eta
28  int hfRing = cellId.ietaAbs();
29  int ieta = firstHFTower();
30  // find the tower that contains this ring
31  while(hfRing >= firstHFRingInTower(ieta+1)) {
32  ++ieta;
33  }
34 
35  ieta *= cellId.zside();
36 
37  // now for phi
38  // HF towers are quad, 18 in phi.
39  // go two cells per trigger tower.
40  int iphi = (((cellId.iphi()+1)/4) * 4 + 1)%72; // 71+1 --> 1, 3+5 --> 5
42  results.push_back( HcalTrigTowerDetId(ieta, iphi) );
43  }
44 
45  } else {
46  // the first twenty rings are one-to-one
47  if(cellId.ietaAbs() < theTopology.firstHEDoublePhiRing()) {
48  results.push_back( HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()) );
49  } else {
50  // the remaining rings are two-to-one in phi
51  int iphi1 = cellId.iphi();
52  int ieta = cellId.ieta();
53  // the last eta ring in HE is split. Recombine.
54  if(ieta == theTopology.lastHERing()) --ieta;
55  if(ieta == -theTopology.lastHERing()) ++ieta;
56 
57  results.push_back( HcalTrigTowerDetId(ieta, iphi1) );
58  results.push_back( HcalTrigTowerDetId(ieta, iphi1+1) );
59  }
60  }
61 
62  return results;
63 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:34
int depth() const
get the tower depth
Definition: HcalDetId.h:42
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:36
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:71
int lastHERing() const
Definition: HcalTopology.h:64

Member Data Documentation

HcalTopology HcalTrigTowerGeometry::theTopology
private

Definition at line 43 of file HcalTrigTowerGeometry.h.

Referenced by detIds(), firstHFRingInTower(), towerEtaBounds(), and towerIds().

bool HcalTrigTowerGeometry::useHFQuadPhiRings_
private

Definition at line 45 of file HcalTrigTowerGeometry.h.

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

bool HcalTrigTowerGeometry::useShortFibers_
private

Definition at line 44 of file HcalTrigTowerGeometry.h.

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