-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_NanoAOD.py
executable file
·65 lines (47 loc) · 2.05 KB
/
run_NanoAOD.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# alphatwirl
from Core.EventReader import EventLoopRunner, MPEventLoopRunner, EventLoop
from Core.ProgressBar import ProgressBar,ProgressReport,ProgressMonitor,BProgressMonitor
from Core.Concurrently import CommunicationChannel,CommunicationChannel0
from Core.BEventBuilder import BEventBuilder
from Core.ComponentLoop import ComponentLoop
from Core.UFComponentReader import UFComponentReader
from Core.Utils.git import getGitDescribe,getGitDiff
# Standard package
import imp,sys,os
cfgFileName = sys.argv[1]
file = open( cfgFileName,'r')
cfg = imp.load_source( 'UFNanoAOD.__cfg_to_run__', cfgFileName, file)
rootTree = "Events"
nCores = cfg.nCores
componentList = cfg.componentList
nEvents = cfg.nEvents
disableProgressBar = cfg.disableProgressBar
sequence = cfg.sequence
outputInfo = cfg.outputInfo
progressBar = ProgressBar()
if nCores != 1:
progressMonitor = BProgressMonitor(progressBar)
communicationChannel = CommunicationChannel(nCores,progressMonitor)
else:
progressMonitor = ProgressMonitor(progressBar)
communicationChannel = CommunicationChannel0(progressMonitor)
pass
if not disableProgressBar: progressMonitor.begin()
communicationChannel.begin()
print "\nLoading samples:\n"
eventLoopRunner = MPEventLoopRunner(communicationChannel)
eventBuilder = BEventBuilder(rootTree,nEvents)
componentReader = UFComponentReader(eventBuilder, eventLoopRunner, sequence, outputInfo)
componentLoop = ComponentLoop(componentReader)
print "\nBegin Running\n"
componentLoop(componentList)
print "\nEnd Running\n"
print "\nOutput saved in "+outputInfo.outputDir+"\n"
gitFile = os.path.join(outputInfo.outputDir,"gitDetails.txt")
gitVerboseFile = os.path.join(outputInfo.outputDir,"gitVerboseDetails.txt")
with open(gitFile,'w') as f:
f.write(getGitDescribe())
with open(gitVerboseFile,'w') as f:
f.write(getGitDiff())
if not disableProgressBar: progressMonitor.end()
communicationChannel.end()