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 10 of file generateFlavCfromFlavB.py.

References cmsPerfStripChart.dict, ALCARECOTkAlBeamHalo_cff.filter, and list().

Referenced by main().

10 def generate_flav_c(loaded_data):
11  flav_b_data = filter(
12  lambda e: e.params.jetFlavor == 0,
13  loaded_data.entries
14  )
15  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.operatingPoint)
16  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.measurementType)
17  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.etaMin)
18  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.ptMin)
19  flav_b_data = sorted(flav_b_data, key=lambda e: e.params.discrMin)
20  sys_groups = itertools.groupby(
21  flav_b_data,
22  key=lambda e: '%d, %s, %.02f, %.02f, %.02f' % (
23  e.params.operatingPoint,
24  e.params.measurementType,
25  e.params.etaMin,
26  e.params.ptMin,
27  e.params.discrMin
28  )
29  )
30 
31  def gen_entry_dict(groups):
32  for _, grp in groups:
33  grp = list(grp)
34  entries_by_sys = dict((e.params.sysType, e) for e in grp)
35  assert len(grp) == len(entries_by_sys) # every sysType is unique
36  yield entries_by_sys
37  sys_dicts = gen_entry_dict(sys_groups)
38 
39  def gen_flavb_csv_line(dicts):
40  for d in dicts:
41  central = d.pop('central')
42  central.params.jetFlavor = 1
43  yield central.makeCSVLine()
44  for e in d.itervalues():
45  e.params.jetFlavor = 1
46  e.formula = '2*(%s)-(%s)' % (e.formula, central.formula)
47  yield e.makeCSVLine()
48  csv_lines = gen_flavb_csv_line(sys_dicts)
49 
50  return list(l for l in csv_lines)
51 
52 
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 53 of file generateFlavCfromFlavB.py.

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

53 def main():
54  if len(sys.argv) < 3:
55  print 'Need input/output filenames as first/second arguments. Exit.'
56  exit(-1)
57  if os.path.exists(sys.argv[2]):
58  print 'Output file exists. Exit.'
59  exit(-1)
60 
61  print '\nChecking input file consistency...'
62  loaders = dataLoader.get_data(sys.argv[1])
63  checks = checker.run_check_data(loaders, True, True, False)
64  for data in loaders:
65  typ = data.meas_type
66  if 1 in data.flavs:
67  print 'FLAV_C already present in input file for %s. Exit.' % typ
68  exit(-1)
69  if not any(0 in data.flavs for data in loaders):
70  print 'FLAV_B not found in input file. Exit.'
71  exit(-1)
72 
73 
74  print '\nGenerating new csv content...'
75  new_csv_data = list(itertools.chain.from_iterable(
76  l
77  for d in loaders
78  for l in generate_flav_c(d)
79  ))
80 
81  with open(sys.argv[1]) as f:
82  old_csv_data = f.readlines()
83 
84  with open(sys.argv[2], 'w') as f:
85  f.writelines(old_csv_data)
86  f.write('\n')
87  f.writelines(new_csv_data)
88 
89  print 'Done.'
90 
91 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:34
def generate_flav_c(loaded_data)
def get_data(filename)
Definition: dataLoader.py:190
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