975 TCanvas *c = fAdcDataCanv->GetCanvas();
977 TH1 *hf =
dynamic_cast<TH1*
>(c->FindObject(
"Frame"));
978 TH1 *h =
dynamic_cast<TH1*
>(c->FindObject(
"EventData"));
979 TH1 *d0 =
dynamic_cast<TH1*
>(c->FindObject(
"DrsCalib0"));
980 TH1 *d1 =
dynamic_cast<TH1*
>(c->FindObject(
"DrsCalib1"));
981 TH1 *d2 =
dynamic_cast<TH1*
>(c->FindObject(
"DrsCalib2"));
985 if ((hf && hf->GetNbinsX()!=roi) ||
986 (dynamic_cast<TH2*>(h) && !fAdcPersistent->isChecked()) ||
987 (!dynamic_cast<TH2*>(h) && fAdcPersistent->isChecked()))
1002 hf =
new TH1F(
"Frame",
"", roi, -0.5, roi-0.5);
1003 hf->SetDirectory(0);
1004 hf->SetBit(kCanDelete);
1005 hf->SetStats(kFALSE);
1006 hf->SetYTitle(
"Voltage [mV]");
1007 hf->GetXaxis()->CenterTitle();
1008 hf->GetYaxis()->CenterTitle();
1009 hf->SetMinimum(-1250);
1010 hf->SetMaximum(2150);
1012 if (!fAdcPersistent->isChecked())
1013 h =
new TH1F(
"EventData",
"", roi, -0.5, roi-0.5);
1016 h =
new TH2F(
"EventData",
"", roi, -0.5, roi-0.5, 6751, -2350.5*2000/4096, 4400.5*2000/4096);
1018 gStyle->SetPalette(1, 0);
1022 h->SetBit(kCanDelete);
1023 h->SetMarkerStyle(kFullDotMedium);
1024 h->SetMarkerColor(
kBlue);
1026 c->GetListOfPrimitives()->Add(hf,
"");
1028 if (dynamic_cast<TH2*>(h))
1029 c->GetListOfPrimitives()->Add(h,
"col same");
1032 if (d0 && !(fDrsCalibBaselineOn->isChecked() && fDrsCalibBaseline->value()>0))
1037 if (d1 && !(fDrsCalibGainOn->isChecked() && fDrsCalibGain->value()>0))
1042 if (d2 && !(fDrsCalibTrgOffsetOn->isChecked() && fDrsCalibTrgOffset->value()>0))
1048 if (!d0 && fDrsCalibBaselineOn->isChecked() && fDrsCalibBaseline->value()>0)
1050 d0 =
new TH1F(
"DrsCalib0",
"", roi, -0.5, roi-0.5);
1051 d0->SetDirectory(0);
1052 d0->SetBit(kCanDelete);
1053 d0->SetMarkerStyle(kFullDotSmall);
1054 d0->SetMarkerColor(
kRed);
1055 d0->SetLineColor(
kRed);
1056 c->GetListOfPrimitives()->Add(d0,
"PEX0same");
1059 if (!d1 && fDrsCalibGainOn->isChecked() && fDrsCalibGain->value()>0)
1061 d1 =
new TH1F(
"DrsCalib1",
"", roi, -0.5, roi-0.5);
1062 d1->SetDirectory(0);
1063 d1->SetBit(kCanDelete);
1064 d1->SetMarkerStyle(kFullDotSmall);
1067 c->GetListOfPrimitives()->Add(d1,
"PEX0same");
1070 if (!d2 && fDrsCalibTrgOffsetOn->isChecked() && fDrsCalibTrgOffset->value()>0)
1072 d2 =
new TH1F(
"DrsCalib2",
"", roi, -0.5, roi-0.5);
1073 d2->SetDirectory(0);
1074 d2->SetBit(kCanDelete);
1075 d2->SetMarkerStyle(kFullDotSmall);
1076 d2->SetMarkerColor(
kGreen);
1077 d2->SetLineColor(
kGreen);
1078 c->GetListOfPrimitives()->Add(d2,
"PEX0same");
1081 if (!dynamic_cast<TH2*>(h) && !c->GetListOfPrimitives()->FindObject(h))
1082 c->GetListOfPrimitives()->Add(h,
"PLsame");
1087 fAdcChannel->value() +
1088 fAdcChip->value() * 9+
1089 fAdcBoard->value() * 36+
1090 fAdcCrate->value() *360;
1093 str <<
"CBPX = " << fAdcCrate->value() <<
'|' << fAdcBoard->value() <<
'|' << fAdcChip->value() <<
'|' << fAdcChannel->value() <<
" (" << p <<
")";
1094 str <<
" EventNum = " <<
fEventData->EventNum;
1095 str <<
" TriggerNum = " <<
fEventData->TriggerNum;
1096 str <<
" TriggerType = " <<
fEventData->TriggerType;
1097 str <<
" BoardTime = " <<
fEventData->BoardTime[fAdcBoard->value()+fAdcCrate->value()*10];
1099 hf->SetTitle(str.str().c_str());
1101 str <<
"ADC Pipeline (start cell: " <<
fEventData->StartPix[p] <<
")";
1102 hf->SetXTitle(str.str().c_str());
1108 fDrsCalibBaseline->setEnabled(fDrsCalibBaseline->value()>0);
1109 fDrsCalibGain->setEnabled(fDrsCalibGain->value()>0);
1110 fDrsCalibTrgOffset->setEnabled(fDrsCalibTrgOffset->value()>0);
1111 fDrsCalibROI->setEnabled(fDrsCalibROI->value()>0);
1113 fDrsCalibBaseline2->setEnabled(fDrsCalibBaseline->value()>0);
1114 fDrsCalibGain2->setEnabled(fDrsCalibGain->value()>0);
1115 fDrsCalibTrgOffset2->setEnabled(fDrsCalibTrgOffset->value()>0);
1116 fDrsCalibROI2->setEnabled(fDrsCalibROI->value()>0);
1129 if (!dynamic_cast<TH2*>(h))
1143 const int ii = fAdcPhysical->isChecked() ? (
i+
start)%1024 :
i;
1154 d0->SetBinContent(ii+1,
fDrsCalibration[1440*1024*0 + p*1024+(start+
i)%1024]);
1155 d0->SetBinError(ii+1,
fDrsCalibration[1440*1024*1 + p*1024+(start+
i)%1024]);
1160 d1->SetBinContent(ii+1,
fDrsCalibration[1440*1024*2 + p*1024+(start+
i)%1024]);
1161 d1->SetBinError(ii+1,
fDrsCalibration[1440*1024*3 + p*1024+(start+
i)%1024]);
1171 if (fAdcDynamicScale->isEnabled() && fAdcDynamicScale->isChecked())
1176 hf->SetMinimum(h->GetMinimum());
1177 hf->SetMaximum(h->GetMaximum());
1179 if (fAdcManualScale->isEnabled() && fAdcManualScale->isChecked())
1181 if (h->GetMinimumStored()==-1111)
1183 h->SetMinimum(-1150);
1184 hf->SetMinimum(-1150);
1186 if (h->GetMaximumStored()==-1111)
1188 h->SetMaximum(2150);
1189 hf->SetMaximum(2150);
1193 if (fAdcAutoScale->isEnabled() && fAdcAutoScale->isChecked())
1198 if (h->GetMinimum()<hf->GetMinimum())
1199 hf->SetMinimum(h->GetMinimum());
1200 if (h->GetMaximum()>hf->GetMaximum())
1201 hf->SetMaximum(h->GetMaximum());
1204 if (dynamic_cast<TH2*>(h))
1212 const int imin = ceil(hf->GetMinimum());
1213 const int imax = floor(hf->GetMaximum());
1215 TH1S hd(
"",
"", imax-imin+1, imin-0.5, imax+0.5);
1217 TH1S h0(
"",
"", imax-imin+1, imin-0.5, imax+0.5);
1219 TH1S h1(
"",
"", imax-imin+1, imin-0.5, imax+0.5);
1221 TH1S h2(
"",
"", imax-imin+1, imin-0.5, imax+0.5);
1223 hd.SetLineColor(h->GetLineColor());
1225 h0.SetLineColor(d0->GetLineColor());
1227 h1.SetLineColor(d1->GetLineColor());
1229 h2.SetLineColor(d2->GetLineColor());
1233 if (!dynamic_cast<TH2*>(h))
1234 hd.Fill(h->GetBinContent(
i+1));
1236 h0.Fill(d0->GetBinContent(
i+1));
1238 h1.Fill(d1->GetBinContent(
i+1));
1240 h2.Fill(d2->GetBinContent(
i+1));
1243 double mm = hd.GetMaximum(hd.GetEntries());
1244 if (h0.GetMaximum(h0.GetEntries())>mm)
1245 mm = h0.GetMaximum();
1246 if (h1.GetMaximum(h1.GetEntries())>mm)
1247 mm = h1.GetMaximum();
1248 if (h2.GetMaximum(h2.GetEntries())>mm)
1249 mm = h2.GetMaximum();
1251 TIter Next(hf->GetListOfFunctions());
1253 while ((obj=Next()))
1254 if (dynamic_cast<TBox*>(obj))
1255 delete hf->GetListOfFunctions()->Remove(obj);
1257 const double l = h->GetBinLowEdge(h->GetXaxis()->GetLast()+1);
1258 const double m = c->GetX2();
1260 const double scale = 0.9*(m-l)/mm;
Adds some functionality to boost::posix_time::ptime for our needs.
void SetLedColor(QPushButton *button, LedColor_t col, const Time &t)
void DrawHorizontal(TH1 *hf, double xmax, TH1 &h, double scale)
vector< float > fDrsCalibration