ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
python.subdetectors.afp.TDAQC_Multi_Channel_Variable Class Reference
Inheritance diagram for python.subdetectors.afp.TDAQC_Multi_Channel_Variable:
Collaboration diagram for python.subdetectors.afp.TDAQC_Multi_Channel_Variable:

Public Member Functions

def make_good_iov (self, iov)
 
def make_good_iovs (self, iovs)
 
def __repr__ (self)
 
def read (self, query_range, query, *regex=False)
 
def calculate_good_iovs (self, lbtime, subdetector)
 

Static Public Member Functions

def timeCOOL2PBeast (timestamp)
 
def timePBeast2COOL (timestamp)
 

Public Attributes

 regex
 
 mapping
 
 force_mapping
 
 empty_value
 
 query
 
 path
 
 input_hashes
 
 subdetector
 
 iovs
 

Static Public Attributes

int TIME_RATIO = 1e3
 

Detailed Description

Definition at line 205 of file afp.py.

Member Function Documentation

◆ __repr__()

def python.subdetectors.afp.TDAQC_Variable.__repr__ (   self)
inherited

Definition at line 117 of file afp.py.

117  def __repr__(self):
118  return f"<TDAQCVariable {self.query}>"
119 

◆ calculate_good_iovs()

def python.subdetectors.afp.TDAQC_Variable.calculate_good_iovs (   self,
  lbtime,
  subdetector 
)
inherited
Calculate LB-wise "good" states

Definition at line 166 of file afp.py.

166  def calculate_good_iovs(self, lbtime, subdetector):
167  """
168  Calculate LB-wise "good" states
169  """
170 
171  self.subdetector = subdetector
172 
173  since, until = lbtime.first, lbtime.last
174  if self.timewise_folder:
175  query_range = RANGEIOV_VAL(since.since, until.until)
176  else:
177  query_range = RANGEIOV_VAL(RunLumi(since.Run, since.LumiBlock),
178  RunLumi(until.Run, until.LumiBlock))
179 
180  # Read the database
181  iovs = self.read(query_range, self.query, regex=self.regex)
182  # Decide the states of the input iovs
183  iovs = self.make_good_iovs(iovs)
184  # Apply a mapping for input channels if necessary
185  iovs = self.map_input_channels(iovs)
186 
187  if self.timewise_folder and not config.opts.timewise:
188  # we might already know the defect mapping
189  with timer("Quantize %s (%i iovs over %i lbs)" %
190  (self.query, len(iovs), len(lbtime))):
191  # Quantize to luminosity block
192  iovs = self.quantize(lbtime, iovs)
193 
194  self.iovs = iovs
195  return self
196 

◆ make_good_iov()

def python.subdetectors.afp.TDAQC_Multi_Channel_Variable.make_good_iov (   self,
  iov 
)
Determine if channels in one input iov are good.

Reimplemented from python.subdetectors.afp.TDAQC_Variable.

Reimplemented in python.subdetectors.afp.TDAQC_Array_Variable, and python.subdetectors.afp.TDAQC_Bit_Flag_Variable.

Definition at line 206 of file afp.py.

206  def make_good_iov(self, iov):
207  """
208  Determine if channels in one input iov are good.
209  """
210  giov = []
211  for channel, goodness in self.evaluator(iov):
212  current = GoodIOV(iov.since, iov.until, channel, goodness)
213  current._orig_iov = iov
214  giov.append(current)
215  return giov
216 

◆ make_good_iovs()

def python.subdetectors.afp.TDAQC_Multi_Channel_Variable.make_good_iovs (   self,
  iovs 
)
Determine whether each iov signifies a good or bad state.

Definition at line 217 of file afp.py.

217  def make_good_iovs(self, iovs):
218  """
219  Determine whether each iov signifies a good or bad state.
220  """
221  results = []
222  for iov in iovs:
223  results.append(self.make_good_iov(iov))
224  return IOVSet(sum(zip(*results), ())) # Sort by channel first
225 

◆ read()

def python.subdetectors.afp.TDAQC_Variable.read (   self,
  query_range,
  query,
regex = False 
)
inherited
Read the relevant data from pBeast for this variable, and convert them to COOL-like format

Definition at line 120 of file afp.py.

120  def read(self, query_range, query, *, regex=False):
121  """
122  Read the relevant data from pBeast for this variable, and convert them to COOL-like format
123  """
124  partition, className, attribute, path = query.split('.', 3)
125 
126  log.info(f"Querying pBeast object{'s using regex' if regex else ''} {query}")
127 
128  since, until = query_range
129  since, until = TDAQC_Variable.timeCOOL2PBeast(since), TDAQC_Variable.timeCOOL2PBeast(until)
130 
131  query_data = pbeast.get_data(partition, className, attribute, path, regex, since, until)
132  data = dict.fromkeys(self.mapping.keys()) if self.force_mapping else dict()
133  if query_data:
134  data.update(query_data[0].data)
135 
136  def instantiate(since, until, channel, value):
137  if isinstance(value, list):
138  value = tuple(value)
139  return PBeastIOV(TDAQC_Variable.timePBeast2COOL(since), TDAQC_Variable.timePBeast2COOL(until), channel, value)
140 
141  iovs = []
142  for channel, entries in data.items():
143  if not entries:
144  iovs.append(PBeastIOV(*query_range, channel, self.empty_value))
145  continue
146  first = entries[0]
147  since = first.ts
148  value = first.value
149  for point in entries:
150  if point.value == value:
151  continue
152  iovs.append(instantiate(since, point.ts, channel, value))
153  since = point.ts
154  value = point.value
155  last = entries[-1]
156  iovs.append(instantiate(since, last.ts, channel, value))
157  iovs = IOVSet(iovs, iov_type=PBeastIOV, origin=query)
158 
159  if log.isEnabledFor(logging.INFO):
160  input_hash = hash(iovs)
161  self.input_hashes.append(input_hash)
162  log.info(" -> Input hash: % 09x (len=%i)", input_hash, len(iovs))
163 
164  return iovs
165 

◆ timeCOOL2PBeast()

def python.subdetectors.afp.TDAQC_Variable.timeCOOL2PBeast (   timestamp)
staticinherited

Definition at line 100 of file afp.py.

100  def timeCOOL2PBeast(timestamp):
101  return int(timestamp/TDAQC_Variable.TIME_RATIO)
102 

◆ timePBeast2COOL()

def python.subdetectors.afp.TDAQC_Variable.timePBeast2COOL (   timestamp)
staticinherited

Definition at line 104 of file afp.py.

104  def timePBeast2COOL(timestamp):
105  return TimestampType(timestamp*TDAQC_Variable.TIME_RATIO)
106 

Member Data Documentation

◆ empty_value

python.subdetectors.afp.TDAQC_Variable.empty_value
inherited

Definition at line 112 of file afp.py.

◆ force_mapping

python.subdetectors.afp.TDAQC_Variable.force_mapping
inherited

Definition at line 111 of file afp.py.

◆ input_hashes

python.subdetectors.afp.TDAQC_Variable.input_hashes
inherited

Definition at line 115 of file afp.py.

◆ iovs

python.subdetectors.afp.TDAQC_Variable.iovs
inherited

Definition at line 194 of file afp.py.

◆ mapping

python.subdetectors.afp.TDAQC_Variable.mapping
inherited

Definition at line 110 of file afp.py.

◆ path

python.subdetectors.afp.TDAQC_Variable.path
inherited

Definition at line 114 of file afp.py.

◆ query

python.subdetectors.afp.TDAQC_Variable.query
inherited

Definition at line 113 of file afp.py.

◆ regex

python.subdetectors.afp.TDAQC_Variable.regex
inherited

Definition at line 109 of file afp.py.

◆ subdetector

python.subdetectors.afp.TDAQC_Variable.subdetector
inherited

Definition at line 171 of file afp.py.

◆ TIME_RATIO

int python.subdetectors.afp.TDAQC_Variable.TIME_RATIO = 1e3
staticinherited

Definition at line 97 of file afp.py.


The documentation for this class was generated from the following file:
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.sugar.iovtype.RANGEIOV_VAL
def RANGEIOV_VAL()
Definition: iovtype.py:153
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
python.variable.GoodIOV
def GoodIOV(channel, good)
Definition: variable.py:18
python.sugar.runlumi.RunLumi
RunLumi
Definition: runlumi.py:131
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
python.subdetectors.afp.PBeastIOV
def PBeastIOV(channel, value)
Definition: afp.py:90
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790