1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
#include "CondCore/Utilities/interface/PayloadInspectorModule.h"
#include "CondCore/Utilities/interface/PayloadInspector.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
#include "CondCore/EcalPlugins/plugins/EcalDrawUtils.h"
// the data format of the condition to be inspected
#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h"
#include "TH2F.h"
#include "TCanvas.h"
#include "TStyle.h"
#include "TLine.h"
#include "TLatex.h"
#include <string>
namespace {
/***********************************************
2d plot of EcalTPGFineGrainTowerEE of 1 IOV
************************************************/
class EcalTPGFineGrainTowerEEPlot : public cond::payloadInspector::PlotImage<EcalTPGFineGrainTowerEE> {
public:
EcalTPGFineGrainTowerEEPlot()
: cond::payloadInspector::PlotImage<EcalTPGFineGrainTowerEE>("EcalTPGFineGrainTowerEE - map ") {
setSingleIov(true);
}
bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override {
TH2F* endc_p = new TH2F("EE+", "EE+ Tower TPG FineGrain", 22, 0, 22, 22, 0, 22);
TH2F* endc_m = new TH2F("EE-", "EE- Tower TPG FineGrain", 22, 0, 22, 22, 0, 22);
auto iov = iovs.front();
std::shared_ptr<EcalTPGFineGrainTowerEE> payload = fetchPayload(std::get<1>(iov));
unsigned int run = std::get<0>(iov);
double minEE = 0, maxEE = 1;
if (payload.get()) {
const EcalTPGFineGrainTowerEEMap& towerMap = (*payload).getMap();
EcalTPGFineGrainTowerEEMapIterator it;
for (it = towerMap.begin(); it != towerMap.end(); ++it) {
if (EcalScDetId::validHashIndex((*it).first)) {
EcalScDetId ttId = EcalScDetId::unhashIndex((*it).first);
int ix = ttId.ix();
int iy = ttId.iy();
int zside = ttId.zside();
uint32_t weight = (uint32_t)((*it).second);
if (zside == -1)
endc_m->Fill(ix, iy, weight);
else
endc_p->Fill(ix, iy, weight);
if (maxEE < weight)
maxEE = weight;
if (minEE > weight)
minEE = weight;
}
} //tower map
} //payload
TCanvas canvas("CC map", "CC map", 800, 800);
TLatex t1;
t1.SetNDC();
t1.SetTextAlign(26);
t1.SetTextSize(0.05);
t1.DrawLatex(0.5, 0.96, Form("Ecal TPGFineGrain Tower EE, IOV %i", run));
TPad* padem = new TPad("padem", "padem", 0., 0.3, 0.45, 0.75);
padem->Draw();
TPad* padep = new TPad("padep", "padep", 0.55, 0.3, 1., 0.75);
padep->Draw();
TLine* l = new TLine(0., 0., 72., 0.);
l->Draw();
padem->cd();
DrawEE_Tower(endc_m, l, minEE, maxEE);
padep->cd();
DrawEE_Tower(endc_p, l, minEE, maxEE);
std::string ImageName(m_imageFileName);
canvas.SaveAs(ImageName.c_str());
return true;
} // fill method
};
} // namespace
// Register the classes as boost python plugin
PAYLOAD_INSPECTOR_MODULE(EcalTPGFineGrainTowerEE) { PAYLOAD_INSPECTOR_CLASS(EcalTPGFineGrainTowerEEPlot); }
|