![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "GaudiKernel/GaudiException.h"
14 #include "GaudiKernel/ISvcLocator.h"
15 #include "GaudiKernel/MsgStream.h"
17 #define IsBitSet(val, bit) ((val) & (1 << (bit)))
46 int stream=
s->first, wanted=
s->second;
47 for (
int e=0;
e<wanted; ++
e){
55 if (
myrand.Uniform(1.0)>psratio){
72 std::ostringstream
out;
74 out<<
"\nevent "<<
s->first<<
" goes to stream(s)";
75 for (
unsigned int e=0;
e<
s->second.size(); ++
e){
76 out<<
" "<<
s->second[
e];
88 const std::string&
type,
89 const std::string&
name,
92 m_inputSvc(
"ByteStreamEventStorageInputSvc",
name),
96 declareInterface<IAthenaOutputStreamTool>(
this);
104 sprintf(buf,
"ByteStreamEventStorageOutputSvc%d",
i);
186 return(StatusCode::SUCCESS);
194 FILE *
fp = fopen(
file.c_str(),
"r");
197 throw std::runtime_error(
"File could not be opened in ByteStreamMultipleOutputStreamCopyTool::initlbnmap");
199 char *
line=
new char[500];
202 while (fgets(
line,480,
fp)) {
203 if (
line[0]==
'-')
continue;
204 int s=sscanf(&
line[0],
"stream %d, run %d, lbn %d, has %d events and %f/ub, %f intlumi of run, and %d wanted",&
stream,&
run,&
lbn,&nevt,&
intlumi,&intlumifrac,&nwanted);
223 FILE *
fp = fopen(
file.c_str(),
"r");
226 throw std::runtime_error(
"File could not be opened in ByteStreamMultipleOutputStreamCopyTool::initlbnmap");
228 char *
line=
new char[500];
231 while (fgets(
line,480,
fp)) {
232 if (
line[0]==
'-')
continue;
233 int s=sscanf(&
line[0],
"run_nbr=%d, evt_nbr=%d, time_stamp=%d, lbk_nbr=%d, noalg=%d, j40=%d, noalgps=%d, j40ps=%d",&
run,&
evt,&
time,&
lbn,&noalg,&j40,&psnoalg,&psj40);
235 ATH_MSG_INFO(evtinfile<<
": "<<
run<<
" "<<
lbn<<
" "<<
evt<<
": passed noalg j40 "<<noalg<<
" "<<j40<<
", prescale noalg j40 "<<psnoalg<<
" "<<psj40);
265 for (
auto l =
r->second.begin();
l!=
r->second.end();
l++ ){
266 l->second.makestreammap();
267 ATH_MSG_INFO(
r->first<<
" "<<
l->first<<
" wants: "<<
l->second.streameventstring());
277 for (
auto l =
r->second.begin();
l!=
r->second.end();
l++ ){
279 if (
l->second.magic!=9999){
284 ATH_MSG_INFO(
r->first<<
" "<<
l->first<<
" wrote out "<<
l->second.written_j40<<
" j40 and "<<
l->second.written_no_j40<<
" non-j40 events");
286 if (
l->second.currentevent!=0){
288 if (
l->second.currentevent!=
l->second.nevt){
289 ATH_MSG_WARNING(
r->first<<
" "<<
l->first<<
" saw "<<
l->second.currentevent<<
" and we expected "<<
l->second.nevt<<
" events!");
292 ATH_MSG_INFO(
r->first<<
" "<<
l->first<<
" saw all "<<
l->second.nevt<<
" events expected.");
309 return StatusCode::SUCCESS;
314 return StatusCode::SUCCESS;
321 ATH_MSG_ERROR(
" failed to get the current event from ByteStreamInputSvc " );
322 return StatusCode::FAILURE ;
325 int run = re_c->run_no();
328 if (re_c->version() < 0x03010000) {
eventNumber=re_c->lvl1_id(); }
331 int lbn = re_c->lumi_block();
333 int bcid = re_c->bc_id();
335 int nL1word = re_c->nlvl1_trigger_info();
345 return StatusCode::SUCCESS ;
354 return StatusCode::SUCCESS ;
367 if ((
l.currentevent>=
l.nevt || ((
unsigned int)
l.currentevent)>
l.trigmap.size()) &&
l.noalgps>0) {
368 ATH_MSG_WARNING(
"Only expecting "<<
l.nevt<<
" events in "<<
run<<
" "<<
lbn<<
" with trigmap size "<<
l.trigmap.size());
371 std::vector<int>
streams=
l.streammap[
l.currentevent];
373 else{
ATH_MSG_INFO(
lbn<<
" "<<
l.currentevent<<
" goes to "<<
streams.size()<<
" streams and j40 is "<<
l.trigmap[
l.currentevent]);}
376 for (
unsigned int s=0;
s<
streams.size(); ++
s){
381 return StatusCode::FAILURE ;
383 if (
l.noalgps>0){
if (
l.trigmap[
l.currentevent])
l.written_j40++;
else l.written_no_j40++; }
392 static int eventstream=-1,ntotevents=0;
397 return StatusCode::FAILURE ;
401 if (ntotevents%100==0){ ++eventstream; }
404 return StatusCode::SUCCESS ;
409 return StatusCode::FAILURE ;
413 ATH_MSG_ERROR(
" failed to write event to ByteStreamOutputSvc"<<eventstream);
414 return StatusCode::FAILURE ;
416 ATH_MSG_INFO(
" wrote event "<<ntotevents<<
" to ByteStreamOutputSvc"<<eventstream);
419 return StatusCode::SUCCESS ;
425 return StatusCode::SUCCESS ;
430 if ( typeKeys.size()!=0){
432 ATH_MSG_WARNING(
" Streaming objects is not supported. The whole input event is written out" );
435 return(StatusCode::SUCCESS);
439 if ( dataObjects.size()!=0){
440 ATH_MSG_WARNING(
" Streaming objects is not supported. The whole input event is written out" );
443 return(StatusCode::SUCCESS);
447 if ( dataObjects.size()!=0){
448 ATH_MSG_WARNING(
" fillObjectRefs is not supported. The whole input event is written out" );
451 return(StatusCode::SUCCESS);
455 return(StatusCode::SUCCESS);
def retrieve(aClass, aKey=None)
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::map< int, std::vector< int > > streammap
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
std::map< int, int > wantedmap
int run(int argc, char *argv[])
a run-time configurable list of data objects
msgSvc
Provide convenience handles for various services.
::StatusCode StatusCode
StatusCode definition for legacy code.
#define CHECK(...)
Evaluate an expression and check for errors.
setEventNumber setTimeStamp bcid
def time(flags, cells_name, *args, **kw)
#define ATH_MSG_WARNING(x)
const boost::regex re(r_e)
std::vector< int > trigevt
Define macros for attributes used to control the static checker.
std::vector< int > trigmap
std::string streameventstring()