CMS 3D CMS Logo

heppy_loop.py
Go to the documentation of this file.
1 if __name__ == '__main__':
2  from optparse import OptionParser
3  from PhysicsTools.HeppyCore.framework.heppy_loop import main
4 
5  parser = OptionParser()
6  parser.usage = """
7  %prog <name> <analysis_cfg>
8  For each component, start a Loop.
9  'name' is whatever you want.
10  """
11 
12  parser.add_option("-N", "--nevents",
13  dest="nevents",
14  type="int",
15  help="number of events to process",
16  default=None)
17  parser.add_option("-p", "--nprint",
18  dest="nprint",
19  help="number of events to print at the beginning",
20  default=5)
21  parser.add_option("-e", "--iEvent",
22  dest="iEvent",
23  help="jump to a given event. ignored in multiprocessing.",
24  default=None)
25  parser.add_option("-f", "--force",
26  dest="force",
27  action='store_true',
28  help="don't ask questions in case output directory already exists.",
29  default=False)
30  parser.add_option("-i", "--interactive",
31  dest="interactive",
32  action='store_true',
33  help="stay in the command line prompt instead of exiting",
34  default=False)
35  parser.add_option("-t", "--timereport",
36  dest="timeReport",
37  action='store_true',
38  help="Make a report of the time used by each analyzer",
39  default=False)
40  parser.add_option("-v", "--verbose",
41  dest="verbose",
42  action='store_true',
43  help="increase the verbosity of the output (from 'warning' to 'info' level)",
44  default=False)
45  parser.add_option("-q", "--quiet",
46  dest="quiet",
47  action='store_true',
48  help="do not print log messages to screen.",
49  default=False)
50  parser.add_option("-o", "--option",
51  dest="extraOptions",
52  type="string",
53  action="append",
54  default=[],
55  help="Save one extra option (either a flag, or a key=value pair) that can be then accessed from the job config file")
56  parser.add_option("-j", "--ntasks",
57  dest="ntasks",
58  type="int",
59  help="number of parallel tasks to span",
60  default=10)
61 
62  (options,args) = parser.parse_args()
63 
64  loop = main(options, args, parser)
65  if not options.interactive:
66  exit() # trigger exit also from ipython
Definition: main.py:1