Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-11 09:11:41

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 // G4ParameterisationPolyhedra[Rho/Phi/Z]
0027 //
0028 // Class description:
0029 //
0030 // These classes represent the parameterised positioning equivalent to 
0031 // dividing a G4Polyhedra along one of each axis Rho, Phi, Z.
0032 
0033 // Author: Pedro Arce (CIEMAT), 09.05.2001 - Initial version
0034 //         Ivana Hrivnacova (Orsay), 08.04.2004 - Implemented reflection
0035 //---------------------------------------------------------------------
0036 #ifndef G4PARAMETERISATIONPOLYHEDRA_HH
0037 #define G4PARAMETERISATIONPOLYHEDRA_HH 1
0038 
0039 #include "G4VDivisionParameterisation.hh"
0040 #include "G4Polyhedra.hh"
0041 
0042 class G4VPhysicalVolume;
0043 
0044 // Dummy declarations to get rid of warnings ...
0045 //
0046 class G4Trd;
0047 class G4Trap;
0048 class G4Cons;
0049 class G4Sphere;
0050 class G4Orb;
0051 class G4Ellipsoid;
0052 class G4Torus;
0053 class G4Para;
0054 class G4Hype;
0055 class G4Tubs;
0056 class G4Polycone;
0057 
0058 /**
0059  * @brief G4VParameterisationPolyhedra is the base class for the parameterised
0060  * positioning equivalent to dividing a G4Polyhedra along one of each axis Rho,
0061  * Phi, Z.
0062  */
0063 
0064 class G4VParameterisationPolyhedra : public G4VDivisionParameterisation
0065 { 
0066   public:
0067   
0068     /**
0069      * Initialises a parameterised polyhedra, given the axis of parameterisation
0070      * 'axis' and the number of divided slices 'nCopies'.
0071      *  @param[in] axis The axis along which apply the parameterisation.
0072      *  @param[in] nCopies The total number of divided slices.
0073      *  @param[in] offset Potential initial offset along the axis.
0074      *  @param[in] step The width of the divided slice.
0075      *  @param[in] pSolid Pointer to the original shape to parameterise.
0076      *  @param[in] divType String identifier for the kind of division.
0077      */
0078     G4VParameterisationPolyhedra( EAxis axis, G4int nCopies,
0079                                   G4double offset, G4double step,
0080                                   G4VSolid* pSolid, DivisionType divType );
0081   
0082     /**
0083      * Default Destructor.
0084      */
0085     ~G4VParameterisationPolyhedra() override;
0086 
0087   private:
0088 
0089     /**
0090      * Converts radius of the sides to radius of the corners:
0091      * i.e. - r_corners = r_sides/factor.
0092      *  @returns The cosine of (0.5*phiTotal/nofSides).
0093      */
0094     G4double ConvertRadiusFactor(const G4Polyhedra& phedra) const;
0095 
0096 };
0097 
0098 /**
0099  * @brief G4ParameterisationPolyhedraRho represents the parameterised positioning
0100  * equivalent to dividing a G4Polyhedra along Rho axis.
0101  */
0102 
0103 class G4ParameterisationPolyhedraRho : public G4VParameterisationPolyhedra
0104 { 
0105   public:
0106 
0107     /**
0108      * Initialises a parameterised polyhedra, along the Rho axis.
0109      *  @param[in] axis The axis along which apply the parameterisation.
0110      *  @param[in] nCopies The total number of divided slices.
0111      *  @param[in] offset Potential initial offset along the axis.
0112      *  @param[in] step The width of the divided slice.
0113      *  @param[in] pSolid Pointer to the original shape to parameterise.
0114      *  @param[in] divType String identifier for the kind of division.
0115      */
0116     G4ParameterisationPolyhedraRho( EAxis axis, G4int nCopies,
0117                                     G4double offset, G4double step,
0118                                     G4VSolid* pSolid,
0119                                     DivisionType divType );
0120 
0121     /**
0122      * Default Destructor.
0123      */
0124    ~G4ParameterisationPolyhedraRho() override;
0125 
0126     /**
0127      * Checks the validity of parameters given in input, issuing an exception.
0128      */
0129     void CheckParametersValidity() override;
0130 
0131     /**
0132      * Returns the max width along Rho.
0133      *  @returns The maximum width of the solid to divide along the Rho axis.
0134      */
0135     G4double GetMaxParameter() const override;
0136 
0137     /**
0138      * Concrete methods implementing the parameterisation.
0139      */
0140     void ComputeTransformation( const G4int copyNo,
0141                                       G4VPhysicalVolume* physVol ) const override;
0142     void ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
0143                             const G4VPhysicalVolume* physVol ) const override;
0144 
0145   private:  // Dummy declarations to get rid of warnings ...
0146 
0147     void ComputeDimensions (G4Trd&,const G4int,
0148                             const G4VPhysicalVolume*) const override {}
0149     void ComputeDimensions (G4Trap&,const G4int,
0150                             const G4VPhysicalVolume*) const override {}
0151     void ComputeDimensions (G4Box&,const G4int,
0152                             const G4VPhysicalVolume*) const override {}
0153     void ComputeDimensions (G4Sphere&,const G4int,
0154                             const G4VPhysicalVolume*) const override {}
0155     void ComputeDimensions (G4Orb&,const G4int,
0156                             const G4VPhysicalVolume*) const override {}
0157     void ComputeDimensions (G4Ellipsoid&,const G4int,
0158                             const G4VPhysicalVolume*) const override {}
0159     void ComputeDimensions (G4Torus&,const G4int,
0160                             const G4VPhysicalVolume*) const override {}
0161     void ComputeDimensions (G4Para&,const G4int,
0162                             const G4VPhysicalVolume*) const override {}
0163     void ComputeDimensions (G4Hype&,const G4int,
0164                             const G4VPhysicalVolume*) const override {}
0165     void ComputeDimensions (G4Tubs&,const G4int,
0166                             const G4VPhysicalVolume*) const override {}
0167     void ComputeDimensions (G4Cons&,const G4int,
0168                             const G4VPhysicalVolume*) const override {}
0169     void ComputeDimensions (G4Polycone&,const G4int,
0170                             const G4VPhysicalVolume*) const override {}
0171 };
0172 
0173 /**
0174  * @brief G4ParameterisationPolyhedraPhi represents the parameterised positioning
0175  * equivalent to dividing a G4Polyhedra along Phi axis.
0176  */
0177 
0178 class G4ParameterisationPolyhedraPhi : public G4VParameterisationPolyhedra
0179 { 
0180   public:
0181 
0182     /**
0183      * Initialises a parameterised polyhedra, along the Phi axis.
0184      *  @param[in] axis The axis along which apply the parameterisation.
0185      *  @param[in] nCopies The total number of divided slices.
0186      *  @param[in] offset Potential initial offset along the axis.
0187      *  @param[in] step The width of the divided slice.
0188      *  @param[in] pSolid Pointer to the original shape to parameterise.
0189      *  @param[in] divType String identifier for the kind of division.
0190      */
0191     G4ParameterisationPolyhedraPhi( EAxis axis, G4int nCopies,
0192                                     G4double offset, G4double step,
0193                                     G4VSolid* pSolid,
0194                                     DivisionType divType );
0195 
0196     /**
0197      * Default Destructor.
0198      */
0199    ~G4ParameterisationPolyhedraPhi() override;
0200 
0201     /**
0202      * Checks the validity of parameters given in input, issuing an exception.
0203      */
0204     void CheckParametersValidity() override;
0205 
0206     /**
0207      * Returns the max width along Phi.
0208      *  @returns The maximum width of the solid to divide along the Phi axis.
0209      */
0210     G4double GetMaxParameter() const override;
0211 
0212     /**
0213      * Concrete methods implementing the parameterisation.
0214      */
0215     void ComputeTransformation( const G4int copyNo,
0216                                       G4VPhysicalVolume* physVol ) const override;
0217     void ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
0218                             const G4VPhysicalVolume* physVol ) const override;
0219 
0220   private:  // Dummy declarations to get rid of warnings ...
0221 
0222     void ComputeDimensions (G4Trd&,const G4int,
0223                             const G4VPhysicalVolume*) const override {}
0224     void ComputeDimensions (G4Trap&,const G4int,
0225                             const G4VPhysicalVolume*) const override {}
0226     void ComputeDimensions (G4Box&,const G4int,
0227                             const G4VPhysicalVolume*) const override {}
0228     void ComputeDimensions (G4Sphere&,const G4int,
0229                             const G4VPhysicalVolume*) const override {}
0230     void ComputeDimensions (G4Orb&,const G4int,
0231                             const G4VPhysicalVolume*) const override {}
0232     void ComputeDimensions (G4Ellipsoid&,const G4int,
0233                             const G4VPhysicalVolume*) const override {}
0234     void ComputeDimensions (G4Torus&,const G4int,
0235                             const G4VPhysicalVolume*) const override {}
0236     void ComputeDimensions (G4Para&,const G4int,
0237                             const G4VPhysicalVolume*) const override {}
0238     void ComputeDimensions (G4Hype&,const G4int,
0239                             const G4VPhysicalVolume*) const override {}
0240     void ComputeDimensions (G4Tubs&,const G4int,
0241                             const G4VPhysicalVolume*) const override {}
0242     void ComputeDimensions (G4Cons&,const G4int,
0243                             const G4VPhysicalVolume*) const override {}
0244     void ComputeDimensions (G4Polycone&,const G4int,
0245                             const G4VPhysicalVolume*) const override {}
0246 };
0247 
0248 /**
0249  * @brief G4ParameterisationPolyhedraZ represents the parameterised positioning
0250  * equivalent to dividing a G4Polyhedra along Z axis.
0251  */
0252 
0253 class G4ParameterisationPolyhedraZ : public G4VParameterisationPolyhedra
0254 { 
0255   public:
0256 
0257     /**
0258      * Initialises a parameterised polyhedra, along the Z axis.
0259      *  @param[in] axis The axis along which apply the parameterisation.
0260      *  @param[in] nCopies The total number of divided slices.
0261      *  @param[in] offset Potential initial offset along the axis.
0262      *  @param[in] step The width of the divided slice.
0263      *  @param[in] pSolid Pointer to the original shape to parameterise.
0264      *  @param[in] divType String identifier for the kind of division.
0265      */
0266     G4ParameterisationPolyhedraZ( EAxis axis, G4int nCopies,
0267                                   G4double offset, G4double step,
0268                                   G4VSolid* pSolid,
0269                                   DivisionType divType );
0270 
0271     /**
0272      * Default Destructor.
0273      */
0274    ~G4ParameterisationPolyhedraZ() override;
0275 
0276     /**
0277      * Checks the validity of parameters given in input, issuing an exception.
0278      */
0279     void CheckParametersValidity() override;
0280 
0281     /**
0282      * Returns the max width along Z.
0283      *  @returns The maximum width of the solid to divide along the Z axis.
0284      */
0285     G4double GetMaxParameter() const override;
0286 
0287     /**
0288      * Concrete methods implementing the parameterisation.
0289      */
0290     void ComputeTransformation( const G4int copyNo,
0291                                       G4VPhysicalVolume* physVol ) const override;
0292     void ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
0293                             const G4VPhysicalVolume* physVol ) const override;
0294 
0295   private:
0296 
0297     /**
0298      * Internal accessors for the original R parameters of the solid to divide.
0299      */
0300     G4double GetR(G4double z, G4double z1, G4double r1,
0301                   G4double z2, G4double r2) const;
0302     G4double GetRmin(G4double z, G4int nsegment) const;
0303     G4double GetRmax(G4double z, G4int nsegment) const;
0304 
0305     // Dummy declarations to get rid of warnings ...
0306     void ComputeDimensions (G4Trd&,const G4int,
0307                             const G4VPhysicalVolume*) const override {}
0308     void ComputeDimensions (G4Trap&,const G4int,
0309                             const G4VPhysicalVolume*) const override {}
0310     void ComputeDimensions (G4Box&,const G4int,
0311                             const G4VPhysicalVolume*) const override {}
0312     void ComputeDimensions (G4Sphere&,const G4int,
0313                             const G4VPhysicalVolume*) const override {}
0314     void ComputeDimensions (G4Orb&,const G4int,
0315                             const G4VPhysicalVolume*) const override {}
0316     void ComputeDimensions (G4Ellipsoid&,const G4int,
0317                             const G4VPhysicalVolume*) const override {}
0318     void ComputeDimensions (G4Torus&,const G4int,
0319                             const G4VPhysicalVolume*) const override {}
0320     void ComputeDimensions (G4Para&,const G4int,
0321                             const G4VPhysicalVolume*) const override {}
0322     void ComputeDimensions (G4Hype&,const G4int,
0323                             const G4VPhysicalVolume*) const override {}
0324     void ComputeDimensions (G4Tubs&,const G4int,
0325                             const G4VPhysicalVolume*) const override {}
0326     void ComputeDimensions (G4Cons&,const G4int,
0327                             const G4VPhysicalVolume*) const override {}
0328     void ComputeDimensions (G4Polycone&,const G4int,
0329                             const G4VPhysicalVolume*) const override {}
0330   private:
0331 
0332     G4int fNSegment = 0;
0333     G4PolyhedraHistorical* fOrigParamMother = nullptr;
0334 };
0335 
0336 #endif