22 #include "GaudiKernel/IInterface.h"
23 #include "GaudiKernel/MsgStream.h"
24 #include "GaudiKernel/StatusCode.h"
43 m_configSvc(
"TrigConf::TrigConfigSvc/TrigConfigSvc",
name),
44 m_monGroup(0), m_phiScaleTT(32./
M_PI), m_phiScaleJE(16./
M_PI)
46 declareInterface<TrigT1CaloLWHistogramToolV1>(
this);
50 "Number of Error Event Number Samples");
52 "Make all eta bins the same size in eta/phi plots");
71 if (
sc.isFailure() ) {
72 msg(MSG::ERROR) <<
"Couldn't connect to " <<
m_configSvc.typeAndName()
75 }
else msg(MSG::INFO) <<
"Connected to " <<
m_configSvc.typeAndName()
79 return StatusCode::SUCCESS;
86 return StatusCode::SUCCESS;
98 std::ostringstream cnum;
100 << std::setiosflags(std::ios::fixed | std::ios::showpoint)
101 << std::setprecision(precision) <<
val;
108 int firstMax,
int secondMin,
int secondMax,
112 const int numSecond = secondMax - secondMin + 1;
116 std::ostringstream cnum;
118 axis->SetBinLabel(
bin, cnum.str().c_str());
127 int firstMin,
int firstMax,
128 int secondMin,
int secondMax,
int step,
int offset,
bool xAxis)
134 std::ostringstream cnum;
136 axis->SetBinLabel(
bin, cnum.str().c_str());
150 std::ostringstream cnum;
152 axis->SetBinLabel(
bin, cnum.str().c_str());
162 std::string newWord(word);
163 if (!xAxis && word.length() > 6) {
165 std::string::size_type
idx =
166 word.find_last_of(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
167 if (
idx != std::string::npos &&
idx != 0 &&
idx != word.length()-1) {
168 newWord =
"#splitline{" + word.substr(0,
idx) +
"}{"
169 + word.substr(
idx) +
"}";
181 for (
int bit = 0; bit < 8; ++bit) {
192 std::vector<std::string>&
names)
213 int nthresh = ttc.
max;
215 for (
int thr = 0; thr < nthresh; ++thr) {
216 std::ostringstream cnum;
217 cnum <<
type <<
" " << thr;
218 names.push_back(cnum.str());
226 std::vector<TrigConf::TriggerThreshold*>::const_iterator
it;
228 const std::string thrType((*it)->type());
229 if (
type == def.emType() ||
type == def.tauType()) {
230 if (thrType != def.emType() && thrType != def.tauType())
continue;
231 }
else if (thrType !=
type)
continue;
232 const int threshNum = (*it)->thresholdNumber();
233 if (threshNum >= 0 && threshNum < nthresh) {
234 names[threshNum] = (*it)->name();
247 const std::string&
type,
int offset,
bool xAxis)
250 std::vector<std::string>
names;
253 std::vector<std::string>::const_iterator
it =
names.begin();
265 std::ostringstream cval;
266 const int mask = (1 << nBits) - 1;
267 for (
int thr = 0; thr < nThresh; ++thr) {
268 const int hit = (
val >> (nBits*thr)) &
mask;
270 if (thr != nThresh-1) cval <<
" ";
278 int nThresh,
int nBits)
281 const int mask = (1 << nBits) - 1;
282 for (
int thr = 0; thr < nThresh; ++thr) {
283 const int hit1 = (val1 >> (nBits*thr)) &
mask;
284 const int hit2 = (val2 >> (nBits*thr)) &
mask;
285 if (hit1 && (hit1 == hit2))
result |= (1 << thr);
293 int nThresh,
int nBits)
296 const int mask = (1 << nBits) - 1;
297 for (
int thr = 0; thr < nThresh; ++thr) {
298 const int hit1 = (val1 >> (nBits*thr)) &
mask;
299 const int hit2 = (val2 >> (nBits*thr)) &
mask;
300 if (hit1 != hit2)
result |= (1 << thr);
310 unsigned int mask = 0;
325 int nthresh = ttc.
max;
333 std::vector<TrigConf::TriggerThreshold*>::const_iterator
it;
335 const std::string thrType((*it)->type());
336 if (thrType !=
type)
continue;
337 const int threshNum = (*it)->thresholdNumber();
338 if (threshNum >= 0 && threshNum < nthresh) {
339 mask |= (1<<threshNum);
370 const int nChips = 8;
374 axis->SetTitle(
"Chip/Local Coord");
396 const int nCrates = 4;
400 axis->SetTitle(
"Crate/CMM");
408 const int nCrates = 4;
409 const int nCPMs = 14;
412 axis->SetTitle(
"Crate/Module");
432 const int nCrates = 2;
433 const int nJEMs = 16;
436 axis->SetTitle(
"Crate/Module");
456 const int nCrates = 2;
460 axis->SetTitle(
"Crate/CMM");
468 const int nFrame = 8;
472 axis->SetTitle(
"Frame/Local Coord");
482 newOffset += TrigConf::L1DataDef::max_JET_Threshold_Number();
483 thresholds(
hist, TrigConf::L1DataDef::jbType(), newOffset, xAxis);
484 newOffset += TrigConf::L1DataDef::max_JB_Threshold_Number();
485 thresholds(
hist, TrigConf::L1DataDef::jfType(), newOffset, xAxis);
552 int lastCrate,
int offset,
bool xAxis)
555 if (lastCrate-firstCrate > 1)
step = 4;
558 axis->SetTitle(
"Crate/Module");
567 for (
int bit = 0; bit < 8; ++bit) {
581 axis->SetTitle(
"Submodule/Channel");
591 const std::string&
title,
602 const std::string&
title,
603 int nx,
const double*
xbins)
624 const std::string&
title,
int nx,
const double*
xbins)
635 const std::string&
title,
642 hist->SetOption(
"colz");
649 const std::string&
title,
650 int nx,
const double*
xbins,
656 hist->SetOption(
"colz");
663 const std::string&
title,
664 int nx,
const double*
xbins,
665 int ny,
const double*
ybins)
670 hist->SetOption(
"colz");
677 const std::string&
name,
const std::string&
title,
683 hist->SetOption(
"colz");
690 const std::string&
name,
const std::string&
title,
691 int nx,
const double*
xbins,
int ny,
double ymin,
double ymax)
696 hist->SetOption(
"colz");
703 const std::string&
name,
const std::string&
title,
704 int nx,
const double*
xbins,
int ny,
const double*
ybins)
709 hist->SetOption(
"colz");
716 const std::string&
title,
723 hist->SetOption(
"text");
730 const std::string&
name,
const std::string&
title,
736 hist->GetXaxis()->SetTitle(
"Events with Error/Mismatch");
745 msg(MSG::WARNING) <<
"Could not register histogram : "
755 const std::string&
title,
766 const std::string&
title,
773 hist->SetOption(
"colz");
782 msg(MSG::WARNING) <<
"Could not register histogram : "
795 const std::string&
name,
const std::string&
title)
806 const std::string&
name,
const std::string&
title)
813 axis->SetBinLabel(1,
"#color[4]{0}");
814 axis->SetBinLabel(2,
"#color[4]{1}");
815 axis->SetBinLabel(19,
"#color[4]{18}");
816 axis->SetBinLabel(20,
"#color[4]{19}");
817 axis->SetTitle(
"Serialiser FPGA");
824 const std::string&
name,
const std::string&
title)
835 const std::string&
title)
844 axis->SetBinLabel(
bin+58,
"+");
848 hist->SetXTitle(
"eta");
850 const double halfPhiBin =
M_PI/64.;
856 axis->SetBinLabel(64,
"phi");
864 const std::string&
title)
877 axis->SetBinLabel(
bin+58,
"+");
881 hist->SetXTitle(
"eta");
890 else axis->SetBinLabel(64,
"phi");
897 const std::string&
name,
const std::string&
title)
907 const std::string&
name,
const std::string&
title)
912 hist->GetXaxis()->SetTitle(
"Module");
913 hist->GetYaxis()->SetTitle(
"Crate");
920 const std::string&
name,
const std::string&
title)
924 hist->GetXaxis()->SetTitle(
"Module");
932 const std::string&
name,
const std::string&
title)
943 const std::string&
title)
947 axis->SetBinLabel(1,
"L0/0");
948 axis->SetBinLabel(2,
"L0/1");
949 axis->SetBinLabel(3,
"L1/0");
950 axis->SetBinLabel(4,
"L1/1");
951 axis->SetBinLabel(5,
"L2/0");
952 axis->SetBinLabel(6,
"L2/1");
953 axis->SetBinLabel(7,
"L3/0");
954 axis->SetBinLabel(8,
"L3/1");
955 axis->SetBinLabel(9,
"R0/0");
956 axis->SetBinLabel(10,
"R0/1");
957 axis->SetBinLabel(11,
"R1/0");
958 axis->SetBinLabel(12,
"R1/1");
959 axis->SetBinLabel(13,
"R2/0");
960 axis->SetBinLabel(14,
"R2/1");
961 axis->SetBinLabel(15,
"T/0");
962 axis->SetBinLabel(16,
"T/1");
963 axis->SetTitle(
"Sum/CMM");
970 const std::string&
name,
const std::string&
title)
974 axis->SetBinLabel(1,
"L0");
975 axis->SetBinLabel(2,
"L1");
976 axis->SetBinLabel(3,
"L2");
977 axis->SetBinLabel(4,
"L3");
978 axis->SetBinLabel(5,
"R0");
979 axis->SetBinLabel(6,
"R1");
980 axis->SetBinLabel(7,
"R2");
981 axis->SetBinLabel(8,
"T");
982 axis->SetTitle(
"Sum (Local/Remote/Total)");
994 const std::string&
name,
const std::string&
title)
999 axis->SetBinLabel(1,
"Ex");
1000 axis->SetBinLabel(2,
"Ey");
1001 axis->SetBinLabel(3,
"Et");
1008 const std::string&
name,
const std::string&
title)
1019 const std::string&
name,
const std::string&
title)
1030 const std::string&
name,
const std::string&
title)
1040 const std::string&
name,
const std::string&
title)
1045 hist->SetXTitle(
"Module");
1046 hist->SetYTitle(
"Crate");
1053 const std::string&
title)
1055 const int nxbins = 32;
1056 const double xbins[nxbins+1] = {-4.9,-3.2,-2.9,-2.7,-2.4,-2.2,-2.0,-1.8,-1.6,
1057 -1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,0.0,0.2,
1058 0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,
1061 hist->SetXTitle(
"eta");
1068 const std::string&
title)
1075 for (
int ch = -11;
ch < 12;
ch+=2) {
1078 const double eta =
chan/5. + 0.1;
1081 axis->SetBinLabel(2,
"-15/-3.05");
1082 axis->SetBinLabel(4,
"-13/-2.55");
1083 axis->SetBinLabel(29,
"12/2.55");
1084 axis->SetBinLabel(31,
"14/3.05");
1086 const int nxbins = 32;
1087 const double xbins[nxbins+1] = {-4.9,-3.2,-2.9,-2.7,-2.4,-2.2,-2.0,-1.8,
1088 -1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,
1089 0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,
1090 2.0,2.2,2.4,2.7,2.9,3.2,4.9};
1092 hist->SetXTitle(
"eta");
1096 const double halfPhiBin =
M_PI/32.;
1102 else axis->SetBinLabel(32,
"phi");
1109 const std::string&
title)
1120 axis->SetBinLabel(2,
"-14/-2.95");
1121 axis->SetBinLabel(4,
"-12/-2.45");
1122 axis->SetBinLabel(28,
"12/2.45");
1123 axis->SetBinLabel(30,
"14/2.95");
1124 axis->SetBinLabel(32,
"16/4.05");
1126 const int nxbins = 32;
1127 const double xbins[nxbins+1] = {-4.0,-3.05,-2.8,-2.55,-2.3,-2.1,-1.9,-1.7,
1128 -1.5,-1.3,-1.1,-0.9,-0.7,-0.5,-0.3,-0.1,
1129 0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,
1130 2.1,2.3,2.55,2.8,3.05,4.0,4.95};
1132 hist->SetXTitle(
"eta");
1141 else axis->SetBinLabel(32,
"phi");
1148 const std::string&
title,
1152 const int eRange = 256;
1153 const int dRange = 4096*
scale;
1155 for (
int i = 0;
i < eRange; ++
i) {
1159 double binedges[eRange+2];
1161 std::set<int>::const_iterator iter =
sorted.begin();
1162 std::set<int>::const_iterator iterE =
sorted.end();
1163 for (; iter != iterE; ++iter) {
1169 binedges[
nbins] = dRange;
1177 const std::string&
name,
const std::string&
title)
1179 const int nbins = TrigConf::L1DataDef::max_JET_Threshold_Number();
1188 const std::string&
name,
const std::string&
title)
1190 const int nbins = TrigConf::L1DataDef::max_JB_Threshold_Number();
1199 const std::string&
name,
const std::string&
title)
1201 const int nbins = TrigConf::L1DataDef::max_JF_Threshold_Number();
1210 const std::string&
name,
const std::string&
title)
1212 const int nbins = TrigConf::L1DataDef::max_JE_Threshold_Number();
1221 const std::string&
name,
const std::string&
title)
1223 const int nbins = TrigConf::L1DataDef::max_XE_Threshold_Number();
1232 const std::string&
name,
const std::string&
title)
1235 const int nbins = 8;
1244 const std::string&
name,
const std::string&
title)
1247 const int nbins = 8;
1256 const std::string&
name,
const std::string&
title)
1267 const std::string&
name,
const std::string&
title)
1272 hist->SetYTitle(
"Crate");
1283 const std::string&
title)
1285 const int nxbins = 66;
1286 const double xbins[nxbins+1] = {-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
1287 -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1288 -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1289 -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1290 -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1291 0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1292 1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1293 3.1,3.2,3.625,4.050,4.475,4.9};
1295 hist->SetXTitle(
"eta");
1302 const std::string&
title)
1304 const int nxbins = 62;
1305 const double xbins[nxbins+1] = {-4.9,-4.050,-3.2,-3.1,-2.9,
1306 -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1307 -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1308 -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1309 -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1310 0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1311 1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1314 hist->SetXTitle(
"eta");
1321 const std::string&
title)
1328 for (
int ch = -25;
ch < 25;
ch+=4) {
1331 const double eta = (
chan/10.)+0.05;
1334 axis->SetBinLabel(1,
"-49/-4.41");
1335 axis->SetBinLabel(5,
"-32/-3.15");
1336 axis->SetBinLabel(62,
"31/3.15");
1337 axis->SetBinLabel(66,
"44/4.41");
1339 const int nxbins = 66;
1340 const double xbins[nxbins+1] = {-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
1341 -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1342 -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1343 -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1344 -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1345 0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1346 1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1347 3.1,3.2,3.625,4.050,4.475,4.9};
1349 hist->SetXTitle(
"eta");
1354 const double halfPhiBin =
M_PI/64.;
1360 else axis->SetBinLabel(64,
"phi");
1368 const std::string&
title)
1373 axis->SetBinLabel(1,
"-49/-4.17");
1374 axis->SetBinLabel(66,
"44/4.19");
1383 const std::string&
name,
const std::string&
title)
1391 for (
int ch = -25;
ch < 25;
ch+=4) {
1394 const double eta = (
chan/10.)+0.05;
1397 axis->SetBinLabel(1,
"-49/-4.41");
1398 axis->SetBinLabel(5,
"-32/-3.15");
1399 axis->SetBinLabel(62,
"31/3.15");
1400 axis->SetBinLabel(66,
"44/4.41");
1402 const int nxbins = 66;
1403 const double xbins[nxbins+1] = {-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
1404 -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1405 -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1406 -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1407 -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1408 0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1409 1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1410 3.1,3.2,3.625,4.050,4.475,4.9};
1412 hist->SetXTitle(
"eta");
1417 const double halfPhiBin =
M_PI/64.;
1423 else axis->SetBinLabel(64,
"phi");
1431 const std::string&
name,
const std::string&
title)
1436 axis->SetBinLabel(1,
"-49/-4.17");
1437 axis->SetBinLabel(66,
"44/4.19");
1446 const std::string&
name,
const std::string&
title,
1447 int firstCrate,
int lastCrate)
1449 const int nbins = (lastCrate-firstCrate+1)*16;
1458 const std::string&
name,
const std::string&
title,
1459 int firstCrate,
int lastCrate)
1461 const int nbins = (lastCrate-firstCrate+1)*16;
1472 const std::string&
name,
const std::string&
title,
1473 int firstCrate,
int lastCrate)
1475 const int nbins = (lastCrate-firstCrate+1)*16;
1486 const std::string&
name,
const std::string&
title,
1487 int firstCrate,
int lastCrate)
1489 const int nbins = (lastCrate-firstCrate+1)*16;
1499 const std::string&
name,
const std::string&
title,
1500 int firstCrate,
int lastCrate)
1502 const int nbins = (lastCrate-firstCrate+1)*16;
1516 int& minBinx,
int& minBiny,
int& maxBinx,
int& maxBiny,
1527 unsigned int ix = 0;
1528 unsigned int iy = 0;
1531 hist->resetActiveBinLoop();
1560 int& minBinx,
int& minBiny,
int& maxBinx,
int& maxBiny,
1573 for (
int ix = 1; ix <=
xbins; ++ix) {
1574 for (
int iy = 1; iy <=
ybins; ++iy) {
1610 const EventContext& ctx = Gaudi::Hive::currentContext();
1613 const int biny =
hist->GetYaxis()->FindBin(
y);
1616 for (
int binx = 1; binx <=
nbins; ++binx) {
1617 const int val =
hist->GetBinContent(binx, biny);
1619 else if (
val == 0) {
1624 for (
int b =
nbins;
b > binx; --
b) {
1625 const int v1 =
hist->GetBinContent(
b-1, biny);
1626 if (v1 == 0)
continue;
1627 const int v2 =
hist->GetBinContent(
b, biny);
1629 hist->SetBinContent(
b, biny, v1);
1641 int nThresh,
int nBits,
int offset)
1644 const int mask = (1 << nBits) - 1;
1645 for (
int thr = 0; thr < nThresh; ++thr) {
1646 const int hit = (
val >> (nBits*thr)) &
mask;
1655 int y,
int nThresh,
int nBits,
int offset)
1658 const int mask = (1 << nBits) - 1;
1659 for (
int thr = 0; thr < nThresh; ++thr) {
1660 const int hit = (
val >> (nBits*thr)) &
mask;
1669 int val,
int nThresh,
int nBits,
int offset)
1672 const int mask = (1 << nBits) - 1;
1673 for (
int thr = 0; thr < nThresh; ++thr) {
1674 const int hit = (
val >> (nBits*thr)) &
mask;
1686 unsigned int ix = 0;
1687 unsigned int iy = 0;
1701 histFrom->
getSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY);
1702 histTo->
setSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY);
1714 for (
int ix = 1; ix <=
xbins; ++ix) {
1715 for (
int iy = 1; iy <=
ybins; ++iy) {
1717 double contentOut = 0.;
1718 double errorOut = 0.;
1721 const double contentIn = contentOut*
entries;
1723 + contentOut*contentOut*
entries);
1737 histFrom->
getSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY,
1739 histTo->
setSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY,
1788 if (eta < -3.2 || eta > 3.2) {
1790 phiMod = floor(phiMod/2)*2. + 1.;
1815 if (
eta > 3.8 &&
eta < 4.0) {
1828 if (eta < -3.2 || eta > 3.2) {
1853 phiMod = floor(phiMod/4)*4. + 2.;
1858 }
else if (
absEta > 2.5) {
1864 phiMod = floor(phiMod/2)*2. + 1.;
1893 phiMod = floor(phiMod/4)*4. + 2.;
1898 }
else if (
absEta > 2.5) {
1904 phiMod = floor(phiMod/2)*2. + 1.;
1932 }
else if (
absEta > 2.5) {
1952 }
else if (
absEta > 2.5) {
1962 double eta,
double phi,
int& binx,
int& biny)
1965 if (eta < -2.5 || eta > 2.5) phiMod += 0.5;
1972 }
else if (
absEta > 2.5) {
1978 biny =
hist->GetYaxis()->FindBin(phiMod);
1984 double eta,
double phi,
int& binx,
int& biny)
1995 if (binx <= 4 || binx >= 63) nbin = 4;
1996 else if (binx <= 8 || binx >= 59) nbin = 2;
1997 const int binyBase = ((biny-1)/nbin)*nbin+1;
1998 for (
int i = 0;
i < nbin; ++
i) {
2027 unsigned int ix = 0;
2028 unsigned int iy = 0;
2031 hist->resetActiveBinLoop();
2035 }
else hist->SetBinError(1, 1, 0.);
2036 hist->setSums(0., 0., 0., 0., 0., 0., 0.);
2049 const double OneSigOneSided = 0.159;
2050 int nbins = hist3->GetNbinsX() + 2;
2051 if (hist3->GetDimension() == 2)
nbins *= (hist3->GetNbinsY() + 2);
2054 if (
denom == 0.)
continue;
2057 if (
eff == 0. ||
eff > 0.99) {
2065 hist3->SetEntries(
hist1->GetEntries());
2066 if (hist3->GetDimension() == 1) {
2067 hist3->SetMinimum(0.);
2068 hist3->SetMaximum(110.);