319 nutools::dbi::Table YZCorrTable;
321 YZCorrTable.SetDetector(
"pdunesp");
322 YZCorrTable.SetTableName(
"distcorryz");
323 YZCorrTable.SetTableType(nutools::dbi::kConditionsTable);
324 YZCorrTable.SetDataTypeMask(nutools::dbi::kDataOnly);
326 YZCorrTable.SetDataTypeMask(nutools::dbi::kMCOnly);
328 int corrIdx = YZCorrTable.AddCol(
"corr",
"double");
329 int corrErrIdx = YZCorrTable.AddCol(
"corr_err",
"double");
330 int yIdx = YZCorrTable.AddCol(
"y",
"double");
332 int zIdx = YZCorrTable.AddCol(
"z",
"double");
339 YZCorrTable.SetVerbosity(100);
345 readOk = YZCorrTable.Load();
348 mf::LogError(
"XYZCalibProtoDUNE") <<
"Load from yz calib database table failed.";
352 if (YZCorrTable.NRow() == 0) {
353 mf::LogError(
"XYZCalibProtoDUNE") <<
"Number of rows in yz calib table is 0. This should never be the case!";
357 nutools::dbi::Row*
row;
359 std::vector<int> planeVec;
361 std::map<int,std::vector<YZCorr_t> > fYZCorr;
363 for (
int i=0; i<YZCorrTable.NRow(); ++i) {
364 row = YZCorrTable.GetRow(i);
365 chan = row->Channel();
366 int plane = chan/10000000;
367 int side = (chan-plane*10000000)/1000000;
368 int chanId = plane*10+side;
371 row->Col(yIdx).Get(yzcorr.y);
373 row->Col(zIdx).Get(yzcorr.z);
375 row->Col(corrIdx).Get(yzcorr.corr);
376 row->Col(corrErrIdx).Get(yzcorr.corr_err);
378 if (fYZCorr.find(chanId) == fYZCorr.end())
379 planeVec.push_back(chanId);
381 fYZCorr[chanId].push_back(yzcorr);
395 for (
unsigned int i=0; i<planeVec.size(); ++i) {
396 int ip = planeVec[i];
397 std::sort(fYZCorr[ip].
begin(),fYZCorr[ip].
end());
399 ymin = fYZCorr[ip][0].y;
400 zmin = fYZCorr[ip][0].z;
401 ymax = fYZCorr[ip][fYZCorr[ip].size()-1].y;
402 zmax = fYZCorr[ip][fYZCorr[ip].size()-1].z;
404 for (
unsigned j=1; j<fYZCorr[ip].size(); ++j, ++nbinsz)
405 if (fYZCorr[ip][j].
z < fYZCorr[ip][j-1].
z)
break;
406 nbinsy =
int(fYZCorr[ip].
size())/++nbinsz;
407 bwz = (zmax-zmin)/(nbinsz-1);
408 bwy = (ymax-ymin)/(nbinsy-1);
411 sprintf(hname,
"yzCorrHist_%d",i);
412 fYZCorrHist[ip] = TH2F(hname,
"",nbinsz,zmin-bwz/2,zmax+bwz/2,
413 nbinsy,ymin-bwy/2,ymax+bwy/2);
416 for (
unsigned int j=0; j<fYZCorr[ip].size(); ++j)
417 fYZCorrHist[ip].Fill(fYZCorr[ip][j].
z,fYZCorr[ip][j].
y,fYZCorr[ip][j].corr);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::string fYZCorrFileName
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::map< int, TH2F > fYZCorrHist
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
QTextStream & endl(QTextStream &s)