diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 7191b989a04375ba6c293d3aab3badfcebe17529..3bbf2302bfdeab590a6f0f9118479715771782d6 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -400,40 +400,38 @@ InitStatus CbmL1::Init() } } NTrdStations = layerCounter; - if (fTrackingMode == L1Algo::TrackingMode::kMcbm) { NTrdStations = NTrdStations - 1; } - } - - - // count ToF parameters - - // if (fUseTOF) { - // int maxTofStation = 0; - - // L1Vector<int> NHits("NHits", 10, 0); - // L1Vector<float> Z_pos("Z_pos", 10, 0.f); - - // if (fTofHits) { - // for (int j = 0; j < fTofHits->GetEntriesFast(); j++) { - // CbmTofHit* mh = L1_DYNAMIC_CAST<CbmTofHit*>(fTofHits->At(j)); - // int St = fTofDigiBdfPar->GetNbTrackingStations(); - - // if (maxTofStation < St) maxTofStation = St; - - // TVector3 pos; - // mh->Position(pos); - // Z_pos[St] += pos.Z(); - // NHits[St]++; - // } - // } - - // for (int i = 0; i < (maxTofStation + 1); i++) { - // Z_pos[i] = Z_pos[i] / NHits[i]; - // } - // } + if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (fMissingHits)) { NTrdStations = NTrdStations - 1; } + } - // TODO: Read N TOF stations from geometry - if (fUseTOF) NTOFStation = 4; //fTofDigiBdfPar->GetNbTrackingStations(); + vector<float> TofStationZ; + vector<int> TofStationN; + if (fUseTOF) NTOFStation = fTofDigiBdfPar->GetNbTrackingStations(); + { + TofStationZ.resize(NTOFStation, 0); + TofStationN.resize(NTOFStation, 0); + + for (int iSmType = 0; iSmType < fTofDigiBdfPar->GetNbSmTypes(); iSmType++) { + for (int iSm = 0; iSm < fTofDigiBdfPar->GetNbSm(iSmType); iSm++) { + for (int iRpc = 0; iRpc < fTofDigiBdfPar->GetNbRpc(iSmType); iRpc++) { + int iAddr = CbmTofAddress::GetUniqueAddress(iSm, iRpc, 0, 0, iSmType); + int station = fTofDigiBdfPar->GetTrackingStation(iSmType, iSm, iRpc); + CbmTofCell* fChannelInfo = fDigiPar->GetCell(iAddr); + if (NULL == fChannelInfo) break; + float z = fChannelInfo->GetZ(); + float x = fChannelInfo->GetX(); + if (fMissingHits) { + if ((x > 20) && (z > 270) && (station == 1)) station = 2; + if (z > 400) continue; + } + TofStationZ[station] += z; + TofStationN[station] += 1; + } + } + } + for (Int_t i = 0; i < NTOFStation; i++) + TofStationZ[i] = TofStationZ[i] / TofStationN[i]; + } CbmStsSetup* stsSetup = CbmStsSetup::Instance(); if (!stsSetup->IsInit()) { stsSetup->Init(nullptr); } @@ -615,12 +613,9 @@ InitStatus CbmL1::Init() // Int_t nrModules = fTrdDigiPar->GetNrOfModules(); int skip = num; - if (fTrackingMode == L1Algo::TrackingMode::kMcbm) { - if (num == 0) skip = 0; - if (num == 1) skip = 2; - if (num == 2) skip = 3; - } + if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (fMissingHits)) + if (num > 0) skip++; int ModuleId = fTrdDigiPar->GetModuleId(skip); CbmTrdParModDigi* module = (CbmTrdParModDigi*) fTrdDigiPar->GetModulePar(ModuleId); @@ -654,16 +649,9 @@ InitStatus CbmL1::Init() geo.push_back(4); - z = 0; - int num = ist - (NMvdStations + NStsStations + NTrdStations + NMuchStations); - if (num == 0) z = 251; - if (num == 1) z = 270; - if (num == 2) z = 293; - if (num == 3) z = 310; - - geo.push_back(z); + geo.push_back(TofStationZ[ist - num]); geo.push_back(10); /// TODO: add Tof width dz geo.push_back(0); @@ -940,8 +928,10 @@ InitStatus CbmL1::Init() iSta < (NStsStations + NMvdStations + NMuchStations + NTrdStations); iSta++, j++) { TString stationNameSts = stationName; int skipStation = j; - if (skipStation == 2) skipStation = 3; - if (skipStation == 3) skipStation = 4; + if (fMissingHits) + if (skipStation == 2) skipStation = 3; + if (fMissingHits) + if (skipStation == 3) skipStation = 4; stationNameSts += skipStation; TProfile2D* hStaRadLen = (TProfile2D*) rlFile->Get(stationNameSts); if (!hStaRadLen) { diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index c9a0545e0a0d015ec5e09a5fbf02fd3f3bdae827..10b085a2fcc183ab93829df961a2c6ce5b046a48 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -731,7 +731,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, int sta = mh->GetPlaneId(); - if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (sta > 1)) { sta = sta - 1; } + if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (sta > 1) && (fMissingHits)) { sta = sta - 1; } th.iStation = NMvdStations + sta + NStsStations + NMuchStations; @@ -879,7 +879,8 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, th.y = pos.Y(); th.z = pos.Z(); - if ((th.x > 20) && (th.z > 270) && (fTofDigiBdfPar->GetTrackingStation(mh) == 1)) sttof = 2; + if (fMissingHits) + if ((th.x > 20) && (th.z > 270) && (fTofDigiBdfPar->GetTrackingStation(mh) == 1)) sttof = 2; if (th.z > 400) continue; th.iStation = sttof + NMvdStations + NStsStations + NMuchStations + NTrdStations;