35 if(
GetBool(
"NeighboursOn",
false,
false)) {
37 if(
GetString(
"NeighbourAlgorithm",
"") !=
"NeverNeighbour") {
54 eva.
Add<
QBool>(
"Reader",
"GeneratedEvent").SetWrite(
false);
67 if(!exec)
return exec;
93 eva.
Get<
QBool>(
"Reader",
"GeneratedEvent")=
false;
128 std::string errDescr;
129 errDescr =
"JumpToEvent is not implemented with reader " +
GetName();
137 Panic(
"JumpToEvent is not compatible with NeighboursOn=true option");
149 std::string inFile =
GetString(
"InputFile",
"NODEFAULT");
150 std::string fileExtension =
"";
151 size_t dotpos = inFile.find_last_of(
".");
152 if(dotpos != std::string::npos)
153 fileExtension = inFile.substr( dotpos+1 );
164 Debug(
"InputFileName is %s", inFile.c_str());
169 Debug(
"FileList is %s",listPath.c_str());
190 Debug(
"Opening filelist \"%s\"", path.c_str());
191 ifstream inputFileList (path.c_str());
192 if (inputFileList.is_open()) {
193 bool startFound =
false;
194 std::string dataPath =
".";
196 while (! inputFileList.eof() ) {
197 getline(inputFileList,line);
199 if(line ==
"")
continue;
200 else if(line.at(0) ==
'#')
continue;
201 else if(line ==
"END")
break;
202 else if(line ==
"START") startFound =
true;
203 else if(line.substr(0,8) ==
"DATAPATH") {
204 int valStart = line.find_first_not_of(
' ', 8);
205 int valEnd = line.find_first_of(
' ', valStart);
206 if(valStart - valEnd > 0)
207 dataPath = line.substr(valStart,valEnd - valStart);
208 Debug(
"DataPath is \"%s\"", dataPath.c_str());
210 else if(startFound) {
212 && line.rfind(
".list") != std::string::npos
213 && line.rfind(
".list") == line.size() - 5) {
216 Debug(
"Found file list %s", line.c_str());
220 fFileList.push_back(dataPath +
"/" + line);
221 Debug(
"Found file %s", line.c_str());
226 if(!startFound)
Panic(
"Could not find the START tag in yout filelist");
227 inputFileList.close();
229 Panic(
"Error opening InputFilesList %s",path.c_str());
#define Q_BEGIN_NAMESPACE
const std::string & GetString(const std::string &parname, const std::string &defVal, bool warnCfg=true) const
Get a string parameter from config file ( see GetDouble() )
void Debug(const char *descr,...) const
Send a debug message (used to debug the module) with printf syntax.
unsigned int GetIteration() const
Get Current sequence iteration.
void Info(const char *descr,...) const
Send an info message (information) with printf syntax.
void Panic(const char *descr,...) const
Send a panic message (stops the framework) with printf syntax.
int GetInt(const std::string &parname, int defVal, bool warnCfg=true) const
Get an int parameter from config file ( see GetDouble() )
bool GetBool(const std::string &parname, bool defVal, bool warnCfg=true) const
Get a bool parameter from config file ( see GetDouble() )
const std::string & GetName() const
Get Module name.
bool wrapped into a QObject
error class with error type and description
void SetDescription(const std::string &descr)
set error description
Visitor class of QEvent that provides full handling of QEvent.
QEvent & GetEvent()
Get the QEvent.
void Get(const char *owner, WriteHandle< Q > &handle)
Get QObject from the event in write mode. This method has to be called in the event loop,...
void Clear()
clear the underlying QEvent (calls QEvent::Clear())
void Add(const char *owner, WriteHandle< Q > &handle)
Add QObject to the event. This method has to be called before the event loop, e.g....
void SetReadNumber(const unsigned int readNumber)
set the event number as read by the current QReader (calls QEvent::SetReadNumber())
list of references to const QEvent (s)
void Clear()
reset list to 0 elements
unsigned int GetReadNumber() const
return the event number as read by the current reader.
static QGlobalReaderDispatcher & GetInstance()
void SetCurrentReaderFilename(const std::string &filename)
bool GetTimeProfilingOn() const
Check if the time profiling is on.
std::string GetTimeProfileReport(const std::string &prefix="") const
Report the time profiling.
const QReaderNeighbour * GetReaderNeighbour() const
void Init(QEventAssembler &eva)
bool Do(QEventAssembler &evao, QEventList &neighbours)
std::string fReaderCurrentFileName
std::string fTempOutputFileList
std::string fReaderModuleName
bool Do(QEventAssembler &eva)
void Init(QEventAssembler &eva)
virtual bool Do(QEventAssembler &eva)=0
Do method is called for each event, getting the QEventAssembler as argument. This method must be impl...
unsigned int fProcessedNumber
events processed
std::map< unsigned int, std::string > fReadNumberAtFileOpen
QNeighboursFiller * fNeighboursFiller
Neighbours filler.
virtual void Done()=0
Done method is called after event loop. This method must be implemented by inheriting classes.
bool fReadFileList
read file list
QRWCommon * fRWCommon
object to share file names with QWriter
bool fNeighboursOn
Neighbours are on.
void InitFileManager()
Initialize multiple and single file management.
Long64_t fReadNumber
last event read
static std::list< std::string > fFullPathFilesList
list of files
bool Process(QEventAssembler &eva, QEventList &neigh, const bool exec, QEventList &oneigh)
Process method is called for each event, and calls Do()
std::string fFileListPath
file list path
void ReadFilesList(std::string path)
Parse the file that contain the files list.
void OpenNewFile(const std::string &fileName)
Call it when opening new file.
void Begin(QEventAssembler &eva)
Begin method is called before event loop, and calls Init()
virtual void Init(QEventAssembler &eva)=0
Init method is called before event loop, getting the QEventAssembler as argument This method must be ...
int fEventNumberPrintStep
print event number step
QError fErr
Error returned by methods.
bool DoBase(QEventAssembler &eva)
DoBase executes Do, and is called by QNeighboursFiller.
const QError & BaseJumpToEvent(Long64_t eventnumber)
Called when another module ask for a specific event number in the next Do(), calls JumpToEvent()
std::vector< std::string > fFileList
list of files
QReaderEventGeneratorFiller * fReaderEventGeneratorFiller
Event generator
virtual const QError & JumpToEvent(Long64_t eventnumber)
Called when another module ask for a specific eventnumber in the next Do(). Implementation of this me...
void NotifyOpenNewFile(const std::string &fileName)
Call it when opening new file.
virtual ~QReader()
destructor
int fFileNumber
current file number read
void End()
End method is called after event loop, and calls Done()