CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CaloGeometryHelper Class Reference

#include <CaloGeometryHelper.h>

Inheritance diagram for CaloGeometryHelper:
Calorimeter

Public Types

typedef std::array< DetId, 8 > NeiVect
 
typedef math::XYZVector XYZPoint
 
typedef math::XYZVector XYZVector
 

Public Member Functions

bool borderCrossing (const DetId &, const DetId &) const
 
void buildCrystal (const DetId &id, Crystal &) const
 
 CaloGeometryHelper ()
 
 CaloGeometryHelper (const edm::ParameterSet &fastCalo)
 
DetId getClosestCell (const XYZPoint &point, bool ecal, bool central) const
 
const NeiVectgetNeighbours (const DetId &det) const
 
void getWindow (const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
 
void initialize (double bField)
 
double magneticField () const
 
bool move (DetId &cell, const CaloDirection &dir, bool fast=true) const
 
bool preshowerPresent () const
 
double preshowerZPosition (int layer) const
 
 ~CaloGeometryHelper ()
 
- Public Member Functions inherited from Calorimeter
 Calorimeter ()
 
 Calorimeter (const edm::ParameterSet &caloParameters)
 
const ECALPropertiesecalProperties (int onEcal) const
 ECAL properties. More...
 
const EcalBarrelGeometrygetEcalBarrelGeometry () const
 
const EcalEndcapGeometrygetEcalEndcapGeometry () const
 
const CaloSubdetectorGeometrygetEcalGeometry (int subdetn) const
 
const EcalPreshowerGeometrygetEcalPreshowerGeometry () const
 
const CaloSubdetectorTopologygetEcalTopology (int subdetn) const
 
const CaloSubdetectorGeometrygetHcalGeometry () const
 
const HCALPropertieshcalProperties (int onHcal) const
 HCAL properties. More...
 
const PreshowerLayer1Propertieslayer1Properties (int onLayer1) const
 Preshower Layer1 properties. More...
 
const PreshowerLayer2Propertieslayer2Properties (int onLayer2) const
 Preshower Layer2 properties. More...
 
void setupGeometry (const CaloGeometry &pG)
 
void setupTopology (const CaloTopology &)
 
 ~Calorimeter ()
 

Private Member Functions

void buildCrystalArray ()
 
void buildNeighbourArray ()
 
bool diagonalmove (DetId &cell, const CaloDirection &dir) const
 
bool simplemove (DetId &cell, const CaloDirection &dir) const
 

Private Attributes

std::vector< BaseCrystalbarrelCrystals_
 
std::vector< NeiVectbarrelNeighbours_
 
double bfield_
 
std::vector< BaseCrystalendcapCrystals_
 
std::vector< NeiVectendcapNeighbours_
 
bool neighbourmapcalculated_
 
bool preshowerPresent_
 
double psLayer1Z_
 
double psLayer2Z_
 

Additional Inherited Members

- Protected Attributes inherited from Calorimeter
const EcalBarrelGeometryEcalBarrelGeometry_
 
const CaloSubdetectorTopologyEcalBarrelTopology_
 
const EcalEndcapGeometryEcalEndcapGeometry_
 
const CaloSubdetectorTopologyEcalEndcapTopology_
 
const CaloSubdetectorGeometryHcalGeometry_
 
ECALBarrelPropertiesmyECALBarrelProperties_
 
ECALEndcapPropertiesmyECALEndcapProperties_
 
HCALBarrelPropertiesmyHCALBarrelProperties_
 
HCALEndcapPropertiesmyHCALEndcapProperties_
 
HCALForwardPropertiesmyHCALForwardProperties_
 
PreshowerLayer1PropertiesmyPreshowerLayer1Properties_
 
PreshowerLayer2PropertiesmyPreshowerLayer2Properties_
 
const EcalPreshowerGeometryPreshowerGeometry_
 

Detailed Description

Definition at line 18 of file CaloGeometryHelper.h.

Member Typedef Documentation

◆ NeiVect

typedef std::array<DetId, 8> CaloGeometryHelper::NeiVect

Definition at line 41 of file CaloGeometryHelper.h.

◆ XYZPoint

Definition at line 21 of file CaloGeometryHelper.h.

◆ XYZVector

Definition at line 20 of file CaloGeometryHelper.h.

Constructor & Destructor Documentation

◆ CaloGeometryHelper() [1/2]

CaloGeometryHelper::CaloGeometryHelper ( )

Definition at line 26 of file CaloGeometryHelper.cc.

26  : Calorimeter() {
28  psLayer1Z_ = 303;
29  psLayer2Z_ = 307;
30 }

References neighbourmapcalculated_, psLayer1Z_, and psLayer2Z_.

◆ CaloGeometryHelper() [2/2]

CaloGeometryHelper::CaloGeometryHelper ( const edm::ParameterSet fastCalo)

Definition at line 32 of file CaloGeometryHelper.cc.

32  : Calorimeter(fastCalo) {
33  // std::cout << " In the constructor with ParameterSet " << std::endl;
34  psLayer1Z_ = 303;
35  psLayer2Z_ = 307;
36 }

References psLayer1Z_, and psLayer2Z_.

◆ ~CaloGeometryHelper()

CaloGeometryHelper::~CaloGeometryHelper ( )

Definition at line 56 of file CaloGeometryHelper.cc.

56 { ; }

Member Function Documentation

◆ borderCrossing()

bool CaloGeometryHelper::borderCrossing ( const DetId c1,
const DetId c2 
) const

Definition at line 370 of file CaloGeometryHelper.cc.

370  {
371  if (c1.subdetId() != c2.subdetId())
372  return false;
373 
374  if (c1.subdetId() == EcalBarrel) {
375  // there is a crack if the two cells don't belong to the same
376  // module
377  EBDetId cc1(c1);
378  EBDetId cc2(c2);
379  return (cc1.im() != cc2.im() || cc1.ism() != cc2.ism());
380  }
381 
382  if (c1.subdetId() == EcalEndcap) {
383  // there is a crack if the two cells don't belong to the same
384  // module
385  return (EEDetId(c1).isc() != EEDetId(c2).isc());
386  }
387  return false;
388 }

References alignmentValidation::c1, EcalBarrel, EcalEndcap, EBDetId::im(), EEDetId::isc(), EBDetId::ism(), and DetId::subdetId().

Referenced by EcalHitMaker::buildSegments(), and EcalHitMaker::configureGeometry().

◆ buildCrystal()

void CaloGeometryHelper::buildCrystal ( const DetId id,
Crystal xtal 
) const

Definition at line 157 of file CaloGeometryHelper.cc.

157  {
158  if (cell.subdetId() == EcalBarrel) {
159  xtal = Crystal(cell, &barrelCrystals_[EBDetId(cell).hashedIndex()]);
160  return;
161  }
162  if (cell.subdetId() == EcalEndcap) {
163  xtal = Crystal(cell, &endcapCrystals_[EEDetId(cell).hashedIndex()]);
164  return;
165  }
166 }

References barrelCrystals_, EcalBarrel, EcalEndcap, endcapCrystals_, ecalpyutils::hashedIndex(), and DetId::subdetId().

Referenced by EcalHitMaker::buildGeometry(), and EcalHitMaker::EcalHitMaker().

◆ buildCrystalArray()

void CaloGeometryHelper::buildCrystalArray ( )
private

Definition at line 390 of file CaloGeometryHelper.cc.

390  {
391  const unsigned nbarrel = EBDetId::kSizeForDenseIndexing;
392  // Barrel first. The hashed index runs from 0 to 61199
393  barrelCrystals_.resize(nbarrel, BaseCrystal());
394 
395  //std::cout << " Building the array of crystals (barrel) " ;
396  const std::vector<DetId>& vec(EcalBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel));
397  unsigned size = vec.size();
398  for (unsigned ic = 0; ic < size; ++ic) {
399  unsigned hashedindex = EBDetId(vec[ic]).hashedIndex();
400  auto geom = EcalBarrelGeometry_->getGeometry(vec[ic]);
401  BaseCrystal xtal(vec[ic]);
402  xtal.setCorners(geom->getCorners(), geom->getPosition());
403  barrelCrystals_[hashedindex] = xtal;
404  }
405 
406  // std::cout << " done " << size << std::endl;
407  // std::cout << " Building the array of crystals (endcap) " ;
408 
409  const std::vector<DetId>& vece(EcalEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap));
410  size = vece.size();
411  // There are some holes in the hashedIndex for the EE. Hence the array is bigger than the number
412  // of crystals
413  const unsigned nendcap = EEDetId::kSizeForDenseIndexing;
414 
415  endcapCrystals_.resize(nendcap, BaseCrystal());
416  for (unsigned ic = 0; ic < size; ++ic) {
417  unsigned hashedindex = EEDetId(vece[ic]).hashedIndex();
418  auto geom = EcalEndcapGeometry_->getGeometry(vece[ic]);
419  BaseCrystal xtal(vece[ic]);
420  xtal.setCorners(geom->getCorners(), geom->getPosition());
421  endcapCrystals_[hashedindex] = xtal;
422  }
423  // std::cout << " done " << size << std::endl;
424 }

References barrelCrystals_, DetId::Ecal, EcalBarrel, Calorimeter::EcalBarrelGeometry_, EcalEndcap, Calorimeter::EcalEndcapGeometry_, endcapCrystals_, relativeConstraints::geom, CaloSubdetectorGeometry::getGeometry(), CaloSubdetectorGeometry::getValidDetIds(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, BaseCrystal::setCorners(), and findQualityFiles::size.

Referenced by initialize().

◆ buildNeighbourArray()

void CaloGeometryHelper::buildNeighbourArray ( )
private

Definition at line 169 of file CaloGeometryHelper.cc.

169  {
171 
172  const unsigned nbarrel = EBDetId::kSizeForDenseIndexing;
173  // Barrel first. The hashed index runs from 0 to 61199
174  barrelNeighbours_.resize(nbarrel);
175 
176  //std::cout << " Building the array of neighbours (barrel) " ;
177 
178  const std::vector<DetId>& vec(EcalBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel));
179  unsigned size = vec.size();
180  for (unsigned ic = 0; ic < size; ++ic) {
181  // We get the 9 cells in a square.
182  std::vector<DetId> neighbours(EcalBarrelTopology_->getWindow(vec[ic], 3, 3));
183  // std::cout << " Cell " << EBDetId(vec[ic]) << std::endl;
184  unsigned nneighbours = neighbours.size();
185 
186  unsigned hashedindex = EBDetId(vec[ic]).hashedIndex();
187  if (hashedindex >= nbarrel) {
188  LogDebug("CaloGeometryTools") << " Array overflow " << std::endl;
189  }
190 
191  // If there are 9 cells, it is easy, and this order is know:
192  // 6 7 8
193  // 3 4 5
194  // 0 1 2 (0 = SOUTHWEST)
195 
196  if (nneighbours == 9) {
197  //barrelNeighbours_[hashedindex].reserve(8);
198  unsigned int nn = 0;
199  for (unsigned in = 0; in < nneighbours; ++in) {
200  // remove the centre
201  if (neighbours[in] != vec[ic]) {
202  barrelNeighbours_[hashedindex][nn] = (neighbours[in]);
203  nn++;
204  // std::cout << " Neighbour " << in << " " << EBDetId(neighbours[in]) << std::endl;
205  }
206  }
207  } else {
208  DetId central(vec[ic]);
209  //barrelNeighbours_[hashedindex].resize(8,DetId(0));
210  for (unsigned idir = 0; idir < 8; ++idir) {
211  DetId testid = central;
212  bool status = move(testid, orderedDir[idir], false);
213  if (status)
214  barrelNeighbours_[hashedindex][idir] = testid;
215  }
216  }
217  }
218 
219  // Moved to the endcap
220 
221  // std::cout << " done " << size << std::endl;
222  // std::cout << " Building the array of neighbours (endcap) " ;
223 
224  const std::vector<DetId>& vece(EcalEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap));
225  size = vece.size();
226  // There are some holes in the hashedIndex for the EE. Hence the array is bigger than the number
227  // of crystals
228  const unsigned nendcap = EEDetId::kSizeForDenseIndexing;
229 
230  endcapNeighbours_.resize(nendcap);
231  for (unsigned ic = 0; ic < size; ++ic) {
232  // We get the 9 cells in a square.
233  std::vector<DetId> neighbours(EcalEndcapTopology_->getWindow(vece[ic], 3, 3));
234  unsigned nneighbours = neighbours.size();
235  // remove the centre
236  unsigned hashedindex = EEDetId(vece[ic]).hashedIndex();
237 
238  if (hashedindex >= nendcap) {
239  LogDebug("CaloGeometryTools") << " Array overflow " << std::endl;
240  }
241 
242  if (nneighbours == 9) {
243  //endcapNeighbours_[hashedindex].reserve(8);
244  unsigned int nn = 0;
245  for (unsigned in = 0; in < nneighbours; ++in) {
246  // remove the centre
247  if (neighbours[in] != vece[ic]) {
248  endcapNeighbours_[hashedindex][nn] = (neighbours[in]);
249  nn++;
250  }
251  }
252  } else {
253  DetId central(vece[ic]);
254  //endcapNeighbours_[hashedindex].resize(8,DetId(0));
255  for (unsigned idir = 0; idir < 8; ++idir) {
256  DetId testid = central;
257  bool status = move(testid, orderedDir[idir], false);
258  if (status)
259  endcapNeighbours_[hashedindex][idir] = testid;
260  }
261  }
262  }
263  // std::cout << " done " << size <<std::endl;
265 }

References barrelNeighbours_, central, EAST, DetId::Ecal, EcalBarrel, Calorimeter::EcalBarrelGeometry_, Calorimeter::EcalBarrelTopology_, EcalEndcap, Calorimeter::EcalEndcapGeometry_, Calorimeter::EcalEndcapTopology_, endcapNeighbours_, CaloSubdetectorGeometry::getValidDetIds(), CaloSubdetectorTopology::getWindow(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), recoMuon::in, EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, LogDebug, move(), neighbourmapcalculated_, groupFilesInBlocks::nn, NORTH, NORTHEAST, NORTHWEST, orderedDir, findQualityFiles::size, SOUTH, SOUTHEAST, SOUTHWEST, mps_update::status, and WEST.

Referenced by initialize().

◆ diagonalmove()

bool CaloGeometryHelper::diagonalmove ( DetId cell,
const CaloDirection dir 
) const
private

Definition at line 318 of file CaloGeometryHelper.cc.

318  {
319  bool result;
320  // One has to try both paths
321  if (dir == NORTHEAST) {
322  result = simplemove(cell, NORTH);
323  if (result)
324  return simplemove(cell, EAST);
325  else {
326  result = simplemove(cell, EAST);
327  if (result)
328  return simplemove(cell, NORTH);
329  else
330  return false;
331  }
332  } else if (dir == NORTHWEST) {
333  result = simplemove(cell, NORTH);
334  if (result)
335  return simplemove(cell, WEST);
336  else {
337  result = simplemove(cell, WEST);
338  if (result)
339  return simplemove(cell, NORTH);
340  else
341  return false;
342  }
343  } else if (dir == SOUTHEAST) {
344  result = simplemove(cell, SOUTH);
345  if (result)
346  return simplemove(cell, EAST);
347  else {
348  result = simplemove(cell, EAST);
349  if (result)
350  return simplemove(cell, SOUTH);
351  else
352  return false;
353  }
354  } else if (dir == SOUTHWEST) {
355  result = simplemove(cell, SOUTH);
356  if (result)
357  return simplemove(cell, WEST);
358  else {
359  result = simplemove(cell, SOUTH);
360  if (result)
361  return simplemove(cell, WEST);
362  else
363  return false;
364  }
365  }
366  cell = DetId(0);
367  return false;
368 }

References DeadROC_duringRun::dir, EAST, NORTH, NORTHEAST, NORTHWEST, mps_fire::result, simplemove(), SOUTH, SOUTHEAST, SOUTHWEST, and WEST.

Referenced by move().

◆ getClosestCell()

DetId CaloGeometryHelper::getClosestCell ( const XYZPoint point,
bool  ecal,
bool  central 
) const

Definition at line 58 of file CaloGeometryHelper.cc.

58  {
59  DetId result;
60  if (ecal) {
61  if (central) {
62  // std::cout << "EcalBarrelGeometry_" << " " << EcalBarrelGeometry_ << std::endl;
64 #ifdef DEBUGGCC
65  if (result.null())
66  return result;
67  GlobalPoint ip = GlobalPoint(point.X(), point.Y(), point.Z());
69  float deltaeta2 = ip.eta() - cc.eta();
70  deltaeta2 *= deltaeta2;
71  float deltaphi2 = acos(cos(ip.phi() - cc.phi()));
72  deltaphi2 *= deltaphi2;
73  Histos::instance()->fill("h100", point.eta(), sqrt(deltaeta2 + deltaphi2));
74 #endif
75  } else {
77 #ifdef DEBUGGCC
78  if (result.null()) {
79  return result;
80  }
81  GlobalPoint ip = GlobalPoint(point.X(), point.Y(), point.Z());
83  Histos::instance()->fill("h110", point.eta(), (ip - cc).perp());
84 #endif
85  }
86  } else {
87  result = static_cast<const HcalGeometry*>(HcalGeometry_)
88  ->getClosestCell(GlobalPoint(point.X(), point.Y(), point.Z()), true);
89  HcalDetId myDetId(result);
90 
91  // special patch for HF (this is already a part of HcalGeometry)
92  if (myDetId.subdetId() == HcalForward) {
93  int mylayer;
94  if (fabs(point.Z()) > 1132.) {
95  mylayer = 2;
96  } else {
97  mylayer = 1;
98  }
99  HcalDetId myDetId2((HcalSubdetector)myDetId.subdetId(), myDetId.ieta(), myDetId.iphi(), mylayer);
100  result = myDetId2;
101  // return result;
102  }
103 
104  // Special patch to correct the HCAL geometry (does not work)
105  /*
106  if(result.subdetId()!=HcalEndcap) return result;
107  if(myDetId.depth()==3) return result;
108 
109  int ieta=myDetId.ietaAbs();
110  float azmin=400.458; /// in sync with BaseParticlePropagator
111 
112  if(ieta<=17)
113  return result;
114  else if(ieta>=18 && ieta<=26)
115  azmin += 35.0; // don't consider ieta=18 nose separately
116  else if(ieta>=27)
117  azmin += 21.0;
118 
119  HcalDetId first(HcalEndcap,myDetId.ieta(),myDetId.iphi(),1);
120  bool layer2=(fabs(point.Z())>azmin);
121  if(!layer2)
122  {
123  return first;
124  }
125  else
126  {
127  HcalDetId second(HcalEndcap,myDetId.ieta(),myDetId.iphi(),2);
128  if(second!=HcalDetId()) result=second;
129  }
130  */
131 #ifdef DEBUGGCC
132  if (result.null()) {
133  return result;
134  }
135  GlobalPoint ip = GlobalPoint(point.x(), point.y(), point.z());
136  GlobalPoint cc = HcalGeometry_->getPosition(result);
137  float deltaeta2 = ip.eta() - cc.eta();
138  deltaeta2 *= deltaeta2;
139  float deltaphi2 = acos(cos(ip.phi() - cc.phi()));
140  deltaphi2 *= deltaphi2;
141 
142  Histos::instance()->fill("h120", point.eta(), sqrt(deltaeta2 + deltaphi2));
143 #endif
144  }
145  return result;
146 }

References central, funct::cos(), bsc_activity_cfg::ecal, Calorimeter::EcalBarrelGeometry_, Calorimeter::EcalEndcapGeometry_, PV3DBase< T, PVType, FrameType >::eta(), Histos::fill(), EcalEndcapGeometry::getClosestCell(), EcalBarrelGeometry::getClosestCell(), CaloSubdetectorGeometry::getGeometry(), HcalForward, Calorimeter::HcalGeometry_, HcalDetId::ieta(), Histos::instance(), HcalDetId::iphi(), perp(), PV3DBase< T, PVType, FrameType >::phi(), point, mps_fire::result, mathSSE::sqrt(), and DetId::subdetId().

Referenced by HcalHitMaker::addHit(), EcalHitMaker::EcalHitMaker(), CalorimetryManager::EMShowerSimulation(), CalorimetryManager::HDShowerSimulation(), CalorimetryManager::MuonMipSimulation(), and CalorimetryManager::reconstructHCAL().

◆ getNeighbours()

const CaloGeometryHelper::NeiVect & CaloGeometryHelper::getNeighbours ( const DetId det) const

◆ getWindow()

void CaloGeometryHelper::getWindow ( const DetId pivot,
int  s1,
int  s2,
std::vector< DetId > &  vec 
) const

Definition at line 148 of file CaloGeometryHelper.cc.

148  {
149  // currently the getWindow method is the same for EcalBarrelTopology and EndcapTopology
150  // (implemented in CaloSubDetectorTopology)
151  // optimized versions are foreseen
152  vec = getEcalTopology(pivot.subdetId())->getWindow(pivot, s1, s2);
154  sort(vec.begin(), vec.end(), distance);
155 }

References HLT_FULL_cff::distance, Calorimeter::getEcalGeometry(), Calorimeter::getEcalTopology(), indexGen::s2, and DetId::subdetId().

Referenced by EcalHitMaker::EcalHitMaker().

◆ initialize()

void CaloGeometryHelper::initialize ( double  bField)

Definition at line 38 of file CaloGeometryHelper.cc.

38  {
41  bfield_ = bField;
43 
44  if (preshowerPresent_) {
45  ESDetId cps1(getEcalPreshowerGeometry()->getClosestCellInPlane(GlobalPoint(80., 80., 303.), 1));
46  psLayer1Z_ = getEcalPreshowerGeometry()->getGeometry(cps1)->getPosition().z();
47  ESDetId cps2(getEcalPreshowerGeometry()->getClosestCellInPlane(GlobalPoint(80., 80., 307.), 2));
48  psLayer2Z_ = getEcalPreshowerGeometry()->getGeometry(cps2)->getPosition().z();
49  LogDebug("CaloGeometryTools") << " Preshower layer positions " << psLayer1Z_ << " " << psLayer2Z_ << std::endl;
50  } else
51  LogDebug("CaloGeometryTools") << " No preshower present" << std::endl;
52 
53  // std::cout << " Preshower layer positions " << psLayer1Z_ << " " << psLayer2Z_ << std::endl;
54 }

References Calorimetry_cff::bField, bfield_, buildCrystalArray(), buildNeighbourArray(), Calorimeter::getEcalPreshowerGeometry(), CaloSubdetectorGeometry::getGeometry(), LogDebug, preshowerPresent_, psLayer1Z_, and psLayer2Z_.

Referenced by FamosManager::setupGeometryAndField().

◆ magneticField()

double CaloGeometryHelper::magneticField ( ) const
inline

Definition at line 44 of file CaloGeometryHelper.h.

44 { return bfield_; }

References bfield_.

Referenced by EcalHitMaker::configureGeometry().

◆ move()

bool CaloGeometryHelper::move ( DetId cell,
const CaloDirection dir,
bool  fast = true 
) const

Definition at line 272 of file CaloGeometryHelper.cc.

272  {
273  DetId originalcell = cell;
274  if (dir == NONE || cell == DetId(0))
275  return false;
276 
277  // Conversion CaloDirection and index in the table
278  // CaloDirection :NONE,SOUTH,SOUTHEAST,SOUTHWEST,EAST,WEST, NORTHEAST,NORTHWEST,NORTH
279  // Table : SOUTHWEST,SOUTH,SOUTHEAST,WEST,EAST,NORTHWEST,NORTH, NORTHEAST
280  static const int calodirections[9] = {-1, 1, 2, 0, 4, 3, 7, 5, 6};
281 
282  if (fast && neighbourmapcalculated_) {
283  DetId result = (originalcell.subdetId() == EcalBarrel)
284  ? barrelNeighbours_[EBDetId(originalcell).hashedIndex()][calodirections[dir]]
285  : endcapNeighbours_[EEDetId(originalcell).hashedIndex()][calodirections[dir]];
286  bool status = !result.null();
287  cell = result;
288  return status;
289  }
290 
291  if (dir == NORTH || dir == SOUTH || dir == EAST || dir == WEST) {
292  return simplemove(cell, dir);
293  } else {
294  if (dir == NORTHEAST || dir == NORTHWEST || dir == SOUTHEAST || dir == SOUTHWEST)
295  return diagonalmove(cell, dir);
296  }
297 
298  cell = DetId(0);
299  return false;
300 }

References barrelNeighbours_, diagonalmove(), DeadROC_duringRun::dir, EAST, EcalBarrel, endcapNeighbours_, EBDetId::hashedIndex(), EEDetId::hashedIndex(), neighbourmapcalculated_, NONE, NORTH, NORTHEAST, NORTHWEST, mps_fire::result, simplemove(), SOUTH, SOUTHEAST, SOUTHWEST, mps_update::status, DetId::subdetId(), and WEST.

Referenced by buildNeighbourArray(), and EcalHitMaker::configureGeometry().

◆ preshowerPresent()

bool CaloGeometryHelper::preshowerPresent ( ) const
inline

Definition at line 51 of file CaloGeometryHelper.h.

51 { return preshowerPresent_; };

References preshowerPresent_.

Referenced by CalorimetryManager::initialize().

◆ preshowerZPosition()

double CaloGeometryHelper::preshowerZPosition ( int  layer) const
inline

Definition at line 33 of file CaloGeometryHelper.h.

33 { return (layer == 1) ? psLayer1Z_ : psLayer2Z_; }

References psLayer1Z_, and psLayer2Z_.

Referenced by PreshowerHitMaker::addHit(), and PreshowerHitMaker::PreshowerHitMaker().

◆ simplemove()

bool CaloGeometryHelper::simplemove ( DetId cell,
const CaloDirection dir 
) const
private

Definition at line 302 of file CaloGeometryHelper.cc.

302  {
303  std::vector<DetId> neighbours;
304  if (cell.subdetId() == EcalBarrel)
305  neighbours = EcalBarrelTopology_->getNeighbours(cell, dir);
306  else if (cell.subdetId() == EcalEndcap)
307  neighbours = EcalEndcapTopology_->getNeighbours(cell, dir);
308 
309  if ((!neighbours.empty()) && (!neighbours[0].null())) {
310  cell = neighbours[0];
311  return true;
312  } else {
313  cell = DetId(0);
314  return false;
315  }
316 }

References DeadROC_duringRun::dir, EcalBarrel, Calorimeter::EcalBarrelTopology_, EcalEndcap, Calorimeter::EcalEndcapTopology_, CaloSubdetectorTopology::getNeighbours(), and DetId::subdetId().

Referenced by diagonalmove(), and move().

Member Data Documentation

◆ barrelCrystals_

std::vector<BaseCrystal> CaloGeometryHelper::barrelCrystals_
private

Definition at line 67 of file CaloGeometryHelper.h.

Referenced by buildCrystal(), and buildCrystalArray().

◆ barrelNeighbours_

std::vector<NeiVect> CaloGeometryHelper::barrelNeighbours_
private

Definition at line 64 of file CaloGeometryHelper.h.

Referenced by buildNeighbourArray(), getNeighbours(), and move().

◆ bfield_

double CaloGeometryHelper::bfield_
private

Definition at line 73 of file CaloGeometryHelper.h.

Referenced by initialize(), and magneticField().

◆ endcapCrystals_

std::vector<BaseCrystal> CaloGeometryHelper::endcapCrystals_
private

Definition at line 68 of file CaloGeometryHelper.h.

Referenced by buildCrystal(), and buildCrystalArray().

◆ endcapNeighbours_

std::vector<NeiVect> CaloGeometryHelper::endcapNeighbours_
private

Definition at line 65 of file CaloGeometryHelper.h.

Referenced by buildNeighbourArray(), getNeighbours(), and move().

◆ neighbourmapcalculated_

bool CaloGeometryHelper::neighbourmapcalculated_
private

Definition at line 70 of file CaloGeometryHelper.h.

Referenced by buildNeighbourArray(), CaloGeometryHelper(), and move().

◆ preshowerPresent_

bool CaloGeometryHelper::preshowerPresent_
private

Definition at line 74 of file CaloGeometryHelper.h.

Referenced by initialize(), and preshowerPresent().

◆ psLayer1Z_

double CaloGeometryHelper::psLayer1Z_
private

Definition at line 61 of file CaloGeometryHelper.h.

Referenced by CaloGeometryHelper(), initialize(), and preshowerZPosition().

◆ psLayer2Z_

double CaloGeometryHelper::psLayer2Z_
private

Definition at line 61 of file CaloGeometryHelper.h.

Referenced by CaloGeometryHelper(), initialize(), and preshowerZPosition().

EBDetId::hashedIndex
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
Calorimeter::EcalEndcapGeometry_
const EcalEndcapGeometry * EcalEndcapGeometry_
Definition: Calorimeter.h:74
CaloDirection
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
CaloGeometryHelper::psLayer2Z_
double psLayer2Z_
Definition: CaloGeometryHelper.h:61
Calorimeter::Calorimeter
Calorimeter()
Definition: Calorimeter.cc:22
BaseCrystal
Definition: BaseCrystal.h:19
Histos::instance
static Histos * instance()
Definition: Histos.cc:15
EEDetId::isc
int isc() const
Definition: EEDetId.cc:222
mps_update.status
status
Definition: mps_update.py:69
Calorimeter::EcalEndcapTopology_
const CaloSubdetectorTopology * EcalEndcapTopology_
Definition: Calorimeter.h:80
Crystal
Definition: Crystal.h:20
EBDetId
Definition: EBDetId.h:17
central
Definition: L1ECALPrefiringWeightProducer.cc:36
CaloGeometryHelper::diagonalmove
bool diagonalmove(DetId &cell, const CaloDirection &dir) const
Definition: CaloGeometryHelper.cc:318
ESDetId
Definition: ESDetId.h:15
indexGen.s2
s2
Definition: indexGen.py:107
CaloGeometryHelper::simplemove
bool simplemove(DetId &cell, const CaloDirection &dir) const
Definition: CaloGeometryHelper.cc:302
DistanceToCell
Definition: DistanceToCell.h:11
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
EcalBarrel
Definition: EcalSubdetector.h:10
DetId
Definition: DetId.h:17
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
EAST
Definition: CaloDirection.h:14
NORTH
Definition: CaloDirection.h:18
CaloGeometryHelper::barrelCrystals_
std::vector< BaseCrystal > barrelCrystals_
Definition: CaloGeometryHelper.h:67
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
orderedDir
static const CaloDirection orderedDir[8]
Definition: PFECALHashNavigator.h:17
SOUTHEAST
Definition: CaloDirection.h:12
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
CaloGeometryHelper::buildCrystalArray
void buildCrystalArray()
Definition: CaloGeometryHelper.cc:390
CaloSubdetectorGeometry::getValidDetIds
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
Definition: CaloSubdetectorGeometry.cc:32
EcalBarrelGeometry::getClosestCell
DetId getClosestCell(const GlobalPoint &r) const override
Definition: EcalBarrelGeometry.cc:63
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EEDetId
Definition: EEDetId.h:14
Calorimeter::getEcalTopology
const CaloSubdetectorTopology * getEcalTopology(int subdetn) const
Definition: Calorimeter.cc:143
EcalEndcap
Definition: EcalSubdetector.h:10
CaloSubdetectorTopology::getNeighbours
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
Definition: CaloSubdetectorTopology.h:77
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
CaloGeometryHelper::endcapNeighbours_
std::vector< NeiVect > endcapNeighbours_
Definition: CaloGeometryHelper.h:65
CaloGeometryHelper::endcapCrystals_
std::vector< BaseCrystal > endcapCrystals_
Definition: CaloGeometryHelper.h:68
recoMuon::in
Definition: RecoMuonEnumerators.h:6
CaloGeometryHelper::bfield_
double bfield_
Definition: CaloGeometryHelper.h:73
EEDetId::hashedIndex
int hashedIndex() const
Definition: EEDetId.h:183
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
HcalDetId
Definition: HcalDetId.h:12
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
SOUTHWEST
Definition: CaloDirection.h:13
CaloGeometryHelper::getWindow
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
Definition: CaloGeometryHelper.cc:148
CaloSubdetectorGeometry::getGeometry
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Definition: CaloSubdetectorGeometry.cc:36
DetId::Ecal
Definition: DetId.h:27
cc
Calorimeter::HcalGeometry_
const CaloSubdetectorGeometry * HcalGeometry_
Definition: Calorimeter.h:75
Calorimeter::EcalBarrelGeometry_
const EcalBarrelGeometry * EcalBarrelGeometry_
Definition: Calorimeter.h:73
groupFilesInBlocks.nn
nn
Definition: groupFilesInBlocks.py:150
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
CaloSubdetectorTopology::getWindow
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: CaloSubdetectorTopology.cc:4
HcalForward
Definition: HcalAssistant.h:36
CaloGeometryHelper::preshowerPresent_
bool preshowerPresent_
Definition: CaloGeometryHelper.h:74
WEST
Definition: CaloDirection.h:15
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:292
NORTHWEST
Definition: CaloDirection.h:17
Histos::fill
void fill(const std::string &name, float val1, float val2=1., float val3=1.)
Fill an histogram.
Definition: Histos.cc:125
NONE
Definition: TkAlStyle.cc:47
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
CaloGeometryHelper::move
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const
Definition: CaloGeometryHelper.cc:272
bsc_activity_cfg.ecal
ecal
Definition: bsc_activity_cfg.py:25
CaloGeometryHelper::barrelNeighbours_
std::vector< NeiVect > barrelNeighbours_
Definition: CaloGeometryHelper.h:64
Calorimeter::getEcalPreshowerGeometry
const EcalPreshowerGeometry * getEcalPreshowerGeometry() const
Definition: Calorimeter.h:54
CaloGeometryHelper::psLayer1Z_
double psLayer1Z_
Definition: CaloGeometryHelper.h:61
SOUTH
Definition: CaloDirection.h:11
mps_fire.result
result
Definition: mps_fire.py:311
NORTHEAST
Definition: CaloDirection.h:16
Calorimeter::EcalBarrelTopology_
const CaloSubdetectorTopology * EcalBarrelTopology_
Definition: Calorimeter.h:79
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
ecalpyutils::hashedIndex
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:38
EcalEndcapGeometry::getClosestCell
DetId getClosestCell(const GlobalPoint &r) const override
Definition: EcalEndcapGeometry.cc:210
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Calorimeter::getEcalGeometry
const CaloSubdetectorGeometry * getEcalGeometry(int subdetn) const
Definition: Calorimeter.cc:132
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
CaloGeometryHelper::neighbourmapcalculated_
bool neighbourmapcalculated_
Definition: CaloGeometryHelper.h:70
CaloGeometryHelper::buildNeighbourArray
void buildNeighbourArray()
Definition: CaloGeometryHelper.cc:169