22 enum {kESChannels = 137216};
23 enum {IX_MIN = 1, IY_MIN = 1, IX_MAX = 40, IY_MAX = 40};
32 ESChannelStatusPlot() :
cond::payloadInspector::PlotImage<
ESChannelStatus>(
"ES channel status") {
35 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
37 TH2F*** esmap =
new TH2F**[2];
39 for (
int plane = 0; plane < 2; plane++) {
40 esmap[plane] =
new TH2F*[2];
41 for (
int side = 0; side < 2; side++)
42 esmap[plane][side] =
new TH2F(Form(
"esmap%i%i",plane,side),title[plane][side].c_str(), IX_MAX, 0, IX_MAX, IY_MAX, 0, IY_MAX);
46 auto iov = iovs.front();
48 run = std::get<0>(iov);
51 for(
int id = 0;
id < kESChannels;
id++)
54 int side = myESId.
zside();
55 if(side < 0) side = 1;
57 int plane = myESId.
plane() - 1;
58 if(side < 0 || side > 1 || plane < 0 || plane > 1) {
59 std::cout <<
" channel " <<
id <<
" side " << myESId.
zside() <<
" plane " << myESId.
plane() << std::endl;
65 if(myESId.
strip() == 1) {
66 esmap[plane][side]->Fill(myESId.
six() -1, myESId.
siy() -1,
status);
76 gStyle->SetOptStat(0);
77 gStyle->SetPalette(1);
78 TCanvas
canvas(
"CC map",
"CC map",1680,1320);
83 t1.DrawLatex(0.5, 0.96, Form(
"ES Channel Status, IOV %i", run));
84 t1.SetTextSize(0.025);
86 float xmi[2] = {0.0, 0.5};
87 float xma[2] = {0.5, 1.0};
88 TPad*** pad =
new TPad**[2];
89 for (
int plane = 0; plane < 2; plane++) {
90 pad[plane] =
new TPad*[2];
91 for (
int side = 0; side < 2; side++) {
92 float yma = 0.94 - (0.46 * plane);
93 float ymi = yma - 0.44;
94 pad[plane][side] =
new TPad(Form(
"p_%i_%i", plane, side),Form(
"p_%i_%i", plane, side),
95 xmi[side], ymi, xma[side], yma);
96 pad[plane][side]->Draw();
100 for (
int side = 0; side < 2; side++) {
101 for (
int plane = 0; plane < 2; plane++) {
102 pad[plane][side]->cd();
103 esmap[plane][side]->Draw(
"colz1");
108 t1.SetTextSize(0.025);
109 int Nbdead = escount * 32;
113 t1.DrawLatex(0.5, 0.92, Form(
"Number of dead strips %i", Nbdead));
116 canvas.SaveAs(ImageName.c_str());
127 ESChannelStatusDiff() :
cond::payloadInspector::PlotImage<
ESChannelStatus>(
"ES channel status difference") {
130 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
131 TH2F*** esmap =
new TH2F**[2];
132 std::string title[2][2] = {{
"ES+F",
"ES-F"},{
"ES+R",
"ES-R"}};
133 for (
int plane = 0; plane < 2; plane++) {
134 esmap[plane] =
new TH2F*[2];
135 for (
int side = 0; side < 2; side++)
136 esmap[plane][side] =
new TH2F(Form(
"esmap%i%i",plane,side),title[plane][side].c_str(), IX_MAX, 0, IX_MAX, IY_MAX, 0, IY_MAX);
139 unsigned int run[2], irun = 0;
140 int stat[kESChannels];
141 for (
auto const & iov: iovs) {
142 std::shared_ptr<ESChannelStatus> payload = fetchPayload( std::get<1>(iov) );
143 run[irun] = std::get<0>(iov);
146 for(
int id = 0;
id < kESChannels;
id++)
154 int side = myESId.
zside();
155 if(side < 0) side = 1;
157 int plane = myESId.
plane() - 1;
158 if(side < 0 || side > 1 || plane < 0 || plane > 1) {
159 std::cout <<
" channel " <<
id <<
" side " << myESId.
zside() <<
" plane " << myESId.
plane() << std::endl;
162 int diff = status - stat[
id];
164 if(myESId.
strip() == 1) {
165 esmap[plane][side]->Fill(myESId.
six() -1, myESId.
siy() -1,
diff);
175 gStyle->SetOptStat(0);
176 gStyle->SetPalette(1);
177 TCanvas
canvas(
"CC map",
"CC map",1680,1320);
181 t1.SetTextSize(0.05);
182 t1.DrawLatex(0.5, 0.96, Form(
"ES Channel Status, IOV %i - %i", run[1], run[0]));
183 t1.SetTextSize(0.025);
185 float xmi[2] = {0.0, 0.5};
186 float xma[2] = {0.5, 1.0};
187 TPad*** pad =
new TPad**[2];
188 for (
int plane = 0; plane < 2; plane++) {
189 pad[plane] =
new TPad*[2];
190 for (
int side = 0; side < 2; side++) {
191 float yma = 0.94 - (0.46 * plane);
192 float ymi = yma - 0.44;
193 pad[plane][side] =
new TPad(Form(
"p_%i_%i", plane, side),Form(
"p_%i_%i", plane, side),
194 xmi[side], ymi, xma[side], yma);
195 pad[plane][side]->Draw();
199 for (
int side = 0; side < 2; side++) {
200 for (
int plane = 0; plane < 2; plane++) {
201 pad[plane][side]->cd();
202 esmap[plane][side]->Draw(
"colz1");
207 t1.SetTextSize(0.025);
208 int Nbdead = escount * 32;
212 t1.DrawLatex(0.5, 0.92, Form(
"Number of different strips %i", Nbdead));
215 canvas.SaveAs(ImageName.c_str());
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
virtual bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)=0
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
uint16_t getStatusCode() const
void setSingleIov(bool flag)
void DrawES(int plane, int side)
static ESDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
static bool validHashIndex(int hi)