test
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 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...
 
void setupHFTowers (bool enableRCT, bool enable1x1)
 
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 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 use1x1_, and useRCT_.

9  : theTopology( topology ) {
10  useRCT_=true;
11  use1x1_=true;
12 }
const HcalTopology * theTopology

Member Function Documentation

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

Definition at line 73 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, HcalTrigTowerDetId::version(), and ecaldqm::zside().

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

since the towers are irregular in eta in HF

Definition at line 200 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HcalTopology::firstHFRing(), firstHFTower(), hfTowerEtaSize(), mps_fire::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(0); 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: mps_fire.py:83
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 190 of file HcalTrigTowerGeometry.cc.

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

Referenced by detIds(), and firstHFRingInTower().

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

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

Referenced by detIds().

42  {
43  int nPhiBinsHF = ( 18 );
44  return (abs(ieta) < firstHFTower(version)) ? 72 : nPhiBinsHF;
45  }
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 30 of file HcalTrigTowerGeometry.h.

Referenced by hfTowerEtaSize().

30 {return (version==0)?(32):(41);}
void HcalTrigTowerGeometry::setupHFTowers ( bool  enableRCT,
bool  enable1x1 
)
inline

Definition at line 19 of file HcalTrigTowerGeometry.h.

References use1x1_, and useRCT_.

19  {
20  useRCT_=enableRCT;
21  use1x1_=enable1x1;
22  }
const HcalTopology& HcalTrigTowerGeometry::topology ( ) const
inline

Definition at line 33 of file HcalTrigTowerGeometry.h.

References theTopology.

33 { 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 214 of file HcalTrigTowerGeometry.cc.

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

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

214  {
215  int ietaAbs = abs(ieta);
216  std::pair<double,double> etas =
217  (ietaAbs < firstHFTower(version)) ? 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
int firstHFTower(int version) const
std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds ( const HcalDetId cellId) const

the mapping to and from DetIds

Definition at line 15 of file HcalTrigTowerGeometry.cc.

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

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

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

Definition at line 37 of file HcalTrigTowerGeometry.h.

References use1x1_.

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

Definition at line 36 of file HcalTrigTowerGeometry.h.

References useRCT_.

36 { return useRCT_; }

Member Data Documentation

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

Definition at line 57 of file HcalTrigTowerGeometry.h.

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

bool HcalTrigTowerGeometry::useRCT_
private

Definition at line 56 of file HcalTrigTowerGeometry.h.

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