634 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
637 fvCPTOff[iSmType].resize(iNbSm * iNbRpc);
640 fvCPWalk[iSmType].resize(iNbSm * iNbRpc);
642 for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
643 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
650 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
651 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] = 0.;
655 fvCPTOff[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
656 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
657 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
658 fvCPWalk[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
660 for (Int_t iCh = 0; iCh < iNbChan; iCh++) {
661 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
662 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
663 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
664 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
665 for (Int_t iSide = 0; iSide < nbSide; iSide++) {
666 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 0.;
667 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 1.;
668 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = 0.;
671 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide][iWx] = 0.;
678 LOG(info) <<
"CbmTofHitMaker::InitCalibParameter: defaults set";
682 TFile* oldFile = gFile;
683 TDirectory* oldDir = gDirectory;
686 LOG(info) <<
"CbmTofHitMaker::InitCalibParameter: read histos from "
694 LOG(fatal) <<
"CbmTofHitMaker::InitCalibParameter: "
703 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
706 TProfile*
hSvel = (TProfile*) gDirectory->FindObjectAny(Form(
"cl_SmT%01d_Svel", iSmType));
709 TDirectory* curdir = gDirectory;
711 gDirectory->cd(oldDir->GetPath());
713 gDirectory->cd(curdir->GetPath());
716 LOG(info) <<
"Svel histogram not found for module type " << iSmType;
719 for (Int_t iPar = 0; iPar < 4; iPar++) {
720 TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny(Form(
"cl_SmT%01d_Fpar%1d", iSmType, iPar));
721 if (NULL != hFparcur) {
722 gDirectory->cd(oldDir->GetPath());
724 gDirectory->cd(curdir->GetPath());
728 for (Int_t iSm = 0; iSm < iNbSm; iSm++)
729 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
734 if (Vscal == 0.) Vscal = 1.;
736 LOG(info) <<
"Modify " << iSmType << iSm << iRpc <<
" Svel by " << Vscal <<
" to "
740 (TH2F*) gDirectory->FindObjectAny(Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc));
741 TH2F* htempTOff_pfx =
742 (TH2F*) gDirectory->FindObjectAny(Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc));
743 TH1D* htempTot_Mean =
744 (TH1D*) gDirectory->FindObjectAny(Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc));
746 (TH1D*) gDirectory->FindObjectAny(Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc));
747 if (NULL != htempPos_pfx && NULL != htempTOff_pfx && NULL != htempTot_Mean && NULL != htempTot_Off) {
749 Int_t iNbinTot = htempTot_Mean->GetNbinsX();
750 for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
752 for (Int_t iSide = 0; iSide < 2; iSide++) {
753 Double_t TotMean = htempTot_Mean->GetBinContent(iCh * 2 + 1 + iSide);
754 if (0.001 < TotMean) {
757 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = htempTot_Off->GetBinContent(iCh * 2 + 1 + iSide);
760 Double_t YMean = ((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1);
761 Double_t TMean = ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1);
764 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean;
765 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean;
767 if (5 == iSmType || 8 == iSmType) {
768 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] =
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0];
770 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] =
fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][0];
773 LOG(debug) <<
"CbmTofHitMaker::InitCalibParameter:"
774 <<
" SmT " << iSmType <<
" Sm " << iSm <<
" Rpc " << iRpc <<
" Ch " << iCh
775 << Form(
": YMean %f, TMean %f", YMean, TMean) <<
" -> "
776 << Form(
" %f, %f, %f, %f ",
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
777 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1],
780 <<
", NbinTot " << iNbinTot;
782 TH1D* htempWalk0 = (TH1D*) gDirectory->FindObjectAny(
783 Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px", iSmType, iSm, iRpc, iCh));
784 TH1D* htempWalk1 = (TH1D*) gDirectory->FindObjectAny(
785 Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px", iSmType, iSm, iRpc, iCh));
786 if (NULL != htempWalk0 && NULL != htempWalk1) {
787 LOG(debug) <<
"Initialize Walk correction for "
788 << Form(
" SmT%01d_sm%03d_rpc%03d_Ch%03d", iSmType, iSm, iRpc, iCh);
790 LOG(error) <<
"CbmTofHitMaker::InitCalibParameter: "
791 "Inconsistent Walk histograms";
793 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin] = htempWalk0->GetBinContent(iBin + 1);
794 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] = htempWalk1->GetBinContent(iBin + 1);
795 if (iCh == 5 && iBin == 10)
796 LOG(info) << Form(
"Read New SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ", iSmType, iSm, iRpc, iCh,
797 iBin,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]);
798 if (5 == iSmType || 8 == iSmType) {
799 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] =
800 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin];
805 LOG(info) <<
"No Walk histograms for TSRC " << iSmType << iSm << iRpc << iCh;
810 LOG(warning) <<
" Calibration histos " << Form(
"cl_SmT%01d_sm%03d_rpc%03d_XXX", iSmType, iSm, iRpc)
813 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
814 TH1D* htmpDelTof = (TH1D*) gDirectory->FindObjectAny(
815 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel));
816 if (NULL == htmpDelTof) {
817 LOG(debug) <<
" Histos " << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel)
821 LOG(debug) <<
" Load DelTof from histos "
822 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel) <<
".";
824 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] += htmpDelTof->GetBinContent(iBx + 1);
829 gDirectory->cd(oldDir->GetPath());
831 (TH1D*) htmpDelTof->Clone(Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof", iSmType, iSm, iRpc, iSel));
833 LOG(debug) <<
" copy histo " << h1DelTof->GetName() <<
" to directory " << oldDir->GetName();
835 gDirectory->cd(curdir->GetPath());
845 LOG(info) <<
"CbmTofHitMaker::InitCalibParameter: initialization done";
1487 Double_t dLastPosY, Double_t dLastTime, Double_t dLastTotS)
1496 Int_t iCh = iLastChan + 1;
1500 LOG(debug) <<
"Skip channel " << iCh <<
" of detector " << Form(
"0x%08x", iDetId);
1503 if (iCh >= iNbCh)
return kFALSE;
1505 LOG(debug1) << Form(
"Inspect channel TSRC %d%d%d%d at time %f, pos %f, size ", iSmType, iSm, iRpc, iCh, dLastTime,
1507 <<
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size();
1508 if (iCh == iNbCh)
return kFALSE;
1509 if (0 ==
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size())
return kFALSE;
1510 if (0 <
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size())
1512 if (1 <
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size()) {
1513 Bool_t AddedHit = kFALSE;
1514 for (
size_t i1 = 0; i1 <
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1; i1++) {
1515 if (AddedHit)
break;
1517 while (!AddedHit && i2 <
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size()) {
1518 LOG(debug1) <<
"check digi pair " << i1 <<
"," << i2 <<
" with size "
1519 <<
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size();
1521 if ((
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i1])->GetSide()
1522 == (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][i2])->GetSide()) {
1537 Double_t dPosY = 0.;
1545 Double_t dNClHits = (Double_t)(
vDigiIndRef.size() / 2);
1548 Double_t dNewTotS = (dLastTotS + dTotS);
1549 dLastPosX = (dLastPosX * dLastTotS + dPosX * dTotS) / dNewTotS;
1550 dLastPosY = (dLastPosY * dLastTotS + dPosY * dTotS) / dNewTotS;
1551 dLastTime = (dLastTime * dLastTotS + dTime * dTotS) / dNewTotS;
1552 dLastTotS = dNewTotS;
1554 Int_t Ind1 =
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i1];
1555 Int_t Ind2 =
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i2];
1559 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()
1562 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + i1);
1564 std::vector<int>::iterator it;
1565 it = find(
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(),
1566 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end(), Ind2);
1567 if (it !=
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end()) {
1568 auto ipos = it -
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin();
1569 LOG(debug1) <<
"Found i2 " << i2 <<
" with Ind2 " << Ind2 <<
" at position " << ipos;
1570 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin()
1573 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + ipos);
1576 LOG(fatal) <<
" Did not find i2 " << i2 <<
" with Ind2 " << Ind2;
1580 if (iCh != (iNbCh - 1)
1581 &&
AddNextChan(iSmType, iSm, iRpc, iCh, dLastPosX, dLastPosY, dLastTime, dLastTotS)) {
1582 LOG(debug1) <<
"Added Strip " << iCh <<
" to cluster of size " << dNClHits;
1592 Double_t hitpos_local[3] = {3 * 0.};
1593 hitpos_local[0] = dLastPosX;
1594 hitpos_local[1] = dLastPosY;
1595 hitpos_local[2] = 0.;
1602 Double_t hitpos[3] = {3 * 0.};
1604 gGeoManager->GetCurrentNode();
1605 gGeoManager->GetCurrentMatrix();
1606 gGeoManager->LocalToMaster(hitpos_local, hitpos);
1608 TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
1609 TVector3 hitPosErr(0.5, 0.5, 0.5);
1611 if (iChm < 0) iChm = 0;
1612 if (iChm > iNbCh - 1) iChm = iNbCh - 1;
1617 TString cstr =
"Save A-Hit ";
1618 cstr += Form(
" %3d %3d 0x%08x %3d 0x%08x %8.2f %6.2f",
1619 fiNbHits, iNbChanInHit, iDetId, iLastChan,
1621 dLastTime, dLastPosY);
1622 cstr += Form(
", DigiSize: %lu ",
vDigiIndRef.size());
1623 cstr +=
", DigiInds: ";
1638 Int_t(dLastTotS * 10.));
1642 LH_store(iSmType, iSm, iRpc, iChm, pHit);
1724 Double_t dWeightedTime = 0.0;
1725 Double_t dWeightedPosX = 0.0;
1726 Double_t dWeightedPosY = 0.0;
1727 Double_t dWeightedPosZ = 0.0;
1728 Double_t dWeightsSum = 0.0;
1733 Int_t iNbChanInHit = 0;
1735 Int_t iLastChan = -1;
1736 Double_t dLastPosX = 0.0;
1737 Double_t dLastPosY = 0.0;
1738 Double_t dLastTime = 0.0;
1740 Double_t dPosX = 0.0;
1741 Double_t dPosY = 0.0;
1742 Double_t dPosZ = 0.0;
1743 Double_t dTime = 0.0;
1744 Double_t dTimeDif = 0.0;
1745 Double_t dTotS = 0.0;
1748 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
1751 for (Int_t iSm = 0; iSm < iNbSm; iSm++)
1752 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
1755 LOG(debug2) <<
"RPC - Loop " << Form(
" %3d %3d %3d %3d ", iSmType, iSm, iRpc, iChType);
1763 dWeightedTime = 0.0;
1764 dWeightedPosX = 0.0;
1765 dWeightedPosY = 0.0;
1766 dWeightedPosZ = 0.0;
1775 LOG(debug2) <<
"ChanOrient "
1783 for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
1784 LOG(debug3) <<
"VDigisize "
1785 << Form(
" T %3d Sm %3d R %3d Ch %3d Size %3lu ", iSmType, iSm, iRpc, iCh,
1787 if (0 ==
fStorDigi[iSmType][iSm * iNbRpc + iRpc].
size())
continue;
1789 if (0 <
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size())
1792 while (1 <
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size()) {
1794 while ((
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetSide()
1795 == (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetSide()) {
1798 if (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size() > 2) {
1799 LOG(debug) <<
"SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh <<
", Times: "
1800 << Form(
"%f", (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime()) <<
", "
1801 << Form(
"%f", (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime())
1803 << (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime()
1804 - (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime()
1805 <<
", array size: " <<
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size();
1806 if (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetSide()
1807 ==
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetSide()) {
1808 LOG(debug) <<
"3 consecutive SameSide Digis! on TSRC " << iSmType << iSm << iRpc << iCh
1809 <<
", Times: " << (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime()
1810 <<
", " << (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime()
1812 << (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1])->GetTime()
1813 - (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0])->GetTime()
1814 <<
", array size: " <<
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size();
1815 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1816 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1818 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1821 if (
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetTime()
1822 -
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetTime()
1823 >
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]->GetTime()
1824 -
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][1]->GetTime()) {
1825 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1826 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1828 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1831 LOG(debug) << Form(
"Ev %8.0f, digis not properly time ordered, TSRCS "
1833 fdEvent, iSmType, iSm, iRpc, iCh,
1834 (Int_t)
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][0]->GetSide());
1835 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1836 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1);
1838 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1);
1843 LOG(debug2) <<
"SameSide Erase fStor entries(d) " << iSmType <<
", SR " << iSm * iNbRpc + iRpc
1845 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1846 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1848 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1850 if (2 >
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size())
break;
1854 LOG(debug2) <<
"digis processing for "
1855 << Form(
" SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ", iSmType, iSm, iRpc, iCh,
1857 if (2 >
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].
size()) {
1858 LOG(debug) << Form(
"Leaving digi processing for TSRC %d%d%d%d, size %3lu", iSmType, iSm, iRpc, iCh,
1868 LOG(debug1) << Form(
" TSRC %d%d%d%d size %3lu ", iSmType, iSm, iRpc, iCh,
1870 << Form(
" ChId: 0x%08x 0x%08x ", iChId, iUCellId);
1874 LOG(error) <<
"CbmTofHitMaker::BuildClusters: no "
1876 << Form(
" %3d %3d %3d %3d 0x%08x 0x%08x ", iSmType, iSm, iRpc, iCh, iChId, iUCellId);
1889 LOG(debug2) <<
" " << xDigiA->
ToString();
1890 LOG(debug2) <<
" " << xDigiB->
ToString();
1893 if (5 == iSmType && dTimeDif != 0.) {
1895 LOG(debug) <<
"CbmTofHitMaker::BuildClusters: "
1897 << iSm <<
" with inconsistent digits " << xDigiA->
GetTime() <<
", " << xDigiB->
GetTime()
1898 <<
" -> " << dTimeDif;
1899 LOG(debug) <<
" " << xDigiA->
ToString();
1900 LOG(debug) <<
" " << xDigiB->
ToString();
1910 &&
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size() > 2) {
1911 LOG(debug) <<
"Hit candidate outside correlation window, check for "
1912 "better possible digis, "
1913 <<
" mul " <<
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].size();
1916 Double_t dPosYN = 0.;
1917 Double_t dTimeDifN = 0;
1928 if (TMath::Abs(dPosYN) < TMath::Abs(dPosY)) {
1929 LOG(debug) <<
"Replace digi on side " << xDigiC->
GetSide() <<
", yPosNext " << dPosYN
1930 <<
" old: " << dPosY;
1931 dTimeDif = dTimeDifN;
1935 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1936 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1938 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1942 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1943 ++(
fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1));
1945 ++(
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + 1));
1953 LOG(fatal) <<
"Wrong combinations of digis " <<
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0]
1954 <<
"," <<
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1];
1958 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1959 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1961 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1974 LOG(debug1) <<
"NbChanInHit "
1975 << Form(
" %3d %3d %3d %3d %3d 0x%p %1.0f Time %f PosX %f "
1977 iNbChanInHit, iSmType, iRpc, iCh, iLastChan, xDigiA, xDigiA->
GetSide(), dTime,
1984 if (0 < iNbChanInHit) {
1985 if (iLastChan == iCh - 1) {
1994 if (TMath::Abs(dTime - dLastTime) <
fdMaxTimeDist && iLastChan == iCh - 1
1997 dWeightedTime += dTime * dTotS;
1998 dWeightedPosX += dPosX * dTotS;
1999 dWeightedPosY += dPosY * dTotS;
2000 dWeightedPosZ += dPosZ * dTotS;
2001 dWeightsSum += dTotS;
2007 LOG(debug1) <<
" Add Digi and erase fStor entries(a): NbChanInHit " << iNbChanInHit <<
", "
2008 << iSmType <<
", SR " << iSm * iNbRpc + iRpc <<
", Ch" << iCh;
2010 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
2011 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2012 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
2013 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2015 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2017 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2022 dWeightedTime /= dWeightsSum;
2023 dWeightedPosX /= dWeightsSum;
2024 dWeightedPosY /= dWeightsSum;
2025 dWeightedPosZ /= dWeightsSum;
2028 Double_t hitpos_local[3];
2029 hitpos_local[0] = dWeightedPosX;
2030 hitpos_local[1] = dWeightedPosY;
2031 hitpos_local[2] = dWeightedPosZ;
2038 Double_t hitpos[3] = {3 * 0.};
2040 gGeoManager->GetCurrentNode();
2041 gGeoManager->GetCurrentMatrix();
2045 gGeoManager->LocalToMaster(hitpos_local, hitpos);
2047 LOG(debug1) << Form(
" LocalToMaster: (%6.1f,%6.1f,%6.1f) "
2048 "->(%6.1f,%6.1f,%6.1f)",
2049 hitpos_local[0], hitpos_local[1], hitpos_local[2], hitpos[0], hitpos[1],
2052 TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
2057 TVector3 hitPosErr(0.5, 0.5, 0.5);
2071 if (iChm < 0) iChm = 0;
2072 if (iChm > iNbCh - 1) iChm = iNbCh - 1;
2082 LOG(debug) <<
"Save Hit "
2083 << Form(
" %3d %3d 0x%08x %3d %3d %3d %f %f",
fiNbHits, iNbChanInHit, iDetId, iChm,
2084 iLastChan, iRefId, dWeightedTime, dWeightedPosY)
2085 <<
", DigiSize: " <<
vDigiIndRef.size() <<
", DigiInds: " << sRef;
2090 LOG(warning) <<
"Digi refs for Hit " <<
fiNbHits <<
": vDigiIndRef.size()";
2095 LOG(debug) <<
"Store Hit twice? "
2096 <<
" fiNbHits " <<
fiNbHits <<
", "
2097 << Form(
"0x%08x, MatchCollSize %d, IndRefSize %lu ", iDetId,
2103 LOG(debug) <<
" Digi " << i <<
" " << pDigiC->
ToString();
2106 LOG(fatal) <<
"Insufficient CalDigiVec size for i " << i <<
", Ind " <<
vDigiIndRef.at(i);
2116 LOG(fatal) <<
"DigiMatchColl has insufficient size " <<
fTofDigiMatchColl->GetEntriesFast();
2119 if (NULL != digiMatchL)
2120 for (Int_t i = 0; i < digiMatchL->
GetNofLinks(); i++) {
2122 LOG(debug) <<
"report link " << i <<
"(" << digiMatchL->
GetNofLinks() <<
"), ind "
2127 LOG(warn) << Form(
"Invalid DigiRefInd for det 0x%08x", iDetId);
2132 LOG(warn) <<
"Invalid CalDigiInd";
2136 LOG(debug) <<
" DigiL " << pDigiC->
ToString();
2139 LOG(warn) <<
"Invalid digMatch Link at Index " <<
fiNbHits - 1;
2142 LOG(debug) <<
"Current HitsColl length " <<
fTofHitsColl->GetEntriesFast();
2151 Int_t(dWeightsSum * 10.));
2157 LH_store(iSmType, iSm, iRpc, iChm, pHit);
2176 fvdX[iSmType][iRpc].push_back(dWeightedPosX);
2177 fvdY[iSmType][iRpc].push_back(dWeightedPosY);
2187 dWeightedTime = dTime * dTotS;
2188 dWeightedPosX = dPosX * dTotS;
2189 dWeightedPosY = dPosY * dTotS;
2190 dWeightedPosZ = dPosZ * dTotS;
2191 dWeightsSum = dTotS;
2196 LOG(debug2) <<
" Next fStor Digi " << iSmType <<
", SR " << iSm * iNbRpc + iRpc <<
", Ch" << iCh
2197 <<
", Dig0 " << (
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0]) <<
", Dig1 "
2198 << (
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
2202 LOG(debug2) <<
" Erase fStor entries(b) " << iSmType <<
", SR " << iSm * iNbRpc + iRpc <<
", Ch"
2204 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
2205 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2206 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
2207 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2209 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2211 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2227 LOG(debug) << Form(
"1.Hit on TSRC %d%d%d%d, time: %f, PosY %f, Tdif %f ", iSmType, iSm, iRpc, iCh,
2228 dTime, dPosY, dTimeDif);
2231 dWeightedTime = dTime * dTotS;
2232 dWeightedPosX = dPosX * dTotS;
2233 dWeightedPosY = dPosY * dTotS;
2234 dWeightedPosZ = dPosZ * dTotS;
2235 dWeightsSum = dTotS;
2243 LOG(debug2) <<
" Erase fStor entries(c) " << iSmType <<
", SR " << iSm * iNbRpc + iRpc <<
", Ch"
2245 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
2246 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2247 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
2248 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2250 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2252 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
2270 if (
AddNextChan(iSmType, iSm, iRpc, iLastChan, dLastPosX, dLastPosY, dLastTime, dWeightsSum)) {
2274 fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh].clear();
2275 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].clear();
2277 LOG(debug2) <<
"finished V-RPC"
2278 << Form(
" %3d %3d %3d %d %f %fx", iSmType, iSm, iRpc,
fTofHitsColl->GetEntriesFast(),
2279 dLastPosX, dLastPosY);
2283 LOG(error) <<
"=> Cluster building "
2284 <<
"from digis to hits not implemented for pads, Sm type " << iSmType <<
" Rpc " << iRpc;
2290 if (0 < iNbChanInHit) {
2291 LOG(debug1) <<
"Process cluster " << iNbChanInHit;
2295 LOG(debug1) <<
"H-Hit ";
2298 LOG(debug2) <<
"V-Hit ";
2300 dWeightedTime /= dWeightsSum;
2301 dWeightedPosX /= dWeightsSum;
2302 dWeightedPosY /= dWeightsSum;
2303 dWeightedPosZ /= dWeightsSum;
2306 Double_t hitpos_local[3] = {3 * 0.};
2307 hitpos_local[0] = dWeightedPosX;
2308 hitpos_local[1] = dWeightedPosY;
2309 hitpos_local[2] = dWeightedPosZ;
2316 Double_t hitpos[3] = {3 * 0.};
2318 gGeoManager->GetCurrentNode();
2319 gGeoManager->GetCurrentMatrix();
2322 gGeoManager->LocalToMaster(hitpos_local, hitpos);
2324 LOG(debug1) << Form(
" LocalToMaster for V-node: "
2325 "(%6.1f,%6.1f,%6.1f) ->(%6.1f,%6.1f,%6.1f)",
2326 hitpos_local[0], hitpos_local[1], hitpos_local[2], hitpos[0], hitpos[1], hitpos[2]);
2328 TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
2332 TVector3 hitPosErr(0.5, 0.5, 0.5);
2348 if (iChm < 0) iChm = 0;
2349 if (iChm > iNbCh - 1) iChm = iNbCh - 1;
2353 TString cstr =
"Save V-Hit ";
2354 cstr += Form(
" %3d %3d 0x%08x %3d 0x%08x %8.2f %6.2f",
2355 fiNbHits, iNbChanInHit, iDetId, iLastChan,
2357 dWeightedTime, dWeightedPosY);
2359 cstr += Form(
", DigiSize: %lu ",
vDigiIndRef.size());
2360 cstr +=
", DigiInds: ";
2370 LOG(warning) <<
"Digi refs for Hit " <<
fiNbHits <<
": vDigiIndRef.size()";
2375 LOG(debug) <<
"Store Hit twice? "
2376 <<
" fiNbHits " <<
fiNbHits <<
", " << Form(
"0x%08x", iDetId);
2385 Int_t(dWeightsSum * 10.));
2392 LH_store(iSmType, iSm, iRpc, iChm, pHit);
2412 fvdX[iSmType][iRpc].push_back(dWeightedPosX);
2413 fvdY[iSmType][iRpc].push_back(dWeightedPosY);
2423 LOG(debug2) <<
" Fini-A " << Form(
" %3d %3d %3d M%3d", iSmType, iSm, iRpc,
fviClusterMul[iSmType][iSm][iRpc]);
2425 LOG(debug2) <<
" Fini-B " << Form(
" %3d ", iSmType);