Changeset 10118 for fact/Feedback
- Timestamp:
- 01/25/11 09:47:27 (14 years ago)
- Location:
- fact/Feedback
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/Feedback/Feedback.cc
r269 r10118 10 10 #include "Feedback.h" 11 11 #include "PixelMap.h" 12 13 #define PIXMAP_LOCATION "../config/PixelMap.txt"14 12 15 13 static const char* FBState_Description[] = { … … 42 40 Feedback::Feedback(): EvidenceServer(SERVER_NAME) { 43 41 44 PixMap = new PixelMap(PIXMAP_LOCATION, false); 42 // Make RPC to get pixelmap 43 DimRpcInfo RPC((char *) "ConfigRequest", (char *) ""); 44 RPC.setData((char *) "Misc PixelMap"); 45 46 PixMap = new PixelMap(std::string(RPC.getString(), RPC.getSize())); 45 47 TimeBarrier = 0; 46 48 … … 52 54 fIDTable = Tokenize(GetConfig("IDTable"), " \t"); 53 55 Multiplicity = new unsigned int [fIDTable.size()]; 54 55 multiset<string> A; 56 char *Buf; 57 56 57 // Determine multiplicity of bias to pixel connection 58 std::vector<unsigned int> A; 58 59 for (unsigned int i=0; i<fIDTable.size(); i++) { 59 if (asprintf(&Buf, "BiasID%d%d%d", PixMap->Pixel_to_HVboard(fIDTable[i]), 60 PixMap->Pixel_to_HVchain(fIDTable[i]), PixMap->Pixel_to_HVchannel(fIDTable[i])) == -1) Message(FATAL, "asprintf() failed"); 61 A.insert(Buf); 62 free(Buf); 63 } 64 65 for (unsigned int i=0; i<fIDTable.size(); i++) { 66 if (asprintf(&Buf, "BiasID%d%d%d", PixMap->Pixel_to_HVboard(fIDTable[i]), 67 PixMap->Pixel_to_HVchain(fIDTable[i]), PixMap->Pixel_to_HVchannel(fIDTable[i])) == -1) Message(FATAL, "asprintf() failed"); 68 Multiplicity[i] = A.count(Buf); 69 free(Buf); 70 } 71 60 A = PixMap->HV_to_Pixel(PixMap->Pixel_to_HVcrate(atoi(fIDTable[i].c_str())), PixMap->Pixel_to_HVboard(atoi(fIDTable[i].c_str())), PixMap->Pixel_to_HVchannel(atoi(fIDTable[i].c_str()))); 61 Multiplicity[i] = A.size(); 62 } 63 72 64 // Initialise with zero content ??? 73 65 Average = new float [fIDTable.size()]; … … 227 219 float Correction; 228 220 229 // Re fect data isfeedback off or timestamp too early221 // Reject data if feedback off or timestamp too early 230 222 if (FBMode == Off || getCommand()->getTimestamp() < TimeBarrier) return; 231 223 TimeBarrier = 0; … … 298 290 // Send command (non-blocking since in handler thread) 299 291 if (!Cmd.str().empty()) { 300 DimClient::sendCommandNB("Bias/Command", (char *) (" hv"+Cmd.str()).c_str());292 DimClient::sendCommandNB("Bias/Command", (char *) ("pixel "+Cmd.str()).c_str()); 301 293 } 302 294 … … 385 377 // Build command 386 378 for (unsigned int i=0; i<fIDTable.size(); i++) { 387 Cmd << fIDTable[i] << " " << std::showpos << -U/2/Multiplicity[i] << " "; 379 Cmd << fIDTable[i] << " " << std::showpos << -U/2/Multiplicity[i] << " "; 388 380 } 389 381 390 382 // Send command 391 383 if (!Cmd.str().empty()) { 392 DimClient::sendCommand("Bias/Command", (" hv"+Cmd.str()).c_str());384 DimClient::sendCommand("Bias/Command", ("pixel "+Cmd.str()).c_str()); 393 385 } 394 386 395 387 DiffVoltage = U; 396 388 SetFBMode(ResponseFirst); 397 PrintMessage(" HVFeedback: Decreasing voltages by %f for response measurement, acquiring data.\n",DiffVoltage/2);389 PrintMessage("Feedback: Decreasing voltages by %f for response measurement, acquiring data.\n",DiffVoltage/2); 398 390 } 399 391 … … 439 431 void Feedback::commandHandler() { 440 432 441 string Command = ToString( "C", getCommand()->getData(), getCommand()->getSize());433 string Command = ToString((char *) "C", getCommand()->getData(), getCommand()->getSize()); 442 434 443 435 // Parse command into tokens -
fact/Feedback/Makefile
r269 r10118 12 12 13 13 CPPFLAGS = -DREVISION='"$(REVISION)"' -O3 -Wall 14 LIBS = - lstdc++ -lz -lpthread -lutil -lfl -lreadline -ltermcap $(DIMDIR)/linux/libdim.a14 LIBS = -L /usr/lib/termcap -lstdc++ -lz -lpthread -lutil -lfl -lreadline -ltermcap $(DIMDIR)/linux/libdim.a 15 15 16 16 Feedback: $(OBJECTS)
Note:
See TracChangeset
for help on using the changeset viewer.