File indexing completed on 2025-08-06 08:17:53
0001
0002
0003
0004 #ifndef MICROMEGAS_CYLINDERGEOMMICROMEGAS_H
0005 #define MICROMEGAS_CYLINDERGEOMMICROMEGAS_H
0006
0007
0008
0009
0010
0011
0012 #include "MicromegasDefs.h"
0013 #include "MicromegasTile.h"
0014
0015 #include <g4detectors/PHG4CylinderGeom.h>
0016
0017 #include <TGeoMatrix.h>
0018
0019 #include <cmath>
0020 #include <iostream>
0021
0022 class ActsGeometry;
0023 class TVector2;
0024 class TVector3;
0025 class PHG4Hit;
0026
0027 class CylinderGeomMicromegas : public PHG4CylinderGeom
0028 {
0029 public:
0030
0031
0032 explicit CylinderGeomMicromegas()
0033 {}
0034
0035
0036 CylinderGeomMicromegas(int layer )
0037 : m_layer( layer )
0038 {}
0039
0040
0041 void identify(std::ostream&) const override;
0042
0043
0044
0045 int get_layer() const override {return m_layer;}
0046 double get_radius() const override {return m_radius;}
0047 double get_thickness() const override { return m_thickness;}
0048 double get_zmin() const override {return m_zmin;}
0049 double get_zmax() const override {return m_zmax;}
0050 double get_pitch() const { return m_pitch; }
0051
0052
0053 MicromegasDefs::SegmentationType get_segmentation_type() const {return m_segmentation_type;}
0054
0055
0056 MicromegasDefs::DriftDirection get_drift_direction() const {return m_drift_direction;}
0057
0058
0059 bool check_radius( const TVector3& ) const;
0060
0061
0062 TVector3 get_local_from_world_coords( uint tileid, ActsGeometry*, const TVector3& ) const;
0063
0064
0065 TVector3 get_local_from_world_vect( uint tileid, ActsGeometry*, const TVector3& ) const;
0066
0067
0068 TVector3 get_world_from_local_coords( uint tileid, ActsGeometry*, const TVector2& ) const;
0069
0070
0071 TVector3 get_world_from_local_coords( uint tileid, ActsGeometry*, const TVector3& ) const;
0072
0073
0074 TVector3 get_world_from_local_vect( uint tileid, ActsGeometry*, const TVector3& ) const;
0075
0076
0077
0078
0079
0080
0081 int find_tile_cylindrical( const TVector3& ) const;
0082
0083
0084 size_t get_tiles_count() const { return m_tiles.size(); }
0085
0086
0087 const MicromegasTile& get_tile( uint tileid ) const
0088 {
0089 assert( tileid < m_tiles.size() );
0090 return m_tiles[tileid];
0091 }
0092
0093
0094 int find_strip_from_world_coords( uint tileid, ActsGeometry*, const TVector3& ) const;
0095
0096
0097 int find_strip_from_local_coords( uint tileid, ActsGeometry*, const TVector2& ) const;
0098
0099
0100 double get_strip_length( uint tileid, ActsGeometry* ) const;
0101
0102
0103 uint get_strip_count( uint tileid, ActsGeometry* ) const;
0104
0105
0106 TVector2 get_local_coordinates( uint tileid, ActsGeometry*, uint stripnum ) const;
0107
0108
0109 TVector3 get_world_coordinates( uint tileid, ActsGeometry*, uint stripnum ) const;
0110
0111
0112 static constexpr double reference_radius = 82;
0113
0114
0115 using range_t = std::pair<double, double>;
0116
0117
0118 range_t get_phi_range(uint tileid, ActsGeometry* ) const;
0119
0120
0121
0122
0123
0124 range_t get_theta_range(uint tileid, ActsGeometry* ) const;
0125
0126
0127
0128
0129
0130 void set_layer(const int i) override {m_layer = i;}
0131 void set_radius(const double value) override {m_radius = value;}
0132 void set_thickness(const double value) override {m_thickness = value;}
0133 void set_zmin(const double value) override {m_zmin = value;}
0134 void set_zmax(const double value) override {m_zmax = value;}
0135 void set_pitch( double value ) { m_pitch = value; }
0136
0137
0138 void set_tiles( const MicromegasTile::List& tiles ) {m_tiles = tiles;}
0139
0140
0141 void set_segmentation_type( MicromegasDefs::SegmentationType value ) {m_segmentation_type = value;}
0142
0143
0144 void set_drift_direction( MicromegasDefs::DriftDirection value ) {m_drift_direction = value;}
0145
0146
0147 private:
0148
0149
0150 int m_layer = 0;
0151
0152
0153 MicromegasDefs::SegmentationType m_segmentation_type = MicromegasDefs::SegmentationType::SEGMENTATION_PHI;
0154
0155
0156 MicromegasDefs::DriftDirection m_drift_direction = MicromegasDefs::DriftDirection::OUTWARD;
0157
0158
0159 double m_radius = 0;
0160
0161
0162 double m_thickness = 0;
0163
0164
0165 double m_zmin = 0;
0166
0167
0168 double m_zmax = 0;
0169
0170
0171 double m_pitch = 0.1;
0172
0173
0174
0175
0176
0177
0178 MicromegasTile::List m_tiles;
0179
0180 ClassDefOverride(CylinderGeomMicromegas, 1)
0181 };
0182
0183 #endif