1 |
/** @file |
/** @file |
2 |
* $Author: mocchiut $ |
* $Author: mocchiut $ |
3 |
* $Date: 2006/11/16 11:01:34 $ |
* $Date: 2006/11/16 12:28:17 $ |
4 |
* $Revision: 6.13 $ |
* $Revision: 6.14 $ |
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: /afs/ba.infn.it/user/pamela/src/CVS/yoda/techmodel/EventReader.cpp,v 6.13 2006/11/16 11:01:34 mocchiut Exp $\n"; |
"$Header: /afs/ba.infn.it/user/pamela/src/CVS/yoda/techmodel/EventReader.cpp,v 6.14 2006/11/16 12:28:17 mocchiut Exp $\n"; |
91 |
} |
} |
92 |
|
|
93 |
/** |
/** |
98 |
SetInputStream(run); |
SetInputStream(run); |
99 |
//Create the structure of directories and create xxx.Header.root files |
//Create the structure of directories and create xxx.Header.root files |
100 |
run->WriteHeaders(this, &Header); |
run->WriteHeaders(this, &Header); |
101 |
|
fPL = 0; |
102 |
|
notfirst = false; |
103 |
|
jgood = true; |
104 |
//Create the xxx.root in it's specific directory |
//Create the xxx.root in it's specific directory |
105 |
for (AlgorithmMap::iterator i = TechmodelAlgorithmMap.begin(); |
for (AlgorithmMap::iterator i = TechmodelAlgorithmMap.begin(); |
106 |
i != TechmodelAlgorithmMap.end(); i++) { |
i != TechmodelAlgorithmMap.end(); i++) { |
143 |
// |
// |
144 |
// E. Mocchiutti |
// E. Mocchiutti |
145 |
// |
// |
|
|
|
146 |
// |
// |
147 |
// Start reading the next event jumping the CPU padding to 64 bits |
// Start reading the next event jumping the CPU padding to 64 bits |
|
// |
|
|
Float_t pd0 = (16.+Header->GetPscuHeader()->GetPacketLenght())/64.; |
|
|
Float_t pd1 = pd0 - (Float_t)int(pd0); |
|
|
Float_t padfrac = 64. - pd1 * 64.; |
|
148 |
// |
// |
149 |
UInt_t padbytes = (UInt_t)padfrac; |
if ( Header->GetPscuHeader()->GetPacketId1() == 0x10 ) notfirst = true; |
150 |
if ( padbytes > 0 && !InputFile->eof() ){ |
// |
151 |
oss.str(""); |
if ( !InputFile->eof() && notfirst ){ |
152 |
oss << " padbytes is " << padbytes << " \n skipping these bytes\n"; |
const unsigned char fafe[3]={0xFA, 0xFE, 0xDE}; |
153 |
logger->info(oss.str().c_str()); |
char isfa[3]; |
154 |
InputFile->seekg(padbytes,std::ios::cur); |
memset(isfa, 0, 3*sizeof(char)); |
155 |
|
InputFile->read(isfa, sizeof(isfa)); |
156 |
|
InputFile->seekg(-3,std::ios::cur); |
157 |
|
// |
158 |
|
fPL += 16 + Header->GetPscuHeader()->GetPacketLenght(); |
159 |
|
// |
160 |
|
if ( (0x000000FF & isfa[0]) == fafe[0] && (0x000000FF & isfa[2]) == fafe[2] && (0x000000FF & isfa[2]) == fafe[2] ){ |
161 |
|
// |
162 |
|
fPL += 0; |
163 |
|
} else { |
164 |
|
if ( !jgood ){ |
165 |
|
jgood = true; |
166 |
|
} else { |
167 |
|
Float_t pd0 = fPL/64.; |
168 |
|
fPL = 0; |
169 |
|
Float_t pd1 = pd0 - (Float_t)int(pd0); |
170 |
|
Float_t padfrac = 64. - pd1 * 64.; |
171 |
|
// |
172 |
|
UInt_t padbytes = (UInt_t)padfrac; |
173 |
|
if ( padbytes > 0 && padbytes < 64 ){ |
174 |
|
oss.str(""); |
175 |
|
oss << " padbytes is " << padbytes << " \n skipping these bytes\n"; |
176 |
|
logger->info(oss.str().c_str()); |
177 |
|
InputFile->seekg(padbytes,std::ios::cur); |
178 |
|
}; |
179 |
|
}; |
180 |
|
}; |
181 |
}; |
}; |
|
|
|
182 |
// |
// |
183 |
// end E. Mocchiutti |
// end E. Mocchiutti |
184 |
// |
// |
189 |
oss.str(""); |
oss.str(""); |
190 |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
191 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
192 |
|
jgood = false; |
193 |
} catch (WrongCRCHeaderException exc) { |
} catch (WrongCRCHeaderException exc) { |
194 |
oss.str(""); |
oss.str(""); |
195 |
oss << exc.print(); |
oss << exc.print(); |
196 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
197 |
|
jgood = false; |
198 |
} catch (WrongCRCException exc) { |
} catch (WrongCRCException exc) { |
199 |
oss.str(""); |
oss.str(""); |
200 |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
201 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
202 |
archiveCorruptedPacket(Header->GetPscuHeader()->FileOffset, Header->GetPscuHeader()->PacketLenght); |
archiveCorruptedPacket(Header->GetPscuHeader()->FileOffset, Header->GetPscuHeader()->PacketLenght); |
203 |
|
jgood = false; |
204 |
} catch (UnidentifiedPacketException exc) { |
} catch (UnidentifiedPacketException exc) { |
205 |
oss.str(""); |
oss.str(""); |
206 |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
207 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
208 |
|
jgood = false; |
209 |
} catch (NotExistingCounterException exc) { |
} catch (NotExistingCounterException exc) { |
210 |
oss.str(""); |
oss.str(""); |
211 |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
212 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
213 |
|
jgood = false; |
214 |
} catch (LengthException exc) { |
} catch (LengthException exc) { |
215 |
oss.str(""); |
oss.str(""); |
216 |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
217 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
218 |
|
jgood = false; |
219 |
} catch (BackwardCounterException exc) { |
} catch (BackwardCounterException exc) { |
220 |
oss.str(""); |
oss.str(""); |
221 |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
oss << exc.print() << " " << Header->GetPscuHeader()->Print(); |
222 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
223 |
|
jgood = false; |
224 |
} catch (...) { |
} catch (...) { |
225 |
logger->error("Couldn't read the event. Skipping to the next header. \n"); |
logger->error("Couldn't read the event. Skipping to the next header. \n"); |
226 |
|
jgood = false; |
227 |
} |
} |
228 |
if ((step%1000) == 0) std::cout << step/1000 << "K \n"; |
if ((step%1000) == 0) std::cout << step/1000 << "K \n"; |
229 |
oss.str(""); |
oss.str(""); |
280 |
if (OrbitalTime < prevPckOBT){ |
if (OrbitalTime < prevPckOBT){ |
281 |
oss.str(""); |
oss.str(""); |
282 |
oss << " Onboard Time is less than before of " << (prevPckOBT - OrbitalTime); |
oss << " Onboard Time is less than before of " << (prevPckOBT - OrbitalTime); |
283 |
|
notfirst = false; |
284 |
logger->error(oss.str().c_str()); |
logger->error(oss.str().c_str()); |
285 |
} |
} |
286 |
|
|