- Timestamp:
- 01/21/11 13:54:00 (14 years ago)
- Location:
- fact/Evidence/Edd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/Evidence/Edd/Edd.cc
r10105 r10112 549 549 int DataPoints = Items[ItemNo].x.size(); 550 550 if (DataPoints == 0) continue; 551 551 552 552 // Normalize y scale if requested 553 553 double *y = new double [DataPoints]; … … 562 562 } 563 563 } 564 564 565 565 // Plot data 566 566 Items[ItemNo].Signal->setData(Items[ItemNo].x.data(), y, DataPoints); … … 735 735 Stream << QString("# ") + Items[ItemNo].Signal->title().text() + ".hist" << endl; 736 736 for (int i=0; i<Items[ItemNo].Signal->dataSize(); i++) { 737 Stream << (int)Items[ItemNo].x.at(i) << " " << Items[ItemNo].Signal->y(i) << endl;737 Stream << Items[ItemNo].x.at(i) << " " << Items[ItemNo].Signal->y(i) << endl; 738 738 } 739 739 } … … 1019 1019 1020 1020 Name = DRSBoard+"/EventData"; 1021 Active = false;1022 1021 1023 1022 Tmpfile = tmpfile(); … … 1031 1030 1032 1031 // Context menu 1033 PhysPipeAction = new QAction("P lot physical pipeline", this);1032 PhysPipeAction = new QAction("Physical pipeline", this); 1034 1033 PhysPipeAction->setCheckable(true); 1035 1034 connect(PhysPipeAction, SIGNAL(triggered()), SLOT(PlotTraces())); 1036 1035 Menu->insertAction(StripAction, PhysPipeAction); 1036 1037 PersistanceAction = new QAction("Persistance", this); 1038 PersistanceAction->setCheckable(true); 1039 Menu->insertAction(StripAction, PersistanceAction); 1037 1040 Menu->removeAction(StripAction); 1038 1041 … … 1084 1087 if (List.isEmpty()) return; 1085 1088 1089 // Clear in case persistance was activated 1090 ClearCurve(0); 1091 1086 1092 List.first().Signal->setTitle(QString::number(Board)+","+QString::number(Chip)+","+ QString::number(Channel) + " (" + DRS_to_Pixel(Board, Chip, Channel).c_str() + ")"); 1087 1093 List.first().Board = Board; … … 1094 1100 // Update event buffer 1095 1101 void EventScope::Update(QString Name, int Time, QByteArray Data, QString Format, QString) { 1096 1102 1097 1103 if (Name != this->Name) return; 1098 1104 … … 1100 1106 if (!SetStatus(this, Name, Time, Format)) return; 1101 1107 if (Data.size() < (int) sizeof(RunHeader)) return; 1108 1109 // Disconnect while processing to avoid queing of events 1110 disconnect(Handler, SIGNAL(YEP(QString, int, QByteArray, QString, QString)), this, SLOT(Update(QString, int, QByteArray, QString, QString))); 1102 1111 1103 1112 // Open tempory file and write event data to this file … … 1154 1163 emit(EventHeaderChanged(Stream.readAll())); 1155 1164 1165 // Update display 1156 1166 PlotTraces(); 1167 1168 // Reconnect after processing 1169 connect(Handler, SIGNAL(YEP(QString, int, QByteArray, QString, QString)), SLOT(Update(QString, int, QByteArray, QString, QString))); 1157 1170 } 1158 1171 … … 1162 1175 double x,y; 1163 1176 unsigned int Cell, Trig; 1177 static int Last = 0; 1164 1178 1165 1179 // Only process if valid data in RawDataCTX class 1166 if ( !Active ||ErrCode != CTX_OK) return;1180 if (ErrCode != CTX_OK) return; 1167 1181 1168 1182 // Set x axis title 1169 1183 if (PhysPipeAction->isChecked()) setAxisTitle(QwtPlot::xBottom, "Time from start of pipeline (ns)"); 1170 1184 else setAxisTitle(QwtPlot::xBottom, "Time from trigger minus one revolution (ns)"); 1171 1185 1172 1186 // Loop through event data to update event scope 1173 1187 RunHeader *R = RD->RHeader; 1174 1188 for (int i=0; i<List.size(); i++) { 1175 1189 1176 ClearCurve(i); 1190 if (PersistanceAction->isChecked()) List[i].Signal->setStyle(QwtPlotCurve::Dots); 1191 else { 1192 ClearCurve(i); 1193 List[i].Signal->setStyle(QwtPlotCurve::Lines); 1194 } 1177 1195 1178 1196 // Check if current event contains requested trace … … 1185 1203 Trig = *((int *) RD->Data + List[i].Board*R->NChips + List[i].Chip); 1186 1204 1205 // Calulate point of curve 1187 1206 for (unsigned int j=0; j<R->Samples; j++) { 1188 1207 … … 1202 1221 } 1203 1222 1204 UpdatePlot(); 1223 // Limit update rate in persistance mode 1224 if (!PersistanceAction->isChecked() || time(NULL) > Last) { 1225 UpdatePlot(); 1226 Last = time(NULL); 1227 } 1228 1205 1229 1206 1230 // Loop through event data for pixel display … … 1237 1261 // Set display active (if inactive, disconnect from server) 1238 1262 void EventScope::SetActive(bool State) { 1263 1264 static bool Active = false; 1239 1265 1240 1266 if (State && !Active) Handler->Subscribe(DRSBoard+"/EventData"); … … 1529 1555 } 1530 1556 1557 connect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString))); 1558 connect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString))); 1559 1531 1560 StartStop(false); 1532 1561 connect(Scope, SIGNAL(PixelData(QVector<double>)), SLOT(SetPixelData(QVector<double>))); … … 1562 1591 Scope->SetActive(!State); 1563 1592 StartStopButton->setText(State ? "Start" : "Stop"); 1564 if (!State) { 1565 connect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString))); 1566 connect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString))); 1567 } 1568 else { 1569 disconnect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString))); 1570 disconnect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString))); 1571 } 1593 if (!State) connect(Handler, SIGNAL(YEP(QString, int, QByteArray, QString, QString)), Scope, SLOT(Update(QString, int, QByteArray, QString, QString))); 1594 else disconnect(Handler, SIGNAL(YEP(QString, int, QByteArray, QString, QString)), Scope, SLOT(Update(QString, int, QByteArray, QString, QString))); 1572 1595 } 1573 1596 -
fact/Evidence/Edd/Edd.h
r10079 r10112 280 280 CTX_ErrCode ErrCode; 281 281 QAction *PhysPipeAction; 282 QAction *PersistanceAction; 282 283 FILE *Tmpfile; 283 bool Active;284 284 285 285 public:
Note:
See TracChangeset
for help on using the changeset viewer.