Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4SmoothTrajectoryPoint class implementatio << 27 // 23 // 28 // Contact: << 24 // $Id: G4SmoothTrajectoryPoint.cc,v 1.10 2003/06/16 17:13:18 gunter Exp $ 29 // Questions and comments to this code shoul << 25 // GEANT4 tag $Name: geant4-06-00 $ 30 // Katsuya Amako (e-mail: Katsuya.Amako@k << 26 // 31 // Makoto Asai (e-mail: asai@slac.stanf << 27 // 32 // Takashi Sasaki (e-mail: Takashi.Sasaki@ << 28 // --------------------------------------------------------------- 33 // ------------------------------------------- << 29 // >> 30 // G4SmoothTrajectoryPoint.cc >> 31 // >> 32 // --------------------------------------------------------------- 34 33 35 #include "G4SmoothTrajectoryPoint.hh" 34 #include "G4SmoothTrajectoryPoint.hh" 36 35 37 #include "G4AttDef.hh" << 38 #include "G4AttDefStore.hh" 36 #include "G4AttDefStore.hh" >> 37 #include "G4AttDef.hh" 39 #include "G4AttValue.hh" 38 #include "G4AttValue.hh" 40 #include "G4UnitsTable.hh" 39 #include "G4UnitsTable.hh" >> 40 #include <strstream> 41 41 42 // #define G4ATTDEBUG << 42 G4Allocator<G4SmoothTrajectoryPoint> aSmoothTrajectoryPointAllocator; 43 #ifdef G4ATTDEBUG << 44 # include "G4AttCheck.hh" << 45 #endif << 46 43 47 G4Allocator<G4SmoothTrajectoryPoint>*& aSmooth << 44 G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint() >> 45 : fAuxiliaryPointVector(0) 48 { 46 { 49 G4ThreadLocalStatic G4Allocator<G4SmoothTraj << 47 fPosition = G4ThreeVector(0.,0.,0.); 50 return _instance; << 51 } 48 } 52 49 53 G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoi << 50 G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(G4ThreeVector pos) >> 51 : fAuxiliaryPointVector(0) >> 52 { >> 53 fPosition = pos; >> 54 } 54 55 55 G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoi << 56 G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(G4ThreeVector pos, 56 G4ThreeVector pos, std::vector<G4ThreeVector << 57 std::vector<G4ThreeVector>* auxiliaryPoints) 57 : fPosition(pos), fAuxiliaryPointVector(auxi << 58 : fPosition(pos), >> 59 fAuxiliaryPointVector(auxiliaryPoints) 58 {} 60 {} 59 61 60 G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoi << 62 G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(const G4SmoothTrajectoryPoint &right) 61 : fPosition(right.fPosition), fAuxiliaryPoin << 63 : G4VTrajectoryPoint(), 62 {} << 64 fPosition(right.fPosition),fAuxiliaryPointVector(right.fAuxiliaryPointVector) >> 65 { >> 66 } >> 67 >> 68 G4SmoothTrajectoryPoint::~G4SmoothTrajectoryPoint() >> 69 { >> 70 if(fAuxiliaryPointVector) { >> 71 delete fAuxiliaryPointVector; >> 72 } >> 73 } 63 74 64 G4SmoothTrajectoryPoint::~G4SmoothTrajectoryPo << 65 75 66 const std::map<G4String, G4AttDef>* G4SmoothTr << 76 const std::map<G4String,G4AttDef>* >> 77 G4SmoothTrajectoryPoint::GetAttDefs() const 67 { 78 { 68 G4bool isNew; 79 G4bool isNew; 69 std::map<G4String, G4AttDef>* store = << 80 std::map<G4String,G4AttDef>* store 70 G4AttDefStore::GetInstance("G4SmoothTrajec << 81 = G4AttDefStore::GetInstance("G4SmoothTrajectoryPoint",isNew); 71 if (isNew) { 82 if (isNew) { 72 G4String Pos("Pos"); 83 G4String Pos("Pos"); 73 (*store)[Pos] = G4AttDef(Pos, "Step Positi << 84 (*store)[Pos] = G4AttDef(Pos, "Step Position", >> 85 "Physics","","G4ThreeVector"); 74 G4String Aux("Aux"); 86 G4String Aux("Aux"); 75 (*store)[Aux] = << 87 (*store)[Aux] = G4AttDef(Aux, "Auxiliary Point Position", 76 G4AttDef(Aux, "Auxiliary Point Position" << 88 "Physics","","G4ThreeVector"); 77 } 89 } 78 return store; 90 return store; 79 } 91 } 80 92 81 std::vector<G4AttValue>* G4SmoothTrajectoryPoi 93 std::vector<G4AttValue>* G4SmoothTrajectoryPoint::CreateAttValues() const 82 { 94 { 83 auto values = new std::vector<G4AttValue>; << 95 char c[100]; >> 96 std::ostrstream s(c,100); 84 97 85 if (fAuxiliaryPointVector != nullptr) { << 98 std::vector<G4AttValue>* values = new std::vector<G4AttValue>; 86 for (const auto& iAux : *fAuxiliaryPointVe << 99 87 values->push_back(G4AttValue("Aux", G4Be << 100 if (fAuxiliaryPointVector) { >> 101 std::vector<G4ThreeVector>::iterator iAux; >> 102 for (iAux = fAuxiliaryPointVector->begin(); >> 103 iAux != fAuxiliaryPointVector->end(); ++iAux) { >> 104 s.seekp(std::ios::beg); >> 105 s << G4BestUnit(*iAux,"Length") << std::ends; >> 106 values->push_back(G4AttValue("Aux",c,"")); 88 } 107 } 89 } 108 } 90 109 91 values->push_back(G4AttValue("Pos", G4BestUn << 110 s.seekp(std::ios::beg); 92 << 111 s << G4BestUnit(fPosition,"Length") << std::ends; 93 #ifdef G4ATTDEBUG << 112 values->push_back(G4AttValue("Pos",c,"")); 94 G4cout << G4AttCheck(values, GetAttDefs()); << 95 #endif << 96 113 97 return values; 114 return values; 98 } 115 } 99 116