CMS 3D CMS Logo

Classes | Functions
dataLoader Namespace Reference

Classes

class  DataLoader
 

Functions

def get_data (filename)
 
def get_data_csv (csv_data)
 

Function Documentation

◆ get_data()

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().

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

◆ get_data_csv()

def dataLoader.get_data_csv (   csv_data)

Definition at line 158 of file dataLoader.py.

References createfilelist.int, and digitizers_cfi.strip.

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

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