SND@LHC Software
Loading...
Searching...
No Matches
ShipGeoCave Class Reference

#include <ShipGeoCave.h>

Inheritance diagram for ShipGeoCave:
Collaboration diagram for ShipGeoCave:

Public Member Functions

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

Protected Attributes

TString name
 

Detailed Description

Definition at line 14 of file ShipGeoCave.h.

Constructor & Destructor Documentation

◆ ShipGeoCave()

ShipGeoCave::ShipGeoCave ( )

◆ ~ShipGeoCave()

ShipGeoCave::~ShipGeoCave ( )
inline

Definition at line 20 of file ShipGeoCave.h.

20{}

Member Function Documentation

◆ addRefNodes()

void ShipGeoCave::addRefNodes ( )

Definition at line 80 of file ShipGeoCave.cxx.

81{
82 // Adds the reference node
83 FairGeoNode* volu=getVolume(name);
84 if (volu) { masterNodes->Add(new FairGeoNode(*volu)); }
85}
TString name
Definition ShipGeoCave.h:17

◆ getModuleName()

const char * ShipGeoCave::getModuleName ( Int_t  )
inline

Definition at line 21 of file ShipGeoCave.h.

21{return name.Data();}

◆ print()

void ShipGeoCave::print ( )

Definition at line 102 of file ShipGeoCave.cxx.

103{
104 // Prints the geometry
105 FairGeoNode* volu=getVolume(name);
106 if (volu) {
107 FairGeoBasicShape* sh=volu->getShapePointer();
108 FairGeoMedium* med=volu->getMedium();
109 if (sh&&med) {
110 cout<<volu->GetName()<<'\n'<<sh->GetName()<<'\n'<<med->GetName()<<'\n';
111 sh->printPoints(volu);
112 }
113 }
114}

◆ read()

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

Definition at line 34 of file ShipGeoCave.cxx.

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

◆ write()

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

Definition at line 87 of file ShipGeoCave.cxx.

88{
89 // Writes the geometry to file
90 fout.setf(ios::fixed,ios::floatfield);
91 FairGeoNode* volu=getVolume(name);
92 if (volu) {
93 FairGeoBasicShape* sh=volu->getShapePointer();
94 FairGeoMedium* med=volu->getMedium();
95 if (sh&&med) {
96 fout<<volu->GetName()<<'\n'<<sh->GetName()<<'\n'<<med->GetName()<<'\n';
97 sh->writePoints(&fout,volu);
98 }
99 }
100}

Member Data Documentation

◆ name

TString ShipGeoCave::name
protected

Definition at line 17 of file ShipGeoCave.h.


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