source: trunk/source/tracking/src/G4RichTrajectoryPoint.cc @ 1187

Last change on this file since 1187 was 1011, checked in by garnier, 15 years ago

update

File size: 7.2 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4RichTrajectoryPoint.cc,v 1.3 2006/09/27 20:42:52 asaim Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30//
31// ---------------------------------------------------------------
32//
33// G4RichTrajectoryPoint.cc
34//
35// Contact:
36//   Questions and comments on G4TrajectoryPoint, on which this is based,
37//   should be sent to
38//     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
39//     Makoto  Asai   (e-mail: asai@kekvax.kek.jp)
40//     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
41//   and on the extended code to:
42//     John Allison   (e-mail: John.Allison@manchester.ac.uk)
43//     Joseph Perl    (e-mail: perl@slac.stanford.edu)
44//
45// ---------------------------------------------------------------
46
47#include "G4RichTrajectoryPoint.hh"
48
49#include "G4Track.hh"
50#include "G4Step.hh"
51#include "G4VProcess.hh"
52
53#include "G4AttDefStore.hh"
54#include "G4AttDef.hh"
55#include "G4AttValue.hh"
56#include "G4UnitsTable.hh"
57
58//#define G4ATTDEBUG
59#ifdef G4ATTDEBUG
60#include "G4AttCheck.hh"
61#endif
62
63G4Allocator<G4RichTrajectoryPoint> aRichTrajectoryPointAllocator;
64
65G4RichTrajectoryPoint::G4RichTrajectoryPoint():
66  fpAuxiliaryPointVector(0),
67  fTotEDep(0.),
68  fpProcess(0),
69  fPreStepPointGlobalTime(0),
70  fPostStepPointGlobalTime(0)
71{}
72
73G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Track* aTrack):
74  G4TrajectoryPoint(aTrack->GetPosition()),
75  fpAuxiliaryPointVector(0),
76  fTotEDep(0.),
77  fpProcess(0),
78  fPreStepPointGlobalTime(aTrack->GetGlobalTime()),
79  fPostStepPointGlobalTime(aTrack->GetGlobalTime())
80{}
81
82G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep):
83  G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()),
84  fpAuxiliaryPointVector(aStep->GetPointerToVectorOfAuxiliaryPoints()),
85  fTotEDep(aStep->GetTotalEnergyDeposit())
86{
87  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
88  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
89  fpProcess = postStepPoint->GetProcessDefinedStep();
90  fPreStepPointGlobalTime = preStepPoint->GetGlobalTime();
91  fPostStepPointGlobalTime = postStepPoint->GetGlobalTime();
92
93  /*
94  G4cout << "fpAuxiliaryPointVector "
95         << (void*) fpAuxiliaryPointVector;
96  G4cout << ": ";
97  if (fpAuxiliaryPointVector) {
98    G4cout << "size: " << fpAuxiliaryPointVector->size();
99    for (size_t i = 0; i < fpAuxiliaryPointVector->size(); ++i)
100      G4cout << "\n  " << (*fpAuxiliaryPointVector)[i];
101  } else {
102    G4cout << "non-existent";
103  }
104  G4cout << G4endl;
105
106  static const G4Step* lastStep = 0;
107  if (aStep && aStep == lastStep) {
108    G4cout << "********* aStep is same as last" << G4endl;
109  }
110  lastStep = aStep;
111
112  static std::vector<G4ThreeVector>*  lastAuxiliaryPointVector = 0;
113  if (fpAuxiliaryPointVector &&
114      fpAuxiliaryPointVector == lastAuxiliaryPointVector) {
115    G4cout << "********* fpAuxiliaryPointVector is same as last" << G4endl;
116  }
117  lastAuxiliaryPointVector = fpAuxiliaryPointVector;
118  */
119}
120
121G4RichTrajectoryPoint::G4RichTrajectoryPoint
122(const G4RichTrajectoryPoint &right):
123  G4TrajectoryPoint(right),
124  fpAuxiliaryPointVector(right.fpAuxiliaryPointVector),
125  fTotEDep(right.fTotEDep),
126  fpProcess(right.fpProcess),
127  fPreStepPointGlobalTime(right.fPreStepPointGlobalTime),
128  fPostStepPointGlobalTime(right.fPostStepPointGlobalTime)
129{}
130
131G4RichTrajectoryPoint::~G4RichTrajectoryPoint()
132{
133  if(fpAuxiliaryPointVector) {
134    /*
135    G4cout << "Deleting fpAuxiliaryPointVector at "
136           << (void*) fpAuxiliaryPointVector
137           << G4endl;
138    */
139    delete fpAuxiliaryPointVector;
140  }
141}
142
143const std::map<G4String,G4AttDef>*
144G4RichTrajectoryPoint::GetAttDefs() const
145{
146  G4bool isNew;
147  std::map<G4String,G4AttDef>* store
148    = G4AttDefStore::GetInstance("G4RichTrajectoryPoint",isNew);
149  if (isNew) {
150
151    // Copy base class att defs...
152    *store = *(G4TrajectoryPoint::GetAttDefs());
153
154    G4String ID;
155
156    ID = "Aux";
157    (*store)[ID] = G4AttDef(ID, "Auxiliary Point Position",
158                            "Physics","G4BestUnit","G4ThreeVector");
159    ID = "TED";
160    (*store)[ID] = G4AttDef(ID,"Total Energy Deposit",
161                            "Physics","G4BestUnit","G4double");
162    ID = "PDS";
163    (*store)[ID] = G4AttDef(ID,"Process Defined Step",
164                            "Physics","","G4String");
165    ID = "PTDS";
166    (*store)[ID] = G4AttDef(ID,"Process Type Defined Step",
167                            "Physics","","G4String");
168    ID = "PreT";
169    (*store)[ID] = G4AttDef(ID,"Pre-step-point global time",
170                            "Physics","G4BestUnit","G4double");
171    ID = "PostT";
172    (*store)[ID] = G4AttDef(ID,"Post-step-point global time",
173                            "Physics","G4BestUnit","G4double");
174  }
175  return store;
176}
177
178std::vector<G4AttValue>* G4RichTrajectoryPoint::CreateAttValues() const
179{
180  // Create base class att values...
181  std::vector<G4AttValue>* values = G4TrajectoryPoint::CreateAttValues();
182
183  if (fpAuxiliaryPointVector) {
184    std::vector<G4ThreeVector>::iterator iAux;
185    for (iAux = fpAuxiliaryPointVector->begin();
186         iAux != fpAuxiliaryPointVector->end(); ++iAux) {
187      values->push_back(G4AttValue("Aux",G4BestUnit(*iAux,"Length"),""));
188    }
189  }
190
191  values->push_back(G4AttValue("TED",G4BestUnit(fTotEDep,"Energy"),""));
192
193  if (fpProcess) {
194    values->push_back
195      (G4AttValue("PDS",fpProcess->GetProcessName(),""));
196    values->push_back
197      (G4AttValue
198       ("PTDS",G4VProcess::GetProcessTypeName(fpProcess->GetProcessType()),
199        ""));
200  } else {
201    values->push_back
202      (G4AttValue("PDS","User Defined Limit in Current Volume",""));
203    values->push_back(G4AttValue("PTDS","User",""));
204  }
205
206  values->push_back
207    (G4AttValue("PreT",G4BestUnit(fPreStepPointGlobalTime,"Time"),""));
208
209  values->push_back
210    (G4AttValue("PostT",G4BestUnit(fPostStepPointGlobalTime,"Time"),""));
211
212#ifdef G4ATTDEBUG
213  G4cout << G4AttCheck(values,GetAttDefs());
214#endif
215
216  return values;
217}
Note: See TracBrowser for help on using the repository browser.