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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 /tracking/src/G4ClonedRichTrajectory.cc (Version 11.3.0) and /tracking/src/G4ClonedRichTrajectory.cc (Version 10.5.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 // G4ClonedRichTrajectory class implementation    
 27 //                                                
 28 // Makoto Asai (JLab) - Oct.2024                  
 29 // -------------------------------------------    
 30                                                   
 31 #include "G4ClonedRichTrajectory.hh"              
 32 #include "G4RichTrajectory.hh"                    
 33                                                   
 34 #include "G4ParticleTable.hh"                     
 35 #include "G4AttDef.hh"                            
 36 #include "G4AttDefStore.hh"                       
 37 #include "G4AttValue.hh"                          
 38 #include "G4PhysicsModelCatalog.hh"               
 39 #include "G4ClonedRichTrajectoryPoint.hh"         
 40 #include "G4UIcommand.hh"                         
 41 #include "G4UnitsTable.hh"                        
 42 #include "G4VProcess.hh"                          
 43                                                   
 44 // #define G4ATTDEBUG                             
 45 #ifdef G4ATTDEBUG                                 
 46 #  include "G4AttCheck.hh"                        
 47 #endif                                            
 48                                                   
 49 #include <sstream>                                
 50                                                   
 51 G4Allocator<G4ClonedRichTrajectory>*& aClonedR    
 52 {                                                 
 53   static G4Allocator<G4ClonedRichTrajectory>*     
 54   return _instance;                               
 55 }                                                 
 56                                                   
 57 G4ClonedRichTrajectory::G4ClonedRichTrajectory    
 58 {                                                 
 59   ParticleName = right.ParticleName;              
 60   PDGCharge = right.PDGCharge;                    
 61   PDGEncoding = right.PDGEncoding;                
 62   fTrackID = right.fTrackID;                      
 63   fParentID = right.fParentID;                    
 64   initialKineticEnergy = right.initialKineticE    
 65   initialMomentum = right.initialMomentum;        
 66   //positionRecord = new G4ClonedTrajectoryPoi    
 67   //for (auto& i : *right.positionRecord) {       
 68   //  auto rightPoint = (G4ClonedTrajectoryPoi    
 69   //  positionRecord->push_back(new G4ClonedTr    
 70   //}                                             
 71   fpInitialVolume = right.fpInitialVolume;        
 72   fpInitialNextVolume = right.fpInitialNextVol    
 73   fpCreatorProcess = right.fpCreatorProcess;      
 74   fCreatorModelID = right.fCreatorModelID;        
 75   fpFinalVolume = right.fpFinalVolume;            
 76   fpFinalNextVolume = right.fpFinalNextVolume;    
 77   fpEndingProcess = right.fpEndingProcess;        
 78   fFinalKineticEnergy = right.fFinalKineticEne    
 79   if(right.fpRichPointContainer!=nullptr && ri    
 80   {                                               
 81     fpRichPointContainer = new G4TrajectoryPoi    
 82     for (auto& i : *right.fpRichPointContainer    
 83       auto rightPoint = (G4RichTrajectoryPoint    
 84       fpRichPointContainer->push_back(new G4Cl    
 85     }                                             
 86   }                                               
 87 }                                                 
 88                                                   
 89 G4ClonedRichTrajectory::~G4ClonedRichTrajector    
 90 {                                                 
 91   if (fpRichPointContainer != nullptr) {          
 92     for (auto& i : *fpRichPointContainer) {       
 93       delete i;                                   
 94     }                                             
 95     fpRichPointContainer->clear();                
 96     delete fpRichPointContainer;                  
 97   }                                               
 98 }                                                 
 99                                                   
100 void G4ClonedRichTrajectory::AppendStep(const     
101 {                                                 
102   fpRichPointContainer->push_back(new G4Cloned    
103                                                   
104   // Except for first step, which is a sort of    
105   // the track, compute the final values...       
106   //                                              
107   const G4Track* track = aStep->GetTrack();       
108   const G4StepPoint* postStepPoint = aStep->Ge    
109   if (track->GetCurrentStepNumber() > 0) {        
110     fpFinalVolume = track->GetTouchableHandle(    
111     fpFinalNextVolume = track->GetNextTouchabl    
112     fpEndingProcess = postStepPoint->GetProces    
113     fFinalKineticEnergy =                         
114       aStep->GetPreStepPoint()->GetKineticEner    
115   }                                               
116 }                                                 
117                                                   
118 void G4ClonedRichTrajectory::MergeTrajectory(G    
119 {                                                 
120   if (secondTrajectory == nullptr) return;        
121                                                   
122   auto seco = (G4ClonedRichTrajectory*)secondT    
123   G4int ent = seco->GetPointEntries();            
124   for (G4int i = 1; i < ent; ++i) {               
125     // initial point of the second trajectory     
126     //                                            
127     fpRichPointContainer->push_back((*(seco->f    
128   }                                               
129   delete (*seco->fpRichPointContainer)[0];        
130   seco->fpRichPointContainer->clear();            
131 }                                                 
132                                                   
133 void G4ClonedRichTrajectory::ShowTrajectory(st    
134 {                                                 
135   // Invoke the default implementation in G4VT    
136   //                                              
137   G4VTrajectory::ShowTrajectory(os);              
138                                                   
139   // ... or override with your own code here.     
140 }                                                 
141                                                   
142 void G4ClonedRichTrajectory::DrawTrajectory()     
143 {                                                 
144   // Invoke the default implementation in G4VT    
145   //                                              
146   G4VTrajectory::DrawTrajectory();                
147                                                   
148   // ... or override with your own code here.     
149 }                                                 
150                                                   
151 const std::map<G4String, G4AttDef>* G4ClonedRi    
152 {                                                 
153   G4bool isNew;                                   
154   std::map<G4String, G4AttDef>* store = G4AttD    
155   if (isNew) {                                    
156     G4String ID;                                  
157                                                   
158     ID = "ID";                                    
159     (*store)[ID] = G4AttDef(ID, "Track ID", "P    
160                                                   
161     ID = "PID";                                   
162     (*store)[ID] = G4AttDef(ID, "Parent ID", "    
163                                                   
164     ID = "PN";                                    
165     (*store)[ID] = G4AttDef(ID, "Particle Name    
166                                                   
167     ID = "Ch";                                    
168     (*store)[ID] = G4AttDef(ID, "Charge", "Phy    
169                                                   
170     ID = "PDG";                                   
171     (*store)[ID] = G4AttDef(ID, "PDG Encoding"    
172                                                   
173     ID = "IKE";                                   
174     (*store)[ID] = G4AttDef(ID, "Initial kinet    
175                                                   
176     ID = "IMom";                                  
177     (*store)[ID] = G4AttDef(ID, "Initial momen    
178                                                   
179     ID = "IMag";                                  
180     (*store)[ID] = G4AttDef(ID, "Initial momen    
181                                                   
182     ID = "NTP";                                   
183     (*store)[ID] = G4AttDef(ID, "No. of points    
184                                                   
185     ID = "IVPath";                                
186     (*store)[ID] = G4AttDef(ID, "Initial Volum    
187                                                   
188     ID = "INVPath";                               
189     (*store)[ID] = G4AttDef(ID, "Initial Next     
190                                                   
191     ID = "CPN";                                   
192     (*store)[ID] = G4AttDef(ID, "Creator Proce    
193                                                   
194     ID = "CPTN";                                  
195     (*store)[ID] = G4AttDef(ID, "Creator Proce    
196                                                   
197     ID = "CMID";                                  
198     (*store)[ID] = G4AttDef(ID, "Creator Model    
199                                                   
200     ID = "CMN";                                   
201     (*store)[ID] = G4AttDef(ID, "Creator Model    
202                                                   
203     ID = "FVPath";                                
204     (*store)[ID] = G4AttDef(ID, "Final Volume     
205                                                   
206     ID = "FNVPath";                               
207     (*store)[ID] = G4AttDef(ID, "Final Next Vo    
208                                                   
209     ID = "EPN";                                   
210     (*store)[ID] = G4AttDef(ID, "Ending Proces    
211                                                   
212     ID = "EPTN";                                  
213     (*store)[ID] = G4AttDef(ID, "Ending Proces    
214                                                   
215     ID = "FKE";                                   
216     (*store)[ID] = G4AttDef(ID, "Final kinetic    
217   }                                               
218                                                   
219   return store;                                   
220 }                                                 
221                                                   
222 static G4String Path(const G4TouchableHandle&     
223 {                                                 
224   std::ostringstream oss;                         
225   G4int depth = th->GetHistoryDepth();            
226   for (G4int i = depth; i >= 0; --i) {            
227     oss << th->GetVolume(i)->GetName() << ':'     
228     if (i != 0) oss << '/';                       
229   }                                               
230   return oss.str();                               
231 }                                                 
232                                                   
233 std::vector<G4AttValue>* G4ClonedRichTrajector    
234 {                                                 
235   // Create base class att values...              
236   //std::vector<G4AttValue>* values = G4VTraje    
237   auto values = new std::vector<G4AttValue>;      
238   values->push_back(G4AttValue("ID", G4UIcomma    
239   values->push_back(G4AttValue("PID", G4UIcomm    
240   values->push_back(G4AttValue("PN", ParticleN    
241   values->push_back(G4AttValue("Ch", G4UIcomma    
242   values->push_back(G4AttValue("PDG", G4UIcomm    
243   values->push_back(G4AttValue("IKE", G4BestUn    
244   values->push_back(G4AttValue("IMom", G4BestU    
245   values->push_back(G4AttValue("IMag", G4BestU    
246   values->push_back(G4AttValue("NTP", G4UIcomm    
247                                                   
248   if (fpInitialVolume && (fpInitialVolume->Get    
249     values->push_back(G4AttValue("IVPath", Pat    
250   }                                               
251   else {                                          
252     values->push_back(G4AttValue("IVPath", "No    
253   }                                               
254                                                   
255   if (fpInitialNextVolume && (fpInitialNextVol    
256     values->push_back(G4AttValue("INVPath", Pa    
257   }                                               
258   else {                                          
259     values->push_back(G4AttValue("INVPath", "N    
260   }                                               
261                                                   
262   if (fpCreatorProcess != nullptr) {              
263     values->push_back(G4AttValue("CPN", fpCrea    
264     G4ProcessType type = fpCreatorProcess->Get    
265     values->push_back(G4AttValue("CPTN", G4VPr    
266     values->push_back(G4AttValue("CMID", G4UIc    
267     const G4String& creatorModelName = G4Physi    
268     values->push_back(G4AttValue("CMN", creato    
269   }                                               
270   else {                                          
271     values->push_back(G4AttValue("CPN", "None"    
272     values->push_back(G4AttValue("CPTN", "None    
273     values->push_back(G4AttValue("CMID", "None    
274     values->push_back(G4AttValue("CMN", "None"    
275   }                                               
276                                                   
277   if (fpFinalVolume && (fpFinalVolume->GetVolu    
278     values->push_back(G4AttValue("FVPath", Pat    
279   }                                               
280   else {                                          
281     values->push_back(G4AttValue("FVPath", "No    
282   }                                               
283                                                   
284   if (fpFinalNextVolume && (fpFinalNextVolume-    
285     values->push_back(G4AttValue("FNVPath", Pa    
286   }                                               
287   else {                                          
288     values->push_back(G4AttValue("FNVPath", "N    
289   }                                               
290                                                   
291   if (fpEndingProcess != nullptr) {               
292     values->push_back(G4AttValue("EPN", fpEndi    
293     G4ProcessType type = fpEndingProcess->GetP    
294     values->push_back(G4AttValue("EPTN", G4VPr    
295   }                                               
296   else {                                          
297     values->push_back(G4AttValue("EPN", "None"    
298     values->push_back(G4AttValue("EPTN", "None    
299   }                                               
300                                                   
301   values->push_back(G4AttValue("FKE", G4BestUn    
302                                                   
303 #ifdef G4ATTDEBUG                                 
304   G4cout << G4AttCheck(values, GetAttDefs());     
305 #endif                                            
306                                                   
307   return values;                                  
308 }                                                 
309                                                   
310 G4ParticleDefinition* G4ClonedRichTrajectory::    
311 {                                                 
312   return (G4ParticleTable::GetParticleTable()-    
313 }                                                 
314                                                   
315                                                   
316