Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:50

0001 #!/usr/bin/env python
0002 from builtins import range
0003 import os
0004 # probably easier to fetch everything without subdirs, but that's up to user preferences
0005 #import PhysicsTools.HeppyCore.framework.config as cfg
0006 #cfg.Analyzer.nosubdir=True
0007 
0008 import PSet
0009 import sys
0010 import re
0011 print("ARGV:",sys.argv)
0012 JobNumber=sys.argv[1]
0013 crabFiles=PSet.process.source.fileNames
0014 print(crabFiles)
0015 firstInput = crabFiles[0]
0016 print("--------------- using edmFileUtil to convert PFN to LFN -------------------------")
0017 for i in range(0,len(crabFiles)) :
0018      pfn=os.popen("edmFileUtil -d %s"%(crabFiles[i])).read() 
0019      pfn=re.sub("\n","",pfn)
0020      print(crabFiles[i],"->",pfn)
0021      crabFiles[i]=pfn
0022      #crabFiles[i]="root://cms-xrd-global.cern.ch/"+crabFiles[i]
0023 
0024 import imp
0025 handle = open("heppy_config.py", 'r')
0026 cfo = imp.load_source("heppy_config", "heppy_config.py", handle)
0027 config = cfo.config
0028 handle.close()
0029 
0030 #replace files with crab ones, no splitting beyond what crab give us
0031 config.components[0].files=crabFiles
0032 
0033 #Use a simple self configured looper so that we know where the output goes
0034 from PhysicsTools.HeppyCore.framework.looper import Looper
0035 looper = Looper( 'Output', config, nPrint = 1)
0036 looper.loop()
0037 looper.write()
0038 
0039 #place the file in the main folder
0040 os.rename("Output/tree.root", "tree.root")
0041 
0042 #create bare minimum FJR
0043 fwkreport='''
0044 <FrameworkJobReport>
0045 <ReadBranches>
0046 </ReadBranches>
0047 <PerformanceReport>
0048   <PerformanceSummary Metric="StorageStatistics">
0049     <Metric Name="Parameter-untracked-bool-enabled" Value="true"/>
0050     <Metric Name="Parameter-untracked-bool-stats" Value="true"/>
0051     <Metric Name="Parameter-untracked-string-cacheHint" Value="application-only"/>
0052     <Metric Name="Parameter-untracked-string-readHint" Value="auto-detect"/>
0053     <Metric Name="ROOT-tfile-read-totalMegabytes" Value="0"/>
0054     <Metric Name="ROOT-tfile-write-totalMegabytes" Value="0"/>
0055   </PerformanceSummary>
0056 </PerformanceReport>
0057 
0058 <GeneratorInfo>
0059 </GeneratorInfo>
0060 </FrameworkJobReport>
0061 '''
0062 
0063 f1=open('./FrameworkJobReport.xml', 'w+')
0064 f1.write(fwkreport)