CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
plot_hgcal_utils Namespace Reference

Functions

def acustompalette
 
def drawHalfEtaValues
 
def TwikiPrintout
 

Variables

dictionary _LABELS2COMPS
 
tuple COMPOUNDS = OrderedDict()
 
tuple dEdx = OrderedDict()
 
tuple DETECTORS = OrderedDict()
 
tuple hist_label_to_num = OrderedDict()
 
tuple MatXo = OrderedDict()
 
dictionary plots = {}
 
tuple sDETS = OrderedDict()
 

Function Documentation

def plot_hgcal_utils.acustompalette ( )

Definition at line 189 of file plot_hgcal_utils.py.

References mps_check.array, and sistrip::SpyUtilities.range().

190 def acustompalette():
191  NRGBs = 7
192  NCont = 100
193  ncolors = array('i', [])
194  gStyle.SetNumberContours(NCont);
195  stops = [ 0.00, 0.10, 0.25, 0.45, 0.60, 0.75, 1.00 ]
196  red = [ 1.00, 0.00, 0.00, 0.00, 0.97, 0.97, 0.10 ]
197  green = [ 1.00, 0.97, 0.30, 0.40, 0.97, 0.00, 0.00 ]
198  blue = [ 1.00, 0.97, 0.97, 0.00, 0.00, 0.00, 0.00 ]
199  stopsArray = array('d', stops)
200  redArray = array('d', red)
201  greenArray = array('d', green)
202  blueArray = array('d', blue)
203  first_color_number = TColor.CreateGradientColorTable(NRGBs, stopsArray, redArray, greenArray, blueArray, NCont);
204  gStyle.SetNumberContours(NCont)
205 
206 
207  palsize = NCont
208  palette = []
209  for i in range(palsize):
210  palette.append(first_color_number+i)
211  palarray = array('i',palette)
212 
213  gStyle.SetPalette(palsize,palarray)
214 
215 
#In MeV/mm
tuple array
Definition: mps_check.py:216
const uint16_t range(const Frame &aFrame)
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 267 of file plot_hgcal_utils.py.

References funct.cos(), funct.exp(), sistrip::SpyUtilities.range(), funct.sin(), and funct.tan().

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

References print().

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

Variable Documentation

dictionary plot_hgcal_utils._LABELS2COMPS
Initial value:
1 = {'BeamPipe': 'BEAM', #There are other BEAM volumes but there are behind the region of our interest.
2  'Tracker': 'Tracker',
3  #CALOECTSFront contains both CALOECTSModerator and EndcapTimingLayer plus
4  #thermal screen but I want to split those.
5  #In V16(D86) there is no CALOECTSMiddle.
6  'EndcapTimingLayer': 'EndcapTimingLayer',
7  'Neutron Moderator + Thermal Screen' : 'CALOECTSModerator',
8  'HGCal + HGCal Service + Thermal Screen' : 'CALOECTSRear',
9  'Solenoid Magnet' : 'MGNT',
10  'Muon Wheels and Cables' : 'MB',
11  'ECAL': 'ECAL',
12  'HCal': 'HCal',
13  'FromVertexToBackOfHGCal' : ['BEAM','Tracker','ECAL','HCal','EndcapTimingLayer','CALOECTSModerator','CALOECTSRear','MGNT','MB'],
14  'HGCal': 'HGCal',
15  'HGCalEE': 'HGCalEE',
16  'HGCalHE': ['HGCalHEsil', 'HGCalHEmix']
17  }

Definition at line 37 of file plot_hgcal_utils.py.

tuple plot_hgcal_utils.COMPOUNDS = OrderedDict()

Definition at line 62 of file plot_hgcal_utils.py.

tuple plot_hgcal_utils.dEdx = OrderedDict()

Definition at line 216 of file plot_hgcal_utils.py.

Referenced by dEdxAnalyzer.analyze(), EnergyLossUpdator.computeBetheBloch(), SteppingHelixPropagator.getDeDx(), SteppingHelixPropagator.getNextState(), HLTDeDxFilter.hltFilter(), SteppingHelixPropagator.loadState(), SteppingHelixPropagator.makeAtomStep(), and oldComputeBetheBloch().

tuple plot_hgcal_utils.DETECTORS = OrderedDict()

Definition at line 75 of file plot_hgcal_utils.py.

tuple plot_hgcal_utils.hist_label_to_num = OrderedDict()

Definition at line 113 of file plot_hgcal_utils.py.

tuple plot_hgcal_utils.MatXo = OrderedDict()

Definition at line 253 of file plot_hgcal_utils.py.

dictionary plot_hgcal_utils.plots = {}

Definition at line 14 of file plot_hgcal_utils.py.

tuple plot_hgcal_utils.sDETS = OrderedDict()

Definition at line 98 of file plot_hgcal_utils.py.