EcalBarrelGeometry

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
#ifndef EcalBarrelGeometry_h
#define EcalBarrelGeometry_h

#include "Geometry/CaloGeometry/interface/EZArrayFL.h"
#include "Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/TruncatedPyramid.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/Records/interface/EcalBarrelGeometryRecord.h"
#include "CondFormats/AlignmentRecord/interface/EBAlignmentRcd.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "Geometry/Records/interface/PEcalBarrelRcd.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"
#include <vector>
#include <atomic>

class EcalBarrelGeometry final : public CaloSubdetectorGeometry {
public:
  typedef std::vector<TruncatedPyramid> CellVec;

  typedef CaloCellGeometry::CCGFloat CCGFloat;
  typedef CaloCellGeometry::Pt3D Pt3D;
  typedef CaloCellGeometry::Pt3DVec Pt3DVec;

  typedef IdealGeometryRecord IdealRecord;
  typedef EcalBarrelGeometryRecord AlignedRecord;
  typedef EBAlignmentRcd AlignmentRecord;
  typedef PEcalBarrelRcd PGeometryRecord;

  typedef EZArrayFL<EEDetId> OrderedListOfEEDetId;  // like an stl vector: begin(), end(), [i]

  typedef std::vector<OrderedListOfEEDetId*> VecOrdListEEDetIdPtr;

  typedef EcalBarrelNumberingScheme NumberingScheme;

  typedef EBDetId DetIdType;

  static constexpr int k_NumberOfCellsForCorners = EBDetId::kSizeForDenseIndexing;

  static constexpr int k_NumberOfShapes = 17;

  static constexpr int k_NumberOfParametersPerShape = 11;

  static std::string dbString() { return "PEcalBarrelRcd"; }

  unsigned int numberOfShapes() const override { return k_NumberOfShapes; }
  unsigned int numberOfParametersPerShape() const override { return k_NumberOfParametersPerShape; }

  EcalBarrelGeometry();

  ~EcalBarrelGeometry() override;

  int getNumXtalsPhiDirection() const { return _nnxtalPhi; }

  int getNumXtalsEtaDirection() const { return _nnxtalEta; }

  const std::vector<int>& getEtaBaskets() const { return _EtaBaskets; }

  int getBasketSizeInPhi() const { return _PhiBaskets; }

  void setNumXtalsPhiDirection(const int& nnxtalPhi) { _nnxtalPhi = nnxtalPhi; }

  void setNumXtalsEtaDirection(const int& nnxtalEta) { _nnxtalEta = nnxtalEta; }

  void setEtaBaskets(const std::vector<int>& EtaBaskets) { _EtaBaskets = EtaBaskets; }

  void setBasketSizeInPhi(const int& PhiBaskets) { _PhiBaskets = PhiBaskets; }

  const OrderedListOfEEDetId* getClosestEndcapCells(EBDetId id) const;

  // Get closest cell, etc...

  DetId getClosestCell(const GlobalPoint& r) const override;

  CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint& r, double dR) const override;

  CCGFloat avgRadiusXYFrontFaceCenter() const;

  static std::string hitString() { return "EcalHitsEB"; }

  static std::string producerTag() { return "EcalBarrel"; }

  static unsigned int numberOfAlignments() { return 36; }

  static unsigned int alignmentTransformIndexLocal(const DetId& id);

  static unsigned int alignmentTransformIndexGlobal(const DetId& id);

  static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc);

  static void localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int i, Pt3D& ref);

  void newCell(const GlobalPoint& f1,
               const GlobalPoint& f2,
               const GlobalPoint& f3,
               const CCGFloat* parm,
               const DetId& detId) override;

  bool present(const DetId& id) const override;

protected:
  // Modify the RawPtr class
  CaloCellGeometryPtr getGeometryRawPtr(uint32_t index) const override;

private:
  /** number of crystals in eta direction */
  int _nnxtalEta;

  /** number of crystals in phi direction */
  int _nnxtalPhi;

  /** 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.) */
  std::vector<int> _EtaBaskets;

  /** size of one basket in phi */
  int _PhiBaskets;

  mutable std::atomic<EZMgrFL<EEDetId>*> m_borderMgr;

  mutable std::atomic<VecOrdListEEDetIdPtr*> m_borderPtrVec;
  CMS_THREAD_GUARD(m_check) mutable CCGFloat m_radius;
  mutable std::atomic<bool> m_check;

  CellVec m_cellVec;
};

#endif