| 1 |
/** @file |
/** @file |
| 2 |
* $Author: kusanagi $ |
* $Author: mocchiut $ |
| 3 |
* $Date: 2006/05/30 19:10:03 $ |
* $Date: 2006/11/13 11:45:49 $ |
| 4 |
* $Revision: 6.5 $ |
* $Revision: 6.10 $ |
| 5 |
* |
* |
| 6 |
* Implementation of the functions of a sample Algorithm class. |
* Implementation of the functions of a sample Algorithm class. |
| 7 |
* This file can be used as a templace to develop your own algorithm. |
* This file can be used as a templace to develop your own algorithm. |
| 87 |
*/ |
*/ |
| 88 |
std::string EventReader::GetVersionInfo(void) const { |
std::string EventReader::GetVersionInfo(void) const { |
| 89 |
return |
return |
| 90 |
"$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 6.5 2006/05/30 19:10:03 kusanagi Exp $\n"; |
"$Header: /afs/ba.infn.it/user/pamela/src/CVS/yoda/techmodel/EventReader.cpp,v 6.10 2006/11/13 11:45:49 mocchiut Exp $\n"; |
| 91 |
} |
} |
| 92 |
|
|
| 93 |
/** |
/** |
| 120 |
stringstream oss; |
stringstream oss; |
| 121 |
int step = 0; |
int step = 0; |
| 122 |
const PacketType* type; |
const PacketType* type; |
| 123 |
while (!InputFile->eof() && ((step++ < maxPackets) || (maxPackets == 0))){ |
while (InputFile->good() && !InputFile->eof() && ((step++ < maxPackets) || (maxPackets == 0))){ |
| 124 |
try { |
try { |
| 125 |
if (FindStart()) { |
if (FindStart()) { |
| 126 |
UnpackPscuHeader(); |
UnpackPscuHeader(); |
| 137 |
oss << "\n No way to read events of type " << type->GetName().c_str() << Header->GetPscuHeader()->Print(); |
oss << "\n No way to read events of type " << type->GetName().c_str() << Header->GetPscuHeader()->Print(); |
| 138 |
throw NotExistingAlgorithmException(oss.str().c_str()); //to exctract to an higher level and delete the logger! |
throw NotExistingAlgorithmException(oss.str().c_str()); //to exctract to an higher level and delete the logger! |
| 139 |
} |
} |
| 140 |
|
|
| 141 |
|
// |
| 142 |
|
// E. Mocchiutti |
| 143 |
|
// |
| 144 |
|
|
| 145 |
|
// |
| 146 |
|
// Start reading the next event jumping the CPU padding to 64 bits |
| 147 |
|
// |
| 148 |
|
Float_t pd0 = (16.+Header->GetPscuHeader()->GetPacketLenght())/64.; |
| 149 |
|
Float_t pd1 = pd0 - (Float_t)int(pd0); |
| 150 |
|
Float_t padfrac = 64. - pd1 * 64.; |
| 151 |
|
// |
| 152 |
|
UInt_t padbytes = (UInt_t)padfrac; |
| 153 |
|
if ( padbytes > 0 ){ |
| 154 |
|
oss.str(""); |
| 155 |
|
oss << " padbytes is " << padbytes << " \n skipping these bytes\n"; |
| 156 |
|
logger->info(oss.str().c_str()); |
| 157 |
|
InputFile->seekg(padbytes,std::ios::cur); |
| 158 |
|
}; |
| 159 |
|
|
| 160 |
|
// |
| 161 |
|
// end E. Mocchiutti |
| 162 |
|
// |
| 163 |
|
|
| 164 |
} |
} |
| 165 |
// In case of exception have to save the packet in a specific root file?? |
// In case of exception have to save the packet in a specific root file?? |
| 166 |
} catch (NotExistingAlgorithmException exc) { |
} catch (NotExistingAlgorithmException exc) { |
| 212 |
stringstream oss; |
stringstream oss; |
| 213 |
int response = 0; |
int response = 0; |
| 214 |
char buff[16]; |
char buff[16]; |
| 215 |
|
memset(buff, 0, 16*sizeof(char)); |
| 216 |
InputFile->read(buff, sizeof(buff)); |
InputFile->read(buff, sizeof(buff)); |
| 217 |
|
|
| 218 |
|
|
| 309 |
int loop = -1; |
int loop = -1; |
| 310 |
char buffer[buffSize]; |
char buffer[buffSize]; |
| 311 |
bool flagOverPad = false; |
bool flagOverPad = false; |
| 312 |
|
memset(buffer, 0, buffSize*sizeof(char)); |
| 313 |
while (!InputFile->eof()) { |
while (!InputFile->eof()) { |
| 314 |
InputFile->read(buffer, sizeof(buffer)); |
InputFile->read(buffer, sizeof(buffer)); |
| 315 |
index = 0; |
index = 0; |