16 #include "FairRootManager.h"
26 FairRootManager* ioman = FairRootManager::Instance();
27 if (
nullptr == ioman) {
28 Fatal(
"CbmKresConversionBG::Init",
"RootManager not instantised!");
31 fMcTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
32 if (
nullptr == fMcTracks) {
33 Fatal(
"CbmKresConversionBG::Init",
"No MCTrack array!");
41 Double_t invmassRecoPi0,
42 vector<TH1*> BGCases) {
87 if (TMath::Abs(pdg1) != 11) NumOfOthers++;
88 if (TMath::Abs(pdg2) != 11) NumOfOthers++;
89 if (TMath::Abs(pdg3) != 11) NumOfOthers++;
90 if (TMath::Abs(pdg4) != 11) NumOfOthers++;
93 if (NumOfOthers == 4) BGCases[9]->Fill(invmassRecoPi0);
94 if (NumOfOthers == 3) BGCases[8]->Fill(invmassRecoPi0);
96 if (NumOfOthers == 2) {
97 BGCases[7]->Fill(invmassRecoPi0);
98 BGCases[10]->Fill(pdg1);
99 BGCases[10]->Fill(pdg2);
100 BGCases[10]->Fill(pdg3);
101 BGCases[10]->Fill(pdg4);
107 if (TMath::Abs(pdg1) == 11)
108 mother1 = (
CbmMCTrack*) fMcTracks->At(motherId1);
109 if (TMath::Abs(pdg2) == 11)
110 mother2 = (
CbmMCTrack*) fMcTracks->At(motherId2);
111 if (TMath::Abs(pdg3) == 11)
112 mother3 = (
CbmMCTrack*) fMcTracks->At(motherId3);
113 if (TMath::Abs(pdg4) == 11)
114 mother4 = (
CbmMCTrack*) fMcTracks->At(motherId4);
120 if (TMath::Abs(pdg1) != 11 && motherId1 != -1)
121 mother1N = (
CbmMCTrack*) fMcTracks->At(motherId1);
122 if (TMath::Abs(pdg2) != 11 && motherId2 != -1)
123 mother2N = (
CbmMCTrack*) fMcTracks->At(motherId2);
124 if (TMath::Abs(pdg3) != 11 && motherId3 != -1)
125 mother3N = (
CbmMCTrack*) fMcTracks->At(motherId3);
126 if (TMath::Abs(pdg4) != 11 && motherId4 != -1)
127 mother4N = (
CbmMCTrack*) fMcTracks->At(motherId4);
129 if (
nullptr != mother1) BGCases[11]->Fill(mother1->
GetPdgCode());
130 if (
nullptr != mother2) BGCases[11]->Fill(mother2->
GetPdgCode());
131 if (
nullptr != mother3) BGCases[11]->Fill(mother3->
GetPdgCode());
132 if (
nullptr != mother4) BGCases[11]->Fill(mother4->
GetPdgCode());
134 std::vector<int> testM;
135 if (TMath::Abs(pdg1) == 11) testM.push_back(motherId1);
136 if (TMath::Abs(pdg2) == 11) testM.push_back(motherId2);
137 if (TMath::Abs(pdg3) == 11) testM.push_back(motherId3);
138 if (TMath::Abs(pdg4) == 11) testM.push_back(motherId4);
140 if (testM.size() == 2 && testM[0] == testM[1]) {
141 BGCases[12]->Fill(invmassRecoPi0);
142 if (testM[0] != -1) {
148 if (TMath::Abs(pdg1) != 11 && motherId1 != -1) {
149 BGCases[23]->Fill(pdg1);
151 BGCases[25]->Fill(invmassRecoPi0);
153 if (TMath::Abs(pdg2) != 11 && motherId2 != -1) {
154 BGCases[23]->Fill(pdg2);
156 BGCases[25]->Fill(invmassRecoPi0);
158 if (TMath::Abs(pdg3) != 11 && motherId3 != -1) {
159 BGCases[23]->Fill(pdg3);
161 BGCases[25]->Fill(invmassRecoPi0);
163 if (TMath::Abs(pdg4) != 11 && motherId4 != -1) {
164 BGCases[23]->Fill(pdg4);
166 BGCases[25]->Fill(invmassRecoPi0);
169 if (TMath::Abs(pdg1) != 11 && motherId1 == -1) {
170 BGCases[26]->Fill(pdg1);
171 BGCases[27]->Fill(invmassRecoPi0, 0.5);
172 BGCases[28]->Fill(mctrack1->
GetP());
173 BGCases[29]->Fill(mctrack1->
GetPt());
175 if (TMath::Abs(pdg2) != 11 && motherId2 == -1) {
176 BGCases[26]->Fill(pdg2);
177 BGCases[27]->Fill(invmassRecoPi0, 0.5);
178 BGCases[28]->Fill(mctrack2->
GetP());
179 BGCases[29]->Fill(mctrack2->
GetPt());
181 if (TMath::Abs(pdg3) != 11 && motherId3 == -1) {
182 BGCases[26]->Fill(pdg3);
183 BGCases[27]->Fill(invmassRecoPi0, 0.5);
184 BGCases[28]->Fill(mctrack3->
GetP());
185 BGCases[29]->Fill(mctrack3->
GetPt());
187 if (TMath::Abs(pdg4) != 11 && motherId4 == -1) {
188 BGCases[26]->Fill(pdg4);
189 BGCases[27]->Fill(invmassRecoPi0, 0.5);
190 BGCases[28]->Fill(mctrack4->
GetP());
191 BGCases[29]->Fill(mctrack4->
GetPt());
195 std::vector<int> testGR;
196 if (TMath::Abs(pdg1) == 11 &&
nullptr != mother1)
198 if (TMath::Abs(pdg2) == 11 &&
nullptr != mother2)
200 if (TMath::Abs(pdg3) == 11 &&
nullptr != mother3)
202 if (TMath::Abs(pdg4) == 11 &&
nullptr != mother4)
205 if (testGR.size() == 2) {
206 if (testGR[0] == testGR[1]) { BGCases[13]->Fill(invmassRecoPi0); }
213 if (TMath::Abs(pdg1) != 11 && motherId1 == -1)
215 if (TMath::Abs(pdg2) != 11 && motherId2 == -1)
217 if (TMath::Abs(pdg3) != 11 && motherId3 == -1)
219 if (TMath::Abs(pdg4) != 11 && motherId4 == -1)
223 if (TMath::Abs(pdg1) != 11 &&
nullptr != mother1N) {
225 BGCases[17]->Fill(pdg1);
227 BGCases[20]->
Fill(invmassRecoPi0);
228 if (mother1N->
GetPdgCode() == 221) BGCases[21]->
Fill(invmassRecoPi0);
229 if (mother1N->
GetPdgCode() == 310) BGCases[22]->
Fill(invmassRecoPi0);
231 if (TMath::Abs(pdg2) != 11 &&
nullptr != mother2N) {
233 BGCases[17]->Fill(pdg2);
235 BGCases[20]->
Fill(invmassRecoPi0);
236 if (mother2N->
GetPdgCode() == 221) BGCases[21]->
Fill(invmassRecoPi0);
237 if (mother2N->
GetPdgCode() == 310) BGCases[22]->
Fill(invmassRecoPi0);
239 if (TMath::Abs(pdg3) != 11 &&
nullptr != mother3N) {
241 BGCases[17]->Fill(pdg3);
243 BGCases[20]->
Fill(invmassRecoPi0);
244 if (mother3N->
GetPdgCode() == 221) BGCases[21]->
Fill(invmassRecoPi0);
245 if (mother3N->
GetPdgCode() == 310) BGCases[22]->
Fill(invmassRecoPi0);
247 if (TMath::Abs(pdg4) != 11 &&
nullptr != mother4N) {
249 BGCases[17]->Fill(pdg4);
251 BGCases[20]->
Fill(invmassRecoPi0);
252 if (mother4N->
GetPdgCode() == 221) BGCases[21]->
Fill(invmassRecoPi0);
253 if (mother4N->
GetPdgCode() == 310) BGCases[22]->
Fill(invmassRecoPi0);
257 if (NumOfOthers == 1) BGCases[6]->Fill(invmassRecoPi0);
259 if (NumOfOthers == 0) {
260 if (motherId1 != -1 && motherId2 != -1 && motherId3 != -1
261 && motherId4 != -1) {
266 if (
nullptr != mother1 &&
nullptr != mother2 &&
nullptr != mother3
267 &&
nullptr != mother4) {
277 if (motherId1 == motherId2 && motherId3 == motherId4
278 && grandmotherId1 == grandmotherId3) {
279 if (grandmotherId1 != -1) {
285 BGCases[0]->Fill(invmassRecoPi0);
291 if (motherId1 != motherId2 && motherId3 != motherId4) {
292 if (grandmotherId1 == grandmotherId3
293 && grandmotherId1 == grandmotherId4
294 && grandmotherId1 == grandmotherId2) {
295 BGCases[1]->Fill(invmassRecoPi0);
297 BGCases[5]->Fill(invmassRecoPi0);
301 if (motherId1 == motherId2 && motherId3 == motherId4
302 && grandmotherId1 != grandmotherId3)
303 BGCases[2]->Fill(invmassRecoPi0);
305 if ((motherId1 == motherId2 && motherId3 != motherId4)
306 || (motherId1 != motherId2 && motherId3 == motherId4)) {
307 if ((grandmotherId1 == grandmotherId3
308 && grandmotherId1 == grandmotherId4
309 && grandmotherId1 != grandmotherId2)
310 || (grandmotherId1 == grandmotherId2
311 && grandmotherId1 == grandmotherId4
312 && grandmotherId1 != grandmotherId3)
313 || (grandmotherId1 == grandmotherId2
314 && grandmotherId1 == grandmotherId3
315 && grandmotherId1 != grandmotherId4)
316 || (grandmotherId2 == grandmotherId3
317 && grandmotherId2 == grandmotherId4
318 && grandmotherId2 != grandmotherId1)
319 || (grandmotherId2 == grandmotherId1
320 && grandmotherId2 == grandmotherId4
321 && grandmotherId2 != grandmotherId3)
322 || (grandmotherId2 == grandmotherId1
323 && grandmotherId2 == grandmotherId3
324 && grandmotherId2 != grandmotherId4)
325 || (grandmotherId3 == grandmotherId1
326 && grandmotherId3 == grandmotherId2
327 && grandmotherId3 != grandmotherId4)
328 || (grandmotherId3 == grandmotherId1
329 && grandmotherId3 == grandmotherId4
330 && grandmotherId3 != grandmotherId2)
331 || (grandmotherId3 == grandmotherId2
332 && grandmotherId3 == grandmotherId4
333 && grandmotherId3 != grandmotherId1)
334 || (grandmotherId4 == grandmotherId1
335 && grandmotherId4 == grandmotherId2
336 && grandmotherId4 != grandmotherId3)
337 || (grandmotherId4 == grandmotherId1
338 && grandmotherId4 == grandmotherId3
339 && grandmotherId4 != grandmotherId2)
340 || (grandmotherId4 == grandmotherId2
341 && grandmotherId4 == grandmotherId3
342 && grandmotherId4 != grandmotherId1)) {
343 BGCases[3]->Fill(invmassRecoPi0);
345 BGCases[4]->Fill(invmassRecoPi0);