127 cout << endl <<
"-I- " << fName <<
": executing event with " <<
fDigis->GetEntriesFast() <<
" digis." << endl;
128 cout <<
"----------------------------------------------" << endl;
133 cerr <<
"-E- " << fName <<
"::Exec: No digi scheme!" << endl;
155 for (
Int_t iStation = 0; iStation < nStations; iStation++) {
157 Int_t nDigisFInStation = 0;
158 Int_t nDigisBInStation = 0;
161 for (
Int_t iSector = 0; iSector < nSectors; iSector++) {
165 set<Int_t> fSet, bSet;
167 cout <<
"-E- " << fName <<
"::Exec: sector " << sector->
GetSectorNr() <<
" of station "
168 << station->
GetStationNr() <<
"not found in front map!" << endl;
176 cout <<
"-E- " << fName <<
"::Exec: sector " << sector->
GetSectorNr() <<
" of station "
177 << station->
GetStationNr() <<
"not found in back map!" << endl;
184 Int_t nDigisFInSector = fSet.size();
185 Int_t nDigisBInSector = bSet.size();
186 nDigisFInStation += nDigisFInSector;
187 nDigisBInStation += nDigisBInSector;
190 nDigisF += nDigisFInStation;
191 nDigisB += nDigisBInStation;
201 cout <<
"-I- " << fName <<
":Event summary" << endl;
202 cout <<
" Active channels front side: " << nDigisF << endl;
203 cout <<
" Active channels back side : " << nDigisB << endl;
204 cout <<
" Real time : " <<
fTimer.RealTime() << endl;
210 cout << setw(15) << left << fName <<
": " << setprecision(4) << setw(8) << fixed << right <<
fTimer.RealTime()
218 for (
Int_t i = 0;
i < nClust; ++
i) {
222 for (
Int_t j = 0; j < nDigis; ++j) {
224 clus->AddLink(FairLink(
kStsDigi, idigi));
417 set<Int_t>::iterator it1;
426 Int_t lastDigiNr = -1;
427 Int_t lastDigiPos = -1;
429 Int_t clusterMaxNr = -1;
434 Int_t clusterBeginPos = 0;
435 Int_t clusterWidth = 0;
440 for (it1 = digiSet.begin(); it1 != digiSet.end(); it1++) {
447 if (lastDigiPos == -1) {
450 clusterBeginPos = digiPos;
453 if (digiPos == lastDigiPos + 1) {
455 if (digiSig == lastDigiSig) {
457 clusterHasPlateau =
kTRUE;
461 if (digiSig > lastDigiSig && lastDigiSig < clusterMaxSig && digiSig != clusterMaxSig) {
462 clusterCand->
SetMean(clusterMaxNr);
466 clusterCand->
AddDigi(lastDigiNr);
470 clusterWidth = lastDigiPos - clusterBeginPos + 1;
473 if (clusterHasPlateau) {
476 if (!clusterHasMinimum && !clusterHasPlateau) {
482 clusterHasPlateau =
kFALSE;
485 clusterBeginPos = digiPos;
487 }
else if (lastDigiPos >= 0) {
488 clusterCand->
SetMean(clusterMaxNr);
493 clusterWidth = lastDigiPos - clusterBeginPos + 1;
496 if (clusterHasPlateau) {
499 if (!clusterHasMinimum && !clusterHasPlateau) {
505 clusterHasPlateau =
kFALSE;
508 clusterBeginPos = digiPos;
510 if (digiSig > clusterMaxSig) {
511 clusterMaxNr = iDigi;
513 clusterMaxSig = digiSig;
516 clusterWidth = lastDigiPos - clusterBeginPos + 1;
517 if (clusterWidth < 90) {
524 clusterCand->
SetMean(clusterMaxNr);
529 clusterWidth = lastDigiPos - clusterBeginPos + 1;
532 if (clusterHasPlateau) {
535 if (!clusterHasMinimum && !clusterHasPlateau) {
541 clusterHasPlateau =
kFALSE;
544 clusterBeginPos = digiPos;
548 lastDigiPos = digiPos;
549 lastDigiSig = digiSig;
552 clusterCand->
SetMean(clusterMaxNr);
555 clusterWidth = lastDigiPos - clusterBeginPos + 1;
558 if (clusterHasPlateau) {
561 if (lastDigiPos && !clusterHasPlateau) {
571 map<Int_t, Int_t> channelSorted;
572 for (it1 = digiSet.begin(); it1 != digiSet.end(); it1++) {
581 for (
Int_t iter = 0; iter < 1100; iter++) {
582 iDigi = channelSorted[iter];
587 if (iFS >= channelSorted.size())
633 maxDigiSig = digi->
GetAdc();
648 for (
Int_t itemp = 0; itemp < clusterCand->
GetNDigis(); itemp++) {
653 sumWX += chanNr * chanADC;
655 error += (chanADC * chanADC);
656 sumWX2 += chanADC * chanNr * chanNr;
664 for (
Int_t itemp = 0; itemp < clusterCand->
GetNDigis(); itemp++) {
673 }
else if (itemp > 0) {
680 cluster->
SetMean(sumWX / sumW);
683 if (sumW < maxDigiSig) {
684 cout <<
" MAX DIGI = " << maxDigiSig <<
", while SUMW = " << sumW << endl;
685 for (
Int_t itemp = 0; itemp < clusterCand->
GetNDigis(); itemp++) {
687 cout <<
"digi ADC = " << digi->
GetAdc() <<
" at channel# " << digi->
GetChannelNr() << endl;
704 xPrev -= chan2 * adcPrev * 0.5;
705 xPrev /= (qPrev - adcPrev * 0.5);
707 clusPrev->
SetQtot(qPrev - adcPrev * 0.5);
709 xCor -= chan2 * adcPrev * 0.5;
710 xCor /= (sumW - adcPrev * 0.5);
712 cluster->
SetQtot(sumW - adcPrev * 0.5);
730 Double_t rms = (sumWX2 - sumWX * sumWX / sumW) / sumW;
749 const Int_t nDigMax = 13;
750 static Int_t first = 1, nSubs[nDigMax] = {0};
754 nSubs[6] = nSubs[7] = nSubs[8] = nSubs[9] = 2;
755 nSubs[10] = nSubs[11] = nSubs[12] = 3;
768 Int_t i0 = 0, itemp = 0;
769 Double_t chanNr = 0.0, chanADC = 0.0, sumW = 0.0, sumWX = 0.0, sumWX2 = 0.0;
772 for (
Int_t icl = 0; icl < nsub; ++icl) {
774 if (icl == 0 && mult - leng0 * nsub == 1)
776 else if (icl == nsub - 1 && mult - leng0 * nsub == 2)
792 sumWX += chanNr * chanADC;
793 sumWX2 += chanADC * chanNr * chanNr;
796 cluster->
SetMean(sumWX / sumW);
798 cluster->SetDefaultType(mult);
816 xPrev -= chan2 * adcPrev * 0.5;
817 xPrev /= (qPrev - adcPrev * 0.5);
819 clusPrev->
SetQtot(qPrev - adcPrev * 0.5);
820 adcPrev = digThis->
GetAdc();
822 xCor -= chan1 * adcPrev * 0.5;
823 xCor /= (sumW - adcPrev * 0.5);
825 cluster->
SetQtot(sumW - adcPrev * 0.5);
844 Double_t rms = (sumWX2 - sumWX * sumWX / sumW) / sumW;
853 if (itemp + leng * (nsub - icl - 1) > mult)
855 sumW = sumWX = sumWX2 = 0.0;
962 cout <<
"============================================================" << endl;
963 cout <<
"===== " << fName <<
": Run summary " << endl;
964 cout <<
"===== " << endl;
965 cout <<
"===== Number of clusters : " << setw(8) << setprecision(2) <<
fNofClustersCand << endl;
966 cout <<
"===== Number of good clusters : " << setw(8) << setprecision(2) <<
fNofClustersGood <<
" ("
968 cout <<
"===== Number of plateau clusters : " << setw(8) << setprecision(2) <<
fNofClustersWP <<
" ("
970 cout <<
"===== Number of minimum clusters : " << setw(8) << setprecision(2) <<
fNofClustersWM <<
" ("
972 cout <<
"===== Longest cluster : " << setw(8) << setprecision(2) <<
fLongestCluster << endl;
973 cout <<
"===== Longest good cluster : " << setw(8) << setprecision(2) <<
fLongestGoodCluster << endl;
974 cout <<
"============================================================" << endl;