40 fCurrentFileNumber(0u),
44 TotalEntryFileSize(0),
46 LastReadEntryFileSize(0),
47 fEndOfFrame(
"EndOfFrame")
54 fSourceOfFrames.
SetModeIO(ConfAgent::kRead);
72 if ( fConfMode == -1 )
77 ::fclose(fCurrentFile);
80 if ( fConfMode == 0 ) {
82 std::string
tmp = fPath;
83 if ( tmp.size() > 0 && !(tmp.at(tmp.size()-1) ==
'/') )
87 std::ostringstream filename;
88 filename << tmp << fBaseForName
89 << std::setfill(
'0') << std::setw(4) << fCurrentFileNumber++ << std::setfill(
' ')
92 fCurrentFile = ::fopen(filename.str().data(),
"rb");
93 if ( fCurrentFile != 0x0 ) {
94 Log <<
"A new input file has just been open "
95 << filename.str() <<
nline;
97 (fCurrentFile,fMaxSize);
111 while ( fCurrentFileNumber < fListOfFile.size() ) {
113 fCurrentFile = ::fopen(fListOfFile[fCurrentFileNumber].data(),
"rb");
114 if ( fCurrentFile == 0x0 ) {
116 << fListOfFile[fCurrentFileNumber]
117 <<
" is not a valid file "
120 fCurrentFileNumber++;
123 Log <<
info <<
"A new input file has just been open "
124 << fListOfFile[fCurrentFileNumber]
126 fSourceOfFrames.
SetFile(fCurrentFile,fMaxSize);
129 fCurrentFileNumber++;
145 NarvalInterface::process_config(directory_path,error_code);
147 if ( (*error_code) == 0u ) {
162 if (
GetFrameIO().GetCurrentBlockIN()->IsEoB() ) {
167 ReadEntryFileSize += out.
GetSize();
169 double Ratio = ((double)ReadEntryFileSize)/((double)TotalEntryFileSize)*100.;
170 double LastRatio = ((double)LastReadEntryFileSize)/((double)TotalEntryFileSize)*100.;
172 std::ostringstream toto;
173 toto<<TotalEntryFileSize;
174 int NDigits = toto.str().length();
176 if(((
int)Ratio) != ((
int)LastRatio))
178 std::cout<<
"\r"<<
"Analysis progress : "<<std::setw(3)<<(int)(Ratio+0.5)<<
" %"<<
" ("<<std::setw(NDigits)<<ReadEntryFileSize<<
"/"<<std::setw(NDigits)<<TotalEntryFileSize<<
" bytes)"<<std::flush;
179 if((
int)(Ratio+0.5)==99 || (
int)(Ratio+0.5)==100) std::cout<<
std::endl;
182 LastReadEntryFileSize = ReadEntryFileSize;
184 if (
GetFrameIO().GetStatus() == BaseFrameIO::kFinished ) {
194 fEndOfFrame.
Fired(
true);
218 std::string
tmp, option;
225 conffile +=
"RootAFP.conf";
227 fCurrentFileNumber = 0u;
229 std::ifstream filein(conffile.data());
230 if ( filein.is_open() == true ) {
233 while ( filein.good() && !filein.eof() ) {
234 if ( tmp[0] ==
'#' ) {
240 std::istringstream decode(tmp);
244 std::string pathforfiles, basename;
245 UInt_t starting_number;
246 decode >> option >> pathforfiles >> basename >> starting_number;
248 if ( decode.good() ) {
250 fPath = pathforfiles;
251 fBaseForName = basename;
252 fCurrentFileNumber = starting_number;
259 if( tmp[0] ==
'l' ) {
261 std::string filename;
262 decode >> option >> filename;
264 fListOfFile.push_back(filename);
268 if( tmp[0] ==
'r' ) {
269 UInt_t starting_number, ending_number;
270 std::string pathforfiles, basename;
271 decode >> option >> pathforfiles >> basename >> starting_number >> ending_number;
272 if( decode.good() && starting_number < ending_number ){
273 for( UInt_t number = starting_number; number <= ending_number; number++ ){
274 std::ostringstream osfilename;
275 osfilename << pathforfiles << basename
276 << std::setfill(
'0') << std::setw(4) << number << std::setfill(
' ')
278 fListOfFile.push_back(osfilename.str());
298 for(
unsigned int i=0 ; i<fListOfFile.size() ; i++)
300 std::ifstream afile(fListOfFile[i].data(), std::ios_base::binary);
301 afile.seekg( 0 , std::ios_base::end );
302 unsigned long size = afile.tellg() ;
304 TotalEntryFileSize +=
size;
308 Log <<
info <<
"List of file to be read is " << fListOfFile.size() <<
nline ;
315 if ( *error_code == 0u )
329 ::fclose(fCurrentFile);
330 fCurrentFileNumber = 0u;
virtual Long64_t GetSize(UInt_t=0u) const
size of the current block
It defines the interface needed to be a narval actor (producer).
LogMessage & error(LogMessage &)
virtual UInt_t ProcessBlock(ADF::FrameBlock &)
Produce one block of data.
LogMessage & warning(LogMessage &)
LogMessage & nline(LogMessage &)
virtual void SetModeIO(ConfAgent::EMode mode)
void SetModel(ConfAgent::EModel model)
virtual void process_initialise(UInt_t *error_code)
Constructor implementation.
virtual void process_reset(UInt_t *error_code)
Destructor implementation.
void Fired(Bool_t b=true)
Fired (default) or not this trigger.
virtual Bool_t Register(DFTrigger *)
To register a trigger.
static void process_config(const Char_t *, UInt_t *)
to init globals (static) from a directory
LogMessage & info(LogMessage &)
manipulator to modify the LogMessage
const std::string & GetConfPath()
To get the algo path associated with the current actor.
Base class for version numbers.
virtual SharedFP * SetOutputFrame(Frame *frame)
Once a trigger has fired, the result of the algorithm is set through this.
virtual void Detach(FrameBlock *in, FrameBlock *out)
void SetStatus(EStatus stat)
virtual void SetProcessMethod(const char *)
To set the current method.
LogMessage & dolog(LogMessage &)
virtual UInt_t Write()
It writes to the Frame the content of the dedicated structures.
virtual void ClearMessage()
To clear the current message.
virtual Bool_t Record(DFTrigger *)
To record a frame trigger.
virtual Frame * GetOutputFrame()
to get back the output frame
header file for RootAFP.cpp
ADF::LogMessage & endl(ADF::LogMessage &log)
virtual void SetFile(FILE *file, Long64_t max_size=kMaxUInt_t)
virtual void Print(std::ostream &out=std::cout) const
Print some informations (statistics)
virtual void Attach(FrameBlock *in, FrameBlock *out)
Attach a block to this. Rewind called if DoRewind set to true (Default)
virtual std::string & GetProcessName()
To get the Process name.
LogMessage Log
to send messages to the log server
virtual void SetName(const char *name)
Base class that described an item in a Factory.