12 #ifndef ROOT_TMPWorker 13 #define ROOT_TMPWorker 27 #include <type_traits> 36 TMPWorker(
const std::vector<std::string>& fileNames,
const std::string& treeName,
unsigned nWorkers,
ULong64_t maxEntries);
43 virtual void Init(
int fd,
unsigned workerN);
69 std::unique_ptr<TSocket>
fS;
Bool_t fTreeCacheIsLearning
virtual void HandleInput(MPCodeBufPair &msg)
Handle a message with an EMPCode.
pid_t fPid
the PID of the process in which this worker is running
TFile * OpenFile(const std::string &fileName)
Handle file opening.
unsigned fNWorker
the ordinal number of this worker (0 to nWorkers-1)
A specialized TFileCacheRead object for a TTree.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
This class works in conjuction with TMPClient, reacting to messages received from it as specified by ...
ULong64_t fProcessedEntries
the number of entries processed by this worker so far
std::string fTreeName
the name of the tree to be processed
void SendError(const std::string &errmsg, unsigned int code=MPCode::kError)
Error sender.
unsigned GetNWorker() const
#define ClassDef(name, id)
TTree * fTree
pointer to the tree to be processed. It is only used if the tree is directly passed to TProcessExecut...
ULong64_t fMaxNEntries
the maximum number of entries to be processed by this worker
void SetupTreeCache(TTree *tree)
Tree cache handling.
std::unique_ptr< TSocket > fS
This worker's socket. The unique_ptr makes sure resources are released.
void CloseFile()
Handle file closing.
TFile * fFile
last open file
std::pair< unsigned, std::unique_ptr< TBufferFile > > MPCodeBufPair
An std::pair that wraps the code and optional object contained in a message.
TMPWorker()
Class constructors.
unsigned fNWorkers
the number of workers spawned
TMPWorker & operator=(const TMPWorker &)=delete
unsigned long long ULong64_t
std::vector< std::string > fFileNames
the files to be processed by all workers
std::string fId
identifier string in the form W<nwrk>|P<proc id>="">
virtual void Init(int fd, unsigned workerN)
This method is called by children processes right after forking.
A TTree object has a header with a name and a title.
void Setup()
Auxilliary method for common initializations.
TTree * RetrieveTree(TFile *fp)
Retrieve a tree from an open file.