00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #include "G4RichTrajectoryPoint.hh"
00047
00048 #include "G4Track.hh"
00049 #include "G4Step.hh"
00050 #include "G4VProcess.hh"
00051
00052 #include "G4AttDefStore.hh"
00053 #include "G4AttDef.hh"
00054 #include "G4AttValue.hh"
00055 #include "G4UnitsTable.hh"
00056
00057
00058 #ifdef G4ATTDEBUG
00059 #include "G4AttCheck.hh"
00060 #endif
00061
00062 #include <sstream>
00063
00064 G4Allocator<G4RichTrajectoryPoint> aRichTrajectoryPointAllocator;
00065
00066 G4RichTrajectoryPoint::G4RichTrajectoryPoint():
00067 fpAuxiliaryPointVector(0),
00068 fTotEDep(0.),
00069 fRemainingEnergy(0.),
00070 fpProcess(0),
00071 fPreStepPointStatus(fUndefined),
00072 fPostStepPointStatus(fUndefined),
00073 fPreStepPointGlobalTime(0),
00074 fPostStepPointGlobalTime(0),
00075 fPreStepPointWeight(1.),
00076 fPostStepPointWeight(1.)
00077 {}
00078
00079 G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Track* aTrack):
00080 G4TrajectoryPoint(aTrack->GetPosition()),
00081 fpAuxiliaryPointVector(0),
00082 fTotEDep(0.),
00083 fRemainingEnergy(aTrack->GetKineticEnergy()),
00084 fpProcess(0),
00085 fPreStepPointStatus(fUndefined),
00086 fPostStepPointStatus(fUndefined),
00087 fPreStepPointGlobalTime(aTrack->GetGlobalTime()),
00088 fPostStepPointGlobalTime(aTrack->GetGlobalTime()),
00089 fpPreStepPointVolume(aTrack->GetTouchableHandle()),
00090 fpPostStepPointVolume(aTrack->GetNextTouchableHandle()),
00091 fPreStepPointWeight(aTrack->GetWeight()),
00092 fPostStepPointWeight(aTrack->GetWeight())
00093 {}
00094
00095 G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep):
00096 G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()),
00097 fpAuxiliaryPointVector(aStep->GetPointerToVectorOfAuxiliaryPoints()),
00098 fTotEDep(aStep->GetTotalEnergyDeposit())
00099 {
00100 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
00101 G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
00102 if (aStep->GetTrack()->GetCurrentStepNumber() <= 0) {
00103 fRemainingEnergy = aStep->GetTrack()->GetKineticEnergy();
00104 } else {
00105 fRemainingEnergy = preStepPoint->GetKineticEnergy() - fTotEDep;
00106 }
00107 fpProcess = postStepPoint->GetProcessDefinedStep();
00108 fPreStepPointStatus = preStepPoint->GetStepStatus();
00109 fPostStepPointStatus = postStepPoint->GetStepStatus();
00110 fPreStepPointGlobalTime = preStepPoint->GetGlobalTime();
00111 fPostStepPointGlobalTime = postStepPoint->GetGlobalTime();
00112 fpPreStepPointVolume = preStepPoint->GetTouchableHandle();
00113 fpPostStepPointVolume = postStepPoint->GetTouchableHandle();
00114 fPreStepPointWeight = preStepPoint->GetWeight();
00115 fPostStepPointWeight = postStepPoint->GetWeight();
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 }
00144
00145 G4RichTrajectoryPoint::G4RichTrajectoryPoint
00146 (const G4RichTrajectoryPoint &right):
00147 G4TrajectoryPoint(right),
00148 fpAuxiliaryPointVector(right.fpAuxiliaryPointVector),
00149 fTotEDep(right.fTotEDep),
00150 fRemainingEnergy(right.fRemainingEnergy),
00151 fpProcess(right.fpProcess),
00152 fPreStepPointStatus(right.fPreStepPointStatus),
00153 fPostStepPointStatus(right.fPostStepPointStatus),
00154 fPreStepPointGlobalTime(right.fPreStepPointGlobalTime),
00155 fPostStepPointGlobalTime(right.fPostStepPointGlobalTime),
00156 fpPreStepPointVolume(right.fpPreStepPointVolume),
00157 fpPostStepPointVolume(right.fpPostStepPointVolume),
00158 fPreStepPointWeight(right.fPreStepPointWeight),
00159 fPostStepPointWeight(right.fPostStepPointWeight)
00160 {}
00161
00162 G4RichTrajectoryPoint::~G4RichTrajectoryPoint()
00163 {
00164 if(fpAuxiliaryPointVector) {
00165
00166
00167
00168
00169
00170 delete fpAuxiliaryPointVector;
00171 }
00172 }
00173
00174 const std::map<G4String,G4AttDef>*
00175 G4RichTrajectoryPoint::GetAttDefs() const
00176 {
00177 G4bool isNew;
00178 std::map<G4String,G4AttDef>* store
00179 = G4AttDefStore::GetInstance("G4RichTrajectoryPoint",isNew);
00180 if (isNew) {
00181
00182
00183 *store = *(G4TrajectoryPoint::GetAttDefs());
00184
00185 G4String ID;
00186
00187 ID = "Aux";
00188 (*store)[ID] = G4AttDef(ID, "Auxiliary Point Position",
00189 "Physics","G4BestUnit","G4ThreeVector");
00190 ID = "TED";
00191 (*store)[ID] = G4AttDef(ID,"Total Energy Deposit",
00192 "Physics","G4BestUnit","G4double");
00193 ID = "RE";
00194 (*store)[ID] = G4AttDef(ID,"Remaining Energy",
00195 "Physics","G4BestUnit","G4double");
00196 ID = "PDS";
00197 (*store)[ID] = G4AttDef(ID,"Process Defined Step",
00198 "Physics","","G4String");
00199 ID = "PTDS";
00200 (*store)[ID] = G4AttDef(ID,"Process Type Defined Step",
00201 "Physics","","G4String");
00202 ID = "PreStatus";
00203 (*store)[ID] = G4AttDef(ID,"Pre-step-point status",
00204 "Physics","","G4String");
00205 ID = "PostStatus";
00206 (*store)[ID] = G4AttDef(ID,"Post-step-point status",
00207 "Physics","","G4String");
00208 ID = "PreT";
00209 (*store)[ID] = G4AttDef(ID,"Pre-step-point global time",
00210 "Physics","G4BestUnit","G4double");
00211 ID = "PostT";
00212 (*store)[ID] = G4AttDef(ID,"Post-step-point global time",
00213 "Physics","G4BestUnit","G4double");
00214 ID = "PreVPath";
00215 (*store)[ID] = G4AttDef(ID,"Pre-step Volume Path",
00216 "Physics","","G4String");
00217 ID = "PostVPath";
00218 (*store)[ID] = G4AttDef(ID,"Post-step Volume Path",
00219 "Physics","","G4String");
00220 ID = "PreW";
00221 (*store)[ID] = G4AttDef(ID,"Pre-step-point weight",
00222 "Physics","","G4double");
00223 ID = "PostW";
00224 (*store)[ID] = G4AttDef(ID,"Post-step-point weight",
00225 "Physics","","G4double");
00226 }
00227 return store;
00228 }
00229
00230 static G4String Status(G4StepStatus stps)
00231 {
00232 G4String status;
00233 switch (stps) {
00234 case fWorldBoundary: status = "fWorldBoundary"; break;
00235 case fGeomBoundary: status = "fGeomBoundary"; break;
00236 case fAtRestDoItProc: status = "fAtRestDoItProc"; break;
00237 case fAlongStepDoItProc: status = "fAlongStepDoItProc"; break;
00238 case fPostStepDoItProc: status = "fPostStepDoItProc"; break;
00239 case fUserDefinedLimit: status = "fUserDefinedLimit"; break;
00240 case fExclusivelyForcedProc: status = "fExclusivelyForcedProc"; break;
00241 case fUndefined: status = "fUndefined"; break;
00242 default: status = "Not recognised"; break;
00243 }
00244 return status;
00245 }
00246
00247 static G4String Path(const G4TouchableHandle& th)
00248 {
00249 std::ostringstream oss;
00250 G4int depth = th->GetHistoryDepth();
00251 for (G4int i = depth; i >= 0; --i) {
00252 oss << th->GetVolume(i)->GetName()
00253 << ':' << th->GetCopyNumber(i);
00254 if (i != 0) oss << '/';
00255 }
00256 return oss.str();
00257 }
00258
00259 std::vector<G4AttValue>* G4RichTrajectoryPoint::CreateAttValues() const
00260 {
00261
00262 std::vector<G4AttValue>* values = G4TrajectoryPoint::CreateAttValues();
00263
00264 if (fpAuxiliaryPointVector) {
00265 std::vector<G4ThreeVector>::iterator iAux;
00266 for (iAux = fpAuxiliaryPointVector->begin();
00267 iAux != fpAuxiliaryPointVector->end(); ++iAux) {
00268 values->push_back(G4AttValue("Aux",G4BestUnit(*iAux,"Length"),""));
00269 }
00270 }
00271
00272 values->push_back(G4AttValue("TED",G4BestUnit(fTotEDep,"Energy"),""));
00273
00274 values->push_back(G4AttValue("RE",G4BestUnit(fRemainingEnergy,"Energy"),""));
00275
00276 if (fpProcess) {
00277 values->push_back
00278 (G4AttValue("PDS",fpProcess->GetProcessName(),""));
00279 values->push_back
00280 (G4AttValue
00281 ("PTDS",G4VProcess::GetProcessTypeName(fpProcess->GetProcessType()),
00282 ""));
00283 } else {
00284 values->push_back(G4AttValue("PDS","None",""));
00285 values->push_back(G4AttValue("PTDS","None",""));
00286 }
00287
00288 values->push_back
00289 (G4AttValue("PreStatus",Status(fPreStepPointStatus),""));
00290
00291 values->push_back
00292 (G4AttValue("PostStatus",Status(fPostStepPointStatus),""));
00293
00294 values->push_back
00295 (G4AttValue("PreT",G4BestUnit(fPreStepPointGlobalTime,"Time"),""));
00296
00297 values->push_back
00298 (G4AttValue("PostT",G4BestUnit(fPostStepPointGlobalTime,"Time"),""));
00299
00300 if (fpPreStepPointVolume && fpPreStepPointVolume->GetVolume()) {
00301 values->push_back(G4AttValue("PreVPath",Path(fpPreStepPointVolume),""));
00302 } else {
00303 values->push_back(G4AttValue("PreVPath","None",""));
00304 }
00305
00306 if (fpPostStepPointVolume && fpPostStepPointVolume->GetVolume()) {
00307 values->push_back(G4AttValue("PostVPath",Path(fpPostStepPointVolume),""));
00308 } else {
00309 values->push_back(G4AttValue("PostVPath","None",""));
00310 }
00311
00312 {
00313 std::ostringstream oss;
00314 oss << fPreStepPointWeight;
00315 values->push_back
00316 (G4AttValue("PreW",oss.str(),""));
00317 }
00318
00319 {
00320 std::ostringstream oss;
00321 oss << fPostStepPointWeight;
00322 values->push_back
00323 (G4AttValue("PostW",oss.str(),""));
00324 }
00325
00326 #ifdef G4ATTDEBUG
00327 G4cout << G4AttCheck(values,GetAttDefs());
00328 #endif
00329
00330 return values;
00331 }