GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
EfficiencyHelper.hh
Go to the documentation of this file.
1#ifndef EXAMPLEEVENTHELPER_HH
2#define EXAMPLEEVENTHELPER_HH
3
4#include "TGRSIHelper.h"
5
6#include "TGriffin.h"
7#include "TGriffinBgo.h"
8
9// This is a custom action which respects a well defined interface. It supports parallelism,
10// in the sense that it behaves correctly if implicit multi threading is enabled.
11// Note the plural: in presence of a MT execution, internally more than a single TList is created.
12// The detector types in the specifcation of Book must match those in the call to it as well as those in the Exec function (and be in the same order)!
13
14class EfficiencyHelper : public TGRSIHelper, public ROOT::Detail::RDF::RActionImpl<EfficiencyHelper> {
15public:
16 // constructor sets the prefix (which is used for the output file as well)
17 // and calls Setup which in turn also calls CreateHistograms
18 explicit EfficiencyHelper(TList* list)
19 : TGRSIHelper(list)
20 {
21 Prefix("EfficiencyHelper");
22 Setup();
23 }
24
25 ROOT::RDF::RResultPtr<std::map<std::string, TList>> Book(ROOT::RDataFrame* d) override
26 {
27 return d->Book<TGriffin, TGriffinBgo>(std::move(*this), {"TGriffin", "TGriffinBgo"});
28 }
29 // this function creates and books all histograms
30 void CreateHistograms(unsigned int slot) override;
31 // this function gets called for every single event and fills the histograms
32 void Exec(unsigned int slot, TGriffin& grif, TGriffinBgo& grifBgo);
33 // this function is optional and is called after the output lists off all slots/workers have been merged
34 void EndOfSort(std::shared_ptr<std::map<std::string, TList>>& list) override;
35
36private:
37 // any constants that are set in the CreateHistograms function and used in the Exec function can be stored here
38 // or any other settings
39 Long64_t fCycleLength{0};
40};
41
42// These are needed functions used by TDataFrameLibrary to create and destroy the instance of this helper
43extern "C" EfficiencyHelper* CreateHelper(TList* list) { return new EfficiencyHelper(list); }
44
45extern "C" void DestroyHelper(TGRSIHelper* helper) { delete helper; }
46
47#endif
void DestroyHelper(TGRSIHelper *helper)
EfficiencyHelper * CreateHelper(TList *list)
void EndOfSort(std::shared_ptr< std::map< std::string, TList > > &list) override
This method gets called at the end of Finalize()
ROOT::RDF::RResultPtr< std::map< std::string, TList > > Book(ROOT::RDataFrame *d) override
This method will call the Book action on the provided dataframe.
void CreateHistograms(unsigned int slot) override
Virtual helper function that the user uses to create their histograms.
EfficiencyHelper(TList *list)
void Exec(unsigned int slot, TGriffin &grif, TGriffinBgo &grifBgo)
std::string & Prefix()
Definition TGRSIHelper.h:40
virtual void Setup()