ATLAS Offline Software
Loading...
Searching...
No Matches
GeoPixelServices Class Reference

#include <GeoPixelServices.h>

Inheritance diagram for GeoPixelServices:
Collaboration diagram for GeoPixelServices:

Public Member Functions

 GeoPixelServices (InDetDD::PixelDetectorManager *ddmgr, PixelGeometryManager *mgr, GeoModelIO::ReadGeoModel *sqliteReader, std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > mapFPV, std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > mapAX, InDetDD::Zone *envelopeZone=0)
 GeoPixelServices (const GeoPixelServices &)=delete
GeoPixelServicesoperator= (const GeoPixelServices &)=delete
 ~GeoPixelServices ()
virtual GeoVPhysVol * Build () override
void initialize (const std::string &)
void initializeOld (const std::string &)
InDetDD::VolumeBuildergetBuilder ()
InDetDD::VolumeBuildergetServMatBuilder ()

Protected Attributes

PixelGeometryManagerm_gmt_mgr
InDetMaterialManagerm_mat_mgr
InDetDD::PixelDetectorManagerm_DDmgr
GeoModelIO::ReadGeoModel * m_sqliteReader
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > m_mapFPV
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
const double m_epsilon

Private Attributes

std::vector< const InDetDD::ServiceVolume * > m_services
InDetDD::VolumeBuilderm_pixServBuilder
InDetDD::VolumeBuilderm_servMatBuilder
std::vector< double > m_layerShift

Detailed Description

Definition at line 17 of file GeoPixelServices.h.

Constructor & Destructor Documentation

◆ GeoPixelServices() [1/2]

GeoPixelServices::GeoPixelServices ( InDetDD::PixelDetectorManager * ddmgr,
PixelGeometryManager * mgr,
GeoModelIO::ReadGeoModel * sqliteReader,
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > mapFPV,
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > mapAX,
InDetDD::Zone * envelopeZone = 0 )

Definition at line 114 of file GeoPixelServices.cxx.

120 : GeoVPixelFactory(ddmgr, mgr, sqliteReader, std::move(mapFPV), std::move(mapAX)),
121 m_pixServBuilder(nullptr),
122 m_servMatBuilder(nullptr),
123 m_layerShift(0)
124{
125
126 // Get dimensions of barrel and endcap
127 double barrelRmin = m_gmt_mgr->PixelBarrelRMin();
128 double barrelRmax = m_gmt_mgr->PixelBarrelRMax();
129 double barrelZmin = -m_gmt_mgr->PixelBarrelHalfLength();
130 double barrelZmax = m_gmt_mgr->PixelBarrelHalfLength();
131 double endcapRmin = m_gmt_mgr->PixelEndcapRMin();
132 double endcapRmax = m_gmt_mgr->PixelEndcapRMax();
133 double endcapZmin = m_gmt_mgr->PixelEndcapZMin();
134 double endcapZmax = m_gmt_mgr->PixelEndcapZMax();
135
136 double pixelRmin, pixelRmax, pixelZmax;
137 if (!pixZone) {
138 pixelRmin = m_gmt_mgr->PixelRMin();
139 pixelRmax = m_gmt_mgr->PixelRMax();
140 pixelZmax = m_gmt_mgr->PixelHalfLength();
141 pixZone = new InDetDD::TubeZone("Pixel",-pixelZmax,pixelZmax,pixelRmin,pixelRmax);
142 }
143 else {
144 if (m_gmt_mgr->PixelSimpleEnvelope()) {
145 pixelRmin = m_gmt_mgr->PixelRMin();
146 pixelRmax = m_gmt_mgr->PixelRMax();
147 pixelZmax = m_gmt_mgr->PixelHalfLength();
148 }
149 else {
150 pixelZmax = m_gmt_mgr->PixelEnvelopeZ(0);
151 pixelRmin = m_gmt_mgr->PixelEnvelopeRMin(0);
152 pixelRmax = m_gmt_mgr->PixelEnvelopeRMax(0);
153 }
154 }
155
156 InDetDD::UnboundedZone topZone("Mother");
157 pixZone->add(new InDetDD::TubeZone("C",-endcapZmax,-endcapZmin,endcapRmin,endcapRmax, true));
158 pixZone->add(new InDetDD::TubeZone("B",barrelZmin,barrelZmax,barrelRmin,barrelRmax));
159 pixZone->add(new InDetDD::TubeZone("A",endcapZmin,endcapZmax,endcapRmin,endcapRmax));
160 topZone.add(pixZone);
161
162 // Collect the layer shifts / IBL 2mm shift
163 m_layerShift.clear();
164 for(int ii = 0; ii < m_gmt_mgr->PixelBarrelNLayer(); ii++){
165 m_gmt_mgr->SetCurrentLD(ii);
166 m_layerShift.push_back(m_gmt_mgr->PixelLayerGlobalShift());
167 }
168
169
170 // We process all tables.
171 bool barrelPresent = m_gmt_mgr->partPresent("Barrel");
172 bool endcapAPresent = m_gmt_mgr->partPresent("EndcapA");
173 bool endcapCPresent = m_gmt_mgr->partPresent("EndcapC");
174
175 if (barrelPresent) initialize("barrel");
176 if (endcapAPresent || endcapCPresent) initialize("endcap");
177 initialize("simple");
178 initialize("envelope");
179
180 // all services are added at a time
181 m_pixServBuilder = new InDetDD::VolumeBuilder(topZone, m_services);
182 m_pixServBuilder->setMaterialManager(m_mat_mgr);
183 if (m_gmt_mgr->athenaComps()->serviceBuilderTool()) {
184 const std::vector<const InDetDD::ServiceVolume *> & services = m_gmt_mgr->athenaComps()->serviceBuilderTool()->getServices();
185 m_servMatBuilder = new InDetDD::VolumeBuilder(topZone, services);
186 m_servMatBuilder->setMaterialManager(m_mat_mgr);
187 }
188}
InDetDD::VolumeBuilder * m_servMatBuilder
std::vector< double > m_layerShift
std::vector< const InDetDD::ServiceVolume * > m_services
InDetDD::VolumeBuilder * m_pixServBuilder
PixelGeometryManager * m_gmt_mgr
InDetMaterialManager * m_mat_mgr
GeoVPixelFactory(InDetDD::PixelDetectorManager *ddmgr, PixelGeometryManager *mgr, GeoModelIO::ReadGeoModel *sqliteReader, std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > mapFPV, std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > mapAX)
void initialize()

◆ GeoPixelServices() [2/2]

GeoPixelServices::GeoPixelServices ( const GeoPixelServices & )
delete

◆ ~GeoPixelServices()

GeoPixelServices::~GeoPixelServices ( )

Definition at line 190 of file GeoPixelServices.cxx.

191{
192 // delete contents of m_multiParam
193 for (unsigned int i = 0; i < m_services.size(); ++i) {
194 delete m_services[i];
195 }
196 delete m_pixServBuilder;
197 delete m_servMatBuilder;
198}

Member Function Documentation

◆ Build()

GeoVPhysVol * GeoPixelServices::Build ( )
overridevirtual

Implements GeoVPixelFactory.

Definition at line 356 of file GeoPixelServices.cxx.

357{
358 return nullptr;
359}

◆ getBuilder()

InDetDD::VolumeBuilder * GeoPixelServices::getBuilder ( )
inline

Definition at line 31 of file GeoPixelServices.h.

31{return m_pixServBuilder;}

◆ getServMatBuilder()

InDetDD::VolumeBuilder * GeoPixelServices::getServMatBuilder ( )
inline

Definition at line 32 of file GeoPixelServices.h.

32{return m_servMatBuilder;}

◆ initialize()

void GeoPixelServices::initialize ( const std::string & a)

Definition at line 201 of file GeoPixelServices.cxx.

202{
203 // For "simple" services use ServiceVolumeMaker to read in the table. The barrel and endcap can also be read in
204 // with ServiceVolumeMaker but there is still use of parameters specified by radiation length which is not handled by ServiceVolumeMaker
205 // so we use the old version.
206
207 if (a!="simple") {
208 return initializeOld(a);
209 }
210
211 InDetDD::ServiceVolumeSchema schema;
212 std::string label;
213 if (a=="simple") {
214 schema.setSimpleSchema();
215 label = "Svc";
216 } else if (a=="barrel") { // Not used yet. initializeOld() is used instead
217 schema.setPixelSchema();
218 label = "Brl";
219 } else if (a=="endcap") { // Not used yet. initializeOld() is used instead
220 schema.setPixelSchema();
221 label = "EC";
222 } else {
223 m_gmt_mgr->msg(MSG::ERROR) << "Unrecognized service table type: " << a << endmsg;
224 return;
225 }
226
227 IRDBRecordset_ptr table = m_gmt_mgr->getPixelServiceRecordset(a);
228
229 InDetDD::ServiceVolumeMaker volMaker(label, std::move(table), schema, m_gmt_mgr->athenaComps());
230 for (unsigned int i = 0; i < volMaker.numElements(); ++i) {
231 m_services.push_back(volMaker.make(i));
232 }
233}
#define endmsg
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
static Double_t a
void initializeOld(const std::string &)
std::string label(const std::string &format, int i)
Definition label.h:19

◆ initializeOld()

void GeoPixelServices::initializeOld ( const std::string & a)

Definition at line 237 of file GeoPixelServices.cxx.

238{
239 //
240 // Loop over the service elements:
241 //
242 int numServices = m_gmt_mgr->PixelServiceElements(a);
243 for(int ii = 0; ii < numServices; ii++) {
244
245
246 // Will return <0 if the element doesn't belong to current inside/outside zone
247 // This check is removed as it now checks accroding to the dimensions.
248 //if (m_gmt_mgr->PixelServiceFrameNum(a, ii) < 0) continue;
249 //
250 //
251 // Retrieve/calculate the parameters for the volume.
252 //
253 InDetDD::ServiceVolume param;
254 param.setMaterial(m_gmt_mgr->PixelServiceMaterial(a, ii));
255 param.setRmin(m_gmt_mgr->PixelServiceRMin(a, ii));
256 param.setRmax(m_gmt_mgr->PixelServiceRMax(a, ii));
257 param.setZmin(m_gmt_mgr->PixelServiceZMin(a, ii));
258 param.setZmax(m_gmt_mgr->PixelServiceZMax(a, ii));
259 param.setZsymm(m_gmt_mgr->PixelServiceZsymm(a, ii));
260 param.setVolName(m_gmt_mgr->PixelServiceName(a, ii));
261
262 double zShift=0.; // the famous IBL Z shift
263 int iShiftIndex = m_gmt_mgr->PixelServiceShift(a, ii);
264 // FIXME: The magic number 100 here should be explained...
265 // cppcheck-suppress negativeContainerIndex
266 if(iShiftIndex>0) zShift=m_layerShift[iShiftIndex-100];
267 param.setZShift(zShift);
268
269 // Service envelopes
270 int envNum=m_gmt_mgr->PixelServiceEnvelopeNum(a, ii);
271 param.setEnvelopeNum(envNum);
272 int envParent=m_gmt_mgr->PixelServiceParentEnvelopeNum(a, ii);
273 param.setParentEnvelope(envParent);
274 int volId = m_gmt_mgr->PixelServiceFrameNum(a, ii);
275
276 bool needsRotation = false;
277
278 // For TUBE there is no need to read the rest
279 std::string shapeType = m_gmt_mgr->PixelServiceShape(a, ii);
280 if (!shapeType.empty() && shapeType != "TUBE") {
281 double rmin2 = m_gmt_mgr->PixelServiceRMin2(a, ii);
282 double rmax2 = m_gmt_mgr->PixelServiceRMax2(a, ii);
283 int repeat = m_gmt_mgr->PixelServiceRepeat(a, ii);
284 double phiLoc = m_gmt_mgr->PixelServicePhiLoc(a, ii);
285 double phiWidth = m_gmt_mgr->PixelServiceWidth(a, ii);
286
287 // Can be in degree or Gaudi::Units::mm. Usually it is Gaudi::Units::deg expect for BOX, TRAP and ROD shape
288 // Geometry manager makes no assumptions about units. So we must interpret here.
289 if (shapeType == "BOX" || shapeType == "ROD" || shapeType == "ROD2" || shapeType == "TRAP") {
290 phiWidth *= Gaudi::Units::mm;
291 } else {
292 phiWidth *= Gaudi::Units::degree;
293 }
294
295 if (phiWidth == 0) phiWidth = 2*Gaudi::Units::pi;
296 if (rmin2 <= 0) rmin2 = param.rmin();
297 if (rmax2 <= 0) rmax2 = param.rmax();
298 if (repeat == 0) repeat = 1;
299
300 if (shapeType == "PGON" || shapeType == "PGON2" ||
301 shapeType == "CONE" || shapeType == "CONS" ||
302 shapeType == "PGON3" || shapeType == "PGON31" || shapeType == "PGON4") {
303 if ((rmin2 != param.rmin()) || (rmax2 != param.rmax())) {
304 needsRotation = true;
305 }
306 }
307
308 int sides = 0;
309 int nCopies = 1;
310 if (shapeType == "PGON" || shapeType == "PGON2" ||
311 shapeType == "PGON3" || shapeType == "PGON31" || shapeType == "PGON4") {
312 sides = repeat;
313 } else {
314 nCopies = repeat;
315 }
316
317 // Force nCopies to 1 for TUBE and CONE
318 if (shapeType.empty() || shapeType == "TUBE" || shapeType == "CONE") {
319 nCopies = 1;
320 }
321
322 param.setShapeType(shapeType);
323 param.setRmin2(rmin2);
324 param.setRmax2(rmax2);
325 param.setPhiLoc(phiLoc);
326 param.setPhiWidth(phiWidth);
327 param.setSides(sides);
328 param.setNCopies(nCopies);
329 }
330
331 param.setNeedsRotation(needsRotation);
332
333 //
334 // If zin is 0... (within 10^-5) this is a volume symmetric around
335 // the origin
336 //
337 if(std::abs(param.zmin()) < 0.000001) {
338 param.setZmin(-param.zmax());
339 param.setZsymm(false);
340 }
341
342 std::string label;
343 if(envNum>0) label="Env";
344 else if (a == "barrel") label = "Brl";
345 else if (a == "endcap") label = "EC";
346 else if (a == "simple") label = "Svc";
347 param.setLabel(label, volId);
348
349 // Fill m_multiVolumes;
350 m_services.push_back(new InDetDD::ServiceVolume(param));
351
352 }
353}
void setLabel(const std::string &name, int volId)
std::initializer_list< unsigned int > constexpr sides
Definition RPDUtils.h:17

◆ operator=()

GeoPixelServices & GeoPixelServices::operator= ( const GeoPixelServices & )
delete

Member Data Documentation

◆ m_DDmgr

InDetDD::PixelDetectorManager* GeoVPixelFactory::m_DDmgr
protectedinherited

Definition at line 45 of file GeoVPixelFactory.h.

◆ m_epsilon

const double GeoVPixelFactory::m_epsilon
protectedinherited

Definition at line 49 of file GeoVPixelFactory.h.

◆ m_gmt_mgr

PixelGeometryManager* GeoVPixelFactory::m_gmt_mgr
protectedinherited

Definition at line 43 of file GeoVPixelFactory.h.

◆ m_layerShift

std::vector<double> GeoPixelServices::m_layerShift
private

Definition at line 39 of file GeoPixelServices.h.

◆ m_mapAX

std::shared_ptr<std::map<std::string, GeoAlignableTransform*> > GeoVPixelFactory::m_mapAX
protectedinherited

Definition at line 48 of file GeoVPixelFactory.h.

◆ m_mapFPV

std::shared_ptr<std::map<std::string, GeoFullPhysVol*> > GeoVPixelFactory::m_mapFPV
protectedinherited

Definition at line 47 of file GeoVPixelFactory.h.

◆ m_mat_mgr

InDetMaterialManager* GeoVPixelFactory::m_mat_mgr
protectedinherited

Definition at line 44 of file GeoVPixelFactory.h.

◆ m_pixServBuilder

InDetDD::VolumeBuilder* GeoPixelServices::m_pixServBuilder
private

Definition at line 37 of file GeoPixelServices.h.

◆ m_services

std::vector<const InDetDD::ServiceVolume *> GeoPixelServices::m_services
private

Definition at line 36 of file GeoPixelServices.h.

◆ m_servMatBuilder

InDetDD::VolumeBuilder* GeoPixelServices::m_servMatBuilder
private

Definition at line 38 of file GeoPixelServices.h.

◆ m_sqliteReader

GeoModelIO::ReadGeoModel* GeoVPixelFactory::m_sqliteReader
protectedinherited

Definition at line 46 of file GeoVPixelFactory.h.


The documentation for this class was generated from the following files: