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 (const HcalTopology *topology)
 
int hfTowerEtaSize (int ieta) const
 
int nPhiBins (int ieta) const
 an interface for CaloSubdetectorGeometry More...
 
int nTowers () const
 
void setUpgradeConfigurationHFTowers (bool value)
 
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

const HcalTopologytheTopology
 
bool useHFQuadPhiRings_
 
bool useShortFibers_
 
bool useUpgradeConfigurationHFTowers_
 

Detailed Description

Definition at line 10 of file HcalTrigTowerGeometry.h.

Constructor & Destructor Documentation

HcalTrigTowerGeometry::HcalTrigTowerGeometry ( const HcalTopology topology)

Member Function Documentation

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

Definition at line 84 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(), python.entryComment::results, theTopology, useUpgradeConfigurationHFTowers_, and ecaldqm::zside().

84  {
85  // Written, tested by E. Berry (Princeton)
86  std::vector<HcalDetId> results;
87 
88  int tower_ieta = hcalTrigTowerDetId.ieta();
89  int tower_iphi = hcalTrigTowerDetId.iphi();
90 
91  int cell_ieta = tower_ieta;
92  int cell_iphi = tower_iphi;
93 
94  int min_depth, n_depths;
95 
96  // HB
97 
98  if (abs(cell_ieta) <= theTopology->lastHBRing()){
99  theTopology->depthBinInformation(HcalBarrel, abs(tower_ieta), n_depths, min_depth);
100  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
101  results.push_back(HcalDetId(HcalBarrel,cell_ieta,cell_iphi,cell_depth));
102  }
103 
104  // HO
105 
106  if (abs(cell_ieta) <= theTopology->lastHORing()){
107  theTopology->depthBinInformation(HcalOuter , abs(tower_ieta), n_depths, min_depth);
108  for (int ho_depth = min_depth; ho_depth <= min_depth + n_depths - 1; ho_depth++)
109  results.push_back(HcalDetId(HcalOuter, cell_ieta,cell_iphi,ho_depth));
110  }
111 
112  // HE
113 
114  if (abs(cell_ieta) >= theTopology->firstHERing() &&
115  abs(cell_ieta) < theTopology->lastHERing()){
116 
117  theTopology->depthBinInformation(HcalEndcap, abs(tower_ieta), n_depths, min_depth);
118 
119  // Special for double-phi cells
120  if (abs(cell_ieta) >= theTopology->firstHEDoublePhiRing())
121  if (tower_iphi%2 == 0) cell_iphi = tower_iphi - 1;
122 
123  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
124  results.push_back(HcalDetId(HcalEndcap, cell_ieta, cell_iphi, cell_depth));
125 
126  // Special for split-eta cells
127  if (abs(tower_ieta) == 28){
128  theTopology->depthBinInformation(HcalEndcap, abs(tower_ieta)+1, n_depths, min_depth);
129  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++){
130  if (tower_ieta < 0) results.push_back(HcalDetId(HcalEndcap, tower_ieta - 1, cell_iphi, cell_depth));
131  if (tower_ieta > 0) results.push_back(HcalDetId(HcalEndcap, tower_ieta + 1, cell_iphi, cell_depth));
132  }
133  }
134 
135  }
136 
137  // HF
138 
139  if (abs(cell_ieta) >= theTopology->firstHFRing()){
140 
141  int HfTowerPhiSize;
142  if ( useUpgradeConfigurationHFTowers_ ) HfTowerPhiSize = 1;
143  else HfTowerPhiSize = 72 / nPhiBins(tower_ieta);
144 
145  int HfTowerEtaSize = hfTowerEtaSize(tower_ieta);
146  int FirstHFRingInTower = firstHFRingInTower(abs(tower_ieta));
147 
148  for (int iHFTowerPhiSegment = 0; iHFTowerPhiSegment < HfTowerPhiSize; iHFTowerPhiSegment++){
149 
150  cell_iphi = (tower_iphi / HfTowerPhiSize) * HfTowerPhiSize; // Find the minimum phi segment
151  if ( !useUpgradeConfigurationHFTowers_ ) cell_iphi -= 2; // The first trigger tower starts at HCAL iphi = 71, not HCAL iphi = 1
152  cell_iphi += iHFTowerPhiSegment; // Get all of the HCAL iphi values in this trigger tower
153  cell_iphi += 72; // Don't want to take the mod of a negative number
154  cell_iphi = cell_iphi % 72; // There are, at most, 72 cells.
155  if ( !useUpgradeConfigurationHFTowers_) cell_iphi += 1;// There is no cell at iphi = 0
156 
157  if (cell_iphi%2 == 0) continue; // These cells don't exist.
158 
159  for (int iHFTowerEtaSegment = 0; iHFTowerEtaSegment < HfTowerEtaSize; iHFTowerEtaSegment++){
160 
161  cell_ieta = FirstHFRingInTower + iHFTowerEtaSegment;
162 
163  if (cell_ieta >= 40 && cell_iphi%4 == 1) continue; // These cells don't exist.
164 
165  theTopology->depthBinInformation(HcalForward, cell_ieta, n_depths, min_depth);
166 
167  // Negative tower_ieta -> negative cell_ieta
168  int zside = 1;
169  if (tower_ieta < 0) zside = -1;
170 
171  cell_ieta *= zside;
172 
173  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
174  results.push_back(HcalDetId(HcalForward, cell_ieta, cell_iphi, cell_depth));
175 
176  if ( zside * cell_ieta == 30 ) {
177  theTopology->depthBinInformation(HcalForward, 29 * zside, n_depths, min_depth);
178  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
179  results.push_back(HcalDetId(HcalForward, 29 * zside , cell_iphi, cell_depth));
180  }
181 
182  }
183  }
184  }
185 
186  return results;
187 }
int firstHFRing() const
Definition: HcalTopology.h:83
const HcalTopology * theTopology
int lastHBRing() const
Definition: HcalTopology.h:80
int zside(DetId const &)
int ieta() const
get the tower ieta
int hfTowerEtaSize(int ieta) const
int nPhiBins(int ieta) const
an interface for CaloSubdetectorGeometry
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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:88
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
int firstHERing() const
Definition: HcalTopology.h:81
int lastHORing() const
Definition: HcalTopology.h:86
int iphi() const
get the tower iphi
int lastHERing() const
Definition: HcalTopology.h:82
int HcalTrigTowerGeometry::firstHFRingInTower ( int  ietaTower) const

since the towers are irregular in eta in HF

Definition at line 202 of file HcalTrigTowerGeometry.cc.

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

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

202  {
203  // count up to the correct HF ring
204  int inputTower = abs(ietaTower);
205  int result = theTopology->firstHFRing();
206  for(int iTower = firstHFTower(); iTower != inputTower; ++iTower) {
207  result += hfTowerEtaSize(iTower);
208  }
209 
210  // negative in, negative out.
211  if(ietaTower < 0) result *= -1;
212  return result;
213 }
int firstHFRing() const
Definition: HcalTopology.h:83
const HcalTopology * theTopology
int hfTowerEtaSize(int ieta) const
tuple result
Definition: query.py:137
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 190 of file HcalTrigTowerGeometry.cc.

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

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

190  {
191 
192  if ( useUpgradeConfigurationHFTowers_ ) return 1;
193 
194  int ietaAbs = abs(ieta);
195  assert(ietaAbs >= firstHFTower() && ietaAbs <= nTowers());
196  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
197  return (ietaAbs == nTowers()) ? 4 : 3;
198 
199 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 funct::abs(), firstHFTower(), and useUpgradeConfigurationHFTowers_.

Referenced by detIds().

25  {
26  int nPhiBinsHF = ( useUpgradeConfigurationHFTowers_ ? 36 : 18 );
27  return (abs(ieta) < firstHFTower()) ? 72 : nPhiBinsHF;
28  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int HcalTrigTowerGeometry::nTowers ( ) const
inline

Definition at line 31 of file HcalTrigTowerGeometry.h.

Referenced by hfTowerEtaSize().

31 {return 32;}
void HcalTrigTowerGeometry::setUpgradeConfigurationHFTowers ( bool  value)
inline
void HcalTrigTowerGeometry::setupHF ( bool  useShortFibers,
bool  useQuadRings 
)

Definition at line 17 of file HcalTrigTowerGeometry.cc.

References useHFQuadPhiRings_, and useShortFibers_.

17  {
18  useShortFibers_=useShortFibers;
19  useHFQuadPhiRings_=useQuadRings;
20 }
void HcalTrigTowerGeometry::towerEtaBounds ( int  ieta,
double &  eta1,
double &  eta2 
) const

where this tower begins and ends in eta

Definition at line 216 of file HcalTrigTowerGeometry.cc.

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

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

216  {
217  int ietaAbs = abs(ieta);
218  if(ietaAbs < firstHFTower()) {
219  eta1 = theHBHEEtaBounds[ietaAbs-1];
220  eta2 = theHBHEEtaBounds[ietaAbs];
221  // the last tower is split, so get tower 29, too
222  if(ietaAbs == theTopology->lastHERing()-1) {
223  eta2 = theHBHEEtaBounds[ietaAbs+1];
224  }
225  } else {
226  // count from 0
227  int hfIndex = firstHFRingInTower(ietaAbs) - theTopology->firstHFRing();
228  eta1 = theHFEtaBounds[hfIndex];
229  eta2 = theHFEtaBounds[hfIndex + hfTowerEtaSize(ieta)];
230  }
231 
232  // get the signs and order right
233  if(ieta < 0) {
234  double tmp = eta1;
235  eta1 = -eta2;
236  eta2 = -tmp;
237  }
238 }
int firstHFRing() const
Definition: HcalTopology.h:83
const HcalTopology * theTopology
int hfTowerEtaSize(int ieta) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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:82
std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds ( const HcalDetId cellId) const

the mapping to and from DetIds

Definition at line 23 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, edm::shift, HcalDetId::subdet(), theTopology, useHFQuadPhiRings_, useShortFibers_, useUpgradeConfigurationHFTowers_, and HcalDetId::zside().

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

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

Member Data Documentation

const HcalTopology* HcalTrigTowerGeometry::theTopology
private

Definition at line 48 of file HcalTrigTowerGeometry.h.

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

bool HcalTrigTowerGeometry::useHFQuadPhiRings_
private

Definition at line 50 of file HcalTrigTowerGeometry.h.

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

bool HcalTrigTowerGeometry::useShortFibers_
private

Definition at line 49 of file HcalTrigTowerGeometry.h.

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

bool HcalTrigTowerGeometry::useUpgradeConfigurationHFTowers_
private