GRSISort "v4.0.0.5"
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 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
70 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif2->GetEnergy());
71 }
72 }
73 }
74 }
75
76 // loop over suppressed griffin hits
77 for(int g1 = 0; g1 < grif.GetSuppressedMultiplicity(&grifBgo); ++g1) {
78 auto* grif1 = grif.GetSuppressedHit(g1);
79 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
80 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy());
81 for(int g2 = g1 + 1; g2 < grif.GetSuppressedMultiplicity(&grifBgo); ++g2) {
82 auto* grif2 = grif.GetSuppressedHit(g2);
83 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
84 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
85 if(Prompt(grif1, grif2)) {
86 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
87 }
88 }
89 }
90 for(int g2 = 0; g2 < grif.GetMultiplicity(); ++g2) {
91 if(g1 == g2) { continue; } // this is wrong? maybe check energy and time instead?
92 auto* grif2 = grif.GetGriffinHit(g2);
93 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
94 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
95 if(Prompt(grif1, grif2)) {
96 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
97 fH1[slot].at("griffinGriffinESuppProj")->Fill(grif1->GetEnergy());
98 }
99 }
100 }
101 }
102
103 // loop over unsuppressed griffin addback hits
104 for(int g1 = 0; g1 < grif.GetAddbackMultiplicity(); ++g1) {
105 auto* grif1 = grif.GetAddbackHit(g1);
106 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
107 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy());
108 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
109 auto* grif2 = grif.GetAddbackHit(g2);
110 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
111 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
112 if(Prompt(grif1, grif2)) {
113 // fill every histogram "twice" because of the way we loop
114 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
115 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy());
116 fH1[slot].at("griffinGriffinEAddbackProj")->Fill(grif1->GetEnergy());
117 fH1[slot].at("griffinGriffinEAddbackProj")->Fill(grif2->GetEnergy());
118 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
119 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif2->GetEnergy());
120 }
121 }
122 }
123 }
124
125 // loop over suppressed griffin addback hits
126 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
127 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
128 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
129 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy());
130 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
131 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
132 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
133 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
134 if(Prompt(grif1, grif2)) {
135 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
136 }
137 }
138 }
139 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
140 if(g1 == g2) { continue; }
141 auto* grif2 = grif.GetAddbackHit(g2);
142 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
143 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
144 if(Prompt(grif1, grif2)) {
145 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
146 fH1[slot].at("griffinGriffinESuppAddbackProj")->Fill(grif1->GetEnergy());
147 }
148 }
149 }
150 }
151
152 // loop over suppressed griffin addback hits, single crystal method
153 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
154 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
155 if(Reject(grif1) || !GoodCfd(grif1) || grif.GetNSuppressedAddbackFrags(g1) > 1) { continue; }
156 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy());
157 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
158 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
159 if(Reject(grif2) || !GoodCfd(grif2) || grif.GetNSuppressedAddbackFrags(g2) > 1) { continue; }
160 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
161 if(Prompt(grif1, grif2)) {
162 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
163 }
164 }
165 }
166 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
167 if(g1 == g2) { continue; }
168 auto* grif2 = grif.GetAddbackHit(g2);
169 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
170 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
171 if(Prompt(grif1, grif2)) {
172 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
173 fH1[slot].at("griffinGriffinESingleCrystalProj")->Fill(grif1->GetEnergy());
174 }
175 }
176 }
177 }
178}
179
181{
182 // we use .at() here instead of [] so that we get meaningful error message if a histogram we try to fill wasn't created
183 // e.g. because of a typo
184
185 // we do direct background corrections in the histograms, i.e.
186 // we subtract time-random gate and coincident Compton background, and add time-random Compton background
187
188 // loop over unsuppressed griffin hits
189 for(int g0 = 0; g0 < grif.GetMultiplicity(); ++g0) {
190 auto* grif0 = grif.GetGriffinHit(g0);
191 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
192 for(int g1 = 0; g1 < grif.GetMultiplicity(); ++g1) {
193 if(g1 == g0) { continue; }
194 auto* grif1 = grif.GetGriffinHit(g1);
195 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
196 if(Coincident(grif0, grif1) && Gate(grif0)) {
197 // coincident gate
198 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy());
199 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
200 auto* grif2 = grif.GetGriffinHit(g2);
201 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
202 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
203 if(Prompt(grif1, grif2)) {
204 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
205 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy());
206 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
207 }
208 }
209 }
210 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
211 // time-random gate - subtract with time random weight
212 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
213 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
214 auto* grif2 = grif.GetGriffinHit(g2);
215 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
216 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
217 if(Prompt(grif1, grif2)) {
218 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
219 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
220 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
221 }
222 }
223 }
224 } else if(Coincident(grif0, grif1) && Background(grif0)) {
225 // coincident Compton background - subtract with energy gate weight
226 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy(), -fEnergyRatio);
227 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
228 auto* grif2 = grif.GetGriffinHit(g2);
229 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
230 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
231 if(Prompt(grif1, grif2)) {
232 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
233 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
234 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
235 }
236 }
237 }
238 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
239 // time random Compton background - add with time random weight time energy gate weight
240 fH1[slot].at("griffinE")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
241 for(int g2 = g1 + 1; g2 < grif.GetMultiplicity(); ++g2) {
242 auto* grif2 = grif.GetGriffinHit(g2);
243 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
244 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
245 if(Prompt(grif1, grif2)) {
246 fH2[slot].at("griffinGriffinE")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
247 fH2[slot].at("griffinGriffinE")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
248 fH2[slot].at("griffinGriffinESum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
249 }
250 }
251 }
252 }
253 }
254 }
255
256 // loop over suppressed griffin hits
257 for(int g0 = 0; g0 < grif.GetAddbackMultiplicity(); ++g0) {
258 auto* grif0 = grif.GetAddbackHit(g0);
259 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
260 for(int g1 = 0; g1 < grif.GetSuppressedMultiplicity(&grifBgo); ++g1) {
261 if(g1 == g0) { continue; }
262 auto* grif1 = grif.GetSuppressedHit(g1);
263 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
264 if(Coincident(grif0, grif1) && Gate(grif0)) {
265 // coincident gate
266 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy());
267 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
268 // time-random gate - subtract with time random weight
269 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
270 } else if(Coincident(grif0, grif1) && Background(grif0)) {
271 // coincident Compton background - subtract with energy gate weight
272 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy(), -fEnergyRatio);
273 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
274 // time random Compton background - add with time random weight time energy gate weight
275 fH1[slot].at("griffinESupp")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
276 }
277 for(int g2 = g1 + 1; g2 < grif.GetSuppressedMultiplicity(&grifBgo); ++g2) {
278 auto* grif2 = grif.GetSuppressedHit(g2);
279 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
280 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
281 if(Prompt(grif1, grif2)) {
282 if(Coincident(grif0, grif1) && Gate(grif0)) {
283 // coincident gate
284 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
285 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
286 // time-random gate - subtract with time random weight
287 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
288 } else if(Coincident(grif0, grif1) && Background(grif0)) {
289 // coincident Compton background - subtract with energy gate weight
290 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), 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 fH2[slot].at("griffinGriffinESuppSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
294 }
295 }
296 }
297 }
298 for(int g2 = 0; g2 < grif.GetMultiplicity(); ++g2) {
299 if(g1 == g2) { continue; }
300 auto* grif2 = grif.GetGriffinHit(g2);
301 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
302 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
303 if(Prompt(grif1, grif2)) {
304 if(Coincident(grif0, grif1) && Gate(grif0)) {
305 // coincident gate
306 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
307 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
308 // time-random gate - subtract with time random weight
309 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
310 } else if(Coincident(grif0, grif1) && Background(grif0)) {
311 // coincident Compton background - subtract with energy gate weight
312 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
313 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
314 // time random Compton background - add with time random weight time energy gate weight
315 fH2[slot].at("griffinGriffinEMixed")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
316 }
317 }
318 }
319 }
320 }
321 }
322
323 // loop over unsuppressed griffin addback hits
324 for(int g0 = 0; g0 < grif.GetAddbackMultiplicity(); ++g0) {
325 auto* grif0 = grif.GetAddbackHit(g0);
326 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
327 for(int g1 = 0; g1 < grif.GetAddbackMultiplicity(); ++g1) {
328 if(g1 == g0) { continue; }
329 auto* grif1 = grif.GetAddbackHit(g1);
330 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
331 if(Coincident(grif0, grif1) && Gate(grif0)) {
332 // coincident gate
333 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy());
334 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
335 auto* grif2 = grif.GetAddbackHit(g2);
336 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
337 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
338 if(Prompt(grif1, grif2)) {
339 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
340 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy());
341 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
342 }
343 }
344 }
345 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
346 // time-random gate - subtract with time random weight
347 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
348 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
349 auto* grif2 = grif.GetAddbackHit(g2);
350 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
351 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
352 if(Prompt(grif1, grif2)) {
353 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
354 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
355 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
356 }
357 }
358 }
359 } else if(Coincident(grif0, grif1) && Background(grif0)) {
360 // coincident Compton background - subtract with energy gate weight
361 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy(), -fEnergyRatio);
362 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
363 auto* grif2 = grif.GetAddbackHit(g2);
364 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
365 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
366 if(Prompt(grif1, grif2)) {
367 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
368 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
369 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
370 }
371 }
372 }
373 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
374 // time random Compton background - add with time random weight time energy gate weight
375 fH1[slot].at("griffinEAddback")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
376 for(int g2 = g1 + 1; g2 < grif.GetAddbackMultiplicity(); ++g2) {
377 auto* grif2 = grif.GetAddbackHit(g2);
378 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
379 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
380 if(Prompt(grif1, grif2)) {
381 fH2[slot].at("griffinGriffinEAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
382 fH2[slot].at("griffinGriffinEAddback")->Fill(grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
383 fH2[slot].at("griffinGriffinEAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
384 }
385 }
386 }
387 }
388 }
389 }
390
391 // loop over suppressed griffin addback hits
392 for(int g0 = 0; g0 < grif.GetAddbackMultiplicity(); ++g0) {
393 auto* grif0 = grif.GetAddbackHit(g0);
394 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
395 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
396 if(g1 == g0) { continue; }
397 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
398 if(Reject(grif1) || !GoodCfd(grif1)) { continue; }
399 if(Coincident(grif0, grif1) && Gate(grif0)) {
400 // coincident gate
401 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy());
402 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
403 // time-random gate - subtract with time random weight
404 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
405 } else if(Coincident(grif0, grif1) && Background(grif0)) {
406 // coincident Compton background - subtract with energy gate weight
407 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy(), -fEnergyRatio);
408 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
409 // time random Compton background - add with time random weight time energy gate weight
410 fH1[slot].at("griffinESuppAddback")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
411 }
412 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
413 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
414 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
415 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
416 if(Prompt(grif1, grif2)) {
417 if(Coincident(grif0, grif1) && Gate(grif0)) {
418 // coincident gate
419 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
420 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
421 // time-random gate - subtract with time random weight
422 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
423 } else if(Coincident(grif0, grif1) && Background(grif0)) {
424 // coincident Compton background - subtract with energy gate weight
425 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
426 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
427 // time random Compton background - add with time random weight time energy gate weight
428 fH2[slot].at("griffinGriffinESuppAddbackSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
429 }
430 }
431 }
432 }
433 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
434 if(g1 == g2) { continue; }
435 auto* grif2 = grif.GetAddbackHit(g2);
436 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
437 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
438 if(Prompt(grif1, grif2)) {
439 if(Coincident(grif0, grif1) && Gate(grif0)) {
440 // coincident gate
441 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
442 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
443 // time-random gate - subtract with time random weight
444 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
445 } else if(Coincident(grif0, grif1) && Background(grif0)) {
446 // coincident Compton background - subtract with energy gate weight
447 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
448 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
449 // time random Compton background - add with time random weight time energy gate weight
450 fH2[slot].at("griffinGriffinEMixedAddback")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
451 }
452 }
453 }
454 }
455 }
456 }
457
458 // loop over suppressed griffin addback hits, single crystal method
459 for(int g0 = 0; g0 < grif.GetAddbackMultiplicity(); ++g0) {
460 auto* grif0 = grif.GetAddbackHit(g0);
461 if(Reject(grif0) || !GoodCfd(grif0)) { continue; }
462 for(int g1 = 0; g1 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g1) {
463 if(g1 == g0) { continue; }
464 auto* grif1 = grif.GetSuppressedAddbackHit(g1);
465 if(Reject(grif1) || !GoodCfd(grif1) || grif.GetNSuppressedAddbackFrags(g1) > 1) { continue; }
466 if(Coincident(grif0, grif1) && Gate(grif0)) {
467 // coincident gate
468 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy());
469 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
470 // time-random gate - subtract with time random weight
471 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy(), -fTimeRandomRatio);
472 } else if(Coincident(grif0, grif1) && Background(grif0)) {
473 // coincident Compton background - subtract with energy gate weight
474 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy(), -fEnergyRatio);
475 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
476 // time random Compton background - add with time random weight time energy gate weight
477 fH1[slot].at("griffinESingleCrystal")->Fill(grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
478 }
479 for(int g2 = g1 + 1; g2 < grif.GetSuppressedAddbackMultiplicity(&grifBgo); ++g2) {
480 auto* grif2 = grif.GetSuppressedAddbackHit(g2);
481 if(Reject(grif2) || !GoodCfd(grif2) || grif.GetNSuppressedAddbackFrags(g2) > 1) { continue; }
482 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 179.) {
483 if(Prompt(grif1, grif2)) {
484 if(Coincident(grif0, grif1) && Gate(grif0)) {
485 // coincident gate
486 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy());
487 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
488 // time-random gate - subtract with time random weight
489 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fTimeRandomRatio);
490 } else if(Coincident(grif0, grif1) && Background(grif0)) {
491 // coincident Compton background - subtract with energy gate weight
492 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), -fEnergyRatio);
493 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
494 // time random Compton background - add with time random weight time energy gate weight
495 fH2[slot].at("griffinGriffinESingleCrystalSum")->Fill(grif1->GetEnergy() + grif2->GetEnergy(), grif1->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
496 }
497 }
498 }
499 }
500 for(int g2 = 0; g2 < grif.GetAddbackMultiplicity(); ++g2) {
501 if(g1 == g2) { continue; }
502 auto* grif2 = grif.GetAddbackHit(g2);
503 if(Reject(grif2) || !GoodCfd(grif2)) { continue; }
504 if(grif1->GetPosition().Angle(grif2->GetPosition()) / TMath::Pi() * 180. > 157.) {
505 if(Prompt(grif1, grif2)) {
506 if(Coincident(grif0, grif1) && Gate(grif0)) {
507 // coincident gate
508 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy());
509 } else if(TimeRandom(grif0, grif1) && Gate(grif0)) {
510 // time-random gate - subtract with time random weight
511 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fTimeRandomRatio);
512 } else if(Coincident(grif0, grif1) && Background(grif0)) {
513 // coincident Compton background - subtract with energy gate weight
514 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), -fEnergyRatio);
515 } else if(TimeRandom(grif0, grif1) && Background(grif0)) {
516 // time random Compton background - add with time random weight time energy gate weight
517 fH2[slot].at("griffinGriffinEMixedSingleCrystal")->Fill(grif1->GetEnergy(), grif2->GetEnergy(), fTimeRandomRatio * fEnergyRatio);
518 }
519 }
520 }
521 }
522 }
523 }
524}
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:45
std::vector< TGRSIMap< std::string, TH1 * > > fH1
Definition TGRSIHelper.h:44
TGriffinHit * GetAddbackHit(const int &i)
Definition TGriffin.cxx:288
Short_t GetAddbackMultiplicity()
Definition TGriffin.cxx:264
UShort_t GetNSuppressedAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:593
TGriffinHit * GetSuppressedAddbackHit(const int &i)
Definition TGriffin.cxx:538
Short_t GetSuppressedMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:501
Short_t GetSuppressedAddbackMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:554
TGriffinHit * GetSuppressedHit(const int &i)
!
Definition TGriffin.cxx:485
TGriffinHit * GetGriffinHit(const int &i)
!
Definition TGriffin.cxx:243