@@ -145,29 +145,29 @@ void Detector::createGeometry()
145145 vRICH->SetTitle (vstrng);
146146 auto & richPars = RICHBaseParam::Instance ();
147147
148- prepareLayout ();
148+ prepareLayout (); // Preparing the positions of the rings and tiles
149149
150150 for (int iRing{0 }; iRing < richPars.nRings ; ++iRing) {
151151 if (!richPars.oddGeom && iRing == (richPars.nRings / 2 )) {
152152 continue ;
153153 }
154- mRings [iRing] = Ring{iRing,
155- richPars.nTiles ,
156- richPars.rMin ,
157- richPars.rMax ,
158- richPars.radiatorThickness ,
159- (float )mVTile1 [iRing],
160- (float )mVTile2 [iRing],
161- (float )mLAerogelZ [iRing],
162- richPars.detectorThickness ,
163- (float )mVMirror1 [iRing],
164- (float )mVMirror2 [iRing],
165- richPars.zBaseSize ,
166- (float )mR0Radiator [iRing],
167- (float )mR0PhotoDet [iRing],
168- (float )mTRplusG [iRing],
169- (float )mThetaBi [iRing],
170- GeometryTGeo::getRICHVolPattern ()};
154+ mRings [iRing] = o2::rich:: Ring{iRing,
155+ richPars.nTiles ,
156+ richPars.rMin ,
157+ richPars.rMax ,
158+ richPars.radiatorThickness ,
159+ (float )mVTile1 [iRing],
160+ (float )mVTile2 [iRing],
161+ (float )mLAerogelZ [iRing],
162+ richPars.detectorThickness ,
163+ (float )mVMirror1 [iRing],
164+ (float )mVMirror2 [iRing],
165+ richPars.zBaseSize ,
166+ (float )mR0Radiator [iRing],
167+ (float )mR0PhotoDet [iRing],
168+ (float )mTRplusG [iRing],
169+ (float )mThetaBi [iRing],
170+ GeometryTGeo::getRICHVolPattern ()};
171171 }
172172
173173 if (richPars.enableFWDRich ) {
@@ -182,7 +182,7 @@ void Detector::InitializeO2Detector()
182182{
183183 LOG (info) << " Initialize RICH O2Detector" ;
184184 mGeometryTGeo = GeometryTGeo::Instance ();
185- // defineSensitiveVolumes();
185+ defineSensitiveVolumes ();
186186}
187187
188188void Detector::defineSensitiveVolumes ()
@@ -194,12 +194,19 @@ void Detector::defineSensitiveVolumes()
194194 LOGP (info, " Adding RICH Sensitive Volumes" );
195195
196196 // The names of the RICH sensitive volumes have the format: Ring(0...mRings.size()-1)
197- for (int j{0 }; j < mRings .size (); j++) {
198- volumeName = GeometryTGeo::getRICHSensorPattern () + TString::Itoa (j, 10 );
199- LOGP (info, " Trying {}" , volumeName.Data ());
200- v = geoManager->GetVolume (volumeName.Data ());
201- LOGP (info, " Adding RICH Sensitive Volume {}" , v->GetName ());
202- AddSensitiveVolume (v);
197+ for (auto ring : mRings ) {
198+ for (int j = 0 ; j < ring.getNTiles (); j++) {
199+ volumeName = Form (" %s_%d_%d" , GeometryTGeo::getRICHSensorPattern (), ring.getPosId (), j);
200+ LOGP (info, " Trying {}" , volumeName.Data ());
201+ v = geoManager->GetVolume (volumeName.Data ());
202+ if (!v) {
203+ LOG (error) << " Geometry does not contain volume " << volumeName.Data ();
204+ geoManager->GetListOfVolumes ()->Print ();
205+ LOG (fatal) << " Could not find volume " << volumeName.Data () << " in the geometry" ;
206+ }
207+ LOGP (info, " Adding RICH Sensitive Volume {}" , v->GetName ());
208+ AddSensitiveVolume (v);
209+ }
203210 }
204211}
205212
0 commit comments