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 192 of file plot_hgcal_utils.py.

References mps_check.array, and FastTimerService_cff.range.

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

◆ 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 270 of file plot_hgcal_utils.py.

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

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

◆ 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 131 of file plot_hgcal_utils.py.

References print().

131 def TwikiPrintout(plotname, label, zoom):
132  """The plots in the twiki are already too much and to avoid mistakes
133  we will try to automatize the procedure
134  """
135 
136  #Twiki will strip out spaces
137  label = label.replace(" ", "_")
138 
139  zoomstring = ""
140 
141  if zoom == "all":
142  zoomstring = ""
143  zoomtitle = "in all HGCal"
144  zoomdir = "%s/" % label
145  elif zoom == "zplus":
146  zoomstring = "_ZplusZoom"
147  zoomtitle = "in Z+ endcap of HGCal"
148  zoomdir = "%s/ZPlusZoom/" % label
149  elif zoom == "zminus":
150  zoomstring = "_ZminusZoom"
151  zoomtitle = "in Z- endcap of HGCal"
152  zoomdir = "%s/ZMinusZoom/" % label
153  else :
154  print("WRONG OPTION")
155 
156 
157  #Here for the hide button
158  if plotname == "x_vs_z_vs_Rsum":
159  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))
160 
161  if "Rsum" in plotname and "x_vs" in plotname and not "cos" 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 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))
163 
164  if "Rsum" in plotname and "l_vs" in plotname and not "cos" 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 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))
166 
167  if "Rsumcos" in plotname and "x_vs" 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 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))
169 
170  if "Rsumcos" in plotname and "l_vs" 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 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))
172 
173  if "Rloc" in plotname and "x_vs" in plotname and not "cos" in plotname:
174  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))
175 
176  if "Rloc" in plotname and "l_vs" in plotname and not "cos" in plotname:
177  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))
178 
179  #Here again for the closing of the hide button
180  if plotname == "l_vs_z_vs_Rloc":
181  print("%ENDTWISTY%")
182 
183  """
184  I won't put the local cos plots for now, only the sum cos above
185  if "Rloccos" in plotname and "x_vs" in plotname:
186  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)
187 
188  if "Rloccos" in plotname and "l_vs" in plotname:
189  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)
190  """
191 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def TwikiPrintout(plotname, label, zoom)

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 62 of file plot_hgcal_utils.py.

◆ dEdx

◆ DETECTORS

plot_hgcal_utils.DETECTORS

Definition at line 75 of file plot_hgcal_utils.py.

◆ hist_label_to_num

plot_hgcal_utils.hist_label_to_num

Definition at line 113 of file plot_hgcal_utils.py.

◆ MatXo

plot_hgcal_utils.MatXo

Definition at line 256 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 98 of file plot_hgcal_utils.py.