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 ] [ 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/field/field04/src/F04Trajectory.cc (Version 11.3.0) and /examples/extended/field/field04/src/F04Trajectory.cc (Version 5.0.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 /// \file field/field04/src/F04Trajectory.cc      
 28 /// \brief Implementation of the F04Trajectory    
 29 //                                                
 30                                                   
 31 #include "F04Trajectory.hh"                       
 32                                                   
 33 #include "F04TrajectoryPoint.hh"                  
 34                                                   
 35 #include "G4AttDef.hh"                            
 36 #include "G4AttDefStore.hh"                       
 37 #include "G4AttValue.hh"                          
 38 #include "G4ParticleTable.hh"                     
 39 #include "G4UIcommand.hh"                         
 40 #include "G4UnitsTable.hh"                        
 41                                                   
 42 // #define G4ATTDEBUG                             
 43 #ifdef G4ATTDEBUG                                 
 44 #  include "G4AttCheck.hh"                        
 45 #endif                                            
 46                                                   
 47 G4ThreadLocal G4Allocator<F04Trajectory>* F04T    
 48                                                   
 49 //....oooOO0OOooo........oooOO0OOooo........oo    
 50                                                   
 51 F04Trajectory::F04Trajectory() {}                 
 52                                                   
 53 //....oooOO0OOooo........oooOO0OOooo........oo    
 54                                                   
 55 F04Trajectory::F04Trajectory(const G4Track* aT    
 56 {                                                 
 57   G4ParticleDefinition* particleDefinition = a    
 58   fParticleName = particleDefinition->GetParti    
 59   fPDGCharge = particleDefinition->GetPDGCharg    
 60   fPDGEncoding = particleDefinition->GetPDGEnc    
 61   fTrackID = aTrack->GetTrackID();                
 62   fParentID = aTrack->GetParentID();              
 63   fInitialMomentum = aTrack->GetMomentum();       
 64   fpPointsContainer = new TrajectoryPointConta    
 65   // Following is for the first trajectory poi    
 66   fpPointsContainer->push_back(new F04Trajecto    
 67 }                                                 
 68                                                   
 69 //....oooOO0OOooo........oooOO0OOooo........oo    
 70                                                   
 71 F04Trajectory::F04Trajectory(F04Trajectory& ri    
 72 {                                                 
 73   fParticleName = right.fParticleName;            
 74   fPDGCharge = right.fPDGCharge;                  
 75   fPDGEncoding = right.fPDGEncoding;              
 76   fTrackID = right.fTrackID;                      
 77   fParentID = right.fParentID;                    
 78   fInitialMomentum = right.fInitialMomentum;      
 79   fpPointsContainer = new TrajectoryPointConta    
 80                                                   
 81   for (size_t i = 0; i < right.fpPointsContain    
 82     auto rightPoint = (F04TrajectoryPoint*)((*    
 83     fpPointsContainer->push_back(new F04Trajec    
 84   }                                               
 85 }                                                 
 86                                                   
 87 //....oooOO0OOooo........oooOO0OOooo........oo    
 88                                                   
 89 F04Trajectory::~F04Trajectory()                   
 90 {                                                 
 91   for (size_t i = 0; i < fpPointsContainer->si    
 92     delete (*fpPointsContainer)[i];               
 93   }                                               
 94   fpPointsContainer->clear();                     
 95                                                   
 96   delete fpPointsContainer;                       
 97 }                                                 
 98                                                   
 99 //....oooOO0OOooo........oooOO0OOooo........oo    
100                                                   
101 void F04Trajectory::ShowTrajectory(std::ostrea    
102 {                                                 
103   // Invoke the default implementation in G4VT    
104   G4VTrajectory::ShowTrajectory(os);              
105   // ... or override with your own code here.     
106 }                                                 
107                                                   
108 //....oooOO0OOooo........oooOO0OOooo........oo    
109                                                   
110 void F04Trajectory::AppendStep(const G4Step* a    
111 {                                                 
112   fpPointsContainer->push_back(new F04Trajecto    
113 }                                                 
114                                                   
115 //....oooOO0OOooo........oooOO0OOooo........oo    
116                                                   
117 G4ParticleDefinition* F04Trajectory::GetPartic    
118 {                                                 
119   return (G4ParticleTable::GetParticleTable()-    
120 }                                                 
121                                                   
122 //....oooOO0OOooo........oooOO0OOooo........oo    
123                                                   
124 void F04Trajectory::MergeTrajectory(G4VTraject    
125 {                                                 
126   if (!secondTrajectory) return;                  
127                                                   
128   auto second = (F04Trajectory*)secondTrajecto    
129   G4int ent = second->GetPointEntries();          
130   // initial point of the second trajectory sh    
131   for (G4int i = 1; i < ent; ++i) {               
132     fpPointsContainer->push_back((*(second->fp    
133   }                                               
134   delete (*second->fpPointsContainer)[0];         
135   second->fpPointsContainer->clear();             
136 }                                                 
137                                                   
138 //....oooOO0OOooo........oooOO0OOooo........oo    
139                                                   
140 const std::map<G4String, G4AttDef>* F04Traject    
141 {                                                 
142   G4bool isNew;                                   
143   std::map<G4String, G4AttDef>* store = G4AttD    
144                                                   
145   if (isNew) {                                    
146     G4String ID("ID");                            
147     (*store)[ID] = G4AttDef(ID, "Track ID", "B    
148                                                   
149     G4String PID("PID");                          
150     (*store)[PID] = G4AttDef(PID, "Parent ID",    
151                                                   
152     G4String PN("PN");                            
153     (*store)[PN] = G4AttDef(PN, "Particle Name    
154                                                   
155     G4String Ch("Ch");                            
156     (*store)[Ch] = G4AttDef(Ch, "Charge", "Phy    
157                                                   
158     G4String PDG("PDG");                          
159     (*store)[PDG] = G4AttDef(PDG, "PDG Encodin    
160                                                   
161     G4String IMom("IMom");                        
162     (*store)[IMom] = G4AttDef(IMom, "Momentum     
163                               "G4BestUnit", "G    
164                                                   
165     G4String IMag("IMag");                        
166     (*store)[IMag] = G4AttDef(IMag, "Magnitude    
167                               "Physics", "G4Be    
168                                                   
169     G4String NTP("NTP");                          
170     (*store)[NTP] = G4AttDef(NTP, "No. of poin    
171   }                                               
172   return store;                                   
173 }                                                 
174                                                   
175 //....oooOO0OOooo........oooOO0OOooo........oo    
176                                                   
177 std::vector<G4AttValue>* F04Trajectory::Create    
178 {                                                 
179   auto values = new std::vector<G4AttValue>;      
180                                                   
181   values->push_back(G4AttValue("ID", G4UIcomma    
182                                                   
183   values->push_back(G4AttValue("PID", G4UIcomm    
184                                                   
185   values->push_back(G4AttValue("PN", fParticle    
186                                                   
187   values->push_back(G4AttValue("Ch", G4UIcomma    
188                                                   
189   values->push_back(G4AttValue("PDG", G4UIcomm    
190                                                   
191   values->push_back(G4AttValue("IMom", G4BestU    
192                                                   
193   values->push_back(G4AttValue("IMag", G4BestU    
194                                                   
195   values->push_back(G4AttValue("NTP", G4UIcomm    
196                                                   
197 #ifdef G4ATTDEBUG                                 
198   G4cout << G4AttCheck(values, GetAttDefs());     
199 #endif                                            
200   return values;                                  
201 }                                                 
202