Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/exoticphysics/saxs/src/SAXSDetectorConstruction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.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/exoticphysics/saxs/src/SAXSDetectorConstruction.cc (Version 11.3.0) and /examples/extended/exoticphysics/saxs/src/SAXSDetectorConstruction.cc (Version 11.1.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /// \file SAXSDetectorConstruction.cc              26 /// \file SAXSDetectorConstruction.cc
 27 /// \brief Implementation of the SAXSDetectorC     27 /// \brief Implementation of the SAXSDetectorConstruction class
 28 //                                                 28 //
 29 //....oooOO0OOooo........oooOO0OOooo........oo     29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 30                                                    30 
 31 #include "SAXSDetectorConstruction.hh"             31 #include "SAXSDetectorConstruction.hh"
 32                                                << 
 33 #include "SAXSSensitiveDetector.hh"                32 #include "SAXSSensitiveDetector.hh"
 34                                                    33 
 35 #include "G4AssemblyVolume.hh"                 <<  34 #include "G4RunManager.hh"
 36 #include "G4Box.hh"                            <<  35 
 37 #include "G4Colour.hh"                         <<  36 #include "G4Material.hh"
 38 #include "G4Cons.hh"                           <<  37 #include "G4MaterialTable.hh"
 39 #include "G4Element.hh"                            38 #include "G4Element.hh"
 40 #include "G4ElementTable.hh"                       39 #include "G4ElementTable.hh"
 41 #include "G4ExtendedMaterial.hh"               <<  40 #include "G4NistManager.hh"
 42 #include "G4GeometryManager.hh"                <<  41 
                                                   >>  42 #include "G4Box.hh"
                                                   >>  43 #include "G4Tubs.hh"
                                                   >>  44 #include "G4Sphere.hh"
                                                   >>  45 #include "G4Cons.hh"
                                                   >>  46 #include "G4Polyhedra.hh"
                                                   >>  47 #include "G4Trd.hh"
                                                   >>  48 #include "G4SubtractionSolid.hh"
                                                   >>  49 #include "G4UnionSolid.hh"
                                                   >>  50 #include "G4AssemblyVolume.hh"
 43 #include "G4IntersectionSolid.hh"                  51 #include "G4IntersectionSolid.hh"
                                                   >>  52 
                                                   >>  53 #include "G4RotationMatrix.hh"
                                                   >>  54 #include "G4ThreeVector.hh"
                                                   >>  55 
 44 #include "G4LogicalVolume.hh"                      56 #include "G4LogicalVolume.hh"
 45 #include "G4LogicalVolumeStore.hh"             << 
 46 #include "G4MIData.hh"                         << 
 47 #include "G4Material.hh"                       << 
 48 #include "G4MaterialTable.hh"                  << 
 49 #include "G4MultiFunctionalDetector.hh"        << 
 50 #include "G4NistManager.hh"                    << 
 51 #include "G4PSDoseDeposit.hh"                  << 
 52 #include "G4PSEnergyDeposit.hh"                << 
 53 #include "G4PVPlacement.hh"                        57 #include "G4PVPlacement.hh"
 54 #include "G4PhysicalConstants.hh"              <<  58 #include "G4GeometryManager.hh"
 55 #include "G4PhysicalVolumeStore.hh"                59 #include "G4PhysicalVolumeStore.hh"
 56 #include "G4Polyhedra.hh"                      <<  60 #include "G4LogicalVolumeStore.hh"
 57 #include "G4RotationMatrix.hh"                 << 
 58 #include "G4RunManager.hh"                     << 
 59 #include "G4SDManager.hh"                      << 
 60 #include "G4SDParticleFilter.hh"               << 
 61 #include "G4SolidStore.hh"                         61 #include "G4SolidStore.hh"
 62 #include "G4Sphere.hh"                         << 
 63 #include "G4SubtractionSolid.hh"               << 
 64 #include "G4SystemOfUnits.hh"                  << 
 65 #include "G4ThreeVector.hh"                    << 
 66 #include "G4Trd.hh"                            << 
 67 #include "G4Tubs.hh"                           << 
 68 #include "G4UniformMagField.hh"                    62 #include "G4UniformMagField.hh"
 69 #include "G4UnionSolid.hh"                     <<  63 
 70 #include "G4VSensitiveDetector.hh"             << 
 71 #include "G4VisAttributes.hh"                      64 #include "G4VisAttributes.hh"
 72 #include "globals.hh"                          <<  65 #include "G4Colour.hh"
                                                   >>  66 
                                                   >>  67 #include "G4SDManager.hh"
                                                   >>  68 #include "G4VSensitiveDetector.hh"
                                                   >>  69 
                                                   >>  70 #include "G4MultiFunctionalDetector.hh"
                                                   >>  71 #include "G4PSDoseDeposit.hh"
                                                   >>  72 #include "G4PSEnergyDeposit.hh"
                                                   >>  73 #include "G4SDParticleFilter.hh"
 73                                                    74 
 74 #include <cmath>                                   75 #include <cmath>
 75 #include <sstream>                                 76 #include <sstream>
 76 #include <vector>                                  77 #include <vector>
 77                                                    78 
                                                   >>  79 #include "G4PhysicalConstants.hh"
                                                   >>  80 #include "G4SystemOfUnits.hh"
                                                   >>  81 #include "globals.hh"
                                                   >>  82 
                                                   >>  83 #include "G4ExtendedMaterial.hh"
                                                   >>  84 #include "G4MIData.hh"
                                                   >>  85 
 78 //....oooOO0OOooo........oooOO0OOooo........oo     86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 79                                                    87 
 80 SAXSDetectorConstruction::SAXSDetectorConstruc <<  88 SAXSDetectorConstruction::SAXSDetectorConstruction():
 81 {                                              <<  89   G4VUserDetectorConstruction(), fWorldLogic(0)
                                                   >>  90 {          
 82   G4cout << "### DetectorConstruction Instanti     91   G4cout << "### DetectorConstruction Instantiated ###" << G4endl;
 83                                                    92 
 84   // instantiate the messenger (set methods wi <<  93   //instantiate the messenger (set methods will be called after construct)
 85   fMessenger = new SAXSDetectorConstructionMes     94   fMessenger = new SAXSDetectorConstructionMessenger(this);
 86                                                <<  95         
 87   // set geometrical variables                 <<  96   //set geometrical variables
 88   SetGeometricalVariables();                   <<  97   SetGeometricalVariables();        
 89                                                <<  98     
 90   // Initialization                            <<  99   //Initialization           
 91   fPhantomMaterialIndex = 1;                   << 100   fPhantomMaterialIndex = 1;   
 92                                                << 101     
 93   fComp0 = 0.0;  // components of the "Medical << 102   fComp0 = 0.0;    //components of the "Medical Material (MedMat)"
 94   fComp1 = 1.0;  // Through macro I can set on << 103   fComp1 = 1.0;    //Through macro I can set one Medical Material only
 95   fComp2 = 0.0;                                   104   fComp2 = 0.0;
 96   fComp3 = 0.0;                                   105   fComp3 = 0.0;
 97                                                << 106     
 98   fCustomMatDensity = 1.00;  // g/mol          << 107   fCustomMatDensity = 1.00; //g/mol
 99   fCustomMatHmassfract = 0.1119;                  108   fCustomMatHmassfract = 0.1119;
100   fCustomMatCmassfract = 0.;                      109   fCustomMatCmassfract = 0.;
101   fCustomMatNmassfract = 0.;                      110   fCustomMatNmassfract = 0.;
102   fCustomMatOmassfract = 0.8881;                  111   fCustomMatOmassfract = 0.8881;
103   fCustomMatNamassfract = 0.;                     112   fCustomMatNamassfract = 0.;
104   fCustomMatPmassfract = 0.;                      113   fCustomMatPmassfract = 0.;
105   fCustomMatSmassfract = 0.;                      114   fCustomMatSmassfract = 0.;
106   fCustomMatClmassfract = 0.;                     115   fCustomMatClmassfract = 0.;
107   fCustomMatKmassfract = 0.;                      116   fCustomMatKmassfract = 0.;
108   fCustomMatCamassfract = 0.;                     117   fCustomMatCamassfract = 0.;
109                                                << 118     
110   fCustomMatFF = "";  // MIFF filename for a c << 119   fCustomMatFF = "";  //MIFF filename for a custom (extended) material
111                                                << 120     
112   fSensitiveVolume = 0;                           121   fSensitiveVolume = 0;
113                                                << 122     
114   fIWantSlits = false;                         << 123   fIWantSlits = false;   
115 }                                                 124 }
116                                                   125 
117 //....oooOO0OOooo........oooOO0OOooo........oo    126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
118                                                   127 
119 SAXSDetectorConstruction::~SAXSDetectorConstru << 128 SAXSDetectorConstruction::~SAXSDetectorConstruction(){}
120                                                   129 
121 //....oooOO0OOooo........oooOO0OOooo........oo    130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122                                                   131 
123 void SAXSDetectorConstruction::DefineMaterials    132 void SAXSDetectorConstruction::DefineMaterials()
124 {                                                 133 {
125   // Define the NIST manager                   << 134   //Define the NIST manager
126   G4NistManager* NistMan = G4NistManager::Inst    135   G4NistManager* NistMan = G4NistManager::Instance();
127                                                << 136     
128   // Define the required elements for compound << 137   //Define the required elements for compounds
129   G4Element* elH = NistMan->FindOrBuildElement << 138   G4Element* elH  = NistMan->FindOrBuildElement("H");
130   G4Element* elC = NistMan->FindOrBuildElement << 139   G4Element* elC  = NistMan->FindOrBuildElement("C");
131   G4Element* elN = NistMan->FindOrBuildElement << 140   G4Element* elN  = NistMan->FindOrBuildElement("N");
132   G4Element* elO = NistMan->FindOrBuildElement << 141   G4Element* elO  = NistMan->FindOrBuildElement("O");
133   G4Element* elNa = NistMan->FindOrBuildElemen << 142   G4Element* elNa = NistMan->FindOrBuildElement("Na"); 
134   G4Element* elP = NistMan->FindOrBuildElement << 143   G4Element* elP  = NistMan->FindOrBuildElement("P");  
135   G4Element* elS = NistMan->FindOrBuildElement << 144   G4Element* elS  = NistMan->FindOrBuildElement("S");  
136   G4Element* elCl = NistMan->FindOrBuildElemen << 145   G4Element* elCl = NistMan->FindOrBuildElement("Cl");  
137   G4Element* elK = NistMan->FindOrBuildElement << 146   G4Element* elK = NistMan->FindOrBuildElement("K");  
138   G4Element* elCa = NistMan->FindOrBuildElemen << 147   G4Element* elCa = NistMan->FindOrBuildElement("Ca");      
139                                                << 148         
140   // variable definition                       << 149   //variable definition
141   G4double d;  // density                      << 150   G4double d;                          //density
142   G4int nel;  // number of elements            << 151   G4int nel;                           //number of elements
143   G4String matname;                               152   G4String matname;
144                                                << 153     
145   // Air                                       << 154   //Air
146   d = 1.29 * mg / cm3;                         << 155   d = 1.29*mg/cm3;
147   nel = 2;                                        156   nel = 2;
148   G4double tAir = 293.15 * CLHEP::kelvin;  //  << 157   G4double tAir = 293.15 * CLHEP::kelvin;  //20° Celsius
149   G4double pAir = 1. * CLHEP::atmosphere;  //  << 158   G4double pAir = 1.*CLHEP::atmosphere;          //1 atm
150   fAir = new G4Material("Air", d, nel, kStateG    159   fAir = new G4Material("Air", d, nel, kStateGas, tAir, pAir);
151   fAir->AddElement(elN, 0.7);                     160   fAir->AddElement(elN, 0.7);
152   fAir->AddElement(elO, 0.3);                     161   fAir->AddElement(elO, 0.3);
153                                                << 162                   
154   // Fat (Tartari2002) (FF from Tartari2002)   << 163   //Fat (Tartari2002) (FF from Tartari2002)
155   G4double d_Fat = 0.923 * g / cm3;            << 164   G4double d_Fat = 0.923*g/cm3;
156   nel = 3;                                        165   nel = 3;
157   matname = "Fat_MI";                             166   matname = "Fat_MI";
158   fFat = new G4Material(matname, d_Fat, nel);     167   fFat = new G4Material(matname, d_Fat, nel);
159   fFat->AddElement(elH, 0.119);                   168   fFat->AddElement(elH, 0.119);
160   fFat->AddElement(elC, 0.772);                   169   fFat->AddElement(elC, 0.772);
161   fFat->AddElement(elO, 0.109);                   170   fFat->AddElement(elO, 0.109);
162                                                << 171     
163   // Water (FF from Tartari2002)               << 172   //Water (FF from Tartari2002)
164   G4double d_Water = 1. * g / cm3;             << 173   G4double d_Water = 1.*g/cm3;
165   nel = 2;                                        174   nel = 2;
166   matname = "Water_MI";                           175   matname = "Water_MI";
167   fWater = new G4Material(matname, d_Water, ne    176   fWater = new G4Material(matname, d_Water, nel);
168   fWater->AddElement(elH, 2);                     177   fWater->AddElement(elH, 2);
169   fWater->AddElement(elO, 1);                     178   fWater->AddElement(elO, 1);
170                                                << 179     
171   // BoneMatrix (Collagen) (FF from Tartari200 << 180   //BoneMatrix (Collagen) (FF from Tartari2002)
172   G4double d_BoneMatrix = 1.263 * g / cm3;     << 181   G4double d_BoneMatrix = 1.263*g/cm3; 
173   nel = 4;                                        182   nel = 4;
174   matname = "BoneMatrix_MI";                      183   matname = "BoneMatrix_MI";
175   fBoneMatrix = new G4Material(matname, d_Bone    184   fBoneMatrix = new G4Material(matname, d_BoneMatrix, nel);
176   fBoneMatrix->AddElement(elH, 0.0344);           185   fBoneMatrix->AddElement(elH, 0.0344);
177   fBoneMatrix->AddElement(elC, 0.7140);           186   fBoneMatrix->AddElement(elC, 0.7140);
178   fBoneMatrix->AddElement(elN, 0.1827);           187   fBoneMatrix->AddElement(elN, 0.1827);
179   fBoneMatrix->AddElement(elO, 0.0689);           188   fBoneMatrix->AddElement(elO, 0.0689);
180                                                << 189     
181   // Mineral (Hydroxyapatite) (Tartari2002) (F << 190   //Mineral (Hydroxyapatite) (Tartari2002) (FF from Tartari2002)
182   G4double d_Mineral = 2.74 * g / cm3;         << 191   G4double d_Mineral = 2.74*g/cm3;
183   nel = 4;                                        192   nel = 4;
184   matname = "Mineral_MI";                         193   matname = "Mineral_MI";
185   fMineral = new G4Material(matname, d_Mineral    194   fMineral = new G4Material(matname, d_Mineral, nel);
186   fMineral->AddElement(elH, 0.002);               195   fMineral->AddElement(elH, 0.002);
187   fMineral->AddElement(elO, 0.414);               196   fMineral->AddElement(elO, 0.414);
188   fMineral->AddElement(elP, 0.185);               197   fMineral->AddElement(elP, 0.185);
189   fMineral->AddElement(elCa, 0.399);              198   fMineral->AddElement(elCa, 0.399);
190                                                << 199     
191   // Medical Material (compostion of Water, Fa << 200   //Medical Material (compostion of Water, Fat, BoneMatrix and Mineral)
192   G4double comp[] = {fComp0, fComp1, fComp2, f    201   G4double comp[] = {fComp0, fComp1, fComp2, fComp3};
193   G4double d_MedMat =                             202   G4double d_MedMat =
194     1 / (comp[0] / d_Fat + comp[1] / d_Water + << 203     1/(comp[0]/d_Fat+comp[1]/d_Water+comp[2]/d_BoneMatrix+comp[3]/d_Mineral);
195   G4int n_MedMat = 0;                             204   G4int n_MedMat = 0;
196   for (size_t i = 0; i < 4; i++) {             << 205   for (size_t i=0; i<4; i++) {
197     if (comp[i] > 0) n_MedMat++;               << 206     if (comp[i]>0) n_MedMat++;
198     if (comp[i] < 0 || comp[i] > 1) {          << 207     if (comp[i]<0 || comp[i]>1) {
199       G4String excep = "Error in Medical Mater << 208       G4String excep =
200       G4Exception("DetectorConstuction::Define << 209         "Error in Medical Material composition: comp[i]<0 or comp[i]>1";
                                                   >> 210       G4Exception("DetectorConstuction::DefineMaterials()","dc0001",
                                                   >> 211                   FatalException,excep);
201       return;                                     212       return;
202     }                                             213     }
203   }                                            << 214   }        
204   std::stringstream ss0, ss1, ss2, ss3;        << 215   std::stringstream ss0,ss1,ss2,ss3;
205   ss0 << comp[0];                              << 216   ss0 << comp[0];        
206   ss1 << comp[1];                              << 217   ss1 << comp[1];        
207   ss2 << comp[2];                              << 218   ss2 << comp[2];        
208   ss3 << comp[3];                              << 219   ss3 << comp[3];        
209   if (comp[0] == 0 || comp[0] == 1) ss0 << ".0 << 220   if (comp[0]==0 || comp[0]==1) ss0 << ".00";
210   if (comp[1] == 0 || comp[1] == 1) ss1 << ".0 << 221   if (comp[1]==0 || comp[1]==1) ss1 << ".00";
211   if (comp[2] == 0 || comp[2] == 1) ss2 << ".0 << 222   if (comp[2]==0 || comp[2]==1) ss2 << ".00";
212   if (comp[3] == 0 || comp[3] == 1) ss3 << ".0 << 223   if (comp[3]==0 || comp[3]==1) ss3 << ".00";
213   if (ss0.str().size() < 4) ss0 << "0";        << 224   if (ss0.str().size()<4) ss0 << "0";
214   if (ss1.str().size() < 4) ss1 << "0";        << 225   if (ss1.str().size()<4) ss1 << "0";
215   if (ss2.str().size() < 4) ss2 << "0";        << 226   if (ss2.str().size()<4) ss2 << "0";
216   if (ss3.str().size() < 4) ss3 << "0";        << 227   if (ss3.str().size()<4) ss3 << "0";
217   if (ss0.str().size() != 4 || ss1.str().size( << 228   if (ss0.str().size()!=4 || ss1.str().size()!=4 || ss2.str().size()!=4 
218       || ss3.str().size() != 4)                << 229       || ss3.str().size()!=4) {
219   {                                            << 230     G4String excep = 
220     G4String excep = "Error in MedMaterial com << 231       "Error in MedMaterial composition: check the digits of the elements of comp";
221     G4Exception("DetectorConstuction::DefineMa << 232     G4Exception("DetectorConstuction::DefineMaterials()","dc0002",
                                                   >> 233                 FatalException,excep);
222     return;                                       234     return;
223   }                                               235   }
224   matname = "MedMat_" + ss0.str() + "_" + ss1. << 236   matname = "MedMat_"+ss0.str()+"_"+ss1.str()+"_"+ss2.str()+"_"+ss3.str();
225   fMedMat = new G4Material(matname, d_MedMat,     237   fMedMat = new G4Material(matname, d_MedMat, n_MedMat);
226   if (comp[0]) fMedMat->AddMaterial(fFat, comp    238   if (comp[0]) fMedMat->AddMaterial(fFat, comp[0]);
227   if (comp[1]) fMedMat->AddMaterial(fWater, co    239   if (comp[1]) fMedMat->AddMaterial(fWater, comp[1]);
228   if (comp[2]) fMedMat->AddMaterial(fBoneMatri    240   if (comp[2]) fMedMat->AddMaterial(fBoneMatrix, comp[2]);
229   if (comp[3]) fMedMat->AddMaterial(fMineral,  << 241   if (comp[3]) fMedMat->AddMaterial(fMineral, comp[3]);        
230   if (comp[0] + comp[1] + comp[2] + comp[3] != << 242   if (comp[0]+comp[1]+comp[2]+comp[3] != 1) {
231     G4String excep = "Error in Medical Materia    243     G4String excep = "Error in Medical Material composition: sum(comp) != 1";
232     G4Exception("DetectorConstuction::DefineMa << 244     G4Exception("DetectorConstuction::DefineMaterials()",
                                                   >> 245                 "dc0003",FatalException,excep);
233     return;                                       246     return;
234   }                                               247   }
235   // If the user wants to use more than one Me << 248   //If the user wants to use more than one MedMat, he has to create the mix 
236   // and label the material properly, such as  << 249   //and label the material properly, such as "MedMat_0.55_0.25_0.05_0.15". 
237   // Such a name enables the automatic form fa << 250   //Such a name enables the automatic form factor calculation.
238                                                << 251     
239   // PMMA (FF from Tartari2002)                << 252   //PMMA (FF from Tartari2002)
240   d = 1.18 * g / cm3;                          << 253   d = 1.18*g/cm3;
241   nel = 3;                                        254   nel = 3;
242   matname = "PMMA_MI";                            255   matname = "PMMA_MI";
243   fPMMA = new G4Material(matname, d, nel);        256   fPMMA = new G4Material(matname, d, nel);
244   fPMMA->AddElement(elH, 8);                      257   fPMMA->AddElement(elH, 8);
245   fPMMA->AddElement(elC, 5);                      258   fPMMA->AddElement(elC, 5);
246   fPMMA->AddElement(elO, 2);                      259   fPMMA->AddElement(elO, 2);
247                                                << 260     
248   // Adipose (Poletti2002) (FF from Poletti200 << 261   //Adipose (Poletti2002) (FF from Poletti2002)
249   d = 0.92 * g / cm3;                          << 262   d = 0.92*g/cm3;
250   nel = 4;                                        263   nel = 4;
251   matname = "adipose_MI";                         264   matname = "adipose_MI";
252   fAdipose = new G4Material(matname, d, nel);     265   fAdipose = new G4Material(matname, d, nel);
253   fAdipose->AddElement(elH, 0.124);               266   fAdipose->AddElement(elH, 0.124);
254   fAdipose->AddElement(elC, 0.765);               267   fAdipose->AddElement(elC, 0.765);
255   fAdipose->AddElement(elN, 0.004);               268   fAdipose->AddElement(elN, 0.004);
256   fAdipose->AddElement(elO, 0.107);               269   fAdipose->AddElement(elO, 0.107);
257                                                << 270     
258   // Glandular (Poletti2002) (FF from Poletti2 << 271   //Glandular (Poletti2002) (FF from Poletti2002)
259   d = 1.04 * g / cm3;                          << 272   d = 1.04*g/cm3;
260   nel = 4;                                        273   nel = 4;
261   matname = "glandular_MI";                       274   matname = "glandular_MI";
262   fGlandular = new G4Material(matname, d, nel)    275   fGlandular = new G4Material(matname, d, nel);
263   fGlandular->AddElement(elH, 0.093);             276   fGlandular->AddElement(elH, 0.093);
264   fGlandular->AddElement(elC, 0.184);             277   fGlandular->AddElement(elC, 0.184);
265   fGlandular->AddElement(elN, 0.044);             278   fGlandular->AddElement(elN, 0.044);
266   fGlandular->AddElement(elO, 0.679);             279   fGlandular->AddElement(elO, 0.679);
267                                                << 280     
268   // human breast 50/50 (ICRU44) (FF from Pepl << 281   //human breast 50/50 (ICRU44) (FF from Peplow1998)
269   d = 0.96 * g / cm3;                          << 282   d = 0.96*g/cm3;
270   nel = 3;                                        283   nel = 3;
271   matname = "breast5050_MI";                      284   matname = "breast5050_MI";
272   fBreast5050 = new G4Material(matname, d, nel    285   fBreast5050 = new G4Material(matname, d, nel);
273   fBreast5050->AddElement(elH, 0.115);            286   fBreast5050->AddElement(elH, 0.115);
274   fBreast5050->AddElement(elC, 0.387);            287   fBreast5050->AddElement(elC, 0.387);
275   fBreast5050->AddElement(elO, 0.498);            288   fBreast5050->AddElement(elO, 0.498);
276                                                << 289     
277   // Liver (ICRU46) (FF_pork_liver_Peplow1998) << 290   //Liver (ICRU46) (FF_pork_liver_Peplow1998)
278   d = 1.06 * g / cm3;                          << 291   d = 1.06*g/cm3; 
279   nel = 9;                                        292   nel = 9;
280   matname = "liver_MI";                           293   matname = "liver_MI";
281   fliver = new G4Material(matname, d, nel);       294   fliver = new G4Material(matname, d, nel);
282   fliver->AddElement(elH, 0.102);                 295   fliver->AddElement(elH, 0.102);
283   fliver->AddElement(elC, 0.139);                 296   fliver->AddElement(elC, 0.139);
284   fliver->AddElement(elN, 0.030);                 297   fliver->AddElement(elN, 0.030);
285   fliver->AddElement(elO, 0.716);                 298   fliver->AddElement(elO, 0.716);
286   fliver->AddElement(elNa, 0.002);                299   fliver->AddElement(elNa, 0.002);
287   fliver->AddElement(elP, 0.003);                 300   fliver->AddElement(elP, 0.003);
288   fliver->AddElement(elS, 0.003);                 301   fliver->AddElement(elS, 0.003);
289   fliver->AddElement(elCl, 0.002);                302   fliver->AddElement(elCl, 0.002);
290   fliver->AddElement(elK, 0.003);                 303   fliver->AddElement(elK, 0.003);
291                                                << 304     
292   // Kidney (ICRU46) (FF_pork_kidney_Peplow199 << 305   //Kidney (ICRU46) (FF_pork_kidney_Peplow1998)
293   d = 1.05 * g / cm3;                          << 306   d = 1.05*g/cm3; 
294   nel = 10;                                       307   nel = 10;
295   matname = "kidney_MI";                          308   matname = "kidney_MI";
296   fkidney = new G4Material(matname, d, nel);      309   fkidney = new G4Material(matname, d, nel);
297   fkidney->AddElement(elH, 0.103);                310   fkidney->AddElement(elH, 0.103);
298   fkidney->AddElement(elC, 0.132);                311   fkidney->AddElement(elC, 0.132);
299   fkidney->AddElement(elN, 0.030);                312   fkidney->AddElement(elN, 0.030);
300   fkidney->AddElement(elO, 0.724);                313   fkidney->AddElement(elO, 0.724);
301   fkidney->AddElement(elNa, 0.002);               314   fkidney->AddElement(elNa, 0.002);
302   fkidney->AddElement(elP, 0.002);                315   fkidney->AddElement(elP, 0.002);
303   fkidney->AddElement(elS, 0.002);                316   fkidney->AddElement(elS, 0.002);
304   fkidney->AddElement(elCl, 0.002);               317   fkidney->AddElement(elCl, 0.002);
305   fkidney->AddElement(elK, 0.002);                318   fkidney->AddElement(elK, 0.002);
306   fkidney->AddElement(elCa, 0.001);            << 319   fkidney->AddElement(elCa, 0.001);  
307                                                << 320     
308   // Lexan (Polycarbonate) (FF from Peplow1998 << 321   //Lexan (Polycarbonate) (FF from Peplow1998)
309   d = 1.221 * g / cm3;                         << 322   d = 1.221*g/cm3;
310   nel = 3;                                        323   nel = 3;
311   matname = "Lexan_MI";                           324   matname = "Lexan_MI";
312   fLexan = new G4Material(matname, d, nel);       325   fLexan = new G4Material(matname, d, nel);
313   fLexan->AddElement(elH, 14);                    326   fLexan->AddElement(elH, 14);
314   fLexan->AddElement(elC, 16);                    327   fLexan->AddElement(elC, 16);
315   fLexan->AddElement(elO, 3);                     328   fLexan->AddElement(elO, 3);
316                                                << 329     
317   // Kapton (FF from Peplow1998)               << 330   //Kapton (FF from Peplow1998)
318   d = 1.42 * g / cm3;                          << 331   d = 1.42*g/cm3;
319   nel = 4;                                        332   nel = 4;
320   matname = "Kapton_MI";                          333   matname = "Kapton_MI";
321   fKapton = new G4Material(matname, d, nel);      334   fKapton = new G4Material(matname, d, nel);
322   fKapton->AddElement(elH, 28);                   335   fKapton->AddElement(elH, 28);
323   fKapton->AddElement(elC, 35);                   336   fKapton->AddElement(elC, 35);
324   fKapton->AddElement(elN, 2);                    337   fKapton->AddElement(elN, 2);
325   fKapton->AddElement(elO, 7);                    338   fKapton->AddElement(elO, 7);
326                                                << 339     
327   // Carcinoma (muscle ICRU44) (FF from Kidane << 340   //Carcinoma (muscle ICRU44) (FF from Kidane1999)
328   d = 1.05 * g / cm3;  // check the density    << 341   d = 1.05*g/cm3; //check the density
329   nel = 9;                                        342   nel = 9;
330   matname = "carcinoma_MI";                       343   matname = "carcinoma_MI";
331   fcarcinoma = new G4Material(matname, d, nel)    344   fcarcinoma = new G4Material(matname, d, nel);
332   fcarcinoma->AddElement(elH, 0.102);             345   fcarcinoma->AddElement(elH, 0.102);
333   fcarcinoma->AddElement(elC, 0.143);             346   fcarcinoma->AddElement(elC, 0.143);
334   fcarcinoma->AddElement(elN, 0.034);             347   fcarcinoma->AddElement(elN, 0.034);
335   fcarcinoma->AddElement(elO, 0.710);             348   fcarcinoma->AddElement(elO, 0.710);
336   fcarcinoma->AddElement(elNa, 0.001);            349   fcarcinoma->AddElement(elNa, 0.001);
337   fcarcinoma->AddElement(elP, 0.002);             350   fcarcinoma->AddElement(elP, 0.002);
338   fcarcinoma->AddElement(elS, 0.003);             351   fcarcinoma->AddElement(elS, 0.003);
339   fcarcinoma->AddElement(elCl, 0.001);            352   fcarcinoma->AddElement(elCl, 0.001);
340   fcarcinoma->AddElement(elK, 0.004);             353   fcarcinoma->AddElement(elK, 0.004);
341                                                << 354     
342   // Nylon (FF from Kosanetzky1987)            << 355   //Nylon (FF from Kosanetzky1987)
343   d = 1.15 * g / cm3;                          << 356   d = 1.15*g/cm3;
344   nel = 4;                                        357   nel = 4;
345   matname = "Nylon_MI";                           358   matname = "Nylon_MI";
346   fNylon = new G4Material(matname, d, nel);    << 359   fNylon = new G4Material(matname, d, nel);          
347   fNylon->AddElement(elH, 11);                    360   fNylon->AddElement(elH, 11);
348   fNylon->AddElement(elC, 6);                     361   fNylon->AddElement(elC, 6);
349   fNylon->AddElement(elN, 1);                     362   fNylon->AddElement(elN, 1);
350   fNylon->AddElement(elO, 1);                     363   fNylon->AddElement(elO, 1);
351                                                << 364     
352   // Polyethylene (FF from Kosanetzky1987)     << 365   //Polyethylene (FF from Kosanetzky1987) 
353   d = 0.94 * g / cm3;  // MDPE => 0.92*g/cm3,  << 366   d = 0.94*g/cm3;        //MDPE => 0.92*g/cm3, HDPE => 0.94*g/cm3
354   nel = 2;                                        367   nel = 2;
355   matname = "Polyethylene_MI";                    368   matname = "Polyethylene_MI";
356   fPolyethylene = new G4Material(matname, d, n    369   fPolyethylene = new G4Material(matname, d, nel);
357   fPolyethylene->AddElement(elH, 4);              370   fPolyethylene->AddElement(elH, 4);
358   fPolyethylene->AddElement(elC, 2);              371   fPolyethylene->AddElement(elC, 2);
359                                                << 372     
360   // Polystyrene (FF from Kosanetzky1987)      << 373   //Polystyrene (FF from Kosanetzky1987)
361   d = 1.05 * g / cm3;                          << 374   d = 1.05*g/cm3;
362   nel = 2;                                        375   nel = 2;
363   matname = "Polystyrene_MI";                     376   matname = "Polystyrene_MI";
364   fPolystyrene = new G4Material(matname, d, ne    377   fPolystyrene = new G4Material(matname, d, nel);
365   fPolystyrene->AddElement(elH, 8);               378   fPolystyrene->AddElement(elH, 8);
366   fPolystyrene->AddElement(elC, 8);            << 379   fPolystyrene->AddElement(elC, 8);          
367                                                << 380     
368   // GrayMatter (DeFelici2008) (FF from DeFeli << 381   //GrayMatter (DeFelici2008) (FF from DeFelici2008)
369   d = 0.991 * g / cm3;                         << 382   d = 0.991*g/cm3; 
370   nel = 3;                                        383   nel = 3;
371   matname = "grayMatter_MI";                      384   matname = "grayMatter_MI";
372   fGrayMatter = new G4Material(matname, d, nel    385   fGrayMatter = new G4Material(matname, d, nel);
373   fGrayMatter->AddElement(elH, 0.1127);           386   fGrayMatter->AddElement(elH, 0.1127);
374   fGrayMatter->AddElement(elC, 0.0849);           387   fGrayMatter->AddElement(elC, 0.0849);
375   fGrayMatter->AddElement(elO, 0.8024);           388   fGrayMatter->AddElement(elO, 0.8024);
376                                                << 389     
377   // WhiteMatter (DeFelici2008) (FF from DeFel << 390   //WhiteMatter (DeFelici2008) (FF from DeFelici2008)
378   d = 0.983 * g / cm3;                         << 391   d = 0.983*g/cm3; 
379   nel = 3;                                        392   nel = 3;
380   matname = "whiteMatter_MI";                     393   matname = "whiteMatter_MI";
381   fWhiteMatter = new G4Material(matname, d, ne    394   fWhiteMatter = new G4Material(matname, d, nel);
382   fWhiteMatter->AddElement(elH, 0.1134);          395   fWhiteMatter->AddElement(elH, 0.1134);
383   fWhiteMatter->AddElement(elC, 0.1621);          396   fWhiteMatter->AddElement(elC, 0.1621);
384   fWhiteMatter->AddElement(elO, 0.7245);          397   fWhiteMatter->AddElement(elO, 0.7245);
385                                                << 398     
386   // Blood (beef) (ICRU46) (FF from Peplow1998 << 399   //Blood (beef) (ICRU46) (FF from Peplow1998)
387   d = 1.06 * g / cm3;                          << 400   d = 1.06*g/cm3; 
388   nel = 9;                                        401   nel = 9;
389   matname = "blood_MI";                           402   matname = "blood_MI";
390   fbeefBlood = new G4Material(matname, d, nel)    403   fbeefBlood = new G4Material(matname, d, nel);
391   fbeefBlood->AddElement(elH, 0.102);             404   fbeefBlood->AddElement(elH, 0.102);
392   fbeefBlood->AddElement(elC, 0.11);              405   fbeefBlood->AddElement(elC, 0.11);
393   fbeefBlood->AddElement(elN, 0.033);             406   fbeefBlood->AddElement(elN, 0.033);
394   fbeefBlood->AddElement(elO, 0.746);             407   fbeefBlood->AddElement(elO, 0.746);
395   fbeefBlood->AddElement(elNa, 0.001);            408   fbeefBlood->AddElement(elNa, 0.001);
396   fbeefBlood->AddElement(elP, 0.001);             409   fbeefBlood->AddElement(elP, 0.001);
397   fbeefBlood->AddElement(elS, 0.002);             410   fbeefBlood->AddElement(elS, 0.002);
398   fbeefBlood->AddElement(elCl, 0.003);            411   fbeefBlood->AddElement(elCl, 0.003);
399   fbeefBlood->AddElement(elK, 0.002);             412   fbeefBlood->AddElement(elK, 0.002);
400                                                << 413     
401   // Formaline (FF from Peplow1998)            << 414   //Formaline (FF from Peplow1998)
402   d = 1.083 * g / cm3;                         << 415   d = 1.083*g/cm3; 
403   nel = 3;                                        416   nel = 3;
404   matname = "Formaline_MI";                       417   matname = "Formaline_MI";
405   fFormaline = new G4Material(matname, d, nel)    418   fFormaline = new G4Material(matname, d, nel);
406   fFormaline->AddElement(elH, 2);                 419   fFormaline->AddElement(elH, 2);
407   fFormaline->AddElement(elC, 1);                 420   fFormaline->AddElement(elC, 1);
408   fFormaline->AddElement(elO, 1);              << 421   fFormaline->AddElement(elO, 1);          
409                                                << 422     
410   // Acetone (FF from Cozzini2010)             << 423   //Acetone (FF from Cozzini2010)
411   d = 0.7845 * g / cm3;                        << 424   d = 0.7845*g/cm3; 
412   nel = 3;                                        425   nel = 3;
413   matname = "Acetone_MI";                         426   matname = "Acetone_MI";
414   fAcetone = new G4Material(matname, d, nel);     427   fAcetone = new G4Material(matname, d, nel);
415   fAcetone->AddElement(elH, 6);                   428   fAcetone->AddElement(elH, 6);
416   fAcetone->AddElement(elC, 3);                   429   fAcetone->AddElement(elC, 3);
417   fAcetone->AddElement(elO, 1);                   430   fAcetone->AddElement(elO, 1);
418                                                << 431     
419   // Hperoxide (FF from Cozzini2010)           << 432   //Hperoxide (FF from Cozzini2010)
420   d = 1.11 * g / cm3;                          << 433   d = 1.11*g/cm3; 
421   nel = 2;                                        434   nel = 2;
422   matname = "Hperoxide_MI";                       435   matname = "Hperoxide_MI";
423   fHperoxide = new G4Material(matname, d, nel)    436   fHperoxide = new G4Material(matname, d, nel);
424   fHperoxide->AddElement(elH, 2);                 437   fHperoxide->AddElement(elH, 2);
425   fHperoxide->AddElement(elO, 2);                 438   fHperoxide->AddElement(elO, 2);
426                                                << 439     
427   // CIRS30-70 (Poletti2002) (FF from Poletti2 << 440   //CIRS30-70 (Poletti2002) (FF from Poletti2002)
428   d = 0.97 * g / cm3;                          << 441   d = 0.97*g/cm3; 
429   nel = 5;                                        442   nel = 5;
430   matname = "CIRS30-70_MI";                       443   matname = "CIRS30-70_MI";
431   fCIRS3070 = new G4Material(matname, d, nel);    444   fCIRS3070 = new G4Material(matname, d, nel);
432   fCIRS3070->AddElement(elH, 0.1178);             445   fCIRS3070->AddElement(elH, 0.1178);
433   fCIRS3070->AddElement(elC, 0.7512);             446   fCIRS3070->AddElement(elC, 0.7512);
434   fCIRS3070->AddElement(elN, 0.0066);             447   fCIRS3070->AddElement(elN, 0.0066);
435   fCIRS3070->AddElement(elO, 0.1214);             448   fCIRS3070->AddElement(elO, 0.1214);
436   fCIRS3070->AddElement(elCa, 0.0030);            449   fCIRS3070->AddElement(elCa, 0.0030);
437                                                << 450     
438   // CIRS50-50 (Poletti2002) (FF from Poletti2 << 451   //CIRS50-50 (Poletti2002) (FF from Poletti2002)
439   d = 0.98 * g / cm3;                          << 452   d = 0.98*g/cm3; 
440   nel = 5;                                        453   nel = 5;
441   matname = "CIRS50-50_MI";                       454   matname = "CIRS50-50_MI";
442   fCIRS5050 = new G4Material(matname, d, nel);    455   fCIRS5050 = new G4Material(matname, d, nel);
443   fCIRS5050->AddElement(elH, 0.1110);             456   fCIRS5050->AddElement(elH, 0.1110);
444   fCIRS5050->AddElement(elC, 0.7274);             457   fCIRS5050->AddElement(elC, 0.7274);
445   fCIRS5050->AddElement(elN, 0.0104);             458   fCIRS5050->AddElement(elN, 0.0104);
446   fCIRS5050->AddElement(elO, 0.1482);             459   fCIRS5050->AddElement(elO, 0.1482);
447   fCIRS5050->AddElement(elCa, 0.0030);            460   fCIRS5050->AddElement(elCa, 0.0030);
448                                                << 461     
449   // CIRS70-30 (Poletti2002) (FF from Poletti2 << 462   //CIRS70-30 (Poletti2002) (FF from Poletti2002)
450   d = 1.01 * g / cm3;                          << 463   d = 1.01*g/cm3; 
451   nel = 5;                                        464   nel = 5;
452   matname = "CIRS70-30_MI";                       465   matname = "CIRS70-30_MI";
453   fCIRS7030 = new G4Material(matname, d, nel);    466   fCIRS7030 = new G4Material(matname, d, nel);
454   fCIRS7030->AddElement(elH, 0.1172);             467   fCIRS7030->AddElement(elH, 0.1172);
455   fCIRS7030->AddElement(elC, 0.7378);             468   fCIRS7030->AddElement(elC, 0.7378);
456   fCIRS7030->AddElement(elN, 0.0130);             469   fCIRS7030->AddElement(elN, 0.0130);
457   fCIRS7030->AddElement(elO, 0.1244);             470   fCIRS7030->AddElement(elO, 0.1244);
458   fCIRS7030->AddElement(elCa, 0.0076);            471   fCIRS7030->AddElement(elCa, 0.0076);
459                                                << 472           
460   // RMI454 (Poletti2002) (FF from Poletti2002 << 473   //RMI454 (Poletti2002) (FF from Poletti2002)
461   d = 0.98 * g / cm3;                          << 474   d = 0.98*g/cm3; 
462   nel = 4;                                        475   nel = 4;
463   matname = "RMI454_MI";                          476   matname = "RMI454_MI";
464   fRMI454 = new G4Material(matname, d, nel);      477   fRMI454 = new G4Material(matname, d, nel);
465   fRMI454->AddElement(elH, 0.0924);               478   fRMI454->AddElement(elH, 0.0924);
466   fRMI454->AddElement(elC, 0.6935);               479   fRMI454->AddElement(elC, 0.6935);
467   fRMI454->AddElement(elN, 0.0198);               480   fRMI454->AddElement(elN, 0.0198);
468   fRMI454->AddElement(elO, 0.1943);               481   fRMI454->AddElement(elO, 0.1943);
469                                                << 482         
470   // Bone (King2011 decomposition) (FF from Ki << 483   //Bone (King2011 decomposition) (FF from King2011) 
471   d = 1.344 * g / cm3;                         << 484   d = 1.344*g/cm3; 
472   nel = 6;                                        485   nel = 6;
473   matname = "bone_MI";                            486   matname = "bone_MI";
474   fBone = new G4Material(matname, d, nel);        487   fBone = new G4Material(matname, d, nel);
475   fBone->AddElement(elH, 0.0582);                 488   fBone->AddElement(elH, 0.0582);
476   fBone->AddElement(elC, 0.3055);                 489   fBone->AddElement(elC, 0.3055);
477   fBone->AddElement(elN, 0.0347);                 490   fBone->AddElement(elN, 0.0347);
478   fBone->AddElement(elO, 0.3856);                 491   fBone->AddElement(elO, 0.3856);
479   fBone->AddElement(elP, 0.0684);                 492   fBone->AddElement(elP, 0.0684);
480   fBone->AddElement(elCa, 0.1476);                493   fBone->AddElement(elCa, 0.1476);
481                                                   494 
482   // FatLowX (Tartari2002) (FF_fat_Tartari2002 << 495   //FatLowX (Tartari2002) (FF_fat_Tartari2002_joint_lowXdata_ESRF2003)
483   nel = 3;                                        496   nel = 3;
484   matname = "FatLowX_MI";                         497   matname = "FatLowX_MI";
485   ffatLowX = new G4Material(matname, d_Fat, ne    498   ffatLowX = new G4Material(matname, d_Fat, nel);
486   ffatLowX->AddElement(elH, 0.119);               499   ffatLowX->AddElement(elH, 0.119);
487   ffatLowX->AddElement(elC, 0.772);               500   ffatLowX->AddElement(elC, 0.772);
488   ffatLowX->AddElement(elO, 0.109);               501   ffatLowX->AddElement(elO, 0.109);
489                                                << 502           
490   // BonematrixLowX (Collagen)                 << 503   //BonematrixLowX (Collagen)
491   //(Tartari2002) (FF_bonematrix_Tartari2002_j    504   //(Tartari2002) (FF_bonematrix_Tartari2002_joint_lowXdata)
492   nel = 4;                                        505   nel = 4;
493   matname = "BoneMatrixLowX_MI";                  506   matname = "BoneMatrixLowX_MI";
494   fbonematrixLowX = new G4Material(matname, d_    507   fbonematrixLowX = new G4Material(matname, d_BoneMatrix, nel);
495   fbonematrixLowX->AddElement(elH, 0.0344);       508   fbonematrixLowX->AddElement(elH, 0.0344);
496   fbonematrixLowX->AddElement(elC, 0.7140);       509   fbonematrixLowX->AddElement(elC, 0.7140);
497   fbonematrixLowX->AddElement(elN, 0.1827);       510   fbonematrixLowX->AddElement(elN, 0.1827);
498   fbonematrixLowX->AddElement(elO, 0.0689);       511   fbonematrixLowX->AddElement(elO, 0.0689);
499                                                << 512           
500   // dryBoneLowX                               << 513   //dryBoneLowX
501   //(Tartari2002) (FF_dryBone_Tartari2002_join    514   //(Tartari2002) (FF_dryBone_Tartari2002_joint_lowXdata_ESRF2003)
502   d = 2.06 * g / cm3;                          << 515   d = 2.06*g/cm3; 
503   nel = 6;                                        516   nel = 6;
504   matname = "dryBoneLowX_MI";                     517   matname = "dryBoneLowX_MI";
505   fdryBoneLowX = new G4Material(matname, d, ne    518   fdryBoneLowX = new G4Material(matname, d, nel);
506   fdryBoneLowX->AddElement(elH, 0.0112);          519   fdryBoneLowX->AddElement(elH, 0.0112);
507   fdryBoneLowX->AddElement(elC, 0.2013);          520   fdryBoneLowX->AddElement(elC, 0.2013);
508   fdryBoneLowX->AddElement(elN, 0.0515);          521   fdryBoneLowX->AddElement(elN, 0.0515);
509   fdryBoneLowX->AddElement(elO, 0.3148);          522   fdryBoneLowX->AddElement(elO, 0.3148);
510   fdryBoneLowX->AddElement(elP, 0.1327);          523   fdryBoneLowX->AddElement(elP, 0.1327);
511   fdryBoneLowX->AddElement(elCa, 0.2885);         524   fdryBoneLowX->AddElement(elCa, 0.2885);
512                                                   525 
513   // CustomMat (FF read from file)             << 526   //CustomMat (FF read from file)
514   nel = 0;                                        527   nel = 0;
515   G4double sumMF = 0.;                            528   G4double sumMF = 0.;
516   G4cout << "CustomMat composition: " << G4end    529   G4cout << "CustomMat composition: " << G4endl;
517   if (fCustomMatHmassfract) {                     530   if (fCustomMatHmassfract) {
518     G4cout << "CustomMatHmassfract: " << fCust    531     G4cout << "CustomMatHmassfract: " << fCustomMatHmassfract << G4endl;
519     nel++;                                        532     nel++;
520     sumMF += fCustomMatHmassfract;                533     sumMF += fCustomMatHmassfract;
521   }                                               534   }
522   if (fCustomMatCmassfract) {                  << 535   if (fCustomMatCmassfract) { 
523     G4cout << "CustomMatCmassfract: " << fCust    536     G4cout << "CustomMatCmassfract: " << fCustomMatCmassfract << G4endl;
524     nel++;                                        537     nel++;
525     sumMF += fCustomMatCmassfract;                538     sumMF += fCustomMatCmassfract;
526   }                                               539   }
527   if (fCustomMatNmassfract) {                     540   if (fCustomMatNmassfract) {
528     G4cout << "CustomMatNmassfract: " << fCust    541     G4cout << "CustomMatNmassfract: " << fCustomMatNmassfract << G4endl;
529     nel++;                                        542     nel++;
530     sumMF += fCustomMatNmassfract;                543     sumMF += fCustomMatNmassfract;
531   }                                               544   }
532   if (fCustomMatOmassfract) {                     545   if (fCustomMatOmassfract) {
533     G4cout << "CustomMatOmassfract: " << fCust    546     G4cout << "CustomMatOmassfract: " << fCustomMatOmassfract << G4endl;
534     nel++;                                        547     nel++;
535     sumMF += fCustomMatOmassfract;                548     sumMF += fCustomMatOmassfract;
536   }                                               549   }
537   if (fCustomMatNamassfract) {                    550   if (fCustomMatNamassfract) {
538     G4cout << "CustomMatNamassfract: " << fCus    551     G4cout << "CustomMatNamassfract: " << fCustomMatNamassfract << G4endl;
539     nel++;                                        552     nel++;
540     sumMF += fCustomMatNamassfract;               553     sumMF += fCustomMatNamassfract;
541   }                                               554   }
542   if (fCustomMatPmassfract) {                     555   if (fCustomMatPmassfract) {
543     G4cout << "CustomMatPmassfract: " << fCust    556     G4cout << "CustomMatPmassfract: " << fCustomMatPmassfract << G4endl;
544     nel++;                                        557     nel++;
545     sumMF += fCustomMatPmassfract;                558     sumMF += fCustomMatPmassfract;
546   }                                               559   }
547   if (fCustomMatSmassfract) {                     560   if (fCustomMatSmassfract) {
548     G4cout << "CustomMatSmassfract: " << fCust    561     G4cout << "CustomMatSmassfract: " << fCustomMatSmassfract << G4endl;
549     nel++;                                        562     nel++;
550     sumMF += fCustomMatSmassfract;                563     sumMF += fCustomMatSmassfract;
551   }                                               564   }
552   if (fCustomMatClmassfract) {                    565   if (fCustomMatClmassfract) {
553     G4cout << "CustomMatClmassfract: " << fCus    566     G4cout << "CustomMatClmassfract: " << fCustomMatClmassfract << G4endl;
554     nel++;                                        567     nel++;
555     sumMF += fCustomMatClmassfract;               568     sumMF += fCustomMatClmassfract;
556   }                                            << 569   } 
557   if (fCustomMatKmassfract) {                     570   if (fCustomMatKmassfract) {
558     G4cout << "CustomMatKmassfract: " << fCust    571     G4cout << "CustomMatKmassfract: " << fCustomMatKmassfract << G4endl;
559     nel++;                                        572     nel++;
560     sumMF += fCustomMatKmassfract;                573     sumMF += fCustomMatKmassfract;
561   }                                            << 574   } 
562   if (fCustomMatCamassfract) {                    575   if (fCustomMatCamassfract) {
563     G4cout << "CustomMatCamassfract: " << fCus    576     G4cout << "CustomMatCamassfract: " << fCustomMatCamassfract << G4endl;
564     nel++;                                        577     nel++;
565     sumMF += fCustomMatCamassfract;               578     sumMF += fCustomMatCamassfract;
566   }                                               579   }
567   if (sumMF == 0.) {                              580   if (sumMF == 0.) {
568     // set a default material (water),         << 581     //set a default material (water), 
569     // otherwiswe an error appears in the inte << 582     //otherwiswe an error appears in the interactive mode
570     fCustomMatDensity = 1.00;  // g/cm3        << 583     fCustomMatDensity = 1.00; //g/cm3
571     fCustomMatHmassfract = 0.1119;                584     fCustomMatHmassfract = 0.1119;
572     G4cout << "CustomMat set, but not used!" <    585     G4cout << "CustomMat set, but not used!" << G4endl;
573     G4cout << "CustomMatHmassfract: " << fCust    586     G4cout << "CustomMatHmassfract: " << fCustomMatHmassfract << G4endl;
574     fCustomMatOmassfract = 0.8881;                587     fCustomMatOmassfract = 0.8881;
575     G4cout << "CustomMatOmassfract: " << fCust    588     G4cout << "CustomMatOmassfract: " << fCustomMatOmassfract << G4endl;
576     nel = 2;                                      589     nel = 2;
577     sumMF = 1;                                 << 590     sumMF = 1;                
578   }                                            << 591   }        
579   if (sumMF != 1.) {                              592   if (sumMF != 1.) {
580     G4String excep = "Error in Custom Material << 593     G4String excep =
581     G4Exception("DetectorConstuction::DefineMa << 594       "Error in Custom Material composition: check elemental mass fractions";
                                                   >> 595     G4Exception("DetectorConstuction::DefineMaterials()",
                                                   >> 596                 "dc0004",FatalException,excep);
582     return;                                       597     return;
583   }                                            << 598   }   
584                                                << 599         
585   d = fCustomMatDensity * g / cm3;             << 600   d = fCustomMatDensity*g/cm3; 
586   matname = "CustomMat";                          601   matname = "CustomMat";
587   // Notice: this is an extended material      << 602   //Notice: this is an extended material
588   fCustomMat = new G4ExtendedMaterial(matname,    603   fCustomMat = new G4ExtendedMaterial(matname, d, nel);
589   if (fCustomMatHmassfract) fCustomMat->AddEle << 604   if (fCustomMatHmassfract)
590   if (fCustomMatCmassfract) fCustomMat->AddEle << 605     fCustomMat->AddElement(elH, fCustomMatHmassfract);        
591   if (fCustomMatNmassfract) fCustomMat->AddEle << 606   if (fCustomMatCmassfract)
592   if (fCustomMatOmassfract) fCustomMat->AddEle << 607     fCustomMat->AddElement(elC, fCustomMatCmassfract);
593   if (fCustomMatNamassfract) fCustomMat->AddEl << 608   if (fCustomMatNmassfract)
594   if (fCustomMatPmassfract) fCustomMat->AddEle << 609     fCustomMat->AddElement(elN, fCustomMatNmassfract);
595   if (fCustomMatSmassfract) fCustomMat->AddEle << 610   if (fCustomMatOmassfract)
596   if (fCustomMatClmassfract) fCustomMat->AddEl << 611     fCustomMat->AddElement(elO, fCustomMatOmassfract);
597   if (fCustomMatKmassfract) fCustomMat->AddEle << 612   if (fCustomMatNamassfract)
598   if (fCustomMatCamassfract) fCustomMat->AddEl << 613     fCustomMat->AddElement(elNa, fCustomMatNamassfract);
599   // Register MI extension                     << 614   if (fCustomMatPmassfract)
600   fCustomMat->RegisterExtension(std::unique_pt << 615     fCustomMat->AddElement(elP, fCustomMatPmassfract);
                                                   >> 616   if (fCustomMatSmassfract)
                                                   >> 617     fCustomMat->AddElement(elS, fCustomMatSmassfract);
                                                   >> 618   if (fCustomMatClmassfract)
                                                   >> 619     fCustomMat->AddElement(elCl, fCustomMatClmassfract);
                                                   >> 620   if (fCustomMatKmassfract)
                                                   >> 621     fCustomMat->AddElement(elK, fCustomMatKmassfract);
                                                   >> 622   if (fCustomMatCamassfract)
                                                   >> 623     fCustomMat->AddElement(elCa, fCustomMatCamassfract);
                                                   >> 624   //Register MI extension        
                                                   >> 625   fCustomMat->RegisterExtension
                                                   >> 626     (std::unique_ptr<G4MIData>(new G4MIData("MI")));
601   G4MIData* dataMICustomMat = (G4MIData*)fCust    627   G4MIData* dataMICustomMat = (G4MIData*)fCustomMat->RetrieveExtension("MI");
602   dataMICustomMat->SetFilenameFF(fCustomMatFF)    628   dataMICustomMat->SetFilenameFF(fCustomMatFF);
603                                                   629 
604   // Nist Materials                            << 630   //Nist Materials
605   fLead = NistMan->FindOrBuildMaterial("G4_Pb" << 631   fLead = NistMan->FindOrBuildMaterial("G4_Pb"); 
606   fTungsten = NistMan->FindOrBuildMaterial("G4    632   fTungsten = NistMan->FindOrBuildMaterial("G4_W");
607   fGe = NistMan->FindOrBuildMaterial("G4_Ge");    633   fGe = NistMan->FindOrBuildMaterial("G4_Ge");
608 }                                                 634 }
609                                                   635 
610 //....oooOO0OOooo........oooOO0OOooo........oo    636 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
611                                                   637 
612 void SAXSDetectorConstruction::SetGeometricalV    638 void SAXSDetectorConstruction::SetGeometricalVariables()
613 {                                                 639 {
614   // World                                     << 640   //World
615   fWorldSize = 10000. * mm;                    << 641   fWorldSize = 10000.*mm; 
616                                                << 642     
617   // Phantom                                   << 643   //Phantom
618   fPhantomDiameter = 50. * mm;                 << 644   fPhantomDiameter = 50.*mm;
619   fPhantomHeight = 15. * mm;                   << 645   fPhantomHeight = 15.*mm;
620   fPhantomZ = 0. * mm;                         << 646   fPhantomZ = 0.*mm;
621                                                << 647             
622   // setup angle (rad)                         << 648   //setup angle (rad)
623   fthetaSetup = 0.;                               649   fthetaSetup = 0.;
624                                                << 650         
625   // Slits                                     << 651   //Slits
626   fSlitSize = 50. * mm;                        << 652   fSlitSize = 50.*mm;
627   fSlit1Thickness = 5. * mm;                   << 653   fSlit1Thickness = 5.*mm;
628   fSlit2Thickness = 5. * mm;                   << 654   fSlit2Thickness = 5.*mm;
629   fSlit3Thickness = 5. * mm;                   << 655   fSlit3Thickness = 5.*mm;
630   fSlit4Thickness = 5. * mm;                   << 656   fSlit4Thickness = 5.*mm;
631   fSlit1SampleDistance = 350. * mm;            << 657   fSlit1SampleDistance = 350.*mm;
632   fSlit2SampleDistance = 50. * mm;             << 658   fSlit2SampleDistance = 50.*mm;
633   fSlit3SampleDistance = 50. * mm;             << 659   fSlit3SampleDistance = 50.*mm;
634   fSlit4SampleDistance = 450. * mm;            << 660   fSlit4SampleDistance = 450.*mm;
635   fSlit1xAperture = 4. * mm;                   << 661   fSlit1xAperture = 4.*mm;
636   fSlit2xAperture = 4. * mm;                   << 662   fSlit2xAperture = 4.*mm;
637   fSlit3xAperture = 4. * mm;                   << 663   fSlit3xAperture = 4.*mm;
638   fSlit4xAperture = 4. * mm;                   << 664   fSlit4xAperture = 4.*mm;
639   fSlit1yAperture = 4. * mm;                   << 665   fSlit1yAperture = 4.*mm;
640   fSlit2yAperture = 4. * mm;                   << 666   fSlit2yAperture = 4.*mm;
641   fSlit3yAperture = 4. * mm;                   << 667   fSlit3yAperture = 4.*mm;
642   fSlit4yAperture = 4. * mm;                   << 668   fSlit4yAperture = 4.*mm;
643                                                << 669 
644   // Detector                                  << 670   //Detector
645   fDetectorSize = 20. * mm;                    << 671   fDetectorSize = 20.*mm;
646   fDetectorThickness = 20. * mm;               << 672   fDetectorThickness = 20.*mm;
647   fDetectorSampleDistance = 500. * mm;         << 673   fDetectorSampleDistance = 500.*mm;
648                                                << 674         
649   // Shielding                                 << 675   //Shielding
650   fShieldingThickness = 4. * mm;               << 676   fShieldingThickness = 4.*mm;
651 }                                                 677 }
652                                                   678 
653 //....oooOO0OOooo........oooOO0OOooo........oo    679 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
654                                                   680 
655 G4VPhysicalVolume* SAXSDetectorConstruction::C    681 G4VPhysicalVolume* SAXSDetectorConstruction::Construct()
656 {                                              << 682 {   
657   // define custom materials                   << 683   //define custom materials
658   DefineMaterials();                              684   DefineMaterials();
                                                   >> 685         
                                                   >> 686   //World    
                                                   >> 687   fWorldSolid = new G4Box("WorldSolid", 
                                                   >> 688                           fWorldSize*0.5, 
                                                   >> 689                           fWorldSize*0.5, 
                                                   >> 690                           fWorldSize*0.5);   
                                                   >> 691      
                                                   >> 692   fWorldLogic = new G4LogicalVolume(fWorldSolid, fAir, "WorldLogic");  
                                                   >> 693      
                                                   >> 694   fWorldLogic->SetVisAttributes(G4VisAttributes::GetInvisible());    
                                                   >> 695     
                                                   >> 696   fWorldPhysical = new G4PVPlacement(0, 
                                                   >> 697                                      G4ThreeVector(0., 0., 0.), 
                                                   >> 698                                      fWorldLogic, 
                                                   >> 699                                      "WorldPhysical", 
                                                   >> 700                                      0, 
                                                   >> 701                                      false, 
                                                   >> 702                                      0);
                                                   >> 703       
                                                   >> 704   //choose the phantom material
                                                   >> 705   switch (fPhantomMaterialIndex) {        
                                                   >> 706   case (1):                           
                                                   >> 707     fPhantomMaterial = fWater;
                                                   >> 708     break;
                                                   >> 709   case (2):                                           
                                                   >> 710     fPhantomMaterial = fMedMat;
                                                   >> 711     break;
                                                   >> 712   case (3):
                                                   >> 713     fPhantomMaterial = fPMMA;
                                                   >> 714     break;    
                                                   >> 715   case (4):
                                                   >> 716     fPhantomMaterial = fAdipose;
                                                   >> 717     break;   
                                                   >> 718   case (5):
                                                   >> 719     fPhantomMaterial = fGlandular;
                                                   >> 720     break; 
                                                   >> 721   case (6):
                                                   >> 722     fPhantomMaterial = fBreast5050;
                                                   >> 723     break; 
                                                   >> 724   case (7):
                                                   >> 725     fPhantomMaterial = fcarcinoma;
                                                   >> 726     break; 
                                                   >> 727   case (8):
                                                   >> 728     fPhantomMaterial = fkidney;
                                                   >> 729     break; 
                                                   >> 730   case (9):
                                                   >> 731     fPhantomMaterial = fliver;
                                                   >> 732     break; 
                                                   >> 733   case (10):
                                                   >> 734     fPhantomMaterial = fFat;
                                                   >> 735     break;  
                                                   >> 736   case (11):
                                                   >> 737     fPhantomMaterial = fBoneMatrix;
                                                   >> 738     break;  
                                                   >> 739   case (12):
                                                   >> 740     fPhantomMaterial = fMineral;
                                                   >> 741     break;  
                                                   >> 742   case (13):
                                                   >> 743     fPhantomMaterial = fBone;
                                                   >> 744     break;  
                                                   >> 745   case (14):
                                                   >> 746     fPhantomMaterial = ffatLowX;
                                                   >> 747     break; 
                                                   >> 748   case (15):
                                                   >> 749     fPhantomMaterial = fbonematrixLowX;
                                                   >> 750     break;
                                                   >> 751   case (16):
                                                   >> 752     fPhantomMaterial = fdryBoneLowX;
                                                   >> 753     break;
                                                   >> 754   case (17):
                                                   >> 755     fPhantomMaterial = fLexan;
                                                   >> 756     break;  
                                                   >> 757   case (18):
                                                   >> 758     fPhantomMaterial = fKapton;
                                                   >> 759     break;  
                                                   >> 760   case (19):
                                                   >> 761     fPhantomMaterial = fNylon;
                                                   >> 762     break;  
                                                   >> 763   case (20):
                                                   >> 764     fPhantomMaterial = fPolyethylene;
                                                   >> 765     break;  
                                                   >> 766   case (21):
                                                   >> 767     fPhantomMaterial = fPolystyrene;
                                                   >> 768     break; 
                                                   >> 769   case (22):
                                                   >> 770     fPhantomMaterial = fFormaline;
                                                   >> 771     break; 
                                                   >> 772   case (23):
                                                   >> 773     fPhantomMaterial = fAcetone;
                                                   >> 774     break; 
                                                   >> 775   case (24):
                                                   >> 776     fPhantomMaterial = fHperoxide;
                                                   >> 777     break;  
                                                   >> 778   case (25):
                                                   >> 779     fPhantomMaterial = fCIRS3070;
                                                   >> 780     break; 
                                                   >> 781   case (26):
                                                   >> 782     fPhantomMaterial = fCIRS5050;
                                                   >> 783     break; 
                                                   >> 784   case (27):
                                                   >> 785     fPhantomMaterial = fCIRS7030;
                                                   >> 786     break; 
                                                   >> 787   case (28):
                                                   >> 788     fPhantomMaterial = fRMI454;                          
                                                   >> 789     break;
                                                   >> 790   case (29):
                                                   >> 791     fPhantomMaterial = fAir;
                                                   >> 792     break; 
                                                   >> 793   case (30):
                                                   >> 794     fPhantomMaterial = fCustomMat;
                                                   >> 795     break;
                                                   >> 796   }    
                                                   >> 797         
                                                   >> 798   //Phantom (cylinder with axis orthogonal to the X-ray beam axis)
                                                   >> 799   G4Tubs* PhantomSolid = new G4Tubs("PhantomSolid", 
                                                   >> 800                                     0., 
                                                   >> 801                                     fPhantomDiameter*0.5, 
                                                   >> 802                                     fPhantomHeight*0.5, 
                                                   >> 803                                     0.*deg, 
                                                   >> 804                                     360.*deg);  
                                                   >> 805                                                         
                                                   >> 806   fPhantomLogic = new G4LogicalVolume(PhantomSolid, 
                                                   >> 807                                       fPhantomMaterial, 
                                                   >> 808                                       "PhantomLogic");        
659                                                   809 
660   // World                                     << 810   G4VisAttributes* PhantomVisAttribute =
661   fWorldSolid = new G4Box("WorldSolid", fWorld << 811     new G4VisAttributes(G4Colour(1., 1., 1.));  
662                                                << 
663   fWorldLogic = new G4LogicalVolume(fWorldSoli << 
664                                                << 
665   fWorldLogic->SetVisAttributes(G4VisAttribute << 
666                                                << 
667   fWorldPhysical =                             << 
668     new G4PVPlacement(0, G4ThreeVector(0., 0., << 
669                                                << 
670   // choose the phantom material               << 
671   switch (fPhantomMaterialIndex) {             << 
672     case (1):                                  << 
673       fPhantomMaterial = fWater;               << 
674       break;                                   << 
675     case (2):                                  << 
676       fPhantomMaterial = fMedMat;              << 
677       break;                                   << 
678     case (3):                                  << 
679       fPhantomMaterial = fPMMA;                << 
680       break;                                   << 
681     case (4):                                  << 
682       fPhantomMaterial = fAdipose;             << 
683       break;                                   << 
684     case (5):                                  << 
685       fPhantomMaterial = fGlandular;           << 
686       break;                                   << 
687     case (6):                                  << 
688       fPhantomMaterial = fBreast5050;          << 
689       break;                                   << 
690     case (7):                                  << 
691       fPhantomMaterial = fcarcinoma;           << 
692       break;                                   << 
693     case (8):                                  << 
694       fPhantomMaterial = fkidney;              << 
695       break;                                   << 
696     case (9):                                  << 
697       fPhantomMaterial = fliver;               << 
698       break;                                   << 
699     case (10):                                 << 
700       fPhantomMaterial = fFat;                 << 
701       break;                                   << 
702     case (11):                                 << 
703       fPhantomMaterial = fBoneMatrix;          << 
704       break;                                   << 
705     case (12):                                 << 
706       fPhantomMaterial = fMineral;             << 
707       break;                                   << 
708     case (13):                                 << 
709       fPhantomMaterial = fBone;                << 
710       break;                                   << 
711     case (14):                                 << 
712       fPhantomMaterial = ffatLowX;             << 
713       break;                                   << 
714     case (15):                                 << 
715       fPhantomMaterial = fbonematrixLowX;      << 
716       break;                                   << 
717     case (16):                                 << 
718       fPhantomMaterial = fdryBoneLowX;         << 
719       break;                                   << 
720     case (17):                                 << 
721       fPhantomMaterial = fLexan;               << 
722       break;                                   << 
723     case (18):                                 << 
724       fPhantomMaterial = fKapton;              << 
725       break;                                   << 
726     case (19):                                 << 
727       fPhantomMaterial = fNylon;               << 
728       break;                                   << 
729     case (20):                                 << 
730       fPhantomMaterial = fPolyethylene;        << 
731       break;                                   << 
732     case (21):                                 << 
733       fPhantomMaterial = fPolystyrene;         << 
734       break;                                   << 
735     case (22):                                 << 
736       fPhantomMaterial = fFormaline;           << 
737       break;                                   << 
738     case (23):                                 << 
739       fPhantomMaterial = fAcetone;             << 
740       break;                                   << 
741     case (24):                                 << 
742       fPhantomMaterial = fHperoxide;           << 
743       break;                                   << 
744     case (25):                                 << 
745       fPhantomMaterial = fCIRS3070;            << 
746       break;                                   << 
747     case (26):                                 << 
748       fPhantomMaterial = fCIRS5050;            << 
749       break;                                   << 
750     case (27):                                 << 
751       fPhantomMaterial = fCIRS7030;            << 
752       break;                                   << 
753     case (28):                                 << 
754       fPhantomMaterial = fRMI454;              << 
755       break;                                   << 
756     case (29):                                 << 
757       fPhantomMaterial = fAir;                 << 
758       break;                                   << 
759     case (30):                                 << 
760       fPhantomMaterial = fCustomMat;           << 
761       break;                                   << 
762   }                                            << 
763                                                << 
764   // Phantom (cylinder with axis orthogonal to << 
765   G4Tubs* PhantomSolid = new G4Tubs("PhantomSo << 
766                                     fPhantomHe << 
767                                                << 
768   fPhantomLogic = new G4LogicalVolume(PhantomS << 
769                                                << 
770   G4VisAttributes* PhantomVisAttribute = new G << 
771   PhantomVisAttribute->SetForceSolid(true);       812   PhantomVisAttribute->SetForceSolid(true);
772   fPhantomLogic->SetVisAttributes(PhantomVisAt    813   fPhantomLogic->SetVisAttributes(PhantomVisAttribute);
773                                                   814 
774   G4cout << "Phantom material: " << fPhantomMa    815   G4cout << "Phantom material: " << fPhantomMaterial->GetName() << G4endl;
775   G4cout << "Phantom density: " << fPhantomMat << 816   G4cout << "Phantom density: " << fPhantomMaterial->GetDensity()/(g/cm3) 
776   G4cout << "Phantom mass: " << fPhantomLogic- << 817          << " g/cm3" << G4endl;
777                                                << 818   G4cout << "Phantom mass: " << fPhantomLogic->GetMass()/g << " g" << G4endl;        
778   G4double rotAngle = 90. * CLHEP::deg;        << 819 
779   G4RotationMatrix* PhantomRotationMatrix = ne << 820   G4double rotAngle = 90.*CLHEP::deg;
                                                   >> 821   G4RotationMatrix* PhantomRotationMatrix =
                                                   >> 822     new G4RotationMatrix(0., 0., 0.);
780   PhantomRotationMatrix->rotateX(rotAngle);       823   PhantomRotationMatrix->rotateX(rotAngle);
781                                                << 824         
782   fPhantomPhysical = new G4PVPlacement(Phantom << 825   fPhantomPhysical = new G4PVPlacement(PhantomRotationMatrix, 
783                                        fPhanto << 826                                        G4ThreeVector(0., 0., fPhantomZ),
784                                                << 827                                        fPhantomLogic,
785   // setup rotation matrix (downstream of the  << 828                                        "PhantomPhysical",
                                                   >> 829                                        fWorldLogic,
                                                   >> 830                                        false,
                                                   >> 831                                        0);
                                                   >> 832           
                                                   >> 833   //setup rotation matrix (downstream of the phantom/sample)
786   G4RotationMatrix* SetupRotationMatrix = new     834   G4RotationMatrix* SetupRotationMatrix = new G4RotationMatrix();
787   SetupRotationMatrix->rotateY(-fthetaSetup);     835   SetupRotationMatrix->rotateY(-fthetaSetup);
788                                                << 836         
789   // Slits                                     << 837   //Slits
790   G4Box* Slit1OutSolid =                       << 838   G4Box* Slit1OutSolid = new G4Box("Slit1OutSolid",
791     new G4Box("Slit1OutSolid", fSlitSize * 0.5 << 839                                    fSlitSize*0.5, 
792                                                << 840                                    fSlitSize*0.5, 
793   G4Box* Slit2OutSolid =                       << 841                                    fSlit1Thickness*0.5); 
794     new G4Box("Slit2OutSolid", fSlitSize * 0.5 << 842                                          
795                                                << 843   G4Box* Slit2OutSolid = new G4Box("Slit2OutSolid", 
796   G4Box* Slit3OutSolid =                       << 844                                    fSlitSize*0.5, 
797     new G4Box("Slit3OutSolid", fSlitSize * 0.5 << 845                                    fSlitSize*0.5,
798                                                << 846                                    fSlit2Thickness*0.5);
799   G4Box* Slit4OutSolid =                       << 847                                          
800     new G4Box("Slit4OutSolid", fSlitSize * 0.5 << 848   G4Box* Slit3OutSolid = new G4Box("Slit3OutSolid", 
801                                                << 849                                    fSlitSize*0.5,
802   G4Box* Hole1Solid =                          << 850                                    fSlitSize*0.5, 
803     new G4Box("Hole1Solid", fSlit1xAperture *  << 851                                    fSlit3Thickness*0.5);
804                                                << 852                                          
805   G4Box* Hole2Solid =                          << 853   G4Box* Slit4OutSolid = new G4Box("Slit4OutSolid", 
806     new G4Box("Hole2Solid", fSlit2xAperture *  << 854                                    fSlitSize*0.5, 
807                                                << 855                                    fSlitSize*0.5, 
808   G4Box* Hole3Solid =                          << 856                                    fSlit4Thickness*0.5); 
809     new G4Box("Hole3Solid", fSlit3xAperture *  << 857          
810                                                << 858   G4Box* Hole1Solid = new G4Box("Hole1Solid", 
811   G4Box* Hole4Solid =                          << 859                                 fSlit1xAperture*0.5, 
812     new G4Box("Hole4Solid", fSlit4xAperture *  << 860                                 fSlit1yAperture*0.5, 
813                                                << 861                                 fSlit1Thickness*0.51); 
814   G4SubtractionSolid* Slit1Solid = new G4Subtr << 862                                       
815                                                << 863   G4Box* Hole2Solid = new G4Box("Hole2Solid", 
816   G4SubtractionSolid* Slit2Solid = new G4Subtr << 864                                 fSlit2xAperture*0.5, 
817                                                << 865                                 fSlit2yAperture*0.5, 
818   G4SubtractionSolid* Slit3Solid = new G4Subtr << 866                                 fSlit2Thickness*0.51);  
819                                                << 867                                       
820   G4SubtractionSolid* Slit4Solid = new G4Subtr << 868   G4Box* Hole3Solid = new G4Box("Hole3Solid", 
821                                                << 869                                 fSlit3xAperture*0.5, 
822   fSlit1Logic = new G4LogicalVolume(Slit1Solid << 870                                 fSlit3yAperture*0.5, 
                                                   >> 871                                 fSlit3Thickness*0.51); 
                                                   >> 872                                        
                                                   >> 873   G4Box* Hole4Solid = new G4Box("Hole4Solid", 
                                                   >> 874                                 fSlit4xAperture*0.5, 
                                                   >> 875                                 fSlit4yAperture*0.5, 
                                                   >> 876                                 fSlit4Thickness*0.51); 
                                                   >> 877         
                                                   >> 878   G4SubtractionSolid* Slit1Solid = new G4SubtractionSolid("Slit1Solid", 
                                                   >> 879                                                           Slit1OutSolid, 
                                                   >> 880                                                           Hole1Solid);
                                                   >> 881                                                                 
                                                   >> 882   G4SubtractionSolid* Slit2Solid = new G4SubtractionSolid("Slit1Solid",
                                                   >> 883                                                           Slit2OutSolid,
                                                   >> 884                                                           Hole2Solid);
                                                   >> 885                                                                 
                                                   >> 886   G4SubtractionSolid* Slit3Solid = new G4SubtractionSolid("Slit3Solid",
                                                   >> 887                                                           Slit3OutSolid,
                                                   >> 888                                                           Hole3Solid);
                                                   >> 889                                                                 
                                                   >> 890   G4SubtractionSolid* Slit4Solid = new G4SubtractionSolid("Slit4Solid",
                                                   >> 891                                                           Slit4OutSolid, 
                                                   >> 892                                                           Hole4Solid);
                                                   >> 893      
                                                   >> 894   fSlit1Logic = new G4LogicalVolume(Slit1Solid, fTungsten, "Slit1Logic"); 
823   fSlit2Logic = new G4LogicalVolume(Slit2Solid    895   fSlit2Logic = new G4LogicalVolume(Slit2Solid, fTungsten, "Slit2Logic");
824   fSlit3Logic = new G4LogicalVolume(Slit3Solid    896   fSlit3Logic = new G4LogicalVolume(Slit3Solid, fTungsten, "Slit3Logic");
825   fSlit4Logic = new G4LogicalVolume(Slit4Solid    897   fSlit4Logic = new G4LogicalVolume(Slit4Solid, fTungsten, "Slit4Logic");
826                                                   898 
827   if (fIWantSlits) {                              899   if (fIWantSlits) {
828     G4cout << "Slit material: Tungsten" << G4e    900     G4cout << "Slit material: Tungsten" << G4endl;
829     G4cout << "Slit1 thickness: " << fSlit1Thi << 901     G4cout << "Slit1 thickness: " << fSlit1Thickness/mm << " mm" << G4endl;
830     G4cout << "Slit2 thickness: " << fSlit2Thi << 902     G4cout << "Slit2 thickness: " << fSlit2Thickness/mm << " mm" << G4endl;
831     G4cout << "Slit3 thickness: " << fSlit3Thi << 903     G4cout << "Slit3 thickness: " << fSlit3Thickness/mm << " mm" << G4endl;
832     G4cout << "Slit4 thickness: " << fSlit4Thi << 904     G4cout << "Slit4 thickness: " << fSlit4Thickness/mm << " mm" << G4endl;
833     G4cout << "Slit1 aperture: " << fSlit1xApe << 905     G4cout << "Slit1 aperture: " << fSlit1xAperture/mm << " x " 
834            << G4endl;                          << 906            << fSlit1yAperture/mm << " mm2" << G4endl;
835     G4cout << "Slit2 aperture: " << fSlit2xApe << 907     G4cout << "Slit2 aperture: " << fSlit2xAperture/mm << " x " 
836            << G4endl;                          << 908            << fSlit2yAperture/mm << " mm2" << G4endl;
837     G4cout << "Slit3 aperture: " << fSlit3xApe << 909     G4cout << "Slit3 aperture: " << fSlit3xAperture/mm << " x " 
838            << G4endl;                          << 910            << fSlit3yAperture/mm << " mm2" << G4endl;
839     G4cout << "Slit4 aperture: " << fSlit4xApe << 911     G4cout << "Slit4 aperture: " << fSlit4xAperture/mm << " x " 
840            << G4endl;                          << 912            << fSlit4yAperture/mm << " mm2" << G4endl;
841   }                                               913   }
842                                                << 914     
843   G4VisAttributes* SlitlVisAttribute = new G4V << 915   G4VisAttributes* SlitlVisAttribute =
                                                   >> 916     new G4VisAttributes(G4Colour(0.5, 0.5, 0.5));  
844   SlitlVisAttribute->SetForceSolid(true);         917   SlitlVisAttribute->SetForceSolid(true);
845   fSlit1Logic->SetVisAttributes(SlitlVisAttrib    918   fSlit1Logic->SetVisAttributes(SlitlVisAttribute);
846   fSlit2Logic->SetVisAttributes(SlitlVisAttrib    919   fSlit2Logic->SetVisAttributes(SlitlVisAttribute);
847   fSlit3Logic->SetVisAttributes(SlitlVisAttrib    920   fSlit3Logic->SetVisAttributes(SlitlVisAttribute);
848   fSlit4Logic->SetVisAttributes(SlitlVisAttrib    921   fSlit4Logic->SetVisAttributes(SlitlVisAttribute);
849                                                << 922         
850   G4double Slit1z = fPhantomZ - fSlit1SampleDi    923   G4double Slit1z = fPhantomZ - fSlit1SampleDistance;
851   G4ThreeVector Slit1PositionVector = G4ThreeV << 924   G4ThreeVector Slit1PositionVector = G4ThreeVector(0., 0., Slit1z); 
852                                                << 925         
853   G4double Slit2z = fPhantomZ - fSlit2SampleDi    926   G4double Slit2z = fPhantomZ - fSlit2SampleDistance;
854   G4ThreeVector Slit2PositionVector = G4ThreeV << 927   G4ThreeVector Slit2PositionVector = G4ThreeVector(0., 0., Slit2z);  
855                                                << 928             
856   G4double Slit3x = fSlit3SampleDistance * std << 929   G4double Slit3x = fSlit3SampleDistance*std::sin(fthetaSetup);
857   G4double Slit3z = fPhantomZ + fSlit3SampleDi << 930   G4double Slit3z = fPhantomZ + fSlit3SampleDistance*std::cos(fthetaSetup);
858   G4ThreeVector Slit3PositionVector = G4ThreeV << 931   G4ThreeVector Slit3PositionVector = G4ThreeVector(Slit3x, 0., Slit3z); 
859                                                << 932     
860   G4double Slit4x = fSlit4SampleDistance * std << 933   G4double Slit4x = fSlit4SampleDistance*std::sin(fthetaSetup);
861   G4double Slit4z = fPhantomZ + fSlit4SampleDi << 934   G4double Slit4z = fPhantomZ + fSlit4SampleDistance*std::cos(fthetaSetup);
862   G4ThreeVector Slit4PositionVector = G4ThreeV << 935   G4ThreeVector Slit4PositionVector = G4ThreeVector(Slit4x, 0., Slit4z);       
863                                                << 936         
864   if (fIWantSlits) {                              937   if (fIWantSlits) {
865     fSlit1Physical = new G4PVPlacement(0, Slit << 938     fSlit1Physical = new G4PVPlacement(0, 
866                                        fWorldL << 939                                        Slit1PositionVector,
867                                                << 940                                        fSlit1Logic, 
868     fSlit2Physical = new G4PVPlacement(0, Slit << 941                                        "Slit1Physical", 
869                                        fWorldL << 942                                        fWorldLogic, 
870                                                << 943                                        false, 
871     fSlit3Physical = new G4PVPlacement(SetupRo << 944                                        0);
872                                        "Slit3P << 945                                           
873                                                << 946     fSlit2Physical = new G4PVPlacement(0, 
874     fSlit4Physical = new G4PVPlacement(SetupRo << 947                                        Slit2PositionVector, 
875                                        "Slit4P << 948                                        fSlit2Logic, 
                                                   >> 949                                        "Slit2Physical", 
                                                   >> 950                                        fWorldLogic, 
                                                   >> 951                                        false, 
                                                   >> 952                                        0);
                                                   >> 953                                           
                                                   >> 954     fSlit3Physical = new G4PVPlacement(SetupRotationMatrix, 
                                                   >> 955                                        Slit3PositionVector, 
                                                   >> 956                                        fSlit3Logic, 
                                                   >> 957                                        "Slit3Physical", 
                                                   >> 958                                        fWorldLogic, 
                                                   >> 959                                        false, 
                                                   >> 960                                        0);
                                                   >> 961                                               
                                                   >> 962     fSlit4Physical = new G4PVPlacement(SetupRotationMatrix, 
                                                   >> 963                                        Slit4PositionVector, 
                                                   >> 964                                        fSlit4Logic, 
                                                   >> 965                                        "Slit4Physical", 
                                                   >> 966                                        fWorldLogic, 
                                                   >> 967                                        false, 
                                                   >> 968                                        0);
876   }                                               969   }
877                                                << 970                               
878   // Detector (with shielding)                 << 971   //Detector (with shielding)
879   G4Tubs* DetectorSolid = new G4Tubs("Detector << 972   G4Tubs* DetectorSolid = new G4Tubs("DetectorSolid", 
880                                      fDetector << 973                                      0., 
881                                                << 974                                      fDetectorSize*0.5, 
                                                   >> 975                                      fDetectorThickness*0.5, 
                                                   >> 976                                      0.*deg, 
                                                   >> 977                                      360.*deg); 
                                                   >> 978                 
882   fDetectorLogic = new G4LogicalVolume(Detecto    979   fDetectorLogic = new G4LogicalVolume(DetectorSolid, fGe, "DetectorLogic");
883                                                << 980         
884   G4VisAttributes* DetectorVisAttribute = new  << 981   G4VisAttributes* DetectorVisAttribute =
                                                   >> 982     new G4VisAttributes(G4Colour(0., 0.5, 0.));  
885   DetectorVisAttribute->SetForceSolid(true);      983   DetectorVisAttribute->SetForceSolid(true);
886   fDetectorLogic->SetVisAttributes(DetectorVis    984   fDetectorLogic->SetVisAttributes(DetectorVisAttribute);
887                                                << 985     
888   G4double Detx = fDetectorSampleDistance * st << 986   G4double Detx = fDetectorSampleDistance*std::sin(fthetaSetup);
889   G4double Detz = fPhantomZ + fDetectorSampleD << 987   G4double Detz = fPhantomZ + fDetectorSampleDistance*std::cos(fthetaSetup);
890   G4ThreeVector DetectorPositionVector = G4Thr << 988   G4ThreeVector DetectorPositionVector = G4ThreeVector(Detx, 0., Detz); 
891                                                << 989     
892   fDetectorPhysical = new G4PVPlacement(SetupR << 990   fDetectorPhysical = new G4PVPlacement(SetupRotationMatrix, 
893                                         "Detec << 991                                         DetectorPositionVector, 
894                                                << 992                                         fDetectorLogic, 
895   // Shielding                                 << 993                                         "DetectorPhysical", 
896   G4double ShieldingSize = fDetectorSize + 2 * << 994                                         fWorldLogic, 
897                                                << 995                                         false, 
                                                   >> 996                                         0); 
                                                   >> 997            
                                                   >> 998   //Shielding
                                                   >> 999   G4double ShieldingSize = fDetectorSize+2*fShieldingThickness;
                                                   >> 1000         
898   G4double margin = 2.;                           1001   G4double margin = 2.;
899   G4double ShieldingLength = fDetectorThicknes << 1002   G4double ShieldingLength = fDetectorThickness+fShieldingThickness*margin;        
900                                                << 1003         
901   G4double ShieldingSampleDistance = fDetector << 1004   G4double ShieldingSampleDistance = fDetectorSampleDistance+
902                                      + fShield << 1005     fDetectorThickness*0.5+
903                                                << 1006     fShieldingThickness-
904   G4Tubs* ShieldingSolid = new G4Tubs("Shieldi << 1007     ShieldingLength*0.5; 
905                                       Shieldin << 1008                 
906                                                << 1009   G4Tubs* ShieldingSolid = new G4Tubs("ShieldingSolid", 
907   fShieldingLogic = new G4LogicalVolume(Shield << 1010                                       fDetectorSize*0.5, 
908                                                << 1011                                       ShieldingSize*0.5, 
                                                   >> 1012                                       ShieldingLength*0.5, 
                                                   >> 1013                                       0.*deg, 
                                                   >> 1014                                       360.*deg); 
                                                   >> 1015                 
                                                   >> 1016   fShieldingLogic = new G4LogicalVolume(ShieldingSolid, 
                                                   >> 1017                                         fLead, 
                                                   >> 1018                                         "ShieldingLogic");
                                                   >> 1019         
909   G4cout << "Shielding material: Lead" << G4en    1020   G4cout << "Shielding material: Lead" << G4endl;
910   G4cout << "Shielding thickness: " << fShield << 1021   G4cout << "Shielding thickness: " << fShieldingThickness/mm 
911                                                << 1022          << " mm" << G4endl;
912   G4VisAttributes* ShieldingVisAttribute = new << 1023         
                                                   >> 1024   G4VisAttributes* ShieldingVisAttribute =
                                                   >> 1025     new G4VisAttributes(G4Colour(0.3, 0.3, 0.3));  
913   ShieldingVisAttribute->SetForceSolid(true);     1026   ShieldingVisAttribute->SetForceSolid(true);
914   fShieldingLogic->SetVisAttributes(ShieldingV    1027   fShieldingLogic->SetVisAttributes(ShieldingVisAttribute);
915                                                << 1028         
916   G4double Shieldx = ShieldingSampleDistance * << 1029   G4double Shieldx = ShieldingSampleDistance*std::sin(fthetaSetup);
917   G4double Shieldz = fPhantomZ + ShieldingSamp << 1030   G4double Shieldz = fPhantomZ +
918   G4ThreeVector ShieldingPositionVector = G4Th << 1031     ShieldingSampleDistance*std::cos(fthetaSetup);
919                                                << 1032   G4ThreeVector ShieldingPositionVector =
920   G4double ShieldingBackSampleDistance =       << 1033     G4ThreeVector(Shieldx, 0., Shieldz); 
921     fDetectorSampleDistance + fDetectorThickne << 1034    
922                                                << 1035   G4double ShieldingBackSampleDistance = fDetectorSampleDistance+
923   G4Tubs* ShieldingBackSolid = new G4Tubs("Shi << 1036     fDetectorThickness*0.5+
924                                           fShi << 1037     fShieldingThickness*0.5;
925                                                << 1038     
926   fShieldingBackLogic = new G4LogicalVolume(Sh << 1039   G4Tubs* ShieldingBackSolid = new G4Tubs("ShieldingBackSolid", 
927                                                << 1040                                           0., 
                                                   >> 1041                                           fDetectorSize*0.5, 
                                                   >> 1042                                           fShieldingThickness*0.5, 
                                                   >> 1043                                           0.*deg, 
                                                   >> 1044                                           360.*deg); 
                                                   >> 1045                                             
                                                   >> 1046   fShieldingBackLogic = new G4LogicalVolume(ShieldingBackSolid, 
                                                   >> 1047                                             fLead, 
                                                   >> 1048                                             "ShieldingBackLogic");
                                                   >> 1049     
928   fShieldingBackLogic->SetVisAttributes(Shield    1050   fShieldingBackLogic->SetVisAttributes(ShieldingVisAttribute);
929                                                << 1051    
930   G4double ShieldBackx = ShieldingBackSampleDi << 1052   G4double ShieldBackx = ShieldingBackSampleDistance*std::sin(fthetaSetup);
931   G4double ShieldBackz = fPhantomZ + Shielding << 1053   G4double ShieldBackz = fPhantomZ +
932   G4ThreeVector ShieldingBackPositionVector =  << 1054     ShieldingBackSampleDistance*std::cos(fthetaSetup);
933                                                << 1055   G4ThreeVector ShieldingBackPositionVector = 
934   fShieldingPhysical =                         << 1056     G4ThreeVector(ShieldBackx, 0., ShieldBackz);
935     new G4PVPlacement(SetupRotationMatrix, Shi << 1057          
936                       "ShieldingPhysical", fWo << 1058   fShieldingPhysical = new G4PVPlacement(SetupRotationMatrix, 
937                                                << 1059                                          ShieldingPositionVector, 
938   fShieldingBackPhysical =                     << 1060                                          fShieldingLogic, 
939     new G4PVPlacement(SetupRotationMatrix, Shi << 1061                                          "ShieldingPhysical", 
940                       "ShieldingBackPhysical", << 1062                                          fWorldLogic, 
                                                   >> 1063                                          false, 
                                                   >> 1064                                          0);
                                                   >> 1065                                               
                                                   >> 1066   fShieldingBackPhysical = new G4PVPlacement(SetupRotationMatrix, 
                                                   >> 1067                                              ShieldingBackPositionVector, 
                                                   >> 1068                                              fShieldingBackLogic, 
                                                   >> 1069                                              "ShieldingBackPhysical", 
                                                   >> 1070                                              fWorldLogic, 
                                                   >> 1071                                              false, 
                                                   >> 1072                                              0);
941                                                   1073 
942   return fWorldPhysical;                          1074   return fWorldPhysical;
                                                   >> 1075 
943 }                                                 1076 }
944                                                   1077 
945 //....oooOO0OOooo........oooOO0OOooo........oo    1078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
946                                                   1079 
947 void SAXSDetectorConstruction::ConstructSDandF    1080 void SAXSDetectorConstruction::ConstructSDandField()
948 {                                                 1081 {
949   // Sensitive Volume                          << 1082   //Sensitive Volume
950   G4VSensitiveDetector* vDetector = new SAXSSe    1083   G4VSensitiveDetector* vDetector = new SAXSSensitiveDetector("det");
951   G4SDManager::GetSDMpointer()->AddNewDetector << 1084   G4SDManager::GetSDMpointer()->AddNewDetector(vDetector); 
952   fSensitiveVolume = fDetectorLogic;           << 1085   fSensitiveVolume = fDetectorLogic;                               
953   fSensitiveVolume->SetSensitiveDetector(vDete    1086   fSensitiveVolume->SetSensitiveDetector(vDetector);
954 }                                                 1087 }
955                                                   1088 
956 //....oooOO0OOooo........oooOO0OOooo........oo    1089 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
957                                                   1090