- Timestamp:
- 05/27/11 14:17:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fadctrl.cc
r10859 r10863 66 66 } 67 67 68 /* 68 69 virtual void UpdateChannelHeader(int i) 69 70 { … … 73 74 74 75 Out() << fChannelHeader[i]; 76 if (fIsHexOutput) 77 Out() << Converter::GetHex<uint16_t>(fChannelHeader, 16) << endl; 78 } 79 */ 80 81 virtual void UpdateChannelHeaders() 82 { 83 // emit service with trigger counter from header 84 if (!fIsVerbose) 85 return; 86 87 Out() << dec << endl; 88 89 Out() << kBold << "ID: Crate=" << fEventHeader.Crate() << " Board=" << fEventHeader.Board() << endl; 90 for (unsigned int c=0; c<FAD::kNumChips; c++) 91 { 92 Out() << "ReadoutWin #" << c << ":"; 93 for (unsigned int ch=0; ch<FAD::kNumChannelsPerChip; ch++) 94 Out() << " " << setw(4) << fChannelHeader[c*FAD::kNumChannelsPerChip+ch].fRegionOfInterest; 95 Out() << endl; 96 } 97 98 for (unsigned int c=0; c<FAD::kNumChips; c++) 99 { 100 Out() << "StartCells #" << c << ":"; 101 for (unsigned int ch=0; ch<FAD::kNumChannelsPerChip; ch++) 102 Out() << " " << setw(4) << fChannelHeader[c*FAD::kNumChannelsPerChip+ch].fStartCell; 103 Out() << endl; 104 } 105 75 106 if (fIsHexOutput) 76 107 Out() << Converter::GetHex<uint16_t>(fChannelHeader, 16) << endl; … … 113 144 } 114 145 115 // FIXME FIXME FIXME. The data block could have the same size!!!!!116 // !!!!!!!!!!!!!!!!!!!117 146 if (type==kReadHeader) 118 147 { … … 164 193 } 165 194 166 /*167 195 uint8_t *ptr = reinterpret_cast<uint8_t*>(fBuffer.data()); 196 uint8_t *end = ptr + fBuffer.size()*2; 168 197 for (unsigned int i=0; i<FAD::kNumChannels; i++) 169 198 { 170 if (ptr+sizeof(FAD::ChannelHeader) /2 > reinterpret_cast<uint8_t*>(fBuffer.data())+fBuffer.size()*2)199 if (ptr+sizeof(FAD::ChannelHeader) > end) 171 200 { 172 Error("WRONG SIZE1"); 173 break; 201 Error("Channel header exceeds buffer size."); 202 PostClose(false); 203 return; 174 204 } 175 205 176 // FIXME: Size consistency check!!!!177 206 fChannelHeader[i] = vector<uint16_t>((uint16_t*)ptr, (uint16_t*)ptr+sizeof(FAD::ChannelHeader)/2); 178 207 ptr += sizeof(FAD::ChannelHeader); 179 208 180 // FIXME CHECK: Event Size vs ROI 181 182 UpdateChannelHeader(i); 183 184 if (ptr+fChannelHeader[i].fRegionOfInterest*2 > reinterpret_cast<uint8_t*>(fBuffer.data())+fBuffer.size()*2) 209 //UpdateChannelHeader(i); 210 211 if (ptr+fChannelHeader[i].fRegionOfInterest*2 > end) 185 212 { 186 Error("WRONG SIZE2"); 187 break; 213 Error("Data block exceeds buffer size."); 214 PostClose(false); 215 return; 188 216 } 189 217 190 218 uint16_t *data = reinterpret_cast<uint16_t*>(ptr); 219 220 /* 191 221 for (uint16_t *d=data; d<data+fChannelHeader[i].fRegionOfInterest; d++) 192 222 { … … 209 239 } 210 240 } 241 */ 211 242 212 243 UpdateData(data, fChannelHeader[i].fRegionOfInterest*2); 213 244 ptr += fChannelHeader[i].fRegionOfInterest*2; 214 }*/ 245 } 246 247 UpdateChannelHeaders(); 215 248 216 249 fBuffer.resize(sizeof(FAD::EventHeader)/2); … … 310 343 ConnectionFAD(ba::io_service& ioservice, MessageImp &imp) : 311 344 Connection(ioservice, imp()), 312 fIsVerbose( true), fIsHexOutput(false), fIsDataOutput(false), fCounter(0)345 fIsVerbose(false), fIsHexOutput(false), fIsDataOutput(false), fCounter(0) 313 346 { 314 347 // Maximum possible needed space:
Note:
See TracChangeset
for help on using the changeset viewer.