Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:57:52

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