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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/medical/dna/dnadamage1/molecule.C (Version 11.3.0) and /examples/extended/medical/dna/dnadamage1/molecule.C (Version 9.5.p1)


  1 // -------------------------------------------      1 
  2 // $Id: plot.C 70323 2013-05-29 07:57:44Z gcos    
  3 // -------------------------------------------    
  4 //                                                
  5 // *******************************************    
  6 // To execute this macro under ROOT after your    
  7 //   1 - launch ROOT (usually type 'root' at y    
  8 //   2 - type '.X plot.C' at the ROOT session     
  9 // *******************************************    
 10                                                   
 11 #include <iostream>                               
 12 #include "TROOT.h"                                
 13 #include "DNAVolumeType.hh"                       
 14 using namespace std;                              
 15                                                   
 16 template<typename T>                              
 17 class ThreeVector                                 
 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){}                      
 25     ~ThreeVector(){}                              
 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>& rig    
 40     {                                             
 41         return (_x == right._x) &&                
 42                (_y == right._y) &&                
 43                (_z == right._z);                  
 44     }                                             
 45                                                   
 46     ThreeVector<T>& operator =(const ThreeVect    
 47                                                   
 48 ClassDef(ThreeVector,1)                           
 49 };                                                
 50                                                   
 51 #if !defined(__CLING__)                           
 52 ClassImp(ThreeVector);                            
 53 #endif                                            
 54                                                   
 55 class Molecule                                    
 56 {                                                 
 57 public:                                           
 58     Molecule(){}                                  
 59     Molecule(string name,                         
 60              int copyNumber,                      
 61              const ThreeVector<double>& positi    
 62              int strand)                          
 63              : fName(name)                        
 64              , fCopyNumber(copyNumber)            
 65              , fPosition(position)                
 66              , fStrand(strand)                    
 67             {}                                    
 68     ~Molecule(){}                                 
 69 public:                                           
 70     string fName;                                 
 71     string fMaterial;                             
 72     int fCopyNumber;                              
 73     int fStrand;                                  
 74                                                   
 75     ThreeVector<double> fPosition;                
 76                                                   
 77     double fRadius;                               
 78     double fRadiusWater;                          
 79                                                   
 80     ClassDef(Molecule,1)                          
 81 };                                                
 82                                                   
 83 #if !defined(__CLING__)                           
 84 ClassImp(Molecule);                               
 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 c    
 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<doub    
140                               strand);            
141             fMolecules.push_back(molecule);       
142         }                                         
143     }                                             
144     file.close();                                 
145                                                   
146     return fMolecules;                            
147 }                                                 
148