11 #ifndef O_LARGEFILE //for OSX
17 if(
sizeof(
unsigned long long)!=8 ||
sizeof(
unsigned short)!=2 )
18 throw std::runtime_error(
std::string(
"Wrong platform: sizeof(unsigned long long)!=8 || sizeof(unsigned short)!=2"));
41 if(
end>file_buffer_end ||
end<file_buffer )
throw ( std::runtime_error(
"Error of reading") );
42 if( !fd )
throw ( std::runtime_error(
"Open some file first") );
45 unsigned short *
event = raw_event;
48 size_t dduWordCount = 0;
51 while( !
end && dduWordCount<50000 ){
52 unsigned long long *dduWord =
start;
53 unsigned long long preHeader = 0;
57 while( dduWord<file_buffer_end && dduWordCount<50000 ){
61 if( (word_2&0xFFFFFFFFFFFF0000LL)==0x8000000180000000LL ){
68 if( (word_0&0xFFFFFFFFFFFF0000LL)==0xFFFFFFFFFFFF0000LL ) eventStatus |= FFFF;
73 eventStatus |= Header;
74 if(
event==raw_event ) preHeader = word_1;
77 if( (word_0&0xFFFFFFFFFFFF0000LL)==0x8000FFFF80000000LL ){
78 eventStatus |= Trailer;
90 memcpy(
event,&preHeader,
sizeof(preHeader));
91 event +=
sizeof(preHeader)/
sizeof(
unsigned short);
95 memcpy(
event,start,(dduWord-start)*
sizeof(
unsigned long long));
96 event += (dduWord-
start)*
sizeof(
unsigned long long)/
sizeof(
unsigned short);
99 if( dduWordCount==50000 ){
end = dduWord;
break; }
103 ssize_t length =
::read(fd,file_buffer,
sizeof(file_buffer));
104 if( length==-1 )
throw ( std::runtime_error(
"Error of reading") );
106 eventStatus |= EndOfStream;
107 end = (file_buffer_end = file_buffer +
sizeof(file_buffer)/
sizeof(
unsigned long long));
110 file_buffer_end = file_buffer + length/
sizeof(
unsigned long long);
117 if( !
end ) eventStatus |= DDUoversize;
118 if( !(eventStatus&
Header) && !(eventStatus&Trailer) && !(eventStatus&FFFF) ) eventStatus |=
Unknown;
120 buf = (
const unsigned short*)raw_event;
121 return (eventStatus&FFFF?
event-raw_event-4:
event-raw_event);
126 for(
int i=0;
i<prescaling;
i++){
128 if( (size =
read(buf)) == 0 )
break;
129 }
while( rejectCriteria&eventStatus || !(acceptCriteria&eventStatus) || (selectCriteria?selectCriteria!=eventStatus:0) );
unsigned int rejectCriteria
tuple start
Check for commandline option errors.
unsigned long long word_2
size_t read(const unsigned short *&buf)
virtual ~FileReaderDDU(void)
unsigned short raw_event[200000]
unsigned int acceptCriteria
unsigned long long word_0
unsigned long long * file_buffer_end
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned long long file_buffer[4000]
size_t next(const unsigned short *&buf, int prescaling=1)
unsigned int selectCriteria
int open(const char *filename)
unsigned long long word_1
tuple size
Write out results.