ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ReplicatedSlice.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ReplicatedSlice.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // G4ReplicatedSlice
27 //
28 // Class description:
29 //
30 // G4ReplicatedSlice represents many touchable detector elements differing
31 // only in their positioning. The elements' positions are calculated by means
32 // of a simple linear formula.
33 //
34 // Division may occur along:
35 //
36 // o Cartesian axes (kXAxis,kYAxis,kZAxis)
37 //
38 // The divisions, of specified width have coordinates of
39 // form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1
40 // for the case of kXAxis, and are unrotated.
41 //
42 // o Radial axis (cylindrical polar) (kRho)
43 //
44 // The divisions are cons/tubs sections, centred on the origin
45 // and are unrotated.
46 // They have radii of width*n+offset to width*(n+1)+offset
47 // where n=0..nReplicas-1
48 //
49 // o Phi axis (cylindrical polar) (kPhi)
50 // The divisions are `phi sections' or wedges, and of cons/tubs form
51 // They have phi of offset+n*width to offset+(n+1)*width where
52 // n=0..nReplicas-1
53 
54 // Author: M.Asai (SLAC), 20/04/2010 - Extended from G4PVDivision
55 // ----------------------------------------------------------------------
56 #ifndef G4REPLICATEDSLICE_HH
57 #define G4REPLICATEDSLICE_HH 1
58 
59 #include "geomdefs.hh"
60 #include "G4VPhysicalVolume.hh"
62 
63 class G4LogicalVolume;
64 class G4VSolid;
65 
67 {
68  public: // with description
69 
70  G4ReplicatedSlice(const G4String& pName,
71  G4LogicalVolume* pLogical,
72  G4LogicalVolume* pMotherLogical,
73  const EAxis pAxis,
74  const G4int nReplicas,
75  const G4double width,
76  const G4double half_gap,
77  const G4double offset );
78  // Constructor with number of divisions and width
79 
80  G4ReplicatedSlice(const G4String& pName,
81  G4LogicalVolume* pLogical,
82  G4LogicalVolume* pMotherLogical,
83  const EAxis pAxis,
84  const G4int nReplicas,
85  const G4double half_gap,
86  const G4double offset );
87  // Constructor with number of divisions
88 
89  G4ReplicatedSlice(const G4String& pName,
90  G4LogicalVolume* pLogical,
91  G4LogicalVolume* pMotherLogical,
92  const EAxis pAxis,
93  const G4double width,
94  const G4double half_gap,
95  const G4double offset );
96  // Constructor with width
97 
98  G4ReplicatedSlice(const G4String& pName,
99  G4LogicalVolume* pLogical,
100  G4VPhysicalVolume* pMotherPhysical,
101  const EAxis pAxis,
102  const G4int nReplicas,
103  const G4double width,
104  const G4double half_gap,
105  const G4double offset);
106  // Constructor in mother physical volume
107 
108  G4ReplicatedSlice(const G4String& pName,
109  G4LogicalVolume* pLogical,
110  G4VPhysicalVolume* pMotherPhysical,
111  const EAxis pAxis,
112  const G4int nReplicas,
113  const G4double half_gap,
114  const G4double offset );
115  // Constructor with number of divisions
116 
117  G4ReplicatedSlice(const G4String& pName,
118  G4LogicalVolume* pLogical,
119  G4VPhysicalVolume* pMotherPhysical,
120  const EAxis pAxis,
121  const G4double width,
122  const G4double half_gap,
123  const G4double offset );
124  // Constructor with width
125 
126  virtual ~G4ReplicatedSlice();
127 
128  G4ReplicatedSlice(const G4ReplicatedSlice&) = delete;
130 
131  virtual G4bool IsMany() const;
132  virtual G4int GetCopyNo() const;
133  virtual void SetCopyNo(G4int CopyNo);
134  virtual G4bool IsReplicated() const;
135  virtual G4int GetMultiplicity() const;
137  virtual void GetReplicationData( EAxis& axis,
138  G4int& nReplicas,
139  G4double& width,
140  G4double& offset,
141  G4bool& consuming ) const;
142  EAxis GetDivisionAxis() const;
143  G4bool IsParameterised() const;
144 
145  EVolume VolumeType() const final;
146  // Characterise the type of volume - normal/replicated/parameterised.
147 
148  G4bool IsRegularStructure() const;
149  G4int GetRegularStructureId() const;
150  // Methods to identify volume that can apply 'regular' navigation.
151  // Currently divisions do not qualify for this.
152 
153  private:
154 
155  void CheckAndSetParameters( const EAxis pAxis,
156  const G4int nDivs,
157  const G4double width,
158  const G4double half_gap,
159  const G4double offset,
160  DivisionType divType,
161  G4LogicalVolume* pMotherLogical,
162  const G4LogicalVolume* pLogical );
163 
164  void SetParameterisation( G4LogicalVolume* motherLogical,
165  const EAxis pAxis,
166  const G4int nReplicas,
167  const G4double width,
168  const G4double half_gap,
169  const G4double offset,
170  DivisionType divType );
171 
172  void ErrorInAxis( EAxis axis, G4VSolid* solid );
173 
174  protected:
175 
176  EAxis faxis; // axis of optimisation
177  EAxis fdivAxis; // axis of division
179  G4double fwidth = 0.0, foffset = 0.0;
182 };
183 
184 #endif