LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
molecule.C
Go to the documentation of this file.
1 // -------------------------------------------------------------------
2 // $Id: plot.C 70323 2013-05-29 07:57:44Z gcosmo $
3 // -------------------------------------------------------------------
4 //
5 // *********************************************************************
6 // To execute this macro under ROOT after your simulation ended,
7 // 1 - launch ROOT (usually type 'root' at your machine's prompt)
8 // 2 - type '.X plot.C' at the ROOT session prompt
9 // *********************************************************************
10 
11 #include <iostream>
12 #include "TROOT.h"
13 #include "../dnadamage1/include/DNAVolumeType.hh"
14 using namespace std;
15 
16 template<typename T>
18 {
19 private:
20  T _x, _y, _z;
21 public:
22  ThreeVector():_x(0),_y(0),_z(0){}
23  ThreeVector(T x, T y, T z)
24  :_x(x),_y(y),_z(z){}
26  T x() const
27  {
28  return _x;
29  }
30  T y() const
31  {
32  return _y;
33  }
34  T z() const
35  {
36  return _z;
37  }
38 
39  bool operator ==(const ThreeVector<T>& right) const
40  {
41  return (_x == right._x) &&
42  (_y == right._y) &&
43  (_z == right._z);
44  }
45 
46  ThreeVector<T>& operator =(const ThreeVector<T>& right) = default;
47 
48 ClassDef(ThreeVector,1)
49 };
50 
51 #if !defined(__CLING__)
53 #endif
54 
55 class Molecule
56 {
57 public:
59  Molecule(string name,
60  int copyNumber,
61  const ThreeVector<double>& position,
62  int strand)
63  : fName(name)
64  , fCopyNumber(copyNumber)
65  , fPosition(position)
66  , fStrand(strand)
67  {}
69 public:
70  string fName;
71  string fMaterial;
73  int fStrand;
74 
76 
77  double fRadius;
78  double fRadiusWater;
79 
80  ClassDef(Molecule,1)
81 };
82 
83 #if !defined(__CLING__)
85 #endif
86 
87 std::vector<Molecule> molecule()
88 {
89  std::vector<Molecule> fMolecules;
90  double size;
91  string name;
92  ifstream file("VoxelStraight.fab2g4dna");
93  if(!file.is_open())
94  {
95  string msg ="VoxelStraight.fab2g4dna could not be opened";
96  throw std::invalid_argument(msg);
97  }
98 
99  string line;
100  while(getline(file, line) )
101  {
102  if(line.empty())
103  {
104  continue;
105  }
106 
107  istringstream issLine(line);
108  string firstItem;
109  issLine >> firstItem;
110  if("_Size" == firstItem)
111  {
112  issLine >> size;
113  }
114  else if("_pl" == firstItem)
115  {
116  string name;
117  issLine >> name;
118 
119  string material;
120  issLine >> material;
121 
122  int strand;
123  issLine >> strand;
124 
125  int copyNumber;
126  issLine >> copyNumber;
127 
128  double x;
129  issLine >> x;
130 
131  double y;
132  issLine >> y;
133 
134  double z;
135  issLine >> z;
136 
137  Molecule molecule(name,
138  copyNumber,
139  ThreeVector<double>(x, y, z),
140  strand);
141  fMolecules.push_back(molecule);
142  }
143  }
144  file.close();
145 
146  return fMolecules;
147 }
Float_t x
Definition: compare.C:6
int fStrand
Definition: molecule.C:73
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
~ThreeVector()
Definition: molecule.C:25
double fRadius
Definition: molecule.C:77
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
T x() const
Definition: molecule.C:26
STL namespace.
ThreeVector< double > fPosition
Definition: molecule.C:75
string fName
Definition: molecule.C:70
double fRadiusWater
Definition: molecule.C:78
T z() const
Definition: molecule.C:34
vector< Molecule > fMolecules
Definition: plot.C:17
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
~Molecule()
Definition: molecule.C:68
Molecule(string name, int copyNumber, const ThreeVector< double > &position, int strand)
Definition: molecule.C:59
ThreeVector(T x, T y, T z)
Definition: molecule.C:23
int fCopyNumber
Definition: molecule.C:72
Molecule()
Definition: molecule.C:58
string fMaterial
Definition: molecule.C:71
T y() const
Definition: molecule.C:30
TFile * file
std::vector< Molecule > molecule()
Definition: molecule.C:87
ThreeVector()
Definition: molecule.C:22
bool operator==(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
Definition: counter.h:278
ClassImp(ThreeVector)