CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 const short N_MODULES_BARREL = 144
 
static const short N_RING_BARREL = 170
 
static const short N_RING_ENDCAP = 78
 
static const short N_RING_TOTAL = 248
 

Static Private Member Functions

static void initializeFromGeometry ()
 

Static Private Attributes

static const CaloGeometrycaloGeometry_ = 0
 
static short endcapRingIndex_ [EEDetId::IX_MAX][EEDetId::IY_MAX]
 
static bool isInitializedFromGeometry_ = false
 

Detailed Description

Definition at line 20 of file EcalRingCalibrationTools.h.

Constructor & Destructor Documentation

EcalRingCalibrationTools::EcalRingCalibrationTools ( )
inline

Definition at line 23 of file EcalRingCalibrationTools.h.

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

Definition at line 24 of file EcalRingCalibrationTools.h.

24 {};

Member Function Documentation

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

Definition at line 113 of file EcalRingCalibrationTools.cc.

References initializeFromGeometry(), 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().

114 {
115 
116  std::vector<DetId> ringIds;
117 
118  for(int ieta= - EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta)
119  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi)
120  if (EBDetId::validDetId(ieta,iphi))
121  ringIds.push_back(EBDetId(ieta,iphi));
122 
123  //needed only for the EE, it can be replaced at some point maybe with something smarter
126 
127  for (int ix=0;ix<EEDetId::IX_MAX;++ix)
128  for (int iy=0;iy<EEDetId::IY_MAX;++iy)
129  for(int zside = -1; zside<2; zside += 2)
130  if ( EEDetId::validDetId(ix+1,iy+1,zside) )
131  ringIds.push_back( EEDetId(ix+1,iy+1,zside) );
132 
133 
134  // std::cout<<" [EcalRingCalibrationTools::getDetIdsInECAL()] DetId.size() is "<<ringIds.size()<<std::endl;
135 
136  return ringIds;
137 }
static const int MIN_IPHI
Definition: EBDetId.h:142
int zside(DetId const &)
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 139 of file EcalRingCalibrationTools.cc.

References gather_cfg::cout, and N_MODULES_BARREL.

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

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

Retrieve the DetIds in a phi-ring.

Definition at line 71 of file EcalRingCalibrationTools.cc.

References endcapRingIndex_, initializeFromGeometry(), isInitializedFromGeometry_, EEDetId::IX_MAX, EEDetId::IY_MAX, relval_steps::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().

72 {
73 
74 
75  std::vector<DetId> ringIds;
76  if (etaIndex < 0)
77  return ringIds;
78 
79  if (etaIndex < N_RING_BARREL)
80  {
81 
82  int k =0;
83  if (etaIndex<85)
84  k=-85 + etaIndex;
85  else
86  k= etaIndex - 84;
87 
88  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi)
89 
90  if (EBDetId::validDetId(k,iphi))
91  ringIds.push_back(EBDetId(k,iphi));
92  }
93 
94  else if (etaIndex < N_RING_TOTAL)
95  {
96  //needed only for the EE, it can be replaced at some point maybe with something smarter
99 
100  int zside= (etaIndex < N_RING_BARREL + (N_RING_ENDCAP/2) ) ? -1 : 1;
101  short eeEtaIndex = (etaIndex - N_RING_BARREL)%(N_RING_ENDCAP/2);
102 
103  for (int ix=0;ix<EEDetId::IX_MAX;++ix)
104  for (int iy=0;iy<EEDetId::IY_MAX;++iy)
105  if (endcapRingIndex_[ix][iy] == eeEtaIndex)
106  ringIds.push_back(EEDetId(ix+1,iy+1,zside));
107 
108  }
109 
110  return ringIds;
111 }
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
static const int MIN_IPHI
Definition: EBDetId.h:142
int zside(DetId const &)
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 const int IY_MAX
Definition: EEDetId.h:306
short EcalRingCalibrationTools::getModuleIndex ( DetId  aDetId)
static

Definition at line 46 of file EcalRingCalibrationTools.cc.

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

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

47 {
48 
49  if (id.det() != DetId::Ecal)
50  return -1;
51 
52  if (id.subdetId() == EcalBarrel)
53  {
54 
55 
56  short module = 4*( EBDetId(id).ism() -1 ) + EBDetId(id).im() -1;
57 
58  // std::cout<<"SM construction # : "<<EBDetId(id).ism() <<" SM installation # : "<< installationSMNumber[ EBDetId(id).ism() -1 ]<< "Xtal is Module :"<<module<< std::endl;
59  return module;
60 
61  }
62  if (id.subdetId() == EcalEndcap)
63  {
64 
65  return -1;
66  }
67 
68  return -1;
69 }
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 20 of file EcalRingCalibrationTools.cc.

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

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

21 {
22  if (id.det() != DetId::Ecal)
23  return -1;
24 
25  if (id.subdetId() == EcalBarrel)
26  {
27  if(EBDetId(id).ieta()<0)
28  return EBDetId(id).ieta() + 85;
29  else
30  return EBDetId(id).ieta() + 84;
31 
32  }
33  if (id.subdetId() == EcalEndcap)
34  {
35  //needed only for the EE, it can be replaced at some point with something smarter
38  EEDetId eid(id);
39  short endcapRingIndex = endcapRingIndex_[eid.ix()-1][eid.iy()-1] + N_RING_BARREL;
40  if (eid.zside() == 1) endcapRingIndex += N_RING_ENDCAP/2;
41  return endcapRingIndex;
42  }
43  return -1;
44 }
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
void EcalRingCalibrationTools::initializeFromGeometry ( )
staticprivate

Definition at line 203 of file EcalRingCalibrationTools.cc.

References caloGeometry_, DetId::Ecal, EcalBarrel, EcalEndcap, endcapRingIndex_, PV3DBase< T, PVType, FrameType >::eta(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), CaloGeometry::getValidDetIds(), h2_mapping_cfi::ics, isInitializedFromGeometry_, EEDetId::ix(), EEDetId::IX_MAX, EEDetId::iy(), EEDetId::IY_MAX, N_RING_ENDCAP, relativeConstraints::ring, and EEDetId::zside().

Referenced by getDetIdsInECAL(), getDetIdsInRing(), and getRingIndex().

204 {
205 
206  if (!caloGeometry_)
207  {
208  edm::LogError("EcalRingCalibrationTools") << "BIG ERROR::Initializing without geometry handle" ;
209  return;
210  }
211 
212  float m_cellPosEta[EEDetId::IX_MAX][EEDetId::IY_MAX];
213  for (int ix=0; ix<EEDetId::IX_MAX; ++ix)
214  for (int iy=0; iy<EEDetId::IY_MAX; ++iy)
215  {
216  m_cellPosEta[ix][iy] = -1.;
217  endcapRingIndex_[ix][iy]=-9;
218  }
219 
220 
222 
223  if (!endcapGeometry)
224  {
225  edm::LogError("EcalRingCalibrationTools") << "BIG ERROR::Ecal Endcap geometry not found" ;
226  return;
227  }
228 
229  const std::vector<DetId>& m_endcapCells= caloGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
230 
231  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin();
232  endcapIt!=m_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  m_cellPosEta[ics][ips] = fabs(cellGeometry->getPosition().eta());
241 
242  //std::cout<<"EE Xtal, |eta| is "<<fabs(cellGeometry->getPosition().eta())<<std::endl;
243 
244  }
245 
246  float eta_ring[N_RING_ENDCAP/2];
247  for (int ring=0; ring<N_RING_ENDCAP/2; ++ring)
248  eta_ring[ring]=m_cellPosEta[ring][50];
249 
250  double etaBoundary[N_RING_ENDCAP/2 + 1];
251  etaBoundary[0]=1.47;
252  etaBoundary[N_RING_ENDCAP/2]=4.0;
253 
254  for (int ring=1; ring<N_RING_ENDCAP/2; ++ring)
255  etaBoundary[ring]=(eta_ring[ring]+eta_ring[ring-1])/2.;
256 
257 
258 
259  for (int ring=0; ring<N_RING_ENDCAP/2; ring++){
260  // std::cout<<"***********************EE ring: "<<ring<<" eta "<<(etaBoundary[ring] + etaBoundary[ring+1])/2.<<std::endl;
261  for (int ix=0; ix<EEDetId::IX_MAX; ix++)
262  for (int iy=0; iy<EEDetId::IY_MAX; iy++)
263  if (m_cellPosEta[ix][iy]>etaBoundary[ring] && m_cellPosEta[ix][iy]<etaBoundary[ring+1])
264  {
265  endcapRingIndex_[ix][iy]=ring;
266  //std::cout<<"endcapRing_["<<ix+1<<"]["<<iy+1<<"] = "<<ring<<";"<<std::endl;
267  }
268  }
269 
270  const std::vector<DetId>& m_barrelCells= caloGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
271 
272  for (std::vector<DetId>::const_iterator barrelIt = m_barrelCells.begin();
273  barrelIt!=m_barrelCells.end();
274  ++barrelIt)
275  {
276  EBDetId eb(*barrelIt);
277  }
278 
279 
280  //EB
281 
283 
284 }
static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX]
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
static const CaloGeometry * caloGeometry_
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static const int IX_MAX
Definition: EEDetId.h:302
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:90
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.
static void EcalRingCalibrationTools::setCaloGeometry ( const CaloGeometry geometry)
inlinestatic

Definition at line 42 of file EcalRingCalibrationTools.h.

References caloGeometry_, and geometry.

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

42 { caloGeometry_ = geometry; };
static const CaloGeometry * caloGeometry_
ESHandle< TrackerGeometry > geometry

Member Data Documentation

const CaloGeometry * EcalRingCalibrationTools::caloGeometry_ = 0
staticprivate

Definition at line 50 of file EcalRingCalibrationTools.h.

Referenced by initializeFromGeometry(), and setCaloGeometry().

short EcalRingCalibrationTools::endcapRingIndex_
staticprivate
bool EcalRingCalibrationTools::isInitializedFromGeometry_ = false
staticprivate
const short EcalRingCalibrationTools::N_MODULES_BARREL = 144
static
const short EcalRingCalibrationTools::N_RING_BARREL = 170
static
const short EcalRingCalibrationTools::N_RING_ENDCAP = 78
static
const short EcalRingCalibrationTools::N_RING_TOTAL = 248
static