CMS 3D CMS Logo

Functions
TkMap_script_phase1 Namespace Reference

Functions

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

Function Documentation

def TkMap_script_phase1.downloadnlineDQMhisto (   run,
  Run_type 
)

Definition at line 93 of file TkMap_script_phase1.py.

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

Referenced by getGT().

93 def downloadnlineDQMhisto(run, Run_type):
94  runDirval=setRunDirectory(run)
95  DataLocalDir=runDirval[0]
96  DataOfflineDir=runDirval[1]
97  nnn=run/100
98  nnnOnline = run/10000
99  File_Name_online=''
100  deadRocMap = False
101  ##################online file########
102  url1 = 'https://cmsweb.cern.ch/dqm/online/data/browse/Original/000'+str(nnnOnline)+'xxxx/000'+str(nnn)+'xx/'
103  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")
104 
105  url2 = 'https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OnlineData/original/000'+str(nnnOnline)+'xxxx/000'+str(nnn)+'xx/'
106  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")
107  f_online_backup=codecs.open("index_online_backup.html", 'r')
108  index_online_backup = f_online_backup.readlines()
109 
110  f_online=codecs.open("index_online.html", 'r')
111  index_online = f_online.readlines()
112  if any(str(run) in x for x in index_online):
113  for x in index_online:
114  if (str(run) in x) and ("_PixelPhase1_" in x):
115  File_Name_online=str(str(x).split(".root'>")[1].split("</a></td><td>")[0])
116  deadRocMap = True
117  else:
118  print("Can't find any file in offline server, trying the online server")
119  if any(str(run) in y for y in index_online_backup):
120  for y in index_online:
121  if (str(run) in y) and ("_PixelPhase1_" in y):
122  File_Name_online=str(str(y).split(".root'>")[1].split("</a></td><td>")[0])
123  deadRocMap = True
124  else:
125  print('No Online DQM file available. Skip dead roc map')
126  deadRocMap = False
127 
128  print('Downloading DQM file:'+File_Name_online)
129 
130 
131  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)
132 
133  os.remove('index_online.html')
134  os.remove('index_online_backup.html')
135  return deadRocMap, File_Name_online;
136 
137 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
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,
  rereco 
)

Definition at line 37 of file TkMap_script_phase1.py.

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

Referenced by getGT().

37 def downloadOfflineDQMhisto(run, Run_type,rereco):
38  runDirval=setRunDirectory(run)
39  DataLocalDir=runDirval[0]
40  DataOfflineDir=runDirval[1]
41  nnn=run/100
42  print('Processing '+ Run_type + ' in '+DataOfflineDir+"...")
43  File_Name = ''
44  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/')
45  url = 'https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OfflineData/'+DataOfflineDir+'/'+Run_type+'/000'+str(nnn)+'xx/'
46  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")
47  f=codecs.open("index.html", 'r')
48  index = f.readlines()
49  if any(str(Run_Number[i]) in s for s in index):
50  for s in index:
51  if rereco:
52  if (str(Run_Number[i]) in s) and ("__DQMIO.root" in s) and ("17Sep2018" in s):
53  File_Name = str(str(s).split("xx/")[1].split("'>DQM")[0])
54  else:
55  if (str(Run_Number[i]) in s) and ("__DQMIO.root" in s):
56  File_Name = str(str(s).split("xx/")[1].split("'>DQM")[0])
57 
58  else:
59  print('No DQM file available. Please check the Offline server')
60  sys.exit(0)
61 
62  print('Downloading DQM file:'+File_Name)
63  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)
64 
65  return File_Name
66 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def setRunDirectory(runNumber)
#define str(s)
double split
Definition: MVATrainer.cc:139
def downloadOfflineDQMhisto(run, Run_type, rereco)
def TkMap_script_phase1.downloadOfflinePCLhisto (   run,
  Run_type 
)

Definition at line 67 of file TkMap_script_phase1.py.

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

Referenced by getGT().

67 def downloadOfflinePCLhisto(run, Run_type):
68  runDirval=setRunDirectory(run)
69  DataLocalDir=runDirval[0]
70  DataOfflineDir=runDirval[1]
71  nnn=run/100
72  print('Processing '+ Run_type + ' in '+DataOfflineDir+"...")
73  File_Name = 'Temp'
74  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/')
75  url = 'https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OfflineData/'+DataOfflineDir+'/'+Run_type+'/000'+str(nnn)+'xx/'
76  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")
77  f=codecs.open("index.html", 'r')
78  index = f.readlines()
79  if any(str(Run_Number[i]) in s for s in index):
80  for s in index:
81  if (str(Run_Number[i]) in s) and ("PromptCalibProdSiPixel-Express" in s) and ("__ALCAPROMPT.root" in s):
82  File_Name = str(str(s).split("xx/")[1].split("'>DQM")[0])
83  else:
84  print('No DQM file available. Please check the Offline server')
85  sys.exit(0)
86  if File_Name!='Temp':
87  print('Downloading DQM file:'+File_Name)
88  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)
89 
90  return File_Name
91 
92 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def downloadOfflinePCLhisto(run, Run_type)
def setRunDirectory(runNumber)
#define str(s)
double split
Definition: MVATrainer.cc:139
def TkMap_script_phase1.getGT (   DQMfile,
  RunNumber,
  globalTagVar 
)

Definition at line 138 of file TkMap_script_phase1.py.

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

138 def getGT(DQMfile, RunNumber, globalTagVar):
139  globalTag_v0 = getGTfromDQMFile(DQMfile, RunNumber, globalTagVar)
140  print("Global Tag: " + globalTag_v0)
141  globalTag = globalTag_v0
142 
143  for z in range(len(globalTag_v0)-2):#clean up the garbage string in the GT
144  if (globalTag_v0[z].isdigit()) and (globalTag_v0[z+1].isdigit()) and (globalTag_v0[z+2].isdigit()) and(globalTag_v0[z+3].isupper()):
145  globalTag = globalTag_v0[z:]
146  break
147  if globalTag == "":
148  print(" No GlobalTag found: trying from DAS.... ")
149  globalTag = str(os.popen('getGTscript.sh '+filepath+ File_Name+' ' +str(Run_Number[i])));
150  if globalTag == "":
151  print(" No GlobalTag found for run: "+str(Run_Number[i]))
152 
153  return globalTag
154 
155 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def getGT(DQMfile, RunNumber, globalTagVar)
#define str(s)
def TkMap_script_phase1.setRunDirectory (   runNumber)

Definition at line 16 of file TkMap_script_phase1.py.

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

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