CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
TH2PolyOfflineMaps.TH2PolyOfflineMaps Class Reference

Public Member Functions

def __del__ (self)
 
def __init__ (self, inputDQMName, outputDirName, minMaxFileName, limits, modDicName, runNumber, dirs, dirsAliases)
 
def DumpData (self)
 
def PrintTrackerMaps (self)
 
def ReadHistograms (self)
 

Public Attributes

 availableNames
 
 detDict
 
 detIDsFileName
 
 dirs
 
 dirsAliases
 
 geometryFilenames
 
 groupedHistograms
 
 inputFile
 
 inputFileName
 
 internalData
 
 limits
 
 limitsDic
 CREATE LIMITS DICTIONARY. More...
 
 listOfNumHistograms
 
 maxBladeToRing
 
 maxLadderToLayer
 
 minMaxFileName
 
 outputDirName
 
 rawToOnlineDict
 
 runNumber
 

Private Member Functions

def __AddNamedBins (self, geoFile, tX, tY, sX, sY, applyModuleRotation=False)
 
def __BuildOnlineBarrelName (self, signedModule, signedLadder, layer)
 
def __BuildOnlineDiskName (self, signedDisk, signedBlade, panel, ring)
 
def __CreateTrackerBaseMap (self)
 
def __GetBarrelSector (self, layer, signedLadder, signedModule)
 
def __GetPartStr (self, isXlowerThanZero, isYlowerThanZero)
 
def __GroupHistograms (self)
 
def __TraverseDirTree (self, dir)
 LOTS OF CODE BORROWED FROM: PYTHONBINREADER, PIXELTRACKERMAP. More...
 

Private Attributes

 __BaseTrackerMap
 

Detailed Description

Definition at line 61 of file TH2PolyOfflineMaps.py.

Constructor & Destructor Documentation

def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__init__ (   self,
  inputDQMName,
  outputDirName,
  minMaxFileName,
  limits,
  modDicName,
  runNumber,
  dirs,
  dirsAliases 
)

Definition at line 268 of file TH2PolyOfflineMaps.py.

268  def __init__(self, inputDQMName, outputDirName, minMaxFileName, limits, modDicName, runNumber, dirs, dirsAliases):
269 # def __init__(self, inputDQMName, outputDirName, minMaxFileName, limitsFileName, modDicName, runNumber, dirs, dirsAliases):
270  self.inputFileName = inputDQMName
271  self.outputDirName = outputDirName
272  self.minMaxFileName = minMaxFileName
273 # self.limitsFileName = limitsFileName
274  self.detIDsFileName = modDicName
275  self.limits = limits
276 
277  self.runNumber = runNumber
278  self.dirs = dirs
279  self.dirsAliases = dirsAliases
280 
281  self.inputFile = TFile(self.inputFileName)
283  self.availableNames = []
284 
285  self.maxLadderToLayer = {6:1, 14:2, 22:3, 32:4}
286  self.maxBladeToRing = {11:1, 17:2}
287 
289  for i in range(maxPxBarrel):
290  self.geometryFilenames.append(getFileInPath("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_" + str(i + 1)))
291 # self.geometryFilenames.append("DATA/Geometry/vertices_barrel_" + str(i + 1))
292  for i in range(-maxPxForward, maxPxForward + 1):
293  if i == 0:
294  continue #there is no 0 disk
295  self.geometryFilenames.append(getFileInPath("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_" + str(i)))
296 # self.geometryFilenames.append("DATA/Geometry/vertices_forward_" + str(i))
297 
298  self.internalData = {}
299 
300  if self.inputFile.IsOpen():
301  print("%s opened successfully!" % (self.inputFileName))
302  #Get all neeeded histograms
303  for dir in self.dirs:
304  self.__TraverseDirTree(self.inputFile.Get(dir))
305  # print("Histograms to read %d" % (len(self.listOfNumHistograms)))
306 
307  self.detDict = {}
308 
309  with open(self.detIDsFileName, "r") as detIDs: # create dictionary online -> rawid
310  for entry in detIDs:
311  items = entry.replace("\n", " ").split(" ")
312  self.detDict.update({items[1] : int(items[0])})
313  # init internal data structure
314  self.internalData.update({int(items[0]) : {}})
315 
316  self.rawToOnlineDict = dict((v,k) for k,v in six.iteritems(self.detDict))
317 
318  self.__GroupHistograms()
319 
321 
322  else:
323  print("Unable to open file %s" % (self.inputFileName))
324 
325  ### CREATE LIMITS DICTIONARY
326 
327  self.limitsDic = {}
328  for y in limits:
329 
330  lineSpl = y.strip().split(" ")
331 
332  if len(lineSpl) < 5:
333  continue
334 
335  currName = lineSpl[0]
336  zMin = float(lineSpl[1])
337  zMax = float(lineSpl[2])
338  isLog = False if lineSpl[3] == "0" else True
339  isAbs = False if lineSpl[4] == "0" else True
340 
341  self.limitsDic.update({currName : {"zMin" : zMin, "zMax" : zMax, "isLog" : isLog, "isAbs" : isAbs}})
def __TraverseDirTree(self, dir)
LOTS OF CODE BORROWED FROM: PYTHONBINREADER, PIXELTRACKERMAP.
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def __init__(self, inputDQMName, outputDirName, minMaxFileName, limits, modDicName, runNumber, dirs, dirsAliases)
#define str(s)
double split
Definition: MVATrainer.cc:139
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__del__ (   self)

Definition at line 529 of file TH2PolyOfflineMaps.py.

References createfilelist.int, and edm.print().

529  def __del__(self):
530  if self.inputFile.IsOpen():
531  self.inputFile.Close()
532 
533 #--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--

Member Function Documentation

def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__AddNamedBins (   self,
  geoFile,
  tX,
  tY,
  sX,
  sY,
  applyModuleRotation = False 
)
private

Definition at line 191 of file TH2PolyOfflineMaps.py.

References mps_check.array, objects.autophobj.float, and split.

191  def __AddNamedBins(self, geoFile, tX, tY, sX, sY, applyModuleRotation = False):
192 
193  for line in geoFile:
194  lineSpl = line.strip().split("\"")
195 
196  detId = lineSpl[0].split(" ")[0]
197 
198  vertices = lineSpl[1]
199  xy = vertices.split(" ")
200  x, y = array('d'), array('d')
201  verNum = 1
202  for coord in xy:
203  coordSpl = coord.split(",")
204  if applyModuleRotation:
205  x.append(-(float(coordSpl[0]) * sX + tX))
206  y.append((float(coordSpl[1]) * sY + tY))
207  else:
208  x.append(float(coordSpl[0]) * sX + tX)
209  y.append(float(coordSpl[1]) * sY + tY)
210  verNum = verNum + 1
211  #close polygon
212  x.append(x[0])
213  y.append(y[0])
214 
215  # print(detId, vertices)
216  # print(x)
217  # print(y)
218  if applyModuleRotation:
219  bin = TGraph(verNum, y, x)
220  else:
221  bin = TGraph(verNum, x, y)
222  # bin = TGraph(verNum, y, x) # rotation by 90 deg (so that it had the same layout as for the strips)
223  bin.SetName(detId)
224 
225  self.__BaseTrackerMap.AddBin(bin)
226 
def __AddNamedBins(self, geoFile, tX, tY, sX, sY, applyModuleRotation=False)
double split
Definition: MVATrainer.cc:139
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BuildOnlineBarrelName (   self,
  signedModule,
  signedLadder,
  layer 
)
private

Definition at line 163 of file TH2PolyOfflineMaps.py.

References PhaseITreeProducer.ModuleLvlValuesReader.__GetBarrelSector(), TH2PolyOfflineMaps.TH2PolyOfflineMaps.__GetBarrelSector(), PhaseITreeProducer.ModuleLvlValuesReader.__GetPartStr(), TH2PolyOfflineMaps.TH2PolyOfflineMaps.__GetPartStr(), funct.abs(), and str.

Referenced by TH2PolyOfflineMaps.TH2PolyOfflineMaps.ReadHistograms().

163  def __BuildOnlineBarrelName(self, signedModule, signedLadder, layer): #in Phase1 it is assumed that there are only full modules
164  thePart = self.__GetPartStr(signedModule < 0, signedLadder < 0)
165  theSector = str(self.__GetBarrelSector(layer, signedLadder, signedModule))
166  return "BPix_B" + thePart + "_SEC" + theSector + "_LYR" + str(layer) + "_LDR" + str(abs(signedLadder)) + "F_MOD" + str(abs(signedModule))
167 
def __GetBarrelSector(self, layer, signedLadder, signedModule)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def __GetPartStr(self, isXlowerThanZero, isYlowerThanZero)
def __BuildOnlineBarrelName(self, signedModule, signedLadder, layer)
#define str(s)
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BuildOnlineDiskName (   self,
  signedDisk,
  signedBlade,
  panel,
  ring 
)
private

Definition at line 168 of file TH2PolyOfflineMaps.py.

References PhaseITreeProducer.ModuleLvlValuesReader.__GetPartStr(), TH2PolyOfflineMaps.TH2PolyOfflineMaps.__GetPartStr(), funct.abs(), and str.

Referenced by TH2PolyOfflineMaps.TH2PolyOfflineMaps.ReadHistograms().

168  def __BuildOnlineDiskName(self, signedDisk, signedBlade, panel, ring):
169  thePart = self.__GetPartStr(signedDisk < 0, signedBlade < 0)
170  return "FPix_B" + thePart + "_D" + str(abs(signedDisk)) + "_BLD" + str(abs(signedBlade)) + "_PNL" + str(panel) + "_RNG" + str(ring)
171 
def __BuildOnlineDiskName(self, signedDisk, signedBlade, panel, ring)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def __GetPartStr(self, isXlowerThanZero, isYlowerThanZero)
#define str(s)
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__CreateTrackerBaseMap (   self)
private

Definition at line 227 of file TH2PolyOfflineMaps.py.

228 
229  self.__BaseTrackerMap = TH2Poly("Summary", "", -10, 160, -70, 70)
230  # self.__BaseTrackerMap = TH2Poly("Summary", "Tracker Map", 0, 0, 0, 0)
231  self.__BaseTrackerMap.SetFloat(1)
232  self.__BaseTrackerMap.GetXaxis().SetTitle("")
233  self.__BaseTrackerMap.GetYaxis().SetTitle("")
234  self.__BaseTrackerMap.SetOption("COLZ L")
235  self.__BaseTrackerMap.SetStats(0)
236 
237  # BARREL FIRST
238  for i in range(maxPxBarrel):
239  with open(self.geometryFilenames[i], "r") as geoFile:
240  currBarrelTranslateX = 0
241  currBarrelTranslateY = barrelLadderShift[i]
242 
243  self.__AddNamedBins(geoFile, currBarrelTranslateX, currBarrelTranslateY, 1, 1, True)
244 
245  # break # debug only 1st layer
246 
247  # MINUS FORWARD
248  for i in range(-maxPxForward, 0):
249  with open(self.geometryFilenames[maxPxBarrel + maxPxForward + i], "r") as geoFile:
250  currForwardTranslateX = forwardDiskXShift[-i - 1]
251  currForwardTranslateY = -forwardDiskYShift
252 
253  self.__AddNamedBins(geoFile, currForwardTranslateX, currForwardTranslateY, 1, 1)
254 
255  # PLUS FORWARD
256  for i in range(maxPxForward):
257  with open(self.geometryFilenames[maxPxBarrel + maxPxForward + i], "r") as geoFile:
258  currForwardTranslateX = forwardDiskXShift[i]
259  currForwardTranslateY = forwardDiskYShift
260 
261  self.__AddNamedBins(geoFile, currForwardTranslateX, currForwardTranslateY, 1, 1)
262 
263  # self.__BaseTrackerMap.Fill("305139728", 2)
264 
265  print("Base Tracker Map: constructed")
266 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def __AddNamedBins(self, geoFile, tX, tY, sX, sY, applyModuleRotation=False)
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__GetBarrelSector (   self,
  layer,
  signedLadder,
  signedModule 
)
private

Definition at line 107 of file TH2PolyOfflineMaps.py.

References funct.abs().

Referenced by TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BuildOnlineBarrelName().

107  def __GetBarrelSector(self, layer, signedLadder, signedModule): #adapted from PixelBarrelName
108  theLadder = abs(signedLadder)
109  theModule = abs(signedModule)
110 
111  sector = 0
112 
113  if layer == 1:
114 
115  if theLadder == 1:
116  if theModule >= 2:
117  return 1
118  else:
119  return 2
120  if theLadder == 2:
121  if theModule >= 3:
122  return 2
123  else:
124  return 3
125  if theLadder == 3:
126  if theModule >= 4:
127  return 3
128  else:
129  return 4
130  if theLadder == 4:
131  if theModule >= 2:
132  return 5
133  else:
134  return 6
135  if theLadder == 5:
136  if theModule >= 3:
137  return 6
138  else:
139  return 7
140  if theLadder == 6:
141  if theModule >= 4:
142  return 7
143  else:
144  return 8
145  # here is used simplified form of assignment, see source file for reference
146  elif layer == 2:
147  i = theLadder // 5
148  sector = i * 3
149  shortLadder = theLadder - 5 * i
150  for i in range(0, shortLadder, 2):
151  sector = sector + 1
152  return sector
153  elif layer == 3:
154  sector = 1
155  for i in range(2, theLadder, 3):
156  if (i + 1) % 3 == 0:
157  sector = sector + 1
158  return sector
159  elif layer == 4:
160  sector = (theLadder + 3) // 4
161  return sector
162 
def __GetBarrelSector(self, layer, signedLadder, signedModule)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__GetPartStr (   self,
  isXlowerThanZero,
  isYlowerThanZero 
)
private

Definition at line 97 of file TH2PolyOfflineMaps.py.

Referenced by TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BuildOnlineBarrelName(), and TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BuildOnlineDiskName().

97  def __GetPartStr(self, isXlowerThanZero, isYlowerThanZero):
98  if isXlowerThanZero and isYlowerThanZero:
99  return "mO"
100  if isXlowerThanZero and isYlowerThanZero == False:
101  return "mI"
102  if isXlowerThanZero == False and isYlowerThanZero:
103  return "pO"
104  if isXlowerThanZero == False and isYlowerThanZero == False:
105  return "pI"
106 
def __GetPartStr(self, isXlowerThanZero, isYlowerThanZero)
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__GroupHistograms (   self)
private

Definition at line 172 of file TH2PolyOfflineMaps.py.

172  def __GroupHistograms(self):
173  currentGroupName = ""
174  groupOfHists = []
176 
177  ##### GROUP ALL LAYERS/RINGS HAVING SIMILAR INFORMATION
178  for obj in self.listOfNumHistograms:
179  objName = obj.GetName()
180  objNameSplit = objName.split("_")
181  objNameCollected = ''.join(objNameSplit[0:-1])
182  if objNameCollected != currentGroupName:
183  if len(groupOfHists):
184  self.groupedHistograms.append(groupOfHists)
185  groupOfHists = []
186 
187  currentGroupName = objNameCollected
188  groupOfHists.append(obj)
189  self.groupedHistograms.append(groupOfHists) #the last group
190 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.__TraverseDirTree (   self,
  dir 
)
private

LOTS OF CODE BORROWED FROM: PYTHONBINREADER, PIXELTRACKERMAP.

Definition at line 69 of file TH2PolyOfflineMaps.py.

References InefficientDoubleROC.InefficientDeadROCs.__TraverseDirTree(), PhaseITreeProducer.ModuleLvlValuesReader.__TraverseDirTree(), TH2PolyOfflineMaps.TH2PolyOfflineMaps.__TraverseDirTree(), InefficientDoubleROC.InefficientDeadROCs.dirs, PhaseITreeProducer.ModuleLvlValuesReader.dirs, TH2PolyOfflineMaps.TH2PolyOfflineMaps.dirs, PhaseITreeProducer.ModuleLvlValuesReader.dirsAliases, TH2PolyOfflineMaps.TH2PolyOfflineMaps.dirsAliases, join(), edm.print(), and split.

Referenced by TH2PolyOfflineMaps.TH2PolyOfflineMaps.__TraverseDirTree().

69  def __TraverseDirTree(self, dir):
70 
71  try:
72  currPath = (dir.GetPath().split(":/"))[1]
73  except:
74  print("Exception raised: Path not found in the input file")
75  return
76 
77  for obj in dir.GetListOfKeys():
78  if not obj.IsFolder():
79  if obj.ReadObjectAny(TClass.GetClass("TH2")):
80  th2 = deepcopy(obj.ReadObj())
81  name = th2.GetName()
82  if 6 < th2.GetNbinsX() < 10 and name.find("per") != -1 and name.find("Lumisection") == -1: #take only module lvl plots
83  print(''.join([dir.GetPath(), '/', name]))
84 
85  # fix when there are plots starting with the same strings in different directories
86  prefix = ""
87  for i in self.dirs:
88  if currPath.startswith(i):
89  prefix = self.dirsAliases[i]
90  break
91  # print(currPath, prefix)
92  th2.SetName(prefix + th2.GetName())
93  self.listOfNumHistograms.append(th2)
94  else:
95  self.__TraverseDirTree(obj.ReadObj())
96 
def __TraverseDirTree(self, dir)
LOTS OF CODE BORROWED FROM: PYTHONBINREADER, PIXELTRACKERMAP.
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.DumpData (   self)

Definition at line 389 of file TH2PolyOfflineMaps.py.

References PhaseITreeProducer.ModuleLvlValuesReader.availableNames, TH2PolyOfflineMaps.TH2PolyOfflineMaps.availableNames, PhaseITreeProducer.ModuleLvlValuesReader.internalData, TH2PolyOfflineMaps.TH2PolyOfflineMaps.internalData, and edm.print().

389  def DumpData(self):
390  for key in self.internalData:
391  print("#"*20)
392  print(key)
393  module = self.internalData[key]
394  for d in module:
395  print((d, module[d]))
396 
397  print(len(self.internalData))
398 
399  for i in self.availableNames:
400  print(i)
401  print(len(self.availableNames))
402 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.PrintTrackerMaps (   self)

Definition at line 403 of file TH2PolyOfflineMaps.py.

References TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BaseTrackerMap, funct.abs(), PhaseITreeProducer.ModuleLvlValuesReader.internalData, TH2PolyOfflineMaps.TH2PolyOfflineMaps.internalData, relativeConstraints.keys, TH2PolyOfflineMaps.TH2PolyOfflineMaps.limitsDic, TH2PolyOfflineMaps.TH2PolyOfflineMaps.minMaxFileName, TH2PolyOfflineMaps.TH2PolyOfflineMaps.outputDirName, edm.print(), TH2PolyOfflineMaps.TH2PolyOfflineMaps.rawToOnlineDict, tcds::Header_v1.runNumber, hcalCalib.runNumber, PUDumper.runNumber, DTStatusFlagHandler.runNumber, DTT0Handler.runNumber, DTTPGParametersHandler.runNumber, DTDeadFlagHandler.runNumber, DTReadOutMappingHandler.runNumber, DTPerformanceHandler.runNumber, DTRangeT0Handler.runNumber, Vx3DHLTAnalyzer.runNumber, ValidIsoTrkCalib.runNumber, TH2PolyOfflineMaps.TH2PolyOfflineMaps.runNumber, and str.

403  def PrintTrackerMaps(self):
404  monitoredValues = []
405  gStyle.SetPalette(1)
406  for key in self.internalData:
407  monitoredValues = self.internalData[key].keys()
408  # print(monitoredValues)
409  break
410 
411  if os.path.exists(self.outputDirName) == False: # check whether directory exists
412  os.system("mkdir " + self.outputDirName)
413 
414  with open(self.outputDirName + self.minMaxFileName, "w") as minMaxFile:
415 
416  for mv in monitoredValues:
417  currentHist = deepcopy(self.__BaseTrackerMap)
418  # currentHist.SetTitle("Run " + self.runNumber + ": Tracker Map for " + mv) // to make it compatible between ROOT v.
419  histoTitle = "Run " + self.runNumber + ": Tracker Map for " + mv
420 
421  applyLogScale = False
422  applyAbsValue = False
423  if mv in self.limitsDic:
424  limitsElem = self.limitsDic[mv]
425 
426  print(mv + " found in limits dictionary - applying custom limits...")
427 
428  currentHist.SetMinimum(limitsElem["zMin"])
429  currentHist.SetMaximum(limitsElem["zMax"])
430  applyLogScale = limitsElem["isLog"]
431  applyAbsValue = limitsElem["isAbs"]
432 
433  listOfVals = []
434  onlineName = ""
435  for detId in self.internalData:
436  val = (self.internalData[detId])[mv]
437  onlineName = self.rawToOnlineDict[detId]
438  listOfVals.append([val, detId, onlineName])
439  if applyAbsValue:
440  currentHist.Fill(str(detId), abs(val))
441  else:
442  currentHist.Fill(str(detId), val)
443 
444  listOfVals = sorted(listOfVals, key = lambda item: item[0])
445 
446  minMaxFile.write("\n" + mv + "\n\n")
447 
448  minMaxFile.write("MIN:\n")
449  for i in range(extremeBinsNum):
450  minMaxFile.write("\t" + str(listOfVals[i][1]) + " " + str(listOfVals[i][2]) + " " + str(listOfVals[i][0]) + "\n")
451 
452  minMaxFile.write("MAX:\n")
453  for i in range(extremeBinsNum):
454  minMaxFile.write("\t" + str(listOfVals[-i - 1][1]) + " " + str(listOfVals[-i - 1][2]) + " " + str(listOfVals[-i - 1][0]) + "\n")
455 
456  c1 = TCanvas(mv, mv, plotWidth , plotHeight)
457 
458  if applyLogScale:
459  c1.SetLogz()
460 
461 
462 
463  currentHist.Draw("AC COLZ L")
464 
465  gPad.Update()
466  palette = currentHist.FindObject("palette");
467  palette.SetX1NDC(0.89);
468  palette.SetX2NDC(0.91);
469  palette.SetLabelSize(0.05);
470  gPad.Update()
471 
472 
473 
474  ### IMPORTANT - REALTIVE POSITIONING IS MESSY IN CURRENT VERION OF PYROOT
475  ### IT CAN CHANGE FROM VERSION TO VERSION, SO YOU HAVE TO ADJUST IT FOR YOUR NEEDS
476  ### !!!!!!!!!!!!!
477 
478  # draw axes (z, phi -> BARREL; x, y -> FORWARD)
479  ###################################################
480 
481  ### z arrow
482  arrow = TArrow(0.05, 27.0, 0.05, -30.0, 0.02, "|>")
483  arrow.SetLineWidth(4)
484  arrow.Draw()
485  ### phi arrow
486  phiArrow = TArrow(0.0, 27.0, 30.0, 27.0, 0.02, "|>")
487  phiArrow.SetLineWidth(4)
488  phiArrow.Draw()
489  ### x arror
490  xArrow = TArrow(25.0, 44.5, 50.0, 44.5, 0.02, "|>")
491  xArrow.SetLineWidth(4)
492  xArrow.Draw()
493  ### y arror
494  yArrow = TArrow(25.0, 44.5, 25.0, 69.5, 0.02, "|>")
495  yArrow.SetLineWidth(4)
496  yArrow.Draw()
497 
498  ###################################################
499 
500  # add some captions
501  txt = TLatex()
502  txt.SetNDC()
503  txt.SetTextFont(1)
504  txt.SetTextColor(1)
505  txt.SetTextAlign(22)
506  txt.SetTextAngle(0)
507 
508  # draw new-style title
509  txt.SetTextSize(0.05)
510  txt.DrawLatex(0.5, 0.95, histoTitle)
511 
512  txt.SetTextSize(0.03)
513 
514  txt.DrawLatex(0.5, 0.125, "-DISK")
515  txt.DrawLatex(0.5, 0.075, "NUMBER ->")
516  txt.DrawLatex(0.5, 0.875, "+DISK")
517 
518  txt.DrawLatex(0.17, 0.35, "+z")
519  txt.DrawLatexNDC(0.36, 0.685, "+phi") # WAY TO FORCE IT TO DRAW LATEX CORRECTLY NOT FOUND ('#' DOESN'T WORK)
520  txt.DrawLatex(0.38, 0.73, "+x")
521  txt.DrawLatex(0.26, 0.875, "+y")
522 
523  txt.SetTextAngle(90)
524  txt.DrawLatex(0.17, 0.5, "BARREL")
525 
526  #save to the png
527  c1.Print(self.outputDirName + mv + ".png")
528 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define str(s)
def TH2PolyOfflineMaps.TH2PolyOfflineMaps.ReadHistograms (   self)

Definition at line 344 of file TH2PolyOfflineMaps.py.

References PhaseITreeProducer.ModuleLvlValuesReader.__BuildOnlineBarrelName(), TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BuildOnlineBarrelName(), PhaseITreeProducer.ModuleLvlValuesReader.__BuildOnlineDiskName(), TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BuildOnlineDiskName(), InefficientDoubleROC.InefficientDeadROCs.detDict, PhaseITreeProducer.ModuleLvlValuesReader.detDict, TH2PolyOfflineMaps.TH2PolyOfflineMaps.detDict, PhaseITreeProducer.ModuleLvlValuesReader.groupedHistograms, TH2PolyOfflineMaps.TH2PolyOfflineMaps.groupedHistograms, createfilelist.int, PhaseITreeProducer.ModuleLvlValuesReader.internalData, TH2PolyOfflineMaps.TH2PolyOfflineMaps.internalData, join(), PhaseITreeProducer.ModuleLvlValuesReader.maxBladeToRing, TH2PolyOfflineMaps.TH2PolyOfflineMaps.maxBladeToRing, PhaseITreeProducer.ModuleLvlValuesReader.maxLadderToLayer, TH2PolyOfflineMaps.TH2PolyOfflineMaps.maxLadderToLayer, edm.print(), split, and update.

344  def ReadHistograms(self):
345  if self.inputFile.IsOpen():
346  for group in self.groupedHistograms:
347  # name = ''.join(group[0].GetName().split("_")[0:-1])
348  if len(group) == 0:
349  return
350  print(group[0].GetName())
351  name = ''.join(group[0].GetName().split("_per_")[0])
352  self.availableNames.append(name)
353  # print(name)
354  for obj in group:
355  nbinsX = obj.GetNbinsX()
356  nbinsY = obj.GetNbinsY()
357 
358  if nbinsX == 9: # BARREL
359  maxX = nbinsX // 2
360  maxY = nbinsY // 2
361 
362  for x in range(-maxX, maxX + 1):
363  if x == 0:
364  continue
365  for y in range(-maxY, maxY + 1, 1):
366  if y == 0:
367  continue
368  onlineName = self.__BuildOnlineBarrelName(x, y, self.maxLadderToLayer[maxY])
369  self.internalData[self.detDict[onlineName]].update({name : obj.GetBinContent(x + maxX + 1, y + maxY + 1)})
370 
371  elif nbinsX == 7: # FORWARD
372  maxX = nbinsX // 2
373  maxY = nbinsY // 4
374 
375  for x in range(-maxX, maxX + 1):
376  if x == 0:
377  continue
378  for y in range(-maxY, maxY + 1):
379  if int(y) == 0:
380  continue
381  for panel in range(1, 3):
382  onlineName = self.__BuildOnlineDiskName(x, y, panel, self.maxBladeToRing[maxY])
383  self.internalData[self.detDict[onlineName]].update({name : obj.GetBinContent(x + maxX + 1, (y + maxY) * 2 + (3-panel))})
384  else:
385  print("Unrecognized plot")
386  else:
387  print("Histograms saved to internal data structure")
388 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def __BuildOnlineDiskName(self, signedDisk, signedBlade, panel, ring)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def __BuildOnlineBarrelName(self, signedModule, signedLadder, layer)
#define update(a, b)
double split
Definition: MVATrainer.cc:139

Member Data Documentation

TH2PolyOfflineMaps.TH2PolyOfflineMaps.__BaseTrackerMap
private
TH2PolyOfflineMaps.TH2PolyOfflineMaps.availableNames
TH2PolyOfflineMaps.TH2PolyOfflineMaps.detDict
TH2PolyOfflineMaps.TH2PolyOfflineMaps.detIDsFileName

Definition at line 274 of file TH2PolyOfflineMaps.py.

TH2PolyOfflineMaps.TH2PolyOfflineMaps.dirs
TH2PolyOfflineMaps.TH2PolyOfflineMaps.dirsAliases
TH2PolyOfflineMaps.TH2PolyOfflineMaps.geometryFilenames

Definition at line 288 of file TH2PolyOfflineMaps.py.

TH2PolyOfflineMaps.TH2PolyOfflineMaps.groupedHistograms
TH2PolyOfflineMaps.TH2PolyOfflineMaps.inputFile

Definition at line 281 of file TH2PolyOfflineMaps.py.

TH2PolyOfflineMaps.TH2PolyOfflineMaps.inputFileName

Definition at line 270 of file TH2PolyOfflineMaps.py.

TH2PolyOfflineMaps.TH2PolyOfflineMaps.internalData
TH2PolyOfflineMaps.TH2PolyOfflineMaps.limits

Definition at line 275 of file TH2PolyOfflineMaps.py.

TH2PolyOfflineMaps.TH2PolyOfflineMaps.limitsDic

CREATE LIMITS DICTIONARY.

Definition at line 327 of file TH2PolyOfflineMaps.py.

Referenced by TH2PolyOfflineMaps.TH2PolyOfflineMaps.PrintTrackerMaps().

TH2PolyOfflineMaps.TH2PolyOfflineMaps.listOfNumHistograms

Definition at line 282 of file TH2PolyOfflineMaps.py.

TH2PolyOfflineMaps.TH2PolyOfflineMaps.maxBladeToRing
TH2PolyOfflineMaps.TH2PolyOfflineMaps.maxLadderToLayer
TH2PolyOfflineMaps.TH2PolyOfflineMaps.minMaxFileName
TH2PolyOfflineMaps.TH2PolyOfflineMaps.outputDirName
TH2PolyOfflineMaps.TH2PolyOfflineMaps.rawToOnlineDict
TH2PolyOfflineMaps.TH2PolyOfflineMaps.runNumber