26 #include "CbmTofHit.h"
36 #include "FairEventHeader.h"
37 #include "FairLogger.h"
38 #include "FairRootFileSink.h"
39 #include "FairRootManager.h"
40 #include "FairRunAna.h"
41 #include "FairRuntimeDb.h"
44 #include "TClonesArray.h"
45 #include "TDirectory.h"
48 #include "TGeoManager.h"
94 Bool_t writeDataInOut)
95 : FairTask(TString(name), verbose)
102 , fTofPointsColl(NULL)
103 , fMcTracksColl(NULL)
108 , fbWriteHitsInOut(writeDataInOut)
109 , fbWriteDigisInOut(writeDataInOut)
113 , fTofDigiMatchColl(NULL)
116 fTofHitsCollOut(NULL)
117 , fTofDigiMatchCollOut(NULL)
131 , fhClustBuildTime(NULL)
132 , fhHitsPerTracks(NULL)
134 , fhTimeResSingHits(NULL)
135 , fhTimeResSingHitsB(NULL)
136 , fhTimePtVsHits(NULL)
137 , fhClusterSize(NULL)
138 , fhClusterSizeType(NULL)
140 , fhClusterSizeMulti(NULL)
142 , fhHiTrkMulPos(NULL)
143 , fhAllTrkMulPos(NULL)
144 , fhMultiTrkProbPos(NULL)
145 , fhDigSpacDifClust(NULL)
146 , fhDigTimeDifClust(NULL)
147 , fhDigDistClust(NULL)
148 , fhClustSizeDifX(NULL)
149 , fhClustSizeDifY(NULL)
152 , fhCluMulCorDutSel(NULL)
162 , fhRpcCluPositionEvol()
165 , fhRpcCluDelMatPos()
168 , fhRpcCluDelMatTOff()
180 , fhRpcDTLastHits_Tot()
181 , fhRpcDTLastHits_CluSize()
183 , fhTRpcCluPosition()
196 , fhTRpcCluTOffDTLastHits()
197 , fhTRpcCluTotDTLastHits()
198 , fhTRpcCluSizeDTLastHits()
199 , fhTRpcCluMemMulDTLastHits()
211 , fhNbDigiPerChan(NULL)
254 , fdChannelDeadtime(0.)
259 fEnableMatchPosScaling(kTRUE)
260 , fEnableAvWalk(kFALSE)
262 , fCalParFileName(
"")
263 , fOutHstFileName(
"")
273 , fbSwapChannelSides(kFALSE)
274 , fiOutputTreeEntry(0)
276 , fbAlternativeBranchNames(kFALSE) {
290 <<
"CbmTofEventClusterizer initializing... expect Digis in ns units! ";
330 LOG(info) <<
"=> Get the digi parameters for tof";
334 FairRunAna* ana = FairRunAna::Instance();
335 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
348 LOG(info) <<
"CbmTofEventClusterizer::Exec => New timeslice " <<
iNbTs
349 <<
" with " <<
fEventsColl->GetEntriesFast() <<
" events, "
354 Int_t iNbCalDigis = 0;
358 for (Int_t iEvent = 0; iEvent <
fEventsColl->GetEntriesFast(); iEvent++) {
387 for (Int_t index = 0; index <
fTofHitsColl->GetEntriesFast(); index++) {
389 new ((*fTofHitsCollOut)[iNbHits])
CbmTofHit(*pHit);
400 new ((*fTofDigiMatchCollOut)[iNbHits])
CbmMatch(*pDigiMatch);
440 FairRootFileSink* bla =
441 (FairRootFileSink*) FairRootManager::Instance()->GetSink();
444 ((FairRootFileSink*) FairRootManager::Instance()->GetSink())
482 FairRootManager* fManager = FairRootManager::Instance();
484 if (NULL == fManager) {
485 LOG(error) <<
"CbmTofEventClusterizer::RegisterInputs => Could not find "
486 "FairRootManager!!!";
506 fEventsColl =
dynamic_cast<TClonesArray*
>(fManager->GetObject(
"Event"));
508 fEventsColl =
dynamic_cast<TClonesArray*
>(fManager->GetObject(
"CbmEvent"));
511 LOG(info) <<
"CbmEvent not found in input file, assume eventwise input";
516 LOG(error) << GetName() <<
": No digi input!";
522 LOG(info) <<
"CbmTofEventClusterizer::RegisterInputs => Could not get "
523 "TofTrbHeader Object";
530 LOG(info) <<
"CbmEvent found in input file, assume time based input";
538 FairRootManager*
rootMgr = FairRootManager::Instance();
550 TString tHitBranchName;
551 TString tHitDigiMatchBranchName;
554 tHitBranchName =
"ATofHit";
555 tHitDigiMatchBranchName =
"ATofDigiMatch";
557 tHitBranchName =
"TofHit";
558 tHitDigiMatchBranchName =
"TofCalDigiMatch";
582 LOG(info) <<
"out branches: " << tHitBranchName <<
", "
583 << tHitDigiMatchBranchName;
589 Bool_t isSimulation = kFALSE;
591 <<
"CbmTofEventClusterizer::InitParameters - Geometry, Mapping, ... ??";
594 FairRun* ana = FairRun::Instance();
595 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
598 if (
k14a > iGeoVersion) {
599 LOG(error) <<
"CbmTofEventClusterizer::InitParameters => Only compatible "
600 "with geometries after v14a !!!";
608 LOG(info) <<
"Create DigiPar ";
613 LOG(error) <<
"CbmTofEventClusterizer::InitParameters => Could not obtain "
614 "the CbmTofDigiPar ";
620 LOG(error) <<
"CbmTofEventClusterizer::InitParameters => Could not obtain "
621 "the CbmTofDigiBdfPar ";
625 rtdb->initContainers(ana->GetRunId());
627 LOG(info) <<
"CbmTofEventClusterizer::InitParameter: currently "
641 LOG(info) <<
" BuildCluster with MaxTimeDist " <<
fdMaxTimeDist
678 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
681 fvCPTOff[iSmType].resize(iNbSm * iNbRpc);
684 fvCPWalk[iSmType].resize(iNbSm * iNbRpc);
686 for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
687 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
694 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
695 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] =
700 fvCPTOff[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
701 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
702 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
703 fvCPWalk[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
705 for (Int_t iCh = 0; iCh < iNbChan; iCh++) {
706 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
707 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
708 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
709 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
710 for (Int_t iSide = 0; iSide < nbSide; iSide++) {
711 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] =
713 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] =
715 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] =
717 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide].resize(
720 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide][iWx] = 0.;
727 LOG(info) <<
"CbmTofEventClusterizer::InitCalibParameter: defaults set";
736 LOG(info) <<
"CbmTofEventClusterizer::InitCalibParameter: read histos from "
744 LOG(fatal) <<
"CbmTofEventClusterizer::InitCalibParameter: "
753 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
757 (TProfile*) gDirectory->FindObjectAny(Form(
"cl_SmT%01d_Svel", iSmType));
760 TDirectory* curdir = gDirectory;
762 gDirectory->cd(oldir->GetPath());
764 gDirectory->cd(curdir->GetPath());
766 LOG(info) <<
"Svel histogram not found for module type " << iSmType;
769 for (Int_t iPar = 0; iPar < 4; iPar++) {
770 TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny(
771 Form(
"cl_SmT%01d_Fpar%1d", iSmType, iPar));
772 if (NULL != hFparcur) {
773 gDirectory->cd(oldir->GetPath());
775 gDirectory->cd(curdir->GetPath());
779 for (Int_t iSm = 0; iSm < iNbSm; iSm++)
780 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
785 if (Vscal == 0.) Vscal = 1.;
791 LOG(info) <<
"Modify " << iSmType << iSm << iRpc <<
" Svel by "
795 TH2F* htempPos_pfx = (TH2F*) gDirectory->FindObjectAny(
796 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc));
797 TH2F* htempTOff_pfx = (TH2F*) gDirectory->FindObjectAny(
798 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc));
799 TH1D* htempTot_Mean = (TH1D*) gDirectory->FindObjectAny(
800 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc));
801 TH1D* htempTot_Off = (TH1D*) gDirectory->FindObjectAny(
802 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc));
803 if (NULL != htempPos_pfx && NULL != htempTOff_pfx
804 && NULL != htempTot_Mean && NULL != htempTot_Off) {
806 Int_t iNbinTot = htempTot_Mean->GetNbinsX();
807 for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
809 for (Int_t iSide = 0; iSide < 2; iSide++) {
810 Double_t TotMean = htempTot_Mean->GetBinContent(
811 iCh * 2 + 1 + iSide);
812 if (0.001 < TotMean) {
813 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *=
816 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] =
817 htempTot_Off->GetBinContent(iCh * 2 + 1 + iSide);
820 Double_t YMean = ((TProfile*) htempPos_pfx)
821 ->GetBinContent(iCh + 1);
823 ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1);
827 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean;
828 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean;
836 if (5 == iSmType || 8 == iSmType) {
837 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] =
838 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0];
839 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] =
841 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] =
842 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][0];
845 LOG(debug) <<
"CbmTofEventClusterizer::InitCalibParameter:"
846 <<
" SmT " << iSmType <<
" Sm " << iSm <<
" Rpc "
847 << iRpc <<
" Ch " << iCh
848 << Form(
": YMean %f, TMean %f", YMean, TMean) <<
" -> "
851 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
852 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1],
855 <<
", NbinTot " << iNbinTot;
857 TH1D* htempWalk0 = (TH1D*) gDirectory->FindObjectAny(
858 Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
863 TH1D* htempWalk1 = (TH1D*) gDirectory->FindObjectAny(
864 Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
869 if (NULL != htempWalk0
870 && NULL != htempWalk1) {
871 LOG(debug) <<
"Initialize Walk correction for "
872 << Form(
" SmT%01d_sm%03d_rpc%03d_Ch%03d",
878 LOG(error) <<
"CbmTofEventClusterizer::InitCalibParameter: "
879 "Inconsistent Walk histograms";
881 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin] =
882 htempWalk0->GetBinContent(iBin + 1);
883 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] =
884 htempWalk1->GetBinContent(iBin + 1);
886 " SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ",
892 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]);
893 if (5 == iSmType || 8 == iSmType) {
894 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] =
895 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin];
901 LOG(warning) <<
" Calibration histos "
902 << Form(
"cl_SmT%01d_sm%03d_rpc%03d_XXX",
908 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
909 TH1D* htmpDelTof = (TH1D*) gDirectory->FindObjectAny(
910 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
915 if (NULL == htmpDelTof) {
916 LOG(debug) <<
" Histos "
917 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
925 LOG(debug) <<
" Load DelTof from histos "
926 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
933 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] +=
934 htmpDelTof->GetBinContent(iBx + 1);
939 gDirectory->cd(oldir->GetPath());
940 TH1D* h1DelTof = (TH1D*) htmpDelTof->Clone(
941 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
947 LOG(debug) <<
" copy histo " << h1DelTof->GetName()
948 <<
" to directory " << oldir->GetName();
950 gDirectory->cd(curdir->GetPath());
960 <<
"CbmTofEventClusterizer::InitCalibParameter: initialization done";
965 LOG(info) <<
"CbmTofEventClusterizer::LoadGeometry starting for "
970 LOG(info) <<
"Digi Parameter container contains " << iNrOfCells <<
" cells.";
971 for (Int_t icell = 0; icell < iNrOfCells; ++icell) {
987 LOG(debug) <<
"-I- InitPar " << icell <<
" Id: " << Form(
"0x%08x", cellId)
988 <<
" " << cell <<
" tmcs: " << smtype <<
" " << smodule <<
" "
989 << module <<
" " << cell <<
" x=" << Form(
"%6.2f",
x)
990 <<
" y=" << Form(
"%6.2f",
y) <<
" z=" << Form(
"%6.2f", z)
991 <<
" dx=" << dx <<
" dy=" << dy;
994 gGeoManager->FindNode(
996 LOG(debug2) << Form(
" Node at (%6.1f,%6.1f,%6.1f) : 0x%p",
1002 TGeoHMatrix* cMatrix = gGeoManager->GetCurrentMatrix();
1013 for (Int_t iDetIndx = 0; iDetIndx < iNbDet; iDetIndx++) {
1018 LOG(info) <<
" DetIndx " << iDetIndx <<
"(" << iNbDet <<
"), SmType "
1019 << iSmType <<
", SmId " << iSmId <<
", RpcId " << iRpcId
1020 <<
" => UniqueId " << Form(
"0x%08x ", iUniqueId)
1021 << Form(
" Svel %6.6f, DeadStrips 0x%08x ",
1026 for (Int_t iCh = 0; iCh < iNbChan * 2; iCh++)
1035 LOG(debug3) <<
" Cell " << iCell << Form(
" 0x%08x ", iUCellId)
1052 fvdX.resize(iNbSmTypes);
1053 fvdY.resize(iNbSmTypes);
1060 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
1067 fvdX[iSmType].resize(iNbRpc);
1068 fvdY[iSmType].resize(iNbRpc);
1069 fvdDifX[iSmType].resize(iNbRpc);
1070 fvdDifY[iSmType].resize(iNbRpc);
1072 for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
1075 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
1080 LOG(warning) <<
"CbmTofEventClusterizer::LoadGeometry: StoreDigi "
1082 << Form(
"SmTy %3d, Sm %3d, NbRpc %3d, Rpc, %3d ",
1089 <<
"CbmTofEventClusterizer::LoadGeometry: StoreDigi with "
1091 " %3d %3d %3d %3d %5d ", iSmType, iSm, iNbRpc, iRpc, iNbChan);
1092 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
1093 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
1094 fvLastHits[iSmType][iSm][iRpc].resize(iNbChan);
1103 LOG(info) <<
"CbmTofEventClusterizer::DeleteGeometry starting";
1107 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
1110 for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
1111 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
1132 new TH1I(
"TofEventClus_ClustBuildTime",
1133 "Time needed to build clusters in each event; Time [s]",
1150 Double_t YSCAL = 50.;
1173 LOG(warning) <<
"No DigiPar for SmType "
1174 << Form(
"%d, 0x%08x", iS, iUCellId);
1180 new TH2F(Form(
"cl_SmT%01d_Pos", iS),
1181 Form(
"Clu position of SmType %d; Sm+Rpc# []; ypos [cm]", iS),
1189 Double_t TSumMax = 1.E3;
1192 new TH2F(Form(
"cl_SmT%01d_TOff", iS),
1193 Form(
"Clu TimeZero in SmType %d; Sm+Rpc# []; TOff [ns]", iS),
1201 TProfile* hSvelcur =
1202 (TProfile*) gDirectory->FindObjectAny(Form(
"cl_SmT%01d_Svel", iS));
1203 if (NULL == hSvelcur) {
1205 Form(
"cl_SmT%01d_Svel", iS),
1206 Form(
"Clu Svel in SmType %d; Sm+Rpc# []; v/v_{nominal} ", iS),
1217 for (Int_t iPar = 0; iPar < 4; iPar++) {
1218 TProfile* hFparcur = (TProfile*) gDirectory->FindObjectAny(
1219 Form(
"cl_SmT%01d_Fpar%1d", iS, iPar));
1220 if (NULL == hFparcur) {
1221 LOG(info) <<
"Histo " << Form(
"cl_SmT%01d_Fpar%1d", iS, iPar)
1222 <<
" not found, recreate ...";
1224 Form(
"cl_SmT%01d_Fpar%1d", iS, iPar),
1225 Form(
"Clu Fpar %d in SmType %d; Sm+Rpc# []; value ", iPar, iS),
1232 fhSmCluFpar[iS][iPar] = (TProfile*) hFparcur->Clone();
1238 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
1240 new TH2F(Form(
"cl_TSmT%01d_Sel%02d_Pos", iS, iSel),
1241 Form(
"Clu position of SmType %d under Selector %02d; Sm+Rpc# "
1252 new TH2F(Form(
"cl_TSmT%01d_Sel%02d_TOff", iS, iSel),
1253 Form(
"Clu TimeZero in SmType %d under Selector %02d; Sm+Rpc# "
1264 new TH2F(Form(
"cl_TSmT%01d_Sel%02d_TRun", iS, iSel),
1265 Form(
"Clu TimeZero in SmType %d under Selector %02d; Event# "
1280 LOG(info) <<
" Define Clusterizer histos for " << iNbDet <<
" detectors ";
1313 for (Int_t iDetIndx = 0; iDetIndx < iNbDet; iDetIndx++) {
1325 LOG(warning) <<
"No DigiPar for Det " << Form(
"0x%08x", iUCellId);
1328 LOG(info) <<
"DetIndx " << iDetIndx <<
", SmType " << iSmType <<
", SmId "
1329 << iSmId <<
", RpcId " << iRpcId <<
" => UniqueId "
1330 << Form(
"(0x%08x, 0x%08x)", iUniqueId, iUCellId) <<
", dx "
1342 LOG(warning) << Form(
1343 "missing ChannelInfo for ch %d addr 0x%08x", iCh, iCCellId);
1348 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DigiCor", iSmType, iSmId, iRpcId),
1350 "Digi Correlation of Rpc #%03d in Sm %03d of type %d; digi 0; digi 1",
1362 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DigiMul", iSmType, iSmId, iRpcId),
1363 Form(
"Digi Multiplicity of Rpc #%03d in Sm %03d of type %d; strip #; "
1376 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DigiStatus", iSmType, iSmId, iRpcId),
1378 "Digi Status of Rpc #%03d in Sm %03d of type %d; strip #; digi status",
1390 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DigiDTLD", iSmType, iSmId, iRpcId),
1391 Form(
"Time distance to last digi of Rpc #%03d in Sm %03d of type %d; "
1392 "channel; t_{digi} - t_{previous digi} (s)",
1404 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Mul", iSmType, iSmId, iRpcId),
1405 Form(
"Clu multiplicity of Rpc #%03d in Sm %03d of type %d; M []; Cnts",
1414 Form(
"cl_SmT%01d_sm%03d_rpc%03d_rate", iSmType, iSmId, iRpcId),
1415 Form(
"Clu rate of Rpc #%03d in Sm %03d of type %d; Time (s); Rate (Hz)",
1424 Form(
"cl_SmT%01d_sm%03d_rpc%03d_rate10s", iSmType, iSmId, iRpcId),
1425 Form(
" Clu rate of Rpc #%03d in Sm %03d of type %d in last "
1426 "10s; Time (s); Rate (Hz)",
1435 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DTLastHits", iSmType, iSmId, iRpcId),
1436 Form(
"Clu #DeltaT to last hits of Rpc #%03d in Sm %03d of type %d; log( "
1437 "#DeltaT (ns)); counts",
1446 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Tot_DTLH", iSmType, iSmId, iRpcId),
1447 Form(
"Clu Tot of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); TOT "
1460 Form(
"cl_SmT%01d_sm%03d_rpc%03d_CluSize_DTLH", iSmType, iSmId, iRpcId),
1461 Form(
"Clu Size of Rpc #%03d in Sm %03d of type %d; log(#DeltaT (ns)); "
1473 Double_t YSCAL = 50.;
1477 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Pos", iSmType, iSmId, iRpcId),
1479 "Clu position of Rpc #%03d in Sm %03d of type %d; Strip []; ypos [cm]",
1491 Form(
"cl_SmT%01d_sm%03d_rpc%03d_PosEvol", iSmType, iSmId, iRpcId),
1492 Form(
"Clu position of Rpc #%03d in Sm %03d of type %d; Analysis Time "
1504 Form(
"cl_SmT%01d_sm%03d_rpc%03d_TimeEvol", iSmType, iSmId, iRpcId),
1505 Form(
"Clu time of Rpc #%03d in Sm %03d of type %d; Analysis Time [s]; dT "
1517 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_DelPos", iSmType, iSmId, iRpcId),
1518 Form(
"Clu position difference of Rpc #%03d in Sm %03d of type "
1519 "%d; Strip []; #Deltaypos(clu) [cm]",
1531 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DelMatPos", iSmType, iSmId, iRpcId),
1532 Form(
"Matched Clu position difference of Rpc #%03d in Sm %03d of type "
1533 "%d; Strip []; #Deltaypos(mat) [cm]",
1544 Double_t TSumMax = 1.E3;
1547 Form(
"cl_SmT%01d_sm%03d_rpc%03d_TOff", iSmType, iSmId, iRpcId),
1549 "Clu TimeZero of Rpc #%03d in Sm %03d of type %d; Strip []; TOff [ns]",
1561 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DelTOff", iSmType, iSmId, iRpcId),
1562 Form(
"Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip "
1563 "[]; #DeltaTOff(clu) [ns]",
1575 Form(
"cl_SmT%01d_sm%03d_rpc%03d_DelMatTOff", iSmType, iSmId, iRpcId),
1576 Form(
"Clu TimeZero Difference of Rpc #%03d in Sm %03d of type %d; Strip "
1577 "[]; #DeltaTOff(mat) [ns]",
1589 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Trms", iSmType, iSmId, iRpcId),
1591 "Clu Time RMS of Rpc #%03d in Sm %03d of type %d; Strip []; Trms [ns]",
1603 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Tot", iSmType, iSmId, iRpcId),
1605 "Clu Tot of Rpc #%03d in Sm %03d of type %d; StripSide []; TOT [a.u.]",
1617 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Size", iSmType, iSmId, iRpcId),
1619 "Clu size of Rpc #%03d in Sm %03d of type %d; Strip []; size [strips]",
1632 Form(
"cl_SmT%01d_sm%03d_rpc%03d_AvWalk", iSmType, iSmId, iRpcId),
1633 Form(
"Walk in SmT%01d_sm%03d_rpc%03d_AvWalk; Tot [a.u.]; #DeltaT [ns]",
1645 Form(
"cl_SmT%01d_sm%03d_rpc%03d_AvLnWalk", iSmType, iSmId, iRpcId),
1646 Form(
"Walk in SmT%01d_sm%03d_rpc%03d_AvLnWalk; log_{10}Tot [a.u.]; "
1661 for (Int_t iSide = 0; iSide < 2; iSide++) {
1663 new TH2D(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk",
1669 Form(
"Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Walk; Tot "
1670 "[a.u.]; #DeltaT [ns]",
1691 LOG(info) <<
" Define Clusterizer monitoring histos ";
1694 new TH2F(Form(
"hCluMulCorDutSel"),
1695 Form(
"Cluster Multiplicity Correlation of Dut %d%d%d with Sel "
1696 "%d%d%d; Mul(Sel); Mul(Dut)",
1712 Form(
"Time Evolution of Cluster Multiplicity in Event; Time (s); Mul"),
1721 new TH1I(
"Clus_DigSpacDifClust",
1722 "Space difference along channel direction between Digi pairs on "
1723 "adjacent channels; PosCh i - Pos Ch i+1 [cm]",
1728 new TH1I(
"Clus_DigTimeDifClust",
1729 "Time difference between Digi pairs on adjacent channels; "
1730 "0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]",
1735 "Clus_DigDistClust",
1736 "Distance between Digi pairs on adjacent channels; PosCh i - Pos Ch i+1 "
1737 "[cm along ch]; 0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]",
1745 new TH2I(
"Clus_ClustSizeDifX",
1746 "Position difference between Point and Hit as function of Cluster "
1747 "Size; Cluster Size [Strips]; dX [cm]",
1755 new TH2I(
"Clus_ClustSizeDifY",
1756 "Position difference between Point and Hit as function of Cluster "
1757 "Size; Cluster Size [Strips]; dY [cm]",
1765 "Position difference between Point and Hit as "
1766 "function of Channel dif; Ch Dif [Strips]; dX [cm]",
1774 "Position difference between Point and Hit as "
1775 "function of Channel Dif; Ch Dif [Strips]; dY [cm]",
1783 "How many time per event the 2 digis on a channel "
1784 "were of the same side ; Counts/Event []",
1789 "Nb of Digis per channel; Nb Digis []",
1798 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
1799 fhSeldT[iSel] =
new TH2F(Form(
"cl_dt_Sel%02d", iSel),
1800 Form(
"Selector time %02d; dT [ns]", iSel),
1825 for (Int_t iDetIndx = 0; iDetIndx < iNbDet; iDetIndx++) {
1834 LOG(warning) <<
"No DigiPar for Det " << Form(
"0x%08x", iUCellId);
1837 LOG(debug1) <<
"DetIndx " << iDetIndx <<
", SmType " << iSmType
1838 <<
", SmId " << iSmId <<
", RpcId " << iRpcId
1840 << Form(
"(0x%08x, 0x%08x)", iUniqueId, iUCellId) <<
", dx "
1862 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
1864 new TH1F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Mul",
1869 Form(
"Clu multiplicity of Rpc #%03d in Sm %03d of type %d "
1870 "under Selector %02d; M []; cnts",
1880 LOG(fatal) <<
" Histo not generated !";
1882 Double_t YSCAL = 50.;
1886 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Pos",
1891 Form(
"Clu position of Rpc #%03d in Sm %03d of type %d under "
1892 "Selector %02d; Strip []; ypos [cm]",
1904 Double_t TSumMax = 1.E4;
1906 if (iSmType == 5) TSumMax *= 2.;
1908 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff",
1913 Form(
"Clu TimeZero of Rpc #%03d in Sm %03d of type %d under "
1914 "Selector %02d; Strip []; TOff [ns]",
1927 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TofOff",
1932 Form(
"Clu TimeDeviation of Rpc #%03d in Sm %03d of type %d "
1933 "under Selector %02d; Strip []; TOff [ns]",
1947 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot",
1952 Form(
"Clu Tot of Rpc #%03d in Sm %03d of type %d under "
1953 "Selector %02d; StripSide []; TOT [a.u.]",
1966 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size",
1971 Form(
"Clu size of Rpc #%03d in Sm %03d of type %d under "
1972 "Selector %02d; Strip []; size [strips]",
1986 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk",
1991 Form(
"Walk in SmT%01d_sm%03d_rpc%03d_Sel%02d_AvWalk; TOT; T-TSel",
2005 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
2010 Form(
"SmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof; TRef-TSel; T-TSel",
2024 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY",
2029 Form(
"SmT%01d_sm%03d_rpc%03d_Sel%02d_dXdY; #Delta x [cm]; "
2043 new TH3F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2",
2048 Form(
"Walk in SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2",
2069 for (Int_t iSide = 0; iSide < 2; iSide++) {
2071 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk",
2078 Form(
"Walk in SmT%01d_sm%03d_rpc%03d_Ch%03d_S%01d_Sel%02d_Walk",
2095 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_TOff_DTLH",
2100 Form(
"Clu TimeZero of Rpc #%03d in Sm %03d of type %d under "
2101 "Selector %02d; log(#DeltaT (ns)); TOff [ns]",
2114 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Tot_DTLH",
2119 Form(
"Clu Tot of Rpc #%03d in Sm %03d of type %d under "
2120 "Selector %02d; log(#DeltaT (ns)); TOT [a.u.]",
2133 new TH2F(Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Size_DTLH",
2138 Form(
"Clu size of Rpc #%03d in Sm %03d of type %d under "
2139 "Selector %02d; log(#DeltaT (ns)); size [strips]",
2152 Form(
"cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_MemMul_DTLH",
2157 Form(
"Clu Memorized Multiplicity of Rpc #%03d in Sm %03d of type %d "
2158 "under Selector %02d; log(#DeltaT (ns)); TOff [ns]",
2174 new TH1I(
"Clus_TofHitPerTrk",
2175 "Mean Number of TofHit per Mc Track; Nb TofHits/Nb MC Tracks []",
2181 "Distribution of the Number of MCPoints associated "
2182 "to each TofHit; Nb MCPoint []",
2188 new TH1I(
"Clus_TofTimeResClust",
2189 "Time resolution for TofHits containing Digis from a single MC "
2190 "Track; t(1st Mc Point) -tTofHit [ns]",
2195 new TH2I(
"Clus_TofTimeResClustB",
2196 "Time resolution for TofHits containing Digis from a single MC "
2197 "Track; (1st Mc Point) -tTofHit [ns]",
2205 new TH2I(
"Clus_TofTimePtVsHit",
2206 "Time resolution for TofHits containing Digis from a single MC "
2207 "Track; t(1st Mc Point) -tTofHit [ns]",
2216 new TH1I(
"Clus_TofTimeResClust",
2217 "Time resolution for TofHits containing Digis from a single "
2218 "TofPoint; tMcPoint -tTofHit [ns]",
2223 new TH2I(
"Clus_TofTimeResClustB",
2224 "Time resolution for TofHits containing Digis from a single "
2225 "TofPoint; tMcPoint -tTofHit [ns]",
2233 "Time resolution for TofHits containing Digis "
2234 "from a single TofPoint; tMcPoint -tTofHit [ps]",
2243 "Cluster Size distribution; Cluster Size [Strips]",
2248 new TH2I(
"Clus_ClusterSizeType",
2249 "Cluster Size distribution in each (SM type, Rpc) pair; Cluster "
2250 "Size [Strips]; 10*SM Type + Rpc Index []",
2260 "Number of MC tracks generating the cluster; MC Tracks multiplicity []",
2265 "Clus_ClusterSizeMulti",
2266 "Cluster Size distribution as function of Number of MC tracks generating "
2267 "the cluster; Cluster Size [Strips]; MC tracks mul. []",
2275 "Position of Clusters with only 1 MC tracks "
2276 "generating the cluster; X [cm]; Y [cm]",
2284 "Position of Clusters with >1 MC tracks "
2285 "generating the cluster; X [cm]; Y [cm]",
2293 "Clus_AllTrkMulPos",
2294 "Position of all clusters generating the cluster; X [cm]; Y [cm]",
2302 new TH2D(
"Clus_MultiTrkProbPos",
2303 "Probability of having a cluster with multiple tracks as "
2304 "function of position; X [cm]; Y [cm]; Prob. [%]",
2322 + (
fStop.GetNanoSec() -
fStart.GetNanoSec()) / 1e9);
2326 gGeoManager->CdTop();
2328 if (0 < iNbTofHits) {
2329 Double_t dCluMul = 0.;
2331 Double_t dTTrig[
iNSel];
2333 Double_t ddXdZ[
iNSel];
2334 Double_t ddYdZ[
iNSel];
2335 Double_t dSel2dXdYMin[
iNSel];
2337 Int_t iBeamRefMul = 0;
2338 Int_t iBeamAddRefMul = 0;
2343 LOG(debug) <<
"CbmTofEventClusterizer::FillHistos() for " <<
iNSel
2350 LOG(debug) <<
"CbmTofEventClusterizer::FillHistos: Muls: "
2357 for (Int_t iDetIndx = 0; iDetIndx < iNbDet; iDetIndx++) {
2376 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2378 if (NULL == pHit)
continue;
2386 std::map<UInt_t, UInt_t>::iterator it =
fDetIdIndexMap.find(iDetId);
2389 Int_t iDetIndx = it->second;
2399 dTimeAna, 1. /
fhRpcCluRate[iDetIndx]->GetBinWidth(1));
2416 LOG(info) <<
"Resetting 10s rate histo for spill " <<
iNSpill
2418 << dDTLEvt / 1.E9 <<
" s without events";
2433 &&
fvLastHits[iSmType][iSm][iRpc][iCh].size() == 0)
2434 LOG(fatal) << Form(
" <E> hit not stored in memory for TSRC %d%d%d%d",
2442 if (
fvLastHits[iSmType][iSm][iRpc][iCh].size()
2451 LOG(warning) << Form(
"Invalid time ordering in ev %8.0f in list of "
2452 "size %lu for TSRC %d%d%d%d: Delta t %f ",
2462 while (
fvLastHits[iSmType][iSm][iRpc][iCh].size() > 2.
2463 ||
fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime()
2469 <<
" pop from list size "
2470 <<
fvLastHits[iSmType][iSm][iRpc][iCh].size()
2471 << Form(
" outdated hits for ev %8.0f in TSRC %d%d%d%d",
2478 " with tHit - tLast %f ",
2480 -
fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime())
2486 "Inconsistent address in list of size %lu for TSRC %d%d%d%d: "
2494 fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime());
2495 fvLastHits[iSmType][iSm][iRpc][iCh].front()->Delete();
2496 fvLastHits[iSmType][iSm][iRpc][iCh].pop_front();
2501 if (
fvLastHits[iSmType][iSm][iRpc][iCh].size()
2504 Double_t dTotSum = 0.;
2505 for (Int_t iLink = 0; iLink < digiMatch->
GetNofLinks();
2509 Int_t iDigInd1 = (digiMatch->
GetLink(iLink + 1)).GetIndex();
2517 std::list<CbmTofHit*>::iterator itL =
2521 iH <
fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1;
2525 TMath::Log10(pHit->
GetTime() - (*itL)->GetTime()));
2527 TMath::Log10(pHit->
GetTime() - (*itL)->GetTime()),
2530 TMath::Log10(pHit->
GetTime() - (*itL)->GetTime()), dTotSum);
2539 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2541 if (NULL == pHit)
continue;
2550 Double_t TotSum = 0.;
2551 for (Int_t iLink = 0; iLink < digiMatch->
GetNofLinks();
2556 if (iDigInd0 < fTofCalDigiVec->size()) {
2559 TotSum += pDig0->
GetTot();
2577 LOG(debug) <<
"CbmTofEventClusterizer::FillHistos: BRefMul: "
2578 << iBeamRefMul <<
", " << iBeamAddRefMul;
2580 if (iBeamRefMul == 0)
2584 if (NULL == pBeamRef)
return kFALSE;
2586 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
2587 BSel[iSel] = kFALSE;
2595 dSel2dXdYMin[iSel] = 1.E300;
2605 for (Int_t iRpc = iR0; iRpc < iRl; iRpc++)
2607 LOG(debug) <<
"Selector 0: DutMul "
2609 << iDutMul <<
", BRefMul " << iBeamRefMul
2610 <<
" TRef: " <<
dTRef <<
", BeamAddRefMul "
2614 LOG(debug1) <<
"Found selector 0, NbHits " << iNbTofHits;
2615 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2617 if (NULL == pHit)
continue;
2620 LOG(debug1) << Form(
" Det 0x%08x, Dut 0x%08x, T %f, TTrig %f",
2627 if (pHit->
GetTime() < dTTrig[iSel]) {
2631 dTTrig[iSel] = pHit->
GetTime();
2640 "Found selector 0 with mul %d from 0x%08x at %f ",
2653 for (Int_t iRpc = iR0; iRpc < iRl; iRpc++)
2656 <<
"CbmTofEventClusterizer::FillHistos(): selector 1: RefMul "
2658 <<
", BRefMul " << iBeamRefMul;
2660 LOG(debug1) <<
"CbmTofEventClusterizer::FillHistos(): Found "
2661 "selector 1, BeamRef at"
2664 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2666 if (NULL == pHit)
continue;
2671 <<
"Check hit " << iHitInd <<
", sel " << iSel
2672 <<
", t: " << pHit->
GetTime() <<
", TT " << dTTrig[iSel];
2674 if (pHit->
GetTime() < dTTrig[iSel]) {
2678 dTTrig[iSel] = pHit->
GetTime();
2681 LOG(debug1) <<
"Accept hit " << iHitInd <<
", sel "
2682 << iSel <<
", t: " << pHit->
GetTime()
2683 <<
", TT " << dTTrig[iSel];
2690 "Found selector 1 with mul %d from 0x%08x at %f ",
2698 LOG(info) <<
"CbmTofEventClusterizer::FillHistos: selection not "
2704 dTTrig[iSel] =
dTRef;
2706 if (iDetMul < iReqMul) BSel[iSel] = 0;
2710 LOG(debug1) <<
"selector loop passed, continue with Sel2Id " <<
fSel2Id;
2713 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
2715 BSel[iSel] = kFALSE;
2718 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2720 if (NULL == pHit)
continue;
2723 Double_t dzscal = 1.;
2725 dzscal = pHit->
GetZ() / pTrig[iSel]->
GetZ();
2726 Double_t dSEl2dXdz = (pHit->
GetX() - pTrig[iSel]->
GetX())
2727 / (pHit->
GetZ() - pTrig[iSel]->
GetZ());
2728 Double_t dSEl2dYdz = (pHit->
GetY() - pTrig[iSel]->
GetY())
2729 / (pHit->
GetZ() - pTrig[iSel]->
GetZ());
2734 pHit->
GetX() - dzscal * pTrig[iSel]->
GetX(), 2.)
2736 pHit->
GetY() - dzscal * pTrig[iSel]->
GetY(), 2.))
2739 Double_t dX2Y2 = TMath::Sqrt(dSEl2dXdz * dSEl2dXdz
2740 + dSEl2dYdz * dSEl2dYdz);
2741 if (dX2Y2 < dSel2dXdYMin[iSel]) {
2742 ddXdZ[iSel] = dSEl2dXdz;
2743 ddYdZ[iSel] = dSEl2dYdz;
2744 dSel2dXdYMin[iSel] = dX2Y2;
2788 LOG(debug1) <<
"Generate trigger pattern";
2789 UInt_t uTriggerPattern = 1;
2793 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
2802 LOG(debug1) <<
"Inspect trigger pattern";
2803 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
2806 for (UInt_t uChannel = 0; uChannel < 16; uChannel++) {
2807 if (uTriggerPattern & (0x1 << uChannel)) {
2816 LOG(debug1) <<
"start filling histos ";
2818 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2820 if (NULL == pHit)
continue;
2823 LOG(debug1) <<
"Process Hit " << iHitInd <<
", DetId " << iDetId;
2825 std::map<UInt_t, UInt_t>::iterator it =
fDetIdIndexMap.find(iDetId);
2828 Int_t iDetIndx = it->second;
2835 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
2849 if (iBeamRefMul == 0)
break;
2855 LOG(error) <<
"Invalid Channel Pointer for ChId "
2856 << Form(
" 0x%08x ", iChId) <<
", Ch " << iCh;
2860 gGeoManager->FindNode(
2863 LOG(debug1) <<
"Hit info: "
2864 << Form(
" 0x%08x %d %f %f %f %f %f %d",
2875 hitpos[0] = pHit->
GetX();
2876 hitpos[1] = pHit->
GetY();
2877 hitpos[2] = pHit->
GetZ();
2878 Double_t hitpos_local[3];
2879 TGeoNode* cNode = gGeoManager->GetCurrentNode();
2880 gGeoManager->MasterToLocal(hitpos, hitpos_local);
2881 LOG(debug1) << Form(
" MasterToLocal for %d, %d%d%d, node %p: "
2882 "(%6.1f,%6.1f,%6.1f) ->(%6.1f,%6.1f,%6.1f)",
2896 (Double_t) iCh, hitpos_local[1]);
2901 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
2919 LOG(debug1) <<
" TofDigiMatchColl entries:"
2923 LOG(error) <<
" Inconsistent DigiMatches for Hitind " << iHitInd
2928 LOG(debug1) <<
" got " << digiMatch->
GetNofLinks() <<
" matches for iCh "
2929 << iCh <<
" at iHitInd " << iHitInd;
2934 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
2938 if (
fvLastHits[iSmType][iSm][iRpc][iCh].size()
2940 std::list<CbmTofHit*>::iterator itL =
2944 iH <
fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1;
2948 TMath::Log10(pHit->
GetTime() - (*itL)->GetTime()),
2954 Double_t TotSum = 0.;
2955 for (Int_t iLink = 0; iLink < digiMatch->
GetNofLinks();
2960 if (iDigInd0 < fTofCalDigiVec->size()) {
2963 TotSum += pDig0->
GetTot();
2966 Double_t dMeanTimeSquared = 0.;
2967 Double_t dNstrips = 0.;
2969 Double_t dDelTof = 0.;
2970 Double_t dTcor[
iNSel];
2971 Double_t dTTcor[
iNSel];
2972 Double_t dZsign[
iNSel];
2973 Double_t dzscal = 1.;
2976 for (Int_t iLink = 0; iLink < digiMatch->
GetNofLinks();
2981 (digiMatch->
GetLink(iLink + 1)).GetIndex();
2985 if (iDigInd0 < fTofCalDigiVec->size()
2991 if ((Int_t) pDig0->
GetType() != iSmType) {
2992 LOG(error) << Form(
" Wrong Digi SmType for Tofhit %d in iDetIndx "
2993 "%d, Ch %d with %3.0f strips at Indx %d, %d",
3001 LOG(debug1) <<
" fhRpcCluTot: Digi 0 " << iDigInd0 <<
": Ch "
3004 << (Double_t) iCh * 2. + pDig0->
GetSide() <<
" Digi 1 "
3005 << iDigInd1 <<
": Ch " << pDig1->
GetChannel() <<
", Side "
3006 << pDig1->
GetSide() <<
", StripSide "
3007 << (Double_t) iCh * 2. + pDig1->
GetSide() <<
", Tot0 "
3019 if (iCh0 != iCh1 || iS0 == iS1) {
3021 " MT2 for Tofhit %d in iDetIndx %d, Ch %d from %3.0f strips: ",
3026 << Form(
" Dig0: Ind %d, Ch %d, Side %d, T: %6.1f ",
3031 << Form(
" Dig1: Ind %d, Ch %d, Side %d, T: %6.1f ",
3041 " Wrong Digi for Tofhit %d in iDetIndx %d, Ch %d at Indx %d, %d "
3042 "from %3.0f strips: %d, %d, %d, %d",
3061 dMeanTimeSquared += TMath::Power(
3067 TMath::Log10(0.5 * (pDig0->
GetTot() + pDig1->
GetTot())),
3070 Double_t dTotWeigth = (pDig0->
GetTot() + pDig1->
GetTot()) / TotSum;
3071 Double_t dCorWeigth = 1. - dTotWeigth;
3081 if (0 == pDig0->
GetSide()) dDelPos *= -1.;
3083 pDig0->
GetChannel(), dCorWeigth * (dDelPos - hitpos_local[1]));
3089 - (1. - 2. * pDig0->
GetSide()) * hitpos_local[1]
3096 - (1. - 2. * pDig1->
GetSide()) * hitpos_local[1]
3103 - (1. - 2. * pDig0->
GetSide()) * hitpos_local[1]
3109 - (1. - 2. * pDig1->
GetSide()) * hitpos_local[1]
3113 LOG(debug1) <<
" fhTRpcCluTot: Digi 0 " << iDigInd0 <<
": Ch "
3116 << (Double_t) iCh * 2. + pDig0->
GetSide() <<
" Digi 1 "
3117 << iDigInd1 <<
": Ch " << pDig1->
GetChannel() <<
", Side "
3118 << pDig1->
GetSide() <<
", StripSide "
3119 << (Double_t) iCh * 2. + pDig1->
GetSide();
3121 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
3123 if (NULL == pHit || NULL == pTrig[iSel]) {
3124 LOG(info) <<
" invalid pHit, iSel " << iSel <<
", iDetIndx "
3134 if (
fvLastHits[iSmType][iSm][iRpc][iCh].size()
3136 std::list<CbmTofHit*>::iterator itL =
3140 iH <
fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1;
3144 TMath::Log10(pHit->
GetTime() - (*itL)->GetTime()),
3147 TMath::Log10(pHit->
GetTime() - (*itL)->GetTime()),
3153 dzscal = pHit->
GetZ() / pTrig[iSel]->
GetZ();
3155 pHit->
GetX() - dzscal * pTrig[iSel]->
GetX(),
3156 pHit->
GetY() - dzscal * pTrig[iSel]->
GetY());
3158 if (pHit->
GetZ() < pTrig[iSel]->
GetZ()) dZsign[iSel] = -1.;
3165 TMath::Power(pHit->
GetX() - dzscal * pTrig[iSel]->
GetX(),
3167 + TMath::Power(pHit->
GetY() - dzscal * pTrig[iSel]->
GetY(),
3174 - (pTrig[iSel]->
GetX()
3176 * (pHit->
GetZ() - (pTrig[iSel]->
GetZ()))),
3180 - (pTrig[iSel]->
GetY()
3182 * (pHit->
GetZ() - (pTrig[iSel]->
GetZ()))),
3189 && TMath::Abs(
dTRef - dTTrig[iSel])
3207 if (iBx < 0) iBx = 0;
3211 dTentry - ((Double_t) iBx) * dBinWidth;
3213 dDTentry < 0 ? iBx1 = iBx - 1 : iBx1 = iBx + 1;
3214 Double_t w0 = 1. - TMath::Abs(dDTentry) / dBinWidth;
3215 Double_t w1 = 1. - w0;
3216 if (iBx1 < 0) iBx1 = 0;
3219 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * w0
3220 +
fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx1][iSel]
3224 << Form(
" DelTof for SmT %d, Sm %d, R %d, T %d, dTRef "
3225 "%6.1f, Bx %d, Bx1 %d, DTe %6.1f -> DelT %6.1f",
3230 dTRef - dTTrig[iSel],
3236 dTTcor[iSel] = dDelTof * dZsign[iSel];
3237 dTcor[iSel] = pHit->
GetTime() - dDelTof - dTTrig[iSel];
3240 if (dTcor[iSel] == 0.)
continue;
3242 " TRpcCluWalk for Ev %d, Link %d(%d), Sel %d, TSR %d%d%d, "
3243 "Ch %d,%d, S %d,%d T %f, DelTof %6.1f, W-ent: %6.0f,%6.0f",
3263 << Form(
" Inconsistent walk histograms -> debugging "
3264 "necessary ... for %d, %d, %d, %d, %d, %d, %d ",
3273 LOG(debug1) << Form(
3274 " TRpcCluWalk values side %d: %f, %f, side %d: %f, %f ",
3278 + ((1. - 2. * pDig0->
GetSide()) * hitpos_local[1]
3280 - dTTcor[iSel] - dTTrig[iSel],
3284 + ((1. - 2. * pDig1->
GetSide()) * hitpos_local[1]
3286 - dTTcor[iSel] - dTTrig[iSel]);
3318 (Double_t)(iSm * iNbRpc + iRpc), dTcor[iSel]);
3324 hitpos[0] = pHit->
GetX() - dzscal * pTrig[iSel]->
GetX()
3326 hitpos[1] = pHit->
GetY() - dzscal * pTrig[iSel]->
GetY()
3328 hitpos[2] = pHit->
GetZ();
3329 gGeoManager->MasterToLocal(
3330 hitpos, hitpos_local);
3335 (pHit->
GetTime() - dTTrig[iSel]) - dTTcor[iSel]);
3344 <<
"CbmTofEventClusterizer::FillHistos: invalid digi index "
3345 << iDetIndx <<
" digi0,1" << iDigInd0 <<
", " << iDigInd1
3356 Double_t dVar = dMeanTimeSquared / (dNstrips - 1);
3358 Double_t dTrms = TMath::Sqrt(dVar);
3359 LOG(debug) << Form(
" Trms for Tofhit %d in iDetIndx %d, Ch %d from "
3360 "%3.0f strips: %6.3f ns",
3370 LOG(debug1) <<
" Fill Time of iDetIndx " << iDetIndx <<
", hitAddr "
3372 " %08x, y = %5.2f", pHit->
GetAddress(), hitpos_local[1])
3376 if (TMath::Abs(hitpos_local[1])
3380 fhSmCluTOff[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc),
3383 for (Int_t iSel = 0; iSel <
iNSel; iSel++)
3385 LOG(debug1) <<
" TRpcCluTOff " << iDetIndx <<
", Sel " << iSel
3386 << Form(
", Dt %7.3f, LHsize %lu ",
3387 pHit->
GetTime() - dTTrig[iSel],
3391 if (
fvLastHits[iSmType][iSm][iRpc][iCh].size()
3393 std::list<CbmTofHit*>::iterator itL =
3397 iH <
fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1;
3401 << Form(
" %f,", pHit->
GetTime() - (*itL)->GetTime());
3405 if (pBeamRef != NULL)
3428 if (
fvLastHits[iSmType][iSm][iRpc][iCh].size()
3430 std::list<CbmTofHit*>::iterator itL =
3433 for (Int_t iH = 0; iH < 1; iH++) {
3436 Double_t dTsinceLast = pHit->
GetTime() - (*itL)->GetTime();
3438 LOG(fatal) << Form(
"Invalid Time since last hit on channel "
3439 "TSRC %d%d%d%d: %f > %f",
3448 TMath::Log10(dTsinceLast), pHit->
GetTime() - dTTrig[iSel]);
3450 TMath::Log10(dTsinceLast),
3451 fvLastHits[iSmType][iSm][iRpc][iCh].size() - 1);
3461 LOG(debug1) <<
"CbmTofEventClusterizer::FillHistos: "
3462 << Form(
" %3d %3d %3lu ",
3467 for (UInt_t uCluster = 0;
3470 LOG(debug2) <<
"CbmTofEventClusterizer::FillHistos: "
3471 << Form(
" %3d %3d %3d ", iSmType, iRpc, uCluster);
3482 if (1 ==
fviTrkMul[iSmType][iRpc][uCluster])
3484 fvdY[iSmType][iRpc][uCluster]);
3485 if (1 <
fviTrkMul[iSmType][iRpc][uCluster])
3487 fvdY[iSmType][iRpc][uCluster]);
3489 fvdY[iSmType][iRpc][uCluster]);
3494 fvdDifX[iSmType][iRpc][uCluster]);
3496 fvdDifY[iSmType][iRpc][uCluster]);
3499 fvdDifX[iSmType][iRpc][uCluster]);
3501 fvdDifY[iSmType][iRpc][uCluster]);
3507 fvdX[iSmType][iRpc].clear();
3508 fvdY[iSmType][iRpc].clear();
3509 fvdDifX[iSmType][iRpc].clear();
3510 fvdDifY[iSmType][iRpc].clear();
3521 TDirectory* oldir = gDirectory;
3543 LOG(debug) <<
"Write triggered Histos for Det Ind " << iDetIndx
3545 for (Int_t iSel = 0; iSel <
iNSel;
3556 Int_t iSmAddr = iUniqueId &
SelMask;
3570 LOG(debug) <<
"WriteHistos: No entries in Walk histos for "
3571 <<
"Smtype" << iSmType <<
", Sm " << iSm <<
", Rpc " << iRpc;
3576 TH2* htempPos = NULL;
3577 TProfile* htempPos_pfx = NULL;
3578 TH1* htempPos_py = NULL;
3579 TProfile* htempTOff_pfx = NULL;
3580 TH1* htempTOff_px = NULL;
3581 TProfile* hAvPos_pfx = NULL;
3582 TProfile* hAvTOff_pfx = NULL;
3585 TH2* htempTot = NULL;
3586 TProfile* htempTot_pfx = NULL;
3587 TH1* htempTot_Mean = NULL;
3588 TH1* htempTot_Off = NULL;
3600 htempTOff_pfx = htempTOff->ProfileX(
3602 htempTOff_px = htempTOff->ProjectionX(
3604 for (Int_t iCh = 0; iCh < htempTOff->GetNbinsX();
3606 TH1* htempTOff_py = htempTOff->ProjectionY(
"_py", iCh + 1, iCh + 1);
3607 Double_t Ymax = htempTOff_py->GetMaximum();
3609 Int_t iBmax = htempTOff_py->GetMaximumBin();
3610 Double_t dTOffmax = htempTOff_py->GetXaxis()->GetBinCenter(iBmax);
3611 if (TMath::Abs(dTOffmax)
3612 > 0.3 * htempTOff_py->GetXaxis()->GetXmax()) {
3613 LOG(debug) <<
"Use Maximum of TOff in ch " << iCh <<
" of histo "
3614 << htempTOff->GetName() <<
": " << dTOffmax <<
", "
3615 << htempTOff_py->GetXaxis()->GetXmax() <<
" instead of "
3616 << htempTOff_pfx->GetBinContent(iCh + 1);
3617 htempTOff_pfx->SetBinContent(iCh + 1, dTOffmax);
3618 htempTOff_pfx->SetBinEntries(iCh + 1, 1);
3694 if (NULL == htempPos_pfx) {
3695 LOG(debug) <<
"WriteHistos: Projections not available, continue ";
3699 htempTot_Mean = htempTot_pfx->ProjectionX(
"_Mean");
3700 htempTot_Off = htempTot_pfx->ProjectionX(
"_Off");
3702 htempPos_pfx->SetName(
3703 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc));
3704 htempTOff_pfx->SetName(
3705 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc));
3706 htempTot_pfx->SetName(
3707 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Tot_pfx", iSmType, iSm, iRpc));
3708 htempTot_Mean->SetName(
3709 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Mean", iSmType, iSm, iRpc));
3710 htempTot_Off->SetName(
3711 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Tot_Off", iSmType, iSm, iRpc));
3712 hAvPos_pfx->SetName(Form(
"cl_CorSmT%01d_Pos_pfx", iSmType));
3713 hAvTOff_pfx->SetName(Form(
"cl_CorSmT%01d_TOff_pfx", iSmType));
3717 htempTot_Off->Reset();
3719 Int_t nbins = htempTot->GetNbinsX();
3720 for (
int i = 0;
i < nbins;
i++) {
3721 hbins[
i] = htempTot->ProjectionY(Form(
"bin%d",
i + 1),
i + 1,
i + 1);
3723 Int_t iBmax = hbins[
i]->GetMaximumBin();
3724 TAxis* xaxis = hbins[
i]->GetXaxis();
3725 Double_t Xmax = xaxis->GetBinCenter(iBmax);
3727 XOff = (Double_t)(Int_t) XOff;
3728 if (XOff < 0) XOff = 0;
3729 htempTot_Off->SetBinContent(
i + 1, XOff);
3730 Double_t Xmean = htempTot_Mean->GetBinContent(
i + 1);
3732 LOG(warning) <<
"Inconsistent Tot numbers for "
3734 "SmT%01d_sm%03d_rpc%03d bin%d: mean %f, Off %f",
3742 htempTot_Mean->SetBinContent(
i + 1, (Xmean - XOff));
3743 if (htempTot_Mean->GetBinContent(
i + 1) != (Xmean - XOff))
3745 <<
"Tot numbers not stored properly for "
3746 << Form(
"SmT%01d_sm%03d_rpc%03d bin%d: mean %f, target %f",
3751 htempTot_Mean->GetBinContent(
i + 1),
3754 htempPos_pfx->Write();
3755 htempTOff_pfx->Write();
3757 htempTot_Mean->Write();
3758 htempTot_Off->Write();
3765 <<
"WriteHistos: restore Offsets and Gains and save Walk for "
3766 <<
"Smtype" << iSmType <<
", Sm " << iSm <<
", Rpc " << iRpc
3767 <<
" and calSmAddr = " << Form(
" 0x%08x ", TMath::Abs(
fCalSmAddr));
3768 htempPos_pfx->Reset();
3769 htempTOff_pfx->Reset();
3770 htempTot_Mean->Reset();
3771 htempTot_Off->Reset();
3772 for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
3774 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
3775 -
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
3776 Double_t TMean = 0.5
3777 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
3778 +
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
3779 htempPos_pfx->Fill(iCh, YMean);
3780 if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) {
3781 LOG(error) <<
"WriteHistos: restore unsuccessful! ch " << iCh
3782 <<
" got " << htempPos_pfx->GetBinContent(iCh) <<
","
3783 << htempPos_pfx->GetBinContent(iCh + 1) <<
","
3784 << htempPos_pfx->GetBinContent(iCh + 2) <<
", expected "
3787 htempTOff_pfx->Fill(iCh, TMean);
3789 for (Int_t iSide = 0; iSide < 2; iSide++) {
3790 htempTot_Mean->SetBinContent(
3791 iCh * 2 + 1 + iSide,
3795 htempTot_Off->SetBinContent(
3796 iCh * 2 + 1 + iSide,
3797 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
3801 LOG(debug1) <<
" Offset, gain restoring done ... ";
3802 htempPos_pfx->Write();
3803 htempTOff_pfx->Write();
3805 htempTot_Mean->Write();
3806 htempTot_Off->Write();
3808 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
3810 TDirectory* curdir = gDirectory;
3812 TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny(
3813 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
3818 gDirectory->cd(curdir->GetPath());
3819 if (NULL != hCorDelTof) {
3820 TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone(
3821 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
3826 hCorDelTofout->Write();
3828 LOG(debug) <<
" No CorDelTof histo "
3829 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
3844 <<
"WriteHistos: restore Offsets and Gains and update Walk for "
3845 <<
"Smtype" << iSmType <<
", Sm " << iSm <<
", Rpc " << iRpc
3868 if (NULL == h2tmp0) {
3869 LOG(debug) << Form(
"WriteHistos: Walk histo not available for "
3870 "SmT %d, Sm %d, Rpc %d, Ch %d",
3877 Int_t iNEntries = h2tmp0->GetEntries();
3879 LOG(debug) << Form(
" Update Walk correction for SmT %d, Sm %d, "
3880 "Rpc %d, Ch %d, Sel%d: Entries %d",
3890 if (-1 < iNEntries) {
3892 h2tmp0->ProfileX(
"_pfx", 1, h2tmp0->GetNbinsY());
3894 h2tmp1->ProfileX(
"_pfx", 1, h2tmp1->GetNbinsY());
3895 TH1D* h1tmp0 = h2tmp0->ProjectionX(
"_px", 1, h2tmp0->GetNbinsY());
3896 TH1D* h1tmp1 = h2tmp1->ProjectionX(
"_px", 1, h2tmp1->GetNbinsY());
3899 TH1D* h1ytmp1 = h2tmp1->ProjectionY(
"_py", 1,
nbClWalkBinX);
3900 Double_t dWMean0 = h1ytmp0->GetMean();
3901 Double_t dWMean1 = h1ytmp1->GetMean();
3902 Double_t dWMean = 0.5 * (dWMean0 + dWMean1);
3905 if (5 == iSmType || 8 == iSmType)
3911 if (h1tmp0->GetBinContent(iWx + 1) >
WalkNHmin
3912 && h1tmp1->GetBinContent(iWx + 1) >
WalkNHmin) {
3915 (((TProfile*) htmp0)->GetBinContent(iWx + 1)
3916 + ((TProfile*) htmp1)->GetBinContent(iWx + 1))
3918 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] +=
3920 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] +=
3923 "Walk for TSR %d%d%d%d Tot %d set to %f",
3929 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
3933 if (h1tmp0->GetBinContent(iWx + 1) >
WalkNHmin
3934 && h1tmp1->GetBinContent(iWx + 1) >
WalkNHmin) {
3936 ((TProfile*) htmp0)->GetBinContent(iWx + 1) - dWMean0;
3938 ((TProfile*) htmp1)->GetBinContent(iWx + 1) - dWMean1;
3939 Double_t dWcor = 0.5 * (dWcor0 + dWcor1);
3940 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] +=
3942 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] +=
3945 if (iCh == 0 && iSmType == 9 && iSm == 0
3946 && h1tmp0->GetBinContent(iWx + 1) >
WalkNHmin)
3948 <<
"Update Walk Sm = " << iSm <<
"(" << iNbRpc
3949 <<
"), Rpc " << iRpc <<
", Bin " << iWx <<
", "
3950 << h1tmp0->GetBinContent(iWx + 1) <<
" cts: "
3951 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]
3953 << ((TProfile*) htmp0)->GetBinContent(iWx + 1)
3954 <<
" - " << dWMean0 <<
" -> " << dWcor - dWMean0
3956 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]
3958 << ((TProfile*) htmp1)->GetBinContent(iWx + 1)
3959 <<
" - " << dWMean1 <<
" -> " << dWcor - dWMean1;
3963 if (h1tmp0->GetBinContent(iWx + 1) >
WalkNHmin
3964 && h1tmp1->GetBinContent(iWx + 1) >
WalkNHmin) {
3966 ((TProfile*) htmp0)->GetBinContent(iWx + 1) - dWMean0;
3968 ((TProfile*) htmp1)->GetBinContent(iWx + 1) - dWMean1;
3970 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx] +=
3972 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx] +=
3983 h1tmp0->SetBinContent(
3984 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
3985 h1tmp1->SetBinContent(
3986 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]);
3990 && h1tmp0->GetBinContent(iWx + 1)
3991 !=
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) {
3992 h1tmp0->SetBinContent(
3994 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
3998 <<
"writing not successful for " << h1tmp0->GetName()
3999 <<
", attempts left: " << iTry <<
", iWx " << iWx
4000 <<
", got " << h1tmp0->GetBinContent(iWx + 1)
4002 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx];
4006 && h1tmp1->GetBinContent(iWx + 1)
4007 !=
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]) {
4008 h1tmp1->SetBinContent(
4010 fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]);
4014 <<
"writing not successful for " << h1tmp1->GetName()
4015 <<
", attempts left: " << iTry <<
", iWx " << iWx
4016 <<
", got " << h1tmp1->GetBinContent(iWx + 1)
4018 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx];
4022 Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
4030 Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
4045 TH1D* h1tmp0 =
fhRpcCluWalk[iDetIndx][iCh][0]->ProjectionX(
4047 TH1D* h1tmp1 =
fhRpcCluWalk[iDetIndx][iCh][1]->ProjectionX(
4050 h1tmp0->SetBinContent(
4051 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
4052 h1tmp1->SetBinContent(
4053 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]);
4054 if (h1tmp0->GetBinContent(iWx + 1)
4055 !=
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) {
4057 <<
"WriteHistos: restore unsuccessful! iWx " << iWx <<
" got "
4058 << h1tmp0->GetBinContent(iWx + 1) <<
", expected "
4059 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx];
4062 h1tmp0->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
4069 h1tmp1->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
4088 LOG(debug) <<
"WriteHistos: (case 2) update Offsets and keep Gains, "
4089 "Walk and DELTOF for "
4090 <<
"Smtype" << iSmType <<
", Sm " << iSm <<
", Rpc "
4092 Int_t iB = iSm * iNbRpc + iRpc;
4093 Double_t dVscal = 1.;
4096 fhSmCluSvel[iSmType]->GetBinContent(iSm * iNbRpc + iRpc + 1);
4097 if (dVscal == 0.) dVscal = 1.;
4099 Double_t YMean = ((TProfile*) hAvPos_pfx)
4100 ->GetBinContent(iB + 1);
4102 htempPos->ProjectionY(Form(
"%s_py", htempPos->GetName()), 1, iNbCh);
4104 LOG(debug1) << Form(
"Determine YMean in %s by fit to %d entries",
4105 htempPos->GetName(),
4106 (Int_t) htempPos_py->GetEntries());
4112 LOG(warning) << Form(
"invalid ChannelInfo for 0x%08x", iChId);
4116 TF1* ff = htempPos_py->GetFunction(
"YBox");
4118 LOG(info) <<
"FRes YBox " << htempPos_py->GetEntries()
4119 <<
" entries in TSR " << iSmType << iSm << iRpc
4120 <<
", chi2 " << ff->GetChisquare() / ff->GetNDF()
4122 ", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos "
4123 "res %5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f",
4126 2. * ff->GetParameter(1),
4127 2. * ff->GetParError(1),
4128 ff->GetParameter(2),
4130 ff->GetParameter(3),
4131 ff->GetParError(3));
4134 - 2. * ff->GetParameter(1))
4137 && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1)) < 0.2)
4140 if (TMath::Abs(ff->GetParameter(3) - YMean)
4142 YMean = ff->GetParameter(3);
4144 / (2. * ff->GetParameter(1));
4145 fhSmCluSvel[iSmType]->Fill((Double_t)(iSm * iNbRpc + iRpc),
4153 fhSmCluTOff[iSmType]->ProjectionY(
"_py", iB + 1, iB + 1);
4154 Double_t Ymax = hAvTOff_py->GetMaximum();
4155 Double_t dTOffmax = 0.;
4157 Int_t iBmax = hAvTOff_py->GetMaximumBin();
4158 dTOffmax = hAvTOff_py->GetXaxis()->GetBinCenter(iBmax);
4160 Double_t TMean = ((TProfile*) hAvTOff_pfx)->GetBinContent(iB + 1);
4161 if (TMath::Abs(dTOffmax - TMean) > 2. * TMean) {
4163 LOG(debug) <<
"Use peak position for TOff of TSR " << iSmType << iSm
4164 << iRpc <<
", B= " << iB <<
": " << TMean;
4166 Double_t TWidth = ((TProfile*) hAvTOff_pfx)->GetBinError(iB + 1);
4171 LOG(debug) << Form(
"<ICor> Correct TSR %d%d%d by TMean=%8.2f, "
4172 "TYOff=%8.2f, TWidth=%8.2f, ",
4180 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4182 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean;
4183 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean;
4185 LOG(debug) <<
"FillCalHist:"
4186 <<
" SmT " << iSmType <<
" Sm " << iSm <<
" Rpc " << iRpc
4187 <<
" Ch " << iCh <<
": YMean " << YMean <<
", TMean "
4191 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
4192 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1],
4193 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0],
4194 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
4197 htempPos_pfx->Reset();
4198 htempTOff_pfx->Reset();
4199 htempTot_Mean->Reset();
4200 htempTot_Off->Reset();
4201 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4204 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
4205 -
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
4206 Double_t TMean = 0.5
4207 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
4208 +
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
4209 htempPos_pfx->Fill(iCh, YMean);
4210 if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) {
4211 LOG(error) <<
"WriteHistos: restore unsuccessful! ch " << iCh
4212 <<
" got " << htempPos_pfx->GetBinContent(iCh) <<
","
4213 << htempPos_pfx->GetBinContent(iCh + 1) <<
","
4214 << htempPos_pfx->GetBinContent(iCh + 2) <<
", expected "
4217 htempTOff_pfx->Fill(iCh, TMean);
4219 for (Int_t iSide = 0; iSide < 2; iSide++) {
4220 htempTot_Mean->SetBinContent(
4221 iCh * 2 + 1 + iSide,
4225 htempTot_Off->SetBinContent(
4226 iCh * 2 + 1 + iSide,
4227 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
4231 LOG(debug1) <<
" Updating done ... write to file ";
4232 htempPos_pfx->Write();
4233 htempTOff_pfx->Write();
4235 htempTot_Mean->Write();
4236 htempTot_Off->Write();
4239 LOG(debug) <<
" Copy old DelTof histos from " << gDirectory->GetName()
4242 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
4244 TDirectory* curdir = gDirectory;
4246 TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny(
4247 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4252 gDirectory->cd(curdir->GetPath());
4253 if (NULL != hCorDelTof) {
4254 TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone(
4255 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4260 hCorDelTofout->Write();
4262 LOG(debug) <<
" No CorDelTof histo "
4263 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4272 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4281 h1tmp0->SetBinContent(
4282 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
4283 h1tmp1->SetBinContent(
4284 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]);
4285 if (h1tmp0->GetBinContent(iWx + 1)
4286 !=
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) {
4287 LOG(error) <<
"WriteHistos: restore unsuccessful! iWx " << iWx
4288 <<
" got " << h1tmp0->GetBinContent(iWx + 1)
4290 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx];
4293 h1tmp0->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
4300 h1tmp1->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
4317 LOG(debug) <<
"WriteHistos (calMode==3): update Offsets and Gains, "
4318 "keep Walk and DelTof for "
4319 <<
"Smtype" << iSmType <<
", Sm " << iSm <<
", Rpc "
4320 << iRpc <<
" with " << iNbCh <<
" channels "
4321 <<
" using selector " <<
fCalSel;
4328 Double_t dVscal = 1.;
4333 fhSmCluSvel[iSmType]->GetBinContent(iSm * iNbRpc + iRpc + 1);
4334 if (dVscal == 0.) dVscal = 1.;
4335 dVW =
fhSmCluSvel[iSmType]->GetBinEffectiveEntries(iSm * iNbRpc
4338 if (dVW < 0.1) dVW = 0.1;
4343 htempPos->ProjectionY(Form(
"%s_py", htempPos->GetName()), 1, iNbCh);
4344 Double_t dYMeanAv = 0.;
4345 Double_t dYMeanFit = 0.;
4347 dYMeanAv = htempPos_py->GetMean();
4348 LOG(debug1) << Form(
"Determine YMeanAv in %s by fit to %d entries",
4349 htempPos->GetName(),
4350 (Int_t) htempPos_py->GetEntries());
4356 LOG(warning) << Form(
"invalid ChannelInfo for 0x%08x", iChId);
4360 TF1* ff = htempPos_py->GetFunction(
"YBox");
4363 - 2. * ff->GetParameter(1))
4366 && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1))
4369 / (2. * ff->GetParameter(1));
4370 LOG(info) <<
"FAvRes YBox " << htempPos_py->GetEntries()
4371 <<
" entries in TSR " << iSmType << iSm << iRpc
4372 <<
", stat: " << gMinuit->fCstatu <<
", chi2 "
4373 << ff->GetChisquare() / ff->GetNDF()
4374 << Form(
", striplen (%5.2f): %7.2f+/-%5.2f, pos res "
4375 "%5.2f+/-%5.2f at y_cen = %5.2f+/-%5.2f",
4377 2. * ff->GetParameter(1),
4378 2. * ff->GetParError(1),
4379 ff->GetParameter(2),
4381 ff->GetParameter(3),
4382 ff->GetParError(3));
4383 if (TMath::Abs(ff->GetParameter(3) - dYMeanAv)
4385 dYMeanFit = ff->GetParameter(3);
4387 (Double_t)(iSm * iNbRpc + iRpc), dV, dVW);
4388 for (Int_t iPar = 0; iPar < 4; iPar++)
4390 (Double_t)(iSm * iNbRpc + iRpc),
4391 ff->GetParameter(2 + iPar));
4395 <<
"FAvBad YBox " << htempPos_py->GetEntries()
4396 <<
" entries in " << iSmType << iSm << iRpc <<
", chi2 "
4397 << ff->GetChisquare()
4398 << Form(
", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos res "
4399 "%5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f",
4402 2. * ff->GetParameter(1),
4403 2. * ff->GetParError(1),
4404 ff->GetParameter(2),
4406 ff->GetParameter(3),
4407 ff->GetParError(3));
4410 LOG(info) <<
"FAvFailed for TSR " << iSmType << iSm << iRpc;
4413 Double_t dYShift = dYMeanFit - dYMeanAv;
4417 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4420 ((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1);
4423 htempPos_py = htempPos->ProjectionY(
4424 Form(
"%s_py%02d", htempPos->GetName(), iCh), iCh + 1, iCh + 1);
4425 if (htempPos_py->GetEntries() >
fdYFitMin
4427 LOG(debug1) << Form(
4428 "Determine YMean in %s of channel %d by fit to %d entries",
4429 htempPos->GetName(),
4431 (Int_t) htempPos_py->GetEntries());
4437 LOG(warning) << Form(
"invalid ChannelInfo for 0x%08x", iChId);
4440 Double_t fp[4] = {1., 3 * 0.};
4441 for (Int_t iPar = 2; iPar < 4; iPar++)
4443 fp[iPar] =
fhSmCluFpar[iSmType][iPar]->GetBinContent(
4444 iSm * iNbRpc + iRpc + 1);
4447 Double_t* fpp = &fp[0];
4449 TF1* ff = htempPos_py->GetFunction(
"YBox");
4452 - 2. * ff->GetParameter(1))
4455 && TMath::Abs(ff->GetParError(1) / ff->GetParameter(1))
4459 if (TMath::Abs(ff->GetParameter(3) - YMean)
4461 YMean = ff->GetParameter(3);
4463 / (2. * ff->GetParameter(1));
4465 (Double_t)(iSm * iNbRpc + iRpc), dV, dVW);
4466 LOG(info) <<
"FRes YBox " << htempPos_py->GetEntries()
4467 <<
" entries in " << iSmType << iSm << iRpc << iCh
4468 <<
", chi2 " << ff->GetChisquare()
4469 << Form(
", striplen (%5.2f), %4.2f -> %4.2f, "
4470 "%4.1f: %7.2f+/-%5.2f, pos res "
4471 "%5.2f+/-%5.2f at y_cen = %5.2f+/-%5.2f",
4476 2. * ff->GetParameter(1),
4477 2. * ff->GetParError(1),
4478 ff->GetParameter(2),
4480 ff->GetParameter(3),
4481 ff->GetParError(3));
4482 for (Int_t iPar = 0; iPar < 4; iPar++)
4484 (Double_t)(iSm * iNbRpc + iRpc),
4485 ff->GetParameter(2 + iPar));
4490 <<
"FBad YBox " << htempPos_py->GetEntries()
4491 <<
" entries in " << iSmType << iSm << iRpc << iCh
4492 <<
", chi2 " << ff->GetChisquare()
4493 << Form(
", striplen (%5.2f), %4.2f: %7.2f +/- %5.2f, pos "
4494 "res %5.2f +/- %5.2f at y_cen = %5.2f +/- %5.2f",
4497 2. * ff->GetParameter(1),
4498 2. * ff->GetParError(1),
4499 ff->GetParameter(2),
4501 ff->GetParameter(3),
4502 ff->GetParError(3));
4508 ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1);
4517 for (Int_t iRefCh = 0; iRefCh < iNbCh; iRefCh++) {
4518 if (0 != ((TH1*) htempTOff_px)->GetBinContent(iRefCh + 1)) {
4519 dW += ((TH1*) htempTOff_px)->GetBinContent(iRefCh + 1);
4521 ((TProfile*) htempTOff_pfx)->GetBinContent(iRefCh + 1)
4522 * ((TH1*) htempTOff_px)->GetBinContent(iRefCh + 1);
4530 if (htempTOff_px->GetBinContent(iCh + 1) > 0.)
4532 "CalibA %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, TM %8.3f , "
4533 "TAV %8.3f, TWM %8.3f, TOff %8.3f, TOffnew %8.3f, ",
4541 htempTOff_px->GetBinContent(iCh + 1),
4543 ((TProfile*) hAvTOff_pfx)
4544 ->GetBinContent(iSm * iNbRpc + iRpc + 1),
4546 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
4547 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] + TMean
4553 if (htempTOff_px->GetBinContent(iCh + 1) >
WalkNHmin) {
4554 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean;
4555 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean;
4557 "CalibB %d,%2d,%2d: TSRC %d%d%d%d, hits %6.0f, dTY %8.3f, TM "
4558 "%8.3f -> new Off %8.3f,%8.3f ",
4566 htempTOff_px->GetBinContent(iCh + 1),
4569 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
4570 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
4579 for (Int_t iSide = 0; iSide < 2; iSide++) {
4580 Int_t ib = iCh * 2 + 1 + iSide;
4581 TH1* hbin = htempTot->ProjectionY(Form(
"bin%d", ib), ib, ib);
4582 if (100 > hbin->GetEntries())
4585 Int_t iBmax = hbin->GetMaximumBin();
4586 TAxis* xaxis = hbin->GetXaxis();
4588 xaxis->GetBinCenter(iBmax)
4589 /
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide];
4594 <<
"XOff changed for "
4595 << Form(
"SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f",
4601 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
4604 Double_t TotMean = hbin->GetMean();
4605 if (15 == iSmType) {
4608 << Form(
"SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, "
4609 "gain %f, modg %f ",
4615 htempTot_Mean->GetBinContent(ib),
4616 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide],
4619 if (0.001 < TotMean) {
4620 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *=
4625 &&
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]
4626 !=
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh]
4629 <<
"CbmTofEventClusterizer::FillCalHist:"
4630 <<
" SmT " << iSmType <<
" Sm " << iSm <<
" Rpc " << iRpc
4631 <<
" Ch " << iCh <<
": YMean " << YMean <<
", TMean " << TMean
4633 << Form(
" %f %f %f %f ",
4634 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
4635 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1],
4636 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0],
4637 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
4640 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]
4641 +
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
4644 * (
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0]
4645 +
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
4646 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dTOff;
4647 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = dTOff;
4648 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dGain;
4649 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] = dGain;
4654 htempPos_pfx->Reset();
4655 htempTOff_pfx->Reset();
4656 htempTot_Mean->Reset();
4657 htempTot_Off->Reset();
4659 Double_t TOff0_mean = 0.;
4660 Double_t TOff1_mean = 0.;
4661 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4663 TOff0_mean +=
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0];
4664 TOff1_mean +=
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1];
4666 TOff0_mean /= (Double_t) iNbCh;
4667 TOff1_mean /= (Double_t) iNbCh;
4669 const Double_t TMaxDev = 1.;
4670 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4672 if (TMath::Abs(TOff0_mean
4673 -
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0])
4675 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] = TOff0_mean;
4676 if (TMath::Abs(TOff1_mean
4677 -
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1])
4679 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = TOff1_mean;
4682 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4685 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
4686 -
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
4687 Double_t TMean = 0.5
4688 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
4689 +
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
4690 htempPos_pfx->Fill(iCh, YMean);
4691 if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) {
4692 LOG(error) <<
"WriteHistos: restore unsuccessful! ch " << iCh
4693 <<
" got " << htempPos_pfx->GetBinContent(iCh) <<
","
4694 << htempPos_pfx->GetBinContent(iCh + 1) <<
","
4695 << htempPos_pfx->GetBinContent(iCh + 2) <<
", expected "
4698 htempTOff_pfx->Fill(iCh, TMean);
4700 for (Int_t iSide = 0; iSide < 2; iSide++) {
4701 htempTot_Mean->SetBinContent(
4702 iCh * 2 + 1 + iSide,
4704 /
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
4705 htempTot_Off->SetBinContent(
4706 iCh * 2 + 1 + iSide,
4707 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
4713 LOG(debug1) <<
" Updating done ... write to file ";
4714 htempPos_pfx->Write();
4715 htempTOff_pfx->Write();
4717 htempTot_Mean->Write();
4718 htempTot_Off->Write();
4721 LOG(debug) <<
" Copy old DelTof histos from " << gDirectory->GetName()
4724 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
4726 TDirectory* curdir = gDirectory;
4728 TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny(
4729 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4734 gDirectory->cd(curdir->GetPath());
4735 if (NULL != hCorDelTof) {
4736 TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone(
4737 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4742 hCorDelTofout->Write();
4744 LOG(debug) <<
" No CorDelTof histo "
4745 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4753 LOG(debug) <<
" Store old walk histos to file ";
4755 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4765 h1tmp0->SetBinContent(
4766 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
4767 h1tmp1->SetBinContent(
4768 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]);
4769 if (h1tmp0->GetBinContent(iWx + 1)
4770 !=
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) {
4771 LOG(error) <<
"WriteHistos: restore unsuccessful! iWx " << iWx
4772 <<
" got " << h1tmp0->GetBinContent(iWx + 1)
4774 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx];
4777 h1tmp0->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
4784 h1tmp1->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
4798 <<
"WriteHistos: restore Offsets, Gains and Walk, save DelTof for "
4799 <<
"Smtype" << iSmType <<
", Sm " << iSm <<
", Rpc " << iRpc;
4800 htempPos_pfx->Reset();
4801 htempTOff_pfx->Reset();
4802 htempTot_Mean->Reset();
4803 htempTot_Off->Reset();
4804 for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
4806 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
4807 -
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
4808 Double_t TMean = 0.5
4809 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
4810 +
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
4811 htempPos_pfx->Fill(iCh, YMean);
4812 if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) {
4813 LOG(error) <<
"WriteHistos: restore unsuccessful! ch " << iCh
4814 <<
" got " << htempPos_pfx->GetBinContent(iCh) <<
","
4815 << htempPos_pfx->GetBinContent(iCh + 1) <<
","
4816 << htempPos_pfx->GetBinContent(iCh + 2) <<
", expected "
4819 htempTOff_pfx->Fill(iCh, TMean);
4821 for (Int_t iSide = 0; iSide < 2; iSide++) {
4822 htempTot_Mean->SetBinContent(
4823 iCh * 2 + 1 + iSide,
4827 htempTot_Off->SetBinContent(
4828 iCh * 2 + 1 + iSide,
4829 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
4833 LOG(debug1) <<
" Restoring of Offsets and Gains done ... ";
4834 htempPos_pfx->Write();
4835 htempTOff_pfx->Write();
4837 htempTot_Mean->Write();
4838 htempTot_Off->Write();
4841 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4851 h1tmp0->SetBinContent(
4852 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
4853 h1tmp1->SetBinContent(
4854 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]);
4855 if (h1tmp0->GetBinContent(iWx + 1)
4856 !=
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) {
4857 LOG(error) <<
"WriteHistos: restore unsuccessful! iWx " << iWx
4858 <<
" got " << h1tmp0->GetBinContent(iWx + 1)
4860 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx];
4863 h1tmp0->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
4870 h1tmp1->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
4888 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
4890 if (NULL == h2tmp) {
4892 "WriteHistos: histo not available for SmT %d, Sm %d, Rpc %d",
4898 Int_t iNEntries = h2tmp->GetEntries();
4901 TProfile* htmp = h2tmp->ProfileX(
"_pfx", 1, h2tmp->GetNbinsY());
4902 TH1D* h1tmp = h2tmp->ProjectionX(
"_px", 1, h2tmp->GetNbinsY());
4906 Double_t dNEntriesSum = 0.;
4908 Double_t dNEntries = h1tmp->GetBinContent(iBx + 1);
4911 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] +=
4912 ((TProfile*) htmp)->GetBinContent(iBx + 1);
4914 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] * dNEntries;
4915 dNEntriesSum += dNEntries;
4917 dDelMean /= dNEntriesSum;
4919 LOG(debug) << Form(
" Update DelTof correction for SmT %d, Sm %d, "
4920 "Rpc %d, Sel%d: Entries %d, Mean shift %6.1f",
4929 h1tmp->SetBinContent(
4931 fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iSel] - dDelMean);
4934 h1tmp->SetName(Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4942 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
4944 TDirectory* curdir = gDirectory;
4946 TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny(
4947 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4952 gDirectory->cd(curdir->GetPath());
4953 if (NULL != hCorDelTof) {
4954 TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone(
4955 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4960 LOG(debug) <<
" Save existing CorDelTof histo "
4961 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4966 hCorDelTofout->Write();
4968 LOG(debug) <<
" No CorDelTof histo "
4969 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
4985 LOG(debug) <<
"WriteHistos (calMode==5): update Offsets and Gains, "
4986 "keep Walk and DelTof for "
4987 <<
"Smtype" << iSmType <<
", Sm " << iSm <<
", Rpc "
4988 << iRpc <<
" with " << iNbCh <<
" channels "
4989 <<
" using selector " <<
fCalSel;
4991 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
4993 Double_t YMean = ((TProfile*) htempPos_pfx)
4994 ->GetBinContent(iCh + 1);
4995 Double_t TMean = 0.;
5000 if (htempTOff_px->GetBinContent(iCh + 1) >
WalkNHmin) {
5001 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean;
5002 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean;
5004 LOG(debug3) << Form(
5005 "Calib: TSRC %d%d%d%d, hits %6.0f, new Off %8.0f,%8.0f ",
5010 htempTOff_px->GetBinContent(iCh + 1),
5011 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
5012 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
5021 for (Int_t iSide = 0; iSide < 2; iSide++) {
5022 Int_t ib = iCh * 2 + 1 + iSide;
5023 TH1* hbin = htempTot->ProjectionY(Form(
"bin%d", ib), ib, ib);
5024 if (100 > hbin->GetEntries())
5027 Int_t iBmax = hbin->GetMaximumBin();
5028 TAxis* xaxis = hbin->GetXaxis();
5030 xaxis->GetBinCenter(iBmax)
5031 /
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide];
5036 <<
"XOff changed for "
5037 << Form(
"SmT%01d_sm%03d_rpc%03d_Side%d: XOff %f, old %f",
5043 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
5046 Double_t TotMean = hbin->GetMean();
5047 if (15 == iSmType) {
5050 << Form(
"SmT%01d_sm%03d_rpc%03d_Side%d: TotMean %f, prof %f, "
5051 "gain %f, modg %f ",
5057 htempTot_Mean->GetBinContent(ib),
5058 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide],
5061 if (0.001 < TotMean) {
5062 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *=
5067 &&
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]
5068 !=
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh]
5071 <<
"CbmTofEventClusterizer::FillCalHist:"
5072 <<
" SmT " << iSmType <<
" Sm " << iSm <<
" Rpc " << iRpc
5073 <<
" Ch " << iCh <<
": YMean " << YMean <<
", TMean " << TMean
5075 << Form(
" %f %f %f %f ",
5076 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
5077 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1],
5078 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0],
5079 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
5082 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]
5083 +
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
5086 * (
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0]
5087 +
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
5088 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dTOff;
5089 fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] = dTOff;
5090 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] = dGain;
5091 fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] = dGain;
5096 htempPos_pfx->Reset();
5097 htempTOff_pfx->Reset();
5098 htempTot_Mean->Reset();
5099 htempTot_Off->Reset();
5100 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
5103 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
5104 -
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
5105 Double_t TMean = 0.5
5106 * (
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
5107 +
fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]);
5108 htempPos_pfx->Fill(iCh, YMean);
5109 if (((TProfile*) htempPos_pfx)->GetBinContent(iCh + 1) != YMean) {
5110 LOG(error) <<
"WriteHistos: restore unsuccessful! ch " << iCh
5111 <<
" got " << htempPos_pfx->GetBinContent(iCh) <<
","
5112 << htempPos_pfx->GetBinContent(iCh + 1) <<
","
5113 << htempPos_pfx->GetBinContent(iCh + 2) <<
", expected "
5116 htempTOff_pfx->Fill(iCh, TMean);
5118 for (Int_t iSide = 0; iSide < 2; iSide++) {
5119 htempTot_Mean->SetBinContent(
5120 iCh * 2 + 1 + iSide,
5122 /
fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
5123 htempTot_Off->SetBinContent(
5124 iCh * 2 + 1 + iSide,
5125 fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide]);
5131 LOG(debug1) <<
" Updating done ... write to file ";
5132 htempPos_pfx->Write();
5133 htempTOff_pfx->Write();
5135 htempTot_Mean->Write();
5136 htempTot_Off->Write();
5139 LOG(debug) <<
" Copy old DelTof histos from " << gDirectory->GetName()
5142 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
5144 TDirectory* curdir = gDirectory;
5146 TH1D* hCorDelTof = (TH1D*) gDirectory->FindObjectAny(
5147 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
5152 gDirectory->cd(curdir->GetPath());
5153 if (NULL != hCorDelTof) {
5154 TH1D* hCorDelTofout = (TH1D*) hCorDelTof->Clone(
5155 Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
5160 hCorDelTofout->Write();
5162 LOG(debug) <<
" No CorDelTof histo "
5163 << Form(
"cl_CorSmT%01d_sm%03d_rpc%03d_Sel%02d_DelTof",
5171 LOG(debug) <<
" Store old walk histos to file ";
5173 for (Int_t iCh = 0; iCh < iNbCh; iCh++)
5183 h1tmp0->SetBinContent(
5184 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]);
5185 h1tmp1->SetBinContent(
5186 iWx + 1,
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iWx]);
5187 if (h1tmp0->GetBinContent(iWx + 1)
5188 !=
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx]) {
5189 LOG(error) <<
"WriteHistos: restore unsuccessful! iWx " << iWx
5190 <<
" got " << h1tmp0->GetBinContent(iWx + 1)
5192 <<
fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iWx];
5195 h1tmp0->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
5202 h1tmp1->SetName(Form(
"Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
5214 LOG(debug) <<
"WriteHistos: update mode " <<
fCalMode
5215 <<
" not yet implemented";
5259 for (Int_t iPar = 0; iPar < 4; iPar++)
5262 for (Int_t iSel = 0; iSel <
iNSel; iSel++) {
5270 gDirectory->cd(oldir->GetPath());
5313 gGeoManager->CdTop();
5317 LOG(info) <<
" No RawDigis defined ! Check! ";
5322 <<
"Build clusters from "
5330 if (iNbTofDigi > 100000) {
5331 LOG(warning) <<
"Too many digis in event " <<
fiNevtBuild;
5337 for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) {
5349 (0 == pDigi->
GetSide()) ? 1 : 0,
5358 for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) {
5361 LOG(debug) << iDigInd <<
" " << pDigi
5362 << Form(
" Address : 0x%08x ", pDigi->
GetAddress()) <<
" SmT "
5363 << pDigi->
GetType() <<
" Sm " << pDigi->
GetSm() <<
" Rpc "
5380 LOG(warning) << Form(
5381 " DigiCor Histo for DetIndx %d derived from 0x%08x not found",
5405 for (Int_t iDigI2 = 0; iDigI2 < iNbTofDigi; iDigI2++) {
5420 Double_t dTDif = TMath::Abs(pDigi->
GetTime() - pDigi2->
GetTime());
5421 if (dTDif < dTDifMin) {
5430 for (; iDigI3 < iNbTofDigi; iDigI3++) {
5437 if (iDigI3 == iNbTofDigi)
5444 LOG(debug2) << Form(
"shift channel %d%d%d%d%d and ",
5446 (Int_t) pDigi->
GetSm(),
5450 << Form(
" %d%d%d%d%d ",
5452 (Int_t) pDigi2->
GetSm(),
5453 (Int_t) pDigi2->
GetRpc(),
5470 LOG(debug2) << Form(
"resultchannel %d%d%d%d%d and ",
5472 (Int_t) pDigi->
GetSm(),
5476 << Form(
" %d%d%d%d%d ",
5478 (Int_t) pDigi2->
GetSm(),
5479 (Int_t) pDigi2->
GetRpc(),
5513 if (pDigi2Min != NULL) {
5523 LOG(warning) << Form(
"BuildClusters: invalid ChannelInfo for 0x%08x",
5536 <<
" BuildClusters: Inconsistent duplicated digis in event "
5538 LOG(warning) <<
" " << pDigi->
ToString();
5539 LOG(warning) <<
" " << pDigi2Min->
ToString();
5572 for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) {
5575 LOG(debug1) <<
"AC "
5576 << Form(
"0x%08x", pDigi->
GetAddress()) <<
" TSRC "
5578 << Form(
"%2d", (Int_t) pDigi->
GetChannel()) <<
" "
5580 <<
" " << pDigi->
GetTot();
5595 .push_back(iDigInd);
5597 LOG(info) <<
"Skip2 Digi "
5598 <<
" Type " << pDigi->
GetType() <<
" "
5601 << pDigi->
GetRpc() <<
" "
5610 for (Int_t iDetIndx = 0; iDetIndx < iNbDet; iDetIndx++) {
5616 for (Int_t iStrip = 0; iStrip < iNbStrips; iStrip++) {
5624 if (iDigiMul == 1) {
5638 + iRpc][iStrip - 1][0]
5643 if (iStrip < iNbStrips - 2) {
5655 + iRpc][iStrip + 1][0]
5670 LOG(error) <<
" Compressed Digis not implemented ... ";
5679 LOG(info) <<
" No Hits defined ! Check! ";
5683 for (Int_t iHitInd = 0; iHitInd <
fTofHitsColl->GetEntries(); iHitInd++) {
5685 if (NULL == pHit)
continue;
5690 if (iSmType != 5 && iSmType != 8)
continue;
5691 LOG(debug) <<
"MergeClusters: in SmT " << iSmType <<
" for " << iNbRpc
5700 LOG(debug) <<
"MergeClusters: Check for mergers in "
5701 << Form(
" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d",
5707 for (Int_t iHitInd2 = iHitInd + 1; iHitInd2 <
fTofHitsColl->GetEntries();
5710 if (NULL == pHit2)
continue;
5713 if (iSmType2 == iSmType) {
5715 if (iSm2 == iSm || iSmType == 5) {
5717 if (TMath::Abs(iRpc - iRpc2) == 1
5722 Double_t xPos = pHit->
GetX();
5723 Double_t yPos = pHit->
GetY();
5724 Double_t tof = pHit->
GetTime();
5725 Double_t xPos2 = pHit2->
GetX();
5726 Double_t yPos2 = pHit2->
GetY();
5727 Double_t tof2 = pHit2->
GetTime();
5728 LOG(debug) <<
"MergeClusters: Found hit in neighbour "
5729 << Form(
" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d",
5735 << Form(
" DX %6.1f, DY %6.1f, DT %6.1f",
5748 for (Int_t iLink = 0; iLink < digiMatch->
GetNofLinks();
5752 UInt_t iDigInd1 = (digiMatch->
GetLink(iLink + 1)).GetIndex();
5754 if (iDigInd0 < fTofCalDigiVec->size()
5768 for (Int_t iLink = 0; iLink < digiMatch2->
GetNofLinks();
5772 UInt_t iDigInd1 = (digiMatch2->
GetLink(iLink + 1)).GetIndex();
5774 if (iDigInd0 < fTofCalDigiVec->size()
5780 dTot2 += pDig0->
GetTot();
5781 dTot2 += pDig1->
GetTot();
5792 LOG(debug) <<
"MergeClusters: Found merger in neighbour "
5793 << Form(
" SmT %d, Sm %d, Rpc %d, Ch %d - hit %d(%d)",
5800 << Form(
" DX %6.1f, DY %6.1f, DT %6.1f",
5804 << Form(
" Tots %6.1f - %6.1f", dTot, dTot2);
5805 Double_t dTotSum = dTot + dTot2;
5806 Double_t dxPosM = (xPos * dTot + xPos2 * dTot2) / dTotSum;
5807 Double_t dyPosM = (yPos * dTot + yPos2 * dTot2) / dTotSum;
5808 Double_t dtofM = (tof * dTot + tof2 * dTot2) / dTotSum;
5819 LOG(debug) <<
"MergeClusters: Compress TClonesArrays to "
5842 double wx = 1. - par[4] * TMath::Power(xx + par[5], 2);
5843 double xboxe = par[0] * 0.25
5844 * (1. + TMath::Erf((xx + par[1] - par[3]) / par[2]))
5845 * (1. + TMath::Erf((-xx + par[1] + par[3]) / par[2]));
5851 h1 = (TH1*) gROOT->FindObjectAny(hname);
5852 if (NULL != h1) {
fit_ybox(h1, 0.); }
5856 Double_t* fpar = NULL;
5862 Double_t* fpar = NULL) {
5863 TAxis* xaxis = h1->GetXaxis();
5864 Double_t Ymin = xaxis->GetXmin();
5865 Double_t Ymax = xaxis->GetXmax();
5866 TF1* f1 =
new TF1(
"YBox",
f1_xboxe, Ymin, Ymax, 6);
5867 Double_t yini = (h1->GetMaximum() + h1->GetMinimum()) * 0.5;
5868 if (ysize == 0.) ysize = Ymax * 0.8;
5869 f1->SetParameters(yini, ysize * 0.5, 1., 0., 0., 0.);
5871 f1->SetParLimits(2, 0.2, 3.);
5872 f1->SetParLimits(3, -4., 4.);
5875 for (Int_t
i = 0;
i < 4;
i++)
5877 for (Int_t
i = 0;
i < 4;
i++)
5878 f1->SetParameter(2 +
i, fp[
i]);
5879 LOG(debug) <<
"Ini Fpar for " << h1->GetName() <<
" with "
5880 << Form(
" %6.3f %6.3f %6.3f %6.3f ", fp[0], fp[1], fp[2], fp[3]);
5883 h1->Fit(
"YBox",
"Q");
5887 res[9] = f1->GetChisquare();
5889 for (
int i = 0;
i < 6;
i++) {
5890 res[
i] = f1->GetParameter(
i);
5891 err[
i] = f1->GetParError(
i);
5894 LOG(debug) <<
"YBox Fit of " << h1->GetName()
5895 <<
" ended with chi2 = " << res[9]
5896 << Form(
", strip length %7.2f +/- %5.2f, position resolution "
5897 "%7.2f +/- %5.2f at y_cen = %7.2f +/- %5.2f",
5908 LOG(fatal) << Form(
"Inconsistent LH Smtype size %lu, %d ",
5915 LOG(fatal) << Form(
"Inconsistent LH Sm size %lu, %d T %d",
5922 LOG(fatal) << Form(
"Inconsistent LH Rpc size %lu, %d TS %d%d ",
5931 "Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ",
5938 if (
fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) {
5945 "Inconsistent address for Ev %8.0f in list of size %lu for "
5946 "TSRC %d%d%d%d: 0x%08x, time %f",
5954 fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime());
5959 LOG(debug) << Form(
"LH check passed for event %8.0f",
fdEvent);
5964 LOG(fatal) << Form(
"Inconsistent LH Smtype size %lu, %d ",
5970 LOG(fatal) << Form(
"Inconsistent LH Sm size %lu, %d T %d",
5977 LOG(fatal) << Form(
"Inconsistent LH Rpc size %lu, %d TS %d%d ",
5986 "Inconsistent LH RpcChannel size %lu, %d TSR %d%d%d ",
5993 while (
fvLastHits[iSmType][iSm][iRpc][iCh].size() > 0) {
6000 "Inconsistent address for Ev %8.0f in list of size %lu for "
6001 "TSRC %d%d%d%d: 0x%08x, time %f",
6009 fvLastHits[iSmType][iSm][iRpc][iCh].front()->GetTime());
6010 fvLastHits[iSmType][iSm][iRpc][iCh].front()->Delete();
6011 fvLastHits[iSmType][iSm][iRpc][iCh].pop_front();
6016 LOG(info) << Form(
"LH cleaning done after %8.0f events",
fdEvent);
6026 Double_t dLastTotS) {
6034 Int_t iCh = iLastChan + 1;
6038 LOG(debug) <<
"Skip channel " << iCh <<
" of detector "
6039 << Form(
"0x%08x", iDetId);
6042 if (iCh >= iNbCh)
return kFALSE;
6044 LOG(debug1) << Form(
"Inspect channel TSRC %d%d%d%d at time %f, pos %f, size ",
6051 <<
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size();
6052 if (iCh == iNbCh)
return kFALSE;
6053 if (0 ==
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size())
6055 if (0 <
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size())
6057 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size());
6058 if (1 <
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size()) {
6059 Bool_t AddedHit = kFALSE;
6061 i1 <
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size() - 1;
6063 if (AddedHit)
break;
6066 && i2 <
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size()) {
6067 LOG(debug1) <<
"check digi pair " << i1 <<
"," << i2 <<
" with size "
6068 <<
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size();
6070 if ((
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][i1])->GetSide()
6071 == (
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][i2])
6087 gGeoManager->FindNode(
6091 Double_t dPosY = 0.;
6098 if (TMath::Abs(dPosY - dLastPosY)
6101 Double_t dNClHits = (Double_t)(
vDigiIndRef.size() / 2);
6105 Double_t dNewTotS = (dLastTotS + dTotS);
6106 dLastPosX = (dLastPosX * dLastTotS + dPosX * dTotS) / dNewTotS;
6107 dLastPosY = (dLastPosY * dLastTotS + dPosY * dTotS) / dNewTotS;
6108 dLastTime = (dLastTime * dLastTotS + dTime * dTotS) / dNewTotS;
6109 dLastTotS = dNewTotS;
6111 Int_t Ind1 =
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i1];
6112 Int_t Ind2 =
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][i2];
6117 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + i1);
6119 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + i1);
6121 std::vector<int>::iterator it;
6122 it = find(
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin(),
6125 if (it !=
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].end()) {
6127 it -
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin();
6128 LOG(debug1) <<
"Found i2 " << i2 <<
" with Ind2 " << Ind2
6129 <<
" at position " << ipos;
6131 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + ipos);
6133 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin() + ipos);
6135 LOG(fatal) <<
" Did not find i2 " << i2 <<
" with Ind2 " << Ind2;
6139 if (iCh != (iNbCh - 1)
6148 LOG(debug1) <<
"Added Strip " << iCh <<
" to cluster of size "
6159 Double_t hitpos_local[3] = {3 * 0.};
6160 hitpos_local[0] = dLastPosX;
6161 hitpos_local[1] = dLastPosY;
6162 hitpos_local[2] = 0.;
6169 Double_t hitpos[3] = {3 * 0.};
6171 gGeoManager->GetCurrentNode();
6172 gGeoManager->GetCurrentMatrix();
6173 gGeoManager->LocalToMaster(hitpos_local, hitpos);
6175 TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
6176 TVector3 hitPosErr(0.5, 0.5, 0.5);
6178 if (iChm < 0) iChm = 0;
6179 if (iChm > iNbCh - 1) iChm = iNbCh - 1;
6185 LOG(debug1) <<
"Save A-Hit "
6186 << Form(
"%2d %2d 0x%08x %3d t %f, y %f ",
6194 LOG(debug1) <<
", DigiInds: ";
6209 Int_t(dLastTotS * 10.));
6213 LH_store(iSmType, iSm, iRpc, iChm, pHit);
6235 if (
fvLastHits[iSmType][iSm][iRpc][iChm].size() == 0)
6236 fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit);
6238 Double_t dLastTime = pHit->
GetTime();
6239 if (dLastTime >=
fvLastHits[iSmType][iSm][iRpc][iChm].back()->GetTime()) {
6240 fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit);
6242 " Store LH from Ev %8.0f for TSRC %d%d%d%d, size %lu, addr 0x%08x, "
6252 dLastTime -
fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime());
6258 std::list<CbmTofHit*>::iterator it;
6259 for (it =
fvLastHits[iSmType][iSm][iRpc][iChm].begin();
6260 it !=
fvLastHits[iSmType][iSm][iRpc][iChm].end();
6262 if ((*it)->GetTime() > dLastTime)
break;
6263 fvLastHits[iSmType][iSm][iRpc][iChm].insert(--it, pHit);
6264 Double_t deltaTime = dLastTime - (*it)->GetTime();
6265 LOG(debug) << Form(
"Hit inserted into LH from Ev %8.0f for TSRC "
6266 "%d%d%d%d, size %lu, addr 0x%08x, delta time %f ",
6276 Double_t deltaTime =
6277 dLastTime -
fvLastHits[iSmType][iSm][iRpc][iChm].front()->GetTime();
6278 LOG(debug) << Form(
"first LH from Ev %8.0f for TSRC %d%d%d%d, size "
6279 "%lu, addr 0x%08x, delta time %f ",
6288 if (deltaTime == 0.) {
6292 fvLastHits[iSmType][iSm][iRpc][iChm].push_front(pHit);
6318 Double_t dWeightedTime = 0.0;
6319 Double_t dWeightedPosX = 0.0;
6320 Double_t dWeightedPosY = 0.0;
6321 Double_t dWeightedPosZ = 0.0;
6322 Double_t dWeightsSum = 0.0;
6327 Int_t iNbChanInHit = 0;
6329 Int_t iLastChan = -1;
6330 Double_t dLastPosX =
6332 Double_t dLastPosY = 0.0;
6333 Double_t dLastTime = 0.0;
6335 Double_t dPosX = 0.0;
6336 Double_t dPosY = 0.0;
6337 Double_t dPosZ = 0.0;
6338 Double_t dTime = 0.0;
6339 Double_t dTimeDif = 0.0;
6340 Double_t dTotS = 0.0;
6343 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
6346 for (Int_t iSm = 0; iSm < iNbSm; iSm++)
6347 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
6350 LOG(debug2) <<
"RPC - Loop "
6351 << Form(
" %3d %3d %3d %3d ", iSmType, iSm, iRpc, iChType);
6360 dWeightedTime = 0.0;
6361 dWeightedPosX = 0.0;
6362 dWeightedPosY = 0.0;
6363 dWeightedPosZ = 0.0;
6372 LOG(debug2) <<
"ChanOrient "
6373 << Form(
" %3d %3d %3d %3d %3d ",
6384 for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
6388 " T %3d Sm %3d R %3d Ch %3d Size %3lu ",
6393 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size());
6394 if (0 ==
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc].size())
6398 if (0 <
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size())
6400 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size());
6403 1 <
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size()) {
6405 while ((
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][0])
6407 == (
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][1])
6411 if (
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size()
6414 <<
"SameSide Digis! on TSRC " << iSmType << iSm << iRpc
6415 << iCh <<
", Times: "
6426 << (
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][1])
6439 <<
"3 consecutive SameSide Digis! on TSRC " << iSmType
6440 << iSm << iRpc << iCh <<
", Times: "
6483 "Ev %8.0f, digis not properly time ordered, TSRCS "
6505 <<
"SameSide Erase fStor entries(d) " << iSmType
6506 <<
", SR " << iSm * iNbRpc + iRpc <<
", Ch" << iCh;
6514 if (2 >
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
6521 <<
"digis processing for "
6522 << Form(
" SmT %3d Sm %3d Rpc %3d Ch %3d # %3lu ",
6529 if (2 >
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
6532 "Leaving digi processing for TSRC %d%d%d%d, size %3lu",
6537 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size());
6548 LOG(debug1) << Form(
6549 " TSRC %d%d%d%d size %3lu ",
6554 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size())
6555 << Form(
" ChId: 0x%08x 0x%08x ", iChId, iUCellId);
6559 LOG(error) <<
"CbmTofEventClusterizer::BuildClusters: no "
6561 << Form(
" %3d %3d %3d %3d 0x%08x 0x%08x ",
6575 LOG(debug2) << Form(
" Node at (%6.1f,%6.1f,%6.1f) : %p",
6587 LOG(debug2) <<
" " << xDigiA->
ToString();
6588 LOG(debug2) <<
" " << xDigiB->
ToString();
6591 if (5 == iSmType && dTimeDif != 0.) {
6593 LOG(debug) <<
"CbmTofEventClusterizer::BuildClusters: "
6595 << iSm <<
" with inconsistent digits "
6597 <<
" -> " << dTimeDif;
6598 LOG(debug) <<
" " << xDigiA->
ToString();
6599 LOG(debug) <<
" " << xDigiB->
ToString();
6612 &&
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size()
6615 <<
"Hit candidate outside correlation window, check for "
6616 "better possible digis, "
6618 <<
fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size();
6622 Double_t dPosYN = 0.;
6623 Double_t dTimeDifN = 0;
6636 if (TMath::Abs(dPosYN) < TMath::Abs(dPosY)) {
6638 <<
"Replace digi on side " << xDigiC->
GetSide()
6639 <<
", yPosNext " << dPosYN <<
" old: " << dPosY;
6640 dTimeDif = dTimeDifN;
6667 <<
"Wrong combinations of digis "
6673 if (TMath::Abs(dPosY)
6677 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
6679 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
6690 dPosX = ((Double_t)(-iNbCh / 2 + iCh) + 0.5)
6696 << Form(
" %3d %3d %3d %3d %3d 0x%p %1.0f Time %f PosX %f "
6714 if (0 < iNbChanInHit) {
6715 if (iLastChan == iCh - 1) {
6726 && iLastChan == iCh - 1
6729 dWeightedTime += dTime * dTotS;
6730 dWeightedPosX += dPosX * dTotS;
6731 dWeightedPosY += dPosY * dTotS;
6732 dWeightedPosZ += dPosZ * dTotS;
6733 dWeightsSum += dTotS;
6742 <<
" Add Digi and erase fStor entries(a): NbChanInHit "
6743 << iNbChanInHit <<
", " << iSmType <<
", SR "
6744 << iSm * iNbRpc + iRpc <<
", Ch" << iCh;
6762 dWeightedTime /= dWeightsSum;
6763 dWeightedPosX /= dWeightsSum;
6764 dWeightedPosY /= dWeightsSum;
6765 dWeightedPosZ /= dWeightsSum;
6768 Double_t hitpos_local[3];
6769 hitpos_local[0] = dWeightedPosX;
6770 hitpos_local[1] = dWeightedPosY;
6771 hitpos_local[2] = dWeightedPosZ;
6778 Double_t hitpos[3] = {3 * 0.};
6780 gGeoManager->GetCurrentNode();
6782 ->GetCurrentMatrix();
6786 gGeoManager->LocalToMaster(hitpos_local, hitpos);
6788 LOG(debug1) << Form(
" LocalToMaster: (%6.1f,%6.1f,%6.1f) "
6789 "->(%6.1f,%6.1f,%6.1f)",
6797 TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
6821 if (iChm < 0) iChm = 0;
6822 if (iChm > iNbCh - 1) iChm = iNbCh - 1;
6824 iSm, iRpc, iChm, 0, iSmType);
6831 sRef += Form(
" %d, (M%d)",
6835 LOG(debug) <<
"Save Hit "
6836 << Form(
" %3d %3d 0x%08x %3d %3d %3d %f %f",
6846 <<
", DigiInds: " << sRef;
6851 LOG(warning) <<
"Digi refs for Hit " <<
fiNbHits
6852 <<
": vDigiIndRef.size()";
6858 && dWeightedTime == pHitL->
GetTime()) {
6859 LOG(debug) <<
"Store Hit twice? "
6860 <<
" fiNbHits " <<
fiNbHits <<
", "
6861 << Form(
"0x%08x", iDetId);
6866 LOG(debug) <<
" Digi " << pDigiC->
ToString();
6877 "Invalid DigiRefInd for det 0x%08x", iDetId);
6883 LOG(warn) <<
"Invalid CalDigiInd";
6888 LOG(debug) <<
" DigiL " << pDigiC->
ToString();
6901 Int_t(dWeightsSum * 10.));
6907 LH_store(iSmType, iSm, iRpc, iChm, pHit);
6930 fvdX[iSmType][iRpc].push_back(dWeightedPosX);
6931 fvdY[iSmType][iRpc].push_back(dWeightedPosY);
6941 dWeightedTime = dTime * dTotS;
6942 dWeightedPosX = dPosX * dTotS;
6943 dWeightedPosY = dPosY * dTotS;
6944 dWeightedPosZ = dPosZ * dTotS;
6945 dWeightsSum = dTotS;
6951 <<
" Next fStor Digi " << iSmType <<
", SR "
6952 << iSm * iNbRpc + iRpc <<
", Ch" << iCh <<
", Dig0 "
6953 << (
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])
6955 << (
fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
6962 <<
" Erase fStor entries(b) " << iSmType <<
", SR "
6963 << iSm * iNbRpc + iRpc <<
", Ch" << iCh;
6992 "1.Hit on TSRC %d%d%d%d, time: %f, PosY %f, Tdif %f ",
7002 dWeightedTime = dTime * dTotS;
7003 dWeightedPosX = dPosX * dTotS;
7004 dWeightedPosY = dPosY * dTotS;
7005 dWeightedPosZ = dPosZ * dTotS;
7006 dWeightsSum = dTotS;
7017 <<
" Erase fStor entries(c) " << iSmType <<
", SR "
7018 << iSm * iNbRpc + iRpc <<
", Ch" << iCh;
7020 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
7022 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
7024 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
7026 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
7055 fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].clear();
7056 fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].clear();
7058 LOG(debug2) <<
"finished V-RPC"
7059 << Form(
" %3d %3d %3d %d %f %fx",
7070 <<
"=> Cluster building "
7071 <<
"from digis to hits not implemented for pads, Sm type "
7072 << iSmType <<
" Rpc " << iRpc;
7078 if (0 < iNbChanInHit) {
7079 LOG(debug1) <<
"Process cluster " << iNbChanInHit;
7083 LOG(debug1) <<
"H-Hit ";
7086 LOG(debug2) <<
"V-Hit ";
7088 dWeightedTime /= dWeightsSum;
7089 dWeightedPosX /= dWeightsSum;
7090 dWeightedPosY /= dWeightsSum;
7091 dWeightedPosZ /= dWeightsSum;
7094 Double_t hitpos_local[3] = {3 * 0.};
7095 hitpos_local[0] = dWeightedPosX;
7096 hitpos_local[1] = dWeightedPosY;
7097 hitpos_local[2] = dWeightedPosZ;
7104 Double_t hitpos[3] = {3 * 0.};
7106 gGeoManager->GetCurrentNode();
7107 gGeoManager->GetCurrentMatrix();
7110 gGeoManager->LocalToMaster(hitpos_local, hitpos);
7112 LOG(debug1) << Form(
" LocalToMaster for V-node: "
7113 "(%6.1f,%6.1f,%6.1f) ->(%6.1f,%6.1f,%6.1f)",
7121 TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
7143 if (iChm < 0) iChm = 0;
7144 if (iChm > iNbCh - 1) iChm = iNbCh - 1;
7149 TString cstr =
"Save V-Hit ";
7150 cstr += Form(
" %3d %3d 0x%08x %3d 0x%08x",
7157 cstr += Form(
", DigiSize: %lu ",
vDigiIndRef.size());
7158 cstr +=
", DigiInds: ";
7163 cstr += Form(
" %d (M,%d)",
7170 LOG(warning) <<
"Digi refs for Hit " <<
fiNbHits
7171 <<
": vDigiIndRef.size()";
7176 && dWeightedTime == pHitL->
GetTime())
7177 LOG(debug) <<
"Store Hit twice? "
7178 <<
" fiNbHits " <<
fiNbHits <<
", "
7179 << Form(
"0x%08x", iDetId);
7190 Int_t(dWeightsSum * 10.));
7197 LH_store(iSmType, iSm, iRpc, iChm, pHit);
7218 fvdX[iSmType][iRpc].push_back(dWeightedPosX);
7219 fvdY[iSmType][iRpc].push_back(dWeightedPosY);
7229 LOG(debug2) <<
" Fini-A "
7230 << Form(
" %3d %3d %3d M%3d",
7236 LOG(debug2) <<
" Fini-B " << Form(
" %3d ", iSmType);
7245 Int_t iDigIndCal = -1;
7247 std::map<Int_t, Double_t> mChannelDeadTime;
7251 for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) {
7259 (0 == pDigi->
GetSide()) ? 1 : 0,
7265 LOG(debug1) <<
"BC "
7266 << Form(
"0x%08x", pDigi->
GetAddress()) <<
" TSRC "
7268 << Form(
"%2d", (Int_t) pDigi->
GetChannel()) <<
" "
7270 <<
" " << pDigi->
GetTot();
7278 Bool_t bValid = kTRUE;
7279 std::map<Int_t, Double_t>::iterator it;
7280 it = mChannelDeadTime.find(iAddr);
7281 if (it != mChannelDeadTime.end()) {
7282 LOG(debug1) <<
"CCT found valid ChannelDeadtime entry "
7283 << mChannelDeadTime[iAddr] <<
", DeltaT "
7284 << pDigi->
GetTime() - mChannelDeadTime[iAddr];
7285 if ((bValid = (pDigi->
GetTime()
7299 mChannelDeadTime[iAddr] = pDigi->
GetTime();
7300 if (!bValid)
continue;
7302 LOG(debug1) <<
"DC "
7303 << Form(
"0x%08x", pDigi->
GetAddress()) <<
" TSRC "
7305 << Form(
"%2d", (Int_t) pDigi->
GetChannel()) <<
" "
7307 <<
" " << pDigi->
GetTot();
7323 LOG(debug2) <<
" CluCal-Init: " << pDigi->
ToString();
7330 LOG(debug2) <<
" CluCal-TOff: " << pCalDigi->
ToString();
7337 if (dTot < 0.001) dTot = 0.001;
7346 Int_t iWx = (Int_t)((pCalDigi->
GetTot() -
fdTOTMin) / dTotBinSize);
7347 if (0 > iWx) iWx = 0;
7350 (pCalDigi->
GetTot() -
fdTOTMin) / dTotBinSize - (Double_t) iWx - 0.5;
7364 [pCalDigi->
GetSide()][iWx + 1]
7379 [pCalDigi->
GetSide()][iWx - 1]
7389 LOG(debug2) <<
" CluCal-Walk: " << pCalDigi->
ToString();
7392 LOG(debug) <<
"BuildClusters: CalDigi "
7393 << Form(
"%02d TSRCS ", iDigIndCal) << pCalDigi->
GetType()
7395 << Form(
"%02d", Int_t(pCalDigi->
GetChannel()))
7397 << Form(
", T %15.3f", pCalDigi->
GetTime()) <<
", Tot "
7398 << pCalDigi->
GetTot() <<
", TotGain "
7410 <<
", Walk " << iWx <<
": "
7417 LOG(debug1) <<
" dDTot " << dDTot <<
" BinSize: " << dTotBinSize
7423 [pCalDigi->
GetSide()][iWx - 1]
7435 [pCalDigi->
GetSide()][iWx + 1]
7436 <<
" -> dWT = " << dWT;
7439 LOG(info) <<
"Skip1 Digi "
7440 <<
" Type " << pDigi->
GetType() <<
" "
7443 << pDigi->
GetRpc() <<
" "
7476 LOG(debug) <<
"CbmTofEventClusterizer::BuildClusters: Sort "
7478 if (iNbTofDigi > 1) {
7484 return a.GetTime() < b.GetTime();
7492 return a.GetTime() < b.GetTime();
7495 <<
"CbmTofEventClusterizer::BuildClusters: Sorting not successful ";
7503 if (
fvDeadStrips.size() <
static_cast<size_t>(iDet + 1))