Changeset 182 for drsdaq/HVFeedback.cc
- Timestamp:
- 03/12/10 15:53:20 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
drsdaq/HVFeedback.cc
r176 r182 25 25 // Constructor: Initialise feedback 26 26 // 27 HVFeedback::HVFeedback(DAQReadout* DAQClass , char* Configfile):28 EvidenceServer(SERVER_NAME){27 HVFeedback::HVFeedback(DAQReadout* DAQClass){//: 28 //EvidenceServer(SERVER_NAME){ 29 29 30 30 m = DAQClass; 31 31 32 fNumberOfChannels = m-> fNumberOfChannels;33 fNumberOfChips = m-> fNumberOfChips;32 fNumberOfChannels = m->GetBoard(0)->GetNumberOfChannels(); 33 fNumberOfChips = m->GetBoard(0)->GetNumberOfChips(); 34 34 35 35 PixMap = new PixelMap(PIXMAP_LOCATION, false); … … 45 45 DIMSigma = new float [m->NumBoards][kNumberOfChipsMax][kNumberOfChannelsMax](); 46 46 47 // Read configuration file 48 FILE *File; 49 if ((File = fopen(Configfile,"r")) == NULL) { 50 printf("Error: Could not open feedback configuration file '%s'\n", Configfile); 51 } 52 else { 53 printf("Reading feedback configuration file %s\n", Configfile); 54 ReadCard("TrigBoard", &fLedTrigBoard, 'I', File); 55 ReadCard("TrigChannel", &fLedTrigChannel, 'I', File); 56 ReadCard("TrigChip", &fLedTrigChip, 'I', File); 57 ReadCard("TrigSample", &fLedTrigSample, 'I', File); 58 ReadCard("TrigThreshold", &fLedTrigThreshold, 'f', File); 59 ReadCard("SignalSample", &fLedSignalSample, 'I', File); 60 ReadCard("BaselineSample", &fLedBaselineSample, 'I', File); 61 ReadCard("IntHalfWidth", &fIntHalfWidth, 'U', File); 62 ReadCard("DefaultNumAverage", &fDefaultNumAverage, 'I', File); 63 ReadCard("DefaultResponse", Response, 'f', File, m->NumBoards*fNumberOfChips*fNumberOfChannels); 64 ReadCard("DefaultTarget", Target, 'f', File, m->NumBoards*fNumberOfChips*fNumberOfChannels); 65 // Add also initial gain to configuration parameters 66 fclose(File); 67 } 47 // Get configuration data 48 fLedTrigBoard = atoi(m->GetConfig("TrigBoard")); 49 fLedTrigChannel = atoi(m->GetConfig("TrigChannel")); 50 fLedTrigChip = atoi(m->GetConfig("TrigChip")); 51 fLedTrigSample = atoi(m->GetConfig("TrigSample")); 52 fLedTrigThreshold = atoi(m->GetConfig("TrigThreshold")); 53 fLedSignalSample = atoi(m->GetConfig("SignalSample")); 54 fLedBaselineSample = atoi(m->GetConfig("BaselineSample")); 55 fIntHalfWidth = atoi(m->GetConfig("IntHalfWidth")); 56 fDefaultNumAverage = atoi(m->GetConfig("DefaultNumAverage")); 57 58 char *Token = strtok(m->GetConfig("DefaultResponse"), " \t"); 59 for (int i=0; i<m->NumBoards*fNumberOfChips*fNumberOfChannels; i++) { 60 if (Token == NULL) break; 61 *(&Response[0][0][0]+i) = (float) atof(Token); 62 Token = strtok(NULL, " \t"); 63 } 64 Token = strtok(m->GetConfig("DefaultTarget"), " \t"); 65 for (int i=0; i<m->NumBoards*fNumberOfChips*fNumberOfChannels; i++) { 66 if (Token == NULL) break; 67 *(&Target[0][0][0]+i) = (float) atof(Token); 68 Token = strtok(NULL, " \t"); 69 } 70 68 71 PrintConfig(MsgToLog); 69 72 … … 76 79 77 80 // Initial state 78 Gain = 0.2;81 Gain = atoi(m->GetConfig("DefaultGain")); 79 82 SetFBMode(FB_Off); 80 83 SetNumAverages(fDefaultNumAverage); … … 94 97 95 98 delete[] Average; delete[] Response; 99 delete[] DIMAverage; delete[] DIMSigma; 100 delete[] Sigma; 96 101 delete[] Target; delete[] Buffer; 97 102 delete PixMap; … … 256 261 else { 257 262 FBMode = Mode; 258 if (Mode != FB_ResponseFirst) State(INFO, "%s", FBState_Description[FBMode]);259 else State(INFO, "%s (voltage difference %.3f)", FBState_Description[FBMode], DiffVoltage);263 if (Mode != FB_ResponseFirst) m->State(m->INFO, "%s", FBState_Description[FBMode]); 264 else m->State(m->INFO, "%s (voltage difference %.3f)", FBState_Description[FBMode], DiffVoltage); 260 265 ClearAverages(); 261 266 }
Note:
See TracChangeset
for help on using the changeset viewer.