test
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 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=0)
 
static TGraph * getBoundary (int ilmr, int unit)
 
static TH2 * getGlobalHist (const char *name=0)
 
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

virtual MEGeom::~MEGeom ( )
inlinevirtual

Definition at line 35 of file MEGeom.h.

35 {}

Member Function Documentation

void MEGeom::drawGlobalBoundaries ( int  lineColor)
static

Definition at line 254 of file MEGeom.cc.

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

255 {
256  TGraph* gr(0);
257  for( int ism=1; ism<=36; ism++ )
258  {
260  gr->SetLineWidth( 2 );
261  gr->SetLineColor( lineColor );
262  gr->Draw("LSame");
263  }
264  for( int isec=1; isec<=9; isec++ )
265  {
267  TGraph* grm = (TGraph*) gr->Clone();
268  TGraph* grp = (TGraph*) gr->Clone();
269  int n = gr->GetN();
270  // std::cout << std::endl;
271  for( int ii=0; ii<n; ii++ )
272  {
273  double x_, y_;
274  gr->GetPoint( ii, x_, y_ );
275  // std::cout << isec << " " << ii << " x=" << x_ << " y=" << y_ << std::endl;
276 
277  double xx_, yy_;
278 
279  xx_ = -85-x_;
280  yy_ = 231-y_;
281  // std::cout << isec << " " << 0 << " x=" << xx_ << " y=" << yy_ << std::endl;
282 
283  grm->SetPoint( ii, xx_, yy_ );
284 
285  xx_ = 85+x_;
286  yy_ = 231-y_;
287  // std::cout << isec << " " << 1 << " x=" << xx_ << " y=" << yy_ << std::endl;
288  grp->SetPoint( ii, xx_, yy_ );
289  }
290  grm->SetLineColor( lineColor );
291  grm->SetLineWidth( 2 );
292  grm->Draw("LSame");
293  grp->SetLineColor( lineColor );
294  grp->SetLineWidth( 2 );
295  grp->Draw("LSame");
296  }
297 }
int ii
Definition: cuy.py:588
static TGraph * getGraphBoundary(int type, int num, bool global=false)
Definition: MEEBGeom.cc:363
static TGraph * getGraphBoundary(int type, int num, int iz=-1, int xside=0)
Definition: MEEEGeom.cc:460
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
void MEGeom::drawHist ( int  ilmr,
int  unit,
TCanvas *  canv = 0 
)
static

Definition at line 167 of file MEGeom.cc.

References assert(), h, ME::iCrystal, ME::iElectronicChannel, ME::iHVChannel, ME::iLMModule, ME::iLMRegion, ME::iLVChannel, ME::iSector, ME::iSuperCrystal, and cond::persistency::GLOBAL_TAG::tname.

168 {
169 
170  TH2* h = getHist( ilmr, histtype );
171  assert( h!=0 );
172  TString tname = h->GetTitle();
173  switch( histtype )
174  {
175  case ME::iSector: break;
176  case ME::iLMRegion: tname += " Monitoring Regions"; break;
177  case ME::iLMModule: tname += " Monitoring Modules"; break;
178  case ME::iSuperCrystal: tname += " Super Crystals"; break;
179  case ME::iCrystal: tname += " Crystals"; break;
180  case ME::iElectronicChannel: tname += " Electronic Channels"; break;
181  case ME::iHVChannel: tname += " HV Channels"; break;
182  case ME::iLVChannel: tname += " LV Channels"; break;
183  }
184 
185  if( canv==0 )
186  {
187  TString cname = tname;
188  cname.ReplaceAll(" ","_");
189  canv = new TCanvas( cname, cname, 10, 10, 500, 500 );
190  }
191  canv->SetTitle( tname );
192  canv->cd();
193 
194  h->Draw("COLZ");
195 
196  TGraph* gsect = getBoundary( ilmr, ME::iSector );
197  assert( gsect!=0 );
198  gsect->SetLineWidth( 1 );
199  gsect->Draw("LSame");
200  TGraph* gside = getBoundary( ilmr, ME::iLMRegion );
201  assert( gside!=0 );
202  gside->SetLineWidth( 2 );
203  gside->Draw("LSame");
204 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
static char const * tname
Definition: GTSchema.h:13
assert(m_qm.get())
static TH2 * getHist(int ilmr, int unit)
Definition: MEGeom.cc:34
static TGraph * getBoundary(int ilmr, int unit)
Definition: MEGeom.cc:115
Definition: ME.h:18
TGraph * MEGeom::getBoundary ( int  ilmr,
int  unit 
)
static

Definition at line 115 of file MEGeom.cc.

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

116 {
117  // for local pictures, only sector or monitoring region
120 
121  int ireg;
122  int ism;
123  int idcc;
124  int side;
125  ME::regionAndSector( ilmr, ireg, ism, idcc, side );
126 
127  //
128  // to produce these root files, run the runGeom executable
129  //
130  TGraph* g_(0);
131  TFile* rootfile(0);
132  TString gn_;
133  if( ireg==ME::iEBM || ireg==ME::iEBP )
134  {
135  rootfile = TFile::Open("ebgeom.root");
136  assert( rootfile!=0 );
137  switch (histtype)
138  {
139  case ME::iSector: gn_ = "SuperModule"; break;
140  case ME::iLMRegion: gn_ = "Side_"; gn_+=side; break;
141  }
142  }
143  else
144  {
145  int isect=ism;
146  if( ireg==ME::iEEM )
147  {
148  isect-=9;
149  rootfile = TFile::Open("eegeom_1.root");
150  }
151  if( ireg==ME::iEEP ) rootfile = TFile::Open("eegeom_2.root");
152  assert( rootfile!=0 );
153  int lmr_= ilmr;
154  if( ireg==ME::iEEP ) lmr_-=72;
155  else if( ireg==ME::iEEM ) lmr_-=82;
156  switch (histtype)
157  {
158  case ME::iSector: gn_ = "Sector_"; gn_+=isect; break;
159  case ME::iLMRegion: gn_ = "LMRegion_"; gn_+=lmr_; break;
160  }
161  }
162  g_ = (TGraph*) rootfile->Get( gn_ );
163  return g_;
164 }
static void regionAndSector(int ilmr, int &ireg, int &isect, int &idcc, int &iside)
Definition: ME.cc:348
Definition: ME.h:16
assert(m_qm.get())
Definition: ME.h:16
Definition: ME.h:16
Definition: ME.h:18
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
Definition: ME.h:16
TH2 * MEGeom::getGlobalHist ( const char *  name = 0)
static

Definition at line 207 of file MEGeom.cc.

References h.

208 {
209  TH2* h = (TH2*)_h->Clone( name );
210  h->Reset();
211  return h;
212 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
static TH2 * _h
Definition: MEGeom.h:46
TH2 * MEGeom::getHist ( int  ilmr,
int  unit 
)
static

Definition at line 34 of file MEGeom.cc.

References 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(), reco_application_2006_simpleTBanalysis_cfg::rootfile, MEEBGeom::smName(), and MEEEGeom::smName().

35 {
36  int ireg;
37  int ism;
38  int idcc;
39  int side;
40  ME::regionAndSector( ilmr, ireg, ism, idcc, side );
41 
42  std::cout << "LM region=" << ilmr << " reg/sm/dcc/side " << ireg << "/" << ism << "/" << idcc << "/" << side << std::endl;
43 
44  TString hname = "LMR="; hname += ilmr; hname += " ";
45  if( ireg==ME::iEEM || ireg==ME::iEEP )
46  {
47  hname += MEEEGeom::smName( ism );
48  }
49  else if( ireg==ME::iEBM || ireg==ME::iEBP )
50  {
51  hname += MEEBGeom::smName( ism );
52  }
53  else
54  abort();
55 
56  hname += " ";
57  hname += "DCC="; hname += idcc; hname += "/" ; hname += side;
58 
59  //
60  // to produce these root files, run the runGeom executable
61  //
62  TH2* h_(0);
63  TFile* rootfile(0);
64  TString hn_;
65  if( ireg==ME::iEBM || ireg==ME::iEBP )
66  {
67  rootfile = TFile::Open("ebgeom.root");
68  assert( rootfile!=0 );
69  hn_="eb_loc";
70  switch ( unit )
71  {
72  case ME::iSector: break;
73  case ME::iLMRegion: hn_ += "_side"; break;
74  case ME::iLMModule: hn_ += "_lmmod"; break;
75  case ME::iSuperCrystal: hn_ += "_tt"; break;
76  case ME::iCrystal: hn_ += "_cr"; break;
77  case ME::iElectronicChannel: hn_ += "_elecr"; break;
78  case ME::iHVChannel: hn_ += "_hv"; break;
79  case ME::iLVChannel: hn_ += "_lv"; break;
80  }
81  }
82  else
83  {
84  int isect=ism;
85  if( ireg==ME::iEEM )
86  {
87  isect-=9;
88  rootfile = TFile::Open("eegeom_1.root");
89  }
90  if( ireg==ME::iEEP ) rootfile = TFile::Open("eegeom_2.root");
91  assert( rootfile!=0 );
92  hn_="eem_S"; hn_+= isect;
93  switch (unit)
94  {
95  case ME::iSector: break;
96  case ME::iLMRegion: break;
97  case ME::iLMModule: hn_ += "_lmmod"; break;
98  case ME::iSuperCrystal: hn_ += "_sc"; break;
99  case ME::iCrystal: hn_ += "_cr"; break;
100  case ME::iElectronicChannel: hn_ += "_cr"; break;
101  case ME::iHVChannel: break;
102  case ME::iLVChannel: break;
103  }
104  }
105  h_ = (TH2*) rootfile->Get( hn_ );
106  h_->SetTitle( hname );
107  h_->GetXaxis()->SetTitle("ix");
108  h_->GetXaxis()->CenterTitle();
109  h_->GetYaxis()->SetTitle("iy");
110  h_->GetYaxis()->CenterTitle();
111  return h_;
112 }
static void regionAndSector(int ilmr, int &ireg, int &isect, int &idcc, int &iside)
Definition: ME.cc:348
static TString smName(int ism)
Definition: MEEBGeom.cc:79
Definition: ME.h:16
assert(m_qm.get())
Definition: ME.h:16
string unit
Definition: csvLumiCalc.py:46
static TString smName(int ism)
Definition: MEEEGeom.cc:415
Definition: ME.h:16
tuple cout
Definition: gather_cfg.py:145
Definition: ME.h:18
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
Definition: ME.h:16
void MEGeom::setBinGlobalHist ( TH2 *  h,
int  ix,
int  iy,
int  iz,
float  val 
)
static

Definition at line 215 of file MEGeom.cc.

References funct::abs(), assert(), and create_public_lumi_plots::ax.

216 {
217  // make sure it's a global hist
218  TAxis* ax = h->GetXaxis();
219  TAxis* ay = h->GetYaxis();
220  assert( ax->GetNbins()==_nbinx && ay->GetNbins()==_nbiny );
221  assert( ax->GetXmax()==_xmax && ax->GetXmin()==_xmin );
222  assert( ay->GetXmax()==_ymax && ay->GetXmin()==_ymin );
223 
224  int ibinx(0);
225  int ibiny(0);
226 
227  if( iz==0 )
228  {
229  int ieta = ix;
230  int iphi = iy;
231  assert( abs(ieta)>=1 && abs(ieta)<=85 );
232  assert( iphi>=1 && iphi<=360 );
233 
234  ibinx = ax->FindBin( ieta );
235  ibiny = ay->FindBin( iphi );
236  }
237  else if( iz==-1 )
238  {
239  assert( ix>=1 && ix<=100 && iy>=1 && iy<=100 );
240  ibinx = (_nbuf+100+1)-ix;
241  ibiny = (_nbuf+180+50+1)-iy;
242  }
243  else if( iz==1 )
244  {
245  assert( ix>=1 && ix<=100 && iy>=1 && iy<=100 );
246  ibinx = _nbinx+1-((_nbuf+100+1)-ix);
247  ibiny = (_nbuf+180+50+1)-iy;
248  }
249  h->SetBinContent( ibinx, ibiny, val );
250 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
assert(m_qm.get())
static float _ymax
Definition: MEGeom.h:45
static float _xmax
Definition: MEGeom.h:43
static float _ymin
Definition: MEGeom.h:44
static int _nbiny
Definition: MEGeom.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int _nbuf
Definition: MEGeom.h:39
static float _xmin
Definition: MEGeom.h:42
static int _nbinx
Definition: MEGeom.h:40

Member Data Documentation

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

Definition at line 46 of file MEGeom.h.

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

Definition at line 40 of file MEGeom.h.

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

Definition at line 41 of file MEGeom.h.

int MEGeom::_nbuf = 5
staticprivate

Definition at line 39 of file MEGeom.h.

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

Definition at line 43 of file MEGeom.h.

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

Definition at line 42 of file MEGeom.h.

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

Definition at line 45 of file MEGeom.h.

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

Definition at line 44 of file MEGeom.h.