ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
drawFromPickle.PadWithHits Class Reference
Inheritance diagram for drawFromPickle.PadWithHits:
Collaboration diagram for drawFromPickle.PadWithHits:

Public Member Functions

def __init__ (self, **kargs)
 
def setFont (self, font)
 
def isPivot (self)
 
def rotateVecToSec5 (self, vec)
 
def determineAvgChargeXyz (self)
 
def determineXminmax (self)
 
def determineYminmax (self)
 
def determineZminmax (self)
 
def determinePhiminmax (self)
 
def determineHminmax (self)
 
def draw (self, view='yx')
 
def drawEdges (self, color, width, view='yx')
 
def printPadCoord (self, view, line)
 
def drawCharge (self, color, view='yx')
 

Public Attributes

 cornerXyz
 
 avgChargeXyz
 
 rotatedCornerXyz
 
 rotatedAvgChargeXyz
 
 maxX
 
 maxY
 
 maxZ
 
 maxH
 
 maxPhi
 
 lineColor
 
 lineWidth
 
 font
 

Private Attributes

 _lines
 
 _labels
 
 _markers
 

Detailed Description

Definition at line 55 of file drawFromPickle.py.

Constructor & Destructor Documentation

◆ __init__()

def drawFromPickle.PadWithHits.__init__ (   self,
**  kargs 
)

Reimplemented from drawFromPickle.BaseClassFromDict.

Definition at line 56 of file drawFromPickle.py.

56  def __init__(self, **kargs) :
57  super(PadWithHits, self).__init__(**kargs)
58  self.cornerXyz = [tuple2vec(t) for t in self.cornerXyz] # convert (x,y,z) tuple to vector
59  self.avgChargeXyz = self.determineAvgChargeXyz()
60  self.rotatedCornerXyz = [self.rotateVecToSec5(v) for v in self.cornerXyz]
61  self.rotatedAvgChargeXyz = self.rotateVecToSec5(self.avgChargeXyz)
62  self.minX, self.maxX = self.determineXminmax()
63  self.minY, self.maxY = self.determineYminmax()
64  self.minZ, self.maxZ = self.determineZminmax()
65  self.minH, self.maxH = self.determineHminmax()
66  self.minPhi, self.maxPhi = self.determinePhiminmax()
67  def color(layer) : return [r.kBlack, r.kRed, r.kBlue, r.kViolet, r.kGreen][layer]
68  def width(isPivot) : return 2 if isPivot else 1
69  self.lineColor = color(self.layer)
70  self.lineWidth = width(self.isPivot())

Member Function Documentation

◆ determineAvgChargeXyz()

def drawFromPickle.PadWithHits.determineAvgChargeXyz (   self)

Definition at line 77 of file drawFromPickle.py.

77  def determineAvgChargeXyz(self) :
78  z = average([p.z() for p in self.cornerXyz]) # although the corners should be at the same z...
79  x, y = xyFromEtaPhiZ(self.avgEta, self.avgPhi, z)
80  return xyzv(x, y, z)

◆ determineHminmax()

def drawFromPickle.PadWithHits.determineHminmax (   self)

Definition at line 93 of file drawFromPickle.py.

93  def determineHminmax(self): return self.loHei, self.hiHei

◆ determinePhiminmax()

def drawFromPickle.PadWithHits.determinePhiminmax (   self)

Definition at line 90 of file drawFromPickle.py.

90  def determinePhiminmax(self):
91  phis = [p.phi() for p in self.cornerXyz]
92  return min(phis), max(phis)

◆ determineXminmax()

def drawFromPickle.PadWithHits.determineXminmax (   self)

Definition at line 81 of file drawFromPickle.py.

81  def determineXminmax(self):
82  xs = [p.x() for p in self.cornerXyz]
83  return min(xs), max(xs)

◆ determineYminmax()

def drawFromPickle.PadWithHits.determineYminmax (   self)

Definition at line 84 of file drawFromPickle.py.

84  def determineYminmax(self):
85  ys = [p.y() for p in self.cornerXyz]
86  return min(ys), max(ys)

◆ determineZminmax()

def drawFromPickle.PadWithHits.determineZminmax (   self)

Definition at line 87 of file drawFromPickle.py.

87  def determineZminmax(self):
88  zs = [p.z() for p in self.cornerXyz]
89  return min(zs), max(zs)

◆ draw()

def drawFromPickle.PadWithHits.draw (   self,
  view = 'yx' 
)

Definition at line 94 of file drawFromPickle.py.

94  def draw(self, view='yx') :
95  self.drawEdges(self.lineColor, self.lineWidth, view)
96  self.drawCharge(self.lineColor, view)

◆ drawCharge()

def drawFromPickle.PadWithHits.drawCharge (   self,
  color,
  view = 'yx' 
)

Definition at line 135 of file drawFromPickle.py.

135  def drawCharge(self, color, view='yx') :
136  v = self.rotatedAvgChargeXyz if view=='hz' else self.avgChargeXyz
137  x, y = 0., 0.
138  if view=='yx' : x, y = v.x(), v.y()
139  elif view=='hz' : x, y = v.z(), v.y()
140  elif view=='zphi' : x, y = v.phi(), v.z()
141  marker = r.TMarker(x, y, r.kMultiply)
142  marker.SetMarkerColor(color)
143  marker.Draw()
144  if hasattr(self, '_markers') : self._markers.append(marker)
145  else : self._markers = [marker]
146  def drawCloud() : print 'drawCloud not implemented yet'
147  if len(self.hitIndices)>1 : drawCloud()
148 
149 #_________________________________________________

◆ drawEdges()

def drawFromPickle.PadWithHits.drawEdges (   self,
  color,
  width,
  view = 'yx' 
)

Definition at line 97 of file drawFromPickle.py.

97  def drawEdges(self, color, width, view='yx') :
98  lineColor = color
99  lineWidth = width
100  corners = self.rotatedCornerXyz if view=='hz' else self.cornerXyz
101  segments, lines = [], []
102  # see Pad::fillCornerCoords to remember which corner is where
103  if view=='yx' : segments = [(corners[i], corners[j]) for i,j in [(0, 1), (1, 3), (2, 3), (0, 2)]]
104  elif view=='hz' : segments = [(corners[i], corners[j]) for i,j in [(0, 1)]]
105  elif view=='zphi' : segments = [(corners[i], corners[j]) for i,j in [(0, 2)]]
106  l = r.TLine
107  if view=='yx' : lines = [l(p1.x(), p1.y(), p2.x(), p2.y()) for p1,p2 in segments]
108  elif view=='hz' : lines = [l(p1.z(), p1.y(), p2.z(), p2.y()) for p1,p2 in segments]
109  elif view=='zphi' : lines = [l(p1.phi(), p1.z(), p2.phi(), p2.z()) for p1,p2 in segments]
110  for l in lines :
111  l.SetLineColor(lineColor)
112  l.SetLineWidth(lineWidth)
113  l.Draw()
114  if hasattr(self, '_lines') : self._lines.append(lines)
115  else : self._lines = lines
116  self.printPadCoord(view, lines[0])

◆ isPivot()

def drawFromPickle.PadWithHits.isPivot (   self)

Definition at line 72 of file drawFromPickle.py.

72  def isPivot(self) : return self.multiplet in [0,2] # ASM 28/04/2016 : Check that this is correct

◆ printPadCoord()

def drawFromPickle.PadWithHits.printPadCoord (   self,
  view,
  line 
)

Definition at line 117 of file drawFromPickle.py.

117  def printPadCoord(self, view, line) :
118  if view not in ['hz','zphi'] : return
119  coord = {'hz':'ieta', 'zphi':'iphi'}[view]
120  leftOrRight = self.layer%2
121  angle = 90. if view=='hz' else 0.
122  xs = sorted([line.GetX1(), line.GetX2()], reverse=leftOrRight)
123  ys = sorted([line.GetY1(), line.GetY2()], reverse=leftOrRight)
124  def outside(xx) : return xx[1] + 0.75*(xx[1]-xx[0])
125  x = average(xs) if view=='hz' else outside(xs)
126  y = average(ys) if view=='zphi' else outside(ys)
127  text = r.TLatex(x, y, "%d" % getattr(self, coord))
128  text.SetTextAlign(22)
129  text.SetTextAngle(angle)
130  text.SetTextColor(line.GetLineColor())
131  if hasattr(self, 'font') : text.SetTextFont(self.font)
132  text.Draw()
133  if hasattr(self, '_labels') : self._labels.append(text)
134  else : self._labels = [text]

◆ rotateVecToSec5()

def drawFromPickle.PadWithHits.rotateVecToSec5 (   self,
  vec 
)

Definition at line 73 of file drawFromPickle.py.

73  def rotateVecToSec5(self, vec) :
74  "Rotate a vector to sector5 coordinates (note: delta phi depends only on the sector)"
75  deltaPhi = midSectorPhi(self.sector) - midSectorPhi(5)
76  return repv(vec.rho(), vec.eta(), vec.phi()).SetPhi(vec.phi() - deltaPhi)

◆ setFont()

def drawFromPickle.PadWithHits.setFont (   self,
  font 
)

Definition at line 71 of file drawFromPickle.py.

71  def setFont(self, font) : self.font = font

Member Data Documentation

◆ _labels

drawFromPickle.PadWithHits._labels
private

Definition at line 134 of file drawFromPickle.py.

◆ _lines

drawFromPickle.PadWithHits._lines
private

Definition at line 115 of file drawFromPickle.py.

◆ _markers

drawFromPickle.PadWithHits._markers
private

Definition at line 145 of file drawFromPickle.py.

◆ avgChargeXyz

drawFromPickle.PadWithHits.avgChargeXyz

Definition at line 59 of file drawFromPickle.py.

◆ cornerXyz

drawFromPickle.PadWithHits.cornerXyz

Definition at line 58 of file drawFromPickle.py.

◆ font

drawFromPickle.PadWithHits.font

Definition at line 71 of file drawFromPickle.py.

◆ lineColor

drawFromPickle.PadWithHits.lineColor

Definition at line 69 of file drawFromPickle.py.

◆ lineWidth

drawFromPickle.PadWithHits.lineWidth

Definition at line 70 of file drawFromPickle.py.

◆ maxH

drawFromPickle.PadWithHits.maxH

Definition at line 65 of file drawFromPickle.py.

◆ maxPhi

drawFromPickle.PadWithHits.maxPhi

Definition at line 66 of file drawFromPickle.py.

◆ maxX

drawFromPickle.PadWithHits.maxX

Definition at line 62 of file drawFromPickle.py.

◆ maxY

drawFromPickle.PadWithHits.maxY

Definition at line 63 of file drawFromPickle.py.

◆ maxZ

drawFromPickle.PadWithHits.maxZ

Definition at line 64 of file drawFromPickle.py.

◆ rotatedAvgChargeXyz

drawFromPickle.PadWithHits.rotatedAvgChargeXyz

Definition at line 61 of file drawFromPickle.py.

◆ rotatedCornerXyz

drawFromPickle.PadWithHits.rotatedCornerXyz

Definition at line 60 of file drawFromPickle.py.


The documentation for this class was generated from the following file:
drawFromPickle.tuple2vec
def tuple2vec(tpl)
Definition: drawFromPickle.py:44
color
Definition: jFexInputByteStreamTool.cxx:25
max
#define max(a, b)
Definition: cfImp.cxx:41
drawFromPickle.average
def average(lst)
Definition: drawFromPickle.py:38
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
drawFromPickle.xyzv
xyzv
Definition: drawFromPickle.py:33
LArG4FSStartPointFilterLegacy.draw
draw
Definition: LArG4FSStartPointFilterLegacy.py:20
color
color
Definition: BinsDiffFromStripMedian.h:18
drawFromPickle.repv
repv
Definition: drawFromPickle.py:32
drawFromPickle.midSectorPhi
def midSectorPhi(sec)
Definition: drawFromPickle.py:37
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
min
#define min(a, b)
Definition: cfImp.cxx:40
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
Trk::outside
@ outside
Definition: PropDirection.h:29
drawFromPickle.xyFromEtaPhiZ
def xyFromEtaPhiZ(eta, phi, z)
Definition: drawFromPickle.py:40