87 cout <<
"ReadEvent: start." << endl;
95 algo->vStsHits.clear();
96 algo->vStsStrips.clear();
97 algo->vStsStripsB.clear();
98 algo->vStsZPos.clear();
100 algo->vSFlagB.clear();
102 algo->vAllHitPoints.clear();
105 cout <<
"ReadEvent: clear is done." << endl;
107 vector<TmpHit> tmpHits;
108 vector<TmpStrip> tmpStrips;
109 vector<TmpStrip> tmpStripsB;
114 algo->StsHitsStartIndex[
i] =
static_cast<THitI>(-1);
115 algo->StsHitsStopIndex[
i] = 0;
119 vector<bool> isUsedMvdPoint;
120 vector<bool> isUsedStsPoint;
129 isUsedMvdPoint.resize(nMC);
130 for (
int iMc = 0; iMc < nMC; iMc++)
131 isUsedMvdPoint[iMc] = 0;
134 for (
int j = 0; j < nEnt; j++) {
153 mh->PositionError(err);
175 iMC =
match->GetPointId();
182 isUsedMvdPoint[iMC] = 1;
193 tmpHits.push_back(th);
199 cout <<
"ReadEvent: mvd hits are gotten." << endl;
208 isUsedStsPoint.resize(nMC);
209 for (
int iMc = 0; iMc < nMC; iMc++)
210 isUsedStsPoint[iMc] = 0;
214 for (
int j = 0; j < nEnt; j++) {
216 if (sh->GetUniqueID())
241 mh->PositionError(err);
265 int iMC = sh->GetRefIndex();
271 isUsedStsPoint[iMC] = 1;
278 tmpHits.push_back(th);
284 cout <<
"ReadEvent: sts hits are gotten." << endl;
289 for (
int iMC = 0; iMC < nMC; iMC++) {
290 if (!(isUsedMvdPoint[iMC])) {
294 isUsedMvdPoint[iMC] = 1;
302 for (
int iMC = 0; iMC < nMC; iMC++) {
303 if (!(isUsedStsPoint[iMC])) {
310 isUsedStsPoint[iMC] = 1;
317 int nHits = nMvdHits + nStsHits;
321 int NStrips = 0, NStripsB = 0;
322 for (
int ih = 0; ih < nHits; ih++) {
328 for (
int is = 0; is < NStrips; is++) {
343 for (
int is = 0; is < NStripsB; is++) {
368 tmpStrips.push_back(tmp);
380 tmpStripsB.push_back(tmp);
415 Int_t NEffStrips = 0, NEffStripsB = 0;
416 for (
int i = 0;
i < NStrips;
i++) {
423 algo->vSFlag.push_back(flag);
426 for (
int i = 0;
i < NStripsB;
i++) {
433 algo->vSFlagB.push_back(flag);
438 cout <<
"ReadEvent: strips are read." << endl;
444 vector<float> vStsZPos_temp;
445 for (
int i = 0;
i < nHits;
i++) {
479 z_tmp = mh_m->GetZ();
484 for (k = 0; k < vStsZPos_temp.size(); k++) {
485 if (vStsZPos_temp[k] == z_tmp) {
490 if (k == vStsZPos_temp.size()) {
491 h.
iz = vStsZPos_temp.size();
492 vStsZPos_temp.push_back(z_tmp);
497 algo->vStsHits.push_back(h);
503 algo->vAllHitPoints.push_back(hp);
507 if (
algo->StsHitsStartIndex[sta] ==
static_cast<THitI>(-1))
508 algo->StsHitsStartIndex[sta] = nEffHits;
510 algo->StsHitsStopIndex[sta] = nEffHits;
516 if (
algo->StsHitsStartIndex[
i] ==
static_cast<THitI>(-1))
517 algo->StsHitsStartIndex[
i] =
algo->StsHitsStopIndex[
i];
528 cout <<
"ReadEvent: mvd and sts are saved." << endl;
531 if (vStsZPos_temp.size() != 0) {
532 vector<float> vStsZPos_temp2;
533 vStsZPos_temp2.clear();
534 vStsZPos_temp2.push_back(vStsZPos_temp[0]);
535 vector<int> newToOldIndex;
536 newToOldIndex.clear();
537 newToOldIndex.push_back(0);
539 for (
unsigned int k = 1; k < vStsZPos_temp.size(); k++) {
540 vector<float>::iterator itpos = vStsZPos_temp2.begin() + 1;
541 vector<int>::iterator iti = newToOldIndex.begin() + 1;
542 for (; itpos < vStsZPos_temp2.end(); itpos++, iti++) {
543 if (vStsZPos_temp[k] < *itpos) {
544 vStsZPos_temp2.insert(itpos, vStsZPos_temp[k]);
545 newToOldIndex.insert(iti, k);
549 if (itpos == vStsZPos_temp2.end()) {
550 vStsZPos_temp2.push_back(vStsZPos_temp[k]);
551 newToOldIndex.push_back(k);
556 cout <<
"ReadEvent: z-pos are sorted." << endl;
559 for (
unsigned int k = 0; k < vStsZPos_temp2.size(); k++)
560 algo->vStsZPos.push_back(vStsZPos_temp2[k]);
562 int size_nto_tmp = newToOldIndex.size();
563 vector<int> oldToNewIndex;
564 oldToNewIndex.clear();
565 oldToNewIndex.resize(size_nto_tmp);
566 for (
int k = 0; k < size_nto_tmp; k++)
567 oldToNewIndex[newToOldIndex[k]] = k;
570 for (
int k = 0; k < size_hs_tmp; k++)
571 algo->vStsHits[k].iz = oldToNewIndex[
algo->vStsHits[k].iz];
586 cout <<
"ReadEvent: z-pos are saved." << endl;
591 cout <<
"HitMatch is done." << endl;
594 vector<TmpMCPoint> vtmpMCPoints;
595 for (
unsigned int iMCPoint = 0; iMCPoint <
vMCPoints.size(); iMCPoint++) {
603 vtmpMCPoints.push_back(tmp);
621 cout <<
"MCPoints are sorted." << endl;
627 int nvtracks = 0, nvtrackscurr = 0;
629 for (vector<TmpMCPoint>::iterator
i = vtmpMCPoints.begin();
i != vtmpMCPoints.end(); ++
i) {
647 if (T.mother_ID == -1) {
650 if (nvtrackscurr > nvtracks) {
652 nvtracks = nvtrackscurr;
657 Vtxcurr.
MC_ID = T.mother_ID;
663 vMCTracks.back().Points.push_back(
i->MCPoint);
666 if (nvtrackscurr > nvtracks)
670 cout <<
"MCPoints and MCTracks are saved." << endl;
673 for (vector<CbmL1MCTrack>::iterator it =
vMCTracks.begin(); it !=
vMCTracks.end(); ++it) {
677 if (fVerbose &&
PrimVtx.MC_ID == 999)
678 cout <<
"No primary vertex !!!" << endl;
681 cout <<
"ReadEvent is done." << endl;
749 const bool useLinks = 0;
754 for (
int iH = 0; iH < NHits; iH++) {
757 const bool isMvd = (hit.
extIndex < 0);
758 if (useLinks && !isMvd) {
761 const int NLinks = stsHit->GetNLinks();
763 cout <<
"HitMatch: Error. Hit wasn't matched with 2 clusters." << endl;
765 vector<int> stsPointIds;
767 FairLink link = stsHit->GetLink(iL);
769 int NLinks2 = stsCluster->GetNLinks();
770 for (
int iL2 = 0; iL2 < NLinks2; iL2++) {
771 FairLink link2 = stsCluster->GetLink(iL2);
773 const int NLinks3 = stsDigi->GetNLinks();
774 for (
int iL3 = 0; iL3 < NLinks3; iL3++) {
775 FairLink link3 = stsDigi->GetLink(iL3);
776 int stsPointId = link3.GetIndex();
777 stsPointIds.push_back(stsPointId);
782 link = stsHit->GetLink(iL);
784 NLinks2 = stsCluster->GetNLinks();
785 for (
int iL2 = 0; iL2 < NLinks2; iL2++) {
786 FairLink link2 = stsCluster->GetLink(iL2);
788 const int NLinks3 = stsDigi->GetNLinks();
789 for (
int iL3 = 0; iL3 < NLinks3; iL3++) {
790 FairLink link3 = stsDigi->GetLink(iL3);
791 int stsPointId = link3.GetIndex();
793 if (!find(&(stsPointIds[0]), &(stsPointIds[stsPointIds.size()]), stsPointId))
799 int mcTrackId = stsPoint->GetTrackID();
803 TVector3 xyz = .5 * (xyzIn + xyzOut);
808 for (iP = 0; iP < NPoints; iP++) {
867 cout <<
"Hit number " << iH <<
" has been matched with " << hit.
mcPointIds.size() <<
" mcPoints." << endl;