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();
141 std::vector<SiPixelTemplateStore> thePixelTemp_;
142 std::shared_ptr<SiPixelTemplateDBObject>
payload = fetchPayload(std::get<1>(iov));
147 <<
"\nERROR: Templates not filled correctly. Check the conditions. Using " 148 "SiPixelTemplateDBObject version " 149 <<
payload->version() <<
"\n\n";
154 std::map<int, header_info> theInfos;
155 for (
const auto& theTemp : thePixelTemp_) {
157 info.ID = theTemp.head.ID;
158 info.lorywidth = theTemp.head.lorywidth;
159 info.lorxwidth = theTemp.head.lorxwidth;
160 info.lorybias = theTemp.head.lorybias;
161 info.lorxbias = theTemp.head.lorxbias;
162 info.Vbias = theTemp.head.Vbias;
163 info.temperature = theTemp.head.temperature;
164 info.templ_version = theTemp.head.templ_version;
165 info.Bfield = theTemp.head.Bfield;
166 info.xsize = theTemp.head.xsize;
167 info.ysize = theTemp.head.ysize;
168 info.zsize = theTemp.head.zsize;
170 theInfos[theTemp.head.ID] =
info;
176 theMaps.resetOption(
"COLZA L");
178 theMaps.resetOption(
"COLZL");
182 theMaps.bookBarrelHistograms(
"templateLABarrel",
"#muH",
"#mu_{H} [1/T]");
184 theMaps.bookForwardHistograms(
"templateLAForward",
"#muH",
"#mu_{H} [1/T]");
186 theMaps.bookBarrelHistograms(
"templateLA",
"#muH",
"#mu_{H} [1/T]");
187 theMaps.bookForwardHistograms(
"templateLA",
"#muH",
"#mu_{H} [1/T]");
190 <<
" un-recognized detector type " << myType << std::endl;
194 std::map<unsigned int, short> templMap =
payload->getTemplateIDs();
197 <<
"There are " << templMap.size()
198 <<
" DetIds in this payload. SiPixelTempate Lorentz Angle maps are not supported for non-Phase1 Pixel " 200 TCanvas
canvas(
"Canv",
"Canv", 1200, 1000);
208 <<
"\n ********* WARNING! ********* \n There are " << templMap.size() <<
" DetIds in this payload !" 209 <<
"\n **************************** \n";
213 for (
auto const&
entry : templMap) {
214 templ.interpolate(
entry.second, 0.f, 0.f, 1.f, 1.f);
217 float uH = templ.lorxwidth() / theInfos[
entry.second].zsize / theInfos[
entry.second].Bfield;
218 COUT <<
"uH: " << uH <<
" lor x width:" << templ.lorxwidth() <<
" z size: " << theInfos[
entry.second].zsize
219 <<
" B-field: " << theInfos[
entry.second].Bfield << std::endl;
224 theMaps.fillBarrelBin(
"templateLA",
entry.first, uH);
227 theMaps.fillForwardBin(
"templateLA",
entry.first, uH);
230 theMaps.fillBarrelBin(
"templateLABarrel",
entry.first, uH);
232 theMaps.fillForwardBin(
"templateLAForward",
entry.first, uH);
236 theMaps.beautifyAllHistograms();
240 theMaps.drawBarrelMaps(
"templateLABarrel",
canvas);
242 theMaps.drawForwardMaps(
"templateLAForward",
canvas);
244 theMaps.drawSummaryMaps(
"templateLA",
canvas);
248 TPaveText ksPt(0, 0, 0.88, 0.04,
"NDC");
249 ksPt.SetBorderSize(0);
250 ksPt.SetFillColor(0);
251 const char* textToAdd = Form(
"Template Tag: #color[2]{%s}, IOV: #color[2]{%s}. Payload hash: #color[2]{%s}",
254 (std::get<1>(iov)).c_str());
255 ksPt.AddText(textToAdd);
266 using SiPixelTemplateLABPixMap = SiPixelTemplateLA<SiPixelPI::t_barrel>;
267 using SiPixelTemplateLAFPixMap = SiPixelTemplateLA<SiPixelPI::t_forward>;
268 using SiPixelTemplateLAMap = SiPixelTemplateLA<SiPixelPI::t_all>;
275 using SiPixelTemplateIDsFullPixelMap =
281 using SiPixelTemplateTitles_Display =
static const unsigned int phase0size
Log< level::Error, false > LogError
static std::string to_string(const XMLCh *ch)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
static const unsigned int phase1size
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
void displayNotSupported(TCanvas &canv, const unsigned int size)
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
Log< level::Warning, false > LogWarning