Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:21:51

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