CMS 3D CMS Logo

Functions | Variables
getInfo Namespace Reference

Functions

def dumpAvailableKeys (run)
 
def dumpDate (run)
 
def dumpIDs (run, isqie)
 
def dumpInfo (run)
 
def dumpSNs (run)
 
def listRuns (runmin, runmax)
 
def read (run, key)
 

Variables

 a
 
 conn
 
 default
 
 description
 
 help
 
 int
 
 level1
 
 names
 
 ngccmidmap
 
 ngqieidmap
 
 ngrbxidmap
 
 parser
 
 RUNMIN
 
 type
 

Function Documentation

◆ dumpAvailableKeys()

def getInfo.dumpAvailableKeys (   run)

Definition at line 54 of file getInfo.py.

References print().

54 def dumpAvailableKeys(run):
55  db = cx_Oracle.connect(conn)
56  cursor = db.cursor()
57  sql="select name from runsession_parameter where runnumber=:run"
58  p=dict(run=run)
59  cursor = cursor.execute(sql, p)
60  res = set();
61  for row in cursor:
62  res.add(row[0]);
63  cursor.close()
64  db.close()
65  for i in sorted(res): print(i)
66 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def dumpAvailableKeys(run)
Definition: getInfo.py:54

◆ dumpDate()

def getInfo.dumpDate (   run)

Definition at line 80 of file getInfo.py.

References int, print(), read(), and submitPVValidationJobs.split().

80 def dumpDate(run):
81  date = read(run, "HCAL_TIME_OF_FM_START")
82  v = date.split()[0].split("-")
83  m = int(v[1])
84  d = int(v[2])
85  month = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
86  print("%s%02d" % (month[m-1], d))
87 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def dumpDate(run)
Definition: getInfo.py:80
def read(run, key)
Definition: getInfo.py:67

◆ dumpIDs()

def getInfo.dumpIDs (   run,
  isqie 
)

Definition at line 112 of file getInfo.py.

References ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets.if(), int, join(), FastTimerService_cff.range, read(), submitPVValidationJobs.split(), and str.

112 def dumpIDs(run, isqie):
113  db = cx_Oracle.connect(conn)
114  cursor = db.cursor()
115  p=dict(run=run)
116  OR= " OR ".join(["name like :key"+str(i) for i in range(len(names))])
117  sql= "".join(["select name, string_value from runsession_parameter where runnumber=:run and (", OR, " )"])
118  for i in range(len(names)): p["key"+str(i)]='CMS.'+names[i]+":"+"ngRBXManager_Firmware_UniqueIDs_H%"
119  cursor = cursor.execute(sql, p)
120 
121  row = cursor.fetchone()
122  out = dict()
123  while row:
124  rbx = "{0} ".format(str(row[0]).split("_")[-1])
125  n = 2
126  if 'M' in rbx: n = 3;
127  if 'P' in rbx: n = 3;
128  key = "{:s}{:02d}".format(rbx[:n], int(rbx[n:]))
129 
130  result = str(row[1])
131  array = result.split(";")
132  value=[]
133  for line in array:
134  rl={}
135  w = line.split()
136  n = len(w);
137  if isqie and w[0]=="QCard":
138  rl['id0'] = w[6]
139  rl['id'] = w[7][:-2]
140  rl['rm'] = int(w[3][-1])
141  rl['qie'] = int(w[1])
142  if isqie and w[0]=="CU":
143  rl['id0'] = w[3]
144  rl['id'] = w[4][:-2]
145  rl['rm'] = 5
146  rl['qie'] = 1
147  if not isqie and (w[0].startswith("ngCCMa") or w[0].startswith("ngCCMb")) and w[2]=="UID:":
148  rl['id0'] = (w[11][1:], "-1")["ERROR" in line]
149  rl['id'] = (w[12][:-1], "-1")["ERROR" in line]
150  rl['rm'] = 0
151  rl['qie'] = 0
152  if(rl): value.append(rl)
153  if key.startswith("HB") or key.startswith("HE"):
154  out[key] = {"value":value, "rbx":rbx}
155  row = cursor.fetchone()
156 
157 
158  #load id2sn
159  data={}
160  json_data=open(ngqieidmap).read()
161  data.update(json.loads(json_data))
162 
163  for key in sorted(out):
164  for q in out[key]["value"]:
165  id0=q['id0']
166  if out[key]["rbx"].startswith('HE'):
167  nid0=int(id0, 16);
168  id0='0x'+'%08x' % nid0
169 
170  k='_'.join((id0, q['id']))
171  v=-1
172  if k in data: v=data[k]
173  print ("%-5s %d %d %-11s %-10s %6d" % (out[key]["rbx"], q['rm'], q['qie'], id0, q['id'], v))
174 
175  cursor.close();
176  db.close()
177 
def dumpIDs(run, isqie)
Definition: getInfo.py:112
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
def read(run, key)
Definition: getInfo.py:67
#define str(s)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)

◆ dumpInfo()

def getInfo.dumpInfo (   run)

Definition at line 88 of file getInfo.py.

References join(), FastTimerService_cff.range, submitPVValidationJobs.split(), and str.

Referenced by ETLElectronicsSim.runTrivialShaper(), and CondDBESSource.~CondDBESSource().

88 def dumpInfo(run):
89  db = cx_Oracle.connect(conn)
90  cursor = db.cursor()
91  p=dict(run=run)
92  OR= " or ".join(["name like :key"+str(i) for i in range(len(names))])
93  sql= "".join(["select name, string_value from runsession_parameter where runnumber=:run and (", OR, " )"])
94  for i in range(len(names)): p["key"+str(i)]='CMS.'+names[i]+":"+"ngRBXManager_Firmware_UniqueIDs_H%"
95  cursor = cursor.execute(sql, p)
96 
97  row = cursor.fetchone()
98  out = dict()
99  while row:
100  key="{0} ".format(str(row[0]).split("_")[-1])
101  result = str(row[1])
102  array = result.split(";")
103  out[key]=array
104  row = cursor.fetchone()
105  for key in sorted(out):
106  print ("-----------------------\n{0} ".format(key))
107  for l in out[key]: print (l)
108 
109  cursor.close();
110  db.close()
111 
def dumpInfo(run)
Definition: getInfo.py:88
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
#define str(s)

◆ dumpSNs()

def getInfo.dumpSNs (   run)

Definition at line 178 of file getInfo.py.

References ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets.if(), int, join(), print(), FastTimerService_cff.range, read(), submitPVValidationJobs.split(), str, and nano_mu_digi_cff.strip.

178 def dumpSNs(run):
179  db = cx_Oracle.connect(conn)
180  cursor = db.cursor()
181  p=dict(run=run)
182  OR= " OR ".join(["name like :key"+str(i) for i in range(len(names))])
183  sql= "".join(["select name, string_value from runsession_parameter where runnumber=:run and (", OR, " )"])
184  for i in range(len(names)): p["key"+str(i)]='CMS.'+names[i]+":"+"ngRBXManager_Firmware_UniqueIDs_HB%"
185  cursor = cursor.execute(sql, p)
186 
187  row = cursor.fetchone()
188  out = dict()
189  hasRMinfo=False
190  hasCCMinfo=False
191  while row:
192  rbx = "{0} ".format(str(row[0]).split("_")[-1])
193  n = 2;
194  if 'M' in rbx: n = 3;
195  if 'P' in rbx: n = 3;
196  key = "{:s}{:02d}".format(rbx[:n], int(rbx[n:]))
197 
198  result = str(row[1])
199  array = result.split(";")
200  valueCCM=""
201  value=""
202  i=0
203  for line in array:
204  w = line.split()
205  n = len(w);
206  if w[0]=="QCard":
207  value += "{0}{1}".format(w[7][:-2], ("", " ")[i==3])
208  if(i==3): i=0
209  else: i=i+1
210  hasRMinfo=True
211  if w[0]=="CU": value += " {0}".format(w[4][:-2])
212  if w[0].startswith("ngCCM") and w[2]=="UID:":
213  valueCCM += " {0}0{1} ".format(w[11][1:], w[12][2:-1])
214  hasCCMinfo=True
215  out[key] = {"value":value+valueCCM, "rbx":rbx}
216  row = cursor.fetchone()
217 
218  data={}
219  for f in (ngrbxidmap, ngccmidmap):
220  json_data=open(f).read()
221  data.update(json.loads(json_data))
222  if(hasRMinfo and hasCCMinfo): print ("RBX | RM1 RM2 RM3 RM4 CU CCMa CCMb\n------|-----------------------------------")
223  elif hasRMinfo: print ("RBX | RM1 RM2 RM3 RM4 CU\n------|-------------------------")
224  else: print("Cannot find published information on RM IDs."); return
225  for key in sorted(out):
226  res = ""
227  for k in out[key]["value"].split():
228  if data.has_key(k): res = res + "{:4d} ".format(data[k])
229  elif "NAC" in k: res = res + " 0 "
230  else: res = res + " -1 "
231  print ("%-5s | %s" % (out[key]["rbx"].strip(), res))
232 
233  cursor.close();
234  db.close()
235 
236 
237 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
def read(run, key)
Definition: getInfo.py:67
#define str(s)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
def dumpSNs(run)
Definition: getInfo.py:178

◆ listRuns()

def getInfo.listRuns (   runmin,
  runmax 
)

Definition at line 17 of file getInfo.py.

References ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets.if(), int, join(), FastTimerService_cff.range, and str.

17 def listRuns(runmin, runmax):
18  n=5
19  db = cx_Oracle.connect(conn)
20  cursor = db.cursor()
21  p=dict();
22  sql="select runnumber, string_value, name from runsession_parameter where runnumber > {} and runnumber < {} and (".format(runmin, runmax)
23  sql = sql + " or ".join(["name=:key"+str(i) for i in range(n*len(level1))])
24  sql = sql + ") order by runnumber"
25  for i in range(len(level1)):
26  p["key"+str(n*i)]='CMS.'+level1[i]+":HCAL_TIME_OF_FM_START"
27  p["key"+str(n*i+1)]='CMS.'+level1[i]+":FM_FULLPATH"
28  p["key"+str(n*i+2)]='CMS.'+level1[i]+":LOCAL_RUNKEY_SELECTED"
29  p["key"+str(n*i+3)]='CMS.'+level1[i]+":LOCAL_RUN_KEY" #for older runs
30  p["key"+str(n*i+4)]='CMS.'+level1[i]+":EVENTS_TAKEN"
31  cursor = cursor.execute(sql, p)
32  out={}
33  maxfm=0
34  maxn=0
35  for row in cursor:
36  k = row[2]
37  n = row[1]
38  r = row[0]
39  if r not in out: out[r] = dict(time="", nevents=-1, fm="", key="")
40  if(k.endswith("HCAL_TIME_OF_FM_START")): out[r]["time"]=n
41  elif(k.endswith("FM_FULLPATH")):
42  fm=n.split("/")[-1]
43  out[r]["fm"]=fm
44  if(len(fm)>maxfm): maxfm=len(fm)
45  elif(k.endswith("EVENTS_TAKEN")):
46  out[r]["nevents"] = int(n)
47  if(len(n)>maxn): maxn = len(n)
48  else: out[r]["key"]=n
49  form="%s | %-24s | %{}d | %-{}s | %s".format(maxn, maxfm)
50  for r,i in sorted(out.items()): print (form % (r, i["time"], i["nevents"], i["fm"], i["key"]))
51  cursor.close()
52  db.close()
53 
def listRuns(runmin, runmax)
Definition: getInfo.py:17
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
#define str(s)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)

◆ read()

def getInfo.read (   run,
  key 
)

Definition at line 67 of file getInfo.py.

References join(), FastTimerService_cff.range, and str.

Referenced by dumpDate(), dumpIDs(), and dumpSNs().

67 def read(run, key):
68  db = cx_Oracle.connect(conn)
69  cursor = db.cursor()
70  p=dict(run=run)
71  OR= " or ".join(["name=:key"+str(i) for i in range(len(names))])
72  sql= "".join(["select value from runsession_string where runsession_parameter_id=any(select id from runsession_parameter where (runnumber=:run and (", OR, " )))"])
73  for i in range(len(names)): p["key"+str(i)]='CMS.'+names[i]+":"+key
74  cursor = cursor.execute(sql, p)
75  result = (cursor.fetchone()[0]).read()
76  cursor.close();
77  db.close()
78  return result
79 
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
def read(run, key)
Definition: getInfo.py:67
#define str(s)

Variable Documentation

◆ a

getInfo.a

Definition at line 244 of file getInfo.py.

◆ conn

getInfo.conn

Definition at line 9 of file getInfo.py.

Referenced by CommissioningHistosUsingDb.addDcuDetIds(), SiStripFec.addDevices(), SiStripRing.addDevices(), SiStripCcu.addDevices(), SiStripDetCabling.addDevices(), SiStripFecCrate.addDevices(), SiStripModule.addDevices(), SiStripFecCabling.addDevices(), SiStripFineDelayHit.beginRun(), TrackerDpgAnalysis.beginRun(), SiStripFedCablingBuilderFromDb.buildFecCablingFromDetIds(), SiStripFedCablingBuilderFromDb.buildFecCablingFromDevices(), SiStripFedCablingBuilderFromDb.buildFecCablingFromFedConnections(), SiStripFedCabling.buildFedCabling(), CalibrationScanTask.CalibrationScanTask(), CalibrationTask.CalibrationTask(), SiStripCommissioningSource.createCablingTasks(), SiStripFecCabling.dcuId(), SiStripFecCabling.detId(), EcalCondDBInterface.fetchCaliIOV(), EcalCondDBInterface.fetchDCSPTMTempList(), EcalCondDBInterface.fetchDCUIOV(), EcalCondDBInterface.fetchFEDelaysForRun(), EcalCondDBInterface.fetchGlobalRunListByLocation(), EcalCondDBInterface.fetchLMFLastRun(), EcalCondDBInterface.fetchLMFRunIOV(), EcalCondDBInterface.fetchMonRunIOV(), EcalCondDBInterface.fetchMonRunList(), EcalCondDBInterface.fetchMonRunListLastNRuns(), EcalCondDBInterface.fetchNonEmptyGlobalRunList(), EcalCondDBInterface.fetchNonEmptyRunList(), EcalCondDBInterface.fetchRunIOV(), EcalCondDBInterface.fetchRunList(), EcalCondDBInterface.fetchRunListByLocation(), EcalCondDBInterface.fetchRunListLastNRuns(), SiStripClusterizerFromRawGPU.fill(), SiStripDaqInfo.findExcludedModule(), SiStripApvGainFromFileBuilder.format_summary(), SiStripTrackerMapCreator.getDetectorFlagAndComment(), HcalAssistant.getListOfChannelsFromDb(), cond::CredentialStore.importForPrincipal(), EcalCondDBInterface.insertDCUIOV(), EcalCondDBInterface.insertLmfDat(), EcalCondDBInterface.insertLmfIOV(), EcalCondDBInterface.insertLmfLmrSubIOV(), EcalCondDBInterface.insertLmfRunIOV(), EcalCondDBInterface.insertLmfSeq(), EcalCondDBInterface.insertMonRunIOV(), EcalCondDBInterface.insertRunIOV(), LMFCorrCoefDat.LMFCorrCoefDat(), LMFDefFabric.LMFDefFabric(), LMFUnique.LMFUnique(), SiStripFedCablingFakeESSource.make(), SiStripFecCabling.module(), SiStripFecCabling.nApvPairs(), operator<<(), SiStripClusterizerConditionsESProducer.produce(), SiStripDaqInfo.readFedIds(), IDBObject.setConnection(), LMFCorrCoefDat.setConnection(), SiStripCcu.SiStripCcu(), stripgpu::SiStripClusterizerConditionsGPU.SiStripClusterizerConditionsGPU(), SiStripFec.SiStripFec(), SiStripFecCrate.SiStripFecCrate(), SiStripModule.SiStripModule(), SiStripRing.SiStripRing(), DaqScopeModeHistosUsingDb.update(), PedestalsHistosUsingDb.update(), NoiseHistosUsingDb.update(), PedsFullNoiseHistosUsingDb.update(), PedsOnlyHistosUsingDb.update(), ApvTimingHistosUsingDb.update(), FastFedCablingHistosUsingDb.update(), EcalCondDBInterface.updateRunConfig(), EcalCondDBInterface.updateRunIOV(), EcalCondDBInterface.updateRunIOVEndTime(), EcalCondDBInterface.updateRunIOVStartTime(), and EcalDBConnection.~EcalDBConnection().

◆ default

getInfo.default

Definition at line 241 of file getInfo.py.

◆ description

getInfo.description

Definition at line 239 of file getInfo.py.

◆ help

getInfo.help

Definition at line 240 of file getInfo.py.

◆ int

getInfo.int

Definition at line 241 of file getInfo.py.

Referenced by dumpDate(), dumpIDs(), dumpSNs(), and listRuns().

◆ level1

getInfo.level1

◆ names

getInfo.names

Definition at line 11 of file getInfo.py.

◆ ngccmidmap

getInfo.ngccmidmap

Definition at line 14 of file getInfo.py.

◆ ngqieidmap

getInfo.ngqieidmap

Definition at line 15 of file getInfo.py.

◆ ngrbxidmap

getInfo.ngrbxidmap

Definition at line 13 of file getInfo.py.

◆ parser

getInfo.parser

Definition at line 239 of file getInfo.py.

◆ RUNMIN

getInfo.RUNMIN

Definition at line 8 of file getInfo.py.

◆ type

getInfo.type

Definition at line 240 of file getInfo.py.