144 eclPrimaryMap.clear();
147 for (
int iPart = 0; iPart < nParticles ; ++iPart) {
148 if (mcParticles[iPart]->getMother() == NULL) {
161 && adhoc_StableInGeneratorFlag) {
162 if (mcParticles[iPart]->getArrayIndex() == -1) {
163 eclPrimaryMap.insert(pair<int, int>(iPart, iPart));
165 eclPrimaryMap.insert(pair<int, int>(mcParticles[iPart]->getArrayIndex(), mcParticles[iPart]->getArrayIndex()));
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()]));
182 RelationArray trgeclDigi0ToMCPart(trgeclDigi0Array, mcParticles);
187 const int NofTCDigiHit = trgeclDigi0Array.
getEntries();
191 for (
int ii = 0; ii < NofTCDigiHit; ii++) {
198 int itimeindex = (int)(
TCRawTiming[ihit] / 100 + 40);
201 for (
int hit = 0; hit < nHits_hit; hit++) {
203 ECLHit* aECLHit = eclHitArray[hit];;
206 if (hitE < 0.1) {
continue;}
207 int hitCellId = aECLHit->
getCellId() - 1;
208 int hitTCId =
_TCMap->getTCIdFromXtalId(hitCellId + 1) - 1;
209 int timeindex = (int)((aECLHit ->getTimeAve()) / 100 + 40);
212 if (hitTCId !=
TCId[ihit]) {
continue;}
213 if (itimeindex != timeindex) {
continue;}
223 XtalId[ihit][0] = hitCellId ;
233 XtalId[ihit][1] = hitCellId ;
242 XtalId[ihit][2] = hitCellId ;
248 for (
int index = 0; index < eclHitRel.
getEntries(); index++) {
249 int PrimaryIndex = -1;
253 if (iter != eclPrimaryMap.end()) {
254 PrimaryIndex = iter->second;
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) {
263 if (
ieclhit[ihit][1] == ieclHitRel) {
267 if (
ieclhit[ihit][2] == ieclHitRel) {
294 mclist = mcParticles[
TCPrimaryIndex[ihit][0]]->getMother()-> getIndex();
296 if (mclist != 1 &&
mother[ihit][0] != 0 && (mcParticles[
TCPrimaryIndex[ihit][0]]->getMother()->getMother())) {
298 mclist = mcParticles[
TCPrimaryIndex[ihit][0]]->getMother()->getMother()-> getIndex();
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();
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();
325 mclist = mcParticles[
TCPrimaryIndex[ihit][1]]->getMother()-> getIndex();
327 if (mclist != 1 &&
mother[ihit][1] != 0 && (mcParticles[
TCPrimaryIndex[ihit][1]]->getMother()->getMother())) {
329 mclist = mcParticles[
TCPrimaryIndex[ihit][1]]->getMother()->getMother()-> getIndex();
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();
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();
352 mclist = mcParticles[
TCPrimaryIndex[ihit][2]]->getMother()-> getIndex();
354 if (mclist != 1 &&
mother[ihit][2] != 0 && (mcParticles[
TCPrimaryIndex[ihit][2]]->getMother()->getMother())) {
356 mclist = mcParticles[
TCPrimaryIndex[ihit][2]]->getMother()->getMother()-> getIndex();
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();
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();
376 for (
int ii = 0; ii < ihit; ++ii) {
382 TCDigiArray[m_hitNum]->setEventId(
m_nEvent);
383 TCDigiArray[m_hitNum]->setTCId(
TCId[ii]);
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]);
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]);
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]);
409 RelationArray trgeclHitToMCPart(trgeclHitArray, mcParticles);
410 const int NofTCHit = trgeclHitArray.
getEntries();
413 for (
int ii = 0; ii < NofTCHit; ++ii) {
415 TRGECLHit* aTRGECLHit = trgeclHitArray[ii];
419 int itimeindex = (int)(
TCHitTiming[ii] / 100 + 40);
421 for (
int index = 0; index < trgeclDigi0ToMCPart.
getEntries(); ++index) {
423 int idigitimeindex = (int)(
TCRawTiming[idigi] / 100 + 40);
425 if (itimeindex != idigitimeindex) {
continue;}
486 for (
int ii = 0; ii < trgeclHitArray.
getEntries(); ++ii) {
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]);
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]);