11 #ifndef O_LARGEFILE //for OSX
16 if(
sizeof(
unsigned long long)!=8 ||
sizeof(
unsigned short)!=2 )
17 throw std::runtime_error(
std::string(
"Wrong platform: sizeof(unsigned long long)!=8 || sizeof(unsigned short)!=2"));
18 raw_event =
new unsigned short [200000*40];
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 dccWordCount = 0;
51 while( !
end && dccWordCount<50000*40 ){
52 unsigned long long *dccWord =
start;
53 unsigned long long preHeader = 0;
57 while( dccWord<file_buffer_end && dccWordCount<50000 ){
61 if( (word_1&0xF0000000000000FFLL)==0x500000000000005FLL &&
62 (word_2&0xFF000000000000FFLL)==0xD900000000000017LL ){
69 if( (word_0&0xFFFFFFFFFFFF0000LL)==0xFFFFFFFFFFFF0000LL ) eventStatus |= FFFF;
74 eventStatus |= Header;
75 if(
event==raw_event ) preHeader = word_1;
78 if( (word_1&0xFF00000000000000LL)==0xEF00000000000000LL &&
79 (word_2&0xFF0000000000000FLL)==0xAF00000000000007LL ){
80 eventStatus |= Trailer;
92 memcpy(
event,&preHeader,
sizeof(preHeader));
93 event +=
sizeof(preHeader)/
sizeof(
unsigned short);
97 memcpy(
event,start,(dccWord-start)*
sizeof(
unsigned long long));
98 event += (dccWord-
start)*
sizeof(
unsigned long long)/
sizeof(
unsigned short);
101 if( dccWordCount==50000*40 ){
end = dccWord;
break; }
105 ssize_t length =
::read(fd,file_buffer,
sizeof(file_buffer));
106 if( length==-1 )
throw ( std::runtime_error(
"Error of reading") );
108 eventStatus |= EndOfStream;
109 end = (file_buffer_end = file_buffer +
sizeof(file_buffer)/
sizeof(
unsigned long long));
112 file_buffer_end = file_buffer + length/
sizeof(
unsigned long long);
119 if( !
end ) eventStatus |= DCCoversize;
120 if( !(eventStatus&
Header) && !(eventStatus&Trailer) && !(eventStatus&FFFF) ) eventStatus |=
Unknown;
122 buf = (
const unsigned short*)raw_event;
123 return (eventStatus&FFFF?
event-raw_event-4:
event-raw_event);
129 if( (size =
read(buf)) == 0 )
break;
130 }
while( rejectCriteria&eventStatus || !(acceptCriteria&eventStatus) || (selectCriteria?selectCriteria!=eventStatus:0) );
size_t read(const unsigned short *&buf)
int open(const char *filename)
tuple start
Check for commandline option errors.
virtual ~FileReaderDCC(void)
unsigned long long word_0
unsigned int acceptCriteria
unsigned int rejectCriteria
unsigned long long * file_buffer_end
unsigned long long word_1
unsigned long long file_buffer[4000]
size_t next(const unsigned short *&buf)
unsigned long long word_2
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 int selectCriteria
unsigned short * raw_event
tuple size
Write out results.