Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:52

0001 // -------------------------------------------------------------------
0002 // $Id: plot.C 70323 2013-05-29 07:57:44Z gcosmo $
0003 // -------------------------------------------------------------------
0004 //
0005 // *********************************************************************
0006 // To execute this macro under ROOT after your simulation ended, 
0007 //   1 - launch ROOT (usually type 'root' at your machine's prompt)
0008 //   2 - type '.X plot.C' at the ROOT session prompt
0009 // *********************************************************************
0010 
0011 #include <iostream>
0012 #include "TROOT.h"
0013 #include "DNAVolumeType.hh"
0014 using namespace std;
0015 
0016 template<typename T>  
0017 class ThreeVector
0018 {
0019 private:
0020     T _x, _y, _z;
0021 public:
0022     ThreeVector():_x(0),_y(0),_z(0){}
0023     ThreeVector(T x, T y, T z)
0024         :_x(x),_y(y),_z(z){}
0025     ~ThreeVector(){}
0026     T x() const
0027     {
0028         return _x;
0029     }
0030     T y() const
0031     {
0032         return _y;
0033     }
0034     T z() const
0035     {
0036     return _z;
0037     }
0038     
0039     bool operator ==(const ThreeVector<T>& right) const
0040     {
0041         return (_x == right._x) && 
0042                (_y == right._y) &&
0043                (_z == right._z);
0044     }
0045             
0046     ThreeVector<T>& operator =(const ThreeVector<T>& right) = default;
0047 
0048 ClassDef(ThreeVector,1)
0049 };
0050 
0051 #if !defined(__CLING__)
0052 ClassImp(ThreeVector);
0053 #endif
0054 
0055 class Molecule
0056 {
0057 public:
0058     Molecule(){}
0059     Molecule(string name, 
0060              int copyNumber, 
0061              const ThreeVector<double>& position, 
0062              int strand)
0063              : fName(name)
0064              , fCopyNumber(copyNumber)
0065              , fPosition(position)
0066              , fStrand(strand)
0067             {}
0068     ~Molecule(){}
0069 public:
0070     string fName;
0071     string fMaterial;
0072     int fCopyNumber;
0073     int fStrand;
0074 
0075     ThreeVector<double> fPosition;
0076 
0077     double fRadius;
0078     double fRadiusWater;
0079 
0080     ClassDef(Molecule,1)
0081 };
0082 
0083 #if !defined(__CLING__)
0084 ClassImp(Molecule);
0085 #endif
0086 
0087 std::vector<Molecule> molecule()
0088 {
0089     std::vector<Molecule> fMolecules;
0090     double size;
0091     string name;
0092     ifstream file("VoxelStraight.fab2g4dna");
0093     if(!file.is_open())
0094     {
0095         string msg ="VoxelStraight.fab2g4dna could not be opened";
0096         throw std::invalid_argument(msg);
0097     }
0098 
0099    string line;
0100     while(getline(file, line) )
0101     {
0102         if(line.empty()) 
0103         {
0104             continue;
0105         }
0106          
0107         istringstream issLine(line);
0108         string firstItem;
0109         issLine >> firstItem;
0110         if("_Size" == firstItem)
0111         {
0112             issLine >> size;
0113         }
0114         else if("_pl" == firstItem)
0115         {
0116             string name;
0117             issLine >> name;
0118 
0119             string material;
0120             issLine >> material;
0121 
0122             int strand;
0123             issLine >> strand;
0124 
0125             int copyNumber;
0126             issLine >> copyNumber;
0127 
0128             double x;
0129             issLine >> x;
0130 
0131             double y;
0132             issLine >> y;
0133 
0134             double z;
0135             issLine >> z;
0136 
0137             Molecule molecule(name, 
0138                               copyNumber, 
0139                               ThreeVector<double>(x, y, z), 
0140                               strand);
0141             fMolecules.push_back(molecule);
0142         }
0143     }
0144     file.close();
0145     
0146     return fMolecules;
0147 }