CMS 3D CMS Logo

Functions
crabhelper Namespace Reference

Functions

def inputFiles ()
 
def runsAndLumis ()
 

Function Documentation

◆ inputFiles()

def crabhelper.inputFiles ( )

Definition at line 8 of file crabhelper.py.

References print(), FastTimerService_cff.range, fileinputsource_cfi.read, and str.

8 def inputFiles():
9  print("ARGV: " + str(sys.argv))
10  JobNumber = sys.argv[1]
11  crabFiles = PSet.process.source.fileNames
12  print(crabFiles)
13  firstInput = crabFiles[0]
14  tested = False
15  forceaaa = False
16  print("--------- using edmFileUtil to convert PFN to LFN --------------")
17  for i in range(0, len(crabFiles)):
18  if os.getenv("GLIDECLIENT_Group", "") != "overflow" and os.getenv("GLIDECLIENT_Group", "") != "overflow_conservative" and not forceaaa:
19  print("Data is local")
20  pfn = os.popen("edmFileUtil -d %s" % (crabFiles[i])).read()
21  pfn = re.sub("\n", "", pfn)
22  print(str(crabFiles[i]) + "->" + str(pfn))
23  if not tested:
24  print("Testing file open")
25  import ROOT
26  testfile = ROOT.TFile.Open(pfn)
27  if testfile and testfile.IsOpen():
28  print("Test OK")
29  crabFiles[i] = pfn
30  testfile.Close()
31  # tested=True
32  else:
33  print("Test open failed, forcing AAA")
34  crabFiles[i] = "root://cms-xrd-global.cern.ch/" + \
35  crabFiles[i]
36  forceaaa = True
37  else:
38  crabFiles[i] = pfn
39 
40  else:
41  print("Data is not local, using AAA/xrootd")
42  crabFiles[i] = "root://cms-xrd-global.cern.ch/" + crabFiles[i]
43  return crabFiles
44 
45 
def inputFiles()
Definition: crabhelper.py:8
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ runsAndLumis()

def crabhelper.runsAndLumis ( )

Definition at line 46 of file crabhelper.py.

References mps_setup.append, createfilelist.int, print(), and str.

46 def runsAndLumis():
47  if hasattr(PSet.process.source, "lumisToProcess"):
48  lumis = PSet.process.source.lumisToProcess
49  runsAndLumis = {}
50  for l in lumis:
51  if "-" in l:
52  start, stop = l.split("-")
53  rstart, lstart = start.split(":")
54  rstop, lstop = stop.split(":")
55  else:
56  rstart, lstart = l.split(":")
57  rstop, lstop = l.split(":")
58  if rstart != rstop:
59  raise Exception(
60  "Cannot convert '%s' to runs and lumis json format" % l)
61  if rstart not in runsAndLumis:
62  runsAndLumis[rstart] = []
63  runsAndLumis[rstart].append([int(lstart), int(lstop)])
64  print("Runs and Lumis: " + str(runsAndLumis))
65  return runsAndLumis
66  return None
67 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def runsAndLumis()
Definition: crabhelper.py:46
#define str(s)