diff --git a/algo/detectors/tof/Calibrate.cxx b/algo/detectors/tof/Calibrate.cxx index 9b5697daa7d011f56fa6c88f0168053f0cdf5775..d283475abd2eefffe7b0836e396b14fae63438d7 100644 --- a/algo/detectors/tof/Calibrate.cxx +++ b/algo/detectors/tof/Calibrate.cxx @@ -46,8 +46,8 @@ namespace cbm::algo::tof continue; } - HitfindSetup::Rpc& rpcPar = fTofConfig.rpcs.at(SmType).at(Sm * NbRpc + Rpc); - HitfindSetup::Channel& chanPar = rpcPar.chanPar[Chan]; + HitfindSetup::RpcCal& rpcPar = fTofConfig.rpccal.at(SmType).at(Sm * NbRpc + Rpc); + HitfindSetup::ChanCal& chanPar = rpcPar.chanPar[Chan]; if (rpcPar.swapChannelSides && 5 != SmType && 8 != SmType) { pDigi.SetAddress(Sm, Rpc, Chan, (0 == Side) ? 1 : 0, SmType); diff --git a/algo/detectors/tof/ClusterizerPars.h b/algo/detectors/tof/ClusterizerPars.h index fea7d8036cd7e808bc55005de9cef1e696689455..1332f5f2c2da7c2c2ead0cb5fc0f9362e86ad372 100644 --- a/algo/detectors/tof/ClusterizerPars.h +++ b/algo/detectors/tof/ClusterizerPars.h @@ -18,11 +18,7 @@ namespace cbm::algo::tof }; struct ClusterizerChanPar { - std::vector<double> fvCPTOff; //[nbSide] - std::vector<double> fvCPTotGain; //[nbSide] - std::vector<double> fvCPTotOff; //[nbSide] - std::vector<std::vector<double>> fvCPWalk; //[nbSide][nbWalkBins] - int32_t address; //unique address + int32_t address; //unique address TofCell cell; }; @@ -33,11 +29,6 @@ namespace cbm::algo::tof double fdMaxSpaceDist; double fSigVel; double fTimeRes; - int32_t numClWalkBinX; - double TOTMax; - double TOTMin; - bool swapChannelSides; - double channelDeadtime; double fCPTOffYBinWidth; double fCPTOffYRange; std::vector<double> fCPTOffY; //[nBin] diff --git a/algo/detectors/tof/Hitfind.cxx b/algo/detectors/tof/Hitfind.cxx index 72fed21efc4db484174b0433d1390deab5d4838b..282df409ee5aa61b0fc4dc4a4febea00fd0f021c 100644 --- a/algo/detectors/tof/Hitfind.cxx +++ b/algo/detectors/tof/Hitfind.cxx @@ -124,11 +124,6 @@ namespace cbm::algo::tof par->fCPTOffY = rpcPar.CPTOffY; par->fCPTOffYRange = rpcPar.CPTOffYRange; par->fTimeRes = rpcPar.timeRes; - par->numClWalkBinX = rpcPar.numClWalkBinX; - par->TOTMax = rpcPar.TOTMax; - par->TOTMin = rpcPar.TOTMin; - par->swapChannelSides = rpcPar.swapChannelSides; - par->channelDeadtime = rpcPar.channelDeadtime; int32_t NbChan = rpcPar.chanPar.size(); par->fChanPar.resize(NbChan); @@ -143,10 +138,6 @@ namespace cbm::algo::tof par->fChanPar[Ch].cell.rotation = ROOT::Math::Rotation3D(&rot_ptr[0], &rot_ptr[9]); par->fChanPar[Ch].cell.sizeX = chanPar.cell.sizeX; par->fChanPar[Ch].cell.sizeY = chanPar.cell.sizeY; - par->fChanPar[Ch].fvCPTOff = chanPar.vCPTOff; - par->fChanPar[Ch].fvCPTotGain = chanPar.vCPTotGain; - par->fChanPar[Ch].fvCPTotOff = chanPar.vCPTotOff; - par->fChanPar[Ch].fvCPWalk = chanPar.vCPWalk; } fAlgo[SmType][Sm * NbRpc + Rpc].SetParams(std::move(par)); } diff --git a/algo/detectors/tof/HitfindSetup.h b/algo/detectors/tof/HitfindSetup.h index dd1b970510743d2357037581541ff8efed5edbfa..12e8c1b7f9bccbf9873ae55b8ee7344422685ed9 100644 --- a/algo/detectors/tof/HitfindSetup.h +++ b/algo/detectors/tof/HitfindSetup.h @@ -21,6 +21,8 @@ namespace cbm::algo::tof */ struct HitfindSetup { + /* Hitfinding parameters */ + struct Cell { double sizeX; double sizeY; @@ -35,19 +37,11 @@ namespace cbm::algo::tof }; struct Channel { - std::vector<double> vCPTOff; - std::vector<double> vCPTotGain; - std::vector<double> vCPTotOff; - std::vector<std::vector<double>> vCPWalk; i32 address; Cell cell; static constexpr auto Properties = - std::make_tuple(config::Property(&Channel::vCPTOff, "vCPTOff", "CPT offset"), - config::Property(&Channel::vCPTotGain, "vCPTotGain", "CP time over threshold gain"), - config::Property(&Channel::vCPTotOff, "vCPTotOff", "CP time over threshold offset"), - config::Property(&Channel::vCPWalk, "vCPWalk", "CP walk correction", YAML::Flow), - config::Property(&Channel::address, "address", "unique address"), + std::make_tuple(config::Property(&Channel::address, "address", "unique address"), config::Property(&Channel::cell, "cell", "cell parameters")); }; @@ -58,14 +52,8 @@ namespace cbm::algo::tof double maxSpaceDist; double sigVel; double timeRes; - i32 numClWalkBinX; - double TOTMax; - double TOTMin; - bool swapChannelSides; - double channelDeadtime; double CPTOffYBinWidth; double CPTOffYRange; - std::vector<double> CPTOffY; std::vector<Channel> chanPar; @@ -76,23 +64,54 @@ namespace cbm::algo::tof config::Property(&Rpc::maxSpaceDist, "maxSpaceDist", "maximum space distance"), config::Property(&Rpc::sigVel, "sigVel", "signal velocity"), config::Property(&Rpc::timeRes, "timeRes", "time resolution"), - config::Property(&Rpc::numClWalkBinX, "numClWalkBinX", "number of walk correction bins"), - config::Property(&Rpc::TOTMax, "TOTMax", "maximum time over threshold"), - config::Property(&Rpc::TOTMin, "TOTMin", "minimum time over threshold"), - config::Property(&Rpc::swapChannelSides, "swapChannelSides", "flag for swapping channel sides"), - config::Property(&Rpc::channelDeadtime, "channelDeadtime", "channel dead time"), config::Property(&Rpc::CPTOffYBinWidth, "CPTOffYBinWidth", "CPT Y offset bin width"), config::Property(&Rpc::CPTOffYRange, "CPTOffYRange", "CPT Y offset range"), config::Property(&Rpc::CPTOffY, "CPTOffY", "CPT Y offset array"), config::Property(&Rpc::chanPar, "chanPar", "channel parameters")); }; + /* Calibration parameters */ + + struct ChanCal { + std::vector<double> vCPTOff; + std::vector<double> vCPTotGain; + std::vector<double> vCPTotOff; + std::vector<std::vector<double>> vCPWalk; + + static constexpr auto Properties = + std::make_tuple(config::Property(&ChanCal::vCPTOff, "vCPTOff", "CPT offset"), + config::Property(&ChanCal::vCPTotGain, "vCPTotGain", "CP time over threshold gain"), + config::Property(&ChanCal::vCPTotOff, "vCPTotOff", "CP time over threshold offset"), + config::Property(&ChanCal::vCPWalk, "vCPWalk", "CP walk correction", YAML::Flow)); + }; + + struct RpcCal { + i32 numClWalkBinX; + double TOTMax; + double TOTMin; + bool swapChannelSides; + double channelDeadtime; + std::vector<ChanCal> chanPar; + + static constexpr auto Properties = std::make_tuple( + config::Property(&RpcCal::numClWalkBinX, "numClWalkBinX", "number of walk correction bins"), + config::Property(&RpcCal::TOTMax, "TOTMax", "maximum time over threshold"), + config::Property(&RpcCal::TOTMin, "TOTMin", "minimum time over threshold"), + config::Property(&RpcCal::swapChannelSides, "swapChannelSides", "flag for swapping channel sides"), + config::Property(&RpcCal::channelDeadtime, "channelDeadtime", "channel dead time"), + config::Property(&RpcCal::chanPar, "chanPar", "channel parameters")); + }; + + /* Members */ + std::vector<std::vector<Rpc>> rpcs; + std::vector<std::vector<RpcCal>> rpccal; std::vector<int32_t> NbSm; std::vector<int32_t> NbRpc; static constexpr auto Properties = std::make_tuple( config::Property(&HitfindSetup::rpcs, "rpcs", "Parameters of RPCs"), + config::Property(&HitfindSetup::rpccal, "rpccal", "Calibration parameters of RPCs"), config::Property(&HitfindSetup::NbSm, "NbSm", "Number of SMs per super module type", {}, YAML::Flow), config::Property(&HitfindSetup::NbRpc, "NbRpc", "Number of RPCs per super module type", {}, YAML::Flow)); }; diff --git a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx index c1beee73fc251867f5cfd5ad40a932bf05a2dd4f..347ae503b66695574b6e35760e2ca826ad869aca 100644 --- a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx +++ b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx @@ -423,6 +423,7 @@ bool CbmTaskTofClusterizerParWrite::InitAlgos() cbm::algo::tof::HitfindSetup setup; setup.rpcs.resize(iNbSmTypes); + setup.rpccal.resize(iNbSmTypes); // Create one algorithm per RPC and configure it with parameters for (int32_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) { @@ -432,10 +433,13 @@ bool CbmTaskTofClusterizerParWrite::InitAlgos() setup.NbRpc.push_back(iNbRpc); setup.rpcs[iSmType].resize(iNbSm * iNbRpc); + setup.rpccal[iSmType].resize(iNbSm * iNbRpc); for (int32_t iSm = 0; iSm < iNbSm; iSm++) { for (int32_t iRpc = 0; iRpc < iNbRpc; iRpc++) { + /* Hitfinding parameters */ + cbm::algo::tof::HitfindSetup::Rpc par; const int32_t iDetId = CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); @@ -444,21 +448,30 @@ bool CbmTaskTofClusterizerParWrite::InitAlgos() par.posYMaxScal = fPosYMaxScal; par.maxTimeDist = fdMaxTimeDist; par.maxSpaceDist = fdMaxSpaceDist; + par.sigVel = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); + par.timeRes = 0.08; par.CPTOffYBinWidth = fvCPTOffYBinWidth[iSmType][iSm * iNbRpc + iRpc]; par.CPTOffY = fvCPTOffY[iSmType][iSm * iNbRpc + iRpc]; par.CPTOffYRange = fvCPTOffYRange[iSmType][iSm * iNbRpc + iRpc]; - par.sigVel = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc); - par.timeRes = 0.08; - par.numClWalkBinX = nbClWalkBinX; - par.TOTMax = fdTOTMax; - par.TOTMin = fdTOTMin; - par.swapChannelSides = fbSwapChannelSides; - par.channelDeadtime = fdChannelDeadtime; + + /* Calibration paramters */ + + cbm::algo::tof::HitfindSetup::RpcCal parCal; + + parCal.numClWalkBinX = nbClWalkBinX; + parCal.TOTMax = fdTOTMax; + parCal.TOTMin = fdTOTMin; + parCal.swapChannelSides = fbSwapChannelSides; + parCal.channelDeadtime = fdChannelDeadtime; int32_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpc); par.chanPar.resize(iNbChan); + parCal.chanPar.resize(iNbChan); + for (int32_t iCh = 0; iCh < iNbChan; iCh++) { + /* Hitfinding parameters */ + cbm::algo::tof::HitfindSetup::Channel& chan = par.chanPar[iCh]; const int32_t address = CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType); @@ -475,13 +488,19 @@ bool CbmTaskTofClusterizerParWrite::InitAlgos() chan.cell.sizeX = channelInfo->GetSizex(); chan.cell.sizeY = channelInfo->GetSizey(); - chan.vCPTOff = fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh]; - chan.vCPTotGain = fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh]; - chan.vCPTotOff = fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh]; - chan.vCPWalk = fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh]; chan.address = address; + + /* Calibration paramters */ + + cbm::algo::tof::HitfindSetup::ChanCal& chanCal = parCal.chanPar[iCh]; + + chanCal.vCPTOff = fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh]; + chanCal.vCPTotGain = fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh]; + chanCal.vCPTotOff = fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh]; + chanCal.vCPWalk = fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh]; } - setup.rpcs[iSmType][iSm * iNbRpc + iRpc] = par; + setup.rpcs[iSmType][iSm * iNbRpc + iRpc] = par; + setup.rpccal[iSmType][iSm * iNbRpc + iRpc] = parCal; } } }