Belle II Software development
MCMatcherTRGECLModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <trg/ecl/modules/MCMatcherTRGECL/MCMatcherTRGECLModule.h>
10
11//framework headers
12#include <framework/gearbox/Unit.h>
13
14//ecl package header
15#include <ecl/dataobjects/ECLHit.h>
16
17//ecl trg package header
18#include "trg/ecl/dataobjects/TRGECLHit.h"
19#include "trg/ecl/dataobjects/TRGECLDigi0.h"
20
21
22#include <mdst/dataobjects/MCParticle.h>
23#include <framework/datastore/RelationArray.h>
24
25
26//C++ STL
27#include <cstdlib>
28#include <time.h>
29#include <utility> //contains pair
30
31
32
33using namespace std;
34using namespace Belle2;
35//using namespace ECL;
36
37//-----------------------------------------------------------------
38// Register the Module
39//-----------------------------------------------------------------
40REG_MODULE(MCMatcherTRGECL);
41
42//-----------------------------------------------------------------
43// Implementation
44//-----------------------------------------------------------------
45
47{
48 // Set description
49
50 setDescription("MCMatcherTRGECLModule");
52 _TCMap = new TrgEclMapping();
53
54
55 for (int ii = 0; ii < 100; ii++) {
56 TCId[ii] = 0;
57 TCRawEnergy[ii] = 0;
58 TCRawTiming[ii] = 0;
59 SignalContribution[ii] = 0;
60 BKGContribution[ii] = 0;
61 TCIdHit[ii] = 0;
62 TCHitEnergy[ii] = 0;
63 TCHitTiming[ii] = 0;
65 BKGContributionHit[ii] = 0;
66
67 for (int icont = 0 ; icont < 3 ; icont ++) {
68
69
70 maxEnergy[ii][icont] = -1;
71 contribution[ii][icont] = 0;
72 TCPrimaryIndex[ii][icont] = -1;
73 XtalId[ii][icont] = -1 ;
74 px[ii][icont] = 0;
75 py[ii][icont] = 0;
76 pz[ii][icont] = 0;
77 pid[ii][icont] = 0;
78 trackId[ii][icont] = 0;
79 background_tag[ii][icont] = 0;
80 mother[ii][icont] = 0 ;
81 gmother[ii][icont] = 0;
82 ggmother[ii][icont] = 0;
83 gggmother[ii][icont] = 0;
84 MCEnergy[ii][icont] = 0;
85
86 ieclhit[ii][icont] = 0 ;
87
88 background_tagHit[ii][icont] = 0;
89 TCPrimaryIndexHit[ii][icont] = -1;
90 XtalIdHit[ii][icont] = -1 ;
91 pxHit[ii][icont] = 0;
92 pyHit[ii][icont] = 0;
93 pzHit[ii][icont] = 0;
94 pidHit[ii][icont] = 0;
95 trackIdHit[ii][icont] = 0;
96 background_tagHit[ii][icont] = 0;
97 motherHit[ii][icont] = 0 ;
98 gmotherHit[ii][icont] = 0;
99 ggmotherHit[ii][icont] = 0;
100 gggmotherHit[ii][icont] = 0;
101 MCEnergyHit[ii][icont] = 0;
102 contributionHit[ii][icont] = 0;
103
104 }
105 }
106}
107
109{
110 delete _TCMap;
111}
112
114{
115 // Initialize variables
116 m_nRun = 0 ;
117 m_nEvent = 0 ;
118 // CPU time start
119 m_timeCPU = clock() * Unit::us;
120
121 m_trgECLDigi0MC.registerInDataStore();
122 m_trgECLHitMC.registerInDataStore();
123 StoreArray<MCParticle> mcParticles;
124 StoreArray<ECLHit> eclHitArray;
125
126 mcParticles.registerRelationTo(eclHitArray);
127 StoreArray<TRGECLDigi0> trgeclDigi0Array;
128 trgeclDigi0Array.registerRelationTo(mcParticles);
129 StoreArray<TRGECLHit> trgeclHitArray;
130 trgeclHitArray.registerRelationTo(mcParticles);
131
132}
133
135{
136}
137
139{
140
141
142 StoreArray<MCParticle> mcParticles;
143 PrimaryTrackMap eclPrimaryMap;
144 eclPrimaryMap.clear();
145 int nParticles = mcParticles.getEntries();
146 // cout << nParticles << endl;
147 for (int iPart = 0; iPart < nParticles ; ++iPart) {
148 if (mcParticles[iPart]->getMother() == NULL) {
149 if (!mcParticles[iPart]->hasStatus(MCParticle::c_PrimaryParticle)) {
150 if (!mcParticles[iPart]->hasStatus(MCParticle::c_StableInGenerator)) {
151 continue;
152 }
153 }
154 }
155
156
157
158 bool adhoc_StableInGeneratorFlag(mcParticles[iPart]->hasStatus(MCParticle::c_StableInGenerator));
159
160 if (mcParticles[iPart]->hasStatus(MCParticle::c_PrimaryParticle)
161 && adhoc_StableInGeneratorFlag) {
162 if (mcParticles[iPart]->getArrayIndex() == -1) {
163 eclPrimaryMap.insert(pair<int, int>(iPart, iPart));
164 } else {
165 eclPrimaryMap.insert(pair<int, int>(mcParticles[iPart]->getArrayIndex(), mcParticles[iPart]->getArrayIndex()));
166 }
167 } else {
168 if (mcParticles[iPart]->getMother() == NULL) continue;
169 if (eclPrimaryMap.find(mcParticles[iPart]->getMother()->getArrayIndex()) != eclPrimaryMap.end()) {
170 eclPrimaryMap.insert(
171 pair<int, int>(mcParticles[iPart]->getArrayIndex(), eclPrimaryMap[mcParticles[iPart]->getMother()->getArrayIndex()]));
172
173 }//if mother of mcParticles is stored.
174 }//if c_StableInGenerator and c_PrimaryParticle
175
176 }//for mcParticles
177
178 //Connect TRGECLDigi0 and MCParticle using ECLHit
179 StoreArray<ECLHit> eclHitArray("ECLHits");
180 RelationArray eclHitRel(mcParticles, eclHitArray);
181 StoreArray<TRGECLDigi0> trgeclDigi0Array;
182 RelationArray trgeclDigi0ToMCPart(trgeclDigi0Array, mcParticles);
183 int nHits_hit = eclHitArray.getEntries() - 1;
184 //
185 int ihit = 0;
186
187 const int NofTCDigiHit = trgeclDigi0Array.getEntries();
188
189 // cout << NofTCDigiHit << endl;
190
191 for (int ii = 0; ii < NofTCDigiHit; ii++) {
192
193
194 TRGECLDigi0* aTRGECLDigi0 = trgeclDigi0Array[ii];
195 TCId[ihit] = (aTRGECLDigi0->getTCId() - 1);
196 TCRawTiming[ihit] = aTRGECLDigi0 ->getRawTiming();
197
198 int itimeindex = (int)(TCRawTiming[ihit] / 100 + 40);
199 TCRawEnergy[ihit] = aTRGECLDigi0 ->getRawEnergy() / Unit::GeV;
200 if (TCRawEnergy[ihit] < 0.1) {continue;} //0.05 GeV cut to save time.
201 for (int hit = 0; hit < nHits_hit; hit++) {//Find relation of TRGECLDigi0 and ECLHit
202
203 ECLHit* aECLHit = eclHitArray[hit];;
204
205 double hitE = aECLHit->getEnergyDep() / Unit::GeV;
206 if (hitE < 0.1) {continue;} //to save time.
207 int hitCellId = aECLHit->getCellId() - 1;
208 int hitTCId = _TCMap->getTCIdFromXtalId(hitCellId + 1) - 1;
209 int timeindex = (int)((aECLHit ->getTimeAve()) / 100 + 40);
210 int backtag = aECLHit ->getBackgroundTag();
211
212 if (hitTCId != TCId[ihit]) {continue;}
213 if (itimeindex != timeindex) {continue;}
214 if (backtag == 0) { SignalContribution[ihit] = SignalContribution[ihit] + hitE;}
215 else { BKGContribution[ihit] = BKGContribution[ihit] + hitE;}
216
217
218 if (TCId[ihit] == hitTCId && maxEnergy[ihit][0] < hitE) {
219
220 ieclhit[ihit][0] = hit;
221 maxEnergy[ihit][0] = hitE;
222 contribution[ihit][0] = hitE;
223 XtalId[ihit][0] = hitCellId ;
224 background_tag[ihit][0] = backtag;
225
226 }
227
228
229 if (TCId[ihit] == hitTCId && maxEnergy[ihit][1] < hitE && hitE < maxEnergy[ihit][0]) {
230 ieclhit[ihit][1] = hit;
231 maxEnergy[ihit][1] = hitE;
232 contribution[ihit][1] = hitE;
233 XtalId[ihit][1] = hitCellId ;
234 background_tag[ihit][1] = backtag;
235 }
236
237
238 if (TCId[ihit] == hitTCId && maxEnergy[ihit][2] < hitE && hitE < maxEnergy[ihit][1]) {
239 ieclhit[ihit][2] = hit;
240 maxEnergy[ihit][2] = hitE;
241 contribution[ihit][2] = hitE;
242 XtalId[ihit][2] = hitCellId ;
243 background_tag[ihit][2] = backtag;
244
245 }
246 }
247 //Find the relation of TRGECLDigi0 and MCParticle using ECLHit
248 for (int index = 0; index < eclHitRel.getEntries(); index++) {
249 int PrimaryIndex = -1;
250
251 map<int, int>::iterator iter = eclPrimaryMap.find(eclHitRel[index].getFromIndex());
252
253 if (iter != eclPrimaryMap.end()) {
254 PrimaryIndex = iter->second;
255 }
256 int eclhitRelSize = eclHitRel[index].getToIndices().size();
257 for (int pri_hit = 0; pri_hit < eclhitRelSize ; pri_hit++) {
258 int ieclHitRel = eclHitRel[index].getToIndex(pri_hit);
259 if (ieclhit[ihit][0] == ieclHitRel) {
260 TCPrimaryIndex[ihit][0] = PrimaryIndex;
261
262 }
263 if (ieclhit[ihit][1] == ieclHitRel) {
264 TCPrimaryIndex[ihit][1] = PrimaryIndex;
265
266 }
267 if (ieclhit[ihit][2] == ieclHitRel) {
268 TCPrimaryIndex[ihit][2] = PrimaryIndex;
269
270 }
271 }
272 }
273
274
275 trackId[ihit][0] = TCPrimaryIndex[ihit][0];
276 trackId[ihit][1] = TCPrimaryIndex[ihit][1];
277 trackId[ihit][2] = TCPrimaryIndex[ihit][2];
278
279
280 // cout <<ihit <<" " << trackId[ihit][0] << " " << trackId[ihit][1] << " " << trackId[ihit][2] << " " << endl;
281
282
283 int mclist = 0;
284
285 if (TCPrimaryIndex[ihit][0] > 0) {
286
287 MCEnergy[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getEnergy();
288 pid[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getPDG();
289 px[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).X();
290 py[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).Y();
291 pz[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).Z();
292 if (pid[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother())) {
293 mother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother() ->getPDG();
294 mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()-> getIndex();
295 }
296 if (mclist != 1 && mother[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother())) {
297 gmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother() ->getPDG();
298 mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()-> getIndex();
299
300 }
301 if (mclist != 1 && gmother[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother())) {
302 ggmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother() ->getPDG();
303 mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()-> getIndex();
304
305
306 }
307 if (mclist != 1 && ggmother[ihit][0] != 0) {
308 if (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()->getMother()) {
309 gggmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
310
311 }
312 }
313
314 }
315 mclist = 0;
316 if (TCPrimaryIndex[ihit][1] > 0) {
317
318 MCEnergy[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getEnergy();
319 pid[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getPDG();
320 px[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).X();
321 py[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).Y();
322 pz[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).Z();
323 if (pid[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother())) {
324 mother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother() ->getPDG();
325 mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()-> getIndex();
326 }
327 if (mclist != 1 && mother[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother())) {
328 gmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother() ->getPDG();
329 mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()-> getIndex();
330
331 }
332 if (mclist != 1 && gmother[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother())) {
333 ggmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother() ->getPDG();
334 mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()-> getIndex();
335 }
336 if (mclist != 1 && ggmother[ihit][1] != 0) {
337 if (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()->getMother()) {
338 gggmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
339 }
340 }
341 }
342 mclist = 0;
343 if (TCPrimaryIndex[ihit][2] > 0) {
344
345 MCEnergy[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getEnergy();
346 pid[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getPDG();
347 px[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).X();
348 py[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).Y();
349 pz[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).Z();
350 if (pid[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother())) {
351 mother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother() ->getPDG();
352 mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()-> getIndex();
353 }
354 if (mclist != 1 && mother[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother())) {
355 gmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother() ->getPDG();
356 mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()-> getIndex();
357
358 }
359 if (mclist != 1 && gmother[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother())) {
360 ggmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother() ->getPDG();
361 mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()-> getIndex();
362 }
363 if (mclist != 1 && ggmother[ihit][2] != 0) {
364 if (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()->getMother()) {
365 gggmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
366 }
367 }
368
369 }
370 trgeclDigi0ToMCPart.add(ii, TCPrimaryIndex[ihit][0]);
371 ihit++;
372 }
373
374
375 StoreArray<TRGECLDigi0MC> TCDigiArray;
376 for (int ii = 0; ii < ihit; ++ii) {
377
378 if (TCRawEnergy[ii] < 0.1) {continue;}
379 TCDigiArray.appendNew();
380 int m_hitNum = TCDigiArray.getEntries() - 1;
381
382 TCDigiArray[m_hitNum]->setEventId(m_nEvent);
383 TCDigiArray[m_hitNum]->setTCId(TCId[ii]);
384
385 TCDigiArray[m_hitNum]->setRawEnergy(TCRawEnergy[ii]);
386 TCDigiArray[m_hitNum]->setRawTiming(TCRawTiming[ii]);
387 TCDigiArray[m_hitNum]->setTrackId(trackId[ii]);
388 TCDigiArray[m_hitNum]->setCellId(XtalId[ii]);
389
390 TCDigiArray[m_hitNum]->setPDG(pid[ii]);
391 TCDigiArray[m_hitNum]->setMother(mother[ii]);
392 TCDigiArray[m_hitNum]->setGMother(gmother[ii]);
393 TCDigiArray[m_hitNum]->setGGMother(ggmother[ii]);
394 TCDigiArray[m_hitNum]->setGGGMother(gggmother[ii]);
395
396 TCDigiArray[m_hitNum]->setPX(px[ii]);
397 TCDigiArray[m_hitNum]->setPY(py[ii]);
398 TCDigiArray[m_hitNum]->setPZ(pz[ii]);
399 TCDigiArray[m_hitNum]->setMCEnergy(MCEnergy[ii]);
400 TCDigiArray[m_hitNum]->setContribution(contribution[ii]);
401 TCDigiArray[m_hitNum]->setBackgroundTag(background_tag[ii]);
402 TCDigiArray[m_hitNum]->setSignalContribution(SignalContribution[ii]);
403 TCDigiArray[m_hitNum]->setBKGContribution(BKGContribution[ii]);
404 }
405
406 //Find relation of TRGECLHit and MCParticle using TRGECLDigi0
407
408 StoreArray<TRGECLHit> trgeclHitArray;
409 RelationArray trgeclHitToMCPart(trgeclHitArray, mcParticles);
410 const int NofTCHit = trgeclHitArray.getEntries();
411
412
413 for (int ii = 0; ii < NofTCHit; ++ii) {
414
415 TRGECLHit* aTRGECLHit = trgeclHitArray[ii];
416 TCIdHit[ii] = (aTRGECLHit->getTCId() - 1);
417 TCHitTiming[ii] = aTRGECLHit ->getTimeAve();
418 TCHitEnergy[ii] = aTRGECLHit -> getEnergyDep();
419 int itimeindex = (int)(TCHitTiming[ii] / 100 + 40);
420
421 for (int index = 0; index < trgeclDigi0ToMCPart.getEntries(); ++index) {
422 int idigi = index;
423 int idigitimeindex = (int)(TCRawTiming[idigi] / 100 + 40);
424 if (TCId[idigi] != TCIdHit[ii]) {continue;}
425 if (itimeindex != idigitimeindex) {continue;}
426
427 TCPrimaryIndexHit[ii][0] = TCPrimaryIndex[idigi][0];
428 contributionHit[ii][0] = contribution[idigi][0];
429 XtalIdHit[ii][0] = XtalId[idigi][0] ;
430
431 TCPrimaryIndexHit[ii][1] = TCPrimaryIndex[idigi][1];
432 contributionHit[ii][1] = contribution[idigi][1];
433 XtalIdHit[ii][1] = XtalId[idigi][1] ;
434
435 TCPrimaryIndexHit[ii][2] = TCPrimaryIndex[idigi][2];
436 contributionHit[ii][2] = contribution[idigi][2];
437 XtalIdHit[ii][2] = XtalId[idigi][2] ;
438
439 background_tagHit[ii][0] = background_tag[idigi][0] ;
440 background_tagHit[ii][1] = background_tag[idigi][1] ;
441 background_tagHit[ii][2] = background_tag[idigi][2] ;
442
444 ;
446
447
448 trackIdHit[ii][0] = trackId[idigi][0];
449 trackIdHit[ii][1] = trackId[idigi][0];
450 trackIdHit[ii][2] = trackId[idigi][0];
451
452 MCEnergyHit[ii][0] = MCEnergy[idigi][0];
453 pidHit[ii][0] = pid[idigi][0] ;
454 pxHit[ii][0] = px[idigi][0];
455 pyHit[ii][0] = py[idigi][0];
456 pzHit[ii][0] = pz[idigi][0];
457 gmotherHit[ii][0] = gmother[idigi][0];
458 ggmotherHit[ii][0] = ggmother[idigi][0];
459 gggmotherHit[ii][0] = gggmother[idigi][0];
460
461 MCEnergyHit[ii][1] = MCEnergy[idigi][1];
462 pidHit[ii][1] = pid[idigi][1] ;
463 pxHit[ii][1] = px[idigi][1];
464 pyHit[ii][1] = py[idigi][1];
465 pzHit[ii][1] = pz[idigi][1];
466 gmotherHit[ii][1] = gmother[idigi][1];
467 ggmotherHit[ii][1] = ggmother[idigi][1];
468 gggmotherHit[ii][1] = gggmother[idigi][1];
469
470 MCEnergyHit[ii][2] = MCEnergy[idigi][2];
471 pidHit[ii][2] = pid[idigi][2] ;
472 pxHit[ii][2] = px[idigi][2];
473 pyHit[ii][2] = py[idigi][2];
474 pzHit[ii][2] = pz[idigi][2];
475 gmotherHit[ii][2] = gmother[idigi][2];
476 ggmotherHit[ii][2] = ggmother[idigi][2];
477 gggmotherHit[ii][2] = gggmother[idigi][2];
478 }
479
480
481
482 trgeclHitToMCPart.add(ii, TCPrimaryIndexHit[ii][0]);
483 }
484
485 StoreArray<TRGECLHitMC> TCHitArray;
486 for (int ii = 0; ii < trgeclHitArray.getEntries(); ++ii) {
487 TCHitArray.appendNew();
488 int m_hitNum = TCHitArray.getEntries() - 1;
489
490 TCHitArray[m_hitNum]->setEventId(m_nEvent);
491 TCHitArray[m_hitNum]-> setTCId(TCIdHit[ii]);
492 TCHitArray[m_hitNum]->setCellId(XtalIdHit[ii]);
493 TCHitArray[m_hitNum]->setEnergyDep(TCHitEnergy[ii]);
494 TCHitArray[m_hitNum]-> setTimeAve(TCHitTiming[ii]);
495 TCHitArray[m_hitNum]-> setTrackId(trackIdHit[ii]);
496 TCHitArray[m_hitNum]-> setPDG(pidHit[ii]);
497 TCHitArray[m_hitNum]->setMother(motherHit[ii]);
498 TCHitArray[m_hitNum]->setGMother(gmotherHit[ii]);
499 TCHitArray[m_hitNum]->setGGMother(ggmotherHit[ii]);
500 TCHitArray[m_hitNum]->setGGGMother(gggmotherHit[ii]);
501 TCHitArray[m_hitNum]->setPX(pxHit[ii]);
502 TCHitArray[m_hitNum]->setPY(pyHit[ii]);
503 TCHitArray[m_hitNum]->setPZ(pzHit[ii]);
504 TCHitArray[m_hitNum]->setMCEnergy(MCEnergyHit[ii]);
505 TCHitArray[m_hitNum]->setBackgroundTag(background_tagHit[ii]);
506 TCHitArray[m_hitNum]->setSignalContribution(SignalContributionHit[ii]);
507 TCHitArray[m_hitNum]->setBKGContribution(BKGContributionHit[ii]);
508 TCHitArray[m_hitNum]->setContribution(contributionHit[ii]);
509
510 }
511
512 ++m_nEvent;
513
514}
515
516
518{
519 ++m_nRun;
520}
521
523{
524}
525
526
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
Definition: ECLHit.h:25
int getCellId() const
Get Cell ID.
Definition: ECLHit.h:65
double getEnergyDep() const
Get deposit energy.
Definition: ECLHit.h:70
double pz[100][3]
Momentum Z of particle.
double BKGContribution[100]
Background Contribution in a TC
int background_tag[100][3]
Beam background tag.
int gmotherHit[100][3]
Grand mother ID
double contributionHit[100][3]
particles contribution
virtual void initialize() override
Initialize variables, print info, and start CPU clock.
StoreArray< TRGECLDigi0MC > m_trgECLDigi0MC
output for TRGECLDigi0MC
double pxHit[100][3]
Momentum X of particle.
int ggmother[100][3]
Grand Grand Mother ID
double MCEnergy[100][3]
Raw Energy of particle
virtual void event() override
Actual digitization of all hits in the ECL.
double SignalContribution[100]
Signal Contribution in a TC.
double contribution[100][3]
particles contribution
double py[100][3]
Momentum Y of particle.
virtual void endRun() override
Nothing so far.
double BKGContributionHit[100]
Background Contribution in a TC
int gggmotherHit[100][3]
Grand Grand Grand Mother ID
virtual void terminate() override
Stopping of CPU clock.
int gmother[100][3]
Grand mother ID
double TCHitEnergy[100]
TC Hit energy
int TCPrimaryIndexHit[100][3]
Primary Index in TC hit
double pzHit[100][3]
Momentum X of particle.
double MCEnergyHit[100][3]
Raw Energy of particle
double SignalContributionHit[100]
Signal Contribution in a TC.
int ggmotherHit[100][3]
Grand Grand Mother ID
int TCPrimaryIndex[100][3]
Primary Index in TC hit
StoreArray< TRGECLHitMC > m_trgECLHitMC
output for TRGECLHitMC
virtual void beginRun() override
Nothing so far.
int gggmother[100][3]
Grand Grand Grand Mother ID
double maxEnergy[100][3]
Energy of maximum contribution particle
double TCRawEnergy[100]
TC raw energy.
virtual ~MCMatcherTRGECLModule()
Destructor.
int background_tagHit[100][3]
Beam background tag.
double pyHit[100][3]
Momentum X of particle.
double TCHitTiming[100]
TC Hit Timking
std::map< int, int > PrimaryTrackMap
define a map for Primary Track
int XtalIdHit[100][3]
XtalId in TC
double TCRawTiming[100]
TC raw timing.
double px[100][3]
Momentum X of particle.
TrgEclMapping * _TCMap
object of TC Mapping
@ c_PrimaryParticle
bit 0: Particle is primary particle.
Definition: MCParticle.h:47
@ c_StableInGenerator
bit 1: Particle is stable, i.e., not decaying in the generator.
Definition: MCParticle.h:49
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
int getEntries() const
Get the number of elements.
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
virtual unsigned short getBackgroundTag() const
Get background tag.
Definition: SimHitBase.h:46
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
void clear() override
Delete all entries in this array.
Definition: StoreArray.h:207
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition: StoreArray.h:140
Raw TC result nefor digitizing.
Definition: TRGECLDigi0.h:21
double getRawTiming() const
Get raw TC timing.
Definition: TRGECLDigi0.h:64
int getTCId() const
Get TC id.
Definition: TRGECLDigi0.h:57
double getRawEnergy() const
Get Energy and Timing Get raw TC energy.
Definition: TRGECLDigi0.h:62
Example Detector.
Definition: TRGECLHit.h:22
double getTimeAve() const
The method to get hit average time.
Definition: TRGECLHit.h:64
int getTCId() const
The method to get TC id.
Definition: TRGECLHit.h:58
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCIdFromXtalId(int)
get [TC ID] from [Xtal ID]
static const double us
[microsecond]
Definition: Unit.h:97
static const double GeV
Standard of [energy, momentum, mass].
Definition: Unit.h:51
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:649
Abstract base class for different kinds of events.
STL namespace.