31 #include <boost/range/adaptor/indexed.hpp>
35 #include "TProfile2D.h"
46 #include "TPaveStats.h"
51 enum MapType { t_barrel = 0, t_forward = 1 };
56 class SiPixelTemplateDBObjectTest
59 SiPixelTemplateDBObjectTest()
61 "SiPixelTemplateDBObject test",
"SiPixelTemplateDBObject test", 10, 0.0, 100.) {}
63 bool fill()
override {
64 auto tag = PlotBase::getTag<0>();
65 for (
auto const& iov :
tag.iovs) {
66 std::vector<SiPixelTemplateStore> thePixelTemp_;
71 <<
"\nERROR: Templates not filled correctly. Check the conditions. Using "
72 "SiPixelTemplateDBObject version "
73 <<
payload->version() <<
"\n\n";
78 for (
const auto& theTemp : thePixelTemp_) {
80 <<
"Template ID = " << theTemp.head.ID <<
", Template Version " << theTemp.head.templ_version
81 <<
", Bfield = " << theTemp.head.Bfield <<
", NTy = " << theTemp.head.NTy
82 <<
", NTyx = " << theTemp.head.NTyx <<
", NTxx = " << theTemp.head.NTxx
83 <<
", Dtype = " << theTemp.head.Dtype <<
", Bias voltage " << theTemp.head.Vbias
84 <<
", temperature " << theTemp.head.temperature <<
", fluence " << theTemp.head.fluence
85 <<
", Q-scaling factor " << theTemp.head.qscale <<
", 1/2 multi dcol threshold "
86 << theTemp.head.s50 <<
", 1/2 single dcol threshold " << theTemp.head.ss50 <<
", y Lorentz Width "
87 << theTemp.head.lorywidth <<
", y Lorentz Bias " << theTemp.head.lorybias <<
", x Lorentz width "
88 << theTemp.head.lorxwidth <<
", x Lorentz Bias " << theTemp.head.lorxbias
89 <<
", Q/Q_avg fractions for Qbin defs " << theTemp.head.fbin[0] <<
", " << theTemp.head.fbin[1]
90 <<
", " << theTemp.head.fbin[2] <<
", pixel x-size " << theTemp.head.xsize <<
", y-size "
91 << theTemp.head.ysize <<
", zsize " << theTemp.head.zsize <<
"\n"
95 std::map<unsigned int, short> templMap =
payload->getTemplateIDs();
96 for (
auto const&
entry : templMap) {
98 templ.interpolate(
entry.second, 0.f, 0.f, 1.f, 1.f);
100 std::cout <<
"\t lorywidth " << templ.lorywidth() <<
" lorxwidth: " << templ.lorxwidth() <<
" lorybias "
101 << templ.lorybias() <<
" lorxbias: " << templ.lorxbias() <<
"\n"
116 class SiPixelTemplateHeaderTable
119 SiPixelTemplateHeaderTable()
121 "SiPixelTemplateDBObject Header summary") {}
123 bool fill()
override {
124 auto tag = PlotBase::getTag<0>();
125 auto iov =
tag.iovs.front();
127 std::vector<SiPixelTemplateStore> thePixelTemp_;
133 <<
"\nERROR: Templates not filled correctly. Check the conditions. Using "
134 "SiPixelTemplateDBObject version "
135 <<
payload->version() <<
"\n\n";
140 TCanvas
canvas(
"Template Header Summary",
"Template Header summary", 1400, 1000);
143 unsigned int tempSize = thePixelTemp_.size();
145 canvas.SetTopMargin(0.07);
146 canvas.SetBottomMargin(0.06);
147 canvas.SetLeftMargin(0.17);
148 canvas.SetRightMargin(0.03);
152 auto h2_TemplateHeaders = std::unique_ptr<TH2F>(
new TH2F(
"Header",
";;", tempSize, 0, tempSize, 6, 0., 6.));
153 h2_TemplateHeaders->SetStats(
false);
155 for (
const auto& theTemp : thePixelTemp_ | boost::adaptors::indexed(1)) {
156 auto tempValue = theTemp.value();
157 auto tempIndex = theTemp.index();
158 float uH = roundoff(tempValue.head.lorxwidth / tempValue.head.zsize / tempValue.head.Bfield, 4);
159 h2_TemplateHeaders->SetBinContent(tempIndex, 6, tempValue.head.ID);
160 h2_TemplateHeaders->SetBinContent(tempIndex, 5, tempValue.head.Bfield);
161 h2_TemplateHeaders->SetBinContent(tempIndex, 4, uH);
162 h2_TemplateHeaders->SetBinContent(tempIndex, 3, tempValue.head.xsize);
163 h2_TemplateHeaders->SetBinContent(tempIndex, 2, tempValue.head.ysize);
164 h2_TemplateHeaders->SetBinContent(tempIndex, 1, tempValue.head.zsize);
165 h2_TemplateHeaders->GetYaxis()->SetBinLabel(6,
"TemplateID");
166 h2_TemplateHeaders->GetYaxis()->SetBinLabel(5,
"B-field [T]");
167 h2_TemplateHeaders->GetYaxis()->SetBinLabel(4,
"#mu_{H} [1/T]");
168 h2_TemplateHeaders->GetYaxis()->SetBinLabel(3,
"x-size [#mum]");
169 h2_TemplateHeaders->GetYaxis()->SetBinLabel(2,
"y-size [#mum]");
170 h2_TemplateHeaders->GetYaxis()->SetBinLabel(1,
"z-size [#mum]");
171 h2_TemplateHeaders->GetXaxis()->SetBinLabel(tempIndex,
"");
174 h2_TemplateHeaders->GetXaxis()->LabelsOption(
"h");
175 h2_TemplateHeaders->GetXaxis()->SetNdivisions(500 + tempSize,
false);
176 h2_TemplateHeaders->GetYaxis()->SetLabelSize(0.05);
177 h2_TemplateHeaders->SetMarkerSize(1.5);
180 h2_TemplateHeaders->Draw(
"TEXT");
184 ltx.SetTextColor(kBlue);
185 ltx.SetTextSize(0.045);
186 ltx.SetTextAlign(11);
187 ltx.DrawLatexNDC(gPad->GetLeftMargin(),
188 1 - gPad->GetTopMargin() + 0.01,
189 (
tagname +
", IOV:" + std::to_string(std::get<0>(iov))).c_str());
197 float roundoff(
float value,
unsigned char prec) {
198 float pow_10 =
pow(10.0
f, (
float)prec);
199 return round(
value * pow_10) / pow_10;
206 template <MapType myType>
207 class SiPixelTemplateLA
227 "SiPixelTemplate assumed value of uH") {}
229 bool fill()
override {
230 gStyle->SetPalette(kRainBow);
231 TGaxis::SetMaxDigits(2);
233 auto tag = PlotBase::getTag<0>();
234 auto iov =
tag.iovs.front();
235 std::vector<SiPixelTemplateStore> thePixelTemp_;
241 <<
"\nERROR: Templates not filled correctly. Check the conditions. Using "
242 "SiPixelTemplateDBObject version "
243 <<
payload->version() <<
"\n\n";
248 std::map<int, header_info> theInfos;
249 for (
const auto& theTemp : thePixelTemp_) {
251 info.ID = theTemp.head.ID;
252 info.lorywidth = theTemp.head.lorywidth;
253 info.lorxwidth = theTemp.head.lorxwidth;
254 info.lorybias = theTemp.head.lorybias;
255 info.lorxbias = theTemp.head.lorxbias;
256 info.Vbias = theTemp.head.Vbias;
257 info.temperature = theTemp.head.temperature;
258 info.templ_version = theTemp.head.templ_version;
259 info.Bfield = theTemp.head.Bfield;
260 info.xsize = theTemp.head.xsize;
261 info.ysize = theTemp.head.ysize;
262 info.zsize = theTemp.head.zsize;
264 theInfos[theTemp.head.ID] =
info;
270 if (myType == t_barrel) {
271 theMaps.bookBarrelHistograms(
"templateLABarrel",
"#muH",
"#mu_{H} [1/T]");
272 theMaps.bookBarrelBins(
"templateLABarrel");
273 }
else if (myType == t_forward) {
274 theMaps.bookForwardHistograms(
"templateLAForward",
"#muH",
"#mu_{H} [1/T]");
275 theMaps.bookForwardBins(
"templateLAForward");
278 std::map<unsigned int, short> templMap =
payload->getTemplateIDs();
281 <<
"SiPixelTempateLA maps are not supported for non-Phase1 Pixel geometries !";
282 TCanvas
canvas(
"Canv",
"Canv", 1200, 1000);
289 for (
auto const&
entry : templMap) {
290 templ.interpolate(
entry.second, 0.f, 0.f, 1.f, 1.f);
293 float uH = templ.lorxwidth() / theInfos[
entry.second].zsize / theInfos[
entry.second].Bfield;
294 COUT <<
"uH: " << uH <<
" lor x width:" << templ.lorxwidth() <<
" z size: " << theInfos[
entry.second].zsize
295 <<
" B-field: " << theInfos[
entry.second].Bfield << std::endl;
299 theMaps.fillBarrelBin(
"templateLABarrel",
entry.first, uH);
301 theMaps.fillForwardBin(
"templateLAForward",
entry.first, uH);
305 theMaps.beautifyAllHistograms();
307 TCanvas
canvas(
"Canv",
"Canv", (myType == t_barrel) ? 1200 : 1600, 1000);
308 if (myType == t_barrel) {
309 theMaps.DrawBarrelMaps(
"templateLABarrel",
canvas);
310 }
else if (myType == t_forward) {
311 theMaps.DrawForwardMaps(
"templateLAForward",
canvas);
322 using SiPixelTemplateLABPixMap = SiPixelTemplateLA<t_barrel>;
323 using SiPixelTemplateLAFPixMap = SiPixelTemplateLA<t_forward>;
328 template <MapType myType>
329 class SiPixelTemplateIDs
334 "SiPixelTemplate ID Values") {}
336 bool fill()
override {
337 gStyle->SetPalette(kRainBow);
339 auto tag = PlotBase::getTag<0>();
340 auto iov =
tag.iovs.front();
346 if (myType == t_barrel) {
347 theMaps.bookBarrelHistograms(
"templateIDsBarrel",
"IDs",
"template IDs");
349 theMaps.bookBarrelBins(
"templateIDsBarrel");
350 }
else if (myType == t_forward) {
351 theMaps.bookForwardHistograms(
"templateIDsForward",
"IDs",
"template IDs");
353 theMaps.bookForwardBins(
"templateIDsForward");
356 std::map<unsigned int, short> templMap =
payload->getTemplateIDs();
359 <<
"SiPixelTempateIDs maps are not supported for non-Phase1 Pixel geometries !";
360 TCanvas
canvas(
"Canv",
"Canv", 1200, 1000);
375 for (
auto const&
entry : templMap) {
376 COUT <<
"DetID: " <<
entry.first <<
" template ID: " <<
entry.second << std::endl;
379 theMaps.fillBarrelBin(
"templateIDsBarrel",
entry.first,
entry.second);
381 theMaps.fillForwardBin(
"templateIDsForward",
entry.first,
entry.second);
385 theMaps.beautifyAllHistograms();
387 TCanvas
canvas(
"Canv",
"Canv", (myType == t_barrel) ? 1200 : 1500, 1000);
388 if (myType == t_barrel) {
389 theMaps.DrawBarrelMaps(
"templateIDsBarrel",
canvas);
390 }
else if (myType == t_forward) {
391 theMaps.DrawForwardMaps(
"templateIDsForward",
canvas);
403 using SiPixelTemplateIDsBPixMap = SiPixelTemplateIDs<t_barrel>;
404 using SiPixelTemplateIDsFPixMap = SiPixelTemplateIDs<t_forward>;