Skip to content

Commit

Permalink
Merge pull request cms-sw#160 from brucala/CMG_MiniAOD_Lite_V6_0_from…
Browse files Browse the repository at this point in the history
…-CMSSW_7_0_6-compFromPSI

including component from PSI
  • Loading branch information
gpetruc committed Dec 8, 2014
2 parents 93aaa43 + 4dc0af3 commit dcfbf71
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CMGTools/Production/python/eostools.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def lfnToPFN( path, tfcProt = 'rfio'):

if path.startswith("/store/cmst3/"):
path = path.replace("/store/cmst3/","root://eoscms.cern.ch//store/cmst3/")
if path.startswith("/pnfs/psi.ch/cms/trivcat/"):
path = path.replace("/pnfs/psi.ch/cms/trivcat/","root://t3se01.psi.ch//")
#print "path to cmsFile():", path
entity = cmsIO.cmsFile( path, tfcProt )
# tokens = cmsIO.splitPFN(entity.pfn)
Expand Down Expand Up @@ -322,8 +324,7 @@ def listFiles(path, rec = False, full_info = False):
if full_info:
result.append( tokens)
else:
result.append( tokens[4])
# print result
result.append( tokens[4] )
return result

def which(cmd):
Expand Down
24 changes: 22 additions & 2 deletions CMGTools/TTHAnalysis/python/samples/ComponentCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,28 @@ def makeMCComponentFromEOS(self,name,dataset,path,pattern=".*root",xSec=1):
)
return component


def getFilesFromPSI(self,name,dataset,path,pattern=".*root"):
from CMGTools.Production.dataset import getDatasetFromCache, writeDatasetToCache
if "%" in path: path = path % dataset;
try:
files = getDatasetFromCache('PSI%{path}%{pattern}.pck'.format(path = path.replace('/','_'), pattern = pattern))
except IOError:
files = [ 'root://t3se01.psi.ch//'+x.replace("/pnfs/psi.ch/cms/trivcat/","") for x in eostools.listFiles('/pnfs/psi.ch/cms/trivcat/'+path) if re.match(pattern,x) ]
if len(files) == 0:
raise RuntimeError, "ERROR making component %s: no files found under %s matching '%s'" % (name,path,pattern)
writeDatasetToCache('PSI%{path}%{pattern}.pck'.format(path = path.replace('/','_'), pattern = pattern), files)
return files
def makeMCComponentFromPSI(self,name,dataset,path,pattern=".*root",xSec=1):
component = cfg.MCComponent(
dataset=dataset,
name = name,
files = self.getFilesFromPSI(name,dataset,path,pattern),
xSection = xSec,
nGenEvents = 1,
triggers = [],
effCorrFactor = 1,
)
return component

def makeDataComponent(self,name,datasets,user,pattern):
files=[]
Expand All @@ -97,7 +118,6 @@ def makeDataComponent(self,name,datasets,user,pattern):

return component


def getFiles(self, dataset, user, pattern, useAAA=False):
# print 'getting files for', dataset,user,pattern
ds = datasetToSource( user, dataset, pattern, True )
Expand Down

0 comments on commit dcfbf71

Please sign in to comment.