FairRoot/PandaRoot
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
detectors
hypGe
PndHypGeReader.cxx
Go to the documentation of this file.
1
//
3
// PndHypGeReader
4
//
5
// Reader of HypGe geometry file (ASCII)
6
//
7
// roginal Author: S.Spataro
8
// modified 15/05/07 by A.Sanchez
9
//
11
12
#include <iostream>
13
#include <fstream>
14
#include <string>
15
#include "TString.h"
16
#include <algorithm>
17
18
#include "
PndHypGeReader.h
"
19
20
using namespace
std;
21
22
PndHypGeReader::PndHypGeReader
(
TString
name
)
23
{
24
sName =
name
;
25
PndHypGeReader::fill_vector
();
26
}
27
28
PndHypGeReader::~PndHypGeReader
()
29
{g4data.clear();
30
}
31
32
void
PndHypGeReader::fill_vector
()
33
{
34
fstream
f
;
35
string
str;
36
DataG4
data;
37
int
line_nr;
38
39
f.open(sName.Data(), ios::in);
40
//f.open(sName, ios::in);
41
cout<<sName<<endl;
42
if
(!f) {
43
cout<<
"PndHypGeReader Error: Data file cannot be open!"
<<endl;
44
exit
(1);
45
}
else
46
{
47
//line_nr = 1;
48
//while(line_nr<=3) {getline(f,str,'\n'); line_nr++;};
49
while
(f)
50
{
51
f>>data.
crystal
>>data.
posX
>>data.
posY
>>data.
posZ
;
52
PndHypGeReader::g4data
.push_back(data);
53
};
54
f.close();
55
};
56
f.clear();
57
58
return
;
59
}
60
61
62
63
DataG4
PndHypGeReader::GetData
(
int
crystal )
64
{
65
DataG4
data;
66
67
for
(
unsigned
int
i
=0;
i
<
PndHypGeReader::g4data
.size();
i
++)
68
{
69
if
(crystal==
PndHypGeReader::g4data
[
i
].crystal)
70
{
71
72
data.
crystal
=
PndHypGeReader::g4data
[
i
].crystal;
73
74
data.
posX
=
PndHypGeReader::g4data
[
i
].posX;
75
data.
posY
=
PndHypGeReader::g4data
[
i
].posY;
76
data.
posZ
=
PndHypGeReader::g4data
[
i
].posZ;
77
//pos.SetXYZ(data.posX, data.posY, data.posZ);
78
79
80
};
81
};
82
83
return
data;
84
//return pos;
85
}
86
87
i
Int_t i
Definition:
run_full.C:25
DataG4
Definition:
PndEmcReader.h:12
exit
exit(0)
DataG4::crystal
int crystal
Definition:
PndEmcReader.h:19
PndHypGeReader::PndHypGeReader
PndHypGeReader(TString name)
Definition:
PndHypGeReader.cxx:22
f
TFile * f
Definition:
bump_analys.C:12
TString
TString
Definition:
SimCompleteLinkDef.h:6
PndHypGeReader::g4data
vector< DataG4 > g4data
Definition:
PndHypGeReader.h:36
name
TString name
Definition:
createRootGeoFile.C:82
DataG4::posX
double posX
Definition:
PndEmcReader.h:21
PndHypGeReader::fill_vector
void fill_vector()
Definition:
PndHypGeReader.cxx:32
DataG4::posZ
double posZ
Definition:
PndEmcReader.h:21
PndHypGeReader.h
DataG4::posY
double posY
Definition:
PndEmcReader.h:21
PndHypGeReader::GetData
DataG4 GetData(int crystal)
Definition:
PndHypGeReader.cxx:63
PndHypGeReader::~PndHypGeReader
~PndHypGeReader()
Definition:
PndHypGeReader.cxx:28
Generated on Wed Apr 3 2019 08:43:57 for FairRoot/PandaRoot by
1.8.5