EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicStlFactory.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicStlFactory.h
1 //
2 // AYK (ayk@bnl.gov), 2014/03/11; revamped in Oct'2017;
3 //
4 // EicRoot STL/SLP file manipulation routines; the idea behind keeping this
5 // class separate from EicCadFile is that local istances are invoked in a
6 // couple of places in order to handle triangulation of geometry subcomponents;
7 // therefore is it not really practical to merge the two classes inot one; on
8 // the other hand I definitely want to see only EicCadFile calls in simulation.C
9 // rather than diverse group of classes handling each particular type of input;
10 //
11 
12 #include <TObject.h>
13 #include <TString.h>
14 
15 #include <FairLogger.h>
16 
17 #include <EicMediaHub.h>
18 #include <EicStlMediaGroup.h>
19 
20 #ifndef _EIC_STL_FACTORY_
21 #define _EIC_STL_FACTORY_
22 
23 class TGeoVolume;
24 class EicCadFileConfig;
25 
26 class EicStlFactory: public TObject {
27  public:
28  EicStlFactory(const char *volume_name, const char *geometry_file_name, const EicCadFileConfig *config,
29  bool acknowledge_config_file_scaling = true);
30  // Dummy constructor;
31  EicStlFactory(): mType(Undefined), /*mWireframeMode(false), mWireframeFeatureSize(0.0),*/ mConfig(NULL), mLogger(NULL) {};
32  // Destructor;
34 
38 
39  gEntry &mgroups( void ) { return mGroups; };
40 
41  void _ConstructGeometry(TGeoVolume *mother, TVector3 shift, bool swapXY = false, //bool wireframe = false,
42  std::vector<TGeoVolume*> *volumes = 0);
43  int CreateRootFile(TGeoVolume *mother, const char *bname);
44 
45  private:
47 
50 
51  //bool mWireframeMode;
52  //double mWireframeFeatureSize;
53 
55 
58 
59  TString mVolumeName;
60  TString mGeometryName;
61 
62  void ImportBinaryStlFile(FILE *fin, unsigned trCount, double scale = 1.0);
63  void ImportAsciiStlSlpFile(double scale = 1.0);
64 
73  void PreAllocateFacet(unsigned solidId, const TGeoMedium *medium,
74  const double vCoord1[], const double vCoord2[], const double vCoord3[]);
75 
76  void DumpTmpStlFile(EicStlAssembly *assembly, TString &stlActualFileName);
77 
78  ClassDef(EicStlFactory,4)
79 };
80 
81 // Yes, this routine can happily live outside of any class definition (used
82 // independently in EicCadFile and EicStlFactory);
83 TGeoVolume *CreateTetrahedron(TVector3 &p1, TVector3 &p2, TVector3 &p3, TVector3 &p4,
84  char name[], TGeoVolume *mother, const TGeoMedium *medium, TVector3 shift);
85 
86 #endif