ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeActsGeometry.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MakeActsGeometry.h
1 
8 #ifndef MAKE_ACTS_GEOMETRY_H
9 #define MAKE_ACTS_GEOMETRY_H
10 
11 #include <fun4all/SubsysReco.h>
12 #include <trackbase/TrkrDefs.h>
13 
16 
19 #include <Acts/Utilities/Logger.hpp>
24 
25 #include <ActsExamples/TGeoDetector/TGeoDetector.hpp>
26 #include <ActsExamples/Fitting/TrkrClusterFittingAlgorithm.hpp>
27 #include <ActsExamples/Plugins/BField/BFieldOptions.hpp>
28 
29 #include <map>
30 #include <memory>
31 #include <string>
32 #include <vector>
33 
34 class PHCompositeNode;
37 class TGeoManager;
38 class TGeoNode;
39 class TGeoVolume;
40 
41 namespace ActsExamples
42 {
43  class IBaseDetector;
44  class IContextDecorator;
45 }
46 
47 namespace Acts
48 {
49  class Surface;
50 }
51 
52 using Surface = std::shared_ptr<const Acts::Surface>;
53 using TrackingGeometry = std::shared_ptr<const Acts::TrackingGeometry>;
54 using TrackingVolumePtr = std::shared_ptr<const Acts::TrackingVolume>;
55 
64 {
65  public:
66 
68  MakeActsGeometry(const std::string& name = "MakeActsGeometry");
69 
71  ~MakeActsGeometry() override = default;
72 
73  int Init(PHCompositeNode *topNode) override;
74  int InitRun(PHCompositeNode *topNode) override;
75  int process_event(PHCompositeNode *topNode) override;
76  int End(PHCompositeNode *topNode) override;
77 
78  std::vector<std::shared_ptr<ActsExamples::IContextDecorator>> getContextDecorators()
79  { return m_contextDecorators; }
80 
81  void setMagField(const std::string &magField)
82  {m_magField = magField;}
83  void setMagFieldRescale(double magFieldRescale)
84  {m_magFieldRescale = magFieldRescale;}
85 
86  double getSurfStepPhi() {return m_surfStepPhi;}
87  double getSurfStepZ() {return m_surfStepZ;}
88 
89  void add_fake_surfaces(bool add){fake_surfaces = add;}
90 
91  private:
93  int buildAllGeometry(PHCompositeNode *topNode);
94 
97 
100 
103  void editTPCGeometry(PHCompositeNode *topNode);
104  void addActsTpcSurfaces(TGeoVolume *tpc_gas_vol,
105  TGeoManager *geoManager);
106 
108 
111  void addActsMicromegasSurfaces(int mm_layer, TGeoVolume *micromegas_vol, TGeoManager *geoManager);
112 
114  void buildActsSurfaces();
115 
117  void makeGeometry(int argc, char* argv[],
118  ActsExamples::IBaseDetector& detector);
119 
120  void setMaterialResponseFile(std::string& responseFile,
121  std::string& materialFile);
122 
124  void getInttKeyFromNode(TGeoNode *gnode);
125  void getMvtxKeyFromNode(TGeoNode *gnode);
126  void getTpcKeyFromNode(TGeoNode *gnode);
127 
130  void makeMvtxMapPairs(TrackingVolumePtr &mvtxVolume);
131  void makeInttMapPairs(TrackingVolumePtr &inttVolume);
132  void makeTpcMapPairs(TrackingVolumePtr &tpcVolume);
133 
135  void makeMmMapPairs(TrackingVolumePtr &tpcVolume);
136 
139  std::vector<double> &world);
141  std::vector<double> &world);
143 
145  void isActive(TGeoNode *gnode, int nmax_print);
146 
148  void makeTGeoNodeMap(PHCompositeNode *topNode);
149 
150  void unpackVolumes();
151 
157 
158  TGeoManager* m_geoManager = nullptr;
159 
161  std::vector<std::shared_ptr<ActsExamples::IContextDecorator> >
163 
165  std::map<TrkrDefs::hitsetkey, TGeoNode*> m_clusterNodeMap;
166  std::map<TrkrDefs::hitsetkey, Surface> m_clusterSurfaceMapSilicon;
167  std::map<unsigned int, std::vector<Surface>> m_clusterSurfaceMapTpcEdit; // uses layer as key
168  std::map<TrkrDefs::hitsetkey, Surface> m_clusterSurfaceMapMmEdit;
169 
171  const static unsigned int m_nTpcLayers = 48;
172  const unsigned int m_nTpcModulesPerLayer = 12;
173  const unsigned int m_nTpcSides = 2;
174 
176  double m_minSurfZ = 0.;
177  double m_maxSurfZ = 105.78;
178  unsigned int m_nSurfZ = 1;
179  unsigned int m_nSurfPhi = 12;
180  double m_surfStepPhi = 0;
181  double m_surfStepZ = 0;
182  double m_moduleStepPhi = 0;
183  double m_modulePhiStart = 0;
184 
186  int nprint_tpc = 0;
187 
189  const static int m_nTpcSectors = 3;
190  const double m_minRadius[m_nTpcSectors] = {30.0, 40.0, 60.0};
191  const double m_maxRadius[m_nTpcSectors] = {40.0, 60.0, 77.0};
195 
196  // Spaces to prevent boxes from touching when placed
197  const double half_width_clearance_thick = 0.4999;
198  const double half_width_clearance_phi = 0.4999;
199  const double half_width_clearance_z = 0.4999;
200 
203 
210 
214 
216  int m_verbosity = 0;
217 
219  std::string m_magField ="1.4" ;
220  double m_magFieldRescale = -1.;
221 
222  bool m_buildMMs = false;
223  bool fake_surfaces = true;
224 };
225 
226 #endif