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 boost;
35using namespace Belle2;
36//using namespace ECL;
37
38//-----------------------------------------------------------------
39// Register the Module
40//-----------------------------------------------------------------
41REG_MODULE(MCMatcherTRGECL);
42
43//-----------------------------------------------------------------
44// Implementation
45//-----------------------------------------------------------------
46
48{
49 // Set description
50
51 setDescription("MCMatcherTRGECLModule");
53 _TCMap = new TrgEclMapping();
54
55
56 for (int ii = 0; ii < 100; ii++) {
57 TCId[ii] = 0;
58 TCRawEnergy[ii] = 0;
59 TCRawTiming[ii] = 0;
60 SignalContribution[ii] = 0;
61 BKGContribution[ii] = 0;
62 TCIdHit[ii] = 0;
63 TCHitEnergy[ii] = 0;
64 TCHitTiming[ii] = 0;
66 BKGContributionHit[ii] = 0;
67
68 for (int icont = 0 ; icont < 3 ; icont ++) {
69
70
71 maxEnergy[ii][icont] = -1;
72 contribution[ii][icont] = 0;
73 TCPrimaryIndex[ii][icont] = -1;
74 XtalId[ii][icont] = -1 ;
75 px[ii][icont] = 0;
76 py[ii][icont] = 0;
77 pz[ii][icont] = 0;
78 pid[ii][icont] = 0;
79 trackId[ii][icont] = 0;
80 background_tag[ii][icont] = 0;
81 mother[ii][icont] = 0 ;
82 gmother[ii][icont] = 0;
83 ggmother[ii][icont] = 0;
84 gggmother[ii][icont] = 0;
85 MCEnergy[ii][icont] = 0;
86
87 ieclhit[ii][icont] = 0 ;
88
89 background_tagHit[ii][icont] = 0;
90 TCPrimaryIndexHit[ii][icont] = -1;
91 XtalIdHit[ii][icont] = -1 ;
92 pxHit[ii][icont] = 0;
93 pyHit[ii][icont] = 0;
94 pzHit[ii][icont] = 0;
95 pidHit[ii][icont] = 0;
96 trackIdHit[ii][icont] = 0;
97 background_tagHit[ii][icont] = 0;
98 motherHit[ii][icont] = 0 ;
99 gmotherHit[ii][icont] = 0;
100 ggmotherHit[ii][icont] = 0;
101 gggmotherHit[ii][icont] = 0;
102 MCEnergyHit[ii][icont] = 0;
103 contributionHit[ii][icont] = 0;
104
105 }
106 }
107}
108
110{
111 delete _TCMap;
112}
113
115{
116 // Initialize variables
117 m_nRun = 0 ;
118 m_nEvent = 0 ;
119 // CPU time start
120 m_timeCPU = clock() * Unit::us;
121
122 m_trgECLDigi0MC.registerInDataStore();
123 m_trgECLHitMC.registerInDataStore();
124 StoreArray<MCParticle> mcParticles;
125 StoreArray<ECLHit> eclHitArray;
126
127 mcParticles.registerRelationTo(eclHitArray);
128 StoreArray<TRGECLDigi0> trgeclDigi0Array;
129 trgeclDigi0Array.registerRelationTo(mcParticles);
130 StoreArray<TRGECLHit> trgeclHitArray;
131 trgeclHitArray.registerRelationTo(mcParticles);
132
133}
134
136{
137}
138
140{
141
142
143 StoreArray<MCParticle> mcParticles;
144 PrimaryTrackMap eclPrimaryMap;
145 eclPrimaryMap.clear();
146 int nParticles = mcParticles.getEntries();
147 // cout << nParticles << endl;
148 for (int iPart = 0; iPart < nParticles ; ++iPart) {
149 if (mcParticles[iPart]->getMother() == NULL) {
150 if (!mcParticles[iPart]->hasStatus(MCParticle::c_PrimaryParticle)) {
151 if (!mcParticles[iPart]->hasStatus(MCParticle::c_StableInGenerator)) {
152 continue;
153 }
154 }
155 }
156
157
158
159 bool adhoc_StableInGeneratorFlag(mcParticles[iPart]->hasStatus(MCParticle::c_StableInGenerator));
160
161 if (mcParticles[iPart]->hasStatus(MCParticle::c_PrimaryParticle)
162 && adhoc_StableInGeneratorFlag) {
163 if (mcParticles[iPart]->getArrayIndex() == -1) {
164 eclPrimaryMap.insert(pair<int, int>(iPart, iPart));
165 } else {
166 eclPrimaryMap.insert(pair<int, int>(mcParticles[iPart]->getArrayIndex(), mcParticles[iPart]->getArrayIndex()));
167 }
168 } else {
169 if (mcParticles[iPart]->getMother() == NULL) continue;
170 if (eclPrimaryMap.find(mcParticles[iPart]->getMother()->getArrayIndex()) != eclPrimaryMap.end()) {
171 eclPrimaryMap.insert(
172 pair<int, int>(mcParticles[iPart]->getArrayIndex(), eclPrimaryMap[mcParticles[iPart]->getMother()->getArrayIndex()]));
173
174 }//if mother of mcParticles is stored.
175 }//if c_StableInGenerator and c_PrimaryParticle
176
177 }//for mcParticles
178
179 //Connect TRGECLDigi0 and MCParticle using ECLHit
180 StoreArray<ECLHit> eclHitArray("ECLHits");
181 RelationArray eclHitRel(mcParticles, eclHitArray);
182 StoreArray<TRGECLDigi0> trgeclDigi0Array;
183 RelationArray trgeclDigi0ToMCPart(trgeclDigi0Array, mcParticles);
184 int nHits_hit = eclHitArray.getEntries() - 1;
185 //
186 int ihit = 0;
187
188 const int NofTCDigiHit = trgeclDigi0Array.getEntries();
189
190 // cout << NofTCDigiHit << endl;
191
192 for (int ii = 0; ii < NofTCDigiHit; ii++) {
193
194
195 TRGECLDigi0* aTRGECLDigi0 = trgeclDigi0Array[ii];
196 TCId[ihit] = (aTRGECLDigi0->getTCId() - 1);
197 TCRawTiming[ihit] = aTRGECLDigi0 ->getRawTiming();
198
199 int itimeindex = (int)(TCRawTiming[ihit] / 100 + 40);
200 TCRawEnergy[ihit] = aTRGECLDigi0 ->getRawEnergy() / Unit::GeV;
201 if (TCRawEnergy[ihit] < 0.1) {continue;} //0.05 GeV cut to save time.
202 for (int hit = 0; hit < nHits_hit; hit++) {//Find relation of TRGECLDigi0 and ECLHit
203
204 ECLHit* aECLHit = eclHitArray[hit];;
205
206 double hitE = aECLHit->getEnergyDep() / Unit::GeV;
207 if (hitE < 0.1) {continue;} //to save time.
208 int hitCellId = aECLHit->getCellId() - 1;
209 int hitTCId = _TCMap->getTCIdFromXtalId(hitCellId + 1) - 1;
210 int timeindex = (int)((aECLHit ->getTimeAve()) / 100 + 40);
211 int backtag = aECLHit ->getBackgroundTag();
212
213 if (hitTCId != TCId[ihit]) {continue;}
214 if (itimeindex != timeindex) {continue;}
215 if (backtag == 0) { SignalContribution[ihit] = SignalContribution[ihit] + hitE;}
216 else { BKGContribution[ihit] = BKGContribution[ihit] + hitE;}
217
218
219 if (TCId[ihit] == hitTCId && maxEnergy[ihit][0] < hitE) {
220
221 ieclhit[ihit][0] = hit;
222 maxEnergy[ihit][0] = hitE;
223 contribution[ihit][0] = hitE;
224 XtalId[ihit][0] = hitCellId ;
225 background_tag[ihit][0] = backtag;
226
227 }
228
229
230 if (TCId[ihit] == hitTCId && maxEnergy[ihit][1] < hitE && hitE < maxEnergy[ihit][0]) {
231 ieclhit[ihit][1] = hit;
232 maxEnergy[ihit][1] = hitE;
233 contribution[ihit][1] = hitE;
234 XtalId[ihit][1] = hitCellId ;
235 background_tag[ihit][1] = backtag;
236 }
237
238
239 if (TCId[ihit] == hitTCId && maxEnergy[ihit][2] < hitE && hitE < maxEnergy[ihit][1]) {
240 ieclhit[ihit][2] = hit;
241 maxEnergy[ihit][2] = hitE;
242 contribution[ihit][2] = hitE;
243 XtalId[ihit][2] = hitCellId ;
244 background_tag[ihit][2] = backtag;
245
246 }
247 }
248 //Find the relation of TRGECLDigi0 and MCParticle using ECLHit
249 for (int index = 0; index < eclHitRel.getEntries(); index++) {
250 int PrimaryIndex = -1;
251
252 map<int, int>::iterator iter = eclPrimaryMap.find(eclHitRel[index].getFromIndex());
253
254 if (iter != eclPrimaryMap.end()) {
255 PrimaryIndex = iter->second;
256 }
257 int eclhitRelSize = eclHitRel[index].getToIndices().size();
258 for (int pri_hit = 0; pri_hit < eclhitRelSize ; pri_hit++) {
259 int ieclHitRel = eclHitRel[index].getToIndex(pri_hit);
260 if (ieclhit[ihit][0] == ieclHitRel) {
261 TCPrimaryIndex[ihit][0] = PrimaryIndex;
262
263 }
264 if (ieclhit[ihit][1] == ieclHitRel) {
265 TCPrimaryIndex[ihit][1] = PrimaryIndex;
266
267 }
268 if (ieclhit[ihit][2] == ieclHitRel) {
269 TCPrimaryIndex[ihit][2] = PrimaryIndex;
270
271 }
272 }
273 }
274
275
276 trackId[ihit][0] = TCPrimaryIndex[ihit][0];
277 trackId[ihit][1] = TCPrimaryIndex[ihit][1];
278 trackId[ihit][2] = TCPrimaryIndex[ihit][2];
279
280
281 // cout <<ihit <<" " << trackId[ihit][0] << " " << trackId[ihit][1] << " " << trackId[ihit][2] << " " << endl;
282
283
284 int mclist = 0;
285
286 if (TCPrimaryIndex[ihit][0] > 0) {
287
288 MCEnergy[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getEnergy();
289 pid[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getPDG();
290 px[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).X();
291 py[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).Y();
292 pz[ihit][0] = (mcParticles[TCPrimaryIndex[ihit][0]]->getMomentum()).Z();
293 if (pid[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother())) {
294 mother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother() ->getPDG();
295 mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()-> getIndex();
296 }
297 if (mclist != 1 && mother[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother())) {
298 gmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother() ->getPDG();
299 mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()-> getIndex();
300
301 }
302 if (mclist != 1 && gmother[ihit][0] != 0 && (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother())) {
303 ggmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother() ->getPDG();
304 mclist = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()-> getIndex();
305
306
307 }
308 if (mclist != 1 && ggmother[ihit][0] != 0) {
309 if (mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()->getMother()) {
310 gggmother[ihit][0] = mcParticles[TCPrimaryIndex[ihit][0]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
311
312 }
313 }
314
315 }
316 mclist = 0;
317 if (TCPrimaryIndex[ihit][1] > 0) {
318
319 MCEnergy[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getEnergy();
320 pid[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getPDG();
321 px[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).X();
322 py[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).Y();
323 pz[ihit][1] = (mcParticles[TCPrimaryIndex[ihit][1]]->getMomentum()).Z();
324 if (pid[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother())) {
325 mother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother() ->getPDG();
326 mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()-> getIndex();
327 }
328 if (mclist != 1 && mother[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother())) {
329 gmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother() ->getPDG();
330 mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()-> getIndex();
331
332 }
333 if (mclist != 1 && gmother[ihit][1] != 0 && (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother())) {
334 ggmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother() ->getPDG();
335 mclist = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()-> getIndex();
336 }
337 if (mclist != 1 && ggmother[ihit][1] != 0) {
338 if (mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()->getMother()) {
339 gggmother[ihit][1] = mcParticles[TCPrimaryIndex[ihit][1]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
340 }
341 }
342 }
343 mclist = 0;
344 if (TCPrimaryIndex[ihit][2] > 0) {
345
346 MCEnergy[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getEnergy();
347 pid[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getPDG();
348 px[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).X();
349 py[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).Y();
350 pz[ihit][2] = (mcParticles[TCPrimaryIndex[ihit][2]]->getMomentum()).Z();
351 if (pid[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother())) {
352 mother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother() ->getPDG();
353 mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()-> getIndex();
354 }
355 if (mclist != 1 && mother[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother())) {
356 gmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother() ->getPDG();
357 mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()-> getIndex();
358
359 }
360 if (mclist != 1 && gmother[ihit][2] != 0 && (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother())) {
361 ggmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother() ->getPDG();
362 mclist = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()-> getIndex();
363 }
364 if (mclist != 1 && ggmother[ihit][2] != 0) {
365 if (mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()->getMother()) {
366 gggmother[ihit][2] = mcParticles[TCPrimaryIndex[ihit][2]]->getMother()->getMother()->getMother()->getMother() ->getPDG();
367 }
368 }
369
370 }
371 trgeclDigi0ToMCPart.add(ii, TCPrimaryIndex[ihit][0]);
372 ihit++;
373 }
374
375
376 StoreArray<TRGECLDigi0MC> TCDigiArray;
377 for (int ii = 0; ii < ihit; ++ii) {
378
379 if (TCRawEnergy[ii] < 0.1) {continue;}
380 TCDigiArray.appendNew();
381 int m_hitNum = TCDigiArray.getEntries() - 1;
382
383 TCDigiArray[m_hitNum]->setEventId(m_nEvent);
384 TCDigiArray[m_hitNum]->setTCId(TCId[ii]);
385
386 TCDigiArray[m_hitNum]->setRawEnergy(TCRawEnergy[ii]);
387 TCDigiArray[m_hitNum]->setRawTiming(TCRawTiming[ii]);
388 TCDigiArray[m_hitNum]->setTrackId(trackId[ii]);
389 TCDigiArray[m_hitNum]->setCellId(XtalId[ii]);
390
391 TCDigiArray[m_hitNum]->setPDG(pid[ii]);
392 TCDigiArray[m_hitNum]->setMother(mother[ii]);
393 TCDigiArray[m_hitNum]->setGMother(gmother[ii]);
394 TCDigiArray[m_hitNum]->setGGMother(ggmother[ii]);
395 TCDigiArray[m_hitNum]->setGGGMother(gggmother[ii]);
396
397 TCDigiArray[m_hitNum]->setPX(px[ii]);
398 TCDigiArray[m_hitNum]->setPY(py[ii]);
399 TCDigiArray[m_hitNum]->setPZ(pz[ii]);
400 TCDigiArray[m_hitNum]->setMCEnergy(MCEnergy[ii]);
401 TCDigiArray[m_hitNum]->setContribution(contribution[ii]);
402 TCDigiArray[m_hitNum]->setBackgroundTag(background_tag[ii]);
403 TCDigiArray[m_hitNum]->setSignalContribution(SignalContribution[ii]);
404 TCDigiArray[m_hitNum]->setBKGContribution(BKGContribution[ii]);
405 }
406
407 //Find relation of TRGECLHit and MCParticle using TRGECLDigi0
408
409 StoreArray<TRGECLHit> trgeclHitArray;
410 RelationArray trgeclHitToMCPart(trgeclHitArray, mcParticles);
411 const int NofTCHit = trgeclHitArray.getEntries();
412
413
414 for (int ii = 0; ii < NofTCHit; ++ii) {
415
416 TRGECLHit* aTRGECLHit = trgeclHitArray[ii];
417 TCIdHit[ii] = (aTRGECLHit->getTCId() - 1);
418 TCHitTiming[ii] = aTRGECLHit ->getTimeAve();
419 TCHitEnergy[ii] = aTRGECLHit -> getEnergyDep();
420 int itimeindex = (int)(TCHitTiming[ii] / 100 + 40);
421
422 for (int index = 0; index < trgeclDigi0ToMCPart.getEntries(); ++index) {
423 int idigi = index;
424 int idigitimeindex = (int)(TCRawTiming[idigi] / 100 + 40);
425 if (TCId[idigi] != TCIdHit[ii]) {continue;}
426 if (itimeindex != idigitimeindex) {continue;}
427
428 TCPrimaryIndexHit[ii][0] = TCPrimaryIndex[idigi][0];
429 contributionHit[ii][0] = contribution[idigi][0];
430 XtalIdHit[ii][0] = XtalId[idigi][0] ;
431
432 TCPrimaryIndexHit[ii][1] = TCPrimaryIndex[idigi][1];
433 contributionHit[ii][1] = contribution[idigi][1];
434 XtalIdHit[ii][1] = XtalId[idigi][1] ;
435
436 TCPrimaryIndexHit[ii][2] = TCPrimaryIndex[idigi][2];
437 contributionHit[ii][2] = contribution[idigi][2];
438 XtalIdHit[ii][2] = XtalId[idigi][2] ;
439
440 background_tagHit[ii][0] = background_tag[idigi][0] ;
441 background_tagHit[ii][1] = background_tag[idigi][1] ;
442 background_tagHit[ii][2] = background_tag[idigi][2] ;
443
445 ;
447
448
449 trackIdHit[ii][0] = trackId[idigi][0];
450 trackIdHit[ii][1] = trackId[idigi][0];
451 trackIdHit[ii][2] = trackId[idigi][0];
452
453 MCEnergyHit[ii][0] = MCEnergy[idigi][0];
454 pidHit[ii][0] = pid[idigi][0] ;
455 pxHit[ii][0] = px[idigi][0];
456 pyHit[ii][0] = py[idigi][0];
457 pzHit[ii][0] = pz[idigi][0];
458 gmotherHit[ii][0] = gmother[idigi][0];
459 ggmotherHit[ii][0] = ggmother[idigi][0];
460 gggmotherHit[ii][0] = gggmother[idigi][0];
461
462 MCEnergyHit[ii][1] = MCEnergy[idigi][1];
463 pidHit[ii][1] = pid[idigi][1] ;
464 pxHit[ii][1] = px[idigi][1];
465 pyHit[ii][1] = py[idigi][1];
466 pzHit[ii][1] = pz[idigi][1];
467 gmotherHit[ii][1] = gmother[idigi][1];
468 ggmotherHit[ii][1] = ggmother[idigi][1];
469 gggmotherHit[ii][1] = gggmother[idigi][1];
470
471 MCEnergyHit[ii][2] = MCEnergy[idigi][2];
472 pidHit[ii][2] = pid[idigi][2] ;
473 pxHit[ii][2] = px[idigi][2];
474 pyHit[ii][2] = py[idigi][2];
475 pzHit[ii][2] = pz[idigi][2];
476 gmotherHit[ii][2] = gmother[idigi][2];
477 ggmotherHit[ii][2] = ggmother[idigi][2];
478 gggmotherHit[ii][2] = gggmother[idigi][2];
479 }
480
481
482
483 trgeclHitToMCPart.add(ii, TCPrimaryIndexHit[ii][0]);
484 }
485
486 StoreArray<TRGECLHitMC> TCHitArray;
487 for (int ii = 0; ii < trgeclHitArray.getEntries(); ++ii) {
488 TCHitArray.appendNew();
489 int m_hitNum = TCHitArray.getEntries() - 1;
490
491 TCHitArray[m_hitNum]->setEventId(m_nEvent);
492 TCHitArray[m_hitNum]-> setTCId(TCIdHit[ii]);
493 TCHitArray[m_hitNum]->setCellId(XtalIdHit[ii]);
494 TCHitArray[m_hitNum]->setEnergyDep(TCHitEnergy[ii]);
495 TCHitArray[m_hitNum]-> setTimeAve(TCHitTiming[ii]);
496 TCHitArray[m_hitNum]-> setTrackId(trackIdHit[ii]);
497 TCHitArray[m_hitNum]-> setPDG(pidHit[ii]);
498 TCHitArray[m_hitNum]->setMother(motherHit[ii]);
499 TCHitArray[m_hitNum]->setGMother(gmotherHit[ii]);
500 TCHitArray[m_hitNum]->setGGMother(ggmotherHit[ii]);
501 TCHitArray[m_hitNum]->setGGGMother(gggmotherHit[ii]);
502 TCHitArray[m_hitNum]->setPX(pxHit[ii]);
503 TCHitArray[m_hitNum]->setPY(pyHit[ii]);
504 TCHitArray[m_hitNum]->setPZ(pzHit[ii]);
505 TCHitArray[m_hitNum]->setMCEnergy(MCEnergyHit[ii]);
506 TCHitArray[m_hitNum]->setBackgroundTag(background_tagHit[ii]);
507 TCHitArray[m_hitNum]->setSignalContribution(SignalContributionHit[ii]);
508 TCHitArray[m_hitNum]->setBKGContribution(BKGContributionHit[ii]);
509 TCHitArray[m_hitNum]->setContribution(contributionHit[ii]);
510
511 }
512
513 ++m_nEvent;
514
515}
516
517
519{
520 ++m_nRun;
521}
522
524{
525}
526
527
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]
Backgroun 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 Contibution 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]
Backgroun 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 Contibution 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 contribtion 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:650
Abstract base class for different kinds of events.
STL namespace.