9 #include <reconstruction/calibration/CDCDedxWireGainAlgorithm.h>
18 #include <TPaveText.h>
42 setDescription(
"A calibration algorithm for CDC dE/dx wire gains");
53 auto ttree = getObjectPtr<TTree>(
"tree");
62 B2FATAL(
"There is no valid payload for CDCDedxBadWires");
65 B2FATAL(
"There is no valid payload for CDCDedxWireGain");
67 std::vector<int>* wire = 0;
68 std::vector<double>* dedxhit = 0;
69 ttree->SetBranchAddress(
"wire", &wire);
70 ttree->SetBranchAddress(
"dedxhit", &dedxhit);
73 std::vector<std::vector<double>> wirededx(14336, std::vector<double>());
74 for (
int i = 0; i < ttree->GetEntries(); ++i) {
76 for (
unsigned int j = 0; j < wire->size(); ++j) {
77 wirededx[wire->at(j)].push_back(dedxhit->at(j));
82 Int_t lBinILayer = 25, hBinILayer = 75;
83 Int_t lBinOLayer = 25, hBinOLayer = 75;
92 for (
unsigned int jwire = 0; jwire < 14336; ++jwire) {
93 for (
unsigned int jdedxhit = 0; jdedxhit < wirededx[jwire].size(); ++jdedxhit) {
94 double ihitdedx = wirededx[jwire][jdedxhit];
95 if (jwire > 0 && jwire < 160 * 8)hILayer->Fill(ihitdedx);
96 else hOLayer->Fill(ihitdedx);
103 TCanvas* ctem =
new TCanvas(
"Layerhisto",
"Inner and Outer Layer dedxhit dist", 900, 400);
106 hILayer->SetFillColor(kYellow);
107 double lowedge = hILayer->GetXaxis()->GetBinLowEdge(lBinILayer);
108 double upedge = hILayer->GetXaxis()->GetBinUpEdge(hBinILayer);
109 hILayer->SetTitle(Form(
"%s, trunc range: %0.02f - %0.02f", hILayer->GetTitle(), lowedge, upedge));
110 hILayer->Draw(
"histo");
111 TH1D* hILayerClone = (TH1D*)hILayer->Clone(Form(
"hILClone_frun%d",
fStartRun));
112 hILayerClone->GetXaxis()->SetRange(lBinILayer, hBinILayer);
113 hILayerClone->SetFillColor(kAzure + 1);
114 hILayerClone->Draw(
"same histo");
116 lowedge = hOLayer->GetXaxis()->GetBinLowEdge(lBinOLayer);
117 upedge = hOLayer->GetXaxis()->GetBinUpEdge(hBinOLayer);
118 hOLayer->SetTitle(Form(
"%s trunc range: %0.02f - %0.02f", hOLayer->GetTitle(), lowedge, upedge));
119 hOLayer->SetFillColor(kYellow);
120 hOLayer->Draw(
"histo");
121 TH1D* hOLayerClone = (TH1D*)hOLayer->Clone(Form(
"hOLClone_frun%d",
fStartRun));
122 hOLayerClone->GetXaxis()->SetRange(lBinOLayer, hBinOLayer);
123 hOLayerClone->SetFillColor(kAzure + 1);
124 hOLayerClone->Draw(
"same histo");
125 ctem->SaveAs(Form(
"cdcdedx_wiregain_layerdists_frun%d.pdf",
fStartRun));
131 TCanvas* ctmp =
new TCanvas(
"tmp",
"tmp", 1200, 1200);
132 std::stringstream psname; psname << Form(
"cdcdedx_wiregain_wiredists_frun%d.pdf[",
fStartRun);
135 ctmp->SetBatch(kTRUE);
136 ctmp->Print(psname.str().c_str());
137 psname.str(
""); psname << Form(
"cdcdedx_wiregain_wiredists_frun%d.pdf",
fStartRun);
141 double iWireTruncMean[14336];
142 for (Int_t jwire = 0; jwire < 14336; jwire++) {
143 iWireTruncMean[jwire] = 1.0;
149 for (
unsigned int jwire = 0; jwire < 14336; ++jwire) {
151 htempPerWire->SetName(Form(
"htempPerWire_%d_run%d", jwire,
fStartRun));
152 htempPerWire->SetTitle(Form(
"dedxhit-dist, wire # = %d (start run: %d);dedxhit;entries", jwire,
fStartRun));
153 for (
unsigned int jdedxhit = 0; jdedxhit < wirededx[jwire].size(); ++jdedxhit) {
154 htempPerWire->Fill(wirededx[jwire][jdedxhit]);
157 double truncMean = 1.0;
158 int startfrom = 1, endat = 1;
160 if (htempPerWire->Integral() <= 50 ||
m_DBBadWires->getBadWireStatus(jwire)) {
162 }
else if (htempPerWire->Integral() > 50 && htempPerWire->Integral() < 1000) {
166 if (jwire < 160 * 8) {
167 startfrom = lBinILayer; endat = hBinILayer;
169 startfrom = lBinOLayer; endat = hBinOLayer;
175 double binweights = 0.0, sumofbc = 0.0;
176 for (
int ibin = startfrom; ibin <= endat; ibin++) {
177 if (htempPerWire->GetBinContent(ibin) > 0) {
178 binweights += (htempPerWire->GetBinContent(ibin) * htempPerWire->GetBinCenter(ibin));
179 sumofbc += htempPerWire->GetBinContent(ibin);
182 if (sumofbc > 0)truncMean = binweights / sumofbc;
183 else truncMean = 1.0;
186 if (truncMean < 0)truncMean = 0.0;
187 iWireTruncMean[jwire] = truncMean;
190 ctmp->cd(jwire % 16 + 1);
191 htempPerWire->SetFillColor(kYellow);
192 htempPerWire->SetTitle(Form(
"%s, rel. #mu_{truc} %0.04f", htempPerWire->GetTitle(), iWireTruncMean[jwire]));
193 htempPerWire->DrawCopy(
"hist");
194 TH1D* htempPerWireClone = (TH1D*)htempPerWire->Clone(Form(
"htempPerWireClone_%d_frun%d", jwire,
fStartRun));
195 htempPerWireClone->GetXaxis()->SetRange(startfrom, endat);
196 htempPerWireClone->SetFillColor(kAzure + 1);
197 htempPerWireClone->Draw(
"same histo");
199 if ((jwire + 1) % 16 == 0)ctmp->Print(psname.str().c_str());
201 htempPerWire->Reset();
206 psname.str(
""); psname << Form(
"cdcdedx_wiregain_wiredists_frun%d.pdf]",
fStartRun);
207 ctmp->Print(psname.str().c_str());
210 TCanvas* cstats =
new TCanvas(
"cstats",
"cstats", 1000, 500);
211 cstats->SetBatch(kTRUE);
212 cstats->Divide(2, 1);
214 auto hestats = getObjectPtr<TH1I>(
"hestats");
216 hestats->SetName(Form(
"hestats_frun%d",
fStartRun));
217 hestats->SetStats(0);
218 hestats->DrawCopy(
"");
221 auto htstats = getObjectPtr<TH1I>(
"htstats");
223 hestats->SetName(Form(
"htstats_frun%d",
fStartRun));
224 htstats->DrawCopy(
"");
225 hestats->SetStats(0);
227 cstats->Print(Form(
"cdcdedx_wiregain_stats_frun%d.pdf",
fStartRun));
233 std::vector<double> dedxTruncmean;
234 for (Int_t jwire = 0; jwire < 14336; jwire++) {
235 dedxTruncmean.push_back(iWireTruncMean[jwire]);
255 B2INFO(
"Saving merged wiregains for (Exp, Run) : (" << expRun.first <<
"," << expRun.second <<
")");
256 for (
unsigned int iwire = 0; iwire < 14336; iwire++) {
258 double rel = dedxTruncmean.at(iwire);
259 if (pre != 0.0)dedxTruncmean.at(iwire) *= (double)
m_DBWireGains->getWireGain(iwire);
260 B2INFO(
"WG for wire [" << iwire <<
"], previous = " << pre <<
", relative = " << rel <<
", merged = " << dedxTruncmean.at(iwire));
263 B2INFO(
"Saving relative wiregains for (Exp, Run) : (" << expRun.first <<
"," << expRun.second <<
")");
266 double layeravg = 1.0;
269 for (
unsigned int iwire = 0; iwire < 14336; iwire++) {
271 if (layeravg != 0.0) {
272 dedxTruncmean.at(iwire) /= layeravg;
280 TCanvas* cLConst =
new TCanvas(
"cLConst",
"cLConst", 1600, 1000);
281 std::stringstream psnameL; psnameL << Form(
"cdcdedx_wiregain_layerconst_frun%d.pdf[",
fStartRun);
282 cLConst->Divide(2, 2);
283 cLConst->SetBatch(kTRUE);
284 cLConst->Print(psnameL.str().c_str());
285 psnameL.str(
""); psnameL << Form(
"cdcdedx_wiregain_layerconst_frun%d.pdf",
fStartRun);
287 TH1D* hWGConst =
new TH1D(Form(
"hWGConst_frun%d",
fStartRun), Form(
"wiregain constant (start run: %d); wire numbers;<dedxhit>",
289 if (
isMergePayload)hWGConst->SetTitle(Form(
"abs-const: %s", hWGConst->GetTitle()));
290 else hWGConst->SetTitle(Form(
"rel-const: %s", hWGConst->GetTitle()));
292 TH1D* hWGConstVar =
new TH1D(Form(
"hWGConstVar_frun%d",
fStartRun), Form(
"wiregain variation (start run: %d); wire gains; nentries",
294 if (
isMergePayload)hWGConstVar->SetTitle(Form(
"abs-const: %s", hWGConstVar->GetTitle()));
295 else hWGConstVar->SetTitle(Form(
"rel-const: %s", hWGConstVar->GetTitle()));
297 std::ofstream fBadWG;
298 fBadWG.open(Form(
"cdcdedx_wiregain_badwire_frun%d.txt",
fStartRun));
300 std::ofstream fDeadWG_New;
301 fDeadWG_New.open(Form(
"cdcdedx_wiregain_deadwire_frun%d_new.txt",
fStartRun));
303 std::ofstream fDeadWG_Old;
304 fDeadWG_Old.open(Form(
"cdcdedx_wiregain_deadwire_frun%d_old.txt",
fStartRun));
306 int toWire = 0, countwire = 0;
307 int cnewdeadwires = 0, colddeadwires = 0, cbadwires = 0;
308 for (
int iLayer = 0; iLayer < 56; iLayer++) {
310 int iSuperLayer = (iLayer - 2) / 6;
311 if (iSuperLayer <= 0)iSuperLayer = 1;
312 int nWireiLayer = 160 + (iSuperLayer - 1) * 32;
314 int fromWire = countwire;
315 toWire = toWire + nWireiLayer;
317 TH1D* hLayerConst =
new TH1D(Form(
"hWireConst_L%d_frun%d", iLayer,
fStartRun),
"blah-blah", nWireiLayer, fromWire * 1.0,
319 if (
isMergePayload)hLayerConst->SetTitle(Form(
"abs-const: Layer = %d (start run: %d); wire numbers;<dedxhit>", iLayer,
fStartRun));
320 else hLayerConst->SetTitle(Form(
"rel-const: Layer = %d (start run: %d); wire numbers;<dedxhit>", iLayer,
fStartRun));
322 int iwire = 0, cnewdeadLwires = 0, colddeadLwires = 0, cbadLwires = 0;
323 for (
int jwire = fromWire; jwire < toWire; jwire++) {
328 hLayerConst->SetBinContent(iwire, dedxTruncmean.at(jwire));
329 if (iLayer < 32 && (iwire % 10 == 0))hLayerConst->GetXaxis()->SetBinLabel(iwire, Form(
"w%d", jwire));
330 else if (iLayer >= 32 && (iwire % 15 == 0))hLayerConst->GetXaxis()->SetBinLabel(iwire, Form(
"w%d", jwire));
332 hWGConstVar->Fill(dedxTruncmean.at(jwire));
333 hWGConst->SetBinContent(countwire, dedxTruncmean.at(jwire));
339 fBadWG << jwire <<
"\n";
343 if (dedxTruncmean.at(jwire) == 0 && !
m_DBBadWires->getBadWireStatus(jwire)) {
346 fDeadWG_New << jwire <<
"\n";
353 fDeadWG_Old << jwire <<
"\n";
356 if ((countwire) % 500 == 0)hWGConst->GetXaxis()->SetBinLabel(countwire, Form(
"w%d", countwire));
359 cLConst->cd(iLayer % 4 + 1);
360 gStyle->SetOptStat(
"ne");
361 double fraclbad = (100.0 * (cnewdeadLwires + cbadLwires)) / nWireiLayer;
362 if (
isLayerScale)hLayerConst->SetTitle(Form(
"%s, avg = %0.04f, nDeadwires = %d->%d(%0.02f%%)", hLayerConst->GetTitle(),
363 flayerAvg.at(iLayer) / layeravg, colddeadLwires + cbadLwires, cnewdeadLwires + cbadLwires, fraclbad));
364 else hLayerConst->SetTitle(Form(
"%s, nDeadwires = %d->%d(%0.02f%%)", hLayerConst->GetTitle(), colddeadLwires + cbadLwires,
365 cnewdeadLwires + cbadLwires,
367 if (iLayer < 8)hLayerConst->GetYaxis()->SetRangeUser(-0.1, 4.0);
368 else hLayerConst->GetYaxis()->SetRangeUser(-0.1, 2.0);
369 hLayerConst->SetFillColorAlpha(kAzure, 0.10);
370 hLayerConst->LabelsOption(
"u",
"X");
371 hLayerConst->DrawCopy(
"hist");
373 TLine* tlc =
new TLine();
374 tlc->SetLineColor(kRed);
375 tlc->SetX1(fromWire); tlc->SetX2(toWire);
376 tlc->SetY1(
flayerAvg.at(iLayer) / layeravg); tlc->SetY2(
flayerAvg.at(iLayer) / layeravg);
377 tlc->DrawClone(
"same");
380 if ((iLayer + 1) % 4 == 0)cLConst->Print(psnameL.str().c_str());
381 hLayerConst->Reset();
385 psnameL.str(
""); psnameL << Form(
"cdcdedx_wiregain_layerconst_frun%d.pdf]",
fStartRun);
386 cLConst->Print(psnameL.str().c_str());
389 TCanvas* cConst =
new TCanvas(
"cConst",
"cConst", 900, 500);
392 hWGConst->LabelsOption(
"u",
"X");
393 hWGConst->GetYaxis()->SetRangeUser(-0.1, hWGConst->GetMaximum() * 1.05);
394 double fracabad = (100.0 * (cnewdeadwires + cbadwires)) / 14336.0;
395 if (
isMergePayload)hWGConst->SetTitle(Form(
"merged %s, nDeadwires = %d->%d (%0.02f%%)", hWGConst->GetTitle(),
396 colddeadwires + cbadwires,
397 cnewdeadwires + cbadwires, fracabad));
398 else hWGConst->SetTitle(Form(
"relative %s, nDeadwires = %d->%d (%0.02f%%)", hWGConst->GetTitle(), colddeadwires + cbadwires,
399 cnewdeadwires + cbadwires,
402 hWGConst->LabelsDeflate();
404 cConst->SaveAs(Form(
"cdcdedx_wiregain_allconstants_frun%d.pdf",
fStartRun));
407 TCanvas* cConstvar =
new TCanvas(
"cConstvar",
"cConstvar", 500, 400);
409 if (
isMergePayload)hWGConstVar->SetTitle(Form(
"merged %s, nDeadwires = %d->%d (%0.02f%%)", hWGConstVar->GetTitle(),
410 colddeadwires + cbadwires,
411 cnewdeadwires + cbadwires,
413 else hWGConstVar->SetTitle(Form(
"relative %s, bad wire = %d->%d (%0.02f)", hWGConstVar->GetTitle(), colddeadwires + cbadwires,
414 cnewdeadwires + cbadwires,
417 hWGConstVar->SetFillColorAlpha(kAzure, 0.10);
418 hWGConstVar->Draw(
"");
419 cConstvar->SaveAs(Form(
"cdcdedx_wiregain_constantsvar_frun%d.pdf",
fStartRun));
430 B2INFO(
"dE/dx Calibration done for " << dedxTruncmean.size() <<
" CDC wires");
439 double TotalInt = htemp->Integral();
440 if (TotalInt <= 0 || htemp->GetNbinsX() <= 0) {
441 binlow = 1.0; binhigh = 1.0;
444 binlow = 1.0; binhigh = 1.0;
445 double sumPer5 = 0.0, sumPer75 = 0.0;
446 for (
int ibin = 1; ibin <= htemp->GetNbinsX(); ibin++) {
448 if (sumPer5 <=
fTrucMin * TotalInt) {
449 sumPer5 += htemp->GetBinContent(ibin);
453 if (sumPer75 <=
fTrucMax * TotalInt) {
454 sumPer75 += htemp->GetBinContent(ibin);
464 double jLayerMeanAvg = 0.0, OutLayerMeanSum = 0.0;
466 int countwire = 0, OutActLayer = 0;
468 TH1D* hLayerAvg =
new TH1D(Form(
"hLayerAvg_frun%d",
fStartRun),
469 Form(
"Layer vs trunc mean avg (star run: %d); layer numbers;<dedxhit>",
fStartRun), 56, -0.5, 55.5);
471 for (
int iLayer = 0; iLayer < 56; iLayer++) {
473 int iSuperLayer = (iLayer - 2) / 6;
474 if (iSuperLayer <= 0)iSuperLayer = 1;
475 int nWireiLayer = 160 + (iSuperLayer - 1) * 32;
477 int fromWire = countwire;
478 toWire = toWire + nWireiLayer;
480 double jLayerMeanSum = 0.0;
481 int jLayerActWires = 0;
482 std::cout <<
"iLayer = " << iLayer <<
", from wire = " << fromWire <<
", to wire = " << toWire << std::endl;
483 for (
int jwire = fromWire; jwire < toWire; jwire++) {
485 if (tempWire.at(jwire) > 0.) {
486 jLayerMeanSum += tempWire.at(jwire);
491 if (jLayerActWires > 0)jLayerMeanAvg = jLayerMeanSum / jLayerActWires;
492 else jLayerMeanAvg = 0.0;
495 hLayerAvg->SetBinContent(iLayer + 1, jLayerMeanAvg);
496 if ((iLayer + 1) % 2 == 0)hLayerAvg->GetXaxis()->SetBinLabel(iLayer + 1, Form(
"L%d", iLayer));
497 std::cout <<
" \t --> sum = " << jLayerMeanSum <<
", active wires = " << jLayerActWires
498 <<
", average = " << jLayerMeanAvg << std::endl;
500 if (iLayer >= 8 && jLayerMeanAvg > 0.0) {
501 OutLayerMeanSum += jLayerMeanAvg;
506 double OutLayerMeanAvg = 1.0;
507 if (OutActLayer > 0) OutLayerMeanAvg = OutLayerMeanSum / OutActLayer;
510 TCanvas* cLAvg =
new TCanvas(
"clayerAvg",
"clayerAvg", 800, 500);
513 gStyle->SetOptStat(
"ne");
514 hLayerAvg->LabelsOption(
"u",
"X");
515 hLayerAvg->SetLineColor(kBlue);
516 hLayerAvg->GetYaxis()->SetRangeUser(-0.1, hLayerAvg->GetMaximum() * 1.20);
517 if (
isMergePayload)hLayerAvg->SetTitle(Form(
"%s, avg = %0.04f (abs)", hLayerAvg->GetTitle(), OutLayerMeanAvg));
518 else hLayerAvg->SetTitle(Form(
"%s, avg = %0.04f (rel)", hLayerAvg->GetTitle(), OutLayerMeanAvg));
519 hLayerAvg->LabelsDeflate();
521 TLine* tl =
new TLine();
522 tl->SetLineColor(kRed);
523 tl->SetX1(-0.5); tl->SetX2(55.5);
524 tl->SetY1(OutLayerMeanAvg); tl->SetY2(OutLayerMeanAvg);
525 tl->DrawClone(
"same");
526 cLAvg->SaveAs(Form(
"cdcdedx_wiregain_layeravg_frun%d.pdf",
fStartRun));
529 return OutLayerMeanAvg;
535 TCanvas* cCDCWires =
new TCanvas(Form(
"cCDCWires_frun%d",
fStartRun),
"CDC dE/dx bad wire status", 800, 800);
537 hxyAll->SetMarkerStyle(20);
538 hxyAll->SetMarkerSize(0.2);
539 hxyAll->SetMarkerColor(kGray);
546 hxyBad->SetTitle(
"");
547 hxyBad->SetMarkerStyle(20);
548 hxyBad->SetMarkerSize(0.3);
549 hxyBad->SetMarkerColor(kBlue);
551 hxyBad->Draw(
"same");
556 hxyOldDead->SetTitle(
"");
557 hxyOldDead->SetMarkerStyle(20);
558 hxyOldDead->SetMarkerSize(0.3);
559 hxyOldDead->SetMarkerColor(kBlack);
560 hxyOldDead->SetStats(0);
561 hxyOldDead->Draw(
"same");
566 hxyNewDead->SetTitle(
"");
567 hxyNewDead->SetMarkerStyle(20);
568 hxyNewDead->SetMarkerSize(0.25);
569 hxyNewDead->SetMarkerColor(kRed);
570 hxyNewDead->SetStats(0);
571 hxyNewDead->Draw(
"same");
574 auto legend =
new TLegend(0.72, 0.80, 0.90, 0.92);
575 legend->SetBorderSize(0);
576 legend->SetLineWidth(3);
577 legend->SetHeader(Form(
"Total Bad: %d (~%0.02f%%)", nDeadwires + Badwires, 100.*(nDeadwires + Badwires) / 14336.0));
578 legend->AddEntry(hxyBad, Form(
"badadc %d" , Badwires),
"p");
579 legend->AddEntry(hxyOldDead, Form(
"olddead %d" , oDeadwires),
"p");
580 legend->AddEntry(hxyNewDead, Form(
"newdead %d" , nDeadwires),
"p");
583 gStyle->SetLegendTextSize(0.025);
584 TPaveText* pt =
new TPaveText(-0.30993, -1.470968, -0.3102707, -1.304516,
"br");
586 pt->SetFillStyle(3001);
589 pt->SetTextSize(0.02258064);
590 TText* t1 = pt->AddText(
"CDC-wire map: counter-clockwise and start from +x");
591 t1->SetTextColor(kGray + 1);
594 cCDCWires->SaveAs(Form(
"cdcdedx_wiregain_wirestatus_frun%d.pdf",
fStartRun));
601 int wire, nwire, twire;
602 double radius, phi, x, y;
604 std::ifstream infile;
605 infile.open(Form(
"%s", badFileName.Data()));
607 TH2F* temp =
new TH2F(Form(
"temp_%s_frun%d", suffix.Data(),
fStartRun), Form(
"wire status (start run: %d)",
fStartRun), 2400, -1.2,
608 1.2, 2400, -1.2, 1.2);
609 if (!infile.fail()) {
611 while (infile >> bwires) {
615 wire = bwires - twire ;
616 phi = 2.*TMath::Pi() * (float(wire) / float(nwire));
617 x = radius * cos(phi);
618 y = radius * sin(phi);
622 for (
int iwires = 0; iwires < 14336; iwires++) {
626 wire = iwires - twire ;
627 phi = 2.*TMath::Pi() * (float(wire) / float(nwire));
628 x = radius * cos(phi);
629 y = radius * sin(phi);
640 16.80, 17.80, 18.80, 19.80, 20.80, 21.80, 22.80, 23.80,
641 25.70, 27.52, 29.34, 31.16, 32.98, 34.80,
642 36.52, 38.34, 40.16, 41.98, 43.80, 45.57,
643 47.69, 49.46, 51.28, 53.10, 54.92, 56.69,
644 58.41, 60.18, 62.00, 63.82, 65.64, 67.41,
645 69.53, 71.30, 73.12, 74.94, 76.76, 78.53,
646 80.25, 82.02, 83.84, 85.66, 87.48, 89.25,
647 91.37, 93.14, 94.96, 96.78, 98.60, 100.37,
648 102.09, 103.86, 105.68, 107.50, 109.32, 111.14
651 Int_t totalWireiLayer = 0 ;
653 for (Int_t iLayer = 0; iLayer < 56; iLayer++) {
654 int iSuperLayer = (iLayer - 2) / 6;
655 if (iSuperLayer <= 0)iSuperLayer = 1;
656 int nWireiLayer = 160 + (iSuperLayer - 1) * 32;
657 totalWireiLayer += nWireiLayer;
659 if (iWire < totalWireiLayer) {
660 if (what ==
"layer")myreturn = iLayer;
661 else if (what ==
"nwirelayer") myreturn = nWireiLayer;
662 else if (what ==
"twire") myreturn = totalWireiLayer - nWireiLayer;
663 else if (what ==
"rwire") myreturn = r[iLayer] / 100.;
664 else std::cout <<
"Invalid return :0 " << std::endl;
bool isLayerScale
method of scaling layer avg
double fTrucMax
max trunc range for mean
double getLayerAverage(std::vector< double > tempWire)
function to get layer avg from outer layers
TH2F * getHistoPattern(TString badFileName, TString suffix)
function to plot wires in hist with input file
int fStartRun
boundary start at this run
double fdEdxMax
max dedx range for wiregain cal
bool isMergePayload
merge payload at the of calibration
bool isLTruc
method of trunc range for mean
DBObjPtr< CDCDedxBadWires > m_DBBadWires
Bad wire DB object.
std::vector< double > flayerAvg
layer wire avg of trun mean
CDCDedxWireGainAlgorithm()
Constructor: Sets the description, the properties and the parameters of the algorithm.
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
double fTrucMin
min trunc range for mean
double getIndexVal(int iWire, TString what)
function to return various CDC indexing for given wire
virtual EResult calibrate() override
Wire gain algorithm.
double fdEdxMin
min dedx range for wiregain cal
void getTrucationBins(TH1D *htemp, int &binlow, int &binhigh)
function to get bins of trunction from histogram
int fdEdxBins
number of bins for dedx histogram
bool isMakePlots
produce plots for status
void plotBadWires(int nDeadwires, int oDeadwires, int Badwires)
function to plot bad wire status (then and now)
void generateNewPayloads(std::vector< double > dedxTruncmean)
function to finally store new payload after full calibration
dE/dx wire gain calibration constants
Base class for calibration algorithms.
void saveCalibration(TClonesArray *data, const std::string &name)
Store DBArray payload with given name with default IOV.
void updateDBObjPtrs(const unsigned int event, const int run, const int experiment)
Updates any DBObjPtrs by calling update(event) for DBStore.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
EResult
The result of calibration.
@ c_OK
Finished successfuly =0 in Python.
@ c_NotEnoughData
Needs more data =2 in Python.
const std::vector< Calibration::ExpRun > & getRunList() const
Get the list of runs for which calibration is called.
Abstract base class for different kinds of events.