CMS 3D CMS Logo

Functions
generateFlavCfromFlavB Namespace Reference

Functions

def generate_flav_c (loaded_data)
 
def main ()
 

Function Documentation

def generateFlavCfromFlavB.generate_flav_c (   loaded_data)

Definition at line 12 of file generateFlavCfromFlavB.py.

References cmsPerfStripChart.dict, and list().

Referenced by main().

12 def generate_flav_c(loaded_data):
13  flav_b_data = [e for e in loaded_data.entries if e.params.jetFlavor == 0]
14  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.operatingPoint)
15  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.measurementType)
16  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.etaMin)
17  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.ptMin)
18  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.discrMin)
19  sys_groups = itertools.groupby(
20  flav_b_data,
21  key=lambda e: '%d, %s, %.02f, %.02f, %.02f' % (
22  e.params.operatingPoint,
23  e.params.measurementType,
24  e.params.etaMin,
25  e.params.ptMin,
26  e.params.discrMin
27  )
28  )
29 
30  def gen_entry_dict(groups):
31  for _, grp in groups:
32  grp = list(grp)
33  entries_by_sys = dict((e.params.sysType, e) for e in grp)
34  assert len(grp) == len(entries_by_sys) # every sysType is unique
35  yield entries_by_sys
36  sys_dicts = gen_entry_dict(sys_groups)
37 
38  def gen_flavb_csv_line(dicts):
39  for d in dicts:
40  central = d.pop('central')
41  central.params.jetFlavor = 1
42  yield central.makeCSVLine()
43  for e in six.itervalues(d):
44  e.params.jetFlavor = 1
45  e.formula = '2*(%s)-(%s)' % (e.formula, central.formula)
46  yield e.makeCSVLine()
47  csv_lines = gen_flavb_csv_line(sys_dicts)
48 
49  return list(l for l in csv_lines)
50 
51 
def generate_flav_c(loaded_data)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def generateFlavCfromFlavB.main ( )

Definition at line 52 of file generateFlavCfromFlavB.py.

References any(), cmsRelvalreport.exit, generate_flav_c(), dataLoader.get_data(), list(), and edm.print().

52 def main():
53  if len(sys.argv) < 3:
54  print('Need input/output filenames as first/second arguments. Exit.')
55  exit(-1)
56  if os.path.exists(sys.argv[2]):
57  print('Output file exists. Exit.')
58  exit(-1)
59 
60  print('\nChecking input file consistency...')
61  loaders = dataLoader.get_data(sys.argv[1])
62  checks = checker.run_check_data(loaders, True, True, False)
63  for data in loaders:
64  typ = data.meas_type
65  if 1 in data.flavs:
66  print('FLAV_C already present in input file for %s. Exit.' % typ)
67  exit(-1)
68  if not any(0 in data.flavs for data in loaders):
69  print('FLAV_B not found in input file. Exit.')
70  exit(-1)
71 
72 
73  print('\nGenerating new csv content...')
74  new_csv_data = list(itertools.chain.from_iterable(
75  l
76  for d in loaders
77  for l in generate_flav_c(d)
78  ))
79 
80  with open(sys.argv[1]) as f:
81  old_csv_data = f.readlines()
82 
83  with open(sys.argv[2], 'w') as f:
84  f.writelines(old_csv_data)
85  f.write('\n')
86  f.writelines(new_csv_data)
87 
88  print('Done.')
89 
90 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def generate_flav_c(loaded_data)
def get_data(filename)
Definition: dataLoader.py:191
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run