CMS 3D CMS Logo

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

#include <MEGeom.h>

Public Member Functions

virtual ~MEGeom ()
 

Static Public Member Functions

static void drawGlobalBoundaries (int lineColor)
 
static void drawHist (int ilmr, int unit, TCanvas *canv=nullptr)
 
static TGraph * getBoundary (int ilmr, int unit)
 
static TH2 * getGlobalHist (const char *name=nullptr)
 
static TH2 * getHist (int ilmr, int unit)
 
static void setBinGlobalHist (TH2 *h, int ix, int iy, int iz, float val)
 

Static Private Attributes

static TH2 * _h
 
static int _nbinx = 2 * (MEGeom::_nbuf + 100 + 85) + 1
 
static int _nbiny = 2 * (MEGeom::_nbuf + 180)
 
static int _nbuf = 5
 
static float _xmax = 0.5 + MEGeom::_nbuf + 100 + 85
 
static float _xmin = -(0.5 + MEGeom::_nbuf + 100 + 85)
 
static float _ymax = 180.5 + (MEGeom::_nbuf + 180)
 
static float _ymin = 180.5 - (MEGeom::_nbuf + 180)
 

Detailed Description

Definition at line 18 of file MEGeom.h.

Constructor & Destructor Documentation

◆ ~MEGeom()

virtual MEGeom::~MEGeom ( )
inlinevirtual

Definition at line 32 of file MEGeom.h.

32 {}

Member Function Documentation

◆ drawGlobalBoundaries()

void MEGeom::drawGlobalBoundaries ( int  lineColor)
static

Definition at line 287 of file MEGeom.cc.

287  {
288  TGraph* gr(nullptr);
289  for (int ism = 1; ism <= 36; ism++) {
291  gr->SetLineWidth(2);
292  gr->SetLineColor(lineColor);
293  gr->Draw("LSame");
294  }
295  for (int isec = 1; isec <= 9; isec++) {
297  TGraph* grm = (TGraph*)gr->Clone();
298  TGraph* grp = (TGraph*)gr->Clone();
299  int n = gr->GetN();
300  // std::cout << std::endl;
301  for (int ii = 0; ii < n; ii++) {
302  double x_, y_;
303  gr->GetPoint(ii, x_, y_);
304  // std::cout << isec << " " << ii << " x=" << x_ << " y=" << y_ << std::endl;
305 
306  double xx_, yy_;
307 
308  xx_ = -85 - x_;
309  yy_ = 231 - y_;
310  // std::cout << isec << " " << 0 << " x=" << xx_ << " y=" << yy_ << std::endl;
311 
312  grm->SetPoint(ii, xx_, yy_);
313 
314  xx_ = 85 + x_;
315  yy_ = 231 - y_;
316  // std::cout << isec << " " << 1 << " x=" << xx_ << " y=" << yy_ << std::endl;
317  grp->SetPoint(ii, xx_, yy_);
318  }
319  grm->SetLineColor(lineColor);
320  grm->SetLineWidth(2);
321  grm->Draw("LSame");
322  grp->SetLineColor(lineColor);
323  grp->SetLineWidth(2);
324  grp->Draw("LSame");
325  }
326 }

References MEEEGeom::getGraphBoundary(), MEEBGeom::getGraphBoundary(), cuy::ii, MEEEGeom::iSector, ecalpyutils::ism(), MEEBGeom::iSuperModule, RecoTauValidation_cfi::lineColor, and dqmiodumpmetadata::n.

◆ drawHist()

void MEGeom::drawHist ( int  ilmr,
int  unit,
TCanvas *  canv = nullptr 
)
static

Definition at line 199 of file MEGeom.cc.

199  {
200  TH2* h = getHist(ilmr, histtype);
201  assert(h != nullptr);
202  TString tname = h->GetTitle();
203  switch (histtype) {
204  case ME::iSector:
205  break;
206  case ME::iLMRegion:
207  tname += " Monitoring Regions";
208  break;
209  case ME::iLMModule:
210  tname += " Monitoring Modules";
211  break;
212  case ME::iSuperCrystal:
213  tname += " Super Crystals";
214  break;
215  case ME::iCrystal:
216  tname += " Crystals";
217  break;
219  tname += " Electronic Channels";
220  break;
221  case ME::iHVChannel:
222  tname += " HV Channels";
223  break;
224  case ME::iLVChannel:
225  tname += " LV Channels";
226  break;
227  }
228 
229  if (canv == nullptr) {
230  TString cname = tname;
231  cname.ReplaceAll(" ", "_");
232  canv = new TCanvas(cname, cname, 10, 10, 500, 500);
233  }
234  canv->SetTitle(tname);
235  canv->cd();
236 
237  h->Draw("COLZ");
238 
239  TGraph* gsect = getBoundary(ilmr, ME::iSector);
240  assert(gsect != nullptr);
241  gsect->SetLineWidth(1);
242  gsect->Draw("LSame");
243  TGraph* gside = getBoundary(ilmr, ME::iLMRegion);
244  assert(gside != nullptr);
245  gside->SetLineWidth(2);
246  gside->Draw("LSame");
247 }

References cms::cuda::assert(), ME::iCrystal, ME::iElectronicChannel, ME::iHVChannel, ME::iLMModule, ME::iLMRegion, ME::iLVChannel, ME::iSector, ME::iSuperCrystal, and tname().

◆ getBoundary()

TGraph * MEGeom::getBoundary ( int  ilmr,
int  unit 
)
static

Definition at line 141 of file MEGeom.cc.

141  {
142  // for local pictures, only sector or monitoring region
143  if (histtype != ME::iSector && histtype != ME::iLMRegion)
144  histtype = ME::iSector;
145 
146  int ireg;
147  int ism;
148  int idcc;
149  int side;
150  ME::regionAndSector(ilmr, ireg, ism, idcc, side);
151 
152  //
153  // to produce these root files, run the runGeom executable
154  //
155  TGraph* g_(nullptr);
156  TFile* rootfile(nullptr);
157  TString gn_;
158  if (ireg == ME::iEBM || ireg == ME::iEBP) {
159  rootfile = TFile::Open("ebgeom.root");
160  assert(rootfile != nullptr);
161  switch (histtype) {
162  case ME::iSector:
163  gn_ = "SuperModule";
164  break;
165  case ME::iLMRegion:
166  gn_ = "Side_";
167  gn_ += side;
168  break;
169  }
170  } else {
171  int isect = ism;
172  if (ireg == ME::iEEM) {
173  isect -= 9;
174  rootfile = TFile::Open("eegeom_1.root");
175  }
176  if (ireg == ME::iEEP)
177  rootfile = TFile::Open("eegeom_2.root");
178  assert(rootfile != nullptr);
179  int lmr_ = ilmr;
180  if (ireg == ME::iEEP)
181  lmr_ -= 72;
182  else if (ireg == ME::iEEM)
183  lmr_ -= 82;
184  switch (histtype) {
185  case ME::iSector:
186  gn_ = "Sector_";
187  gn_ += isect;
188  break;
189  case ME::iLMRegion:
190  gn_ = "LMRegion_";
191  gn_ += lmr_;
192  break;
193  }
194  }
195  g_ = (TGraph*)rootfile->Get(gn_);
196  return g_;
197 }

References cms::cuda::assert(), ME::iEBM, ME::iEBP, ME::iEEM, ME::iEEP, ME::iLMRegion, ME::iSector, ecalpyutils::ism(), ME::regionAndSector(), and doHarvest::rootfile.

◆ getGlobalHist()

TH2 * MEGeom::getGlobalHist ( const char *  name = nullptr)
static

Definition at line 249 of file MEGeom.cc.

249  {
250  TH2* h = (TH2*)_h->Clone(name);
251  h->Reset();
252  return h;
253 }

References h, and Skims_PA_cff::name.

◆ getHist()

TH2 * MEGeom::getHist ( int  ilmr,
int  unit 
)
static

Definition at line 37 of file MEGeom.cc.

37  {
38  int ireg;
39  int ism;
40  int idcc;
41  int side;
42  ME::regionAndSector(ilmr, ireg, ism, idcc, side);
43 
44  std::cout << "LM region=" << ilmr << " reg/sm/dcc/side " << ireg << "/" << ism << "/" << idcc << "/" << side
45  << std::endl;
46 
47  TString hname = "LMR=";
48  hname += ilmr;
49  hname += " ";
50  if (ireg == ME::iEEM || ireg == ME::iEEP) {
51  hname += MEEEGeom::smName(ism);
52  } else if (ireg == ME::iEBM || ireg == ME::iEBP) {
53  hname += MEEBGeom::smName(ism);
54  } else
55  abort();
56 
57  hname += " ";
58  hname += "DCC=";
59  hname += idcc;
60  hname += "/";
61  hname += side;
62 
63  //
64  // to produce these root files, run the runGeom executable
65  //
66  TH2* h_(nullptr);
67  TFile* rootfile(nullptr);
68  TString hn_;
69  if (ireg == ME::iEBM || ireg == ME::iEBP) {
70  rootfile = TFile::Open("ebgeom.root");
71  assert(rootfile != nullptr);
72  hn_ = "eb_loc";
73  switch (unit) {
74  case ME::iSector:
75  break;
76  case ME::iLMRegion:
77  hn_ += "_side";
78  break;
79  case ME::iLMModule:
80  hn_ += "_lmmod";
81  break;
82  case ME::iSuperCrystal:
83  hn_ += "_tt";
84  break;
85  case ME::iCrystal:
86  hn_ += "_cr";
87  break;
89  hn_ += "_elecr";
90  break;
91  case ME::iHVChannel:
92  hn_ += "_hv";
93  break;
94  case ME::iLVChannel:
95  hn_ += "_lv";
96  break;
97  }
98  } else {
99  int isect = ism;
100  if (ireg == ME::iEEM) {
101  isect -= 9;
102  rootfile = TFile::Open("eegeom_1.root");
103  }
104  if (ireg == ME::iEEP)
105  rootfile = TFile::Open("eegeom_2.root");
106  assert(rootfile != nullptr);
107  hn_ = "eem_S";
108  hn_ += isect;
109  switch (unit) {
110  case ME::iSector:
111  break;
112  case ME::iLMRegion:
113  break;
114  case ME::iLMModule:
115  hn_ += "_lmmod";
116  break;
117  case ME::iSuperCrystal:
118  hn_ += "_sc";
119  break;
120  case ME::iCrystal:
121  hn_ += "_cr";
122  break;
124  hn_ += "_cr";
125  break;
126  case ME::iHVChannel:
127  break;
128  case ME::iLVChannel:
129  break;
130  }
131  }
132  h_ = (TH2*)rootfile->Get(hn_);
133  h_->SetTitle(hname);
134  h_->GetXaxis()->SetTitle("ix");
135  h_->GetXaxis()->CenterTitle();
136  h_->GetYaxis()->SetTitle("iy");
137  h_->GetYaxis()->CenterTitle();
138  return h_;
139 }

References cms::cuda::assert(), gather_cfg::cout, ME::iCrystal, ME::iEBM, ME::iEBP, ME::iEEM, ME::iEEP, ME::iElectronicChannel, ME::iHVChannel, ME::iLMModule, ME::iLMRegion, ME::iLVChannel, ME::iSector, ecalpyutils::ism(), ME::iSuperCrystal, ME::regionAndSector(), doHarvest::rootfile, MEEBGeom::smName(), MEEEGeom::smName(), and unit().

◆ setBinGlobalHist()

void MEGeom::setBinGlobalHist ( TH2 *  h,
int  ix,
int  iy,
int  iz,
float  val 
)
static

Definition at line 255 of file MEGeom.cc.

255  {
256  // make sure it's a global hist
257  TAxis* ax = h->GetXaxis();
258  TAxis* ay = h->GetYaxis();
259  assert(ax->GetNbins() == _nbinx && ay->GetNbins() == _nbiny);
260  assert(ax->GetXmax() == _xmax && ax->GetXmin() == _xmin);
261  assert(ay->GetXmax() == _ymax && ay->GetXmin() == _ymin);
262 
263  int ibinx(0);
264  int ibiny(0);
265 
266  if (iz == 0) {
267  int ieta = ix;
268  int iphi = iy;
269  assert(abs(ieta) >= 1 && abs(ieta) <= 85);
270  assert(iphi >= 1 && iphi <= 360);
271 
272  ibinx = ax->FindBin(ieta);
273  ibiny = ay->FindBin(iphi);
274  } else if (iz == -1) {
275  assert(ix >= 1 && ix <= 100 && iy >= 1 && iy <= 100);
276  ibinx = (_nbuf + 100 + 1) - ix;
277  ibiny = (_nbuf + 180 + 50 + 1) - iy;
278  } else if (iz == 1) {
279  assert(ix >= 1 && ix <= 100 && iy >= 1 && iy <= 100);
280  ibinx = _nbinx + 1 - ((_nbuf + 100 + 1) - ix);
281  ibiny = (_nbuf + 180 + 50 + 1) - iy;
282  }
283  h->SetBinContent(ibinx, ibiny, val);
284 }

References funct::abs(), cms::cuda::assert(), LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, and heppy_batch::val.

Member Data Documentation

◆ _h

TH2 * MEGeom::_h
staticprivate
Initial value:
= new TH2F("globalEcal",
"Global representation of ECAL",

Definition at line 42 of file MEGeom.h.

◆ _nbinx

int MEGeom::_nbinx = 2 * (MEGeom::_nbuf + 100 + 85) + 1
staticprivate

Definition at line 36 of file MEGeom.h.

◆ _nbiny

int MEGeom::_nbiny = 2 * (MEGeom::_nbuf + 180)
staticprivate

Definition at line 37 of file MEGeom.h.

◆ _nbuf

int MEGeom::_nbuf = 5
staticprivate

Definition at line 35 of file MEGeom.h.

◆ _xmax

float MEGeom::_xmax = 0.5 + MEGeom::_nbuf + 100 + 85
staticprivate

Definition at line 39 of file MEGeom.h.

Referenced by plotting.PlotTextBox::move(), and plotting.PlotTextBox::width().

◆ _xmin

float MEGeom::_xmin = -(0.5 + MEGeom::_nbuf + 100 + 85)
staticprivate

◆ _ymax

float MEGeom::_ymax = 180.5 + (MEGeom::_nbuf + 180)
staticprivate

Definition at line 41 of file MEGeom.h.

Referenced by plotting.PlotTextBox::move().

◆ _ymin

float MEGeom::_ymin = 180.5 - (MEGeom::_nbuf + 180)
staticprivate

Definition at line 40 of file MEGeom.h.

Referenced by plotting.PlotTextBox::move().

ME::iLMRegion
Definition: ME.h:16
ME::iElectronicChannel
Definition: ME.h:18
MEGeom::_nbuf
static int _nbuf
Definition: MEGeom.h:35
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
MEGeom::_ymax
static float _ymax
Definition: MEGeom.h:41
MEEBGeom::smName
static TString smName(int ism)
Definition: MEEBGeom.cc:79
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
MEGeom::_xmax
static float _xmax
Definition: MEGeom.h:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
ME::iLMModule
Definition: ME.h:16
MEGeom::_nbinx
static int _nbinx
Definition: MEGeom.h:36
ME::iLVChannel
Definition: ME.h:18
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
MEGeom::_ymin
static float _ymin
Definition: MEGeom.h:40
ME::iSuperCrystal
Definition: ME.h:16
MEGeom::_nbiny
static int _nbiny
Definition: MEGeom.h:37
h
MEGeom::_xmin
static float _xmin
Definition: MEGeom.h:38
MEEBGeom::iSuperModule
Definition: MEEBGeom.h:18
ME::iCrystal
Definition: ME.h:16
ME::iEBP
Definition: ME.h:14
ME::iHVChannel
Definition: ME.h:18
ME::iSector
Definition: ME.h:16
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
MEEEGeom::getGraphBoundary
static TGraph * getGraphBoundary(int type, int num, int iz=-1, int xside=0)
Definition: MEEEGeom.cc:423
tname
std::string tname(const std::string &tableName, const std::string &schemaVersion)
Definition: CredentialStore.cc:150
MEEEGeom::smName
static TString smName(int ism)
Definition: MEEEGeom.cc:388
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
MEEEGeom::iSector
Definition: MEEEGeom.h:18
ecalpyutils::ism
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:51
heppy_batch.val
val
Definition: heppy_batch.py:351
ME::iEEM
Definition: ME.h:14
MEEBGeom::getGraphBoundary
static TGraph * getGraphBoundary(int type, int num, bool global=false)
Definition: MEEBGeom.cc:346
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MEGeom::_h
static TH2 * _h
Definition: MEGeom.h:42
RecoTauValidation_cfi.lineColor
lineColor
Definition: RecoTauValidation_cfi.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
doHarvest.rootfile
rootfile
Definition: doHarvest.py:122
ME::iEBM
Definition: ME.h:14
cuy.ii
ii
Definition: cuy.py:590
MEGeom::getHist
static TH2 * getHist(int ilmr, int unit)
Definition: MEGeom.cc:37
ME::regionAndSector
static void regionAndSector(int ilmr, int &ireg, int &isect, int &idcc, int &iside)
Definition: ME.cc:333
ME::iEEP
Definition: ME.h:14
MEGeom::getBoundary
static TGraph * getBoundary(int ilmr, int unit)
Definition: MEGeom.cc:141