GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
ExampleTreeHelper.hh
Go to the documentation of this file.
1#ifndef ExampleTreeHelper_h
2#define ExampleTreeHelper_h
3
4/** \addtogroup Helpers
5 * @{
6 */
7
8////////////////////////////////////////////////////////////////////////////////
9/// \class ExampleTreeHelper
10///
11/// This selector shows how to create a tree with selected events (beta-tagged
12/// with gamma multiplicities of at least three), and selected information
13/// (suppressed addback energies, and beta-gamma timing differences).
14///
15////////////////////////////////////////////////////////////////////////////////
16
17// Header file for the classes stored in the TTree if any.
18#include "TGRSIHelper.h"
19#include "TGriffin.h"
20#include "TGriffinBgo.h"
21#include "TSceptar.h"
22#include "TZeroDegree.h"
23
24// Fixed size dimensions of array or collections stored in the TTree if any.
25
26class ExampleTreeHelper : public TGRSIHelper, public ROOT::Detail::RDF::RActionImpl<ExampleTreeHelper> {
27public:
28 explicit ExampleTreeHelper(TList* list)
29 : TGRSIHelper(list)
30 {
31 Prefix("ExampleTree");
32 Setup();
33 }
34 // These functions are expected to exist
35 ROOT::RDF::RResultPtr<std::map<std::string, TList>> Book(ROOT::RDataFrame* d) override
36 {
37 return d->Book<TGriffin, TGriffinBgo, TZeroDegree, TSceptar>(std::move(*this), {"TGriffin", "TGriffinBgo", "TZeroDegree", "TSceptar"});
38 }
39 void CreateHistograms(unsigned int slot) override;
40 void Exec(unsigned int slot, TGriffin& grif, TGriffinBgo& grifBgo, TZeroDegree& zds, TSceptar& scep);
41
42private:
43 // branches of output trees
44 // all of these need to be maps for the different slots/workers, we're using maps as they don't need to be resized and once accessed
45 // the address of key stays the same (important to be able to create branches)
46 std::map<unsigned int, double*> fSuppressedAddback2; ///< vector of suppressed addback energies
47 std::map<unsigned int, std::vector<double>> fSuppressedAddback; ///< vector of suppressed addback energies
48 std::map<unsigned int, std::vector<double>> fBetaGammaTiming; ///< vector of beta-gamma timing
49 std::map<unsigned int, int> fGriffinMultiplicity; ///< multiplicity of suppressed addback energies
50};
51
52extern "C" ExampleTreeHelper* CreateHelper(TList* list) { return new ExampleTreeHelper(list); }
53
54extern "C" void DestroyHelper(TGRSIHelper* helper) { delete helper; }
55
56/*! @} */
57#endif
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.
std::map< unsigned int, int > fGriffinMultiplicity
multiplicity of suppressed addback energies
void Exec(unsigned int slot, TGriffin &grif, TGriffinBgo &grifBgo, TZeroDegree &zds, TSceptar &scep)
std::map< unsigned int, std::vector< double > > fBetaGammaTiming
vector of beta-gamma timing
std::map< unsigned int, std::vector< double > > fSuppressedAddback
vector of suppressed addback energies
ExampleTreeHelper(TList *list)
std::map< unsigned int, double * > fSuppressedAddback2
vector of suppressed addback energies
std::string & Prefix()
Definition TGRSIHelper.h:40
virtual void Setup()
void DestroyHelper(TGRSIHelper *helper)
ExampleTreeHelper * CreateHelper(TList *list)