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 82 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().

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

since the towers are irregular in eta in HF

Definition at line 200 of file HcalTrigTowerGeometry.cc.

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

Referenced by detIds(), and towerIds().

200  {
201  // count up to the correct HF ring
202  int inputTower = abs(ietaTower);
203  int result = theTopology->firstHFRing();
204  for(int iTower = firstHFTower(); iTower != inputTower; ++iTower) {
205  result += hfTowerEtaSize(iTower);
206  }
207 
208  // negative in, negative out.
209  if(ietaTower < 0) result *= -1;
210  return result;
211 }
int firstHFRing() const
Definition: HcalTopology.h:87
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 188 of file HcalTrigTowerGeometry.cc.

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

Referenced by detIds(), and firstHFRingInTower().

188  {
189 
190  if ( useUpgradeConfigurationHFTowers_ ) return 1;
191 
192  int ietaAbs = abs(ieta);
193  assert(ietaAbs >= firstHFTower() && ietaAbs <= nTowers());
194  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
195  return (ietaAbs == nTowers()) ? 4 : 3;
196 
197 }
assert(m_qm.get())
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 15 of file HcalTrigTowerGeometry.cc.

References useHFQuadPhiRings_, and useShortFibers_.

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

where this tower begins and ends in eta

Definition at line 214 of file HcalTrigTowerGeometry.cc.

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

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

214  {
215  int ietaAbs = abs(ieta);
216  std::pair<double,double> etas =
217  (ietaAbs < firstHFTower()) ? theTopology->etaRange(HcalBarrel,ietaAbs) :
218  theTopology->etaRange(HcalForward,ietaAbs);
219  eta1 = etas.first;
220  eta2 = etas.second;
221 
222  // get the signs and order right
223  if(ieta < 0) {
224  double tmp = eta1;
225  eta1 = -eta2;
226  eta2 = -tmp;
227  }
228 }
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
std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds ( const HcalDetId cellId) const

the mapping to and from DetIds

Definition at line 21 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().

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

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