CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
dataLoader Namespace Reference

Classes

class  DataLoader
 

Functions

def get_data
 
def get_data_csv
 

Variables

 separate_by_flav = False
 
 separate_by_op = False
 

Function Documentation

def dataLoader.get_data (   filename)

Definition at line 191 of file dataLoader.py.

References get_data_csv(), and print().

Referenced by generateFlavCfromFlavB.main(), and checkBTagCalibrationConsistency.run_check().

192 def get_data(filename):
193  with open(filename) as f:
194  csv_data = f.readlines()
195  if not (csv_data and "OperatingPoint" in csv_data[0]):
196  print("Data file does not contain typical header: %s. Exit" % filename)
197  return False
198  csv_data.pop(0) # remove header
199  return get_data_csv(csv_data)
def get_data_csv
Definition: dataLoader.py:158
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def get_data
Definition: dataLoader.py:191
def dataLoader.get_data_csv (   csv_data)

Definition at line 158 of file dataLoader.py.

References digitizers_cfi.strip.

Referenced by get_data(), and checkBTagCalibrationConsistency.run_check_csv().

159 def get_data_csv(csv_data):
160  # grab measurement types
161  meas_types = set(
162  l.split(',')[1].strip()
163  for l in csv_data
164  if len(l.split()) == 11
165  )
166 
167  # grab operating points
168  ops = set(
169  int(l.split(',')[0])
170  for l in csv_data
171  if len(l.split()) == 11
172  ) if separate_by_op else ['all']
173 
174  # grab flavors
175  flavs = set(
176  int(l.split(',')[3])
177  for l in csv_data
178  if len(l.split()) == 11
179  ) if separate_by_flav else ['all']
180 
181  # make loaders and filter empty ones
182  lds = list(
183  DataLoader(csv_data, mt, op, fl)
184  for mt in meas_types
185  for op in ops
186  for fl in flavs
187  )
188  lds = [d for d in lds if d.entries]
189  return lds
190 
def get_data_csv
Definition: dataLoader.py:158

Variable Documentation

dataLoader.separate_by_flav = False

Definition at line 17 of file dataLoader.py.

dataLoader.separate_by_op = False

Definition at line 16 of file dataLoader.py.