CMS 3D CMS Logo

Functions | Variables
plot_hgcal_utils Namespace Reference

Functions

def acustompalette ()
 
def drawHalfEtaValues ()
 
def TwikiPrintout (plotname, label, zoom)
 

Variables

 _LABELS2COMPS
 
 COMPOUNDS
 
 dEdx
 
 DETECTORS
 
 hist_label_to_num
 
 MatXo
 
 plots
 
 sDETS
 

Function Documentation

◆ acustompalette()

def plot_hgcal_utils.acustompalette ( )

Definition at line 186 of file plot_hgcal_utils.py.

186 def acustompalette():
187  NRGBs = 7
188  NCont = 100
189  ncolors = array('i', [])
190  gStyle.SetNumberContours(NCont);
191  stops = [ 0.00, 0.10, 0.25, 0.45, 0.60, 0.75, 1.00 ]
192  red = [ 1.00, 0.00, 0.00, 0.00, 0.97, 0.97, 0.10 ]
193  green = [ 1.00, 0.97, 0.30, 0.40, 0.97, 0.00, 0.00 ]
194  blue = [ 1.00, 0.97, 0.97, 0.00, 0.00, 0.00, 0.00 ]
195  stopsArray = array('d', stops)
196  redArray = array('d', red)
197  greenArray = array('d', green)
198  blueArray = array('d', blue)
199  first_color_number = TColor.CreateGradientColorTable(NRGBs, stopsArray, redArray, greenArray, blueArray, NCont);
200  gStyle.SetNumberContours(NCont)
201 
202 
203  palsize = NCont
204  palette = []
205  for i in range(palsize):
206  palette.append(first_color_number+i)
207  palarray = array('i',palette)
208 
209  gStyle.SetPalette(palsize,palarray)
210 
211 
212 #In MeV/mm

References mps_check.array, and FastTimerService_cff.range.

◆ drawHalfEtaValues()

def plot_hgcal_utils.drawHalfEtaValues ( )
Function to draw the eta.
Function to draw the eta references on top of an already existing
TCanvas. The lines and labels drawn are collected inside a list and
the list is returned to the user to extend the live of the objects
contained, otherwise no lines and labels will be drawn, since they
will be garbage-collected as soon as this function returns.

Definition at line 264 of file plot_hgcal_utils.py.

264 def drawHalfEtaValues():
265  """Function to draw the eta.
266  Function to draw the eta references on top of an already existing
267  TCanvas. The lines and labels drawn are collected inside a list and
268  the list is returned to the user to extend the live of the objects
269  contained, otherwise no lines and labels will be drawn, since they
270  will be garbage-collected as soon as this function returns.
271  """
272 
273  # Add eta labels
274  keep_alive = []
275  etas = [ 0.2*i for i in range(0,18) ]
276 
277  etax = 2850.#6850.
278  etay = 1240.#5200.
279  lineL = 110#8600.
280  offT = 10.
281 
282  for ieta in etas:
283  th = 2*atan(exp(-ieta))
284  talign = 21
285 
286  #IP
287  lineh = TLine(-20.,0.,20.,0.)
288  lineh.Draw()
289  linev = TLine(0.,-10.,0.,10.)
290  linev.Draw()
291  keep_alive.append(lineh)
292  keep_alive.append(linev)
293 
294  x1 = 0
295  y1 = 0
296  if ieta>-1.6 and ieta<1.6:
297  x1 = etay/tan(th)
298  y1 = etay
299  elif ieta <=-1.6:
300  x1 = -etax
301  y1 = -etax*tan(th)
302  talign = 11
303  elif ieta>=1.6:
304  x1 = etax
305  y1 = etax*tan(th)
306  talign = 31
307  x2 = x1+lineL*cos(th)
308  y2 = y1+lineL*sin(th)
309  xt = x2
310  yt = y2+offT
311 
312  line1 = TLine(x1,y1,x2,y2)
313  line1.Draw()
314  keep_alive.append(line1)
315 
316  text = "%3.1f" % ieta
317  t1 = TLatex(xt, yt, '%s' % ('#eta = 0' if ieta == 0 else text))
318  t1.SetTextSize(0.03)
319  t1.SetTextAlign(talign)
320  t1.Draw()
321  keep_alive.append(t1)
322  return keep_alive

References funct.cos(), JetChargeProducer_cfi.exp, FastTimerService_cff.range, funct.sin(), and funct.tan().

◆ TwikiPrintout()

def plot_hgcal_utils.TwikiPrintout (   plotname,
  label,
  zoom 
)
The plots in the twiki are already too much and to avoid mistakes 
   we will try to automatize the procedure

Definition at line 125 of file plot_hgcal_utils.py.

125 def TwikiPrintout(plotname, label, zoom):
126  """The plots in the twiki are already too much and to avoid mistakes
127  we will try to automatize the procedure
128  """
129 
130  #Twiki will strip out spaces
131  label = label.replace(" ", "_")
132 
133  zoomstring = ""
134 
135  if zoom == "all":
136  zoomstring = ""
137  zoomtitle = "in all HGCal"
138  zoomdir = "%s/" % label
139  elif zoom == "zplus":
140  zoomstring = "_ZplusZoom"
141  zoomtitle = "in Z+ endcap of HGCal"
142  zoomdir = "%s/ZPlusZoom/" % label
143  elif zoom == "zminus":
144  zoomstring = "_ZminusZoom"
145  zoomtitle = "in Z- endcap of HGCal"
146  zoomdir = "%s/ZMinusZoom/" % label
147  else :
148  print("WRONG OPTION")
149 
150 
151  #Here for the hide button
152  if plotname == "x_vs_z_vs_Rsum":
153  print("%%TWISTY{ mode=\"div\" showlink=\"Click to see the %s plots %s \" hidelink=\"Hide %s %s\" showimgright=\"%%ICONURLPATH{toggleopen-small}%%\" hideimgright=\"%%ICONURLPATH{toggleclose-small}%%\"}%%" % (label,zoomtitle, label, zoomtitle))
154 
155  if "Rsum" in plotname and "x_vs" in plotname and not "cos" in plotname:
156  print("| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the mean value of the material budget in units of radiation length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the accumulated material budget as seen by the track, as the track travels throughout the detector.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring))
157 
158  if "Rsum" in plotname and "l_vs" in plotname and not "cos" in plotname:
159  print("| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the mean value of the material budget in units of interaction length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the accumulated material budget as seen by the track, as the track travels throughout the detector.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring))
160 
161  if "Rsumcos" in plotname and "x_vs" in plotname:
162  print("| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the mean value of the material budget in units of radiation length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the orthogonal accumulated material budget, that is cos(theta) what the track sees.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring))
163 
164  if "Rsumcos" in plotname and "l_vs" in plotname:
165  print("| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the mean value of the material budget in units of interaction length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the orthogonal accumulated material budget, that is cos(theta) what the track sees.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring))
166 
167  if "Rloc" in plotname and "x_vs" in plotname and not "cos" in plotname:
168  print("| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the local mean value of the material budget in units of radiation length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the local material budget as seen by the track, as the track travels throughout the detector.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring))
169 
170  if "Rloc" in plotname and "l_vs" in plotname and not "cos" in plotname:
171  print("| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the local mean value of the material budget in units of interaction length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the local material budget as seen by the track, as the track travels throughout the detector.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring))
172 
173  #Here again for the closing of the hide button
174  if plotname == "l_vs_z_vs_Rloc":
175  print("%ENDTWISTY%")
176 
177  """
178  I won't put the local cos plots for now, only the sum cos above
179  if "Rloccos" in plotname and "x_vs" in plotname:
180  print "| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the local mean value of the material budget in units of radiation length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the orthogonal accumulated material budget, that is cos(theta) what the track sees.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring)
181 
182  if "Rloccos" in plotname and "l_vs" in plotname:
183  print "| <img alt=\"HGCal_%s%s%s.png\" height=\"300\" width=\"550\" src=\"http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.png\" /> | The plot on the left shows the 2D profile histogram for *%s* %s that displays the local mean value of the material budget in units of interaction length in each R-z cell. R-z cell is 1 cm x 1 mm. The plot depicts the orthogonal accumulated material budget, that is cos(theta) what the track sees.[[http://apsallid.web.cern.ch/apsallid/HGCalMaterial/%sHGCal_%s%s%s.pdf][Click to enlarge plot]] |" % (plotname,label,zoomstring,zoomdir,plotname,label,zoomstring, label, zoomtitle,zoomdir,plotname,label,zoomstring)
184  """
185 

References edm.print().

Variable Documentation

◆ _LABELS2COMPS

plot_hgcal_utils._LABELS2COMPS
private

Definition at line 37 of file plot_hgcal_utils.py.

◆ COMPOUNDS

plot_hgcal_utils.COMPOUNDS

Definition at line 59 of file plot_hgcal_utils.py.

◆ dEdx

plot_hgcal_utils.dEdx

◆ DETECTORS

plot_hgcal_utils.DETECTORS

Definition at line 72 of file plot_hgcal_utils.py.

◆ hist_label_to_num

plot_hgcal_utils.hist_label_to_num

Definition at line 110 of file plot_hgcal_utils.py.

◆ MatXo

plot_hgcal_utils.MatXo

Definition at line 250 of file plot_hgcal_utils.py.

◆ plots

plot_hgcal_utils.plots

Definition at line 14 of file plot_hgcal_utils.py.

◆ sDETS

plot_hgcal_utils.sDETS

Definition at line 95 of file plot_hgcal_utils.py.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
plot_hgcal_utils.acustompalette
def acustompalette()
Definition: plot_hgcal_utils.py:186
plot_hgcal_utils.TwikiPrintout
def TwikiPrintout(plotname, label, zoom)
Definition: plot_hgcal_utils.py:125
mps_check.array
array
Definition: mps_check.py:216
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
plot_hgcal_utils.drawHalfEtaValues
def drawHalfEtaValues()
Definition: plot_hgcal_utils.py:264
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6