|
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);
112 declareProperty(
"ByteStreamOutputSvc0",
m_outputSvc[0],
"Handle to the ByteStreamOutputSvc");
113 declareProperty(
"ByteStreamOutputSvc1",
m_outputSvc[1],
"Handle to the ByteStreamOutputSvc");
114 declareProperty(
"ByteStreamOutputSvc2",
m_outputSvc[2],
"Handle to the ByteStreamOutputSvc");
115 declareProperty(
"ByteStreamOutputSvc3",
m_outputSvc[3],
"Handle to the ByteStreamOutputSvc");
116 declareProperty(
"ByteStreamOutputSvc4",
m_outputSvc[4],
"Handle to the ByteStreamOutputSvc");
117 declareProperty(
"ByteStreamOutputSvc5",
m_outputSvc[5],
"Handle to the ByteStreamOutputSvc");
118 declareProperty(
"ByteStreamOutputSvc6",
m_outputSvc[6],
"Handle to the ByteStreamOutputSvc");
119 declareProperty(
"ByteStreamOutputSvc7",
m_outputSvc[7],
"Handle to the ByteStreamOutputSvc");
120 declareProperty(
"ByteStreamOutputSvc8",
m_outputSvc[8],
"Handle to the ByteStreamOutputSvc");
121 declareProperty(
"ByteStreamOutputSvc9",
m_outputSvc[9],
"Handle to the ByteStreamOutputSvc");
122 declareProperty(
"ByteStreamOutputSvc10",
m_outputSvc[10],
"Handle to the ByteStreamOutputSvc");
123 declareProperty(
"ByteStreamOutputSvc11",
m_outputSvc[11],
"Handle to the ByteStreamOutputSvc");
124 declareProperty(
"ByteStreamOutputSvc12",
m_outputSvc[12],
"Handle to the ByteStreamOutputSvc");
125 declareProperty(
"ByteStreamOutputSvc13",
m_outputSvc[13],
"Handle to the ByteStreamOutputSvc");
126 declareProperty(
"ByteStreamOutputSvc14",
m_outputSvc[14],
"Handle to the ByteStreamOutputSvc");
127 declareProperty(
"ByteStreamOutputSvc15",
m_outputSvc[15],
"Handle to the ByteStreamOutputSvc");
128 declareProperty(
"ByteStreamOutputSvc16",
m_outputSvc[16],
"Handle to the ByteStreamOutputSvc");
129 declareProperty(
"ByteStreamOutputSvc17",
m_outputSvc[17],
"Handle to the ByteStreamOutputSvc");
130 declareProperty(
"ByteStreamOutputSvc18",
m_outputSvc[18],
"Handle to the ByteStreamOutputSvc");
131 declareProperty(
"ByteStreamOutputSvc19",
m_outputSvc[19],
"Handle to the ByteStreamOutputSvc");
132 declareProperty(
"ByteStreamOutputSvc20",
m_outputSvc[20],
"Handle to the ByteStreamOutputSvc");
133 declareProperty(
"ByteStreamOutputSvc21",
m_outputSvc[21],
"Handle to the ByteStreamOutputSvc");
134 declareProperty(
"ByteStreamOutputSvc22",
m_outputSvc[22],
"Handle to the ByteStreamOutputSvc");
135 declareProperty(
"ByteStreamOutputSvc23",
m_outputSvc[23],
"Handle to the ByteStreamOutputSvc");
136 declareProperty(
"ByteStreamOutputSvc24",
m_outputSvc[24],
"Handle to the ByteStreamOutputSvc");
137 declareProperty(
"ByteStreamOutputSvc25",
m_outputSvc[25],
"Handle to the ByteStreamOutputSvc");
138 declareProperty(
"ByteStreamOutputSvc26",
m_outputSvc[26],
"Handle to the ByteStreamOutputSvc");
139 declareProperty(
"ByteStreamOutputSvc27",
m_outputSvc[27],
"Handle to the ByteStreamOutputSvc");
140 declareProperty(
"ByteStreamOutputSvc28",
m_outputSvc[28],
"Handle to the ByteStreamOutputSvc");
141 declareProperty(
"ByteStreamOutputSvc29",
m_outputSvc[29],
"Handle to the ByteStreamOutputSvc");
142 declareProperty(
"ByteStreamOutputSvc30",
m_outputSvc[30],
"Handle to the ByteStreamOutputSvc");
143 declareProperty(
"ByteStreamOutputSvc31",
m_outputSvc[31],
"Handle to the ByteStreamOutputSvc");
144 declareProperty(
"ByteStreamOutputSvc32",
m_outputSvc[32],
"Handle to the ByteStreamOutputSvc");
145 declareProperty(
"ByteStreamOutputSvc33",
m_outputSvc[33],
"Handle to the ByteStreamOutputSvc");
146 declareProperty(
"ByteStreamOutputSvc34",
m_outputSvc[34],
"Handle to the ByteStreamOutputSvc");
147 declareProperty(
"ByteStreamOutputSvc35",
m_outputSvc[35],
"Handle to the ByteStreamOutputSvc");
148 declareProperty(
"ByteStreamOutputSvc36",
m_outputSvc[36],
"Handle to the ByteStreamOutputSvc");
149 declareProperty(
"ByteStreamOutputSvc37",
m_outputSvc[37],
"Handle to the ByteStreamOutputSvc");
150 declareProperty(
"ByteStreamOutputSvc38",
m_outputSvc[38],
"Handle to the ByteStreamOutputSvc");
151 declareProperty(
"ByteStreamOutputSvc39",
m_outputSvc[39],
"Handle to the ByteStreamOutputSvc");
152 declareProperty(
"ByteStreamOutputSvc40",
m_outputSvc[40],
"Handle to the ByteStreamOutputSvc");
153 declareProperty(
"ByteStreamOutputSvc41",
m_outputSvc[41],
"Handle to the ByteStreamOutputSvc");
154 declareProperty(
"ByteStreamOutputSvc42",
m_outputSvc[42],
"Handle to the ByteStreamOutputSvc");
155 declareProperty(
"ByteStreamOutputSvc43",
m_outputSvc[43],
"Handle to the ByteStreamOutputSvc");
156 declareProperty(
"ByteStreamOutputSvc44",
m_outputSvc[44],
"Handle to the ByteStreamOutputSvc");
157 declareProperty(
"ByteStreamOutputSvc45",
m_outputSvc[45],
"Handle to the ByteStreamOutputSvc");
158 declareProperty(
"ByteStreamOutputSvc46",
m_outputSvc[46],
"Handle to the ByteStreamOutputSvc");
159 declareProperty(
"ByteStreamOutputSvc47",
m_outputSvc[47],
"Handle to the ByteStreamOutputSvc");
160 declareProperty(
"ByteStreamOutputSvc48",
m_outputSvc[48],
"Handle to the ByteStreamOutputSvc");
161 declareProperty(
"ByteStreamOutputSvc49",
m_outputSvc[49],
"Handle to the ByteStreamOutputSvc");
163 declareProperty(
"ByteStreamInputSvc",
m_inputSvc,
"Handle to the ByteStreamInputSvc");
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()
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()