CMS 3D CMS Logo

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

Functions

def dumpAvailableKeys
 
def dumpDate
 
def dumpIDs
 
def dumpInfo
 
def dumpSNs
 
def listRuns
 
def read
 

Variables

tuple a = parser.parse_args()
 
tuple conn = os.getenv("HCALDQM_DBCONNECT")
 
list level1 = ['HCAL_LEVEL_1']
 
list names = ['HCAL_HBHE', 'HCAL_HF', 'HCAL_HO', 'HCAL_LEVEL_1', 'HCAL_HBHE904', 'HCAL_HF904']
 
string ngccmidmap = "/nfshome0/akhukhun/hcaldqm/config/id2sn_ngccm.json"
 
string ngqieidmap = "/nfshome0/akhukhun/hcaldqm/config/id2sn_qie.json"
 
string ngrbxidmap = "/nfshome0/akhukhun/hcaldqm/config/id2sn_rmcu.json"
 
tuple parser = argparse.ArgumentParser(description="With no arguments, return list of runs with a small summary after runmin={}".format(RUNMIN))
 
tuple RUNMIN = os.getenv("HCALDQM_RUNMIN")
 

Function Documentation

def getInfo.dumpAvailableKeys (   run)

Definition at line 54 of file getInfo.py.

References print().

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

Definition at line 80 of file getInfo.py.

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

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

Definition at line 112 of file getInfo.py.

References if(), join(), sistrip::SpyUtilities.range(), read(), submitPVValidationJobs.split(), and str.

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

Definition at line 88 of file getInfo.py.

References join(), sistrip::SpyUtilities.range(), submitPVValidationJobs.split(), and str.

Referenced by CondDBESSource.~CondDBESSource().

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

Definition at line 178 of file getInfo.py.

References if(), join(), print(), sistrip::SpyUtilities.range(), read(), submitPVValidationJobs.split(), str, and digitizers_cfi.strip.

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

Definition at line 17 of file getInfo.py.

References if(), join(), sistrip::SpyUtilities.range(), and str.

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

Definition at line 67 of file getInfo.py.

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

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

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

Variable Documentation

tuple getInfo.a = parser.parse_args()

Definition at line 244 of file getInfo.py.

tuple getInfo.conn = os.getenv("HCALDQM_DBCONNECT")

Definition at line 9 of file getInfo.py.

Referenced by CommissioningHistosUsingDb.addDcuDetIds(), SiStripDetCabling.addDevices(), SiStripFineDelayHit.beginRun(), TrackerDpgAnalysis.beginRun(), SiStripFedCablingBuilderFromDb.buildFecCablingFromDetIds(), SiStripFedCablingBuilderFromDb.buildFecCablingFromDevices(), SiStripFedCablingBuilderFromDb.buildFecCablingFromFedConnections(), SiStripFedCabling.buildFedCabling(), SiStripCommissioningSource.createCablingTasks(), 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(), SiStripDaqInfo.findExcludedModule(), 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(), SiStripFedCablingFakeESSource.make(), SiStripClusterizerConditionsESProducer.produce(), SiStripDaqInfo.readFedIds(), IDBObject.setConnection(), LMFCorrCoefDat.setConnection(), DaqScopeModeHistosUsingDb.update(), PedsOnlyHistosUsingDb.update(), PedestalsHistosUsingDb.update(), NoiseHistosUsingDb.update(), PedsFullNoiseHistosUsingDb.update(), FastFedCablingHistosUsingDb.update(), ApvTimingHistosUsingDb.update(), EcalCondDBInterface.updateRunConfig(), EcalCondDBInterface.updateRunIOV(), EcalCondDBInterface.updateRunIOVEndTime(), EcalCondDBInterface.updateRunIOVStartTime(), and EcalDBConnection.~EcalDBConnection().

list getInfo.level1 = ['HCAL_LEVEL_1']

Definition at line 10 of file getInfo.py.

Referenced by TMatacq.findPeak(), HFTimingTrustFlag.HFTimingTrustFlag(), npstat::ArrayND< Numeric, StackLen, StackDim >.jointSliceLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >.projectLoop(), npstat::ArrayND< Numeric, StackLen, StackDim >.projectLoop2(), npstat::ArrayND< Numeric, StackLen, StackDim >.scaleBySliceLoop(), and TMatacq.TMatacq().

list getInfo.names = ['HCAL_HBHE', 'HCAL_HF', 'HCAL_HO', 'HCAL_LEVEL_1', 'HCAL_HBHE904', 'HCAL_HF904']

Definition at line 11 of file getInfo.py.

string getInfo.ngccmidmap = "/nfshome0/akhukhun/hcaldqm/config/id2sn_ngccm.json"

Definition at line 14 of file getInfo.py.

string getInfo.ngqieidmap = "/nfshome0/akhukhun/hcaldqm/config/id2sn_qie.json"

Definition at line 15 of file getInfo.py.

string getInfo.ngrbxidmap = "/nfshome0/akhukhun/hcaldqm/config/id2sn_rmcu.json"

Definition at line 13 of file getInfo.py.

tuple getInfo.parser = argparse.ArgumentParser(description="With no arguments, return list of runs with a small summary after runmin={}".format(RUNMIN))

Definition at line 239 of file getInfo.py.

tuple getInfo.RUNMIN = os.getenv("HCALDQM_RUNMIN")

Definition at line 8 of file getInfo.py.