当前位置: 首页>>代码示例>>C++>>正文


C++ EventBuffer::setTMin方法代码示例

本文整理汇总了C++中EventBuffer::setTMin方法的典型用法代码示例。如果您正苦于以下问题:C++ EventBuffer::setTMin方法的具体用法?C++ EventBuffer::setTMin怎么用?C++ EventBuffer::setTMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventBuffer的用法示例。


在下文中一共展示了EventBuffer::setTMin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
					p.channelIdleTime = shm->getChannelIdleTime(index, n);
					p.d.tofpet.tacIdleTime = shm->getTACIdleTime(index, n);
				}
				else if (feType == 1) {
					p.feType = RawHit::STIC;
					unsigned tCoarse = shm->getTCoarse(index, n);
					unsigned eCoarse = shm->getECoarse(index, n);
					// Compensate for LFSR's 2^16-1 period
					// and wrap at frame's 6.4 us period
					int ctCoarse = STICv3::Sticv3Handler::compensateCoarse(tCoarse, frameID) % 4096;
					int ceCoarse = STICv3::Sticv3Handler::compensateCoarse(eCoarse, frameID) % 4096;
					p.time = 1024LL * frameID * T + ctCoarse * T/4;
					p.timeEnd = 1024LL * frameID * T + ceCoarse * T/4;
					if((p.timeEnd - p.time) < -256*T) p.timeEnd += (1024LL * T);
					p.channelID = 64 * shm->getAsicID(index, n) + shm->getChannelID(index, n);
					p.d.stic.tcoarse = tCoarse;
					p.d.stic.ecoarse = eCoarse;
					p.d.stic.tfine =  shm->getTFine(index, n);
					p.d.stic.efine = shm->getEFine(index, n);
					p.channelIdleTime = shm->getChannelIdleTime(index, n);
					p.d.stic.tBadHit = shm->getTBadHit(index, n);
					p.d.stic.eBadHit = shm->getEBadHit(index, n);
				} else {
					continue;
				}
				
				outBuffer->pushWriteSlot();
				
			}
			
			if(outBuffer->getSize() >= (EVENT_BLOCK_SIZE - DAQd::MaxDataFrameSize)) {
				long long tMin = lastMaxFrameID * 1024 * T;
				long long tMax = (maxFrameID+1) * 1024 * T - 1;
				outBuffer->setTMin(tMin);
				outBuffer->setTMax(tMax);
				lastMaxFrameID = maxFrameID;
				sink->pushEvents(outBuffer);
				outBuffer = NULL;
				
			}

			stepEvents += nEvents;
			stepMaxFrame = stepMaxFrame > nEvents ? stepMaxFrame : nEvents;
			if(frameLost) {
				stepLostFrames += 1;
				if(nEvents == 0) 
					stepLostFrames0 += 1;
			}			
			stepGoodFrames += 1;
			
			rdPointer = (rdPointer+1) % (2*bs);
		}		
		
		if(blockHeader.endOfStep != 0) {
			if(sink != NULL) {
				if(outBuffer != NULL) {
					long long tMin = lastMaxFrameID * 1024 * T;
					long long tMax = (maxFrameID+1) * 1024 * T - 1;
					outBuffer->setTMin(tMin);
					outBuffer->setTMax(tMax);
					lastMaxFrameID = maxFrameID;
					sink->pushEvents(outBuffer);
					outBuffer = NULL;
				}
			
				sink->finish();
开发者ID:lferramacho,项目名称:sw_daq_tofpet,代码行数:67,代码来源:writeRaw.cpp

示例2: run

void RawReader::run()
{

	unsigned nWraps = 0;
	
	EventBuffer<RawPulse> *outBuffer = NULL;
	
	int nEventsInFrame = 0;
	
	long long tMax = 0, lastTMax = 0;
	long long FrameID;
	
	sink->pushT0(0);
	
	long long minFrameID = LLONG_MAX;
	long long maxFrameID = LLONG_MIN;
	uint8_t code;
	
	long long events=0;
	int bytes;
	while (fread(&code, 1, 1, dataFile) == 1) {
		  events++;
		  
		  
		  if(code>0x03){
				fprintf(stderr, "Impossible code: %u, at event %ld\n\n", code, events);
				break;
		  }
		  fseek(dataFile, -1, SEEK_CUR);
		
		
			
		  switch(code){
		  case 0:{
				StartTime rawStartTime;
				bytes= fread(&rawStartTime, sizeof(StartTime), 1, dataFile);
				AcqStartTime=rawStartTime.time;
				//fprintf(stderr, "rawStartTime=%d %d\n",rawStartTime.code,rawStartTime.time);
				continue;
		  }
		  case 1:{
				FrameHeader rawFrameHeader;
				bytes=fread(&rawFrameHeader, sizeof(FrameHeader), 1, dataFile);
				CurrentFrameID=rawFrameHeader.frameID;
				//fprintf(stderr, "Current frameID= %d %lld %lld\n", rawFrameHeader.code,rawFrameHeader.frameID,rawFrameHeader.drift   );
				continue;
		  }
		  case 2:{
				RawTOFPET rawEvent;
		
				bytes=fread(&rawEvent, sizeof(RawTOFPET), 1, dataFile);
				//fprintf(stderr, "tof.struct=%d\n %d\n %d\n %ld\n %ld\n %ld\n %lld\n %lld\n \n\n", rawEvent.code, rawEvent.tac, rawEvent.channelID,rawEvent.tCoarse,  rawEvent.eCoarse, rawEvent.tFine , rawEvent.eFine , rawEvent.tacIdleTime , rawEvent.channelIdleTime );
				if(outBuffer == NULL) {
					  outBuffer = new EventBuffer<RawPulse>(outBlockSize);
				}
				
			
				RawPulse &p = outBuffer->getWriteSlot();
				


				// Carefull with the float/double/integer conversions here..
				p.T = T * 1E12;
				p.time = (1024LL * CurrentFrameID + rawEvent.tCoarse) * p.T;
				p.timeEnd = (1024LL * CurrentFrameID + rawEvent.eCoarse) * p.T;
				if((p.timeEnd - p.time) < -256*p.T) p.timeEnd += (1024LL * p.T);
				p.channelID = rawEvent.channelID;
				p.channelIdleTime = rawEvent.channelIdleTime;
				p.region = rawEvent.channelID / 16;
				p.feType = RawPulse::TOFPET;
				p.d.tofpet.tac = rawEvent.tac;
				p.d.tofpet.tcoarse = rawEvent.tCoarse;
				p.d.tofpet.ecoarse = rawEvent.eCoarse;
				p.d.tofpet.tfine =  rawEvent.tFine;
				p.d.tofpet.efine = rawEvent.eFine;
				p.d.tofpet.tacIdleTime = rawEvent.tacIdleTime;

				//printf("DBG T frameID = %20lld tCoarse = %6u time = %20lld\n", CurrentFrameID, rawEvent.tCoarse, p.time);

				if(CurrentFrameID < minFrameID) minFrameID = CurrentFrameID;
				if(CurrentFrameID > maxFrameID) maxFrameID = CurrentFrameID;
				
				if(p.channelID >= SYSTEM_NCHANNELS)
					  continue;
				
				if(p.time > tMax)
					  tMax = p.time;
				
				outBuffer->pushWriteSlot();
				
				if(outBuffer->getSize() >= (outBlockSize - 512)) {
					  outBuffer->setTMin(lastTMax);
					  outBuffer->setTMax(tMax);		
					  sink->pushEvents(outBuffer);
					  outBuffer = NULL;
				}
				continue;
		  }
		  case 3:{
				RawSTICv3 rawEvent2;
//.........这里部分代码省略.........
开发者ID:andrea-celentano,项目名称:OptoTrackerTofpet,代码行数:101,代码来源:Raw.cpp

示例3: sizeof

void RawReaderV2::run()
{

	unsigned nWraps = 0;
	
	EventBuffer<RawPulse> *outBuffer = NULL;
	
	int nEventsInFrame = 0;
	
	long long tMax = 0, lastTMax = 0;

	sink->pushT0(0);
	
	long long minFrameID = LLONG_MAX;
	long long maxFrameID = LLONG_MIN;
	
	fprintf(stderr, "Reading %llu to %llu\n", eventsBegin, eventsEnd);
	fseek(dataFile, eventsBegin * sizeof(RawEventV2), SEEK_SET);
	
	int maxReadBlock = 1024*1024;
	RawEventV2 *rawEvents = new RawEventV2[maxReadBlock];

	unsigned long long readPointer = eventsBegin;
	while (readPointer < eventsEnd) {
		unsigned long long count = eventsEnd - readPointer;
		if(count > maxReadBlock) count = maxReadBlock;
		int r = fread(rawEvents, sizeof(RawEventV2), count, dataFile);
		if(r <= 0) break;
		readPointer += r;
	
		//printf("events extracted= %lld\n",readPointer);
	
		for(int j = 0; j < r; j++) {
			RawEventV2 &rawEvent = rawEvents[j];

			if(outBuffer == NULL) {
				outBuffer = new EventBuffer<RawPulse>(outBlockSize);
			}
		

			RawPulse &p = outBuffer->getWriteSlot();
			
			// Carefull with the float/double/integer conversions here..
			p.T = T * 1E12;
			p.time = (1024LL * rawEvent.frameID + rawEvent.tCoarse) * p.T;
			p.timeEnd = (1024LL * rawEvent.frameID + rawEvent.eCoarse) * p.T;
			if((p.timeEnd - p.time) < -256*p.T) p.timeEnd += (1024LL * p.T);
			p.channelID = (64 * rawEvent.asicID) + rawEvent.channelID;
			p.channelIdleTime = rawEvent.channelIdleTime;
			p.region = (64 * rawEvent.asicID + rawEvent.channelID) / 16;
			p.feType = RawPulse::TOFPET;
			p.d.tofpet.tac = rawEvent.tacID;
			p.d.tofpet.tcoarse = rawEvent.tCoarse;
			p.d.tofpet.ecoarse = rawEvent.eCoarse;
			p.d.tofpet.tfine =  rawEvent.tFine;
			p.d.tofpet.efine = rawEvent.eFine;
			p.channelIdleTime = rawEvent.channelIdleTime;
			p.d.tofpet.tacIdleTime = rawEvent.tacIdleTime;
		
			if(rawEvent.frameID < minFrameID) minFrameID = rawEvent.frameID;
			if(rawEvent.frameID > maxFrameID) maxFrameID = rawEvent.frameID;
				
			if(p.channelID >= SYSTEM_NCHANNELS)
				continue;
		
			if(p.time > tMax)
				tMax = p.time;
		
			outBuffer->pushWriteSlot();
		
			if(outBuffer->getSize() >= outBlockSize) {
				outBuffer->setTMin(lastTMax);
				outBuffer->setTMax(tMax);
				sink->pushEvents(outBuffer);
				lastTMax = tMax;
				outBuffer = NULL;
			}
		}
	}
	
	delete [] rawEvents;

	
	if(outBuffer != NULL) {
		outBuffer->setTMin(lastTMax);
		outBuffer->setTMax(tMax);		
		sink->pushEvents(outBuffer);
		outBuffer = NULL;
		
	}
	
	sink->finish();
	
	fprintf(stderr, "RawReaderV2 report\n");
	fprintf(stderr, "\t%16lld minFrameID\n", minFrameID);
	fprintf(stderr, "\t%16lld maxFrameID\n", maxFrameID);
	sink->report();
}
开发者ID:andrea-celentano,项目名称:OptoTrackerTofpet,代码行数:98,代码来源:RawV2.cpp


注:本文中的EventBuffer::setTMin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。