CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
TkMap_script_phase1 Namespace Reference

Functions

def downloadnlineDQMhisto
 
def downloadOfflineDQMhisto
 
def downloadOfflinePCLhisto
 
def getGT
 
def setRunDirectory
 

Variables

string check_command = 'check_runcomplete '
 Check if run is complete##############. More...
 
tuple Check_output = subprocess.call(check_command, shell=True)
 
tuple checkfolder = os.path.exists(str(Run_Number[i]))
 Start making TkMaps################. More...
 
tuple CMSSW_BASE = str(os.popen('echo ${CMSSW_BASE}').read().strip())
 
list DataLocalDir = runDirval[0]
 
string dest = 'Beam'
 Producing the list of bad modules. More...
 
string detIdInfoFileName = 'TkDetIdInfo_Run'
 
tuple File_Name = downloadOfflineDQMhisto(Run_Number[i], Run_type, rereco)
 
tuple File_Name_PCL = downloadOfflinePCLhisto(Run_Number[i], Run_type)
 
string filepath = '/tmp/'
 
tuple full_pixelfile_name = os.path.join('./OUT/', file_name)
 
tuple full_stripfile_name = os.path.join('.', file_name)
 
tuple globalTag = getGT(filepath+File_Name, str(Run_Number[i]), 'globalTag_Step1')
 Getting GT############## After switch production to 10_X_X release, the clean up section need to be reviewed and modified ##########. More...
 
tuple input_var = input("DQM file is incompleted, do you want to continue? (y/n): ")
 
list nnnOut = Run_Number[i]
 Downloading DQM file############################. More...
 
list output = []
 put color legend in the TrackerMap################### More...
 
tuple pixel_files = os.listdir('./OUT')
 Start making pixel maps#####################. More...
 
string pixelTreeFileName = 'PixelPhase1Tree_Run'
 
 rereco = False
 Check if user enter the right run type######################. More...
 
list Run_Number = [int(x) for x in sys.argv[2:]]
 
list Run_type = sys.argv[1]
 
tuple runDirval = setRunDirectory(Run_Number[i])
 
string sefile = 'QualityTest_run'
 rename bad module list file###################### More...
 
tuple strip_files = os.listdir('.')
 create merged list of BadComponent from (PCL, RunInfo and FED Errors) ignore for now More...
 
tuple workPath = os.popen('pwd')
 

Function Documentation

def TkMap_script_phase1.downloadnlineDQMhisto (   run,
  Run_type 
)

Definition at line 93 of file TkMap_script_phase1.py.

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

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

Definition at line 37 of file TkMap_script_phase1.py.

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

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

Definition at line 67 of file TkMap_script_phase1.py.

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

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

Definition at line 138 of file TkMap_script_phase1.py.

References print(), sistrip::SpyUtilities.range(), and str.

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

Definition at line 16 of file TkMap_script_phase1.py.

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

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

Variable Documentation

string TkMap_script_phase1.check_command = 'check_runcomplete '

Check if run is complete##############.

Definition at line 191 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.Check_output = subprocess.call(check_command, shell=True)

Definition at line 192 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.checkfolder = os.path.exists(str(Run_Number[i]))

Start making TkMaps################.

Definition at line 217 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.CMSSW_BASE = str(os.popen('echo ${CMSSW_BASE}').read().strip())

Definition at line 158 of file TkMap_script_phase1.py.

Referenced by hitfit::JetTranslatorBase< AJet >.JetTranslatorBase(), and hitfit::LeptonTranslatorBase< ALepton >.LeptonTranslatorBase().

list TkMap_script_phase1.DataLocalDir = runDirval[0]

Definition at line 183 of file TkMap_script_phase1.py.

string TkMap_script_phase1.dest = 'Beam'

Producing the list of bad modules.

if Run_type != "StreamExpress": shutil.copyfile(sefile, checkdir+'/'+sefile) os.system('/usr/bin/python ${CMSSW_BASE}/src/DQM/SiStripMonitorClient/scripts/findBadModT9.py -p '+sefile+' -s /'+checkdir+'/'+sefile); Producing the run certification by lumisection Producing the PrimaryVertex/BeamSpot quality test by LS.. if (Run_type != "Cosmics") and ( Run_type != "StreamExpress") and (Run_type != "StreamExpressCosmics"): print(" Creating the BeamSpot Calibration certification summary:") os.system('lsbs_cert '+filepath+'/'+File_Name) .. and harvest the bad beamspot LS with automatic emailing (if in period and if bad LS found) Producing the Module difference for ExpressStream

Definition at line 297 of file TkMap_script_phase1.py.

string TkMap_script_phase1.detIdInfoFileName = 'TkDetIdInfo_Run'

Definition at line 233 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.File_Name = downloadOfflineDQMhisto(Run_Number[i], Run_type, rereco)

Definition at line 177 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.File_Name_PCL = downloadOfflinePCLhisto(Run_Number[i], Run_type)

Definition at line 179 of file TkMap_script_phase1.py.

string TkMap_script_phase1.filepath = '/tmp/'

Definition at line 176 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.full_pixelfile_name = os.path.join('./OUT/', file_name)

Definition at line 383 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.full_stripfile_name = os.path.join('.', file_name)

Definition at line 359 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.globalTag = getGT(filepath+File_Name, str(Run_Number[i]), 'globalTag_Step1')

Getting GT############## After switch production to 10_X_X release, the clean up section need to be reviewed and modified ##########.

Definition at line 226 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.input_var = input("DQM file is incompleted, do you want to continue? (y/n): ")

Definition at line 199 of file TkMap_script_phase1.py.

list TkMap_script_phase1.nnnOut = Run_Number[i]

Downloading DQM file############################.

Definition at line 174 of file TkMap_script_phase1.py.

list TkMap_script_phase1.output = []

put color legend in the TrackerMap###################

Copying the template html file to index.html########################

Definition at line 265 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.pixel_files = os.listdir('./OUT')

Start making pixel maps#####################.

copy ouput files##########

Definition at line 381 of file TkMap_script_phase1.py.

string TkMap_script_phase1.pixelTreeFileName = 'PixelPhase1Tree_Run'

Definition at line 395 of file TkMap_script_phase1.py.

TkMap_script_phase1.rereco = False

Check if user enter the right run type######################.

Definition at line 159 of file TkMap_script_phase1.py.

list TkMap_script_phase1.Run_Number = [int(x) for x in sys.argv[2:]]

Definition at line 157 of file TkMap_script_phase1.py.

string TkMap_script_phase1.Run_type = sys.argv[1]

Definition at line 156 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.runDirval = setRunDirectory(Run_Number[i])

Definition at line 182 of file TkMap_script_phase1.py.

string TkMap_script_phase1.sefile = 'QualityTest_run'

rename bad module list file######################

Definition at line 242 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.strip_files = os.listdir('.')

create merged list of BadComponent from (PCL, RunInfo and FED Errors) ignore for now

counting dead pixel####################### Counting Dead ROCs and Inefficient DC during the run######################### Merge Dead ROCs and Occupoancy Plot ################### Merge PCL and DQM Plot (only StreamExpress) ################### copy ouput files###################

Definition at line 357 of file TkMap_script_phase1.py.

tuple TkMap_script_phase1.workPath = os.popen('pwd')

Definition at line 234 of file TkMap_script_phase1.py.