CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
EcalBarrelGeometry Class Referencefinal

#include <EcalBarrelGeometry.h>

Inheritance diagram for EcalBarrelGeometry:
CaloSubdetectorGeometry

Public Types

enum  { k_NumberOfCellsForCorners = EBDetId::kSizeForDenseIndexing }
 
enum  { k_NumberOfShapes = 17 }
 
enum  { k_NumberOfParametersPerShape = 11 }
 
typedef EcalBarrelGeometryRecord AlignedRecord
 
typedef EBAlignmentRcd AlignmentRecord
 
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< TruncatedPyramidCellVec
 
typedef EBDetId DetIdType
 
typedef IdealGeometryRecord IdealRecord
 
typedef EcalBarrelNumberingScheme NumberingScheme
 
typedef EZArrayFL< EEDetIdOrderedListOfEEDetId
 
typedef PEcalBarrelRcd PGeometryRecord
 
typedef CaloCellGeometry::Pt3D Pt3D
 
typedef CaloCellGeometry::Pt3DVec Pt3DVec
 
typedef std::vector< OrderedListOfEEDetId * > VecOrdListEEDetIdPtr
 
- Public Types inherited from CaloSubdetectorGeometry
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< std::shared_ptr< const CaloCellGeometry > > CellSet
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< CCGFloatDimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< CCGFloatTrVec
 

Public Member Functions

CCGFloat avgRadiusXYFrontFaceCenter () const
 
 EcalBarrelGeometry ()
 
int getBasketSizeInPhi () const
 
CaloSubdetectorGeometry::DetIdSet getCells (const GlobalPoint &r, double dR) const override
 Get a list of all cells within a dR of the given cell. More...
 
DetId getClosestCell (const GlobalPoint &r) const override
 
const OrderedListOfEEDetIdgetClosestEndcapCells (EBDetId id) const
 
const std::vector< int > & getEtaBaskets () const
 
int getNumXtalsEtaDirection () const
 
int getNumXtalsPhiDirection () const
 
void newCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
 
unsigned int numberOfParametersPerShape () const override
 
unsigned int numberOfShapes () const override
 
bool present (const DetId &id) const override
 is this detid present in the geometry? More...
 
void setBasketSizeInPhi (const int &PhiBaskets)
 
void setEtaBaskets (const std::vector< int > &EtaBaskets)
 
void setNumXtalsEtaDirection (const int &nnxtalEta)
 
void setNumXtalsPhiDirection (const int &nnxtalPhi)
 
 ~EcalBarrelGeometry () override
 
- Public Member Functions inherited from CaloSubdetectorGeometry
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
 CaloSubdetectorGeometry (const CaloSubdetectorGeometry &)=delete
 avoid copies More...
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
CCGFloat deltaEta (const DetId &detId) const
 
CCGFloat deltaPhi (const DetId &detId) const
 
virtual void fillDefaultNamedParameters () const
 
virtual CellSet getCellSet (const GlobalPoint &r, double dR) const
 
virtual std::shared_ptr< const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
virtual void getSummary (TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) 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) More...
 
virtual void initializeParms ()
 
virtual unsigned int numberOfTransformParms () const
 
CaloSubdetectorGeometryoperator= (const CaloSubdetectorGeometry &)=delete
 
ParMgrparMgr ()
 
const ParMgrparMgrConst () const
 
ParVecVecparVecVec ()
 
const ParVecVecparVecVec () const
 
virtual ~CaloSubdetectorGeometry ()
 The base class DOES assume that it owns the CaloCellGeometry objects. More...
 

Static Public Member Functions

static unsigned int alignmentTransformIndexGlobal (const DetId &id)
 
static unsigned int alignmentTransformIndexLocal (const DetId &id)
 
static std::string dbString ()
 
static DetId detIdFromLocalAlignmentIndex (unsigned int iLoc)
 
static std::string hitString ()
 
static void localCorners (Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
 
static unsigned int numberOfAlignments ()
 
static std::string producerTag ()
 

Protected Member Functions

const CaloCellGeometrygetGeometryRawPtr (uint32_t index) const override
 
- Protected Member Functions inherited from CaloSubdetectorGeometry
void addValidID (const DetId &id)
 
virtual std::shared_ptr< const CaloCellGeometrycellGeomPtr (uint32_t index) const
 
virtual unsigned int indexFor (const DetId &id) const
 
virtual unsigned int sizeForDenseIndex (const DetId &id) const
 

Private Attributes

std::vector< int > _EtaBaskets
 
int _nnxtalEta
 
int _nnxtalPhi
 
int _PhiBaskets
 
std::atomic< EZMgrFL< EEDetId > * > m_borderMgr
 
std::atomic< VecOrdListEEDetIdPtr * > m_borderPtrVec
 
CellVec m_cellVec
 
std::atomic< bool > m_check
 
CCGFloat m_radius
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloSubdetectorGeometry
static CCGFloat deltaR (const GlobalPoint &p1, const GlobalPoint &p2)
 
- Protected Attributes inherited from CaloSubdetectorGeometry
ParVecVec m_parVecVec
 
std::vector< DetIdm_validIds
 

Detailed Description

Definition at line 19 of file EcalBarrelGeometry.h.

Member Typedef Documentation

Definition at line 30 of file EcalBarrelGeometry.h.

Definition at line 31 of file EcalBarrelGeometry.h.

Definition at line 25 of file EcalBarrelGeometry.h.

Definition at line 23 of file EcalBarrelGeometry.h.

Definition at line 40 of file EcalBarrelGeometry.h.

Definition at line 29 of file EcalBarrelGeometry.h.

Definition at line 38 of file EcalBarrelGeometry.h.

Definition at line 34 of file EcalBarrelGeometry.h.

Definition at line 32 of file EcalBarrelGeometry.h.

Definition at line 26 of file EcalBarrelGeometry.h.

Definition at line 27 of file EcalBarrelGeometry.h.

Definition at line 36 of file EcalBarrelGeometry.h.

Member Enumeration Documentation

anonymous enum
anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 44 of file EcalBarrelGeometry.h.

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 46 of file EcalBarrelGeometry.h.

Constructor & Destructor Documentation

EcalBarrelGeometry::EcalBarrelGeometry ( )

Definition at line 20 of file EcalBarrelGeometry.cc.

References _EtaBaskets.

Referenced by numberOfParametersPerShape().

20  :
21  _nnxtalEta ( 85 ) ,
22  _nnxtalPhi ( 360 ) ,
23  _PhiBaskets ( 18 ) ,
24  m_borderMgr ( nullptr ),
25  m_borderPtrVec ( nullptr ) ,
26  m_radius ( -1. ),
27  m_check ( false ),
29 {
30  const int neba[] = {25,45,65,85} ;
31  _EtaBaskets = std::vector<int>( neba, neba+4 ) ;
32 }
std::atomic< bool > m_check
std::vector< int > _EtaBaskets
std::atomic< VecOrdListEEDetIdPtr * > m_borderPtrVec
std::atomic< EZMgrFL< EEDetId > * > m_borderMgr
EcalBarrelGeometry::~EcalBarrelGeometry ( )
override

Definition at line 35 of file EcalBarrelGeometry.cc.

References m_borderMgr, m_borderPtrVec, and findQualityFiles::v.

Referenced by numberOfParametersPerShape().

36 {
37  if(m_borderPtrVec)
38  {
39  auto ptr = m_borderPtrVec.load(std::memory_order_acquire);
40  for(auto& v: (*ptr)) {
41  delete v;
42  v = nullptr;
43  }
44  delete m_borderPtrVec.load() ;
45  }
46  delete m_borderMgr.load() ;
47 }
std::atomic< VecOrdListEEDetIdPtr * > m_borderPtrVec
std::atomic< EZMgrFL< EEDetId > * > m_borderMgr

Member Function Documentation

unsigned int EcalBarrelGeometry::alignmentTransformIndexGlobal ( const DetId id)
static

Definition at line 69 of file EcalBarrelGeometry.cc.

References DetId::Ecal.

Referenced by numberOfAlignments().

70 {
71  return (unsigned int)DetId::Ecal - 1 ;
72 }
unsigned int EcalBarrelGeometry::alignmentTransformIndexLocal ( const DetId id)
static

Definition at line 51 of file EcalBarrelGeometry.cc.

References CaloGenericDetId::isEB(), and ecalpyutils::ism().

Referenced by numberOfAlignments().

52 {
53  const CaloGenericDetId gid ( id ) ;
54 
55  assert( gid.isEB() ) ;
56 
57  unsigned int index ( EBDetId(id).ism() - 1 ) ;
58 
59  return index ;
60 }
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
CCGFloat EcalBarrelGeometry::avgRadiusXYFrontFaceCenter ( ) const

Definition at line 476 of file EcalBarrelGeometry.cc.

References CaloSubdetectorGeometry::cellGeomPtr(), mps_fire::i, m_cellVec, m_check, and m_radius.

Referenced by setBasketSizeInPhi().

477 {
478  if(!m_check.load(std::memory_order_acquire))
479  {
480  CCGFloat sum ( 0 ) ;
481  for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
482  {
483  auto cell ( cellGeomPtr(i) ) ;
484  if( nullptr != cell )
485  {
486  const GlobalPoint& pos ( cell->getPosition() ) ;
487  sum += pos.perp() ;
488  }
489  }
490  m_radius = sum/m_cellVec.size() ;
491  m_check.store(true, std::memory_order_release);
492  }
493  return m_radius ;
494 }
std::atomic< bool > m_check
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
CaloCellGeometry::CCGFloat CCGFloat
static std::string EcalBarrelGeometry::dbString ( )
inlinestatic

Definition at line 48 of file EcalBarrelGeometry.h.

48 { return "PEcalBarrelRcd" ; }
DetId EcalBarrelGeometry::detIdFromLocalAlignmentIndex ( unsigned int  iLoc)
static

Definition at line 63 of file EcalBarrelGeometry.cc.

References EBDetId::SMCRYSTALMODE.

Referenced by numberOfAlignments(), FakeCaloAlignmentEP::produceEBAli(), and TestCaloAlignmentEP::produceEBAli().

64 {
65  return EBDetId( iLoc + 1, 1, EBDetId::SMCRYSTALMODE ) ;
66 }
static const int SMCRYSTALMODE
Definition: EBDetId.h:167
int EcalBarrelGeometry::getBasketSizeInPhi ( ) const
inline

Definition at line 63 of file EcalBarrelGeometry.h.

References _PhiBaskets.

Referenced by ClusterShapeAlgo::Calculate_BarrelBasketEnergyFraction().

63 { return _PhiBaskets ; }
CaloSubdetectorGeometry::DetIdSet EcalBarrelGeometry::getCells ( const GlobalPoint r,
double  dR 
) const
overridevirtual

Get a list of all cells within a dR of the given cell.

The default implementation makes a loop over all cell geometries. Cleverer implementations are suggested to use rough conversions between eta/phi and ieta/iphi and test on the boundaries.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 302 of file EcalBarrelGeometry.cc.

References funct::abs(), constexpr, reco::deltaR2(), PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), CaloCellGeometry::etaPos(), f, CaloSubdetectorGeometry::getCells(), triggerObjects_cff::id, m_cellVec, M_PI, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, convertSQLiteXML::ok, phi, PV3DBase< T, PVType, FrameType >::phi(), CaloCellGeometry::phiPos(), Scenarios_cff::scale, and PV3DBase< T, PVType, FrameType >::z().

Referenced by setBasketSizeInPhi().

304 {
305  constexpr int maxphi ( EBDetId::MAX_IPHI ) ;
306  constexpr int maxeta ( EBDetId::MAX_IETA ) ;
307  constexpr float scale( maxphi/(2*M_PI) ) ; // angle to index
308 
309  CaloSubdetectorGeometry::DetIdSet dis; // this is the return object
310 
311  if( 0.000001 < dR )
312  {
313  if( dR > M_PI/2. ) // this version needs "small" dR
314  {
315  dis = CaloSubdetectorGeometry::getCells( r, dR ) ; // base class version
316  }
317  else
318  {
319  const float dR2 ( dR*dR ) ;
320  const float reta ( r.eta() ) ;
321  const float rz ( r.z() ) ;
322  const float rphi ( r.phi() ) ;
323  const float lowEta ( reta - dR ) ;
324  const float highEta ( reta + dR ) ;
325 
326  if( highEta > -1.5 &&
327  lowEta < 1.5 ) // in barrel
328  {
329  const int ieta_center ( int( reta*scale + ((rz<0)?(-1):(1))) ) ;
330  const float phi ( rphi<0 ? rphi + float(2*M_PI) : rphi ) ;
331  const int iphi_center ( int( phi*scale + 11.f ) ) ; // phi=-9.4deg is iphi=1
332 
333  const float fr ( dR*scale ) ; // # crystal widths in dR
334  const float frp ( 1.08f*fr + 1.f ) ; // conservatively above fr
335  const float frm ( 0.92f*fr - 1.f ) ; // conservatively below fr
336  const int idr ( (int)frp ) ; // integerize
337  const int idr2p ( (int)(frp*frp) ) ;
338  const int idr2m ( frm > 0 ? int(frm*frm) : 0 ) ;
339 
340  for( int de ( -idr ) ; de <= idr ; ++de ) // over eta limits
341  {
342  int ieta ( de + ieta_center ) ;
343 
344  if( std::abs(ieta) <= maxeta &&
345  ieta != 0 ) // eta is in EB
346  {
347  const int de2 ( de*de ) ;
348  for( int dp ( -idr ) ; dp <= idr ; ++dp ) // over phi limits
349  {
350  const int irange2 ( dp*dp + de2 ) ;
351 
352  if( irange2 <= idr2p ) // cut off corners that must be too far away
353  {
354  const int iphi ( ( iphi_center + dp + maxphi - 1 )%maxphi + 1 ) ;
355 
356  if( iphi != 0 )
357  {
358  const EBDetId id ( ieta, iphi ) ;
359 
360  bool ok ( irange2 < idr2m ) ; // no more calculation necessary if inside this radius
361 
362  if( !ok ) // if not ok, then we have to test this cell for being inside cone
363  {
364  const CaloCellGeometry* cell(&m_cellVec[ id.denseIndex()]);
365  const float eta ( cell->etaPos() ) ;
366  const float phi ( cell->phiPos() ) ;
367  ok = ( reco::deltaR2( eta, phi, reta, rphi ) < dR2 ) ;
368  }
369  if( ok ) dis.insert( id ) ;
370  }
371  }
372  }
373  }
374  }
375  }
376  }
377  }
378  return dis;
379 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
#define constexpr
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
#define M_PI
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
static const int MAX_IPHI
Definition: EBDetId.h:144
static const int MAX_IETA
Definition: EBDetId.h:143
T eta() const
Definition: PV3DBase.h:76
DetId EcalBarrelGeometry::getClosestCell ( const GlobalPoint r) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 75 of file EcalBarrelGeometry.cc.

References _nnxtalPhi, patCaloMETCorrections_cff::A, TtFullHadDaughter::B, stringResolutionProvider_cfi::bin, patCaloMETCorrections_cff::C, constexpr, popcon2dropbox::copy(), SoftLeptonByDistance_cfi::distance, MillePedeFileConverter_cfg::e, PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), EBDetId::ETAPHIMODE, CaloSubdetectorGeometry::getGeometry(), mps_fire::i, EBDetId::ieta(), createfilelist::int, EBDetId::iphi(), M_PI, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, PV3DBase< T, PVType, FrameType >::phi(), point, present(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CaloGeometryHelper::getClosestCell(), and setBasketSizeInPhi().

76 {
77 
78  // z is the easy one
79  int leverx = 1;
80  int levery = 1;
81  CCGFloat pointz = r.z();
82  int zbin=1;
83  if(pointz<0)
84  zbin=-1;
85 
86  // Now find the closest eta
87  CCGFloat pointeta = r.eta();
88  // double eta;
89  CCGFloat deta=999.;
90  int etabin=1;
91 
92  int guessed_eta = (int)( fabs(pointeta) / 0.0174)+1;
93  int guessed_eta_begin = guessed_eta-1;
94  int guessed_eta_end = guessed_eta+1;
95  if (guessed_eta_begin < 1) guessed_eta_begin = 1;
96  if (guessed_eta_end > 85) guessed_eta_end = 85;
97 
98  for(int bin=guessed_eta_begin; bin<= guessed_eta_end; bin++)
99  {
100  try
101  {
102  if (!present(EBDetId(zbin*bin,1,EBDetId::ETAPHIMODE)))
103  continue;
104 
105  CCGFloat eta = getGeometry(EBDetId(zbin*bin,1,EBDetId::ETAPHIMODE))->etaPos();
106 
107  if(fabs(pointeta-eta)<deta)
108  {
109  deta=fabs(pointeta-eta);
110  etabin=bin;
111  }
112  else break;
113  }
114  catch ( cms::Exception &e )
115  {
116  }
117  }
118 
119 
120  // Now the closest phi. always same number of phi bins(!?)
121  constexpr CCGFloat twopi = M_PI+M_PI;
122  // 10 degree tilt
123  constexpr CCGFloat tilt=twopi/36.;
124 
125  CCGFloat pointphi = r.phi()+tilt;
126 
127  // put phi in correct range (0->2pi)
128  if(pointphi > twopi)
129  pointphi -= twopi;
130  if(pointphi < 0)
131  pointphi += twopi;
132 
133  //calculate phi bin, distinguish + and - eta
134  int phibin = static_cast<int>(pointphi / (twopi/_nnxtalPhi)) + 1;
135  // if(point.z()<0.0)
136  // {
137  // phibin = nxtalPhi/2 - 1 - phibin;
138  // if(phibin<0)
139  // phibin += nxtalPhi;
140  // }
141  try
142  {
143  EBDetId myCell(zbin*etabin,phibin,EBDetId::ETAPHIMODE);
144 
145  if (!present(myCell))
146  return DetId(0);
147 
148  Pt3D A;
149  Pt3D B;
150  Pt3D C;
151  Pt3D point(r.x(),r.y(),r.z());
152 
153  // D.K. : equation of plane : AA*x+BB*y+CC*z+DD=0;
154  // finding equation for each edge
155 
156  // Since the point can lie between crystals, it is necessary to keep track of the movements
157  // to avoid infinite loops
158  CCGFloat history[4]{0.f};
159 
160  //
161  // stop movement in eta direction when closest cell was found (point between crystals)
162  int start = 1;
163  int counter = 0;
164  // Moving until find closest crystal in eta and phi directions (leverx and levery)
165  while (leverx==1 || levery == 1)
166  {
167  leverx = 0;
168  levery = 0;
169  const CaloCellGeometry::CornersVec& corners
170  ( getGeometry(myCell)->getCorners() ) ;
171  CCGFloat SS[4];
172 
173  // compute the distance of the point with respect of the 4 crystal lateral planes
174  for (short i=0; i < 4 ; ++i)
175  {
176  A = Pt3D(corners[i%4].x(),corners[i%4].y(),corners[i%4].z());
177  B = Pt3D(corners[(i+1)%4].x(),corners[(i+1)%4].y(),corners[(i+1)%4].z());
178  C = Pt3D(corners[4+(i+1)%4].x(),corners[4+(i+1)%4].y(),corners[4+(i+1)%4].z());
179  Pl3D plane(A,B,C);
180  plane.normalize();
181  CCGFloat distance = plane.distance(point);
182  if(plane.d()>0.) distance=-distance;
183  if (corners[0].z()<0.) distance=-distance;
184  SS[i] = distance;
185  }
186 
187  // SS's - normals
188  // check position of the point with respect to opposite side of crystal
189  // if SS's have opposite sign, the point lies inside that crystal
190 
191  if ( ( SS[0]>0.&&SS[2]>0. )||( SS[0]<0.&&SS[2]<0. ) )
192  {
193  levery = 1;
194  if ( history[0]>0. && history[2]>0. && SS[0]<0 && SS[2]<0 &&
195  (fabs(SS[0])+fabs(SS[2]))> (fabs(history[0])+fabs(history[2]))) levery = 0 ;
196  if ( history[0]<0. && history[2]<0. && SS[0]>0 && SS[2]>0 &&
197  (fabs(SS[0])+fabs(SS[2]))> (fabs(history[0])+fabs(history[2]))) levery = 0 ;
198 
199 
200  if (SS[0]>0. )
201  {
202  EBDetId nextPoint;
203  if (myCell.iphi()==EBDetId::MIN_IPHI)
204  nextPoint=EBDetId(myCell.ieta(),EBDetId::MAX_IPHI);
205  else
206  nextPoint=EBDetId(myCell.ieta(),myCell.iphi()-1);
207  if (present(nextPoint))
208  myCell=nextPoint;
209  else
210  levery=0;
211  }
212  else
213  {
214  EBDetId nextPoint;
215  if (myCell.iphi()==EBDetId::MAX_IPHI)
216  nextPoint=EBDetId(myCell.ieta(),EBDetId::MIN_IPHI);
217  else
218  nextPoint=EBDetId(myCell.ieta(),myCell.iphi()+1);
219  if (present(nextPoint))
220  myCell=nextPoint;
221  else
222  levery=0;
223  }
224  }
225 
226 
227  if ( ( ( SS[1]>0.&&SS[3]>0. )||( SS[1]<0.&&SS[3]<0. )) && start==1 )
228  {
229  leverx = 1;
230 
231  if ( history[1]>0. && history[3]>0. && SS[1]<0 && SS[3]<0 &&
232  (fabs(SS[1])+fabs(SS[3]))> (fabs(history[1])+fabs(history[3])) )
233  {
234  leverx = 0;
235  start = 0;
236  }
237 
238  if ( history[1]<0. && history[3]<0. && SS[1]>0 && SS[3]>0 &&
239  (fabs(SS[1])+fabs(SS[3]))> (fabs(history[1])+fabs(history[3])) )
240  {
241  leverx = 0;
242  start = 0;
243  }
244 
245 
246  if (SS[1]>0.)
247  {
248  EBDetId nextPoint;
249  if (myCell.ieta()==-1)
250  nextPoint=EBDetId (1,myCell.iphi());
251  else
252  {
253  int nieta= myCell.ieta()+1;
254  if(nieta==86) nieta=85;
255  nextPoint=EBDetId(nieta,myCell.iphi());
256  }
257  if (present(nextPoint))
258  myCell = nextPoint;
259  else
260  leverx = 0;
261  }
262  else
263  {
264  EBDetId nextPoint;
265  if (myCell.ieta()==1)
266  nextPoint=EBDetId(-1,myCell.iphi());
267  else
268  {
269  int nieta=myCell.ieta()-1;
270  if(nieta==-86) nieta=-85;
271  nextPoint=EBDetId(nieta,myCell.iphi());
272  }
273  if (present(nextPoint))
274  myCell = nextPoint;
275  else
276  leverx = 0;
277  }
278  }
279 
280  // Update the history. If the point lies between crystals, the closest one
281  // is returned
282  std::copy(SS,SS+4,history);
283 
284  counter++;
285  if (counter == 10)
286  {
287  leverx=0;
288  levery=0;
289  }
290  }
291  // D.K. if point lies netween cells, take a closest cell.
292  return DetId(myCell);
293  }
294  catch ( cms::Exception &e )
295  {
296  return DetId(0);
297  }
298 
299 }
Definition: start.py:1
static const int MIN_IPHI
Definition: EBDetId.h:142
def copy(args, dbName)
bool present(const DetId &id) const override
is this detid present in the geometry?
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
#define constexpr
HepGeom::Plane3D< CCGFloat > Pl3D
T z() const
Definition: PV3DBase.h:64
CaloCellGeometry::CCGFloat CCGFloat
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
static const std::string B
static const int ETAPHIMODE
Definition: EBDetId.h:166
#define M_PI
bin
set the eta bin as selection string.
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:18
static const int MAX_IPHI
Definition: EBDetId.h:144
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.
T eta() const
Definition: PV3DBase.h:76
T x() const
Definition: PV3DBase.h:62
*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
CaloCellGeometry::Pt3D Pt3D
const EcalBarrelGeometry::OrderedListOfEEDetId * EcalBarrelGeometry::getClosestEndcapCells ( EBDetId  id) const

Definition at line 382 of file EcalBarrelGeometry.cc.

References mps_fire::i, EEDetId::idOuterRing(), EEDetId::iquadrant(), EEDetId::ix(), EEDetId::iy(), gen::k, m_borderMgr, m_borderPtrVec, and EEDetId::validDetId().

Referenced by setBasketSizeInPhi(), spr::simpleMove(), and PFECALHashNavigator::stdsimplemove().

383 {
384  OrderedListOfEEDetId* ptr ( nullptr ) ;
385  auto ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
386  if(!ptrVec) {
387  if( 0 != id.rawId() ) {
388  const int iPhi ( id.iphi() ) ;
389  const int iz ( id.ieta()>0 ? 1 : -1 ) ;
390  const EEDetId eeid ( EEDetId::idOuterRing( iPhi, iz ) ) ;
391  const int iq ( eeid.iquadrant() ) ;
392  const int xout ( 1==iq || 4==iq ? 1 : -1 ) ;
393  const int yout ( 1==iq || 2==iq ? 1 : -1 ) ;
394  if (!m_borderMgr.load(std::memory_order_acquire)) {
395  EZMgrFL<EEDetId>* expect = nullptr;
396  auto ptrMgr = new EZMgrFL<EEDetId>( 720*9, 9 ) ;
397  bool exchanged = m_borderMgr.compare_exchange_strong(expect, ptrMgr, std::memory_order_acq_rel);
398  if(!exchanged) delete ptrMgr;
399  }
400  VecOrdListEEDetIdPtr* expect = nullptr;
401  auto ptrVec = new VecOrdListEEDetIdPtr();
402  ptrVec->reserve(720);
403  for( unsigned int i ( 0 ) ; i != 720 ; ++i )
404  {
405  const int kz ( 360>i ? -1 : 1 ) ;
406  const EEDetId eeid ( EEDetId::idOuterRing( i%360+1, kz ) ) ;
407 
408  const int jx ( eeid.ix() ) ;
409  const int jy ( eeid.iy() ) ;
410 
411  OrderedListOfEEDetId& olist ( *new OrderedListOfEEDetId( m_borderMgr.load(std::memory_order_acquire) ) );
412  int il ( 0 ) ;
413 
414  for( unsigned int k ( 1 ) ; k <= 25 ; ++k )
415  {
416  const int kx ( 1==k || 2==k || 3==k || 12==k || 13==k ? 0 :
417  ( 4==k || 6==k || 8==k || 15==k || 20==k ? 1 :
418  ( 5==k || 7==k || 9==k || 16==k || 19==k ? -1 :
419  ( 10==k || 14==k || 21==k || 22==k || 25==k ? 2 : -2 )))) ;
420  const int ky ( 1==k || 4==k || 5==k || 10==k || 11==k ? 0 :
421  ( 2==k || 6==k || 7==k || 14==k || 17==k ? 1 :
422  ( 3==k || 8==k || 9==k || 18==k || 21==k ? -1 :
423  ( 12==k || 15==k || 16==k || 22==k || 23==k ? 2 : -2 )))) ;
424 
425  if( 8>=il && EEDetId::validDetId( jx + kx*xout ,
426  jy + ky*yout , kz ) )
427  {
428  olist[il++]=EEDetId( jx + kx*xout, jy + ky*yout, kz ) ;
429  }
430  }
431  ptrVec->emplace_back( &olist ) ;
432  }
433  bool exchanged = m_borderPtrVec.compare_exchange_strong(expect, ptrVec, std::memory_order_acq_rel);
434  if(!exchanged) delete ptrVec;
435  ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
436  ptr = (*ptrVec)[iPhi - 1 + ( 0>iz ? 0 : 360 )];
437  }
438  }
439  return ptr;
440 }
EZArrayFL< EEDetId > OrderedListOfEEDetId
std::atomic< VecOrdListEEDetIdPtr * > m_borderPtrVec
int k[5][pyjets_maxn]
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
Definition: EZMgrFL.h:8
std::atomic< EZMgrFL< EEDetId > * > m_borderMgr
std::vector< OrderedListOfEEDetId * > VecOrdListEEDetIdPtr
static EEDetId idOuterRing(int iPhi, int zEnd)
Definition: EEDetId.cc:435
const std::vector<int>& EcalBarrelGeometry::getEtaBaskets ( ) const
inline

Definition at line 61 of file EcalBarrelGeometry.h.

References _EtaBaskets.

Referenced by ClusterShapeAlgo::Calculate_BarrelBasketEnergyFraction().

61 { return _EtaBaskets ; }
std::vector< int > _EtaBaskets
const CaloCellGeometry * EcalBarrelGeometry::getGeometryRawPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 496 of file EcalBarrelGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

Referenced by numberOfAlignments().

496  {
497  // Modify the RawPtr class
498  const CaloCellGeometry* cell(&m_cellVec[index]);
499  return (m_cellVec.size() < index ||
500  nullptr == cell->param() ? nullptr : cell);
501 }
int EcalBarrelGeometry::getNumXtalsEtaDirection ( ) const
inline

Definition at line 59 of file EcalBarrelGeometry.h.

References _nnxtalEta.

59 { return _nnxtalEta ; }
int EcalBarrelGeometry::getNumXtalsPhiDirection ( ) const
inline

Definition at line 57 of file EcalBarrelGeometry.h.

References _nnxtalPhi.

57 { return _nnxtalPhi ; }
static std::string EcalBarrelGeometry::hitString ( )
inlinestatic

Definition at line 84 of file EcalBarrelGeometry.h.

84 { return "EcalHitsEB" ; }
void EcalBarrelGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)
static

Definition at line 443 of file EcalBarrelGeometry.cc.

References EBDetId::kSizeForDenseIndexing, TruncatedPyramid::localCornersReflection(), and TruncatedPyramid::localCornersSwap().

Referenced by numberOfAlignments().

447 {
448  const bool negz ( EBDetId::kSizeForDenseIndexing/2 > i ) ;
449  const bool odd ( 1 == i%2 ) ;
450 
451  if( ( ( negz && !odd ) ||
452  ( !negz && odd ) ) )
453  {
455  }
456  else
457  {
459  }
460 }
static void localCornersSwap(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
def pv(vc)
Definition: MetAnalyzer.py:6
static void localCornersReflection(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
void EcalBarrelGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
overridevirtual

Implements CaloSubdetectorGeometry.

Definition at line 463 of file EcalBarrelGeometry.cc.

References CaloSubdetectorGeometry::addValidID(), CaloSubdetectorGeometry::cornersMgr(), and m_cellVec.

Referenced by numberOfAlignments().

468 {
469  const unsigned int cellIndex ( EBDetId( detId ).denseIndex() ) ;
470  m_cellVec[ cellIndex ] =
471  TruncatedPyramid( cornersMgr(), f1, f2, f3, parm ) ;
472  addValidID( detId ) ;
473 }
void addValidID(const DetId &id)
CaloCellGeometry::CornersMgr * cornersMgr()
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
static unsigned int EcalBarrelGeometry::numberOfAlignments ( )
inlinestatic
unsigned int EcalBarrelGeometry::numberOfParametersPerShape ( ) const
inlineoverridevirtual
unsigned int EcalBarrelGeometry::numberOfShapes ( ) const
inlineoverridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 50 of file EcalBarrelGeometry.h.

References k_NumberOfShapes.

bool EcalBarrelGeometry::present ( const DetId id) const
overridevirtual

is this detid present in the geometry?

Reimplemented from CaloSubdetectorGeometry.

Definition at line 503 of file EcalBarrelGeometry.cc.

References DetId::Ecal, EcalBarrel, EBDetId::ieta(), EBDetId::iphi(), and EBDetId::validDetId().

Referenced by spr::extraIds(), getClosestCell(), and numberOfAlignments().

504 {
505  if(id.det()==DetId::Ecal && id.subdetId()==EcalBarrel){
506  EBDetId ebId(id);
507  if(EBDetId::validDetId(ebId.ieta(),ebId.iphi())) return true;
508  }
509  return false;
510 
511 }
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
static std::string EcalBarrelGeometry::producerTag ( )
inlinestatic

Definition at line 86 of file EcalBarrelGeometry.h.

Referenced by PCaloGeometryBuilder::beginRun(), and CaloGeometryBuilder::produceAligned().

86 { return "EcalBarrel" ; }
void EcalBarrelGeometry::setBasketSizeInPhi ( const int &  PhiBaskets)
inline
void EcalBarrelGeometry::setEtaBaskets ( const std::vector< int > &  EtaBaskets)
inline

Definition at line 69 of file EcalBarrelGeometry.h.

References _EtaBaskets.

69 { _EtaBaskets=EtaBaskets ; }
std::vector< int > _EtaBaskets
void EcalBarrelGeometry::setNumXtalsEtaDirection ( const int &  nnxtalEta)
inline

Definition at line 67 of file EcalBarrelGeometry.h.

References _nnxtalEta.

67 { _nnxtalEta=nnxtalEta ; }
void EcalBarrelGeometry::setNumXtalsPhiDirection ( const int &  nnxtalPhi)
inline

Definition at line 65 of file EcalBarrelGeometry.h.

References _nnxtalPhi.

65 { _nnxtalPhi=nnxtalPhi ; }

Member Data Documentation

std::vector<int> EcalBarrelGeometry::_EtaBaskets
private

size of the baskets in the eta direction. This is needed to find out whether two adjacent crystals lie in the same basked ('module') or not (e.g. this can be used for correcting cluster energies etc.)

Definition at line 126 of file EcalBarrelGeometry.h.

Referenced by EcalBarrelGeometry(), getEtaBaskets(), and setEtaBaskets().

int EcalBarrelGeometry::_nnxtalEta
private

number of crystals in eta direction

Definition at line 117 of file EcalBarrelGeometry.h.

Referenced by getNumXtalsEtaDirection(), and setNumXtalsEtaDirection().

int EcalBarrelGeometry::_nnxtalPhi
private

number of crystals in phi direction

Definition at line 120 of file EcalBarrelGeometry.h.

Referenced by getClosestCell(), getNumXtalsPhiDirection(), and setNumXtalsPhiDirection().

int EcalBarrelGeometry::_PhiBaskets
private

size of one basket in phi

Definition at line 129 of file EcalBarrelGeometry.h.

Referenced by getBasketSizeInPhi(), and setBasketSizeInPhi().

std::atomic<EZMgrFL<EEDetId>*> EcalBarrelGeometry::m_borderMgr
mutableprivate

Definition at line 131 of file EcalBarrelGeometry.h.

Referenced by getClosestEndcapCells(), and ~EcalBarrelGeometry().

std::atomic<VecOrdListEEDetIdPtr*> EcalBarrelGeometry::m_borderPtrVec
mutableprivate

Definition at line 133 of file EcalBarrelGeometry.h.

Referenced by getClosestEndcapCells(), and ~EcalBarrelGeometry().

CellVec EcalBarrelGeometry::m_cellVec
private
std::atomic<bool> EcalBarrelGeometry::m_check
mutableprivate

Definition at line 135 of file EcalBarrelGeometry.h.

Referenced by avgRadiusXYFrontFaceCenter().

CCGFloat EcalBarrelGeometry::m_radius
mutableprivate

Definition at line 134 of file EcalBarrelGeometry.h.

Referenced by avgRadiusXYFrontFaceCenter().