39 fCurrentFileNumber(0u),
42 fEndOfFrame(
"EndOfFrame")
50 fSourceOfFrames.
SetModeIO(ConfAgent::kRead);
66 ::fclose(fCurrentFile);
68 std::cout <<
" -BasicAFP: the input file has just been closed " << fCurrentFileName <<
std::endl;
72 std::string
tmp = fPath;
73 if ( tmp.size() > 0 && !(tmp.at(tmp.size()-1) ==
'/') )
76 std::ostringstream filename;
77 filename << tmp << fBaseForName
78 << std::setfill(
'0') << std::setw(4) << fCurrentFileNumber++ << std::setfill(
' ')
80 fCurrentFileName = filename.str();
82 fCurrentFile = ::fopen(fCurrentFileName.c_str(),
"rb");
83 if ( fCurrentFile != 0x0 ) {
84 Log <<
" -BasicAFP: the input file has just been opened "
85 << fCurrentFileName <<
nline;
87 fSourceOfFrames.
SetFile(fCurrentFile,fMaxSize);
90 size_t len = fCurrentFileName.length();
91 size_t lpt = fCurrentFileName.find_last_of(
'/');
92 fCurrentName = fCurrentFileName.substr(lpt+1, len-lpt-1);
96 Log <<
"Could not open input file " << fCurrentFileName <<
nline;
107 NarvalInterface::process_config(directory_path, error_code);
109 if ( (*error_code) == 0u ) {
128 if (
GetFrameIO().GetCurrentBlockIN()->IsEoB() ) {
134 std::cout << std::setw(2) << fMyID;
135 std::cout << std::left << std::setw(24) <<
"-BasicAFP:" << std::right
136 <<
" " << std::setw(5) << nevtsOut-nevtsIn
137 <<
" evts (" << std::setw(8) << out.
GetSize() <<
")"
138 <<
" Tot = " << std::setw(8) << nevtsOut
142 if (
GetFrameIO().GetStatus() == BaseFrameIO::kFinished ) {
152 fEndOfFrame.
Fired(
true);
180 std::string conffile =
GetConfPath() +
"BasicAFP.conf";
182 std::ifstream filein(conffile.data());
183 if ( filein.is_open() == true ) {
185 std::string pathforfiles, basename;
186 UInt_t starting_number;
188 filein >> pathforfiles >> basename >> starting_number;
189 if ( filein.good() ) {
190 fPath = pathforfiles;
191 fBaseForName = basename;
192 fCurrentFileNumber = starting_number;
193 std::cout <<
"BasicAFP::process_initialise " << pathforfiles <<
" " << basename <<
" " << starting_number <<
std::endl;
212 ::fclose(fCurrentFile);
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 &)
static void process_config(const Char_t *, UInt_t *)
to init globals (static) from a directory
LogMessage & nline(LogMessage &)
virtual void SetModeIO(ConfAgent::EMode mode)
UInt_t GetFramesRead() const
void SetModel(ConfAgent::EModel model)
void Fired(Bool_t b=true)
Fired (default) or not this trigger.
virtual Bool_t Register(DFTrigger *)
To register a trigger.
header file for BasicAFP.cpp
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 UInt_t ProcessBlock(ADF::FrameBlock &)
Produce one block of data.
virtual void process_reset(UInt_t *error_code)
Destructor implementation.
virtual Bool_t Record(DFTrigger *)
To record a frame trigger.
virtual Frame * GetOutputFrame()
to get back the output frame
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)
virtual void process_initialise(UInt_t *error_code)
Constructor implementation.
Base class that described an item in a Factory.