1 #define KVEventSelector_cxx
33 if (IsOptGiven(
"CombinedOutputFile")) {
34 fCombinedOutputFile = GetOpt(
"CombinedOutputFile");
41 fDisableCreateTreeFile =
kTRUE;
48 fDisableCreateTreeFile =
kFALSE;
57 if (IsOptGiven(
"AuxFiles")) {
59 if (GetInputList()) GetInputList()->Add(fAuxChain);
94 if (GetInputList() && GetInputList()->FindObject(
"JobDescriptionList")) {
125 if (IsOptGiven(
"CombinedOutputFile")) {
126 fCombinedOutputFile = GetOpt(
"CombinedOutputFile");
127 Info(
"SlaveBegin",
"Output file name = %s", fCombinedOutputFile.Data());
136 fDisableCreateTreeFile =
kFALSE;
140 if (IsOptGiven(
"AuxFiles")) {
142 if (GetInputList()) {
143 fAuxChain = (
TTree*)GetInputList()->FindObject(GetOpt(
"AuxTreeName"));
144 InitFriendTree(fAuxChain, GetOpt(
"AuxBranchName"));
147 Info(
"SlaveBegin",
"fOutput->ls()");
148 GetOutputList()->ls();
196 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);
211 if (fPartCond.IsSet()) {
213 part.SetIsOK(fPartCond.Test(part));
219 for (
auto p : fGlobalVariables)
dynamic_cast<KVGVList*
>(p)->
Init();
222 RecalculateGlobalVariables();
226 if (!fGlobalVariableAbortEventAnalysis) {
229 ok_anal = Analysis();
246 Info(
"Process",
"End of file reached after %lld events", fEventsRead);
273 if (lhisto.GetEntries()) {
274 lhisto.R__FOR_EACH(
TH1, Write)();
276 if (ltree.GetEntries()) {
281 fOutput->Add(mergeFile);
310 Info(
"Terminate",
"Analysis ends at %s", now.
AsString());
316 if (GetInputList() && fAuxChain) GetInputList()->Remove(fAuxChain);
386 KVVarGlob* vg = GetGVList()->AddGV(class_name, name);
414 fGlobalVariableAbortEventAnalysis =
false;
415 for (
auto p : fGlobalVariables) {
416 auto gvl =
dynamic_cast<KVGVList*
>(p);
419 if (gvl->AbortEventAnalysis()) {
420 fGlobalVariableAbortEventAnalysis =
true;
460 else if (fPartName !=
"") fPartCond.SetParticleClassName(fPartName);
485 return lhisto.get_object<
TH1>(histo_name);
501 if (fDisableCreateTreeFile)
return;
506 else create_output_file();
520 if (fDisableCreateTreeFile)
return;
525 if (writeFile)
tree->SetDirectory(writeFile);
526 else create_output_file();
542 if (fCombinedOutputFile ==
"")
return;
547 writeFile =
TFile::Open(fCombinedOutputFile,
"RECREATE");
552 mergeFile->SetOutputFileName(fCombinedOutputFile);
553 writeFile = mergeFile->OpenFile(
"RECREATE");
554 if (writeFile && writeFile->IsZombie())
SafeDelete(writeFile);
560 ClassName(), fCombinedOutputFile.Data());
561 Abort(amsg, kAbortProcess);
565 if (lhisto.GetEntries()) {
566 lhisto.R__FOR_EACH(
TH1, SetDirectory)(writeFile);
568 if (ltree.GetEntries()) {
569 ltree.R__FOR_EACH(
TTree, SetDirectory)(writeFile);
579 Deprecate(
"Calling this method is no longer required, and any filename given will be ignored."
580 " Call SetJobOutputFileName() to define the output filename.");
593 auto t =
new TTree(name, title);
617 FillTH3((
TH3*)
h1, one, two, three, four);
621 FillTH2((
TH2*)
h1, one, two, three);
625 FillTH1(
h1, one, two);
627 Warning(
"FillHisto",
"%s -> Classe non prevue ...", lhisto.FindObject(histo_name)->ClassName());
630 Warning(
"FillHisto",
"%s introuvable", histo_name);
648 Warning(
"FillHisto",
"%s introuvable", histo_name);
673 h1->
Fill(one, two, three);
685 h2->
Fill(one, two, three);
697 h2->
Fill(one, two, three, four);
708 h3->
Fill(one, two, three, four);
734 if (!IsOptGiven(
"AuxDir") || !IsOptGiven(
"AuxTreeName") || !IsOptGiven(
"AuxBranchName")) {
735 Error(
"SetUpAuxEventChain",
"if AuxFiles option given, you must define AuxDir, AuxTreeName and AuxBranchName");
738 KVString filelist = GetOpt(
"AuxFiles");
739 KVString filedir = GetOpt(
"AuxDir");
740 if (!filedir.
EndsWith(
"/")) filedir +=
"/";
743 while (!filelist.
End()) {
747 InitFriendTree(auxchain, GetOpt(
"AuxBranchName"));
772 TTree* t = ltree.get_object<
TTree>(tree_name);
773 if (!t)
Fatal(
"GetTree",
"Tree %s not found: is this the right name?", tree_name);
794 if (!strcmp(tree_name,
"")) {
795 ltree.R__FOR_EACH(
TTree, Fill)();
799 if ((
tt = GetTree(tree_name))) {
803 Warning(
"FillTree",
"%s introuvable", tree_name);
851 fOptionList.ParseOptions(GetOption());
854 if (IsOptGiven(
"BranchName")) SetBranchName(GetOpt(
"BranchName"));
856 if (IsOptGiven(
"EventsReadInterval")) SetEventsReadInterval(GetOpt(
"EventsReadInterval").Atoi());
886 fChain->SetMakeClass(1);
892 if (strcmp(GetBranchName(),
"") && fChain->GetBranch(GetBranchName())) {
893 Info(
"Init",
"Analysing data in branch : %s", GetBranchName());
894 fChain->SetBranchAddress(GetBranchName(), &
Event, &b_Event);
897 Error(
"Init",
"Failed to link KVEvent object with a branch. Expected branch name=%s",
901 SetAdditionalBranchAddress();
937 fAuxChain->SetBranchAddress(branchname, &AuxEvent);
939 fAuxChain->GetEntry(0);
940 fAuxChain->GetTree()->GetEntry(0);
960 if (fNotifyCalled)
return kTRUE;
961 fNotifyCalled =
kTRUE;
963 Info(
"Notify",
"Beginning analysis of file %s (%lld events)", fChain->GetCurrentFile()->GetName(), fChain->GetTree()->GetEntries());
KVDataAnalyser * gDataAnalyser
KVDataRepositoryManager * gDataRepositoryManager
KVDataSetManager * gDataSetManager
KVTemplateEvent< KVNucleus >::EventOKIterator EventOKIterator
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
R__EXTERN TProof * gProof
char * Form(const char *fmt,...)
static KVClassMonitor * GetInstance()
Return pointer to unique instance of class monitor class.
virtual void SetTriggerConditionsForRun(int)
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.
virtual const Char_t * GetDataAnalyser() const
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 class for TTree containing KVEvent objects.
void FillTProfile2D(TProfile2D *h2, Double_t one, Double_t two, Double_t three, Double_t four)
void AddGV(KVVarGlob *vg)
const KVHashList * GetTreeList() const
return the list of created trees
void SetUpAuxEventChain()
TH1 * GetHisto(const Char_t *name) const
void SetParticleConditions(const KVParticleCondition &, const KVString &="")
void FillTree(const Char_t *sname="")
void InitFriendTree(TTree *tree, const TString &branchname)
const KVHashList * GetHistoList() const
return the list of created trees
TTree * GetTree(const Char_t *name) const
return the tree named tree_name
virtual void CheckEndOfRun()
Testing whether EndRun() should be called.
void FillTH2(TH2 *h2, Double_t one, Double_t two, Double_t three)
void create_output_file()
Bool_t CreateTreeFile(const Char_t *filename="")
void AddTree(TTree *tree)
virtual void SlaveBegin(TTree *tree)
virtual void SlaveTerminate()
void add_histo(TH1 *histo)
for merging with PROOF
void FillHisto(const Char_t *sname, Double_t one, Double_t two=1, Double_t three=1, Double_t four=1)
void FillTProfile(TProfile *h1, Double_t one, Double_t two, Double_t three)
void SetTriggerConditionsForRun(int)
void FillTH1(TH1 *h1, Double_t one, Double_t two)
virtual void Init(TTree *tree)
void add_tree(TTree *tree)
virtual void RecalculateGlobalVariables()
virtual Bool_t Process(Long64_t entry)
virtual void ParseOptions()
void FillTH3(TH3 *h3, Double_t one, Double_t two, Double_t three, Double_t four)
Manage a list of global variables.
void CalculateGlobalVariables(KVEvent *e)
Extended version of ROOT THashList.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Int_t GetIntValue(const Char_t *name) const
const Char_t * GetStringValue(const Char_t *name) const
Bool_t HasParameter(const Char_t *name) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
void SetParticleClassName(const Char_t *cl)
Base class for all global variable implementations.
virtual Int_t Add(const char *name, Long64_t nentries=TTree::kMaxEntries)
const char * AsString() const
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
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)
virtual Int_t Fill(const char *namex, const char *namey, const char *namez, Double_t w)
virtual Bool_t InheritsFrom(const char *classname) const
virtual Int_t Fill(const char *namex, const char *namey, Double_t z, Double_t w=1.)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
static TString Format(const char *fmt,...)
RooCmdArg ClassName(const char *name)
TH1 * GetHisto(const std::string file, const std::string path, const std::string obj)