22 |
*/ |
*/ |
23 |
std::string NeutronDetectorReader::GetVersionInfo(void) const { |
std::string NeutronDetectorReader::GetVersionInfo(void) const { |
24 |
return |
return |
25 |
"$Header: /home/cvsmanager/yoda/techmodel/physics/NeutronDetectorReader.cpp,v 1.2 2004/09/21 20:24:53 kusanagi Exp $"; |
"$Header: /home/cvsmanager/yoda/techmodel/physics/NeutronDetectorReader.cpp,v 2.0 2004/09/21 20:51:22 kusanagi Exp $"; |
26 |
} |
} |
27 |
|
|
28 |
/** |
/** |
47 |
*/ |
*/ |
48 |
void NeutronDetectorReader::RunEvent(int EventNumber, const char subData[], long int lenght) { |
void NeutronDetectorReader::RunEvent(int EventNumber, const char subData[], long int lenght) { |
49 |
NeutronRecord *rec; |
NeutronRecord *rec; |
50 |
int offset = 0; |
const int lenNeutronData = 12; |
51 |
char *data = new char[lenght]; |
char *data = new char[lenght]; |
52 |
//the 2 bytes subtracted belong to the final event CRC bytes |
//the 2 bytes subtracted belong to the final event CRC bytes |
53 |
memcpy(data, subData, lenght); |
memcpy(data, subData, lenght); |
54 |
neutronEvent->Records->Clear(); |
neutronEvent->Records->Clear(); |
55 |
TClonesArray &recs = *(neutronEvent->Records); |
TClonesArray &recs = *(neutronEvent->Records); |
56 |
offset = 12; |
int offset; |
57 |
if (haveData(data, lenght)){ |
if (haveData(data, lenght)){ |
58 |
for (int i = 0; i < 3; i++){ |
for (int i = 0; i < 3; i++){ |
59 |
|
offset = lenNeutronData - 4*i; |
60 |
rec = new(recs[i]) NeutronRecord(); //aggiungo un nuovo NeutronRecord all'evento |
rec = new(recs[i]) NeutronRecord(); //aggiungo un nuovo NeutronRecord all'evento |
61 |
rec->upperTrig = (((BYTE)data[lenght-offset])>>4); |
rec->upperTrig = (((BYTE)data[lenght-offset])>>4); |
62 |
rec->bottomTrig = (((BYTE)data[lenght-offset])&0x0F); |
rec->bottomTrig = (((BYTE)data[lenght-offset])&0x0F); |
63 |
rec->upperBack = (((BYTE)data[lenght-offset+1])>>4); |
rec->upperBack = (((BYTE)data[lenght-offset+1])>>4); |
64 |
rec->bottomBack = (((BYTE)data[lenght-offset+1])&0x0F); |
rec->bottomBack = (((BYTE)data[lenght-offset+1])&0x0F); |
|
offset = offset - 4*(i+1); |
|
65 |
} |
} |
66 |
} |
} |
67 |
delete[] data; |
delete[] data; |