CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes
EcalRingCalibrationTools Class Reference

#include <EcalRingCalibrationTools.h>

Public Member Functions

 EcalRingCalibrationTools ()
 
 ~EcalRingCalibrationTools ()
 

Static Public Member Functions

static std::vector< DetIdgetDetIdsInECAL ()
 
static std::vector< DetIdgetDetIdsInModule (short int)
 
static std::vector< DetIdgetDetIdsInRing (short aRingIndex)
 Retrieve the DetIds in a phi-ring. More...
 
static short getModuleIndex (DetId aDetId)
 
static short getRingIndex (DetId aDetId)
 Retrieve the phi-ring index corresponding to a DetId. More...
 
static void setCaloGeometry (const CaloGeometry *geometry)
 

Static Public Attributes

static constexpr short N_MODULES_BARREL = 144
 
static constexpr short N_RING_BARREL = 170
 
static constexpr short N_RING_ENDCAP = 78
 
static constexpr short N_RING_TOTAL = 248
 

Static Private Member Functions

static void initializeFromGeometry (CaloGeometry const *geometry)
 

Static Private Attributes

static short endcapRingIndex_ [EEDetId::IX_MAX][EEDetId::IY_MAX]
 
static std::atomic< bool > isInitializedFromGeometry_
 
static std::once_flag once_
 

Detailed Description

Definition at line 23 of file EcalRingCalibrationTools.h.

Constructor & Destructor Documentation

◆ EcalRingCalibrationTools()

EcalRingCalibrationTools::EcalRingCalibrationTools ( )
inline

Definition at line 25 of file EcalRingCalibrationTools.h.

25 {};

◆ ~EcalRingCalibrationTools()

EcalRingCalibrationTools::~EcalRingCalibrationTools ( )
inline

Definition at line 26 of file EcalRingCalibrationTools.h.

26 {};

Member Function Documentation

◆ getDetIdsInECAL()

std::vector< DetId > EcalRingCalibrationTools::getDetIdsInECAL ( )
static

Definition at line 102 of file EcalRingCalibrationTools.cc.

References hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, isInitializedFromGeometry_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), EEDetId::IX_MAX, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), EEDetId::IY_MAX, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EBDetId::validDetId(), EEDetId::validDetId(), and ecaldqm::zside().

Referenced by ZeeCalibration::duringLoop(), and ZeeCalibration::endOfLoop().

102  {
103  std::vector<DetId> ringIds;
104 
105  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta)
108  ringIds.push_back(EBDetId(ieta, iphi));
109 
110  //needed only for the EE, it can be replaced at some point maybe with something smarter
112  throw std::logic_error("EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry is not initialized");
113 
114  for (int ix = 0; ix < EEDetId::IX_MAX; ++ix)
115  for (int iy = 0; iy < EEDetId::IY_MAX; ++iy)
116  for (int zside = -1; zside < 2; zside += 2)
117  if (EEDetId::validDetId(ix + 1, iy + 1, zside))
118  ringIds.push_back(EEDetId(ix + 1, iy + 1, zside));
119 
120  // std::cout<<" [EcalRingCalibrationTools::getDetIdsInECAL()] DetId.size() is "<<ringIds.size()<<std::endl;
121 
122  return ringIds;
123 }
static const int MIN_IPHI
Definition: EBDetId.h:135
static std::atomic< bool > isInitializedFromGeometry_
int zside(DetId const &)
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
static const int IX_MAX
Definition: EEDetId.h:298
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
static const int MAX_IPHI
Definition: EBDetId.h:137
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
static const int IY_MAX
Definition: EEDetId.h:302

◆ getDetIdsInModule()

std::vector< DetId > EcalRingCalibrationTools::getDetIdsInModule ( short  int)
static

Definition at line 125 of file EcalRingCalibrationTools.cc.

References gather_cfg::cout, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, N_MODULES_BARREL, and ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::sm().

Referenced by ZeeCalibration::duringLoop(), and ZeeCalibration::endOfLoop().

125  {
126  std::vector<DetId> ringIds;
127  if (moduleIndex < 0)
128  return ringIds;
129 
130  short moduleBound[5] = {1, 26, 46, 66, 86};
131  if (moduleIndex < EcalRingCalibrationTools::N_MODULES_BARREL) {
133  short sm, moduleInSm, zsm;
134 
135  short minModuleiphi, maxModuleiphi, minModuleieta = 360, maxModuleieta = 0;
136 
137  // if(moduleIndex%4 != 0 )
138  sm = moduleIndex / 4 + 1;
139  // else
140  //sm = moduleIndex/4;//i.e. module 8 belongs to sm=3, not sm=3
141 
142  //if(moduleIndex%4 != 0 )
143  moduleInSm = moduleIndex % 4;
144  //else
145  //moduleInSm = 4;//moduleInSm is [1,2,3,4]
146 
147  if (moduleIndex > 71)
148  zsm = -1;
149  else
150  zsm = 1;
151 
152  minModuleiphi = ((sm - 1) % 18 + 1) * 20 - 19;
153  maxModuleiphi = ((sm - 1) % 18 + 1) * 20;
154 
155  if (zsm == 1) {
156  minModuleieta = moduleBound[moduleInSm];
157  maxModuleieta = moduleBound[moduleInSm + 1] - 1;
158  } else if (zsm == -1) {
159  minModuleieta = -moduleBound[moduleInSm + 1] + 1;
160  maxModuleieta = -moduleBound[moduleInSm];
161  }
163 
164  std::cout << "Called moduleIndex " << moduleIndex << std::endl;
165  std::cout << "minModuleieta " << minModuleieta << " maxModuleieta " << maxModuleieta << " minModuleiphi "
166  << minModuleiphi << " maxModuleiphi " << maxModuleiphi << std::endl;
167 
168  for (int ieta = minModuleieta; ieta <= maxModuleieta; ++ieta) {
169  for (int iphi = minModuleiphi; iphi <= maxModuleiphi; ++iphi) {
170  ringIds.push_back(EBDetId(ieta, iphi));
171 
172  // std::cout<<"Putting Xtal with ieta: "<<ieta<<" iphi "<<iphi<<" of SM "<<sm<<" into Module "<<moduleIndex<<std::endl;
173 
174  } //close loop on phi
175  } //close loop on eta
176  } //close if ( moduleInstallationNumber < 144)
177 
178  return ringIds;
179 }
static constexpr short N_MODULES_BARREL

◆ getDetIdsInRing()

std::vector< DetId > EcalRingCalibrationTools::getDetIdsInRing ( short  aRingIndex)
static

Retrieve the DetIds in a phi-ring.

Definition at line 66 of file EcalRingCalibrationTools.cc.

References endcapRingIndex_, hcalRecHitTable_cff::iphi, isInitializedFromGeometry_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), EEDetId::IX_MAX, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), EEDetId::IY_MAX, dqmdumpme::k, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, N_RING_BARREL, N_RING_ENDCAP, N_RING_TOTAL, EBDetId::validDetId(), and ecaldqm::zside().

Referenced by ZeeCalibration::duringLoop(), and ZeeCalibration::endOfLoop().

66  {
67  std::vector<DetId> ringIds;
68  if (etaIndex < 0)
69  return ringIds;
70 
71  if (etaIndex < N_RING_BARREL) {
72  int k = 0;
73  if (etaIndex < 85)
74  k = -85 + etaIndex;
75  else
76  k = etaIndex - 84;
77 
79 
81  ringIds.push_back(EBDetId(k, iphi));
82  }
83 
84  else if (etaIndex < N_RING_TOTAL) {
85  //needed only for the EE, it can be replaced at some point maybe with something smarter
87  throw std::logic_error(
88  "EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry is not initialized");
89 
90  int zside = (etaIndex < N_RING_BARREL + (N_RING_ENDCAP / 2)) ? -1 : 1;
91  short eeEtaIndex = (etaIndex - N_RING_BARREL) % (N_RING_ENDCAP / 2);
92 
93  for (int ix = 0; ix < EEDetId::IX_MAX; ++ix)
94  for (int iy = 0; iy < EEDetId::IY_MAX; ++iy)
95  if (endcapRingIndex_[ix][iy] == eeEtaIndex)
96  ringIds.push_back(EEDetId(ix + 1, iy + 1, zside));
97  }
98 
99  return ringIds;
100 }
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
static const int MIN_IPHI
Definition: EBDetId.h:135
static std::atomic< bool > isInitializedFromGeometry_
static constexpr short N_RING_ENDCAP
int zside(DetId const &)
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
static constexpr short N_RING_BARREL
static const int IX_MAX
Definition: EEDetId.h:298
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
static constexpr short N_RING_TOTAL
static const int MAX_IPHI
Definition: EBDetId.h:137
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
static const int IY_MAX
Definition: EEDetId.h:302

◆ getModuleIndex()

short EcalRingCalibrationTools::getModuleIndex ( DetId  aDetId)
static

Definition at line 49 of file EcalRingCalibrationTools.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EBDetId::im(), EBDetId::ism(), and callgraph::module.

Referenced by calib::CalibElectron::getCalibModulesWeights().

49  {
50  if (id.det() != DetId::Ecal)
51  return -1;
52 
53  if (id.subdetId() == EcalBarrel) {
54  short module = 4 * (EBDetId(id).ism() - 1) + EBDetId(id).im() - 1;
55 
56  // std::cout<<"SM construction # : "<<EBDetId(id).ism() <<" SM installation # : "<< installationSMNumber[ EBDetId(id).ism() -1 ]<< "Xtal is Module :"<<module<< std::endl;
57  return module;
58  }
59  if (id.subdetId() == EcalEndcap) {
60  return -1;
61  }
62 
63  return -1;
64 }
int im() const
get the number of module inside the SM (1-4)
Definition: EBDetId.h:64
int ism() const
get the ECAL/SM id
Definition: EBDetId.h:59

◆ getRingIndex()

short EcalRingCalibrationTools::getRingIndex ( DetId  aDetId)
static

Retrieve the phi-ring index corresponding to a DetId.

Definition at line 24 of file EcalRingCalibrationTools.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, runTauDisplay::eid, endcapRingIndex_, hcalRecHitTable_cff::ieta, EBDetId::ieta(), isInitializedFromGeometry_, N_RING_BARREL, and N_RING_ENDCAP.

Referenced by calib::CalibElectron::getCalibModulesWeights(), EcalPhiSymRecHitProducerBase::initializeConfigCache(), EcalPhiSymRecHitProducerBase::initializePhiSymCache(), PFRecHitQTestECALMultiThreshold::pass(), and EcalPhiSymRecHitProducerBase::processEvent().

24  {
25  if (id.det() != DetId::Ecal)
26  return -1;
27 
28  if (id.subdetId() == EcalBarrel) {
29  if (EBDetId(id).ieta() < 0)
30  return EBDetId(id).ieta() + 85;
31  else
32  return EBDetId(id).ieta() + 84;
33  }
34  if (id.subdetId() == EcalEndcap) {
35  //needed only for the EE, it can be replaced at some point with something smarter
37  throw std::logic_error(
38  "EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry is not initialized");
39 
40  EEDetId eid(id);
41  short endcapRingIndex = endcapRingIndex_[eid.ix() - 1][eid.iy() - 1] + N_RING_BARREL;
42  if (eid.zside() == 1)
43  endcapRingIndex += N_RING_ENDCAP / 2;
44  return endcapRingIndex;
45  }
46  return -1;
47 }
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
static std::atomic< bool > isInitializedFromGeometry_
static constexpr short N_RING_ENDCAP
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
static constexpr short N_RING_BARREL

◆ initializeFromGeometry()

void EcalRingCalibrationTools::initializeFromGeometry ( CaloGeometry const *  geometry)
staticprivate

Definition at line 185 of file EcalRingCalibrationTools.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, endcapRingIndex_, Ecal07UnpackerData_cfi::ics, isInitializedFromGeometry_, EEDetId::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), EEDetId::IX_MAX, EEDetId::iy(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), EEDetId::IY_MAX, N_RING_ENDCAP, relativeConstraints::ring, and EEDetId::zside().

Referenced by setCaloGeometry().

185  {
186  if (not geometry)
187  throw std::invalid_argument("EcalRingCalibrationTools::initializeFromGeometry called with a nullptr argument");
188 
189  float cellPosEta[EEDetId::IX_MAX][EEDetId::IY_MAX];
190  for (int ix = 0; ix < EEDetId::IX_MAX; ++ix)
191  for (int iy = 0; iy < EEDetId::IY_MAX; ++iy) {
192  cellPosEta[ix][iy] = -1.;
193  endcapRingIndex_[ix][iy] = -9;
194  }
195 
196  CaloSubdetectorGeometry const* endcapGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
197  if (not endcapGeometry)
198  throw std::logic_error("EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry not found");
199 
200  std::vector<DetId> const& endcapCells = geometry->getValidDetIds(DetId::Ecal, EcalEndcap);
201 
202  for (std::vector<DetId>::const_iterator endcapIt = endcapCells.begin(); endcapIt != endcapCells.end(); ++endcapIt) {
203  EEDetId ee(*endcapIt);
204  if (ee.zside() == -1)
205  continue; //Just using +side to fill absEta x,y map
206  auto cellGeometry = endcapGeometry->getGeometry(*endcapIt);
207  int ics = ee.ix() - 1;
208  int ips = ee.iy() - 1;
209  cellPosEta[ics][ips] = fabs(cellGeometry->getPosition().eta());
210  //std::cout<<"EE Xtal, |eta| is "<<fabs(cellGeometry->getPosition().eta())<<std::endl;
211  }
212 
213  float eta_ring[N_RING_ENDCAP / 2];
214  for (int ring = 0; ring < N_RING_ENDCAP / 2; ++ring)
215  eta_ring[ring] = cellPosEta[ring][50];
216 
217  double etaBoundary[N_RING_ENDCAP / 2 + 1];
218  etaBoundary[0] = 1.47;
219  etaBoundary[N_RING_ENDCAP / 2] = 4.0;
220 
221  for (int ring = 1; ring < N_RING_ENDCAP / 2; ++ring)
222  etaBoundary[ring] = (eta_ring[ring] + eta_ring[ring - 1]) / 2.;
223 
224  for (int ring = 0; ring < N_RING_ENDCAP / 2; ++ring) {
225  // std::cout<<"***********************EE ring: "<<ring<<" eta "<<(etaBoundary[ring] + etaBoundary[ring+1])/2.<<std::endl;
226  for (int ix = 0; ix < EEDetId::IX_MAX; ix++)
227  for (int iy = 0; iy < EEDetId::IY_MAX; iy++)
228  if (cellPosEta[ix][iy] > etaBoundary[ring] && cellPosEta[ix][iy] < etaBoundary[ring + 1]) {
230  //std::cout<<"endcapRing_["<<ix+1<<"]["<<iy+1<<"] = "<<ring<<";"<<std::endl;
231  }
232  }
233 
234  std::vector<DetId> const& barrelCells = geometry->getValidDetIds(DetId::Ecal, EcalBarrel);
235 
236  for (std::vector<DetId>::const_iterator barrelIt = barrelCells.begin(); barrelIt != barrelCells.end(); ++barrelIt) {
237  EBDetId eb(*barrelIt);
238  }
239 
240  //EB
241 
243 }
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
static std::atomic< bool > isInitializedFromGeometry_
static constexpr short N_RING_ENDCAP
static const int IX_MAX
Definition: EEDetId.h:298
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
static const int IY_MAX
Definition: EEDetId.h:302

◆ setCaloGeometry()

void EcalRingCalibrationTools::setCaloGeometry ( const CaloGeometry geometry)
static

Member Data Documentation

◆ endcapRingIndex_

short EcalRingCalibrationTools::endcapRingIndex_
staticprivate

◆ isInitializedFromGeometry_

std::atomic< bool > EcalRingCalibrationTools::isInitializedFromGeometry_
staticprivate

◆ N_MODULES_BARREL

constexpr short EcalRingCalibrationTools::N_MODULES_BARREL = 144
static

◆ N_RING_BARREL

constexpr short EcalRingCalibrationTools::N_RING_BARREL = 170
static

◆ N_RING_ENDCAP

constexpr short EcalRingCalibrationTools::N_RING_ENDCAP = 78
static

◆ N_RING_TOTAL

constexpr short EcalRingCalibrationTools::N_RING_TOTAL = 248
static

◆ once_

std::once_flag EcalRingCalibrationTools::once_
staticprivate

Definition at line 54 of file EcalRingCalibrationTools.h.

Referenced by setCaloGeometry().