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 22 of file EcalRingCalibrationTools.h.

Constructor & Destructor Documentation

◆ EcalRingCalibrationTools()

EcalRingCalibrationTools::EcalRingCalibrationTools ( )
inline

Definition at line 24 of file EcalRingCalibrationTools.h.

24 :

◆ ~EcalRingCalibrationTools()

EcalRingCalibrationTools::~EcalRingCalibrationTools ( )
inline

Definition at line 25 of file EcalRingCalibrationTools.h.

25 {};

Member Function Documentation

◆ getDetIdsInECAL()

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

Definition at line 102 of file EcalRingCalibrationTools.cc.

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 }

References LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, isInitializedFromGeometry_, EEDetId::IX_MAX, 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().

◆ getDetIdsInModule()

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

Definition at line 125 of file EcalRingCalibrationTools.cc.

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 }

References gather_cfg::cout, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, and N_MODULES_BARREL.

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

◆ getDetIdsInRing()

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

Retrieve the DetIds in a phi-ring.

Definition at line 66 of file EcalRingCalibrationTools.cc.

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 }

References endcapRingIndex_, LEDCalibrationChannels::iphi, isInitializedFromGeometry_, EEDetId::IX_MAX, 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().

◆ getModuleIndex()

short EcalRingCalibrationTools::getModuleIndex ( DetId  aDetId)
static

Definition at line 49 of file EcalRingCalibrationTools.cc.

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 }

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

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

◆ getRingIndex()

short EcalRingCalibrationTools::getRingIndex ( DetId  aDetId)
static

Retrieve the phi-ring index corresponding to a DetId.

Definition at line 24 of file EcalRingCalibrationTools.cc.

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 }

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

Referenced by calib::CalibElectron::getCalibModulesWeights(), and PFRecHitQTestECALMultiThreshold::pass().

◆ initializeFromGeometry()

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

Definition at line 185 of file EcalRingCalibrationTools.cc.

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]) {
229  endcapRingIndex_[ix][iy] = ring;
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 }

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

Referenced by setCaloGeometry().

◆ 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
staticconstexpr

◆ N_RING_BARREL

constexpr short EcalRingCalibrationTools::N_RING_BARREL = 170
staticconstexpr

◆ N_RING_ENDCAP

constexpr short EcalRingCalibrationTools::N_RING_ENDCAP = 78
staticconstexpr

◆ N_RING_TOTAL

constexpr short EcalRingCalibrationTools::N_RING_TOTAL = 248
staticconstexpr

◆ once_

std::once_flag EcalRingCalibrationTools::once_
staticprivate

Definition at line 53 of file EcalRingCalibrationTools.h.

Referenced by setCaloGeometry().

EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
EcalRingCalibrationTools::EcalRingCalibrationTools
EcalRingCalibrationTools()
Definition: EcalRingCalibrationTools.h:24
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
EBDetId
Definition: EBDetId.h:17
geometry
Definition: geometry.py:1
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EBDetId::im
int im() const
get the number of module inside the SM (1-4)
Definition: EBDetId.h:64
EcalRingCalibrationTools::N_RING_BARREL
static constexpr short N_RING_BARREL
Definition: EcalRingCalibrationTools.h:38
EcalRingCalibrationTools::isInitializedFromGeometry_
static std::atomic< bool > isInitializedFromGeometry_
Definition: EcalRingCalibrationTools.h:48
EcalBarrel
Definition: EcalSubdetector.h:10
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
EcalRingCalibrationTools::N_RING_ENDCAP
static constexpr short N_RING_ENDCAP
Definition: EcalRingCalibrationTools.h:39
EcalRingCalibrationTools::initializeFromGeometry
static void initializeFromGeometry(CaloGeometry const *geometry)
Definition: EcalRingCalibrationTools.cc:185
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
dqmdumpme.k
k
Definition: dqmdumpme.py:60
EEDetId
Definition: EEDetId.h:14
EcalEndcap
Definition: EcalSubdetector.h:10
EcalRingCalibrationTools::N_RING_TOTAL
static constexpr short N_RING_TOTAL
Definition: EcalRingCalibrationTools.h:37
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
DetId::Ecal
Definition: DetId.h:27
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
EcalRingCalibrationTools::once_
static std::once_flag once_
Definition: EcalRingCalibrationTools.h:53
EcalRingCalibrationTools::endcapRingIndex_
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
Definition: EcalRingCalibrationTools.h:51
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
Ecal07UnpackerData_cfi.ics
ics
Definition: Ecal07UnpackerData_cfi.py:55
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EBDetId::ism
int ism() const
get the ECAL/SM id
Definition: EBDetId.h:59
EcalRingCalibrationTools::N_MODULES_BARREL
static constexpr short N_MODULES_BARREL
Definition: EcalRingCalibrationTools.h:41
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135