Changeset 11493
- Timestamp:
- 07/20/11 18:10:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fad.cc
r11466 r11493 36 36 37 37 public: 38 Trigger() : fCmd("FAD/TRIGGER", " C", this)38 Trigger() : fCmd("FAD/TRIGGER", "I:1", this) 39 39 { 40 40 } … … 91 91 fTrigger.Add(this); 92 92 } 93 void PostTrigger( )93 void PostTrigger(uint32_t triggerid) 94 94 { 95 95 if (fTriggerEnabled) 96 get_io_service().post(boost::bind(&tcp_connection::SendData, this ));96 get_io_service().post(boost::bind(&tcp_connection::SendData, this, triggerid)); 97 97 } 98 98 … … 123 123 deque<vector<uint16_t>> fOutQueue; 124 124 125 void SendData( )125 void SendData(uint32_t triggerid) 126 126 { 127 127 fHeader.fPackageLength = sizeof(EventHeader)/2+1; 128 128 fHeader.fEventCounter++; 129 fHeader.fTriggerId = fHeader.fEventCounter;129 fHeader.fTriggerId = triggerid; 130 130 fHeader.fTimeStamp = uint32_t((Time(Time::utc).UnixTime()-fStartTime)*10000); 131 131 fHeader.fFreqRefClock = 997+rand()/(RAND_MAX/7); … … 143 143 144 144 evtbuf.insert(evtbuf.end(), buf.begin(), buf.end()); 145 evtbuf.insert(evtbuf.end(), fChHeader[i].fRegionOfInterest, 0x42+i+11.*rand()/RAND_MAX-5); 145 evtbuf.insert(evtbuf.end(), fChHeader[i].fRegionOfInterest, 0x42+i+11.*rand()/RAND_MAX-5+fHeader.fDac[1]/32); 146 147 if (triggerid>0) 148 { 149 int p = 5.*rand()/RAND_MAX+20; 150 double rndm = 500.*rand()/RAND_MAX+500; 151 for (int ii=0; ii<fChHeader[i].fRegionOfInterest; ii++) 152 *(evtbuf.end()-fChHeader[i].fRegionOfInterest+ii) = rndm*exp(-0.5*(ii-p)*(ii-p)/25); // sigma=10 153 } 146 154 147 155 fHeader.fPackageLength += sizeof(ChannelHeader)/2; … … 192 200 // The deadline has passed. 193 201 if (fTriggerEnabled) 194 SendData( );202 SendData(0); 195 203 196 204 AsyncWait(fTriggerSendData, fHeader.fTriggerGeneratorPrescaler, &tcp_connection::TriggerSendData); … … 281 289 case kCmdSingleTrigger: 282 290 cout << "-> Trigger " << fBoardId << endl; 283 SendData( );291 SendData(0); 284 292 break; 285 293 … … 438 446 void Trigger::commandHandler() 439 447 { 448 if (!getCommand()) 449 return; 450 440 451 for (vector<tcp_connection*>::iterator it=vec.begin(); 441 452 it!=vec.end(); it++) 442 { 443 (*it)->PostTrigger(); 444 } 453 (*it)->PostTrigger(getCommand()->getInt()); 445 454 } 446 455
Note:
See TracChangeset
for help on using the changeset viewer.