34 #include "TProfile2D.h"
45 #include "TPaveStats.h"
55 class SiPixelTemplateDBObjectTest :
public Histogram1D<SiPixelTemplateDBObject, SINGLE_IOV> {
57 SiPixelTemplateDBObjectTest()
59 "SiPixelTemplateDBObject test",
"SiPixelTemplateDBObject test", 10, 0.0, 100.) {}
61 bool fill()
override {
62 auto tag = PlotBase::getTag<0>();
63 for (
auto const& iov :
tag.iovs) {
64 std::vector<SiPixelTemplateStore> thePixelTemp_;
65 std::shared_ptr<SiPixelTemplateDBObject>
payload = Base::fetchPayload(std::get<1>(iov));
69 <<
"\nERROR: Templates not filled correctly. Check the conditions. Using "
70 "SiPixelTemplateDBObject version "
71 <<
payload->version() <<
"\n\n";
76 for (
const auto& theTemp : thePixelTemp_) {
78 <<
"Template ID = " << theTemp.head.ID <<
", Template Version " << theTemp.head.templ_version
79 <<
", Bfield = " << theTemp.head.Bfield <<
", NTy = " << theTemp.head.NTy
80 <<
", NTyx = " << theTemp.head.NTyx <<
", NTxx = " << theTemp.head.NTxx
81 <<
", Dtype = " << theTemp.head.Dtype <<
", Bias voltage " << theTemp.head.Vbias
82 <<
", temperature " << theTemp.head.temperature <<
", fluence " << theTemp.head.fluence
83 <<
", Q-scaling factor " << theTemp.head.qscale <<
", 1/2 multi dcol threshold "
84 << theTemp.head.s50 <<
", 1/2 single dcol threshold " << theTemp.head.ss50 <<
", y Lorentz Width "
85 << theTemp.head.lorywidth <<
", y Lorentz Bias " << theTemp.head.lorybias <<
", x Lorentz width "
86 << theTemp.head.lorxwidth <<
", x Lorentz Bias " << theTemp.head.lorxbias
87 <<
", Q/Q_avg fractions for Qbin defs " << theTemp.head.fbin[0] <<
", " << theTemp.head.fbin[1]
88 <<
", " << theTemp.head.fbin[2] <<
", pixel x-size " << theTemp.head.xsize <<
", y-size "
89 << theTemp.head.ysize <<
", zsize " << theTemp.head.zsize <<
"\n"
93 std::map<unsigned int, short> templMap =
payload->getTemplateIDs();
94 for (
auto const&
entry : templMap) {
96 templ.interpolate(
entry.second, 0.f, 0.f, 1.f, 1.f);
98 std::cout <<
"\t lorywidth " << templ.lorywidth() <<
" lorxwidth: " << templ.lorxwidth() <<
" lorybias "
99 << templ.lorybias() <<
" lorxbias: " << templ.lorxbias() <<
"\n"
114 template <SiPixelPI::DetType myType>
115 class SiPixelTemplateLA :
public PlotImage<SiPixelTemplateDBObject, SINGLE_IOV> {
134 bool fill()
override {
135 gStyle->SetPalette(kRainBow);
136 TGaxis::SetMaxDigits(2);
138 auto tag = PlotBase::getTag<0>();
139 auto iov =
tag.iovs.front();
140 std::vector<SiPixelTemplateStore> thePixelTemp_;
141 std::shared_ptr<SiPixelTemplateDBObject>
payload = fetchPayload(std::get<1>(iov));
146 <<
"\nERROR: Templates not filled correctly. Check the conditions. Using "
147 "SiPixelTemplateDBObject version "
148 <<
payload->version() <<
"\n\n";
153 std::map<int, header_info> theInfos;
154 for (
const auto& theTemp : thePixelTemp_) {
156 info.ID = theTemp.head.ID;
157 info.lorywidth = theTemp.head.lorywidth;
158 info.lorxwidth = theTemp.head.lorxwidth;
159 info.lorybias = theTemp.head.lorybias;
160 info.lorxbias = theTemp.head.lorxbias;
161 info.Vbias = theTemp.head.Vbias;
162 info.temperature = theTemp.head.temperature;
163 info.templ_version = theTemp.head.templ_version;
164 info.Bfield = theTemp.head.Bfield;
165 info.xsize = theTemp.head.xsize;
166 info.ysize = theTemp.head.ysize;
167 info.zsize = theTemp.head.zsize;
169 theInfos[theTemp.head.ID] =
info;
175 theMaps.resetOption(
"COLZA L");
177 theMaps.resetOption(
"COLZL");
181 theMaps.bookBarrelHistograms(
"templateLABarrel",
"#muH",
"#mu_{H} [1/T]");
183 theMaps.bookForwardHistograms(
"templateLAForward",
"#muH",
"#mu_{H} [1/T]");
185 theMaps.bookBarrelHistograms(
"templateLA",
"#muH",
"#mu_{H} [1/T]");
186 theMaps.bookForwardHistograms(
"templateLA",
"#muH",
"#mu_{H} [1/T]");
189 <<
" un-recognized detector type " << myType << std::endl;
193 std::map<unsigned int, short> templMap =
payload->getTemplateIDs();
196 <<
"There are " << templMap.size()
197 <<
" DetIds in this payload. SiPixelTempate Lorentz Angle maps are not supported for non-Phase1 Pixel "
199 TCanvas
canvas(
"Canv",
"Canv", 1200, 1000);
207 <<
"\n ********* WARNING! ********* \n There are " << templMap.size() <<
" DetIds in this payload !"
208 <<
"\n **************************** \n";
212 for (
auto const&
entry : templMap) {
213 templ.interpolate(
entry.second, 0.f, 0.f, 1.f, 1.f);
216 float uH = templ.lorxwidth() / theInfos[
entry.second].zsize / theInfos[
entry.second].Bfield;
217 COUT <<
"uH: " << uH <<
" lor x width:" << templ.lorxwidth() <<
" z size: " << theInfos[
entry.second].zsize
218 <<
" B-field: " << theInfos[
entry.second].Bfield << std::endl;
223 theMaps.fillBarrelBin(
"templateLA",
entry.first, uH);
226 theMaps.fillForwardBin(
"templateLA",
entry.first, uH);
229 theMaps.fillBarrelBin(
"templateLABarrel",
entry.first, uH);
231 theMaps.fillForwardBin(
"templateLAForward",
entry.first, uH);
235 theMaps.beautifyAllHistograms();
239 theMaps.drawBarrelMaps(
"templateLABarrel",
canvas);
241 theMaps.drawForwardMaps(
"templateLAForward",
canvas);
243 theMaps.drawSummaryMaps(
"templateLA",
canvas);
254 using SiPixelTemplateLABPixMap = SiPixelTemplateLA<SiPixelPI::t_barrel>;
255 using SiPixelTemplateLAFPixMap = SiPixelTemplateLA<SiPixelPI::t_forward>;
256 using SiPixelTemplateLAMap = SiPixelTemplateLA<SiPixelPI::t_all>;
263 using SiPixelTemplateIDsFullPixelMap =
269 using SiPixelTemplateTitles_Display =