def EcalCondTools::compare | ( | tag1, | |
db1, | |||
since1, | |||
tag2, | |||
db2, | |||
since2, | |||
filename = 'compare.root' |
|||
) |
Produce comparison plots for two records. Save plots to file \ according to format. tag can be an xml file
Definition at line 64 of file EcalCondTools.py.
Referenced by TTUTrackingAlg::alignTracks(), muonisolation::CaloExtractorByAssociator::deposits(), and RPCEfficiencySecond::rollY().
00066 : 00067 '''Produce comparison plots for two records. Save plots to file \ 00068 according to format. tag can be an xml file''' 00069 00070 coeff_1_b=[] 00071 coeff_2_b=[] 00072 00073 coeff_1_e=[] 00074 coeff_2_e=[] 00075 00076 if tag1.find(".xml") < 0: 00077 try: 00078 exec('import '+db1.moduleName(tag1)+' as Plug') 00079 what = {'how':'barrel'} 00080 w = inspect.setWhat(Plug.What(),what) 00081 ex = Plug.Extractor(w) 00082 p = getObject(db1,tag1,since1) 00083 p.extract(ex) 00084 coeff_1_b = [i for i in ex.values()]# first set of coefficients 00085 what = {'how':'endcap'} 00086 w = inspect.setWhat(Plug.What(),what) 00087 ex = Plug.Extractor(w) 00088 p.extract(ex) 00089 coeff_1_e = [i for i in ex.values()]# first set of coefficients 00090 00091 00092 except Exception,er : 00093 print er 00094 else: 00095 coeff_1_b,coeff_1_e = EcalPyUtils.fromXML(tag1) 00096 00097 if tag2.find(".xml")<0: 00098 try: 00099 exec('import '+db2.moduleName(tag2)+' as Plug') 00100 what = {'how':'barrel'} 00101 w = inspect.setWhat(Plug.What(),what) 00102 ex = Plug.Extractor(w) 00103 p = getObject(db2,tag2,since2) 00104 p.extract(ex) 00105 coeff_2_b = [i for i in ex.values()]# 2nd set of coefficients 00106 what = {'how':'endcap'} 00107 w = inspect.setWhat(Plug.What(),what) 00108 ex = Plug.Extractor(w) 00109 p.extract(ex) 00110 coeff_2_e = [i for i in ex.values()]# first set of coefficients 00111 00112 00113 except Exception, er : 00114 print er 00115 else: 00116 coeff_2_b,coeff_2_e = EcalPyUtils.fromXML(tag2) 00117 00118 gStyle.SetPalette(1) 00119 00120 savefile = TFile(filename,"RECREATE") 00121 00122 ebhisto,ebmap, profx, profy= compareBarrel(coeff_1_b,coeff_2_b) 00123 eephisto,eepmap,eemhisto,eemmap=compareEndcap(coeff_1_e,coeff_2_e) 00124 00125 #make more canvas 00126 00127 00128 00129 diff_distro_can = TCanvas("EBdiff","EBdiff") 00130 diff_distro_can.Divide(2,2) 00131 00132 diff_distro_can.cd(1) 00133 ebhisto.Draw() 00134 diff_distro_can.cd(2) 00135 ebmap.Draw("colz") 00136 diff_distro_can.cd(3) 00137 profx.Draw() 00138 diff_distro_can.cd(4) 00139 profy.Draw() 00140 00141 # diff_distro_can.SaveAs(filename) 00142 00143 c2 = TCanvas("EEdiff","EEdiff") 00144 c2.Divide(2,2) 00145 00146 c2.cd(1) 00147 eephisto.Draw() 00148 c2.cd(2) 00149 eepmap.Draw("colz") 00150 c2.cd(3) 00151 eemhisto.Draw() 00152 c2.cd(4) 00153 eemmap.Draw("colz") 00154 00155 EEfilename = "EE_"+filename 00156 00157 # c2.SaveAs(EEfilename) 00158 00159 00160 00161 eeborderphisto,eeborderpmap,eebordermhisto,eebordermmap=compareEndcapBorder(coeff_1_e,coeff_2_e) 00162 ebborderhisto,ebbordermap = compareBarrelBorder(coeff_1_b,coeff_2_b) 00163 00164 border_diff_distro_can = TCanvas("border_difference","borders difference") 00165 border_diff_distro_can.Divide(2,3) 00166 00167 border_diff_distro_can.cd(1) 00168 ebborderhisto.Draw() 00169 border_diff_distro_can.cd(2) 00170 ebbordermap.Draw("colz") 00171 border_diff_distro_can.cd(3) 00172 eeborderphisto.Draw() 00173 border_diff_distro_can.cd(4) 00174 eeborderpmap.Draw("colz") 00175 border_diff_distro_can.cd(5) 00176 eebordermhisto.Draw() 00177 border_diff_distro_can.cd(6) 00178 eebordermmap.Draw("colz") 00179 00180 bordersfilename = "borders_"+filename 00181 prof_filename = "profiles_"+filename 00182 00183 # border_diff_distro_can.SaveAs(bordersfilename) 00184 00185 savefile.Write() 00186 00187
def EcalCondTools::compareBarrel | ( | coeff_barl_1, | |
coeff_barl_2 | |||
) |
Return an histogram and a map of the differences
Definition at line 365 of file EcalCondTools.py.
00366 : 00367 '''Return an histogram and a map of the differences ''' 00368 00369 diff_distro_h = TH1F("diffh","diffh",100,-2,2) 00370 diff_distro_m = TH2F("diffm","diffm",360,1,361,171,-85,86) 00371 diff_distro_m.SetStats(0) 00372 ebeta = TH2F("ebeta","ebeta",171,-85,86,100,-2,2) 00373 ebphi = TH2F("ebphi","ebphi",360,1,361,100,-2,2) 00374 00375 00376 for i,c in enumerate(coeff_barl_1): 00377 diff = c - coeff_barl_2[i] 00378 ieta,iphi= EcalPyUtils.unhashEBIndex(i) 00379 diff_distro_h.Fill(diff) 00380 diff_distro_m.Fill(iphi,ieta,diff) 00381 ebeta.Fill(ieta,diff) 00382 ebphi.Fill(iphi,diff) 00383 00384 prof_x_h = ebeta.ProfileX() 00385 prof_y_h = ebphi.ProfileX() 00386 00387 return diff_distro_h, diff_distro_m, prof_x_h, prof_y_h 00388 00389
def EcalCondTools::compareBarrelBorder | ( | coeff_barl_1, | |
coeff_barl_2 | |||
) |
Return an histogram and a map of the differences
Definition at line 390 of file EcalCondTools.py.
00391 : 00392 '''Return an histogram and a map of the differences ''' 00393 00394 diff_distro_border_h = TH1F("diffborderh","diffh",100,-2,2) 00395 diff_distro_border_m = TH2F("diffborderm","diffm",360,1,361,171,-85,86) 00396 diff_distro_border_m.SetStats(0) 00397 00398 for i,c in enumerate(coeff_barl_1): 00399 diff = c - coeff_barl_2[i] 00400 ieta,iphi= EcalPyUtils.unhashEBIndex(i) 00401 if (abs(ieta)==85 or abs(ieta)==65 or abs(ieta)==64 or abs(ieta)==45 or abs(ieta)==44 or abs(ieta)==25 or abs(ieta)==24 or abs(ieta)==1 or iphi%20==1 or iphi%20==0): 00402 diff_distro_border_h.Fill(diff) 00403 if (abs(ieta)==85 or abs(ieta)==65 or abs(ieta)==64 or abs(ieta)==45 or abs(ieta)==44 or abs(ieta)==25 or abs(ieta)==24 or abs(ieta)==1 or iphi%20==0 or iphi%20==1): 00404 diff_distro_border_m.Fill(iphi,ieta,diff) 00405 00406 return diff_distro_border_h, diff_distro_border_m 00407 00408 00409 00410
def EcalCondTools::compareEndcap | ( | coeff_endc_1, | |
coeff_endc_2 | |||
) |
Return an histogram and a map of the differences for each endcap
Definition at line 411 of file EcalCondTools.py.
00412 : 00413 ''' Return an histogram and a map of the differences for each endcap''' 00414 00415 diff_distro_h_eep = TH1F("diff EE+","diff EE+",100,-2,2) 00416 diff_distro_h_eem = TH1F("diff EE-","diff EE-",100,-2,2) 00417 00418 00419 diff_distro_m_eep = TH2F("map EE+","map EE+",100,1,101,100,1,101) 00420 diff_distro_m_eem = TH2F("map EE-","map EE-",100,1,101,100,1,101) 00421 00422 temp_h = TH1F("tempR","tempR",50,0,50) 00423 00424 diff_distro_m_eep.SetStats(0) 00425 diff_distro_m_eem.SetStats(0) 00426 00427 00428 for i,c in enumerate(coeff_endc_1): 00429 diff = c - coeff_endc_2[i] 00430 ix,iy,iz = EcalPyUtils.unhashEEIndex(i) 00431 R = sqrt((ix-50)*(ix-50)+(iy-50)*(iy-50)) 00432 00433 if iz >0: 00434 diff_distro_h_eep.Fill(diff) 00435 diff_distro_m_eep.Fill(ix,iy,diff) 00436 00437 else: 00438 diff_distro_h_eem.Fill(diff) 00439 diff_distro_m_eem.Fill(ix,iy,diff) 00440 00441 return diff_distro_h_eep, \ 00442 diff_distro_m_eep, \ 00443 diff_distro_h_eem, \ 00444 diff_distro_m_eem 00445 00446
def EcalCondTools::compareEndcapBorder | ( | coeff_endc_1, | |
coeff_endc_2 | |||
) |
Return an histogram and a map of the differences for each endcap
Definition at line 447 of file EcalCondTools.py.
00448 : 00449 ''' Return an histogram and a map of the differences for each endcap''' 00450 00451 border_diff_distro_h_eep = TH1F("borderdiff EE+","diff EE+",100,-2,2) 00452 border_diff_distro_h_eem = TH1F("borderdiff EE-","diff EE-",100,-2,2) 00453 00454 00455 border_diff_distro_m_eep = TH2F("bordermap EE+","map EE+",100,1,101,100,1,101) 00456 border_diff_distro_m_eem = TH2F("bordermap EE-","map EE-",100,1,101,100,1,101) 00457 00458 border_diff_distro_m_eep.SetStats(0) 00459 border_diff_distro_m_eem.SetStats(0) 00460 00461 00462 for i,c in enumerate(coeff_endc_1): 00463 diff = c - coeff_endc_2[i] 00464 ix,iy,iz = EcalPyUtils.unhashEEIndex(i) 00465 Rsq = ((ix-50.0)**2+(iy-50.0)**2) 00466 00467 if (iz >0 and (Rsq<144.0 or Rsq>2500.0)): 00468 border_diff_distro_h_eep.Fill(diff) 00469 border_diff_distro_m_eep.Fill(ix,iy,diff) 00470 elif (iz<0 and (Rsq<144.0 or Rsq>2500.0)): 00471 border_diff_distro_h_eem.Fill(diff) 00472 border_diff_distro_m_eem.Fill(ix,iy,diff) 00473 00474 00475 return border_diff_distro_h_eep, \ 00476 border_diff_distro_m_eep, \ 00477 border_diff_distro_h_eem, \ 00478 border_diff_distro_m_eem
def EcalCondTools::dumpXML | ( | db, | |
tag, | |||
since, | |||
filename = 'dump.xml' |
|||
) |
Dump record in XML format for a given tag
Definition at line 37 of file EcalCondTools.py.
Referenced by cond::PayLoadInspector< DataT >::dump(), cond::PayLoadInspector< DataT >::summary(), EcalADCToGeVXMLTranslator::writeXML(), EcalLaserAPDPNRatiosXMLTranslator::writeXML(), EcalTBWeightsXMLTranslator::writeXML(), EcalWeightGroupXMLTranslator::writeXML(), EcalDAQTowerStatusXMLTranslator::writeXML(), EcalChannelStatusXMLTranslator::writeXML(), EcalDCSTowerStatusXMLTranslator::writeXML(), EcalPedestalsXMLTranslator::writeXML(), EcalGainRatiosXMLTranslator::writeXML(), EcalWeightSetXMLTranslator::writeXML(), and EcalFloatCondObjectContainerXMLTranslator::writeXML().
def EcalCondTools::getObject | ( | db, | |
tag, | |||
since | |||
) |
Return payload object for a given iov, tag, db
Definition at line 295 of file EcalCondTools.py.
00296 : 00297 ''' Return payload object for a given iov, tag, db''' 00298 found=0 00299 try: 00300 exec('import '+db.moduleName(tag)+' as Plug') 00301 for elem in db.iov(tag).elements : 00302 if str(elem.since())==str(since): 00303 found=1 00304 return Plug.Object(elem) 00305 00306 except Exception, er : 00307 print er 00308 00309 if not found : 00310 print "Could not retrieve payload for tag: " , tag, " since: ", since 00311 sys.exit(0) 00312
def EcalCondTools::getToken | ( | db, | |
tag, | |||
since | |||
) |
Return payload token for a given iov, tag, db
Definition at line 279 of file EcalCondTools.py.
00280 : 00281 ''' Return payload token for a given iov, tag, db''' 00282 try : 00283 iov = inspect.Iov(db,tag) 00284 iovlist = iov.list() 00285 for p in iovlist: 00286 tmpsince=p[1] 00287 if str(tmpsince)==str(since) : 00288 return p[0] 00289 print "Could not retrieve token for tag: " , tag, " since: ", since 00290 sys.exit(0) 00291 00292 except Exception, er : 00293 print er 00294
def EcalCondTools::histo | ( | db, | |
tag, | |||
since, | |||
filename = 'histo.root' |
|||
) |
Make histograms and save to file. tag can be an xml file
Definition at line 188 of file EcalCondTools.py.
00189 : 00190 '''Make histograms and save to file. tag can be an xml file''' 00191 00192 coeff_barl=[] 00193 coeff_endc=[] 00194 00195 if tag.find(".xml")< 0: 00196 try: 00197 exec('import '+db.moduleName(tag)+' as Plug') 00198 00199 what = {'how':'barrel'} 00200 w = inspect.setWhat(Plug.What(),what) 00201 ex = Plug.Extractor(w) 00202 p=getObject(db,tag,since) 00203 p.extract(ex) 00204 coeff_barl = [i for i in ex.values()] 00205 00206 00207 what = {'how':'endcap'} 00208 w = inspect.setWhat(Plug.What(),what) 00209 ex = Plug.Extractor(w) 00210 p.extract(ex) 00211 coeff_endc = [i for i in ex.values()] 00212 00213 except Exception, er : 00214 print er 00215 00216 else : 00217 coeff_barl,coeff_endc=EcalPyUtils.fromXML(tag) 00218 00219 00220 savefile = TFile(filename,"RECREATE") 00221 00222 ebmap, ebeta, ebphi, eePmap, ebdist, eeMmap, prof_eePL, prof_eePR, prof_eeML, prof_eeMR, ebBorderdist = makedist(coeff_barl, coeff_endc) 00223 00224 00225 00226 gStyle.SetPalette(1) 00227 00228 c = TCanvas("CCdist") 00229 c.Divide(2,2) 00230 00231 c.cd(1) 00232 ebmap.Draw("colz") 00233 c.cd(2) 00234 eePmap.Draw("colz") 00235 c.cd(3) 00236 ebdist.Draw() 00237 c.cd(4) 00238 eeMmap.Draw("colz") 00239 00240 # c.SaveAs(filename) 00241 00242 prof_eb_eta = ebeta.ProfileX() 00243 prof_eb_phi = ebphi.ProfileX() 00244 00245 c2 = TCanvas("CCprofiles") 00246 c2.Divide(2,2) 00247 00248 leg = TLegend(0.1,0.7,0.48,0.9) 00249 00250 c2.cd(1) 00251 prof_eb_eta.Draw() 00252 c2.cd(2) 00253 prof_eb_phi.Draw() 00254 c2.cd(3) 00255 prof_eePL.SetMarkerStyle(8) 00256 prof_eePL.Draw() 00257 prof_eePR.SetMarkerStyle(8) 00258 prof_eePR.SetMarkerColor(2) 00259 prof_eePR.Draw("same") 00260 prof_eeML.SetMarkerStyle(8) 00261 prof_eeML.SetMarkerColor(3) 00262 prof_eeML.Draw("same") 00263 prof_eeMR.SetMarkerStyle(8) 00264 prof_eeMR.SetMarkerColor(5) 00265 prof_eeMR.Draw("same") 00266 leg.AddEntry(prof_eePL,"Dee1","lp") 00267 leg.AddEntry(prof_eePR,"Dee2","lp") 00268 leg.AddEntry(prof_eeMR,"Dee3","lp") 00269 leg.AddEntry(prof_eeML,"Dee4","lp") 00270 leg.Draw() 00271 c2.cd(4) 00272 ebBorderdist.Draw() 00273 00274 extrafilename = "profiles_"+filename 00275 # c2.SaveAs(extrafilename) 00276 00277 savefile.Write() 00278
def EcalCondTools::listIovs | ( | db, | |
tag | |||
) |
List all available iovs for a given tag
Definition at line 24 of file EcalCondTools.py.
def EcalCondTools::listTags | ( | db | ) |
List all available tags for a given db
Definition at line 18 of file EcalCondTools.py.
def EcalCondTools::makedist | ( | coeff_barl, | |
coeff_endc | |||
) |
Definition at line 313 of file EcalCondTools.py.
00314 : 00315 00316 ebmap = TH2F("EB","EB",360,1,261,171, -85,86) 00317 eePmap = TH2F("EE","EE",100, 1,101,100,1,101) 00318 eeMmap = TH2F("EEminus","EEminus",100,1,101,100,1,101) 00319 ebdist = TH1F("EBdist","EBdist",100,-2,2) 00320 ebBorderdist = TH1F("EBBorderdist","EBBorderdist",100,-2,2) 00321 00322 ebeta = TH2F("ebeta","ebeta",171,-85,86,100,-2,2) 00323 ebphi = TH2F("ebphi","ebphi",360,1,361,100,-2,2) 00324 00325 eePL = TH2F("EEPL","EEPlus Left",50,10,55,100,-2,2) 00326 eePR = TH2F("EEPR","EEPlus Right",50,10,55,100,-2,2) 00327 eeML = TH2F("EEML","EEMinus Left",50,10,55,100,-2,2) 00328 eeMR = TH2F("EEMR","EEMinus Right",50,10,55,100,-2,2) 00329 00330 for i,c in enumerate(coeff_barl): 00331 ieta,iphi = EcalPyUtils.unhashEBIndex(i) 00332 ebmap.Fill(iphi,ieta,c) 00333 ebdist.Fill(c) 00334 ebeta.Fill(ieta,c) 00335 ebphi.Fill(iphi,c) 00336 00337 if (abs(ieta)==85 or abs(ieta)==65 or abs(ieta)==64 or abs(ieta)==45 or abs(ieta)==44 or abs(ieta)==25 or abs(ieta)==24 or abs(ieta)==1 or iphi%20==1 or iphi%20==0): 00338 ebBorderdist.Fill(c) 00339 00340 00341 for i,c in enumerate(coeff_endc): 00342 ix,iy,iz = EcalPyUtils.unhashEEIndex(i) 00343 R = sqrt((ix-50)*(ix-50)+(iy-50)*(iy-50)) 00344 00345 if iz>0: 00346 eePmap.Fill(ix,iy,c) 00347 if ix<50: 00348 eePL.Fill(R,c,1) 00349 if ix>50: 00350 eePR.Fill(R,c,1) 00351 00352 if iz<0: 00353 eeMmap.Fill(ix,iy,c) 00354 if ix<50: 00355 eeML.Fill(R,c,1) 00356 if ix>50: 00357 eeMR.Fill(R,c,1) 00358 00359 prof_eePL = eePL.ProfileX() 00360 prof_eePR = eePR.ProfileX() 00361 prof_eeML = eeML.ProfileX() 00362 prof_eeMR = eeMR.ProfileX() 00363 00364 return ebmap, ebeta, ebphi, eePmap, ebdist, eeMmap, prof_eePL, prof_eePR, prof_eeML, prof_eeMR, ebBorderdist
def EcalCondTools::plot | ( | db, | |
tag, | |||
since, | |||
filename = 'plot.root' |
|||
) |
Invoke the plot function from the wrapper and save to the specified \ file. The file format will reflect the extension given.
Definition at line 49 of file EcalCondTools.py.
Referenced by TaggingVariablePlotter::analyzeTag(), DQMHistPlotter::DQMHistPlotter(), DQMHistPlotter::endJob(), SiPixelHistoricInfoReader::endJob(), DQMHistEffProducer::endJob(), DTNoiseAnalysisTest::endLuminosityBlock(), HLTTauDQMSource::endLuminosityBlock(), FlavourHistograms< T >::epsPlot(), SummaryPlotXmlParser::parseXML(), DQMHistPlotter::cfgEntryDrawJob::print(), runInspector(), and TaggingVariablePlotter::VariableConfig::VariableConfig().
00050 : 00051 '''Invoke the plot function from the wrapper and save to the specified \ 00052 file. The file format will reflect the extension given.''' 00053 00054 try : 00055 iov = inspect.Iov(db,tag) 00056 iovlist = iov.list() 00057 token = getToken(db,tag,since) 00058 payload=inspect.PayLoad(db,token) 00059 payload.plot(filename,"",[],[]) 00060 00061 except Exception,er : 00062 print er 00063