16 #include "TPaveStats.h" 19 #include <boost/algorithm/string/join.hpp> 28 HcalSiPMParametersSummary() :
cond::payloadInspector::PlotImage<
HcalSiPMParameters>(
"HCAL SiPMParameter Summary") {
32 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
35 auto iov = iovs.front();
36 float fcByPE, darkCurrent1, darkCurrent2, tempVal;
42 std::vector<HcalSiPMParameter> itemsVec;
48 std::vector<float>
line;
53 TCanvas* can =
new TCanvas(
"SiPMParametersSummary",
"SiPMParametersSummary", 2000, 1680);
61 label.SetTextAlign(26);
62 label.SetTextSize(0.05);
63 label.SetTextColor(2);
64 label.DrawLatex(0.5, 0.96,Form(
"Hcal SiPM Parameters"));
66 for(std::pair<
std::string, std::vector<HcalSiPMParameter> > cont : (*payload).getAllContainers()){
67 subDetName = std::get<0>(cont);
68 if(subDetName[0] !=
'H' || subDetName ==
"HT")
continue;
69 itemsVec = std::get<1>(cont);
70 type1 = type2 = fcByPE = darkCurrent1 = darkCurrent2 = -1.0;
73 int iphi = detId.
iphi();
74 int ieta = detId.
ieta();
77 if(iphi==0 && ieta==0 && depth==0)
continue;
78 fcByPE = par.getFCByPE();
79 tempVal = par.getDarkCurrent();
80 if(darkCurrent1 == -1.0) {
81 darkCurrent1 = tempVal;
82 type1 = par.getType();
84 else if(darkCurrent2 == -1.0 && par.getType() != type1){
85 darkCurrent2 = tempVal;
86 type2 = par.getType();
91 type1 = darkCurrent1 = 0;
94 darkCurrent2 = darkCurrent1;
100 ll =
new TLine(0,0,0,1);
103 lt =
new TLine(0,1,1,1);
106 lb =
new TLine(0,0,1,0);
109 lr =
new TLine(1,0,1,1);
115 label.SetTextAlign(26);
116 label.SetTextSize(0.15);
117 label.SetTextColor(2);
118 label.DrawLatex(0.5, 0.85, subDetName.c_str());
121 float startPosY = 0.75, endPosY = 0.2;
122 float startPosX = 0.10, endPosX = 0.8;
123 std::vector<float>::iterator linEle;
124 std::vector<std::string>::iterator linStrEle;
128 std::stringstream lbl1, lbl2;
129 lbl1 <<
"(Type " << std::to_string(type1) <<
")";
130 lbl2 <<
"(Type " << std::to_string(type2) <<
")";
131 std::vector<std::string> lblline = {
"fcByPE",
"Dark Current",
"Dark Current"};
132 xDiff = (endPosX - startPosX)/(lblline.size()-1);
133 yDiff = (startPosY - endPosY);
136 label.SetTextAlign(12);
137 label.SetTextSize(0.05);
138 label.SetTextColor(1);
141 for(linStrEle = lblline.begin(); linStrEle != lblline.end(); ++linStrEle) {
142 ll =
new TLine(startPosX + (j+0.5)*xDiff, startPosY, startPosX + (j+0.5)*xDiff, startPosY - 0.5*yDiff);
143 label.DrawLatex(startPosX + (j==0 ? -0.1 : (j-0.4))*xDiff , startPosY - 0.25*yDiff, (*linStrEle).c_str());
144 if(j==1) label.DrawLatex(startPosX + (j==0 ? -0.1 : (j-0.31))*xDiff , startPosY - 0.34*yDiff, (lbl1.str()).c_str());
145 if(j==2) label.DrawLatex(startPosX + (j==0 ? -0.1 : (j-0.31))*xDiff , startPosY - 0.34*yDiff, (lbl2.str()).c_str());
149 ll =
new TLine(0,startPosY, 1, startPosY);
151 ll =
new TLine(0,startPosY - 0.5 * yDiff, 1, startPosY - 0.5 * yDiff);
156 val.SetTextAlign(26);
157 val.SetTextSize(0.055);
158 line = {fcByPE, darkCurrent1, darkCurrent2};
163 for(linEle = line.begin(); linEle != line.end(); ++linEle) {
164 ll =
new TLine(startPosX + (j+0.5)*xDiff, startPosY - 0.5*yDiff, startPosX + (j+0.5)*xDiff, startPosY - 1.5*yDiff);
166 if(j < 2){ ll->Draw(); }
178 can->SaveAs(ImageName.c_str());
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
int depth() const
get the tower depth
int ieta() const
get the cell ieta
virtual bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)=0
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::string SciNotatStr(float num)
int iphi() const
get the cell iphi
void setSingleIov(bool flag)