GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
AngularCorrelationHelper.hh
Go to the documentation of this file.
1#ifndef AngularCorrelationHelper_h
2#define AngularCorrelationHelper_h
3
4#include "TGriffin.h"
5#include "TGriffinBgo.h"
6#include "TGriffinAngles.h"
7#include "TGRSIHelper.h"
8
9class AngularCorrelationHelper : public TGRSIHelper, public ROOT::Detail::RDF::RActionImpl<AngularCorrelationHelper> {
10private:
12 double fGriffinDistance{145.};
13 bool fFolding{false};
14 bool fGrouping{false};
15 bool fAddback{true};
16 std::vector<int> fExcludedDetectors;
17 std::vector<int> fExcludedCrystals;
18
19 double fPrompt{200.}; // Maximum absolute time difference for prompt gamma-gamma
20 double fTimeRandomLow{400.}; // Minimum time difference for gamma-gamma time random background
21 double fTimeRandomHigh{600.}; // Maximum time difference for gamma-gamma time random background
22
23 int fBins{3000};
24 double fMinEnergy{0.};
25 double fMaxEnergy{3000.};
26
28
29 std::map<unsigned int, std::deque<TGriffin*>> fGriffinDeque;
30 std::map<unsigned int, std::deque<TGriffinBgo*>> fBgoDeque;
31
32 bool ExcludeDetector(int detector)
33 {
34 return std::binary_search(fExcludedDetectors.begin(), fExcludedDetectors.end(), detector);
35 }
36 bool ExcludeCrystal(int arraynumber)
37 {
38 return std::binary_search(fExcludedCrystals.begin(), fExcludedCrystals.end(), arraynumber);
39 }
40
41public:
42 explicit AngularCorrelationHelper(TList* list)
43 : TGRSIHelper(list)
44 {
45 Prefix("AngularCorrelation");
46
47 if(fUserSettings != nullptr) {
48 fNofMixedEvents = fUserSettings->GetInt("NumberOfMixedEvents", 10);
49 fGriffinDistance = fUserSettings->GetDouble("GriffinDistance", 145.);
50 fAddback = fUserSettings->GetBool("Addback", true);
51 fFolding = fUserSettings->GetBool("Folding", false);
52 fGrouping = fUserSettings->GetBool("Grouping", false);
53
54 try {
55 fExcludedDetectors = fUserSettings->GetIntVector("ExcludedDetector", true); // be quiet if we don't find this
56 } catch(std::out_of_range&) {
57 // do nothing, we simply don't have any detectors to exclude
58 }
59 try {
60 fExcludedCrystals = fUserSettings->GetIntVector("ExcludedCrystal", true); // be quiet if we don't find this
61 } catch(std::out_of_range&) {
62 // do nothing, we simply don't have any crystals to exclude
63 }
64
65 fPrompt = fUserSettings->GetDouble("MaxPromptTime", 200.);
66 fTimeRandomLow = fUserSettings->GetDouble("TimeRandom.Low", 400.);
67 fTimeRandomHigh = fUserSettings->GetDouble("TimeRandom.High", 600.);
68
69 fBins = fUserSettings->GetInt("NumberOfBins", 3000);
70 fMinEnergy = fUserSettings->GetDouble("MinimumEnergy", 0.);
71 fMaxEnergy = fUserSettings->GetDouble("MaximumEnergy", 3000.);
72 } else {
73 std::cout << "No user settings provided, using default settings: ";
74 }
75 std::cout << std::boolalpha << "# of mixed events " << fNofMixedEvents << ", distance " << fGriffinDistance << " mm, addback " << fAddback << ", folding " << fFolding << ", and grouping " << fGrouping << std::endl;
76
78 fAngles->Print();
79
80 // Setup calls CreateHistograms, which uses the stored angle combinations, so we need those set before
81 Setup();
82 }
83
84 ROOT::RDF::RResultPtr<std::map<std::string, TList>> Book(ROOT::RDataFrame* d) override
85 {
86 return d->Book<TGriffin, TGriffinBgo>(std::move(*this), {"TGriffin", "TGriffinBgo"});
87 }
88
89 void CreateHistograms(unsigned int slot) override;
90 void Exec(unsigned int slot, TGriffin& fGriffin, TGriffinBgo& fGriffinBgo);
91};
92
93#endif
94
95extern "C" AngularCorrelationHelper* CreateHelper(TList* list) { return new AngularCorrelationHelper(list); }
96
97extern "C" void DestroyHelper(TGRSIHelper* helper) { delete helper; }
void DestroyHelper(TGRSIHelper *helper)
AngularCorrelationHelper * CreateHelper(TList *list)
void Exec(unsigned int slot, TGriffin &fGriffin, TGriffinBgo &fGriffinBgo)
void CreateHistograms(unsigned int slot) override
Virtual helper function that the user uses to create their histograms.
bool ExcludeCrystal(int arraynumber)
std::map< unsigned int, std::deque< TGriffin * > > fGriffinDeque
ROOT::RDF::RResultPtr< std::map< std::string, TList > > Book(ROOT::RDataFrame *d) override
This method will call the Book action on the provided dataframe.
std::map< unsigned int, std::deque< TGriffinBgo * > > fBgoDeque
TUserSettings * fUserSettings
Definition TGRSIHelper.h:58
std::string & Prefix()
Definition TGRSIHelper.h:40
virtual void Setup()
void Print(Option_t *="") const override
bool GetBool(const std::string &parameter, bool quiet=false) const
std::vector< int > GetIntVector(const std::string &parameter, bool quiet=false) const
int GetInt(const std::string &parameter, bool quiet=false) const
double GetDouble(const std::string &parameter, bool quiet=false) const