GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TimeWalkHelper.cxx
Go to the documentation of this file.
1#include "TimeWalkHelper.hh"
2
3void TimeWalkHelper::CreateHistograms(unsigned int slot)
4{
5 // Define Histograms
6 fH2[slot]["time_eng_walk"] = new TH2F("time_eng_walk", "time_eng_walk", 120, -20, 100, 4000, 0, 4000);
7 fH2[slot]["time_eng"] = new TH2F("time_eng", "time_eng", 400, -200, 200, 4000, 0, 4000);
8 fH2[slot]["time_eng_nogate"] = new TH2F("time_eng_nogate", "time_eng_nogate", 400, -200, 200, 4000, 0, 4000);
9
10 fH2[slot]["time_engcfd"] = new TH2F("time_engcfd", "time_eng including CFD correction", 4000, -2000, 2000, 4000, 0, 4000);
11 fH2[slot]["time_engcfdnopu"] = new TH2F("time_engcfdnopu", "time_eng including CFD correction", 4000, -2000, 2000, 4000, 0, 4000);
12
13 fH2[slot]["time_eng_walk_bg"] = new TH2F("time_eng_walk_bg", "time_eng_walk_bg", 120, -20, 100, 4000, 0, 4000);
14 fH2[slot]["time_eng_bg"] = new TH2F("time_eng_bg", "time_eng_bg", 120, -20, 100, 4000, 0, 4000);
15
16 fH2[slot]["time_eng_walk_bgnoPU"] = new TH2F("time_eng_walk_bgnoPU", "time_eng_walk_bgnoPU", 120, -20, 100, 4000, 0, 4000);
17 fH2[slot]["time_eng_bgnoPU"] = new TH2F("time_eng_bgnoPU", "time_eng_bgnoPU", 120, -20, 100, 4000, 0, 4000);
18
19 fH2[slot]["time_eng_walk_noPU"] = new TH2F("time_eng_walk_noPU", "time_eng_walk_noPU", 120, -20, 100, 4000, 0, 4000);
20 fH2[slot]["time_eng_noPU"] = new TH2F("time_eng_noPU", "time_eng_noPU", 120, -20, 100, 4000, 0, 4000);
21 fH2[slot]["eng_time_noPU"] = new TH2F("eng_time_noPU", "eng_time_noPU", 8000, 0, 8000, 120, -20, 100);
22
23 fH2[slot]["time_eng_walk_high"] = new TH2F("time_eng_walk_high", "time_eng_walk_high", 120, -20, 100, 4000, 0, 4000);
24 fH2[slot]["time_eng_high"] = new TH2F("time_eng_high", "time_eng_high", 120, -20, 100, 4000, 0, 4000);
25
26 fH2[slot]["time_eng_walk2"] = new TH2F("eng_time_walk", "eng_time_walk", 4000, 0, 4000, 120, -20, 100);
27 fH2[slot]["time_eng2"] = new TH2F("eng_teng", "eng_time", 4000, 0, 4000, 120, -20, 100);
28
29 fH2[slot]["time_eng_walk_no0"] = new TH2F("time_eng_walk_no0", "time_eng_walk_no0", 120, -20, 100, 4000, 0, 4000);
30 fH2[slot]["time_eng_no0"] = new TH2F("time_eng_no0", "time_eng_no0", 120, -20, 100, 4000, 0, 4000);
31
32 fH2[slot]["time_eng_walk_beta"] = new TH2F("time_eng_walk_beta", "time_eng_walk_beta", 120, -20, 100, 4000, 0, 4000);
33 fH2[slot]["time_eng_beta"] = new TH2F("time_eng_beta", "time_eng_beta", 120, -20, 100, 4000, 0, 4000);
34
35 fH3[slot]["time_eng_chan"] = new TH3F("time_engd_chan", "time_engd_chan", 120, -20, 100, 2000, 0, 2000, 64, 0, 64);
36 fH3[slot]["time_eng_chan2"] = new TH3F("time_engd_chan2", "time_engd_chan2", 120, -20, 100, 2000, 0, 2000, 64, 0, 64);
37 fH3[slot]["time_eng_det"] = new TH3F("time_engd_det", "time_engd_det", 120, -20, 100, 2000, 0, 2000, 17, 0, 17);
38 fH3[slot]["time_eng_det2"] = new TH3F("time_engd_det2", "time_engd_det2", 120, -20, 100, 2000, 0, 2000, 17, 0, 17);
39
40 fH2[slot]["kValueChan"] = new TH2F("kValueChan", "kValueChan", 800, 0, 800, 65, 0, 65);
41 fH2[slot]["kValueTDiff"] = new TH2F("kValueTDiff", "kValueTDiff", 400, -200, 200, 800, 0, 800);
42 fH2[slot]["kValueTDiff_samechan"] = new TH2F("kValueTDiff_samechan", "kValueTDiff_samechan", 400, -200, 200, 800, 0, 800);
43 fH2[slot]["kValueTDiff_nogate"] = new TH2F("kValueTDiff_nogate", "kValueTDiff_nogate", 400, -200, 200, 800, 0, 800);
44}
45
47{
48 // Check if hits are less then 300 ns apart.
49 return std::fabs(g->GetTime() - s->GetTime()) < 300.;
50}
51
53{
54 // Check if hits are less then 500 ns apart.
55 return std::fabs(g1->GetTime() - g2->GetTime()) < 500.;
56}
57
58void TimeWalkHelper::Exec(unsigned int slot, TGriffin& grif, TSceptar& scep)
59{
60 // Loop over all Griffin Hits
61 for(auto i = 0; i < grif.GetMultiplicity(); ++i) {
62 auto grif1 = grif.GetGriffinHit(i);
63 fH2[slot].at("kValueChan")->Fill(grif1->GetKValue(), grif1->GetArrayNumber());
64 // Loop over all sceptar hits
65 for(auto j = 0; j < scep.GetMultiplicity(); ++j) {
66 auto scep1 = scep.GetSceptarHit(j);
67 fH2[slot].at("time_eng_bg")->Fill(grif1->GetTimeStamp() - scep1->GetTimeStamp(), grif1->GetEnergy());
68 fH2[slot].at("time_eng_walk_bg")->Fill((grif1->GetTime() - scep1->GetTime()) / 10., grif1->GetEnergy());
69 if(grif1->GetKValue() == 700) {
70 fH2[slot].at("time_eng_bgnoPU")->Fill(grif1->GetTimeStamp() - scep1->GetTimeStamp(), grif1->GetEnergy());
71 fH2[slot].at("time_eng_walk_bgnoPU")->Fill((grif1->GetTime() - scep1->GetTime()) / 10., grif1->GetEnergy());
72 }
73 }
74 for(auto j = 0; j < grif.GetMultiplicity(); ++j) {
75 if(i == j) continue;
76 auto grif2 = grif.GetGriffinHit(j);
77 long timediff = grif2->GetTimeStamp() - grif1->GetTimeStamp();
78 double timediff_walk = (grif2->GetTime() - grif1->GetTime()) / 10.;
79 fH2[slot].at("time_eng_nogate")->Fill(timediff, grif2->GetEnergy());
80 fH2[slot].at("kValueTDiff_nogate")->Fill(timediff, grif2->GetKValue());
81 if(grif1->GetEnergy() > 0.) {
82 fH2[slot].at("time_eng")->Fill(timediff, grif2->GetEnergy());
83 fH2[slot].at("time_eng_walk")->Fill(timediff_walk, grif2->GetEnergy());
84 fH3[slot].at("time_eng_chan")->Fill(timediff, grif2->GetEnergy(), grif2->GetArrayNumber()); // was crystal1 + 4*detector2???
85 fH3[slot].at("time_eng_chan2")->Fill(timediff, grif2->GetEnergy(), grif1->GetArrayNumber()); // was crystal2 + 4*detector1???
86 fH3[slot].at("time_eng_det")->Fill(timediff, grif2->GetEnergy(), grif2->GetDetector());
87 fH3[slot].at("time_eng_det2")->Fill(timediff, grif2->GetEnergy(), grif1->GetDetector());
88 fH2[slot].at("time_engcfd")->Fill(timediff_walk * 10., grif2->GetEnergy());
89 if(grif1->GetKValue() == 700 && grif2->GetKValue() == 700) {
90 fH2[slot].at("time_engcfdnopu")->Fill(timediff_walk * 10., grif2->GetEnergy());
91 fH2[slot].at("time_eng_noPU")->Fill(timediff, grif2->GetEnergy());
92 fH2[slot].at("time_eng_walk_noPU")->Fill(timediff_walk, grif2->GetEnergy());
93 fH2[slot].at("eng_time_noPU")->Fill(grif2->GetEnergy(), timediff);
94 }
95 fH2[slot].at("kValueTDiff")->Fill(timediff, grif2->GetKValue());
96 if(grif1->GetAddress() == grif2->GetAddress()) {
97 fH2[slot].at("kValueTDiff")->Fill(timediff, grif2->GetKValue());
98 }
99 if(grif1->GetAddress() != 0 && grif2->GetAddress() != 0) {
100 fH2[slot].at("time_eng_no0")->Fill(timediff, grif2->GetEnergy());
101 fH2[slot].at("time_eng_walk_no0")->Fill(timediff_walk, grif2->GetEnergy());
102 }
103 fH2[slot].at("time_eng2")->Fill(grif2->GetEnergy(), timediff);
104 fH2[slot].at("time_eng_walk2")->Fill(grif2->GetEnergy(), timediff_walk);
105 }
106 if(grif1->GetEnergy() < 500.) {
107 fH2[slot].at("time_eng_high")->Fill(timediff, grif2->GetEnergy());
108 fH2[slot].at("time_eng_walk_high")->Fill(timediff_walk, grif2->GetEnergy());
109 }
110 }
111 }
112 for(auto i = 0; i < scep.GetMultiplicity(); ++i) {
113 auto scep1 = scep.GetSceptarHit(i);
114 for(auto j = 0; j < scep.GetMultiplicity(); ++j) {
115 if(i == j) continue;
116 auto scep2 = scep.GetSceptarHit(j);
117 fH2[slot].at("time_eng_beta")->Fill(scep2->GetTimeStamp() - scep1->GetTimeStamp(), scep2->GetEnergy());
118 fH2[slot].at("time_eng_walk_beta")->Fill((scep2->GetTime() - scep1->GetTime()) / 10., scep2->GetEnergy());
119 }
120 }
121}
const Double_t s
bool PromptCoincidence(TGriffinHit *g, TSceptarHit *s)
virtual Long64_t GetTimeStamp(Option_t *="") const
virtual Double_t GetTime(const ETimeFlag &correct_flag=ETimeFlag::kAll, Option_t *opt="") const
Returns a time value to the nearest nanosecond!
virtual Short_t GetMultiplicity() const
Definition TDetector.h:73
std::vector< TGRSIMap< std::string, TH2 * > > fH2
Definition TGRSIHelper.h:49
std::vector< TGRSIMap< std::string, TH3 * > > fH3
Definition TGRSIHelper.h:50
Short_t GetMultiplicity() const override
Definition TGriffin.h:52
TGriffinHit * GetGriffinHit(const int &i)
!
Definition TGriffin.h:47
TSceptarHit * GetSceptarHit(const int &i) const
Definition TSceptar.h:36
void CreateHistograms(unsigned int slot) override
Virtual helper function that the user uses to create their histograms.
void Exec(unsigned int slot, TGriffin &grif, TSceptar &scep)