ATLAS Offline Software
Loading...
Searching...
No Matches
PolyconicalEnvelope.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Base class
8
9#include "G4NistManager.hh"
10#include "G4LogicalVolume.hh"
11#include "G4PVPlacement.hh"
12#include "G4SystemOfUnits.hh"
13#include "G4Polycone.hh"
14
15// Geant4 includes used in functions
16
17PolyconicalEnvelope::PolyconicalEnvelope(const std::string& type, const std::string& name, const IInterface* parent)
18 : DetectorGeometryBase(type,name,parent)
19{
20 ATH_MSG_VERBOSE( "PolyconicalEnvelope constructor for " << name );
21}
22
24{
25 ATH_MSG_VERBOSE( "PolyconicalEnvelope::BuildGeometry(): Starting" );
26
27 // Get nist material manager
28 G4NistManager* nist = G4NistManager::Instance();
29
30 G4Material* mat = nist->FindOrBuildMaterial(m_materialName.value());
31
33
34 if (m_innerRadii.size() != m_surfaceNr)
35 ATH_MSG_ERROR("Size of inner radii vector "<<m_innerRadii.size()<<
36 " differs from nr. of surfaces "<<m_surfaceNr<<"!!!");
37 if (m_outerRadii.size() != m_surfaceNr)
38 ATH_MSG_ERROR("Size of outer radii vector "<<m_outerRadii.size()<<
39 " differs from nr. of surfaces "<<m_surfaceNr<<"!!!");
40 if (m_ZSurfaces.size() != m_surfaceNr)
41 ATH_MSG_ERROR("Size of surface Z vector "<<m_ZSurfaces.size()<<
42 " differs from nr. of surfaces "<<m_surfaceNr<<"!!!");
43
44 double* zv=new double[m_surfaceNr];
45 double* iv=new double[m_surfaceNr];
46 double* ov=new double[m_surfaceNr];
47
48 for (unsigned int i=0;i<m_surfaceNr;i++)
49 {
50 zv[i]=m_ZSurfaces[i];
51 iv[i]=m_innerRadii[i];
52 ov[i]=m_outerRadii[i];
53 }
54
55 G4VSolid* envSolid=new G4Polycone(m_detectorName.value(),m_startphi,m_deltaphi,m_surfaceNr,zv,iv,ov);
56
57 G4LogicalVolume* logicWorld = new G4LogicalVolume(envSolid,mat,m_detectorName.value());
58
59 m_envelope.theEnvelope=logicWorld;
60
61 delete[] zv;
62 delete[] iv;
63 delete[] ov;
64 ATH_MSG_VERBOSE( "PolyconicalEnvelope::BuildGeometry(): Finished" );
65 return;
66}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
DetectorGeometryBase(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_detectorName
Gaudi::Property< std::vector< double > > m_outerRadii
Gaudi::Property< unsigned int > m_surfaceNr
Gaudi::Property< std::string > m_materialName
Gaudi::Property< double > m_startphi
Gaudi::Property< std::vector< double > > m_innerRadii
Gaudi::Property< std::vector< double > > m_ZSurfaces
virtual void BuildGeometry() override final
virtual methods being implemented here
Gaudi::Property< double > m_deltaphi
PolyconicalEnvelope(const std::string &type, const std::string &name, const IInterface *parent)