Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:59

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4PVDivision
0027 //
0028 // Class description:
0029 //
0030 // Represents many touchable detector elements differing only in their
0031 // positioning. The elements' positions are calculated by means of a simple
0032 // linear formula.
0033 // 
0034 // G4PVDivision(const G4String& pName,
0035 //                    G4LogicalVolume* pLogical,
0036 //                    G4LogicalVolume* pMother,
0037 //              const EAxis pAxis,
0038 //              const G4int nReplicas,
0039 //              const G4double width,
0040 //              const G4double offset=0)
0041 //
0042 // Division may occur along:
0043 //
0044 // o Cartesian axes (kXAxis,kYAxis,kZAxis)
0045 //
0046 //   The divisions, of specified width have coordinates of
0047 //   form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1
0048 //   for the case of kXAxis, and are unrotated.
0049 //
0050 // o Radial axis (cylindrical polar) (kRho)
0051 //
0052 //   The divisions are cons/tubs sections, centred on the origin
0053 //   and are unrotated.
0054 //   They have radii of width*n+offset to width*(n+1)+offset
0055 //                      where n=0..nReplicas-1
0056 //
0057 // o Phi axis (cylindrical polar) (kPhi)
0058 //   The divisions are `phi sections' or wedges, and of cons/tubs form
0059 //   They have phi of offset+n*width to offset+(n+1)*width where
0060 //   n=0..nReplicas-1
0061 
0062 // 09.05.01 - P.Arce, Initial version
0063 // ----------------------------------------------------------------------
0064 #ifndef G4PVDIVISION_HH
0065 #define G4PVDIVISION_HH
0066 
0067 #include "geomdefs.hh"
0068 #include "G4PVReplica.hh"
0069 #include "G4VDivisionParameterisation.hh"
0070 
0071 class G4LogicalVolume;
0072 class G4VSolid;
0073 
0074 class G4PVDivision : public G4PVReplica
0075 {
0076   public:  // with description
0077     
0078     G4PVDivision(const G4String& pName,
0079                        G4LogicalVolume* pLogical,
0080                        G4LogicalVolume* pMother,
0081                  const EAxis pAxis,
0082                  const G4int nReplicas,
0083                  const G4double width,
0084                  const G4double offset );
0085       // Constructor with number of divisions and width
0086 
0087     G4PVDivision(const G4String& pName,
0088                        G4LogicalVolume* pLogical,
0089                        G4LogicalVolume* pMotherLogical,
0090                  const EAxis pAxis,
0091                  const G4int nReplicas,
0092                  const G4double offset );
0093       // Constructor with number of divisions 
0094 
0095     G4PVDivision(const G4String& pName,
0096                        G4LogicalVolume* pLogical,
0097                        G4LogicalVolume* pMotherLogical,
0098                  const EAxis pAxis,
0099                  const G4double width,
0100                  const G4double offset );
0101       // Constructor with width
0102 
0103     G4PVDivision(const G4String& pName,
0104                        G4LogicalVolume* pLogical,
0105                        G4VPhysicalVolume* pMother,
0106                  const EAxis pAxis,
0107                  const G4int nReplicas,
0108                  const G4double width,
0109                  const G4double offset);
0110       // Constructor in mother physical volume (same as first constructor)
0111 
0112     ~G4PVDivision() override;
0113 
0114     G4PVDivision(const G4PVDivision&) = delete;
0115     G4PVDivision& operator=(const G4PVDivision&) = delete;
0116 
0117     G4bool IsMany() const override;
0118     G4bool IsReplicated() const override;
0119     G4int GetMultiplicity() const override;
0120     G4VPVParameterisation* GetParameterisation() const override;
0121     void GetReplicationData( EAxis& axis,
0122                                      G4int& nReplicas,
0123                                      G4double& width,
0124                                      G4double& offset,
0125                                      G4bool& consuming ) const override;
0126     EAxis  GetDivisionAxis() const;
0127     G4bool IsParameterised() const override;
0128    
0129     EVolume VolumeType() const override;
0130       // Characterise the type of volume - normal/replicated/parameterised.
0131 
0132     G4bool IsRegularStructure() const override; 
0133     G4int  GetRegularStructureId() const override; 
0134       // Methods to identify volume that can have revised 'regular' navigation.
0135       // Currently divisions do not qualify for this.
0136 
0137   private:
0138 
0139     void CheckAndSetParameters( const EAxis pAxis,
0140                                 const G4int nDivs,
0141                                 const G4double width,
0142                                 const G4double offset, 
0143                                       DivisionType divType,
0144                                 const G4LogicalVolume* pMotherLogical );
0145 
0146     void SetParameterisation( G4LogicalVolume* motherLogical,
0147                         const EAxis pAxis,
0148                         const G4int nReplicas,
0149                         const G4double width,
0150                         const G4double offset, 
0151                               DivisionType divType );
0152     void ErrorInAxis( EAxis axis, G4VSolid* solid );
0153 
0154   protected:
0155 
0156     EAxis faxis;             // axis of optimisation
0157     EAxis fdivAxis;          // axis of division
0158     G4int fnReplicas = 0;
0159     G4double fwidth = 0.0, foffset = 0.0;
0160     G4VDivisionParameterisation* fparam = nullptr; 
0161 };
0162 
0163 #endif