diff --git a/core/detectors/rich/CbmRichGeoManager.cxx b/core/detectors/rich/CbmRichGeoManager.cxx index 1a6ff4e630375fe97474999e2afd83c75542b6ef..5df59233603ead37e472d545516af4d04d70c0e7 100644 --- a/core/detectors/rich/CbmRichGeoManager.cxx +++ b/core/detectors/rich/CbmRichGeoManager.cxx @@ -200,14 +200,21 @@ void CbmRichGeoManager::InitPmtCyl() } } - for (map<string, CbmRichRecGeoParPmt>::iterator it = fGP->fPmtMap.begin(); it != fGP->fPmtMap.end(); it++) { + for (map<string, CbmRichRecGeoParPmt>::iterator it = fGP->fPmtMap.begin(); it != fGP->fPmtMap.end();) { it->second.fPlaneX = mapPmtPlaneMinMax[it->first].GetMeanX(); it->second.fPlaneY = mapPmtPlaneMinMax[it->first].GetMeanY(); it->second.fPlaneZ = mapPmtPlaneMinMax[it->first].GetMeanZ(); - // cout << "name:" << it->first << " strip(x,y,z):" <<it->second.fX << "," << it->second.fY << "," << it->second.fZ << - // " pmtPlane(x,y,z):" <<it->second.fPlaneX << "," << it->second.fPlaneY << "," << it->second.fPlaneZ << ", " << - // "theta:" << it->second.fTheta << ", phi:" << it->second.fPhi << endl; + // LOG(info) << "name:" << it->first << " strip(x,y,z):" <<it->second.fX << "," << it->second.fY << "," << it->second.fZ << + // " pmtPlane(x,y,z):" <<it->second.fPlaneX << "," << it->second.fPlaneY << "," << it->second.fPlaneZ << ", " << + // "theta:" << it->second.fTheta << ", phi:" << it->second.fPhi; + + if (!mapPmtPlaneMinMax[it->first].fPointAdded) { + it = fGP->fPmtMap.erase(it); + } + else { + ++it; + } } // Calculate gap between camera_strip @@ -220,6 +227,7 @@ void CbmRichGeoManager::InitPmtCyl() geoIterator.GetPath(nodePath); string nodePathStr = string(nodePath.Data()) + "/"; + if (fGP->fPmtMap.find(nodePathStr) == fGP->fPmtMap.end()) continue; const TGeoMatrix* curMatrix = geoIterator.GetCurrentMatrix(); const Double_t* curNodeTr = curMatrix->GetTranslation(); // const Double_t* curNodeRot = curMatrix->GetRotationMatrix(); diff --git a/core/detectors/rich/CbmRichRecGeoPar.h b/core/detectors/rich/CbmRichRecGeoPar.h index c2ebab1a7350b14bdc1fa45551535b4f7a1a3e67..119adbce254e27f4257d14ce038fb5cd2302725d 100644 --- a/core/detectors/rich/CbmRichRecGeoPar.h +++ b/core/detectors/rich/CbmRichRecGeoPar.h @@ -262,6 +262,7 @@ public: fMaxPmtY = TMath::Max(fMaxPmtY, y); fMinPmtZ = TMath::Min(fMinPmtZ, z); fMaxPmtZ = TMath::Max(fMaxPmtZ, z); + fPointAdded = true; } Double_t GetMeanX() { return (fMinPmtX + fMaxPmtX) / 2.; } @@ -270,7 +271,9 @@ public: Double_t GetMeanZ() { return (fMinPmtZ + fMaxPmtZ) / 2.; } -private: + bool fPointAdded{false}; // true if at least one point was added + + private: Double_t fMinPmtX; Double_t fMaxPmtX; Double_t fMinPmtY;