ATLAS Offline Software
Loading...
Searching...
No Matches
LArG4PlottingScript.RestrictEntry Class Reference
Collaboration diagram for LArG4PlottingScript.RestrictEntry:

Public Member Functions

 __init__ (self)
 checkVar (self, value)
 __str__ (self)
 addRange (self, rang)
 addRangeAbs (self, rang)

Public Attributes

str var = ""
list rangeList = []

Detailed Description

Definition at line 109 of file LArG4PlottingScript.py.

Constructor & Destructor Documentation

◆ __init__()

LArG4PlottingScript.RestrictEntry.__init__ ( self)

Definition at line 110 of file LArG4PlottingScript.py.

110 def __init__(self) :
111 self.var = ""
112 self.rangeList = []

Member Function Documentation

◆ __str__()

LArG4PlottingScript.RestrictEntry.__str__ ( self)

Definition at line 118 of file LArG4PlottingScript.py.

118 def __str__(self) :
119 outstr = self.var+" :"
120 for rang in self.rangeList :
121 outstr+=" ["+str(rang[0])+".."+str(rang[1])+"]"
122 return outstr

◆ addRange()

LArG4PlottingScript.RestrictEntry.addRange ( self,
rang )

Definition at line 123 of file LArG4PlottingScript.py.

123 def addRange(self,rang) :
124 parsed = rang.split("..")
125 try :
126 parsed[0] = float(parsed[0])
127 except ValueError:
128 parsed[0] = -999999.9
129 try :
130 parsed[1] = float(parsed[1])
131 except ValueError:
132 parsed[1] = 9999999.9
133 self.rangeList.append(parsed[0:2])

◆ addRangeAbs()

LArG4PlottingScript.RestrictEntry.addRangeAbs ( self,
rang )

Definition at line 134 of file LArG4PlottingScript.py.

134 def addRangeAbs(self,rang) :
135 parsed = rang.split("..")
136 try :
137 parsed[0] = float(parsed[0])
138 except ValueError:
139 parsed[0] = 0.0
140 try :
141 parsed[1] = float(parsed[1])
142 except ValueError:
143 parsed[1] = 9999999.9
144 if (parsed[0] < 0) or (parsed[1] <= 0) :
145 print ("WARNING: The absolute range is not valid: less then zero. Ignore.")
146 return
147 rang = str(parsed[0])+".."+str(parsed[1])
148 rang2 = str(-parsed[1])+".."+str(-parsed[0])
149 self.addRange(rang)
150 self.addRange(rang2)
151

◆ checkVar()

LArG4PlottingScript.RestrictEntry.checkVar ( self,
value )

Definition at line 113 of file LArG4PlottingScript.py.

113 def checkVar(self,value) :
114 for rang in self.rangeList :
115 if (value >= rang[0]) and (value <= rang[1]) :
116 return True
117 return False

Member Data Documentation

◆ rangeList

list LArG4PlottingScript.RestrictEntry.rangeList = []

Definition at line 112 of file LArG4PlottingScript.py.

◆ var

str LArG4PlottingScript.RestrictEntry.var = ""

Definition at line 111 of file LArG4PlottingScript.py.


The documentation for this class was generated from the following file: