FairShip
Loading...
Searching...
No Matches
ShipGeoCave Class Reference

#include <ShipGeoCave.h>

Inheritance diagram for ShipGeoCave:
[legend]
Collaboration diagram for ShipGeoCave:
[legend]

Public Member Functions

 ShipGeoCave ()
 ~ShipGeoCave () override=default
const char * getModuleName (Int_t) override
Bool_t read (std::fstream &, FairGeoMedia *) override
void addRefNodes () override
void write (std::fstream &) override
void print () override

Protected Attributes

TString name

Detailed Description

Definition at line 17 of file ShipGeoCave.h.

Constructor & Destructor Documentation

◆ ShipGeoCave()

ShipGeoCave::ShipGeoCave ( )

Definition at line 27 of file ShipGeoCave.cxx.

27 : FairGeoSet(), name("cave") {
28 // Constructor
29 fName = "cave";
30 name = "cave";
31 maxModules = 1;
32}
TString name
Definition ShipGeoCave.h:19

◆ ~ShipGeoCave()

ShipGeoCave::~ShipGeoCave ( )
overridedefault

Member Function Documentation

◆ addRefNodes()

void ShipGeoCave::addRefNodes ( )
override

Definition at line 90 of file ShipGeoCave.cxx.

90 {
91 // Adds the reference node
92 FairGeoNode* volu = getVolume(name);
93 if (volu) {
94 masterNodes->Add(new FairGeoNode(*volu));
95 }
96}

◆ getModuleName()

const char * ShipGeoCave::getModuleName ( Int_t )
inlineoverride

Definition at line 24 of file ShipGeoCave.h.

24{ return name.Data(); }

◆ print()

void ShipGeoCave::print ( )
override

Definition at line 114 of file ShipGeoCave.cxx.

114 {
115 // Prints the geometry
116 FairGeoNode* volu = getVolume(name);
117 if (volu) {
118 FairGeoBasicShape* sh = volu->getShapePointer();
119 FairGeoMedium* med = volu->getMedium();
120 if (sh && med) {
121 cout << volu->GetName() << '\n'
122 << sh->GetName() << '\n'
123 << med->GetName() << '\n';
124 sh->printPoints(volu);
125 }
126 }
127}

◆ read()

Bool_t ShipGeoCave::read ( std::fstream & fin,
FairGeoMedia * media )
override

Definition at line 34 of file ShipGeoCave.cxx.

34 {
35 // Reads the geometry from file
36 if (!media) {
37 return kFALSE;
38 }
39 const Int_t maxbuf = 256;
40 char buf[maxbuf];
41 FairGeoNode* volu = nullptr;
42 FairGeoMedium* medium;
43 Bool_t rc = kTRUE;
44 do {
45 fin.getline(buf, maxbuf);
46 if (buf[0] != '\0' && buf[0] != '/' && !fin.eof()) {
47 if (strcmp(buf, name) == 0) {
48 volu = new FairGeoNode;
49 volu->SetName(buf);
50 volu->setVolumeType(kFairGeoTopNode);
51 volu->setActive();
52 fin.getline(buf, maxbuf);
53 TString shape(buf);
54 FairGeoBasicShape* sh = pShapes->selectShape(shape);
55 if (sh) {
56 volu->setShape(sh);
57 } else {
58 rc = kFALSE;
59 }
60 fin.getline(buf, maxbuf);
61 medium = media->getMedium(buf);
62 if (!medium) {
63 medium = new FairGeoMedium();
64 media->addMedium(medium);
65 }
66 volu->setMedium(medium);
67 Int_t n = 0;
68 if (sh) {
69 n = sh->readPoints(&fin, volu);
70 }
71 if (n <= 0) {
72 rc = kFALSE;
73 }
74 } else {
75 rc = kFALSE;
76 }
77 }
78 } while (rc && !volu && !fin.eof());
79 if (volu && rc) {
80 volumes->Add(volu);
81 masterNodes->Add(new FairGeoNode(*volu));
82 } else {
83 delete volu;
84 volu = nullptr;
85 rc = kFALSE;
86 }
87 return rc;
88}

◆ write()

void ShipGeoCave::write ( std::fstream & fout)
override

Definition at line 98 of file ShipGeoCave.cxx.

98 {
99 // Writes the geometry to file
100 fout.setf(ios::fixed, ios::floatfield);
101 FairGeoNode* volu = getVolume(name);
102 if (volu) {
103 FairGeoBasicShape* sh = volu->getShapePointer();
104 FairGeoMedium* med = volu->getMedium();
105 if (sh && med) {
106 fout << volu->GetName() << '\n'
107 << sh->GetName() << '\n'
108 << med->GetName() << '\n';
109 sh->writePoints(&fout, volu);
110 }
111 }
112}

Member Data Documentation

◆ name

TString ShipGeoCave::name
protected

Definition at line 19 of file ShipGeoCave.h.


The documentation for this class was generated from the following files: