Changeset 11701
- Timestamp:
- 07/29/11 14:32:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r11693 r11701 402 402 DimStampedInfo fDimFadRoi; 403 403 DimStampedInfo fDimFadDac; 404 DimStampedInfo fDimFadDrsCalibration; 404 405 DimStampedInfo fDimFadStatus; 405 406 DimStampedInfo fDimFadStatistics1; … … 1139 1140 void DisplayEventData() 1140 1141 { 1142 if (!fEventData) 1143 return; 1144 1141 1145 #ifdef HAVE_ROOT 1142 1146 TCanvas *c = fAdcDataCanv->GetCanvas(); 1143 1147 1144 TH1 *h = dynamic_cast<TH1*>(c->FindObject("EventData")); 1145 if (h && h->GetNbinsX()!=fEventData->Roi) 1146 { 1147 delete h; 1148 h = 0; 1148 TH1 *hf = dynamic_cast<TH1*>(c->FindObject("Frame")); 1149 TH1 *h = dynamic_cast<TH1*>(c->FindObject("EventData")); 1150 TH1 *d0 = dynamic_cast<TH1*>(c->FindObject("DrsCalib0")); 1151 TH1 *d1 = dynamic_cast<TH1*>(c->FindObject("DrsCalib1")); 1152 TH1 *d2 = dynamic_cast<TH1*>(c->FindObject("DrsCalib2")); 1153 1154 if (hf && hf->GetNbinsX()!=fEventData->Roi) 1155 { 1156 delete hf; 1157 delete h; 1158 delete d0; 1159 delete d1; 1160 delete d2; 1161 hf = 0; 1162 } 1163 1164 if (!hf) 1165 { 1166 c->cd(); 1167 1168 const int roi = fEventData->Roi>0 ? fEventData->Roi : 1; 1169 1170 hf = new TH1F("Frame", "", roi, -0.5, roi-0.5); 1171 hf->SetDirectory(0); 1172 hf->SetBit(kCanDelete); 1173 hf->SetStats(kFALSE); 1174 hf->SetYTitle("Voltage [mV]"); 1175 hf->GetXaxis()->CenterTitle(); 1176 hf->GetYaxis()->CenterTitle(); 1177 hf->SetMinimum(-1026); 1178 hf->SetMaximum(1025); 1179 1180 h = new TH1F("EventData", "", roi, -0.5, roi-0.5); 1181 h->SetDirectory(0); 1182 h->SetBit(kCanDelete); 1183 h->SetMarkerStyle(kFullDotMedium); 1184 h->SetMarkerColor(kBlue); 1185 1186 d0 = new TH1F("DrsCalib0", "", roi, -0.5, roi-0.5); 1187 d0->SetDirectory(0); 1188 d0->SetBit(kCanDelete); 1189 d0->SetMarkerStyle(kFullDotSmall); 1190 d0->SetMarkerColor(kRed); 1191 d0->SetLineColor(kRed); 1192 1193 d1 = new TH1F("DrsCalib1", "", roi, -0.5, roi-0.5); 1194 d1->SetDirectory(0); 1195 d1->SetBit(kCanDelete); 1196 d1->SetMarkerStyle(kFullDotSmall); 1197 d1->SetMarkerColor(kMagenta); 1198 d1->SetLineColor(kMagenta); 1199 1200 d2 = new TH1F("DrsCalib2", "", roi, -0.5, roi-0.5); 1201 d2->SetDirectory(0); 1202 d2->SetBit(kCanDelete); 1203 d2->SetMarkerStyle(kFullDotSmall); 1204 d2->SetMarkerColor(kGreen); 1205 d2->SetLineColor(kGreen); 1206 1207 hf->Draw("PL"); 1208 d0->Draw("PEX0same"); 1209 d1->Draw("PEX0same"); 1210 d2->Draw("PEX0same"); 1211 h->Draw("PLsame"); 1212 1213 gPad = NULL; 1149 1214 } 1150 1215 1151 if (!h)1152 {1153 c->cd();1154 1155 const int roi = fEventData->Roi>0 ? fEventData->Roi : 1;1156 1157 TH1D hist("EventData", "", roi, -0.5, roi-0.5);1158 hist.SetStats(kFALSE);1159 //hist->SetBit(TH1::kNoTitle);1160 hist.SetMarkerStyle(kFullDotMedium);1161 hist.SetMarkerColor(kBlue);1162 hist.SetYTitle("Voltage [mV]");1163 hist.GetXaxis()->CenterTitle();1164 hist.GetYaxis()->CenterTitle();1165 hist.SetMinimum(-1026);1166 hist.SetMaximum(1025);1167 h = hist.DrawCopy("PL");1168 h->SetDirectory(0);1169 }1170 1216 1171 1217 const uint32_t p = … … 1178 1224 str << "EventNum = " << fEventData->EventNum; 1179 1225 str << " TriggerNum = " << fEventData->TriggerNum; 1180 str << " Trigger type = " << fEventData->TriggerType;1181 str << " Board time = " << fEventData->BoardTime[fAdcBoard->value()+fAdcCrate->value()*10];1226 str << " TriggerType = " << fEventData->TriggerType; 1227 str << " BoardTime = " << fEventData->BoardTime[fAdcBoard->value()+fAdcCrate->value()*10]; 1182 1228 str << " (" << Time(fEventData->PCTime, fEventData->PCUsec) << ")"; 1183 h ->SetTitle(str.str().c_str());1229 hf->SetTitle(str.str().c_str()); 1184 1230 str.str(""); 1185 1231 str << "ADC Pipeline (start cell: " << fEventData->StartPix[p] << ")"; 1186 h->SetXTitle(str.str().c_str()); 1187 1188 // str.str(""); 1189 // str << "Crate=" << crate << " Board=" << board << " Channel=" << channel << " [" << d.time() << "]" << endl; 1190 // hist->SetTitle(str.str().c_str()); 1191 1192 for (int i=0; i<fEventData->Roi; i++) 1193 h->SetBinContent(i+1, reinterpret_cast<float*>(fEventData->Adc_Data)[p*fEventData->Roi+i]); 1232 hf->SetXTitle(str.str().c_str()); 1233 1234 const int16_t start = fEventData->StartPix[p]; 1235 if (start<0) 1236 { 1237 d0->Reset(); 1238 d1->Reset(); 1239 d2->Reset(); 1240 } 1241 for (int i=0; i<fEventData->Roi; i++) 1242 { 1243 h->SetBinContent(i+1, reinterpret_cast<float*>(fEventData->Adc_Data)[p*fEventData->Roi+i]); 1244 if (start<0) 1245 continue; 1246 1247 if (fDrsRuns[0]>0) 1248 { 1249 d0->SetBinContent(i+1, fDrsCalibration[1440*1024*0 + p*1024+(start+i)%1024]); 1250 d0->SetBinError(i+1, fDrsCalibration[1440*1024*1 + p*1024+(start+i)%1024]); 1251 1252 cout << i << ": " << fDrsCalibration[1440*1024*0 + p*1024+(start+i)%1024] << " " << fDrsCalibration[1440*1024*1 + p*1024+(start+i)%1024] << endl; 1253 1254 } 1255 if (fDrsRuns[1]>0) 1256 { 1257 d1->SetBinContent(i+1, fDrsCalibration[1440*1024*2 + p*1024+(start+i)%1024]); 1258 d1->SetBinError(i+1, fDrsCalibration[1440*1024*3 + p*1024+(start+i)%1024]); 1259 } 1260 if (fDrsRuns[2]>0) 1261 { 1262 d2->SetBinContent(i+1, fDrsCalibration[1440*1024*4 + p*1024 + i]); 1263 d2->SetBinError(i+1, fDrsCalibration[1440*1024*5 + p*1024 + i]); 1264 } 1265 } 1194 1266 1195 1267 if (fAdcDynamicScale->isChecked()) 1196 1268 { 1197 h->SetMinimum(-1111); 1198 h->SetMaximum(-1111); 1269 h->SetMinimum(); 1270 h->SetMaximum(); 1271 1272 hf->SetMinimum(h->GetMinimum()); 1273 hf->SetMaximum(h->GetMaximum()); 1199 1274 } 1200 1275 if (fAdcManualScale->isChecked()) 1201 1276 { 1202 1277 if (h->GetMinimumStored()==-1111) 1278 { 1203 1279 h->SetMinimum(-1026); 1280 hf->SetMinimum(-1026); 1281 } 1204 1282 if (h->GetMaximumStored()==-1111) 1283 { 1205 1284 h->SetMaximum(1025); 1206 } 1285 hf->SetMaximum(1025); 1286 } 1287 } 1288 1207 1289 if (fAdcAutoScale->isChecked()) 1208 1290 { 1209 const double min = h->GetMinimumStored();1210 const double max = h->GetMaximumStored();1211 1212 1291 h->SetMinimum(); 1213 1292 h->SetMaximum(); 1214 1293 1215 h->SetMinimum(h->GetMinimum()<min || min==-1111 ? h->GetMinimum() : min); 1216 h->SetMaximum(h->GetMaximum()>max || max==-1111 ? h->GetMaximum() : max); 1294 if (h->GetMinimum()<hf->GetMinimum()) 1295 hf->SetMinimum(h->GetMinimum()); 1296 if (h->GetMaximum()>hf->GetMaximum()) 1297 hf->SetMaximum(h->GetMaximum()); 1217 1298 } 1218 1299 … … 1247 1328 fEventData = reinterpret_cast<EVENT*>(new char[d.size()]); 1248 1329 memcpy(fEventData, d.ptr<void>(), d.size()); 1330 1331 DisplayEventData(); 1332 } 1333 1334 uint32_t fDrsRuns[3]; 1335 vector<float> fDrsCalibration; 1336 1337 void handleFadDrsCalibration(const DimData &d) 1338 { 1339 if (d.size()==0) 1340 { 1341 fDrsRuns[0] = 0; 1342 fDrsRuns[1] = 0; 1343 fDrsRuns[2] = 0; 1344 fDrsCalibration.assign(1024*1440*6, 0); 1345 DisplayEventData(); 1346 return; 1347 } 1348 1349 if (!CheckSize(d, 1024*1440*6*sizeof(float)+3*sizeof(uint32_t))) 1350 // Do WHAT? 1351 return; 1352 1353 const uint32_t *run = d.ptr<uint32_t>(); 1354 fDrsRuns[0] = run[0]; 1355 fDrsRuns[1] = run[1]; 1356 fDrsRuns[2] = run[2]; 1357 1358 const float *dat = d.ptr<float>(sizeof(uint32_t)*3); 1359 fDrsCalibration.assign(dat, dat+1024*1440*6); 1249 1360 1250 1361 DisplayEventData(); … … 2387 2498 return PostInfoHandler(&FactGui::handleFadDac); 2388 2499 2500 if (getInfo()==&fDimFadDrsCalibration) 2501 return PostInfoHandler(&FactGui::handleFadDrsCalibration); 2502 2389 2503 if (getInfo()==&fDimFadPrescaler) 2390 2504 return PostInfoHandler(&FactGui::handleFadPrescaler); … … 2807 2921 const double tm = Time().RootTime(); 2808 2922 2809 TH1F h("TimeFrame", "", 1, tm, tm+60);//Time().RootTime()-1./24/60/60, Time().RootTime());2810 h .SetDirectory(0);2811 // h.SetBit(TH1::kCanRebin);2812 h .SetStats(kFALSE);2923 TH1F *h=new TH1F("TimeFrame", "", 1, tm, tm+60);//Time().RootTime()-1./24/60/60, Time().RootTime()); 2924 h->SetDirectory(0); 2925 h->SetBit(kCanDelete); 2926 h->SetStats(kFALSE); 2813 2927 // h.SetMinimum(0); 2814 2928 // h.SetMaximum(1); 2815 h .SetXTitle("Time");2816 h .SetYTitle(ytitle);2817 h .GetXaxis()->CenterTitle();2818 h .GetYaxis()->CenterTitle();2819 h .GetXaxis()->SetTimeDisplay(true);2820 h .GetXaxis()->SetTimeFormat("%Mh%S'");2821 h .GetXaxis()->SetLabelSize(0.025);2822 h .GetYaxis()->SetLabelSize(0.025);2823 h .GetYaxis()->SetTitleOffset(1.2);2929 h->SetXTitle("Time"); 2930 h->SetYTitle(ytitle); 2931 h->GetXaxis()->CenterTitle(); 2932 h->GetYaxis()->CenterTitle(); 2933 h->GetXaxis()->SetTimeDisplay(true); 2934 h->GetXaxis()->SetTimeFormat("%Mh%S'"); 2935 h->GetXaxis()->SetLabelSize(0.025); 2936 h->GetYaxis()->SetLabelSize(0.025); 2937 h->GetYaxis()->SetTitleOffset(1.2); 2824 2938 // h.GetYaxis()->SetTitleSize(1.2); 2825 2826 TH1 *cpy = h.DrawCopy(); 2827 cpy->SetDirectory(0); 2828 return cpy; 2939 h->Draw(); 2940 2941 return h; 2829 2942 } 2830 2943 #endif … … 2863 2976 fDimFadRoi ("FAD_CONTROL/REGION_OF_INTEREST", (void*)NULL, 0, this), 2864 2977 fDimFadDac ("FAD_CONTROL/DAC", (void*)NULL, 0, this), 2978 fDimFadDrsCalibration ("FAD_CONTROL/DRS_CALIBRATION", (void*)NULL, 0, this), 2865 2979 fDimFadStatus ("FAD_CONTROL/STATUS", (void*)NULL, 0, this), 2866 2980 fDimFadStatistics1 ("FAD_CONTROL/STATISTICS1", (void*)NULL, 0, this), 2867 2981 fDimFadStatistics2 ("FAD_CONTROL/STATISTICS2", (void*)NULL, 0, this), 2868 2982 //- 2869 fEventData(0), 2983 fEventData(0), fDrsCalibration(1440*1024*6), 2870 2984 fTimeStamp1(0), 2871 2985 fTriggerCounter0(0),
Note:
See TracChangeset
for help on using the changeset viewer.