1#include "KVNucleusEvent.h"
2#define KVEventSelector_cxx
3#include "KVEventSelector.h"
4#include <KVClassMonitor.h>
8#include "KVDataRepositoryManager.h"
9#include "KVDataRepository.h"
10#include "KVDataSetManager.h"
12#include "KVDataSetAnalyser.h"
28 if (IsOptGiven(
"CombinedOutputFile")) {
29 fCombinedOutputFile = GetOpt(
"CombinedOutputFile");
36 fDisableCreateTreeFile =
kTRUE;
43 fDisableCreateTreeFile =
kFALSE;
52 if (IsOptGiven(
"AuxFiles")) {
54 if (GetInputList()) GetInputList()->Add(fAuxChain);
68 if (
jdl->HasParameter(
"DataRepository")) {
69 if (!gDataRepositoryManager) {
71 gDataRepositoryManager->
Init();
73 gDataRepositoryManager->
GetRepository(
jdl->GetStringValue(
"DataRepository"))->cd();
74 gDataSetManager->
GetDataSet(
jdl->GetStringValue(
"DataSet"))->cd();
78 if (!gDataSetManager) {
80 gDataSetManager->
Init();
85 if (gDataSet && gDataAnalyser->
InheritsFrom(
"KVDataSetAnalyser"))
117 Info(
"SlaveBegin",
"fOutput->ls()");
129 Abort(
Form(
"Job received KILL signal from batch system after %lld events - batch job probably needs more CPU time (see end of job statistics)",
fEventsRead),
kAbortFile);
178 if (gDataAnalyser) gDataAnalyser->
preEndRun();
180 if (gDataAnalyser) gDataAnalyser->
postEndRun();
218 Info(
"Terminate",
"Analysis ends at %s",
now.AsString());
259 if (
gvl->AbortEventAnalysis()) {
345 TString amsg = TString::Format(
"%s::create_output_file: could not create output ROOT file '%s'!",
365 Deprecate(
"Calling this method is no longer required, and any filename given will be ignored."
366 " Call SetJobOutputFileName() to define the output filename.");
505 Error(
"SetUpAuxEventChain",
"if AuxFiles option given, you must define AuxDir, AuxTreeName and AuxBranchName");
596 Error(
"Init",
"Failed to link KVEvent object with a branch. Expected branch name=%s",
659 if (gDataAnalyser) gDataAnalyser->
preInitRun();
winID h TVirtualViewer3D TVirtualGLPainter p
R__EXTERN TProof * gProof
char * Form(const char *fmt,...)
Class for iterating over "OK" nuclei in events accessed through base pointer/reference.
static KVClassMonitor * GetInstance()
Return pointer to unique instance of class monitor class.
virtual void SetAnalysedTree(TTree *)
virtual void postEndRun()
void DoStatusUpdate(Long64_t nevents) const
Print infos on events treated, disk usage, memory usage.
virtual void AddJobDescriptionList(TList *)
virtual void preInitAnalysis()
virtual void postAnalysis()
void SetAnalysisTask(KVDataAnalysisTask *at)
void SetProofMode(EProofMode e)
virtual Bool_t CheckStatusUpdateInterval(Long64_t nevents) const
virtual void preAnalysis()
static KVDataAnalyser * GetAnalyser(const Char_t *plugin)
EProofMode GetProofMode() const
virtual void postInitRun()
static Bool_t AbortProcessingLoop()
virtual void postEndAnalysis()
virtual void preEndAnalysis()
virtual void preInitRun()
virtual void RegisterUserClass(TObject *)
virtual void postInitAnalysis()
Define and manage data analysis tasks.
Manages access to one or more data repositories.
KVDataRepository * GetRepository(const Char_t *name) const
Pilots user analysis of experimental data.
Manage all datasets contained in a given data repository.
virtual Bool_t Init(KVDataRepository *=0)
KVDataAnalysisTask * GetAnalysisTaskAny(const Char_t *keywords) const
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
KVDataAnalysisTask * GetAnalysisTask(Int_t) const
General purpose analysis base class for TTree containing KVEvent objects.
void FillTProfile2D(TProfile2D *h2, Double_t one, Double_t two, Double_t three, Double_t four)
Bool_t fDisableCreateTreeFile
used with PROOF
void SetUpAuxEventChain()
Bool_t fFirstEvent
set to kFALSE after first event is read
TH1 * GetHisto(const Char_t *name) const
TProofOutputFile * mergeFile
output file for trees and histos
KVHashList lhisto
list of histograms added with AddHisto
virtual void InitAnalysis()
KVHashList ltree
list of trees added with AddTree
void InitFriendTree(TTree *tree, const TString &branchname)
TTree * fAuxChain
[optional] pointer to another TTree or TChain which may be used during analysis
virtual Bool_t Analysis()
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
TTree * GetTree(const Char_t *name) const
Long64_t fEventsRead
number of events read
virtual void CheckEndOfRun()
void FillTH2(TH2 *h2, Double_t one, Double_t two, Double_t three)
KVEvent * GetEvent() const
Long64_t fTreeEntry
current tree entry number
virtual TList * GetOutputList() const
TTree * fChain
pointer to the analyzed TTree or TChain
void create_output_file()
Bool_t CreateTreeFile(const Char_t *filename="")
KVString fCombinedOutputFile
name for ROOT file containing histos and/or trees produced by analysis
void AddTree(TTree *tree)
virtual void SlaveBegin(TTree *tree)
virtual void SlaveTerminate()
void SetEventsReadInterval(Long64_t N)
void add_histo(TH1 *histo)
for merging with PROOF
void AddHisto(TH1 *histo)
void FillHisto(const Char_t *sname, Double_t one, Double_t two=1, Double_t three=1, Double_t four=1)
KVUniqueNameList fGlobalVariables
Lists of global variables with different selection criteria.
TBranch * b_Event
List of branches.
void SetBranchName(const Char_t *n)
virtual void SetAdditionalBranchAddress()
Bool_t IsOptGiven(const Char_t *option)
void FillTProfile(TProfile *h1, Double_t one, Double_t two, Double_t three)
KVParticleCondition fPartCond
(optional) conditions for selecting particles
void FillTH1(TH1 *h1, Double_t one, Double_t two)
virtual void Init(TTree *tree)
void add_tree(TTree *tree)
void RecalculateGlobalVariables()
virtual Bool_t Process(Long64_t entry)
Bool_t fNotifyCalled
avoid multiple calls to Notify/InitRun
TString GetOpt(const Char_t *option) const
const Char_t * GetBranchName() const
virtual void EndAnalysis()
virtual void ParseOptions()
Bool_t fGlobalVariableAbortEventAnalysis
KVEvent * AuxEvent
[optional] events in fAuxChain
void FillTH3(TH3 *h3, Double_t one, Double_t two, Double_t three, Double_t four)
void FillTree(const Char_t *tree_name="")
KVUserAnalysisOptionList fOptionList
parsed list of options given to TTree::Process
#define KVGVLIST_OPTIMIZE_GVLIST
void CalculateGlobalVariables(KVEvent *e)
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
virtual TObject * FindObject(const char *name) const
virtual void Add(TObject *obj)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
KVString Next(Bool_t strip_whitespace=kFALSE) const
Bool_t Test(const ParticleType *nuc) const
void ParseOptions(const KVString &optlist)
void ls(Option_t *option="") const override
virtual Int_t GetEntries() const
void Close(Option_t *option="") override
virtual void SetDirectory(TDirectory *dir)
virtual Int_t Fill(const char *name, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
TObject * FindObject(const char *name) const override
void Add(TObject *obj) override
TObject * Remove(const TObjLinkPtr_t &lnk)
const char * GetName() const override
virtual const char * ClassName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual TObject * FindObject(const char *name) const
R__ALWAYS_INLINE Bool_t IsZombie() const
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
virtual Bool_t InheritsFrom(const char *classname) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
virtual Int_t Fill(const char *namex, const char *namey, Double_t z, Double_t w=1.)
TFile * OpenFile(const char *opt)
void SetOutputFileName(const char *name)
virtual TList * GetInputList() const
virtual void Abort(const char *why, EAbort what=kAbortProcess)
const char * GetOption() const override
const char * Data() const
virtual TBranch * GetBranch(const char *name)
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
TFile * GetCurrentFile() const
void Print(Option_t *option="") const override
virtual void SetMakeClass(Int_t make)
virtual Long64_t GetEntries() const
virtual TTree * GetTree() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)