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 ( )
inline

Definition at line 25 of file EcalRingCalibrationTools.h.

25 {};
EcalRingCalibrationTools::~EcalRingCalibrationTools ( )
inline

Member Function Documentation

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

Definition at line 118 of file EcalRingCalibrationTools.cc.

References isInitializedFromGeometry_, EEDetId::IX_MAX, EEDetId::IY_MAX, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EBDetId::validDetId(), EEDetId::validDetId(), and HcalDigiParam_cfi::zside.

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

119 {
120  std::vector<DetId> ringIds;
121 
122  for(int ieta= - EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta)
123  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi)
124  if (EBDetId::validDetId(ieta,iphi))
125  ringIds.push_back(EBDetId(ieta,iphi));
126 
127  //needed only for the EE, it can be replaced at some point maybe with something smarter
129  throw std::logic_error("EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry is not initialized");
130 
131  for (int ix=0;ix<EEDetId::IX_MAX;++ix)
132  for (int iy=0;iy<EEDetId::IY_MAX;++iy)
133  for(int zside = -1; zside<2; zside += 2)
134  if ( EEDetId::validDetId(ix+1,iy+1,zside) )
135  ringIds.push_back( EEDetId(ix+1,iy+1,zside) );
136 
137 
138  // std::cout<<" [EcalRingCalibrationTools::getDetIdsInECAL()] DetId.size() is "<<ringIds.size()<<std::endl;
139 
140  return ringIds;
141 }
static const int MIN_IPHI
Definition: EBDetId.h:142
static std::atomic< bool > isInitializedFromGeometry_
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
static const int IX_MAX
Definition: EEDetId.h:302
static const int MAX_IPHI
Definition: EBDetId.h:144
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:143
static const int IY_MAX
Definition: EEDetId.h:306
std::vector< DetId > EcalRingCalibrationTools::getDetIdsInModule ( short  int)
static

Definition at line 143 of file EcalRingCalibrationTools.cc.

References gather_cfg::cout, and N_MODULES_BARREL.

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

144 {
145 
146  std::vector<DetId> ringIds;
147  if (moduleIndex < 0)
148  return ringIds;
149 
150  short moduleBound[5] = {1, 26, 46, 66, 86};
152  {
154  short sm, moduleInSm, zsm;
155 
156  short minModuleiphi, maxModuleiphi, minModuleieta=360,maxModuleieta=0;
157 
158  // if(moduleIndex%4 != 0 )
159  sm = moduleIndex / 4 + 1;
160  // else
161  //sm = moduleIndex/4;//i.e. module 8 belongs to sm=3, not sm=3
162 
163  //if(moduleIndex%4 != 0 )
164  moduleInSm = moduleIndex%4;
165  //else
166  //moduleInSm = 4;//moduleInSm is [1,2,3,4]
167 
168  if(moduleIndex > 71)
169  zsm = -1;
170  else
171  zsm = 1;
172 
173  minModuleiphi = ( (sm - 1) %18 + 1 ) *20 - 19;
174  maxModuleiphi = ( (sm - 1) %18 + 1 ) * 20;
175 
176  if(zsm == 1)
177  {
178  minModuleieta = moduleBound[ moduleInSm ];
179  maxModuleieta = moduleBound[ moduleInSm + 1 ] - 1;
180  }
181  else if(zsm == -1){
182  minModuleieta = - moduleBound[ moduleInSm + 1 ] + 1;
183  maxModuleieta = - moduleBound[ moduleInSm ];
184  }
186 
187 
188  std::cout<<"Called moduleIndex "<<moduleIndex<<std::endl;
189  std::cout<<"minModuleieta "<<minModuleieta<<" maxModuleieta "<<maxModuleieta<<" minModuleiphi "<<minModuleiphi<<" maxModuleiphi "<<maxModuleiphi<<std::endl;
190 
191  for(int ieta = minModuleieta; ieta <= maxModuleieta; ++ieta){
192  for(int iphi = minModuleiphi; iphi<= maxModuleiphi; ++iphi){
193 
194 
195  ringIds.push_back(EBDetId(ieta,iphi));
196 
197  // std::cout<<"Putting Xtal with ieta: "<<ieta<<" iphi "<<iphi<<" of SM "<<sm<<" into Module "<<moduleIndex<<std::endl;
198 
199 
200  }//close loop on phi
201  }//close loop on eta
202  }//close if ( moduleInstallationNumber < 144)
203 
204  return ringIds;
205 }
static constexpr short N_MODULES_BARREL
std::vector< DetId > EcalRingCalibrationTools::getDetIdsInRing ( short  aRingIndex)
static

Retrieve the DetIds in a phi-ring.

Definition at line 77 of file EcalRingCalibrationTools.cc.

References endcapRingIndex_, isInitializedFromGeometry_, EEDetId::IX_MAX, EEDetId::IY_MAX, gen::k, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, N_RING_BARREL, N_RING_ENDCAP, N_RING_TOTAL, EBDetId::validDetId(), and HcalDigiParam_cfi::zside.

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

78 {
79 
80  std::vector<DetId> ringIds;
81  if (etaIndex < 0)
82  return ringIds;
83 
84  if (etaIndex < N_RING_BARREL)
85  {
86 
87  int k =0;
88  if (etaIndex<85)
89  k=-85 + etaIndex;
90  else
91  k= etaIndex - 84;
92 
93  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi)
94 
95  if (EBDetId::validDetId(k,iphi))
96  ringIds.push_back(EBDetId(k,iphi));
97  }
98 
99  else if (etaIndex < N_RING_TOTAL)
100  {
101  //needed only for the EE, it can be replaced at some point maybe with something smarter
103  throw std::logic_error("EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry is not initialized");
104 
105  int zside= (etaIndex < N_RING_BARREL + (N_RING_ENDCAP/2) ) ? -1 : 1;
106  short eeEtaIndex = (etaIndex - N_RING_BARREL)%(N_RING_ENDCAP/2);
107 
108  for (int ix=0;ix<EEDetId::IX_MAX;++ix)
109  for (int iy=0;iy<EEDetId::IY_MAX;++iy)
110  if (endcapRingIndex_[ix][iy] == eeEtaIndex)
111  ringIds.push_back(EEDetId(ix+1,iy+1,zside));
112 
113  }
114 
115  return ringIds;
116 }
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
static const int MIN_IPHI
Definition: EBDetId.h:142
static std::atomic< bool > isInitializedFromGeometry_
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
static constexpr short N_RING_ENDCAP
int k[5][pyjets_maxn]
static const int IX_MAX
Definition: EEDetId.h:302
static constexpr short N_RING_BARREL
static const int MAX_IPHI
Definition: EBDetId.h:144
static const int IY_MAX
Definition: EEDetId.h:306
static constexpr short N_RING_TOTAL
short EcalRingCalibrationTools::getModuleIndex ( DetId  aDetId)
static

Definition at line 52 of file EcalRingCalibrationTools.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EBDetId::im(), EBDetId::ism(), and python.rootplot.argparse::module.

Referenced by calib::CalibElectron::getCalibModulesWeights(), and ~EcalRingCalibrationTools().

53 {
54 
55  if (id.det() != DetId::Ecal)
56  return -1;
57 
58  if (id.subdetId() == EcalBarrel)
59  {
60 
61 
62  short module = 4*( EBDetId(id).ism() -1 ) + EBDetId(id).im() -1;
63 
64  // std::cout<<"SM construction # : "<<EBDetId(id).ism() <<" SM installation # : "<< installationSMNumber[ EBDetId(id).ism() -1 ]<< "Xtal is Module :"<<module<< std::endl;
65  return module;
66 
67  }
68  if (id.subdetId() == EcalEndcap)
69  {
70 
71  return -1;
72  }
73 
74  return -1;
75 }
int ism() const
get the ECAL/SM id
Definition: EBDetId.h:61
int im() const
get the number of module inside the SM (1-4)
Definition: EBDetId.h:66
Definition: vlib.h:208
short EcalRingCalibrationTools::getRingIndex ( DetId  aDetId)
static

Retrieve the phi-ring index corresponding to a DetId.

Definition at line 25 of file EcalRingCalibrationTools.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, runTauDisplay::eid, endcapRingIndex_, EBDetId::ieta(), isInitializedFromGeometry_, EEDetId::ix(), EEDetId::iy(), N_RING_BARREL, N_RING_ENDCAP, and EEDetId::zside().

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

26 {
27  if (id.det() != DetId::Ecal)
28  return -1;
29 
30  if (id.subdetId() == EcalBarrel)
31  {
32  if(EBDetId(id).ieta()<0)
33  return EBDetId(id).ieta() + 85;
34  else
35  return EBDetId(id).ieta() + 84;
36 
37  }
38  if (id.subdetId() == EcalEndcap)
39  {
40  //needed only for the EE, it can be replaced at some point with something smarter
42  throw std::logic_error("EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry is not initialized");
43 
44  EEDetId eid(id);
45  short endcapRingIndex = endcapRingIndex_[eid.ix()-1][eid.iy()-1] + N_RING_BARREL;
46  if (eid.zside() == 1) endcapRingIndex += N_RING_ENDCAP/2;
47  return endcapRingIndex;
48  }
49  return -1;
50 }
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:51
static constexpr short N_RING_BARREL
void EcalRingCalibrationTools::initializeFromGeometry ( CaloGeometry const *  geometry)
staticprivate

Definition at line 212 of file EcalRingCalibrationTools.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, endcapRingIndex_, PV3DBase< T, PVType, FrameType >::eta(), CaloCellGeometry::getPosition(), isInitializedFromGeometry_, EEDetId::ix(), EEDetId::IX_MAX, EEDetId::iy(), EEDetId::IY_MAX, N_RING_ENDCAP, relativeConstraints::ring, and EEDetId::zside().

Referenced by setCaloGeometry().

213 {
214  if (not geometry)
215  throw std::invalid_argument("EcalRingCalibrationTools::initializeFromGeometry called with a nullptr argument");
216 
217  float cellPosEta[EEDetId::IX_MAX][EEDetId::IY_MAX];
218  for (int ix=0; ix<EEDetId::IX_MAX; ++ix)
219  for (int iy=0; iy<EEDetId::IY_MAX; ++iy)
220  {
221  cellPosEta[ix][iy] = -1.;
222  endcapRingIndex_[ix][iy]=-9;
223  }
224 
225  CaloSubdetectorGeometry const* endcapGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
226  if (not endcapGeometry)
227  throw std::logic_error("EcalRingCalibrationTools::initializeFromGeometry Ecal Endcap geometry not found");
228 
229  std::vector<DetId> const& endcapCells = geometry->getValidDetIds(DetId::Ecal, EcalEndcap);
230 
231  for (std::vector<DetId>::const_iterator endcapIt = endcapCells.begin();
232  endcapIt!=endcapCells.end();
233  ++endcapIt)
234  {
235  EEDetId ee(*endcapIt);
236  if (ee.zside() == -1) continue; //Just using +side to fill absEta x,y map
237  const CaloCellGeometry *cellGeometry = endcapGeometry->getGeometry(*endcapIt) ;
238  int ics=ee.ix() - 1 ;
239  int ips=ee.iy() - 1 ;
240  cellPosEta[ics][ips] = fabs(cellGeometry->getPosition().eta());
241  //std::cout<<"EE Xtal, |eta| is "<<fabs(cellGeometry->getPosition().eta())<<std::endl;
242  }
243 
244  float eta_ring[N_RING_ENDCAP/2];
245  for (int ring=0; ring<N_RING_ENDCAP/2; ++ring)
246  eta_ring[ring]=cellPosEta[ring][50];
247 
248  double etaBoundary[N_RING_ENDCAP/2 + 1];
249  etaBoundary[0]=1.47;
250  etaBoundary[N_RING_ENDCAP/2]=4.0;
251 
252  for (int ring=1; ring<N_RING_ENDCAP/2; ++ring)
253  etaBoundary[ring]=(eta_ring[ring]+eta_ring[ring-1])/2.;
254 
255  for (int ring=0; ring<N_RING_ENDCAP/2; ++ring){
256  // std::cout<<"***********************EE ring: "<<ring<<" eta "<<(etaBoundary[ring] + etaBoundary[ring+1])/2.<<std::endl;
257  for (int ix=0; ix<EEDetId::IX_MAX; ix++)
258  for (int iy=0; iy<EEDetId::IY_MAX; iy++)
259  if (cellPosEta[ix][iy]>etaBoundary[ring] && cellPosEta[ix][iy]<etaBoundary[ring+1])
260  {
261  endcapRingIndex_[ix][iy]=ring;
262  //std::cout<<"endcapRing_["<<ix+1<<"]["<<iy+1<<"] = "<<ring<<";"<<std::endl;
263  }
264  }
265 
266  std::vector<DetId> const& barrelCells = geometry->getValidDetIds(DetId::Ecal, EcalBarrel);
267 
268  for (std::vector<DetId>::const_iterator barrelIt = barrelCells.begin();
269  barrelIt!=barrelCells.end();
270  ++barrelIt)
271  {
272  EBDetId eb(*barrelIt);
273  }
274 
275  //EB
276 
278 
279 }
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:302
T eta() const
Definition: PV3DBase.h:76
static const int IY_MAX
Definition: EEDetId.h:306
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void EcalRingCalibrationTools::setCaloGeometry ( const CaloGeometry geometry)
static

Definition at line 207 of file EcalRingCalibrationTools.cc.

References initializeFromGeometry(), and once_.

Referenced by PFRecHitQTestECALMultiThreshold::beginEvent(), ZeeCalibration::duringLoop(), and HLTEcalPhiSymFilter::filter().

208 {
209  std::call_once(once_, EcalRingCalibrationTools::initializeFromGeometry, geometry);
210 }
static void initializeFromGeometry(CaloGeometry const *geometry)

Member Data Documentation

short EcalRingCalibrationTools::endcapRingIndex_
staticprivate
std::atomic< bool > EcalRingCalibrationTools::isInitializedFromGeometry_
staticprivate
short EcalRingCalibrationTools::N_MODULES_BARREL = 144
static
short EcalRingCalibrationTools::N_RING_BARREL = 170
static
short EcalRingCalibrationTools::N_RING_ENDCAP = 78
static
short EcalRingCalibrationTools::N_RING_TOTAL = 248
static
std::once_flag EcalRingCalibrationTools::once_
staticprivate

Definition at line 54 of file EcalRingCalibrationTools.h.

Referenced by setCaloGeometry().