CMS 3D CMS Logo

Functions
TkMap_script_phase1 Namespace Reference

Functions

def downloadnlineDQMhisto (run, Run_type)
 
def downloadOfflineDQMhisto (run, Run_type)
 
def getGT (DQMfile, RunNumber, globalTagVar)
 
def setRunDirectory (runNumber)
 

Function Documentation

def TkMap_script_phase1.downloadnlineDQMhisto (   run,
  Run_type 
)

Definition at line 60 of file TkMap_script_phase1.py.

References any(), setRunDirectory(), split, and str.

Referenced by getGT().

60 def downloadnlineDQMhisto(run, Run_type):
61  runDirval=setRunDirectory(run)
62  DataLocalDir=runDirval[0]
63  DataOfflineDir=runDirval[1]
64  nnn=run/100
65  nnnOnline = run/10000
66  File_Name_online=''
67  deadRocMap = False
68  ##################online file########
69  url1 = 'https://cmsweb.cern.ch/dqm/online/data/browse/Original/000'+str(nnnOnline)+'xxxx/000'+str(nnn)+'xx/'
70  os.popen("curl -k --cert /data/users/cctrkdata/current/auth/proxy/proxy.cert --key /data/users/cctrkdata/current/auth/proxy/proxy.cert -X GET "+url1+" > index_online.html")
71 
72  url2 = 'https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OnlineData/original/000'+str(nnnOnline)+'xxxx/000'+str(nnn)+'xx/'
73  os.popen("curl -k --cert /data/users/cctrkdata/current/auth/proxy/proxy.cert --key /data/users/cctrkdata/current/auth/proxy/proxy.cert -X GET "+url2+" > index_online_backup.html")
74  f_online_backup=codecs.open("index_online_backup.html", 'r')
75  index_online_backup = f_online_backup.readlines()
76 
77  f_online=codecs.open("index_online.html", 'r')
78  index_online = f_online.readlines()
79  if any(str(run) in x for x in index_online):
80  for x in index_online:
81  if (str(run) in x) and ("_PixelPhase1_" in x):
82  File_Name_online=str(str(x).split(".root'>")[1].split("</a></td><td>")[0])
83  deadRocMap = True
84  else:
85  print "Can't find any file in offline server, trying the online server"
86  if any(str(run) in y for y in index_online_backup):
87  for y in index_online:
88  if (str(run) in y) and ("_PixelPhase1_" in y):
89  File_Name_online=str(str(y).split(".root'>")[1].split("</a></td><td>")[0])
90  deadRocMap = True
91  else:
92  print 'No Online DQM file available. Skip dead roc map'
93  deadRocMap = False
94 
95  print 'Downloading DQM file:'+File_Name_online
96 
97 
98  os.system('curl -k --cert /data/users/cctrkdata/current/auth/proxy/proxy.cert --key /data/users/cctrkdata/current/auth/proxy/proxy.cert -X GET https://cmsweb.cern.ch/dqm/online/data/browse/Original/000'+str(nnnOnline)+'xxxx/000'+str(nnn)+'xx/'+File_Name_online+' > /tmp/'+File_Name_online)
99 
100  os.remove('index_online.html')
101  os.remove('index_online_backup.html')
102  return deadRocMap, File_Name_online;
103 
104 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def downloadnlineDQMhisto(run, Run_type)
def setRunDirectory(runNumber)
#define str(s)
double split
Definition: MVATrainer.cc:139
def TkMap_script_phase1.downloadOfflineDQMhisto (   run,
  Run_type 
)

Definition at line 35 of file TkMap_script_phase1.py.

References any(), setRunDirectory(), split, and str.

Referenced by getGT().

35 def downloadOfflineDQMhisto(run, Run_type):
36  runDirval=setRunDirectory(run)
37  DataLocalDir=runDirval[0]
38  DataOfflineDir=runDirval[1]
39  nnn=run/100
40  print 'Processing '+ Run_type + ' in '+DataOfflineDir+"..."
41  File_Name = ''
42  print 'Directory to fetch the DQM file from: https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OfflineData/'+DataOfflineDir+'/'+Run_type+'/000'+str(nnn)+'xx/'
43  url = 'https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OfflineData/'+DataOfflineDir+'/'+Run_type+'/000'+str(nnn)+'xx/'
44  os.popen("curl -k --cert /data/users/cctrkdata/current/auth/proxy/proxy.cert --key /data/users/cctrkdata/current/auth/proxy/proxy.cert -X GET "+url+" > index.html")
45  f=codecs.open("index.html", 'r')
46  index = f.readlines()
47  if any(str(Run_Number[i]) in s for s in index):
48  for s in index:
49  if (str(Run_Number[i]) in s) and ("__DQMIO.root" in s):
50  File_Name = str(str(s).split("xx/")[1].split("'>DQM")[0])
51  else:
52  print 'No DQM file available. Please check the Offline server'
53  sys.exit(0)
54 
55  print 'Downloading DQM file:'+File_Name
56  os.system('curl -k --cert /data/users/cctrkdata/current/auth/proxy/proxy.cert --key /data/users/cctrkdata/current/auth/proxy/proxy.cert -X GET https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OfflineData/'+DataOfflineDir+'/'+Run_type+'/000'+str(nnn)+'xx/'+File_Name+' > /tmp/'+File_Name)
57 
58  return File_Name
59 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def setRunDirectory(runNumber)
#define str(s)
double split
Definition: MVATrainer.cc:139
def downloadOfflineDQMhisto(run, Run_type)
def TkMap_script_phase1.getGT (   DQMfile,
  RunNumber,
  globalTagVar 
)

Definition at line 105 of file TkMap_script_phase1.py.

References downloadnlineDQMhisto(), downloadOfflineDQMhisto(), createfilelist.int, setRunDirectory(), str, and digitizers_cfi.strip.

105 def getGT(DQMfile, RunNumber, globalTagVar):
106  globalTag_v0 = getGTfromDQMFile(DQMfile, RunNumber, globalTagVar)
107  print "Global Tag: " + globalTag_v0
108  globalTag = globalTag_v0
109 
110  for z in range(len(globalTag_v0)-2):#clean up the garbage string in the GT
111  if (globalTag_v0[z].isdigit()) and (globalTag_v0[z+1].isdigit()) and (globalTag_v0[z+2].isdigit()) and(globalTag_v0[z+3].isupper()):
112  globalTag = globalTag_v0[z:]
113  if globalTag == "":
114  print " No GlobalTag found: trying from DAS.... ";
115  globalTag = str(os.popen('getGTscript.sh '+filepath+ File_Name+' ' +str(Run_Number[i])));
116  if globalTag == "":
117  print " No GlobalTag found for run: "+str(Run_Number[i]);
118  return globalTag
119 
120 
def getGT(DQMfile, RunNumber, globalTagVar)
#define str(s)
def TkMap_script_phase1.setRunDirectory (   runNumber)

Definition at line 15 of file TkMap_script_phase1.py.

Referenced by downloadnlineDQMhisto(), downloadOfflineDQMhisto(), and getGT().

15 def setRunDirectory(runNumber):
16  # Don't forget to add an entry when there is a new era
17  dirDict = { 315252:['Data2018', 'Run2018'],\
18  308336:['Data2018', 'Commissioning2018'],\
19  294644:['Data2017', 'Run2017'],\
20  290123:['Data2017', 'Commissioning2017'],\
21  284500:['Data2016', 'PARun2016'],\
22  271024:['Data2016', 'Run2016'],\
23  264200:['Data2016', 'Commissioning2016'],\
24  246907:['Data2015', 'Run2015'],\
25  232881:['Data2015', 'Commissioning2015'],\
26  211658:['Data2013', 'Run2013'],\
27  209634:['Data2013', 'HIRun2013'],\
28  190450:['Data2012', 'Run2012']}
29  runKey=0
30  for key in sorted(dirDict):
31  if runNumber > key:
32  runKey=key
33  return dirDict[runKey]
34 
def setRunDirectory(runNumber)