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