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

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

Definition at line 49 of file CaloGeometryHelper.h.

Definition at line 24 of file CaloGeometryHelper.h.

Definition at line 23 of file CaloGeometryHelper.h.

Constructor & Destructor Documentation

CaloGeometryHelper::CaloGeometryHelper ( )

Definition at line 26 of file CaloGeometryHelper.cc.

References neighbourmapcalculated_, psLayer1Z_, and psLayer2Z_.

26  :Calorimeter()
27 {
29  psLayer1Z_ = 303;
30  psLayer2Z_ = 307;
31 }
CaloGeometryHelper::CaloGeometryHelper ( const edm::ParameterSet fastCalo)

Definition at line 33 of file CaloGeometryHelper.cc.

References psLayer1Z_, and psLayer2Z_.

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

Definition at line 62 of file CaloGeometryHelper.cc.

63 {;
64 }

Member Function Documentation

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

Definition at line 432 of file CaloGeometryHelper.cc.

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

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

433 {
434  if(c1.subdetId()!=c2.subdetId()) return false;
435 
436  if(c1.subdetId()==EcalBarrel)
437  {
438  // there is a crack if the two cells don't belong to the same
439  // module
440  EBDetId cc1(c1);
441  EBDetId cc2(c2);
442  return (cc1.im()!=cc2.im()||cc1.ism()!=cc2.ism() );
443  }
444 
445 if(c1.subdetId()==EcalEndcap)
446  {
447  // there is a crack if the two cells don't belong to the same
448  // module
449  return (EEDetId(c1).isc()!=EEDetId(c2).isc());
450  }
451  return false;
452 }
int isc() const
Definition: EEDetId.cc:285
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
void CaloGeometryHelper::buildCrystal ( const DetId id,
Crystal xtal 
) const

Definition at line 173 of file CaloGeometryHelper.cc.

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

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

174 {
175  if(cell.subdetId()==EcalBarrel)
176  {
177  xtal=Crystal(cell,&barrelCrystals_[EBDetId(cell).hashedIndex()]);
178  return;
179  }
180  if(cell.subdetId()==EcalEndcap)
181  {
182  xtal=Crystal(cell,&endcapCrystals_[EEDetId(cell).hashedIndex()]);
183  return;
184  }
185 }
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
std::vector< BaseCrystal > endcapCrystals_
std::vector< BaseCrystal > barrelCrystals_
void CaloGeometryHelper::buildCrystalArray ( )
private

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

455 {
456  const unsigned nbarrel = EBDetId::kSizeForDenseIndexing;
457  // Barrel first. The hashed index runs from 0 to 61199
458  barrelCrystals_.resize(nbarrel,BaseCrystal());
459 
460  //std::cout << " Building the array of crystals (barrel) " ;
461  const std::vector<DetId>& vec(EcalBarrelGeometry_->getValidDetIds(DetId::Ecal,EcalBarrel));
462  unsigned size=vec.size();
463  for(unsigned ic=0; ic<size; ++ic)
464  {
465  unsigned hashedindex=EBDetId(vec[ic]).hashedIndex();
466  auto geom = EcalBarrelGeometry_->getGeometry(vec[ic]);
467  BaseCrystal xtal(vec[ic]);
468  xtal.setCorners(geom->getCorners(),geom->getPosition());
469  barrelCrystals_[hashedindex]=xtal;
470  }
471 
472  // std::cout << " done " << size << std::endl;
473  // std::cout << " Building the array of crystals (endcap) " ;
474 
475 
476  const std::vector<DetId>& vece(EcalEndcapGeometry_->getValidDetIds(DetId::Ecal,EcalEndcap));
477  size=vece.size();
478  // There are some holes in the hashedIndex for the EE. Hence the array is bigger than the number
479  // of crystals
480  const unsigned nendcap=EEDetId::kSizeForDenseIndexing;
481 
482  endcapCrystals_.resize(nendcap,BaseCrystal());
483  for(unsigned ic=0; ic<size; ++ic)
484  {
485  unsigned hashedindex=EEDetId(vece[ic]).hashedIndex();
486  auto geom = EcalEndcapGeometry_->getGeometry(vece[ic]);
487  BaseCrystal xtal(vece[ic]);
488  xtal.setCorners(geom->getCorners(),geom->getPosition());
489  endcapCrystals_[hashedindex]=xtal;
490  }
491  // std::cout << " done " << size << std::endl;
492 }
size
Write out results.
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
const EcalEndcapGeometry * EcalEndcapGeometry_
Definition: Calorimeter.h:78
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)
std::vector< BaseCrystal > endcapCrystals_
const EcalBarrelGeometry * EcalBarrelGeometry_
Definition: Calorimeter.h:77
int hashedIndex() const
Definition: EEDetId.h:182
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.
std::vector< BaseCrystal > barrelCrystals_
void CaloGeometryHelper::buildNeighbourArray ( )
private

Definition at line 188 of file CaloGeometryHelper.cc.

References barrelNeighbours_, 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().

189 {
190 
192  NORTHEAST};
193 
194  const unsigned nbarrel = EBDetId::kSizeForDenseIndexing;
195  // Barrel first. The hashed index runs from 0 to 61199
196  barrelNeighbours_.resize(nbarrel);
197 
198  //std::cout << " Building the array of neighbours (barrel) " ;
199 
200  const std::vector<DetId>& vec(EcalBarrelGeometry_->getValidDetIds(DetId::Ecal,EcalBarrel));
201  unsigned size=vec.size();
202  for(unsigned ic=0; ic<size; ++ic)
203  {
204  // We get the 9 cells in a square.
205  std::vector<DetId> neighbours(EcalBarrelTopology_->getWindow(vec[ic],3,3));
206  // std::cout << " Cell " << EBDetId(vec[ic]) << std::endl;
207  unsigned nneighbours=neighbours.size();
208 
209  unsigned hashedindex=EBDetId(vec[ic]).hashedIndex();
210  if(hashedindex>=nbarrel)
211  {
212  LogDebug("CaloGeometryTools") << " Array overflow " << std::endl;
213  }
214 
215 
216  // If there are 9 cells, it is easy, and this order is know:
217 // 6 7 8
218 // 3 4 5
219 // 0 1 2 (0 = SOUTHWEST)
220 
221  if(nneighbours==9)
222  {
223  //barrelNeighbours_[hashedindex].reserve(8);
224  unsigned int nn=0;
225  for(unsigned in=0;in<nneighbours;++in)
226  {
227  // remove the centre
228  if(neighbours[in]!=vec[ic])
229  {
230  barrelNeighbours_[hashedindex][nn]=(neighbours[in]);
231  nn++;
232  // std::cout << " Neighbour " << in << " " << EBDetId(neighbours[in]) << std::endl;
233  }
234  }
235  }
236  else
237  {
238  DetId central(vec[ic]);
239  //barrelNeighbours_[hashedindex].resize(8,DetId(0));
240  for(unsigned idir=0;idir<8;++idir)
241  {
242  DetId testid=central;
243  bool status=move(testid,orderedDir[idir],false);
244  if(status) barrelNeighbours_[hashedindex][idir]=testid;
245  }
246 
247  }
248  }
249 
250  // Moved to the endcap
251 
252  // std::cout << " done " << size << std::endl;
253  // std::cout << " Building the array of neighbours (endcap) " ;
254 
255 
256  const std::vector<DetId> & vece(EcalEndcapGeometry_->getValidDetIds(DetId::Ecal,EcalEndcap));
257  size=vece.size();
258  // There are some holes in the hashedIndex for the EE. Hence the array is bigger than the number
259  // of crystals
260  const unsigned nendcap=EEDetId::kSizeForDenseIndexing;
261 
262  endcapNeighbours_.resize(nendcap);
263  for(unsigned ic=0; ic<size; ++ic)
264  {
265  // We get the 9 cells in a square.
266  std::vector<DetId> neighbours(EcalEndcapTopology_->getWindow(vece[ic],3,3));
267  unsigned nneighbours=neighbours.size();
268  // remove the centre
269  unsigned hashedindex=EEDetId(vece[ic]).hashedIndex();
270 
271  if(hashedindex>=nendcap)
272  {
273  LogDebug("CaloGeometryTools") << " Array overflow " << std::endl;
274  }
275 
276  if(nneighbours==9)
277  {
278  //endcapNeighbours_[hashedindex].reserve(8);
279  unsigned int nn=0;
280  for(unsigned in=0;in<nneighbours;++in)
281  {
282  // remove the centre
283  if(neighbours[in]!=vece[ic])
284  {
285  endcapNeighbours_[hashedindex][nn]=(neighbours[in]);
286  nn++;
287  }
288  }
289  }
290  else
291  {
292  DetId central(vece[ic]);
293  //endcapNeighbours_[hashedindex].resize(8,DetId(0));
294  for(unsigned idir=0;idir<8;++idir)
295  {
296  DetId testid=central;
297  bool status=move(testid,orderedDir[idir],false);
298  if(status) endcapNeighbours_[hashedindex][idir]=testid;
299  }
300 
301  }
302  }
303  // std::cout << " done " << size <<std::endl;
305 }
#define LogDebug(id)
size
Write out results.
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
const EcalEndcapGeometry * EcalEndcapGeometry_
Definition: Calorimeter.h:78
const CaloSubdetectorTopology * EcalEndcapTopology_
Definition: Calorimeter.h:84
std::vector< NeiVect > endcapNeighbours_
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)
static const CaloDirection orderedDir[8]
const EcalBarrelGeometry * EcalBarrelGeometry_
Definition: Calorimeter.h:77
std::vector< NeiVect > barrelNeighbours_
Definition: DetId.h:18
int hashedIndex() const
Definition: EEDetId.h:182
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
const CaloSubdetectorTopology * EcalBarrelTopology_
Definition: Calorimeter.h:83
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const
bool CaloGeometryHelper::diagonalmove ( DetId cell,
const CaloDirection dir 
) const
private

Definition at line 368 of file CaloGeometryHelper.cc.

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

Referenced by move().

369 {
370  bool result;
371  // One has to try both paths
372  if(dir==NORTHEAST)
373  {
374  result = simplemove(cell,NORTH);
375  if(result)
376  return simplemove(cell,EAST);
377  else
378  {
379  result = simplemove(cell,EAST);
380  if(result)
381  return simplemove(cell,NORTH);
382  else
383  return false;
384  }
385  }
386  else if(dir==NORTHWEST)
387  {
388  result = simplemove(cell,NORTH);
389  if(result)
390  return simplemove(cell,WEST);
391  else
392  {
393  result = simplemove(cell,WEST);
394  if(result)
395  return simplemove(cell,NORTH);
396  else
397  return false;
398  }
399  }
400  else if(dir == SOUTHEAST)
401  {
402  result = simplemove(cell,SOUTH);
403  if(result)
404  return simplemove(cell,EAST);
405  else
406  {
407  result = simplemove(cell,EAST);
408  if(result)
409  return simplemove(cell,SOUTH);
410  else
411  return false;
412  }
413  }
414  else if(dir == SOUTHWEST)
415  {
416  result = simplemove(cell,SOUTH);
417  if(result)
418  return simplemove(cell,WEST);
419  else
420  {
421  result = simplemove(cell,SOUTH);
422  if(result)
423  return simplemove(cell,WEST);
424  else
425  return false;
426  }
427  }
428  cell = DetId(0);
429  return false;
430 }
Definition: DetId.h:18
dbl *** dir
Definition: mlp_gen.cc:35
bool simplemove(DetId &cell, const CaloDirection &dir) const
DetId CaloGeometryHelper::getClosestCell ( const XYZPoint point,
bool  ecal,
bool  central 
) const

in sync with BaseParticlePropagator

Definition at line 66 of file CaloGeometryHelper.cc.

References funct::cos(), HcalDetId::depth(), Calorimeter::EcalBarrelGeometry_, Calorimeter::EcalEndcapGeometry_, PV3DBase< T, PVType, FrameType >::eta(), Histos::fill(), plotBeamSpotDB::first, CaloSubdetectorGeometry::getClosestCell(), EcalEndcapGeometry::getClosestCell(), EcalBarrelGeometry::getClosestCell(), CaloSubdetectorGeometry::getGeometry(), HcalEndcap, HcalForward, Calorimeter::HcalGeometry_, HcalDetId::ieta(), HcalDetId::ietaAbs(), Histos::instance(), HcalDetId::iphi(), DetId::null(), perp(), PV3DBase< T, PVType, FrameType >::phi(), mps_fire::result, edm::second(), mathSSE::sqrt(), and DetId::subdetId().

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

67 {
68  DetId result;
69  if(ecal)
70  {
71  if(central)
72  {
73  // std::cout << "EcalBarrelGeometry_" << " " << EcalBarrelGeometry_ << std::endl;
75 #ifdef DEBUGGCC
76  if(result.null()) return result;
77  GlobalPoint ip=GlobalPoint(point.X(),point.Y(),point.Z());
78  GlobalPoint cc=EcalBarrelGeometry_->getGeometry(result)->getPosition();
79  float deltaeta2 = ip.eta()-cc.eta();
80  deltaeta2 *= deltaeta2;
81  float deltaphi2 = acos(cos(ip.phi()-cc.phi()));
82  deltaphi2 *= deltaphi2;
83  Histos::instance()->fill("h100",point.eta(),sqrt(deltaeta2+deltaphi2));
84 #endif
85  }
86  else
87  {
89 #ifdef DEBUGGCC
90  if(result.null())
91  {
92  return result;
93  }
94  GlobalPoint ip=GlobalPoint(point.X(),point.Y(),point.Z());
95  GlobalPoint cc=EcalEndcapGeometry_->getGeometry(result)->getPosition();
96  Histos::instance()->fill("h110",point.eta(),(ip-cc).perp());
97 #endif
98  }
99  }
100  else
101  {
103  HcalDetId myDetId(result);
104 
105  // special patch for HF
106  if ( myDetId.subdetId() == HcalForward ) {
107  int mylayer;
108  if ( fabs(point.Z()) > 1132. ) {
109  mylayer = 2;
110  } else {
111  mylayer = 1;
112  }
113  HcalDetId myDetId2((HcalSubdetector)myDetId.subdetId(),myDetId.ieta(),myDetId.iphi(),mylayer);
114  result = myDetId2;
115  return result;
116  }
117 
118 
119  if(result.subdetId()!=HcalEndcap) return result;
120  // Special patch to correct the HCAL geometry
121  if(myDetId.depth()==3) return result;
122 
123  int ieta=myDetId.ietaAbs();
124  float azmin=400.458;
125 
126  if(ieta<=17)
127  return result;
128  else if(ieta>=18 && ieta<=26)
129  azmin += 35.0; // don't consider ieta=18 nose separately
130  else if(ieta>=27)
131  azmin += 21.0;
132 
133  HcalDetId first(HcalEndcap,myDetId.ieta(),myDetId.iphi(),1);
134  bool layer2=(fabs(point.Z())>azmin);
135  if(!layer2)
136  {
137  return first;
138  }
139  else
140  {
141  HcalDetId second(HcalEndcap,myDetId.ieta(),myDetId.iphi(),2);
142  if(second!=HcalDetId()) result=second;
143  }
144 #ifdef DEBUGGCC
145  if(result.null())
146  {
147  return result;
148  }
149  GlobalPoint ip=GlobalPoint(point.x(),point.y(),point.z());
150  GlobalPoint cc=HcalGeometry_->getPosition(result);
151  float deltaeta2 = ip.eta()-cc.eta();
152  deltaeta2 *= deltaeta2;
153  float deltaphi2 = acos(cos(ip.phi()-cc.phi()));
154  deltaphi2 *= deltaphi2;
155 
156  Histos::instance()->fill("h120",point.eta(),sqrt(deltaeta2+deltaphi2));
157 #endif
158 
159  }
160  return result;
161 }
DetId getClosestCell(const GlobalPoint &r) const override
const EcalEndcapGeometry * EcalEndcapGeometry_
Definition: Calorimeter.h:78
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
U second(std::pair< T, U > const &p)
void fill(const std::string &name, float val1, float val2=1., float val3=1.)
Fill an histogram.
Definition: Histos.cc:168
T sqrt(T t)
Definition: SSEVec.h:18
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:77
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
virtual DetId getClosestCell(const GlobalPoint &r) const
Definition: DetId.h:18
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.
bool null() const
is this a null id ?
Definition: DetId.h:45
const CaloSubdetectorGeometry * HcalGeometry_
Definition: Calorimeter.h:79
T eta() const
Definition: PV3DBase.h:76
T perp() const
Magnitude of transverse component.
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
const CaloGeometryHelper::NeiVect & CaloGeometryHelper::getNeighbours ( const DetId det) const

Definition at line 307 of file CaloGeometryHelper.cc.

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

Referenced by CrystalWindowMap::CrystalWindowMap().

308 {
309  return (detid.subdetId()==EcalBarrel)?barrelNeighbours_[EBDetId(detid).hashedIndex()]:
311 }
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
std::vector< NeiVect > endcapNeighbours_
std::vector< NeiVect > barrelNeighbours_
int hashedIndex() const
Definition: EEDetId.h:182
void CaloGeometryHelper::getWindow ( const DetId pivot,
int  s1,
int  s2,
std::vector< DetId > &  vec 
) const

Definition at line 163 of file CaloGeometryHelper.cc.

References SoftLeptonByDistance_cfi::distance, Calorimeter::getEcalGeometry(), Calorimeter::getEcalTopology(), and DetId::subdetId().

Referenced by EcalHitMaker::EcalHitMaker().

164 {
165  // currently the getWindow method is the same for EcalBarrelTopology and EndcapTopology
166  // (implemented in CaloSubDetectorTopology)
167  // optimized versions are foreseen
168  vec=getEcalTopology(pivot.subdetId())->getWindow(pivot,s1,s2);
170  sort(vec.begin(),vec.end(),distance);
171 }
const CaloSubdetectorGeometry * getEcalGeometry(int subdetn) const
Definition: Calorimeter.cc:136
const CaloSubdetectorTopology * getEcalTopology(int subdetn) const
Definition: Calorimeter.cc:145
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
void CaloGeometryHelper::initialize ( double  bField)

Definition at line 40 of file CaloGeometryHelper.cc.

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

Referenced by FamosManager::setupGeometryAndField().

41 {
44  bfield_ = bField;
46 
48  {
49  ESDetId cps1(getEcalPreshowerGeometry()->getClosestCellInPlane(GlobalPoint(80.,80.,303.),1));
50  psLayer1Z_ = getEcalPreshowerGeometry()->getGeometry(cps1)->getPosition().z();
51  ESDetId cps2(getEcalPreshowerGeometry()->getClosestCellInPlane(GlobalPoint(80.,80.,307.),2));
52  psLayer2Z_ = getEcalPreshowerGeometry()->getGeometry(cps2)->getPosition().z();
53  LogDebug("CaloGeometryTools") << " Preshower layer positions " << psLayer1Z_ << " " << psLayer2Z_ << std::endl;
54  }
55  else
56  LogDebug("CaloGeometryTools") << " No preshower present" << std::endl;
57 
58  // std::cout << " Preshower layer positions " << psLayer1Z_ << " " << psLayer2Z_ << std::endl;
59 
60 }
#define LogDebug(id)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const EcalPreshowerGeometry * getEcalPreshowerGeometry() const
Definition: Calorimeter.h:55
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.
double CaloGeometryHelper::magneticField ( ) const
inline

Definition at line 52 of file CaloGeometryHelper.h.

References dir, and eostools::move().

Referenced by EcalHitMaker::configureGeometry().

52 {return bfield_;}
bool CaloGeometryHelper::move ( DetId cell,
const CaloDirection dir,
bool  fast = true 
) const

Definition at line 313 of file CaloGeometryHelper.cc.

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

Referenced by Vispa.Gui.WidgetContainer.WidgetContainer::autosize(), buildNeighbourArray(), EcalHitMaker::configureGeometry(), Vispa.Gui.VispaWidget.VispaWidget::dragWidget(), Vispa.Gui.VispaWidget.VispaWidget::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

314 {
315  DetId originalcell = cell;
316  if(dir==NONE || cell==DetId(0)) return false;
317 
318  // Conversion CaloDirection and index in the table
319  // CaloDirection :NONE,SOUTH,SOUTHEAST,SOUTHWEST,EAST,WEST, NORTHEAST,NORTHWEST,NORTH
320  // Table : SOUTHWEST,SOUTH,SOUTHEAST,WEST,EAST,NORTHWEST,NORTH, NORTHEAST
321  static const int calodirections[9]={-1,1,2,0,4,3,7,5,6};
322 
323  if(fast&&neighbourmapcalculated_)
324  {
325  DetId result = (originalcell.subdetId()==EcalBarrel) ?
326  barrelNeighbours_[EBDetId(originalcell).hashedIndex()][calodirections[dir]]:
327  endcapNeighbours_[EEDetId(originalcell).hashedIndex()][calodirections[dir]];
328  bool status = !result.null();
329  cell = result;
330  return status;
331  }
332 
333  if(dir==NORTH || dir ==SOUTH || dir==EAST || dir==WEST)
334  {
335  return simplemove(cell,dir);
336  }
337  else
338  {
339  if(dir == NORTHEAST || dir==NORTHWEST || dir==SOUTHEAST || dir==SOUTHWEST)
340  return diagonalmove(cell,dir);
341  }
342 
343  cell = DetId(0);
344  return false;
345 }
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
std::vector< NeiVect > endcapNeighbours_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::vector< NeiVect > barrelNeighbours_
Definition: DetId.h:18
bool diagonalmove(DetId &cell, const CaloDirection &dir) const
int hashedIndex() const
Definition: EEDetId.h:182
bool null() const
is this a null id ?
Definition: DetId.h:45
dbl *** dir
Definition: mlp_gen.cc:35
bool simplemove(DetId &cell, const CaloDirection &dir) const
bool CaloGeometryHelper::preshowerPresent ( ) const
inline

Definition at line 59 of file CaloGeometryHelper.h.

Referenced by CalorimetryManager::reconstruct().

double CaloGeometryHelper::preshowerZPosition ( int  layer) const
inline
bool CaloGeometryHelper::simplemove ( DetId cell,
const CaloDirection dir 
) const
private

Definition at line 348 of file CaloGeometryHelper.cc.

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

Referenced by diagonalmove(), and move().

349 {
350  std::vector<DetId> neighbours;
351  if(cell.subdetId()==EcalBarrel)
352  neighbours = EcalBarrelTopology_->getNeighbours(cell,dir);
353  else if(cell.subdetId()==EcalEndcap)
354  neighbours= EcalEndcapTopology_->getNeighbours(cell,dir);
355 
356  if ((!neighbours.empty()) && (!neighbours[0].null()))
357  {
358  cell = neighbours[0];
359  return true;
360  }
361  else
362  {
363  cell = DetId(0);
364  return false;
365  }
366 }
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
const CaloSubdetectorTopology * EcalEndcapTopology_
Definition: Calorimeter.h:84
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
const CaloSubdetectorTopology * EcalBarrelTopology_
Definition: Calorimeter.h:83
dbl *** dir
Definition: mlp_gen.cc:35

Member Data Documentation

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

Definition at line 75 of file CaloGeometryHelper.h.

Referenced by buildCrystal(), and buildCrystalArray().

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

Definition at line 72 of file CaloGeometryHelper.h.

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

double CaloGeometryHelper::bfield_
private

Definition at line 81 of file CaloGeometryHelper.h.

Referenced by initialize().

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

Definition at line 76 of file CaloGeometryHelper.h.

Referenced by buildCrystal(), and buildCrystalArray().

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

Definition at line 73 of file CaloGeometryHelper.h.

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

bool CaloGeometryHelper::neighbourmapcalculated_
private

Definition at line 78 of file CaloGeometryHelper.h.

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

bool CaloGeometryHelper::preshowerPresent_
private

Definition at line 82 of file CaloGeometryHelper.h.

Referenced by initialize().

double CaloGeometryHelper::psLayer1Z_
private

Definition at line 69 of file CaloGeometryHelper.h.

Referenced by CaloGeometryHelper(), and initialize().

double CaloGeometryHelper::psLayer2Z_
private

Definition at line 69 of file CaloGeometryHelper.h.

Referenced by CaloGeometryHelper(), and initialize().