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

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

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

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

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

References print().

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

Referenced by dEdxAnalyzer.analyze(), mkfit.applyMaterialEffects(), 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 256 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.