File indexing completed on 2025-01-31 09:21:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef CEXMC_SETUP_HH
0045 #define CEXMC_SETUP_HH
0046
0047 #include <G4VUserDetectorConstruction.hh>
0048 #include <G4AffineTransform.hh>
0049 #include <G4ThreeVector.hh>
0050 #include <G4RotationMatrix.hh>
0051 #include <G4String.hh>
0052 #include "CexmcSensitiveDetectorsAttributes.hh"
0053
0054 class G4GDMLParser;
0055 class G4LogicalVolume;
0056 class G4VPhysicalVolume;
0057
0058
0059 class CexmcSetup : public G4VUserDetectorConstruction
0060 {
0061 public:
0062 enum SpecialVolumeType
0063 {
0064 Monitor,
0065 VetoCounter,
0066 Calorimeter,
0067 Target
0068 };
0069
0070 struct CalorimeterGeometryData
0071 {
0072 CalorimeterGeometryData() :
0073 nCrystalsInColumn( 1 ), nCrystalsInRow( 1 ), crystalWidth( 0 ),
0074 crystalHeight( 0 ), crystalLength( 0 )
0075 {}
0076
0077 G4int nCrystalsInColumn;
0078
0079 G4int nCrystalsInRow;
0080
0081 G4double crystalWidth;
0082
0083 G4double crystalHeight;
0084
0085 G4double crystalLength;
0086 };
0087
0088 public:
0089 explicit CexmcSetup( const G4String & gdmlFile = "default.gdml",
0090 G4bool validateGDMLFile = false );
0091
0092 G4VPhysicalVolume * Construct( void );
0093
0094 public:
0095 const G4AffineTransform & GetTargetTransform( void ) const;
0096
0097 const G4AffineTransform & GetCalorimeterLeftTransform( void ) const;
0098
0099 const G4AffineTransform & GetCalorimeterRightTransform( void ) const;
0100
0101 void ConvertToCrystalGeometry( const G4ThreeVector & src,
0102 G4int & row, G4int & column, G4ThreeVector & dst ) const;
0103
0104 const CalorimeterGeometryData & GetCalorimeterGeometry( void ) const;
0105
0106 const G4LogicalVolume * GetVolume( SpecialVolumeType volume ) const;
0107
0108 G4bool IsRightDetector( const G4VPhysicalVolume * pVolume ) const;
0109
0110 G4bool IsRightCalorimeter( const G4VPhysicalVolume * pVolume ) const;
0111
0112 private:
0113 void SetupSpecialVolumes( const G4GDMLParser & gdmlParser );
0114
0115 void ReadTransforms( const G4GDMLParser & gdmlParser );
0116
0117 void ReadCalorimeterGeometryData( const G4LogicalVolume * lVolume );
0118
0119 void ReadRightDetectors( void );
0120
0121 private:
0122 static void AssertAndAsignDetectorRole(
0123 CexmcDetectorRole & detectorRole, CexmcDetectorRole value );
0124
0125 static void RotateMatrix( const G4ThreeVector & pos,
0126 G4RotationMatrix & rm );
0127
0128 private:
0129 G4VPhysicalVolume * world;
0130
0131 G4String gdmlFile;
0132
0133 G4bool validateGDMLFile;
0134
0135 G4bool calorimeterRegionInitialized;
0136
0137 G4bool calorimeterGeometryDataInitialized;
0138
0139 G4LogicalVolume * monitorVolume;
0140
0141 G4LogicalVolume * vetoCounterVolume;
0142
0143 G4LogicalVolume * calorimeterVolume;
0144
0145 G4LogicalVolume * targetVolume;
0146
0147 G4VPhysicalVolume * rightVetoCounter;
0148
0149 G4VPhysicalVolume * rightCalorimeter;
0150
0151 G4AffineTransform targetTransform;
0152
0153 G4AffineTransform calorimeterLeftTransform;
0154
0155 G4AffineTransform calorimeterRightTransform;
0156
0157 CalorimeterGeometryData calorimeterGeometry;
0158 };
0159
0160
0161 inline const G4AffineTransform & CexmcSetup::GetTargetTransform( void ) const
0162 {
0163 return targetTransform;
0164 }
0165
0166
0167 inline const G4AffineTransform & CexmcSetup::GetCalorimeterLeftTransform(
0168 void ) const
0169 {
0170 return calorimeterLeftTransform;
0171 }
0172
0173
0174 inline const G4AffineTransform & CexmcSetup::GetCalorimeterRightTransform(
0175 void ) const
0176 {
0177 return calorimeterRightTransform;
0178 }
0179
0180
0181 inline const CexmcSetup::CalorimeterGeometryData &
0182 CexmcSetup::GetCalorimeterGeometry( void ) const
0183 {
0184 return calorimeterGeometry;
0185 }
0186
0187
0188 inline const G4LogicalVolume * CexmcSetup::GetVolume(
0189 SpecialVolumeType volume ) const
0190 {
0191 switch ( volume )
0192 {
0193 case Monitor :
0194 return monitorVolume;
0195 case VetoCounter :
0196 return vetoCounterVolume;
0197 case Calorimeter :
0198 return calorimeterVolume;
0199 case Target :
0200 return targetVolume;
0201 default :
0202 return NULL;
0203 }
0204 }
0205
0206
0207 inline G4bool CexmcSetup::IsRightDetector(
0208 const G4VPhysicalVolume * pVolume ) const
0209 {
0210 if ( pVolume == rightVetoCounter || pVolume == rightCalorimeter )
0211 return true;
0212
0213 return false;
0214 }
0215
0216
0217 inline G4bool CexmcSetup::IsRightCalorimeter(
0218 const G4VPhysicalVolume * pVolume ) const
0219 {
0220 if ( pVolume == rightCalorimeter )
0221 return true;
0222
0223 return false;
0224 }
0225
0226
0227 #endif
0228