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.

References neighbourmapcalculated_, psLayer1Z_, and psLayer2Z_.

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

◆ CaloGeometryHelper() [2/2]

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

Definition at line 32 of file CaloGeometryHelper.cc.

References psLayer1Z_, and psLayer2Z_.

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

◆ ~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.

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

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

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 }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
int isc() const
Definition: EEDetId.cc:222

◆ buildCrystal()

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

Definition at line 157 of file CaloGeometryHelper.cc.

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

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

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 }
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
std::vector< BaseCrystal > endcapCrystals_
std::vector< BaseCrystal > barrelCrystals_

◆ buildCrystalArray()

void CaloGeometryHelper::buildCrystalArray ( )
private

Definition at line 390 of file CaloGeometryHelper.cc.

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

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 }
size
Write out results.
const EcalEndcapGeometry * EcalEndcapGeometry_
Definition: Calorimeter.h:74
std::vector< BaseCrystal > endcapCrystals_
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)
const EcalBarrelGeometry * EcalBarrelGeometry_
Definition: Calorimeter.h:73
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.
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
std::vector< BaseCrystal > barrelCrystals_
int hashedIndex() const
Definition: EEDetId.h:183

◆ buildNeighbourArray()

void CaloGeometryHelper::buildNeighbourArray ( )
private

Definition at line 169 of file CaloGeometryHelper.cc.

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

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 }
size
Write out results.
const EcalEndcapGeometry * EcalEndcapGeometry_
Definition: Calorimeter.h:74
std::vector< NeiVect > barrelNeighbours_
const CaloSubdetectorTopology * EcalEndcapTopology_
Definition: Calorimeter.h:80
std::vector< NeiVect > endcapNeighbours_
static const CaloDirection orderedDir[8]
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const
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)
const EcalBarrelGeometry * EcalBarrelGeometry_
Definition: Calorimeter.h:73
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: DetId.h:17
const CaloSubdetectorTopology * EcalBarrelTopology_
Definition: Calorimeter.h:79
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
int hashedIndex() const
Definition: EEDetId.h:183
#define LogDebug(id)

◆ diagonalmove()

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

Definition at line 318 of file CaloGeometryHelper.cc.

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

Referenced by move().

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 }
bool simplemove(DetId &cell, const CaloDirection &dir) const
Definition: DetId.h:17

◆ getClosestCell()

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

Definition at line 58 of file CaloGeometryHelper.cc.

References gpuPixelDoublets::cc, central, funct::cos(), 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().

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 }
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
const EcalEndcapGeometry * EcalEndcapGeometry_
Definition: Calorimeter.h:74
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void fill(const std::string &name, float val1, float val2=1., float val3=1.)
Fill an histogram.
Definition: Histos.cc:125
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static Histos * instance()
Definition: Histos.cc:15
HcalSubdetector
Definition: HcalAssistant.h:31
const EcalBarrelGeometry * EcalBarrelGeometry_
Definition: Calorimeter.h:73
T perp() const
Magnitude of transverse component.
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: DetId.h:17
const CaloSubdetectorGeometry * HcalGeometry_
Definition: Calorimeter.h:75
DetId getClosestCell(const GlobalPoint &r) const override
DetId getClosestCell(const GlobalPoint &r) const override
*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

◆ getNeighbours()

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

Definition at line 267 of file CaloGeometryHelper.cc.

References barrelNeighbours_, EcalBarrel, endcapNeighbours_, EBDetId::hashedIndex(), EEDetId::hashedIndex(), and DetId::subdetId().

Referenced by CrystalWindowMap::CrystalWindowMap().

267  {
268  return (detid.subdetId() == EcalBarrel) ? barrelNeighbours_[EBDetId(detid).hashedIndex()]
270 }
std::vector< NeiVect > barrelNeighbours_
std::vector< NeiVect > endcapNeighbours_
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
int hashedIndex() const
Definition: EEDetId.h:183

◆ getWindow()

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

Definition at line 148 of file CaloGeometryHelper.cc.

References HLT_2024v12_cff::distance, Calorimeter::getEcalGeometry(), Calorimeter::getEcalTopology(), jetUpdater_cfi::sort, and DetId::subdetId().

Referenced by EcalHitMaker::EcalHitMaker().

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 }
const CaloSubdetectorGeometry * getEcalGeometry(int subdetn) const
Definition: Calorimeter.cc:132
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
const CaloSubdetectorTopology * getEcalTopology(int subdetn) const
Definition: Calorimeter.cc:143
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48

◆ initialize()

void CaloGeometryHelper::initialize ( double  bField)

Definition at line 38 of file CaloGeometryHelper.cc.

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

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 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
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.
const EcalPreshowerGeometry * getEcalPreshowerGeometry() const
Definition: Calorimeter.h:54
#define LogDebug(id)

◆ magneticField()

double CaloGeometryHelper::magneticField ( ) const
inline

Definition at line 44 of file CaloGeometryHelper.h.

References bfield_.

Referenced by EcalHitMaker::configureGeometry().

44 { return bfield_; }

◆ move()

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

Definition at line 272 of file CaloGeometryHelper.cc.

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

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 }
std::vector< NeiVect > barrelNeighbours_
std::vector< NeiVect > endcapNeighbours_
bool simplemove(DetId &cell, const CaloDirection &dir) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
bool diagonalmove(DetId &cell, const CaloDirection &dir) const
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
int hashedIndex() const
Definition: EEDetId.h:183
Definition: TkAlStyle.h:43

◆ preshowerPresent()

bool CaloGeometryHelper::preshowerPresent ( ) const
inline

Definition at line 51 of file CaloGeometryHelper.h.

References preshowerPresent_.

Referenced by CalorimetryManager::initialize().

51 { return preshowerPresent_; };

◆ preshowerZPosition()

double CaloGeometryHelper::preshowerZPosition ( int  layer) const
inline

◆ simplemove()

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

Definition at line 302 of file CaloGeometryHelper.cc.

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

Referenced by diagonalmove(), and move().

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 }
const CaloSubdetectorTopology * EcalEndcapTopology_
Definition: Calorimeter.h:80
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
Definition: DetId.h:17
const CaloSubdetectorTopology * EcalBarrelTopology_
Definition: Calorimeter.h:79

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