GRSISort "v4.1.1.0"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
SummingCorrectionsHelper.cxx
Go to the documentation of this file.
2
4{
5 // four histograms for each type:
6 // - 1D singles (2D matrix for branching ratios),
7 // - prompt 2D matrix (unsuppressed on y-axis for suppressed data),
8 // - same as 1D projection on x-axis (but with 1D binning), and
9 // - sum matrix (sum on x-axis)
10 // latter three are for detectors at 180 degree from another
11 // 180 degree means for addback that the detectors are opposite, so the crystal angles are 158 degrees and larger (for 145 mm distance)!
12
13 // unsuppressed spectra
14 fH1[slot]["griffinE"] = new TH1F("griffinE", Form("Unsuppressed griffin energy;energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
15 fH2[slot]["griffinGriffinE"] = new TH2F("griffinGriffinE", "Unsuppressed griffin-griffin energy @ 180^{o};energy [keV];energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
16 fH1[slot]["griffinGriffinEProj"] = new TH1F("griffinGriffinEProj", Form("Unsuppressed griffin energy with hit in crystal @ 180^{o};energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
17 fH2[slot]["griffinGriffinESum"] = new TH2F("griffinGriffinESum", "Unsuppressed griffin energy vs griffin sum energy @ 180^{o};sum energy [keV];energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
18 // suppressed spectra
19 fH1[slot]["griffinESupp"] = new TH1F("griffinESupp", Form("Suppressed griffin energy;energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
20 fH2[slot]["griffinGriffinEMixed"] = new TH2F("griffinGriffinEMixed", "Unsuppressed/suppressed griffin-griffin energy @ 180^{o};suppressed energy [keV];unsuppressed energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
21 fH1[slot]["griffinGriffinESuppProj"] = new TH1F("griffinGriffinESuppProj", Form("Suppressed griffin energy with hit in crystal @ 180^{o};energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
22 fH2[slot]["griffinGriffinESuppSum"] = new TH2F("griffinGriffinESuppSum", "Suppressed griffin energy vs griffin sum energy @ 180^{o};sum energy [keV];energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
23 // unsuppressed addback spectra
24 fH1[slot]["griffinEAddback"] = new TH1F("griffinEAddback", Form("Unsuppressed griffin addback energy;energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
25 fH2[slot]["griffinGriffinEAddback"] = new TH2F("griffinGriffinEAddback", "Unsuppressed griffin-griffin addback @ 180^{o};energy [keV];energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
26 fH1[slot]["griffinGriffinEAddbackProj"] = new TH1F("griffinGriffinEAddbackProj", Form("Unsuppressed griffin addback energy with hit in detector @ 180^{o};energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
27 fH2[slot]["griffinGriffinEAddbackSum"] = new TH2F("griffinGriffinEAddbackSum", "Unsuppressed griffin addback vs griffin sum energy @ 180^{o};sum energy [keV];energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
28 // suppressed addback spectra
29 fH1[slot]["griffinESuppAddback"] = new TH1F("griffinESuppAddback", Form("Suppressed griffin addback energy;energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
30 fH2[slot]["griffinGriffinEMixedAddback"] = new TH2F("griffinGriffinEMixedAddback", "Unsuppressed/suppressed griffin-griffin addback @ 180^{o};suppressed energy [keV];unsuppressed energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
31 fH1[slot]["griffinGriffinESuppAddbackProj"] = new TH1F("griffinGriffinESuppAddbackProj", Form("Suppressed griffin addback energy with hit in detector @ 180^{o};energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
32 fH2[slot]["griffinGriffinESuppAddbackSum"] = new TH2F("griffinGriffinESuppAddbackSum", "Suppressed griffin addback vs sum energy @ 180^{o};sum energy [keV];energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
33 // suppressed single crystal addback spectra
34 fH1[slot]["griffinESingleCrystal"] = new TH1F("griffinESingleCrystal", Form("Suppressed griffin addback energy single crystal method;energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
35 fH2[slot]["griffinGriffinEMixedSingleCrystal"] = new TH2F("griffinGriffinEMixedSingleCrystal", "Unsuppressed/suppressed griffin-griffin addback @ 180^{o};suppressed energy [keV];unsuppressed energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
36 fH1[slot]["griffinGriffinESingleCrystalProj"] = new TH1F("griffinGriffinESingleCrystalProj", Form("Suppressed griffin addback energy single crystal method with hit in detector @ 180^{o};energy [keV];counts/%.1f keV", (fHighEnergy - fLowEnergy) / fEnergyBins1D), fEnergyBins1D, fLowEnergy, fHighEnergy);
37 fH2[slot]["griffinGriffinESingleCrystalSum"] = new TH2F("griffinGriffinESingleCrystalSum", "Suppressed griffin addback vs sum energy @ 180^{o}, single crystal method;sum energy [keV];energy [keV]", fEnergyBins2D, fLowEnergy, fHighEnergy, fEnergyBins2D, fLowEnergy, fHighEnergy);
38}
39
40void SummingCorrectionsHelper::Exec(unsigned int slot, TGriffin& grif, TGriffinBgo& grifBgo)
41{
43 FillBranchingRatioHistograms(slot, grif, grifBgo);
44 } else {
45 FillEfficiencyHistograms(slot, grif, grifBgo);
46 }
47}
48
50{
51 // we use .at() here instead of [] so that we get meaningful error message if a histogram we try to fill wasn't created
52 // e.g. because of a typo
53
54 // loop over unsuppressed griffin hits
55 for(int g1 = 0; g1 < grif.GetMultiplicity(); ++g1) {
56 auto* grif1 = grif.GetGriffinHit(g1);
57 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
58 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy());
59 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
60 auto* grif2 = grif.GetGriffinHit(g2);
61 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
62 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
63 if(Prompt(grif1, grif2)) {
64 // fill every histogram "twice" because of the way we loop
65 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
66 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy());
67 fH1[slot].at("griffinGriffinEProj")->Fill(grif1->GetEnergy());
68 fH1[slot].at("griffinGriffinEProj")->Fill(grif2->GetEnergy());
69 // we only fill these histograms once, as otherwise we would be double counting
70 // doing it this way means we will have only one of the two gamma rays that contribute to the sum on the x-axis entered on the y-axis
71 // but that is fine as we will fit all peaks that contribute to this sum and add them all together
72 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
73 }
74 }
75 }
76 }
77
78 // loop over suppressed griffin hits
79 for(int g1 = 0; g1 < grif.GetSuppressedMultiplicity(&grifBgo); ++g1) {
80 auto* grif1 = grif.GetSuppressedHit(g1);
81 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
82 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy());
83 for(int g2 = g1 + 1; g2 < grif.GetSuppressedMultiplicity(&grifBgo); ++g2) {
84 auto* grif2 = grif.GetSuppressedHit(g2);
85 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
86 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
87 if(Prompt(grif1, grif2)) {
88 // we only fill these histograms once, as otherwise we would be double counting
89 // doing it this way means we will have only one of the two gamma rays that contribute to the sum on the x-axis entered on the y-axis
90 // but that is fine as we will fit all peaks that contribute to this sum and add them all together
91 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
92 }
93 }
94 }
95 for(int g2 = 0; g2 < grif.GetMultiplicity(); ++g2) {
96 // can't simply check indices to avoid using the same hit twice, so we check the address, energy, and time of the hits
97 auto* grif2 = grif.GetGriffinHit(g2);
98 if(grif1->GetAddress() == grif2->GetAddress() && grif1->GetEnergy() == grif2->GetEnergy() && grif1->GetTime() == grif2->GetTime()) { continue; }
99 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
100 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
101 if(Prompt(grif1, grif2)) {
102 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
103 fH1[slot].at("griffinGriffinESuppProj")->Fill(grif1->GetEnergy());
104 }
105 }
106 }
107 }
108
109 // loop over unsuppressed griffin addback hits
110 for(int g1 = 0; g1 < grif.GetAddbackMultiplicity(); ++g1) {
111 auto* grif1 = grif.GetAddbackHit(g1);
112 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
113 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy());
114 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
115 auto* grif2 = grif.GetAddbackHit(g2);
116 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
117 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
118 if(Prompt(grif1, grif2)) {
119 // fill every histogram "twice" because of the way we loop
120 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
121 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy());
122 fH1[slot].at("griffinGriffinEAddbackProj")->Fill(grif1->GetEnergy());
123 fH1[slot].at("griffinGriffinEAddbackProj")->Fill(grif2->GetEnergy());
124 // we only fill these histograms once, as otherwise we would be double counting
125 // doing it this way means we will have only one of the two gamma rays that contribute to the sum on the x-axis entered on the y-axis
126 // but that is fine as we will fit all peaks that contribute to this sum and add them all together
127 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
128 }
129 }
130 }
131 }
132
133 // loop over suppressed griffin addback hits
134 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
135 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
136 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
137 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy());
138 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
139 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
140 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
141 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
142 if(Prompt(grif1, grif2)) {
143 // we only fill these histograms once, as otherwise we would be double counting
144 // doing it this way means we will have only one of the two gamma rays that contribute to the sum on the x-axis entered on the y-axis
145 // but that is fine as we will fit all peaks that contribute to this sum and add them all together
146 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
147 }
148 }
149 }
150 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
151 // can't simply check indices to avoid using the same hit twice, so we check the address, energy, and time of the hits
152 auto* grif2 = grif.GetAddbackHit(g2);
153 if(grif1->GetAddress() == grif2->GetAddress() && grif1->GetEnergy() == grif2->GetEnergy() && grif1->GetTime() == grif2->GetTime()) { continue; }
154 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
155 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
156 if(Prompt(grif1, grif2)) {
157 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
158 fH1[slot].at("griffinGriffinESuppAddbackProj")->Fill(grif1->GetEnergy());
159 }
160 }
161 }
162 }
163
164 // loop over suppressed griffin addback hits, single crystal method
165 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
166 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
167 if(Reject(grif1) || !GoodCfd(grif1) || grif.GetNSuppressedAddbackFrags(g1) > 1) { continue; }
168 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy());
169 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
170 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
171 if(Reject(grif2) || !GoodCfd(grif2) || grif.GetNSuppressedAddbackFrags(g2) > 1) { continue; }
172 // for the single crystal method, we only consider summing in if it's the crystal opposite
173 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
174 if(Prompt(grif1, grif2)) {
175 // we only fill these histograms once, as otherwise we would be double counting
176 // doing it this way means we will have only one of the two gamma rays that contribute to the sum on the x-axis entered on the y-axis
177 // but that is fine as we will fit all peaks that contribute to this sum and add them all together
178 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
179 }
180 }
181 }
182 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
183 // can't simply check indices to avoid using the same hit twice, so we check the address, energy, and time of the hits
184 auto* grif2 = grif.GetAddbackHit(g2);
185 if(grif1->GetAddress() == grif2->GetAddress() && grif1->GetEnergy() == grif2->GetEnergy() && grif1->GetTime() == grif2->GetTime()) { continue; }
186 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
187 // for the single crystal method, here we need to consider the whole detector opposite, as a hit in one of the other crystals would also cause us to loose this hit
188 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
189 if(Prompt(grif1, grif2)) {
190 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
191 fH1[slot].at("griffinGriffinESingleCrystalProj")->Fill(grif1->GetEnergy());
192 }
193 }
194 }
195 }
196}
197
199{
200 // we use .at() here instead of [] so that we get meaningful error message if a histogram we try to fill wasn't created
201 // e.g. because of a typo
202
203 // we do direct background corrections in the histograms, i.e.
204 // we subtract time-random gate and coincident Compton background, and add time-random Compton background
205
206 // loop over unsuppressed griffin hits
207 for(int g0 = 0; g0 < grif.GetMultiplicity(); ++g0) {
208 auto* grif0 = grif.GetGriffinHit(g0);
209 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
210 for(int g1 = 0; g1 < grif.GetMultiplicity(); ++g1) {
211 if(g1 == g0) { continue; }
212 auto* grif1 = grif.GetGriffinHit(g1);
213 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
214 if(Coincident(grif0, grif1) && Gate(grif0)) {
215 // coincident gate
216 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy());
217 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
218 auto* grif2 = grif.GetGriffinHit(g2);
219 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
220 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
221 if(Prompt(grif1, grif2)) {
222 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
223 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy());
224 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
225 }
226 }
227 }
228 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
229 // time-random gate - subtract with time random weight
230 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
231 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
232 auto* grif2 = grif.GetGriffinHit(g2);
233 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
234 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
235 if(Prompt(grif1, grif2)) {
236 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
237 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
238 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
239 }
240 }
241 }
242 } else if(Coincident(grif0, grif1) && Background(grif0)) {
243 // coincident Compton background - subtract with energy gate weight
244 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy(), -fEnergyRatio);
245 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
246 auto* grif2 = grif.GetGriffinHit(g2);
247 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
248 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
249 if(Prompt(grif1, grif2)) {
250 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
251 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
252 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
253 }
254 }
255 }
256 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
257 // time random Compton background - add with time random weight time energy gate weight
258 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
259 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
260 auto* grif2 = grif.GetGriffinHit(g2);
261 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
262 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
263 if(Prompt(grif1, grif2)) {
264 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
265 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
266 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
267 }
268 }
269 }
270 }
271 }
272 }
273
274 // loop over suppressed griffin hits
275 for(int g0 = 0; g0 < grif.GetSuppressedMultiplicity(&grifBgo); ++g0) {
276 auto* grif0 = grif.GetSuppressedHit(g0);
277 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
278 for(int g1 = 0; g1 < grif.GetSuppressedMultiplicity(&grifBgo); ++g1) {
279 if(g1 == g0) { continue; }
280 auto* grif1 = grif.GetSuppressedHit(g1);
281 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
282 if(Coincident(grif0, grif1) && Gate(grif0)) {
283 // coincident gate
284 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy());
285 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
286 // time-random gate - subtract with time random weight
287 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
288 } else if(Coincident(grif0, grif1) && Background(grif0)) {
289 // coincident Compton background - subtract with energy gate weight
290 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy(), -fEnergyRatio);
291 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
292 // time random Compton background - add with time random weight time energy gate weight
293 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
294 }
295 for(int g2 = g1 + 1; g2 < grif.GetSuppressedMultiplicity(&grifBgo); ++g2) {
296 auto* grif2 = grif.GetSuppressedHit(g2);
297 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
298 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
299 if(Prompt(grif1, grif2)) {
300 if(Coincident(grif0, grif1) && Gate(grif0)) {
301 // coincident gate
302 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
303 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
304 // time-random gate - subtract with time random weight
305 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
306 } else if(Coincident(grif0, grif1) && Background(grif0)) {
307 // coincident Compton background - subtract with energy gate weight
308 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
309 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
310 // time random Compton background - add with time random weight time energy gate weight
311 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
312 }
313 }
314 }
315 }
316 for(int g2 = 0; g2 < grif.GetMultiplicity(); ++g2) {
317 // can't simply check indices to avoid using the same hit twice, so we check the address, energy, and time of the hits
318 auto* grif2 = grif.GetGriffinHit(g2);
319 if(grif1->GetAddress() == grif2->GetAddress() && grif1->GetEnergy() == grif2->GetEnergy() && grif1->GetTime() == grif2->GetTime()) { continue; }
320 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
321 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
322 if(Prompt(grif1, grif2)) {
323 if(Coincident(grif0, grif1) && Gate(grif0)) {
324 // coincident gate
325 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
326 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
327 // time-random gate - subtract with time random weight
328 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
329 } else if(Coincident(grif0, grif1) && Background(grif0)) {
330 // coincident Compton background - subtract with energy gate weight
331 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
332 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
333 // time random Compton background - add with time random weight time energy gate weight
334 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
335 }
336 }
337 }
338 }
339 }
340 }
341
342 // loop over unsuppressed griffin addback hits
343 for(int g0 = 0; g0 < grif.GetAddbackMultiplicity(); ++g0) {
344 auto* grif0 = grif.GetAddbackHit(g0);
345 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
346 for(int g1 = 0; g1 < grif.GetAddbackMultiplicity(); ++g1) {
347 if(g1 == g0) { continue; }
348 auto* grif1 = grif.GetAddbackHit(g1);
349 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
350 if(Coincident(grif0, grif1) && Gate(grif0)) {
351 // coincident gate
352 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy());
353 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
354 auto* grif2 = grif.GetAddbackHit(g2);
355 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
356 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
357 if(Prompt(grif1, grif2)) {
358 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
359 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy());
360 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
361 }
362 }
363 }
364 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
365 // time-random gate - subtract with time random weight
366 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
367 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
368 auto* grif2 = grif.GetAddbackHit(g2);
369 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
370 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
371 if(Prompt(grif1, grif2)) {
372 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
373 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
374 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
375 }
376 }
377 }
378 } else if(Coincident(grif0, grif1) && Background(grif0)) {
379 // coincident Compton background - subtract with energy gate weight
380 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy(), -fEnergyRatio);
381 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
382 auto* grif2 = grif.GetAddbackHit(g2);
383 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
384 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
385 if(Prompt(grif1, grif2)) {
386 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
387 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
388 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
389 }
390 }
391 }
392 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
393 // time random Compton background - add with time random weight time energy gate weight
394 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
395 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
396 auto* grif2 = grif.GetAddbackHit(g2);
397 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
398 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
399 if(Prompt(grif1, grif2)) {
400 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
401 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
402 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
403 }
404 }
405 }
406 }
407 }
408 }
409
410 // loop over suppressed griffin addback hits
411 for(int g0 = 0; g0 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g0) {
412 auto* grif0 = grif.GetSuppressedAddbackHit(g0);
413 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
414 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
415 if(g1 == g0) { continue; }
416 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
417 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
418 if(Coincident(grif0, grif1) && Gate(grif0)) {
419 // coincident gate
420 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy());
421 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
422 // time-random gate - subtract with time random weight
423 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
424 } else if(Coincident(grif0, grif1) && Background(grif0)) {
425 // coincident Compton background - subtract with energy gate weight
426 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy(), -fEnergyRatio);
427 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
428 // time random Compton background - add with time random weight time energy gate weight
429 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
430 }
431 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
432 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
433 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
434 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
435 if(Prompt(grif1, grif2)) {
436 if(Coincident(grif0, grif1) && Gate(grif0)) {
437 // coincident gate
438 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
439 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
440 // time-random gate - subtract with time random weight
441 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
442 } else if(Coincident(grif0, grif1) && Background(grif0)) {
443 // coincident Compton background - subtract with energy gate weight
444 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
445 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
446 // time random Compton background - add with time random weight time energy gate weight
447 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
448 }
449 }
450 }
451 }
452 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
453 // can't simply check indices to avoid using the same hit twice, so we check the address, energy, and time of the hits
454 auto* grif2 = grif.GetAddbackHit(g2);
455 if(grif1->GetAddress() == grif2->GetAddress() && grif1->GetEnergy() == grif2->GetEnergy() && grif1->GetTime() == grif2->GetTime()) { continue; }
456 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
457 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
458 if(Prompt(grif1, grif2)) {
459 if(Coincident(grif0, grif1) && Gate(grif0)) {
460 // coincident gate
461 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
462 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
463 // time-random gate - subtract with time random weight
464 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
465 } else if(Coincident(grif0, grif1) && Background(grif0)) {
466 // coincident Compton background - subtract with energy gate weight
467 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
468 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
469 // time random Compton background - add with time random weight time energy gate weight
470 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
471 }
472 }
473 }
474 }
475 }
476 }
477
478 // loop over suppressed griffin addback hits, single crystal method
479 for(int g0 = 0; g0 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g0) {
480 auto* grif0 = grif.GetSuppressedAddbackHit(g0);
481 if(Reject(grif0) || !GoodCfd(grif0) || grif.GetNSuppressedAddbackFrags(g0) > 1) { continue; }
482 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
483 if(g1 == g0) { continue; }
484 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
485 if(Reject(grif1) || !GoodCfd(grif1) || grif.GetNSuppressedAddbackFrags(g1) > 1) { continue; }
486 if(Coincident(grif0, grif1) && Gate(grif0)) {
487 // coincident gate
488 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy());
489 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
490 // time-random gate - subtract with time random weight
491 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
492 } else if(Coincident(grif0, grif1) && Background(grif0)) {
493 // coincident Compton background - subtract with energy gate weight
494 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy(), -fEnergyRatio);
495 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
496 // time random Compton background - add with time random weight time energy gate weight
497 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
498 }
499 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
500 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
501 if(Reject(grif2) || !GoodCfd(grif2) || grif.GetNSuppressedAddbackFrags(g2) > 1) { continue; }
502 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
503 if(Prompt(grif1, grif2)) {
504 if(Coincident(grif0, grif1) && Gate(grif0)) {
505 // coincident gate
506 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
507 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
508 // time-random gate - subtract with time random weight
509 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
510 } else if(Coincident(grif0, grif1) && Background(grif0)) {
511 // coincident Compton background - subtract with energy gate weight
512 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
513 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
514 // time random Compton background - add with time random weight time energy gate weight
515 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
516 }
517 }
518 }
519 }
520 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
521 // can't simply check indices to avoid using the same hit twice, so we check the address, energy, and time of the hits
522 auto* grif2 = grif.GetAddbackHit(g2);
523 if(grif1->GetAddress() == grif2->GetAddress() && grif1->GetEnergy() == grif2->GetEnergy() && grif1->GetTime() == grif2->GetTime()) { continue; }
524 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
525 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
526 if(Prompt(grif1, grif2)) {
527 if(Coincident(grif0, grif1) && Gate(grif0)) {
528 // coincident gate
529 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
530 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
531 // time-random gate - subtract with time random weight
532 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
533 } else if(Coincident(grif0, grif1) && Background(grif0)) {
534 // coincident Compton background - subtract with energy gate weight
535 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
536 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
537 // time random Compton background - add with time random weight time energy gate weight
538 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
539 }
540 }
541 }
542 }
543 }
544 }
545}
void Prompt()
bool Background(TGriffinHit *h1) const
void FillBranchingRatioHistograms(unsigned int slot, TGriffin &grif, TGriffinBgo &grifBgo)
void CreateHistograms(unsigned int slot) override
Virtual helper function that the user uses to create their histograms.
void Exec(unsigned int slot, TGriffin &grif, TGriffinBgo &grifBgo)
bool Gate(TGriffinHit *h1) const
void FillEfficiencyHistograms(unsigned int slot, TGriffin &grif, TGriffinBgo &grifBgo)
bool TimeRandom(TGriffinHit *h1, TGriffinHit *h2) const
bool Coincident(TGriffinHit *h1, TGriffinHit *h2) const
bool Reject(TGriffinHit *hit) const
bool GoodCfd(TDetectorHit *h1) const
virtual Short_t GetMultiplicity() const
Definition TDetector.h:70
std::vector< TGRSIMap< std::string, TH2 * > > fH2
Definition TGRSIHelper.h:49
std::vector< TGRSIMap< std::string, TH1 * > > fH1
Definition TGRSIHelper.h:48
TGriffinHit * GetAddbackHit(const int &i)
Definition TGriffin.cxx:286
Short_t GetAddbackMultiplicity()
Definition TGriffin.cxx:262
UShort_t GetNSuppressedAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:591
TGriffinHit * GetSuppressedAddbackHit(const int &i)
Definition TGriffin.cxx:536
Short_t GetSuppressedMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:499
Short_t GetSuppressedAddbackMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:552
TGriffinHit * GetSuppressedHit(const int &i)
!
Definition TGriffin.cxx:483
TGriffinHit * GetGriffinHit(const int &i)
!
Definition TGriffin.cxx:241