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 89 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(), HcalTrigTowerDetId::zside(), and ecaldqm::zside().

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

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

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

225  {
226  // count up to the correct HF ring
227  int inputTower = abs(ietaTower);
228  int result = theTopology->firstHFRing();
229  for(int iTower = firstHFTower(0); iTower != inputTower; ++iTower) {
230  result += hfTowerEtaSize(iTower);
231  }
232 
233  // negative in, negative out.
234  if(ietaTower < 0) result *= -1;
235  return result;
236 }
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 215 of file HcalTrigTowerGeometry.cc.

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

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

215  {
216 
217  int ietaAbs = abs(ieta);
218  assert(ietaAbs >= firstHFTower(0) && ietaAbs <= nTowers(0));
219  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
220  return (ietaAbs == nTowers(0)) ? 4 : 3;
221 
222 }
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 239 of file HcalTrigTowerGeometry.cc.

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

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

239  {
240  int ietaAbs = abs(ieta);
241  std::pair<double,double> etas =
242  (ietaAbs < firstHFTower(version)) ? theTopology->etaRange(HcalBarrel,ietaAbs) :
243  theTopology->etaRange(HcalForward,ietaAbs);
244  eta1 = etas.first;
245  eta2 = etas.second;
246 
247  // get the signs and order right
248  if(ieta < 0) {
249  double tmp = eta1;
250  eta1 = -eta2;
251  eta2 = -tmp;
252  }
253 }
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 egammaForCoreTracking_cff::depth, HcalDetId::depth(), HcalTopology::firstHEDoublePhiRing(), firstHFRingInTower(), firstHFTower(), HcalForward, triggerObjects_cff::id, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::maxDepthHE(), mps_update::results, HcalDetId::subdet(), theTopology, use1x1_, use2017_, useRCT_, and HcalDetId::zside().

Referenced by HcalTriggerPrimitiveAlgo::addSignal(), HcalTriggerPrimitiveAlgo::analyzeQIE11(), 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->lastHBRing()) {
58  results.emplace_back( HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()) );
59  } else if (theTopology->maxDepthHE() == 0) {
60  // Ignore these
61  } else if (cellId.ietaAbs() < theTopology->firstHEDoublePhiRing()) {
62  results.emplace_back( HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()) );
63  } else {
64  // the remaining rings are two-to-one in phi
65  int iphi1 = cellId.iphi();
66  int ieta = cellId.ieta();
67  int depth = cellId.depth();
68  // the last eta ring in HE is split. Recombine.
69  if(ieta == theTopology->lastHERing()) --ieta;
70  if(ieta == -theTopology->lastHERing()) ++ieta;
71 
72  if (use2017_) {
73  if (ieta == 26 and depth == 7)
74  ++ieta;
75  if (ieta == -26 and depth == 7)
76  --ieta;
77  }
78 
79  results.emplace_back( HcalTrigTowerDetId(ieta, iphi1) );
80  results.emplace_back( HcalTrigTowerDetId(ieta, iphi1+1) );
81  }
82  }
83 
84  return results;
85 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:146
const HcalTopology * theTopology
int maxDepthHE() const
Definition: HcalTopology.h:146
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:149
int lastHBRing() const
Definition: HcalTopology.h:88
int depth() const
get the tower depth
Definition: HcalDetId.h:166
int ieta() const
get the cell ieta
Definition: HcalDetId.h:159
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:154
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
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().