Changeset 12237 for trunk/FACT++
- Timestamp:
- 10/23/11 14:33:22 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ratescan.cc
r12210 r12237 81 81 float fResolution; 82 82 83 enum reference_t 84 { 85 kCamera, 86 kBoard, 87 kPatch 88 }; 89 90 reference_t fReference; 91 uint16_t fReferenceIdx; 92 83 93 pair<Time, int> GetNewState(DimStampedInfo &info) const 84 94 { … … 153 163 fTriggersPatch[i] += sdata.fPatchRate[i]; 154 164 155 if (sqrt(fTriggers)>fResolution*fTriggers && fSeconds<fSecondsMax) 165 double reference = fTriggers; 166 if (fReference==kBoard) 167 reference = fTriggersBoard[fReferenceIdx]; 168 if (fReference==kPatch) 169 reference = fTriggersPatch[fReferenceIdx]; 170 171 if (sqrt(reference)>fResolution*reference && fSeconds<fSecondsMax) 156 172 { 157 cout << "Triggers so far: " << fTriggers << " (" << sqrt(fTriggers)/fTriggers << ")" << endl; 173 ostringstream out; 174 out << "Triggers so far: " << fTriggers; 175 if (reference>0) 176 out << " (" << sqrt(reference)/reference << ")"; 177 Info(out); 158 178 return; 159 179 } … … 170 190 sout3 << float(sdata.fOnTimeCounter-fOnTimeStart)/fSeconds/1000000; 171 191 172 cout << sout1.str() << sout3.str() << endl;192 Info(sout1.str()+sout3.str()); 173 193 174 194 … … 220 240 int StartRateScan() 221 241 { 242 ofstream fout("ratescan.txt", ios::app); 243 fout << "# ----- " << Time() << " -----" << endl; 244 fout << "# Reference: "; 245 switch (fReference) 246 { 247 case kCamera: fout << "Camera"; 248 case kBoard: fout << "Board #" << fReferenceIdx; 249 case kPatch: fout << "Patch #" << fReferenceIdx; 250 } 251 fout << '\n'; 252 fout << "# -----" << endl; 253 222 254 Dim::SendCommand("FAD_CONTROL/SET_FILE_FORMAT", uint16_t(0)); 223 255 … … 241 273 //if (fStatusFTM.second==FTM::kTakingData) 242 274 { 243 Message("Stopping FTM");275 //Message("Stopping FTM"); 244 276 //Dim::SendCommand("FTM_CONTROL/STOP_RUN"); 245 277 } 278 279 return GetCurrentState(); 280 } 281 282 int SetReferenceCamera() 283 { 284 fReference = kCamera; 285 286 return GetCurrentState(); 287 } 288 289 int SetReferenceBoard(const EventImp &evt) 290 { 291 if (!CheckEventSize(evt.GetSize(), "SetReferenceBoard", 4)) 292 return kSM_FatalError; 293 294 if (evt.GetUInt()>39) 295 { 296 Error("SetReferenceBoard - Board index out of range [0;39]"); 297 return GetCurrentState(); 298 } 299 300 fReference = kBoard; 301 fReferenceIdx = evt.GetUInt(); 302 303 return GetCurrentState(); 304 } 305 306 int SetReferencePatch(const EventImp &evt) 307 { 308 if (!CheckEventSize(evt.GetSize(), "SetReferencePatch", 4)) 309 return kSM_FatalError; 310 311 if (evt.GetUInt()>159) 312 { 313 Error("SetReferencePatch - Patch index out of range [0;159]"); 314 return GetCurrentState(); 315 } 316 317 fReference = kPatch; 318 fReferenceIdx = evt.GetUInt(); 246 319 247 320 return GetCurrentState(); … … 309 382 (bind(&StateMachineRateScan::StopRateScan, this)) 310 383 (""); 384 385 AddEvent("SET_REFERENCE_CAMERA", kStateDimNetworkNA, kStateDisconnected, kStateConnected) 386 (bind(&StateMachineRateScan::SetReferenceCamera, this)) 387 (""); 388 AddEvent("SET_REFERENCE_BOARD", "I:1", kStateDimNetworkNA, kStateDisconnected, kStateConnected) 389 (bind(&StateMachineRateScan::SetReferenceBoard, this, placeholders::_1)) 390 (""); 391 AddEvent("SET_REFERENCE_PATCH", "I:1", kStateDimNetworkNA, kStateDisconnected, kStateConnected) 392 (bind(&StateMachineRateScan::SetReferenceBoard, this, placeholders::_1)) 393 (""); 394 311 395 /* 312 396 AddEvent("ENABLE_OUTPUT", "B:1")//, kStateIdle)
Note:
See TracChangeset
for help on using the changeset viewer.