Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4ReplicatedSlice
0027 //
0028 // Class description:
0029 //
0030 // G4ReplicatedSlice represents many touchable detector elements differing
0031 // only in their positioning. The elements' positions are calculated by means
0032 // of a simple linear formula.
0033 // 
0034 // Division may occur along:
0035 //
0036 // o Cartesian axes (kXAxis,kYAxis,kZAxis)
0037 //
0038 //   The divisions, of specified width have coordinates of
0039 //   form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1
0040 //   for the case of kXAxis, and are unrotated.
0041 //
0042 // o Radial axis (cylindrical polar) (kRho)
0043 //
0044 //   The divisions are cons/tubs sections, centred on the origin
0045 //   and are unrotated.
0046 //   They have radii of width*n+offset to width*(n+1)+offset
0047 //                      where n=0..nReplicas-1
0048 //
0049 // o Phi axis (cylindrical polar) (kPhi)
0050 //   The divisions are `phi sections' or wedges, and of cons/tubs form
0051 //   They have phi of offset+n*width to offset+(n+1)*width where
0052 //   n=0..nReplicas-1
0053 
0054 // Author: M.Asai (SLAC), 20/04/2010 - Extended from G4PVDivision
0055 // ----------------------------------------------------------------------
0056 #ifndef G4REPLICATEDSLICE_HH 
0057 #define G4REPLICATEDSLICE_HH 1
0058 
0059 #include "geomdefs.hh"
0060 #include "G4PVReplica.hh"
0061 #include "G4VDivisionParameterisation.hh"
0062 
0063 class G4LogicalVolume;
0064 class G4VSolid;
0065 
0066 class G4ReplicatedSlice : public G4PVReplica
0067 {
0068   public:
0069     
0070     G4ReplicatedSlice(const G4String& pName,
0071                             G4LogicalVolume* pLogical,
0072                             G4LogicalVolume* pMotherLogical,
0073                       const EAxis pAxis,
0074                       const G4int nReplicas,
0075                       const G4double width,
0076                       const G4double half_gap,
0077                       const G4double offset );
0078       // Constructor with number of divisions and width
0079 
0080     G4ReplicatedSlice(const G4String& pName,
0081                             G4LogicalVolume* pLogical,
0082                             G4LogicalVolume* pMotherLogical,
0083                       const EAxis pAxis,
0084                       const G4int nReplicas,
0085                       const G4double half_gap,
0086                       const G4double offset );
0087       // Constructor with number of divisions 
0088 
0089     G4ReplicatedSlice(const G4String& pName,
0090                             G4LogicalVolume* pLogical,
0091                             G4LogicalVolume* pMotherLogical,
0092                       const EAxis pAxis,
0093                       const G4double width,
0094                       const G4double half_gap,
0095                       const G4double offset );
0096       // Constructor with width
0097 
0098     G4ReplicatedSlice(const G4String& pName,
0099                             G4LogicalVolume* pLogical,
0100                             G4VPhysicalVolume* pMotherPhysical,
0101                       const EAxis pAxis,
0102                       const G4int nReplicas,
0103                       const G4double width,
0104                       const G4double half_gap,
0105                       const G4double offset);
0106       // Constructor in mother physical volume
0107 
0108     G4ReplicatedSlice(const G4String& pName,
0109                             G4LogicalVolume* pLogical,
0110                             G4VPhysicalVolume* pMotherPhysical,
0111                       const EAxis pAxis,
0112                       const G4int nReplicas,
0113                       const G4double half_gap,
0114                       const G4double offset );
0115       // Constructor with number of divisions 
0116 
0117     G4ReplicatedSlice(const G4String& pName,
0118                             G4LogicalVolume* pLogical,
0119                             G4VPhysicalVolume* pMotherPhysical,
0120                       const EAxis pAxis,
0121                       const G4double width,
0122                       const G4double half_gap,
0123                       const G4double offset );
0124       // Constructor with width
0125 
0126     ~G4ReplicatedSlice() override;
0127 
0128     G4ReplicatedSlice(const G4ReplicatedSlice&) = delete;
0129     G4ReplicatedSlice& operator=(const G4ReplicatedSlice&) = delete;
0130 
0131     G4bool IsMany() const override;
0132     G4bool IsReplicated() const override;
0133     G4int GetMultiplicity() const override;
0134     G4VPVParameterisation* GetParameterisation() const override;
0135     void GetReplicationData( EAxis& axis,
0136                              G4int& nReplicas,
0137                              G4double& width,
0138                              G4double& offset,
0139                              G4bool& consuming ) const override;
0140     EAxis  GetDivisionAxis() const;
0141     G4bool IsParameterised() const override;
0142    
0143     EVolume VolumeType() const final;
0144       // Characterise the type of volume - normal/replicated/parameterised.
0145 
0146     G4bool IsRegularStructure() const override; 
0147     G4int  GetRegularStructureId() const override; 
0148       // Methods to identify volume that can apply 'regular' navigation.
0149       // Currently divisions do not qualify for this.
0150 
0151   private:
0152 
0153     void CheckAndSetParameters( const EAxis pAxis,
0154                                 const G4int nDivs,
0155                                 const G4double width,
0156                                 const G4double half_gap,
0157                                 const G4double offset, 
0158                                       DivisionType divType,
0159                                       G4LogicalVolume* pMotherLogical,
0160                                 const G4LogicalVolume* pLogical );
0161 
0162     void SetParameterisation(       G4LogicalVolume* motherLogical,
0163                               const EAxis pAxis,
0164                               const G4int nReplicas,
0165                               const G4double width,
0166                               const G4double half_gap,
0167                               const G4double offset, 
0168                                     DivisionType divType );
0169 
0170     void ErrorInAxis( EAxis axis, G4VSolid* solid );
0171 
0172   protected:
0173 
0174     EAxis faxis;             // axis of optimisation
0175     EAxis fdivAxis;          // axis of division
0176     G4int fnReplicas = 0;
0177     G4double fwidth = 0.0, foffset = 0.0;
0178     G4VDivisionParameterisation* fparam = nullptr; 
0179 };
0180 
0181 #endif