Changeset 11533
- Timestamp:
- 07/22/11 08:50:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fad.cc
r11510 r11533 100 100 void HandleSentData(const boost::system::error_code& error, size_t bytes_transferred) 101 101 { 102 cout << "Data sent: (transmitted=" << bytes_transferred << ") rc=" << error.message() << " (" << error << ")" << endl; 102 #ifdef DEBUG_TX 103 cout << "Data sent[" << fBoardId << "]: (transmitted=" << bytes_transferred << ") rc=" << error.message() << " (" << error << ")" << endl; 104 #endif 103 105 fOutQueue.pop_front(); 104 106 } … … 131 133 fHeader.fFreqRefClock = 997+rand()/(RAND_MAX/7); 132 134 135 /* Trigger ID 136 137 * Byte[4]: Bit 0: ext1 138 * Byte[4]: Bit 1: ext2 139 * Byte[4]: Bit 2-7: n/40 140 * Byte[5]: Bit 0: LP_1 141 * Byte[5]: Bit 1: LP_2 142 * Byte[5]: Bit 2: Pedestal 143 * Byte[5]: Bit 3: 144 * Byte[5]: Bit 4: 145 * Byte[5]: Bit 5: 146 * Byte[5]: Bit 6: 147 * Byte[5]: Bit 7: TIM source 148 149 */ 150 133 151 for (int i=0; i<FAD::kNumTemp; i++) 134 152 fHeader.fTempDrs[i] = (42.+fBoardId/40.+float(rand())/RAND_MAX*5)*16; 135 153 154 // Header, channel header, end delimiter 155 size_t sz = sizeof(fHeader) + kNumChannels*sizeof(FAD::ChannelHeader) + 2; 156 // Data 157 for (int i=0; i<kNumChannels; i++) 158 sz += fChHeader[i].fRegionOfInterest*2; 159 136 160 vector<uint16_t> evtbuf; 161 evtbuf.reserve(sz); 137 162 138 163 for (int i=0; i<kNumChannels; i++) 139 164 { 140 fChHeader[i].fStartCell = i*10; 141 142 const vector<uint16_t> buf = fChHeader[i].HtoN(); 143 144 evtbuf.insert(evtbuf.end(), buf.begin(), buf.end()); 145 evtbuf.insert(evtbuf.end(), fChHeader[i].fRegionOfInterest, 0x42+i+fHeader.fDac[1]/32); 165 fChHeader[i].fStartCell = int64_t(1023)*rand()/RAND_MAX; 166 167 vector<int16_t> data(fChHeader[i].fRegionOfInterest, -1024+0x42+i/9+fHeader.fDac[1]/32); 168 169 for (int ii=0; ii<fChHeader[i].fRegionOfInterest; ii++) 170 { 171 const int rel = ii; 172 const int abs = (ii+fChHeader[i].fStartCell)%fChHeader[i].fRegionOfInterest; 173 174 data[rel] += 6.*rand()/RAND_MAX + 5*exp(-rel/10); // sigma=10 175 data[rel] += 15*sin(2*3.1415*abs/512); // sigma=10 176 } 146 177 147 178 if (triggerid>0) 148 179 { 149 int p = 5.*rand()/RAND_MAX+20;180 int p = 5.*rand()/RAND_MAX+ 20; 150 181 double rndm = 500.*rand()/RAND_MAX+500; 151 182 for (int ii=0; ii<fChHeader[i].fRegionOfInterest; ii++) 152 *(evtbuf.end()-fChHeader[i].fRegionOfInterest+ii) += 153 rndm*exp(-0.5*(ii-p)*(ii-p)/25); // sigma=10 183 data[ii] += rndm*exp(-0.5*(ii-p)*(ii-p)/25); // sigma=10 154 184 } 155 185 156 for (int ii=0; ii<fChHeader[i].fRegionOfInterest; ii++) 157 { 158 *(evtbuf.end()-fChHeader[i].fRegionOfInterest+ii) += 159 6.*rand()/RAND_MAX + 5*exp(-ii/10); // sigma=10 160 161 *(evtbuf.end()-fChHeader[i].fRegionOfInterest+(ii+fChHeader[i].fStartCell)%fChHeader[i].fRegionOfInterest) += 162 15*sin(2*3.1415*ii/512); // sigma=10 163 } 164 186 const vector<uint16_t> buf = fChHeader[i].HtoN(); 187 188 evtbuf.insert(evtbuf.end(), buf.begin(), buf.end()); 189 evtbuf.insert(evtbuf.end(), data.begin(), data.end()); 165 190 166 191 fHeader.fPackageLength += sizeof(ChannelHeader)/2;
Note:
See TracChangeset
for help on using the changeset viewer.