Line data Source code
1 : // $Id$
2 :
3 : ///**************************************************************************
4 : ///* This file is property of and copyright by the *
5 : ///* ALICE Experiment at CERN, All rights reserved. *
6 : ///* *
7 : ///* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 : ///* for The ALICE HLT Project. *
9 : ///* *
10 : ///* Permission to use, copy, modify and distribute this software and its *
11 : ///* documentation strictly for non-commercial purposes is hereby granted *
12 : ///* without fee, provided that the above copyright notice appears in all *
13 : ///* copies and that both the copyright notice and this permission notice *
14 : ///* appear in the supporting documentation. The authors make no claims *
15 : ///* about the suitability of this software for any purpose. It is *
16 : ///* provided "as is" without express or implied warranty. *
17 : ///**************************************************************************/
18 :
19 : /// @file AliHLTFileWriter.cxx
20 : /// @author Matthias Richter
21 : /// @date
22 : /// @brief HLT file writer component implementation.
23 :
24 : #include "AliHLTFileWriter.h"
25 : #include "AliHLTBlockDataCollection.h"
26 : #include <TObjArray.h>
27 : #include <TObjString.h>
28 : #include <TSystem.h>
29 : //#include <TMath.h>
30 : //#include <TFile.h>
31 : #include <cassert>
32 :
33 : using namespace std;
34 :
35 : /** ROOT macro for the implementation of ROOT specific class methods */
36 8 : ClassImp(AliHLTFileWriter)
37 :
38 : AliHLTFileWriter::AliHLTFileWriter()
39 21 : : AliHLTDataSink()
40 21 : , fpBlockDataCollection(NULL)
41 21 : , fBaseName("")
42 21 : , fExtension("")
43 21 : , fDirectory("")
44 21 : , fSubDirFormat("")
45 21 : , fIdFormat("_0x%08x")
46 21 : , fSpecFormat("")
47 21 : , fBlcknoFormat("_0x%02x")
48 21 : , fCurrentFileName("")
49 21 : , fMode(0)
50 21 : , fpBurstBuffer(NULL)
51 21 : , fBurstBufferSize(0)
52 21 : , fBurstBlocks()
53 21 : , fBurstBlockEvents()
54 21 : , fPublisherConfName()
55 21 : , fPublisherConfEvent(-1)
56 69 : {
57 : // An HLT data sink component which writes data to file(s).
58 : //
59 : // Component ID: \b FileWriter <br>
60 : // Library: \b libAliHLTUtil.so <br>
61 : // Input Data Types: ::kAliHLTAllDataTypes <br>
62 : // Output Data Types: none <br>
63 24 : }
64 :
65 : AliHLTFileWriter::~AliHLTFileWriter()
66 54 : {
67 : // destructor
68 :
69 : // file list and file name list are owner of their objects and
70 : // delete all the objects
71 27 : }
72 :
73 : int AliHLTFileWriter::SetDefaults()
74 : {
75 : // init members with default values
76 0 : fBaseName="";
77 0 : fExtension="";
78 0 : fDirectory="";
79 0 : fSubDirFormat="";
80 0 : fIdFormat="_0x%08x";
81 0 : fSpecFormat="";
82 0 : fBlcknoFormat="_0x%02x";
83 0 : fCurrentFileName="";
84 0 : fMode=0;
85 0 : fpBurstBuffer=NULL;
86 0 : fBurstBufferSize=0;
87 0 : fBurstBlocks.clear();
88 0 : fBurstBlockEvents.clear();
89 0 : fPublisherConfEvent=-1;
90 0 : return 0;
91 : }
92 :
93 : const char* AliHLTFileWriter::GetComponentID()
94 : {
95 : // overloaded from AliHLTComponent
96 642 : return "FileWriter";
97 : }
98 :
99 : void AliHLTFileWriter::GetInputDataTypes( AliHLTComponentDataTypeList& list)
100 : {
101 : // overloaded from AliHLTComponent
102 0 : list.clear();
103 0 : list.push_back(kAliHLTAllDataTypes);
104 0 : }
105 :
106 : AliHLTComponent* AliHLTFileWriter::Spawn()
107 : {
108 : // overloaded from AliHLTComponent
109 0 : return new AliHLTFileWriter;
110 0 : }
111 :
112 : int AliHLTFileWriter::DoInit( int argc, const char** argv )
113 : {
114 : // overloaded from AliHLTComponent: initialization
115 : int iResult=0;
116 0 : fpBlockDataCollection=new AliHLTBlockDataCollection;
117 0 : TString argument="";
118 : int bMissingParam=0;
119 0 : char* cpErr=NULL;
120 : int i=0;
121 0 : for (; i<argc && iResult>=0; i++) {
122 0 : cpErr=NULL;
123 0 : argument=argv[i];
124 0 : if (argument.IsNull()) continue;
125 :
126 : // -basename
127 0 : if (argument.CompareTo("-datafile")==0) {
128 0 : if ((bMissingParam=(++i>=argc))) break;
129 0 : fBaseName=argv[i];
130 0 : TObjArray* pTokens=fBaseName.Tokenize(".");
131 0 : if (pTokens) {
132 0 : int iEntries=pTokens->GetEntriesFast();
133 0 : if (iEntries>1) {
134 : int n=0;
135 0 : fBaseName=((TObjString*)pTokens->At(n++))->GetString();
136 0 : while (n<iEntries-1) {
137 0 : fBaseName+="." + ((TObjString*)pTokens->At(n++))->GetString();
138 : }
139 0 : fExtension=((TObjString*)pTokens->At(n))->GetString();
140 0 : }
141 0 : delete pTokens;
142 0 : }
143 :
144 : // -directory
145 0 : } else if (argument.CompareTo("-directory")==0) {
146 0 : if ((bMissingParam=(++i>=argc))) break;
147 0 : fDirectory=argv[i];
148 :
149 : // -subdir
150 0 : } else if (argument.BeginsWith("-subdir")) {
151 0 : argument.ReplaceAll("-subdir", "");
152 0 : if (argument.BeginsWith("=")) {
153 0 : fSubDirFormat=argument.Replace(0,1,"");
154 0 : if (strchr(fSubDirFormat.Data(), '%')==NULL) {
155 0 : fSubDirFormat+="%lu";
156 : }
157 : } else {
158 0 : fSubDirFormat="event%03lu";
159 : }
160 : // no additional eventno in the filename unless set again
161 : // the sub dir contains the id
162 0 : fIdFormat="";
163 :
164 : // -idfmt
165 0 : } else if (argument.BeginsWith("-idfmt")) {
166 0 : argument.ReplaceAll("-idfmt", "");
167 0 : if (argument.BeginsWith("=")) {
168 0 : fIdFormat=argument.Replace(0,1,"");
169 : }
170 :
171 : // -specfmt
172 0 : } else if (argument.BeginsWith("-specfmt")) {
173 0 : argument.ReplaceAll("-specfmt", "");
174 0 : if (argument.BeginsWith("=")) {
175 0 : fSpecFormat=argument.Replace(0,1,"");
176 : } else {
177 0 : fSpecFormat="_0x%08x";
178 : }
179 :
180 : // -blocknofmt
181 0 : } else if (argument.BeginsWith("-blcknofmt") ||
182 0 : argument.BeginsWith("-blocknofmt")) {
183 : // for the sake of backward compatibility we consider also the
184 : // old argument with typo for a while
185 0 : argument.ReplaceAll("-blcknofmt", "");
186 0 : argument.ReplaceAll("-blocknofmt", "");
187 0 : if (argument.BeginsWith("=")) {
188 0 : fBlcknoFormat=argument.Replace(0,1,"");
189 : } else {
190 0 : fBlcknoFormat="_0x%02x";
191 : }
192 :
193 : // -enumeration
194 0 : } else if (argument.CompareTo("-enumerate")==0) {
195 0 : SetMode(kEnumerate);
196 :
197 : // -concatenate-blocks
198 0 : } else if (argument.CompareTo("-concatenate-blocks")==0) {
199 0 : SetMode(kConcatenateBlocks);
200 :
201 : // -concatenate-events
202 0 : } else if (argument.CompareTo("-concatenate-events")==0) {
203 0 : SetMode(kConcatenateEvents);
204 :
205 : // -publisher-conf
206 0 : } else if (argument.CompareTo("-publisher-conf")==0) {
207 0 : if ((bMissingParam=(++i>=argc))) break;
208 0 : fPublisherConfName=argv[i];
209 :
210 : // -write-all-events
211 0 : } else if (argument.CompareTo("-write-all-events")==0) {
212 0 : SetMode(kWriteAllEvents);
213 :
214 : // -write-all-blocks
215 0 : } else if (argument.CompareTo("-write-all-blocks")==0) {
216 0 : SetMode(kWriteAllBlocks);
217 :
218 : // -write-all
219 0 : } else if (argument.CompareTo("-write-all")==0) {
220 0 : SetMode(kWriteAllEvents);
221 0 : SetMode(kWriteAllBlocks);
222 :
223 : // -burst-buffer
224 0 : } else if (argument.CompareTo("-burst-buffer")==0) {
225 0 : if ((bMissingParam=(++i>=argc))) break;
226 0 : fBurstBufferSize = strtoul( argv[i], &cpErr ,0);
227 0 : if ( *cpErr ) break;
228 :
229 : // -skip-datatype
230 0 : } else if(argument.CompareTo("-skip-datatype")==0){
231 0 : SetMode(kSkipDataType);
232 :
233 : // check for selection arguments (AliHLTBlockDataCollection)
234 0 : } else if (fpBlockDataCollection &&
235 0 : (iResult=fpBlockDataCollection->ScanArgument(argc-i, &argv[i]))>0) {
236 0 : i+=iResult-1;
237 : iResult=0;
238 0 : } else {
239 0 : if ((iResult=ScanArgument(argc-i, &argv[i]))==-EINVAL) {
240 0 : HLTError("unknown argument %s", argument.Data());
241 : break;
242 0 : } else if (iResult==-EPROTO) {
243 : bMissingParam=1;
244 0 : break;
245 0 : } else if (iResult>0) {
246 0 : i+=iResult-1;
247 : iResult=0;
248 0 : }
249 : }
250 : }
251 :
252 0 : if (cpErr && *cpErr) {
253 0 : HLTError("Cannot convert specifier '%s' for argument '%s'", argv[i], argument.Data());
254 : iResult=-EINVAL;
255 0 : } else if (bMissingParam) {
256 0 : HLTError("missing parameter for argument %s", argument.Data());
257 : iResult=-EINVAL;
258 0 : }
259 0 : if (fpBlockDataCollection &&
260 0 : (iResult<0 || fpBlockDataCollection->IsEmpty())) {
261 0 : delete fpBlockDataCollection;
262 0 : fpBlockDataCollection=NULL;
263 0 : }
264 0 : if (iResult>=0 && fBurstBufferSize>0) {
265 0 : if (!CheckMode(kConcatenateBlocks) || !CheckMode(kConcatenateEvents)) {
266 0 : HLTError("burst write currently only supported for mode kConcatenateBlocks AND kConcatenateEvents");
267 : iResult=-EINVAL;
268 0 : } else {
269 0 : fpBurstBuffer=new AliHLTUInt8_t[fBurstBufferSize];
270 0 : if (!fpBurstBuffer) {
271 : iResult=-ENOMEM;
272 0 : fBurstBufferSize=0;
273 0 : }
274 : }
275 : }
276 :
277 0 : if (!fPublisherConfName.IsNull()) {
278 0 : if (CheckMode(kConcatenateBlocks) || CheckMode(kConcatenateEvents)) {
279 0 : fPublisherConfName="";
280 0 : HLTWarning("option 'concatenate blocks/events' collides with writing of FilePublisher configuration, ignoring option '-publisher-conf'");
281 : }
282 : }
283 :
284 0 : if (iResult>=0) {
285 0 : iResult=InitWriter();
286 0 : if (!fDirectory.IsNull()) {
287 0 : gSystem->mkdir(fDirectory);
288 : }
289 : }
290 :
291 : return iResult;
292 0 : }
293 :
294 : int AliHLTFileWriter::InitWriter()
295 : {
296 : // internal initialization for child classes
297 :
298 : // fCurrentFileName is used in dump event, just touched her to avoid
299 : // coding convention violation RC11. The function can not be declared
300 : // const since it is just the default implementation, overloaded
301 : // virtual function might not be const
302 0 : fCurrentFileName="";
303 0 : return 0; // note: this doesn't mean 'error'
304 : }
305 :
306 : int AliHLTFileWriter::ScanArgument(int /*argc*/, const char** /*argv*/)
307 : {
308 : // scan argument
309 :
310 : // there are no other arguments than the standard ones
311 : // fCurrentFileName is used in dump event, just touched her to avoid
312 : // coding convention violation RC11. The function can not be declared
313 : // const since it is just the default implementation, overloaded
314 : // virtual function might not be const
315 0 : fCurrentFileName="";
316 0 : return -EINVAL;
317 : }
318 :
319 : int AliHLTFileWriter::DoDeinit()
320 : {
321 : // overloaded from AliHLTComponent: cleanup
322 : int iResult=0;
323 0 : if (fpBurstBuffer) {
324 0 : if ((iResult=BurstWrite())<0) {
325 0 : HLTError("failed BurstWrite");
326 : }
327 0 : delete [] fpBurstBuffer;
328 0 : fpBurstBuffer=NULL;
329 0 : fBurstBufferSize=0;
330 0 : fBurstBlocks.clear();
331 0 : fBurstBlockEvents.clear();
332 0 : }
333 :
334 0 : iResult=CloseWriter();
335 0 : ClearMode(kEnumerate);
336 :
337 0 : if (fpBlockDataCollection) delete fpBlockDataCollection;
338 0 : fpBlockDataCollection=NULL;
339 :
340 0 : SetDefaults();
341 0 : return iResult;
342 : }
343 :
344 : int AliHLTFileWriter::CloseWriter()
345 : {
346 : // initernal cleanup, can be overloaded by child classes
347 :
348 : // fCurrentFileName is used in dump event, just touched her to avoid
349 : // coding convention violation RC11. The function can not be declared
350 : // const since it is just the default implementation, overloaded
351 : // virtual function might not be const
352 0 : fCurrentFileName="";
353 0 : return 0;
354 : }
355 :
356 : int AliHLTFileWriter::DumpEvent( const AliHLTComponentEventData& evtData,
357 : AliHLTComponentTriggerData& /*trigData*/ )
358 : {
359 : // overloaded from AliHLTDataSink: event processing
360 : int iResult=0;
361 0 : if (!IsDataEvent() && !CheckMode(kWriteAllEvents)) return 0;
362 :
363 0 : if (CheckMode(kConcatenateEvents)==0) {
364 : // reset the current file name in order to open a new file
365 : // for the first block. If events are concatenated, the current
366 : // file name stays in order to be opended in append mode.
367 0 : fCurrentFileName="";
368 0 : }
369 :
370 0 : if (!fPublisherConfName.IsNull() && fPublisherConfEvent>=0) {
371 : // write '-nextevent' command for all but the first event
372 0 : ofstream conf(fPublisherConfName.Data(), ios::app);
373 0 : if (conf.good()) {
374 0 : conf << "-nextevent " << endl;
375 : }
376 0 : conf.close();
377 0 : }
378 :
379 : const AliHLTComponentBlockData* pDesc=NULL;
380 :
381 : int blockno=0;
382 0 : for (pDesc=GetFirstInputBlock(); pDesc!=NULL; pDesc=GetNextInputBlock(), blockno++) {
383 0 : if (fpBlockDataCollection) {
384 0 : if (!fpBlockDataCollection->IsSelected(*pDesc)) continue;
385 0 : } else if (pDesc->fDataType==(kAliHLTAnyDataType|kAliHLTDataOriginPrivate) && !CheckMode(kWriteAllBlocks))
386 : continue;
387 : HLTDebug("block %d out of %d", blockno, evtData.fBlockCnt);
388 0 : iResult=ScheduleBlock(blockno, evtData.fEventID, pDesc);
389 0 : }
390 : return iResult;
391 0 : }
392 :
393 : int AliHLTFileWriter::BuildFileName(const AliHLTEventID_t eventID, const int blockID,
394 : const AliHLTComponentDataType& dataType,
395 : const AliHLTUInt32_t specification,
396 : TString& filename)
397 : {
398 : // build file name from current event parameters
399 : int iResult=0;
400 : //HLTDebug("build file name for event %d block %d", eventID, blockID);
401 0 : filename="";
402 :
403 0 : AliHLTUInt32_t eventType=gkAliEventTypeUnknown;
404 :
405 0 : if (!fDirectory.IsNull()) {
406 0 : filename+=fDirectory;
407 0 : if (!filename.EndsWith("/"))
408 0 : filename+="/";
409 : }
410 0 : if (!fSubDirFormat.IsNull()) {
411 0 : filename+=Form(fSubDirFormat, eventID);
412 0 : if (!filename.EndsWith("/"))
413 0 : filename+="/";
414 : }
415 0 : if (filename.EndsWith("/")) {
416 0 : gSystem->mkdir(filename);
417 0 : }
418 :
419 0 : IsDataEvent(&eventType);
420 0 : if (CheckMode(kWriteAllEvents) && !CheckMode(kConcatenateEvents)) {
421 0 : if (eventType==gkAliEventTypeStartOfRun) filename+="SOR_";
422 0 : else if (eventType==gkAliEventTypeEndOfRun) filename+="EOR_";
423 : }
424 :
425 0 : if (!fBaseName.IsNull())
426 0 : filename+=fBaseName;
427 : else
428 0 : filename+="event";
429 0 : if (!CheckMode(kConcatenateEvents)) {
430 0 : if (!CheckMode(kEnumerate)) {
431 0 : if (eventID!=kAliHLTVoidEventID && !fIdFormat.IsNull()) {
432 0 : filename+=Form(fIdFormat, eventID);
433 0 : }
434 : } else {
435 0 : filename+=Form("_%d", GetEventCount());
436 : }
437 : }
438 0 : if (blockID>=0 && !CheckMode(kConcatenateBlocks)) {
439 0 : if (!fBlcknoFormat.IsNull())
440 0 : filename+=Form(fBlcknoFormat, blockID);
441 0 : if (dataType!=kAliHLTVoidDataType &&
442 0 : !CheckMode(kSkipDataType)) {
443 0 : filename+="_";
444 0 : filename+=AliHLTComponent::DataType2Text(dataType).data();
445 0 : }
446 0 : if (!fSpecFormat.IsNull())
447 0 : filename+=Form(fSpecFormat, specification);
448 : }
449 0 : if (!fExtension.IsNull())
450 0 : filename+="." + fExtension;
451 0 : filename.ReplaceAll(" ", "");
452 0 : return iResult;
453 0 : }
454 :
455 : int AliHLTFileWriter::SetMode(Short_t mode)
456 : {
457 : // set mode flag
458 30 : fMode|=mode;
459 : //HLTDebug("mode set to 0x%x", fMode);
460 15 : return fMode;
461 : }
462 :
463 : int AliHLTFileWriter::ClearMode(Short_t mode)
464 : {
465 : // clear mode flag
466 0 : fMode&=~mode;
467 : //HLTDebug("mode set to 0x%x", fMode);
468 0 : return fMode;
469 : }
470 :
471 : int AliHLTFileWriter::CheckMode(Short_t mode) const
472 : {
473 : // check mode flag
474 :
475 : //HLTDebug("check mode 0x%x for flag 0x%x: %d", fMode, mode, (fMode&mode)!=0);
476 0 : return (fMode&mode)!=0;
477 : }
478 :
479 : int AliHLTFileWriter::ScheduleBlock(int blockno, const AliHLTEventID_t& eventID,
480 : const AliHLTComponentBlockData* pDesc)
481 : {
482 : // schedule a block for writing, depending on the mode it is either
483 : // written directly or postponed
484 : int iResult=0;
485 0 : if (fpBurstBuffer==NULL ||
486 0 : (fBurstBlocks.size()==0 && pDesc->fSize>fBurstBufferSize) ) {
487 0 : return WriteBlock(blockno, eventID, pDesc);
488 : }
489 0 : AliHLTComponentBlockData bd=*pDesc;
490 0 : bd.fPtr=NULL;
491 0 : if (fBurstBlocks.size()>0) {
492 0 : bd.fOffset=fBurstBlocks.back().fOffset+fBurstBlocks.back().fSize;
493 0 : } else {
494 0 : bd.fOffset=0;
495 : }
496 0 : if (bd.fOffset+bd.fSize>fBurstBufferSize) {
497 0 : if ((iResult=BurstWrite())>=0) {
498 0 : iResult=WriteBlock(blockno, eventID, pDesc);
499 0 : }
500 : } else {
501 0 : memcpy(fpBurstBuffer+bd.fOffset, pDesc->fPtr, bd.fSize);
502 0 : fBurstBlocks.push_back(bd);
503 0 : fBurstBlockEvents.push_back(eventID);
504 : }
505 :
506 : return iResult;
507 0 : }
508 :
509 : int AliHLTFileWriter::BurstWrite()
510 : {
511 : // write postponed block in one burst
512 : int iResult=0;
513 0 : if (fBurstBlocks.size()==0) return 0;
514 0 : assert(fBurstBlocks.size()==fBurstBlockEvents.size());
515 : HLTDebug("writing %d postponed blocks", fBurstBlocks.size());
516 : int blockno=0;
517 0 : AliHLTComponentBlockDataList::iterator block=fBurstBlocks.begin();
518 0 : AliHLTComponentBlockDataList::iterator firstBlock=block;
519 0 : vector<AliHLTEventID_t>::iterator event=fBurstBlockEvents.begin();
520 0 : if (CheckMode(kConcatenateEvents)) {
521 0 : block=fBurstBlocks.end()-1;
522 0 : event=fBurstBlockEvents.end()-1;
523 0 : }
524 :
525 0 : for (; block!=fBurstBlocks.end() && iResult>=0; block++, event++, blockno++) {
526 0 : if (event!=fBurstBlockEvents.begin() && *event!=*(event-1)) {
527 : blockno=0;
528 0 : }
529 0 : if (CheckMode(kConcatenateEvents)) {
530 : // all blocks in the burst buffer are written in one go
531 : // just the block descriptor is updated appropriately
532 0 : (*block).fSize+=(*block).fOffset;
533 0 : (*block).fPtr=fpBurstBuffer;
534 0 : } else if (CheckMode(kConcatenateBlocks)) {
535 : // all blocks of the same event are written in one go
536 : // just the block descriptor is updated appropriately
537 0 : if (event+1==fBurstBlockEvents.end() ||
538 0 : *event!=*(event+1)) {
539 0 : (*block).fSize+=(*block).fOffset-(*firstBlock).fOffset;
540 0 : (*block).fPtr=fpBurstBuffer+(*firstBlock).fOffset;
541 0 : firstBlock=block+1;
542 : } else {
543 : // coninue if it wasn't the last block of this event
544 : continue;
545 : }
546 0 : } else {
547 0 : (*block).fPtr=fpBurstBuffer+(*block).fOffset;
548 : }
549 0 : (*block).fOffset=0;
550 0 : iResult=WriteBlock(blockno, *event, &(*block));
551 0 : }
552 0 : fBurstBlocks.clear();
553 0 : fBurstBlockEvents.clear();
554 :
555 : return iResult;
556 0 : }
557 :
558 : int AliHLTFileWriter::WriteBlock(int blockno, const AliHLTEventID_t& eventID,
559 : const AliHLTComponentBlockData* pDesc)
560 : {
561 : // write a block
562 : int iResult=0;
563 0 : TString filename;
564 : HLTDebug("dataspec 0x%x", pDesc->fSpecification);
565 0 : iResult=BuildFileName(eventID, blockno, pDesc->fDataType, pDesc->fSpecification, filename);
566 : ios::openmode filemode=(ios::openmode)0;
567 0 : if (fCurrentFileName.CompareTo(filename)==0) {
568 : // append to the file
569 : filemode=ios::app;
570 0 : } else {
571 : // store the file for the next block
572 0 : fCurrentFileName=filename;
573 : }
574 0 : if (iResult>=0) {
575 0 : ofstream dump(filename.Data(), filemode);
576 0 : if (dump.good()) {
577 0 : dump.write((static_cast<const char*>(pDesc->fPtr)), pDesc->fSize);
578 : HLTDebug("wrote %d byte(s) to file %s", pDesc->fSize, filename.Data());
579 : } else {
580 0 : HLTError("can not open file %s for writing", filename.Data());
581 : iResult=-EBADF;
582 : }
583 0 : dump.close();
584 0 : }
585 0 : if (iResult>=0 && !fPublisherConfName.IsNull()) {
586 0 : if (!CheckMode(kConcatenateBlocks) &&
587 0 : !CheckMode(kConcatenateEvents)) {
588 : // append if not the first entry
589 0 : if (fPublisherConfEvent>=0) filemode=ios::app;
590 : else filemode=(ios::openmode)0;
591 0 : ofstream conf(fPublisherConfName.Data(), filemode);
592 0 : if (conf.good()) {
593 0 : conf << "-datatype ";
594 0 : conf << DataType2Text(pDesc->fDataType, 3);
595 0 : conf << " -dataspec ";
596 0 : TString specstr; specstr.Form("0x%08x", pDesc->fSpecification);
597 0 : conf << specstr;
598 0 : conf << " -datafile ";
599 0 : conf << filename;
600 0 : conf << endl;
601 0 : } else {
602 0 : fPublisherConfName="";
603 0 : HLTError("can not open file %s for writing of configuration commands", fPublisherConfName.Data());
604 : }
605 0 : conf.close();
606 0 : fPublisherConfEvent=GetEventCount();
607 0 : } else {
608 0 : fPublisherConfName="";
609 0 : HLTWarning("option 'concatenate blocks/events' collides with writing of FilePublisher configuration, disable ...");
610 : }
611 : }
612 : return iResult;
613 0 : }
|