4 // Author: I.Hrivnacova
6 // Class TG4StepManager
7 // --------------------
8 // See the class description in the header file.
10 #include "TG4StepManager.h"
11 #include "TG4GeometryServices.h"
12 #include "TG4SDServices.h"
13 #include "TG4ParticlesManager.h"
14 #include "TG4PhysicsManager.h"
15 #include "TG4VSensitiveDetector.h"
16 #include "TG4Globals.h"
17 #include "TG4G3Units.h"
19 #include <G4SteppingManager.hh>
20 #include <G4UserLimits.hh>
21 #include <G4UImanager.hh>
22 #include <G4AffineTransform.hh>
23 #include <G4TransportationManager.hh>
24 #include <G4Navigator.hh>
25 #include <G4VProcess.hh>
26 #include <G4ProcessManager.hh>
27 #include <G4ProcessVector.hh>
29 #include <Randomize.hh>
30 #include <TLorentzVector.h>
32 TG4StepManager* TG4StepManager::fgInstance = 0;
34 //_____________________________________________________________________________
35 TG4StepManager::TG4StepManager()
38 fStepStatus(kNormalStep),
43 TG4Globals::Exception(
44 "TG4StepManager: attempt to create two instances of singleton.");
50 //_____________________________________________________________________________
51 TG4StepManager::TG4StepManager(const TG4StepManager& right) {
53 TG4Globals::Exception(
54 "Attempt to copy TG4StepManager singleton.");
57 //_____________________________________________________________________________
58 TG4StepManager::~TG4StepManager() {
64 //_____________________________________________________________________________
65 TG4StepManager& TG4StepManager::operator=(const TG4StepManager& right)
67 // check assignement to self
68 if (this == &right) return *this;
70 TG4Globals::Exception(
71 "Attempt to assign TG4StepManager singleton.");
78 //_____________________________________________________________________________
79 void TG4StepManager::CheckTrack() const
81 // Gives exception in case the track is not defined.
85 TG4Globals::Exception("TG4StepManager: Track is not defined.");
89 //_____________________________________________________________________________
90 void TG4StepManager::CheckStep(const G4String& method) const
92 // Gives exception in case the step is not defined.
96 G4String text = "TG4StepManager::";
97 text = text + method + ": Step is not defined.";
98 TG4Globals::Exception(text);
103 //_____________________________________________________________________________
104 void TG4StepManager::CheckSteppingManager() const
106 // Gives exception in case the step is not defined.
109 if (!fSteppingManager)
110 TG4Globals::Exception("TG4StepManager: Stepping manager is not defined.");
114 //_____________________________________________________________________________
115 void TG4StepManager::SetTLorentzVector(G4ThreeVector xyz, G4double t,
116 TLorentzVector& lv) const
118 // Fills TLorentzVector with G4ThreeVector and G4double.
127 //_____________________________________________________________________________
128 G4VPhysicalVolume* TG4StepManager::GetCurrentOffPhysicalVolume(G4int off) const
130 // Returns the physical volume of the off-th mother's
131 // of the current volume.
134 G4VPhysicalVolume* physVolume = GetCurrentPhysicalVolume();
136 G4VPhysicalVolume* mother = physVolume;
140 if (mother) mother = mother->GetMother();
145 G4String text = "TG4StepManager::CurrentVolOff: \n";
146 text = text + " Volume ";
147 text = text + physVolume->GetName();
148 text = text + " has not defined mother in the required level.";
149 TG4Globals::Warning(text);
157 //_____________________________________________________________________________
158 void TG4StepManager::StopTrack()
160 // Stops the current track and skips to the next.
161 // ?? do we want to invoke rest processes?
162 // ?? do we want to stop secondaries too?
163 // possible "stop" track status from G4:
164 // fStopButAlive, // Invoke active rest physics processes and
165 // // and kill the current track afterward
166 // fStopAndKill, // Kill the current track
167 // fKillTrackAndSecondaries,
168 // // Kill the current track and also associated
176 fTrack->SetTrackStatus(fStopAndKill);
177 // fTrack->SetTrackStatus(fStopButAlive);
178 // fTrack->SetTrackStatus(fKillTrackAndSecondaries);
181 //_____________________________________________________________________________
182 void TG4StepManager::StopEvent()
184 // Aborts the current event processing.
191 fTrack->SetTrackStatus(fKillTrackAndSecondaries);
192 //StopTrack(); // cannot be used as it keeps secondaries
193 G4UImanager::GetUIpointer()->ApplyCommand("/event/abort");
194 G4UImanager::GetUIpointer()->ApplyCommand("/alStacking/clearStack");
197 //_____________________________________________________________________________
198 void TG4StepManager::SetMaxStep(Float_t step)
200 // Maximum step allowed in the current logical volume.
203 G4UserLimits* userLimits
204 = GetCurrentPhysicalVolume()->GetLogicalVolume()->GetUserLimits();
208 G4String text = "TG4StepManager::SetMaxStep:\n";
209 text = text + " User limits not defined.";
210 TG4Globals::Exception(text);
216 userLimits->SetMaxAllowedStep(step*TG4G3Units::Length());
220 //_____________________________________________________________________________
221 void TG4StepManager::SetMaxNStep(Int_t maxNofSteps)
223 // Not yet implemented.
227 "TG4StepManager::SetMaxNStep(..) is not yet implemented.");
230 //_____________________________________________________________________________
231 void TG4StepManager::SetUserDecay(Int_t pdg)
233 // Not yet implemented.
236 TG4Globals::Exception(
237 "TG4StepManager::SetUserDecay(..) is not yet implemented.");
240 //_____________________________________________________________________________
241 G4VPhysicalVolume* TG4StepManager::GetCurrentPhysicalVolume() const
243 // Returns the current physical volume.
244 // According to fStepStatus the volume from track vertex,
245 // pre step point or post step point is returned.
248 G4VPhysicalVolume* physVolume;
249 if (fStepStatus == kNormalStep) {
252 CheckStep("GetCurrentPhysicalVolume");
255 physVolume = fStep->GetPreStepPoint()->GetPhysicalVolume();
257 else if (fStepStatus == kBoundary) {
260 CheckStep("GetCurrentPhysicalVolume");
263 physVolume = fStep->GetPostStepPoint()->GetPhysicalVolume();
271 G4ThreeVector position = fTrack->GetPosition();
272 G4Navigator* navigator =
273 G4TransportationManager::GetTransportationManager()->
274 GetNavigatorForTracking();
276 = navigator->LocateGlobalPointAndSetup(position);
282 //_____________________________________________________________________________
283 Int_t TG4StepManager::CurrentVolID(Int_t& copyNo) const
285 // Returns the current sensitive detector ID
286 // and the copy number of the current physical volume.
289 G4VPhysicalVolume* physVolume = GetCurrentPhysicalVolume();
290 copyNo = physVolume->GetCopyNo() + 1;
292 // sensitive detector ID
293 TG4SDServices* sdServices = TG4SDServices::Instance();
294 return sdServices->GetVolumeID(physVolume->GetLogicalVolume());
297 //_____________________________________________________________________________
298 Int_t TG4StepManager::CurrentVolOffID(Int_t off, Int_t& copyNo) const
300 // Returns the off-th mother's of the current volume
301 // the sensitive detector ID and the copy number.
304 if (off == 0) return CurrentVolID(copyNo);
306 G4VPhysicalVolume* mother = GetCurrentOffPhysicalVolume(off);
309 copyNo = mother->GetCopyNo() + 1;
311 // sensitive detector ID
312 TG4SDServices* sdServices = TG4SDServices::Instance();
313 return sdServices->GetVolumeID(mother->GetLogicalVolume());
321 //_____________________________________________________________________________
322 const char* TG4StepManager::CurrentVolName() const
324 // Returns the current physical volume name.
327 return GetCurrentPhysicalVolume()->GetName();
330 //_____________________________________________________________________________
331 const char* TG4StepManager::CurrentVolOffName(Int_t off) const
333 // Returns the off-th mother's physical volume name.
336 if (off == 0) return CurrentVolName();
338 G4VPhysicalVolume* mother = GetCurrentOffPhysicalVolume(off);
341 return mother->GetName();
346 //_____________________________________________________________________________
347 Int_t TG4StepManager::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
348 Float_t &radl, Float_t &absl) const
350 // Returns the parameters of the current material during transport
351 // the return value is the number of elements in the mixture.
354 G4VPhysicalVolume* physVolume = GetCurrentPhysicalVolume();
357 = physVolume->GetLogicalVolume()->GetMaterial();
361 TG4Globals::Exception(
362 "TG4StepManager::CurrentMaterial(..): material is not defined.");
367 G4int nofElements = material->GetNumberOfElements();
368 TG4GeometryServices* geometryServices = TG4GeometryServices::Instance();
369 a = geometryServices->GetEffA(material);
370 z = geometryServices->GetEffZ(material);
373 dens = material->GetDensity();
374 dens /= TG4G3Units::MassDensity();
377 radl = material->GetRadlen();
378 radl /= TG4G3Units::Length();
380 absl = 0.; // this parameter is not defined in Geant4
384 //_____________________________________________________________________________
385 void TG4StepManager::Gmtod(Float_t* xm, Float_t* xd, Int_t iflag)
387 // Transforms a position from the world reference frame
388 // to the current volume reference frame.
390 // Geant3 desription:
391 // ==================
392 // Computes coordinates XD (in DRS)
393 // from known coordinates XM in MRS
394 // The local reference system can be initialized by
395 // - the tracking routines and GMTOD used in GUSTEP
396 // - a call to GMEDIA(XM,NUMED)
397 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
398 // (inverse routine is GDTOM)
400 // If IFLAG=1 convert coordinates
401 // IFLAG=2 convert direction cosinus
406 if (iflag != 1 && iflag != 2) {
407 TG4Globals::Exception(
408 "TG4StepManager::Gmtod(..,iflag): iflag is not in 1..2");
413 G4AffineTransform affineTransform;
415 if (fStepStatus == kVertex) {
416 G4Navigator* navigator =
417 G4TransportationManager::GetTransportationManager()->
418 GetNavigatorForTracking();
420 affineTransform = navigator->GetGlobalToLocalTransform();
429 = fStep->GetPreStepPoint()->GetTouchable()->GetHistory()
433 G4ThreeVector theGlobalPoint(xm[0],xm[1],xm[2]);
434 G4ThreeVector theLocalPoint;
436 theLocalPoint = affineTransform.TransformPoint(theGlobalPoint);
439 theLocalPoint = affineTransform.TransformAxis(theGlobalPoint);
441 xd[0] = theLocalPoint.x();
442 xd[1] = theLocalPoint.y();
443 xd[2] = theLocalPoint.z();
446 //_____________________________________________________________________________
447 void TG4StepManager::Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)
449 // Transforms a position from the current volume reference frame
450 // to the world reference frame.
452 // Geant3 desription:
453 // ==================
454 // Computes coordinates XM (Master Reference System
455 // knowing the coordinates XD (Detector Ref System)
456 // The local reference system can be initialized by
457 // - the tracking routines and GDTOM used in GUSTEP
458 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
459 // (inverse routine is GMTOD)
461 // If IFLAG=1 convert coordinates
462 // IFLAG=2 convert direction cosinus
466 G4AffineTransform affineTransform;
468 if (fStepStatus == kVertex) {
469 G4Navigator* navigator =
470 G4TransportationManager::GetTransportationManager()->
471 GetNavigatorForTracking();
473 affineTransform = navigator->GetLocalToGlobalTransform();
484 = fStep->GetPreStepPoint()->GetTouchable()->GetHistory()
485 ->GetTopTransform().Inverse();
488 G4ThreeVector theLocalPoint(xd[0],xd[1],xd[2]);
489 G4ThreeVector theGlobalPoint;
491 theGlobalPoint = affineTransform.TransformPoint(theLocalPoint);
493 theGlobalPoint = affineTransform.TransformAxis(theLocalPoint);
496 "TG4StepManager::Gdtom(...,iflag): iflag is not in 1..2");
498 xm[0] = theGlobalPoint.x();
499 xm[1] = theGlobalPoint.y();
500 xm[2] = theGlobalPoint.z();
503 //_____________________________________________________________________________
504 Float_t TG4StepManager::MaxStep() const
506 // Returns maximum step allowed in the current logical volume
510 G4LogicalVolume* curLogVolume
511 = GetCurrentPhysicalVolume()->GetLogicalVolume();
514 G4UserLimits* userLimits
515 = curLogVolume->GetUserLimits();
518 if (userLimits == 0) {
519 G4String text = "User Limits are not defined for log volume ";
520 text = text + curLogVolume->GetName();
521 TG4Globals::Warning(text);
525 const G4Track& trackRef = *(fTrack);
526 maxStep = userLimits->GetMaxAllowedStep(trackRef);
527 maxStep /= TG4G3Units::Length();
532 //_____________________________________________________________________________
533 Int_t TG4StepManager::GetMaxNStep() const
535 // Not yet implemented.
539 "Method GetMaxNStep is not yet implemented in TG4StepManager.");
543 //_____________________________________________________________________________
544 void TG4StepManager::TrackPosition(TLorentzVector& position) const
546 // Current particle position (in the world reference frame)
547 // and the local time since the current track is created
548 // (position of the PostStepPoint).
556 // check if this is == to PostStepPoint position !!
557 G4ThreeVector positionVector = fTrack->GetPosition();
558 positionVector *= 1./(TG4G3Units::Length());
561 G4double time = fTrack->GetLocalTime();
562 time /= TG4G3Units::Time();
564 SetTLorentzVector(positionVector, time, position);
567 //_____________________________________________________________________________
568 Int_t TG4StepManager::GetMedium() const
570 // Returns the second index of the current material (corresponding to
571 // G3 tracking medium index).
574 // current logical volume
575 G4LogicalVolume* curLV = GetCurrentPhysicalVolume()->GetLogicalVolume();
578 TG4GeometryServices* geometryServices = TG4GeometryServices::Instance();
579 return geometryServices->GetMediumId(curLV);
582 //_____________________________________________________________________________
583 void TG4StepManager::TrackMomentum(TLorentzVector& momentum) const
585 // Current particle "momentum" (px, py, pz, Etot).
592 G4ThreeVector momentumVector = fTrack->GetMomentum();
593 momentumVector *= 1./(TG4G3Units::Energy());
595 G4double energy = fTrack->GetDynamicParticle()->GetTotalEnergy();
596 energy /= TG4G3Units::Energy();
598 SetTLorentzVector(momentumVector, energy, momentum);
601 //_____________________________________________________________________________
602 void TG4StepManager::TrackVertexPosition(TLorentzVector& position) const
604 // The vertex particle position (in the world reference frame)
605 // and the local time since the current track is created.
613 G4ThreeVector positionVector = fTrack->GetVertexPosition();
614 positionVector *= 1./(TG4G3Units::Length());
618 G4double time = fTrack->GetLocalTime();
619 time /= TG4G3Units::Time();
621 SetTLorentzVector(positionVector, time, position);
624 //_____________________________________________________________________________
625 void TG4StepManager::TrackVertexMomentum(TLorentzVector& momentum) const
627 // The vertex particle "momentum" (px, py, pz, Ekin)
628 // to do: change Ekin -> Etot
635 G4ThreeVector momentumVector = fTrack->GetVertexMomentumDirection();
636 momentumVector *= 1./(TG4G3Units::Energy());
638 G4double energy = fTrack->GetVertexKineticEnergy();
639 energy /= TG4G3Units::Energy();
641 SetTLorentzVector(momentumVector, energy, momentum);
644 //_____________________________________________________________________________
645 Float_t TG4StepManager::TrackStep() const
647 // Returns the current step length.
651 if (fStepStatus == kNormalStep) {
654 CheckStep("TrackStep");
657 length = fStep->GetStepLength();
658 length /= TG4G3Units::Length();
666 //_____________________________________________________________________________
667 Float_t TG4StepManager::TrackLength() const
669 // Returns the length of the current track from its origin.
676 G4double length = fTrack->GetTrackLength();
677 length /= TG4G3Units::Length();
681 //_____________________________________________________________________________
682 Float_t TG4StepManager::TrackTime() const
684 // Returns the local time since the current track is created.
686 // in Geant4: there is also defined proper time as
687 // the proper time of the dynamical particle of the current track.
694 G4double time = fTrack->GetLocalTime();
695 time /= TG4G3Units::Time();
699 //_____________________________________________________________________________
700 Float_t TG4StepManager::Edep() const
702 // Returns total energy deposit in this step.
705 G4double energyDeposit;
706 if (fStepStatus == kNormalStep) {
712 energyDeposit = fStep->GetTotalEnergyDeposit();
713 energyDeposit /= TG4G3Units::Energy();
718 return energyDeposit;
721 //_____________________________________________________________________________
722 Int_t TG4StepManager::TrackPid() const
724 // Returns the current particle PDG encoding.
731 G4ParticleDefinition* particle
732 = fTrack->GetDynamicParticle()->GetDefinition();
734 // ask TG4ParticlesManager to get PDG encoding
735 // (in order to get PDG from extended TDatabasePDG
736 // in case the standard PDG code is not defined)
738 = TG4ParticlesManager::Instance()->GetPDGEncodingFast(particle);
743 //_____________________________________________________________________________
744 Float_t TG4StepManager::TrackCharge() const
746 // Returns the current particle charge.
754 = fTrack->GetDynamicParticle()->GetDefinition()
756 charge /= TG4G3Units::Charge();
760 //_____________________________________________________________________________
761 Float_t TG4StepManager::TrackMass() const
763 // Returns current particle rest mass.
771 = fTrack->GetDynamicParticle()->GetDefinition()
773 mass /= TG4G3Units::Mass();
777 //_____________________________________________________________________________
778 Float_t TG4StepManager::Etot() const
780 // Returns total energy of the current particle.
788 = fTrack->GetDynamicParticle()->GetTotalEnergy();
789 energy /= TG4G3Units::Energy();
793 //_____________________________________________________________________________
794 Bool_t TG4StepManager::IsTrackInside() const
796 // Returns true if particle does not cross geometrical boundary
797 // and is not in vertex.
800 if (fStepStatus == kNormalStep && !(IsTrackExiting()) ) {
801 // track is always inside during a normal step
808 //_____________________________________________________________________________
809 Bool_t TG4StepManager::IsTrackEntering() const
811 // Returns true if particle cross a geometrical boundary
815 if (fStepStatus != kNormalStep) {
816 // track is entering during a vertex or boundary step
823 //_____________________________________________________________________________
824 Bool_t TG4StepManager::IsTrackExiting() const
826 // Returns true if particle cross a geometrical boundary.
829 if (fStepStatus == kNormalStep) {
832 CheckStep("IsTrackExiting");
835 if (fStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
842 //_____________________________________________________________________________
843 Bool_t TG4StepManager::IsTrackOut() const
845 // Returns true if particle cross the world boundary
846 // at post-step point.
849 if (fStepStatus == kVertex) return false;
852 CheckStep("IsTrackCut");
857 = fStep->GetPostStepPoint()->GetStepStatus();
858 if (status == fWorldBoundary)
864 //_____________________________________________________________________________
865 Bool_t TG4StepManager::IsTrackStop() const
867 // Returns true if particle has stopped
868 // or has been killed, suspended or postponed to next event.
870 // Possible track status from G4:
871 // fAlive, // Continue the tracking
872 // fStopButAlive, // Invoke active rest physics processes and
873 // // and kill the current track afterward
874 // fStopAndKill, // Kill the current track
875 // fKillTrackAndSecondaries,
876 // // Kill the current track and also associated
878 // fSuspend, // Suspend the current track
879 // fPostponeToNextEvent
880 // // Postpones the tracking of thecurrent track
881 // // to the next event.
890 = fTrack->GetTrackStatus();
891 if ((status == fStopAndKill) ||
892 (status == fKillTrackAndSecondaries) ||
893 (status == fSuspend) ||
894 (status == fPostponeToNextEvent)) {
901 //_____________________________________________________________________________
902 Bool_t TG4StepManager::IsTrackDisappeared() const
904 // Returns true if particle has disappeared
905 // (due to any physical process)
906 // or has been killed, suspended or postponed to next event.
915 = fTrack->GetTrackStatus();
916 if ((status == fStopButAlive) ||
917 (status == fKillTrackAndSecondaries) ||
918 (status == fSuspend) ||
919 (status == fPostponeToNextEvent)) {
926 //_____________________________________________________________________________
927 Bool_t TG4StepManager::IsTrackAlive() const
929 // Returns true if particle continues tracking.
937 = fTrack->GetTrackStatus();
938 if (status == fAlive)
944 //_____________________________________________________________________________
945 Bool_t TG4StepManager::IsNewTrack() const
947 // Returns true when track performs the first step.
950 if (fStepStatus == kVertex)
956 //_____________________________________________________________________________
957 Int_t TG4StepManager::NSecondaries() const
959 // Returns the number of secondary particles generated
960 // in the current step.
964 CheckSteppingManager();
967 G4int nofSecondaries = 0;
968 nofSecondaries += fSteppingManager->GetfN2ndariesAtRestDoIt();
969 nofSecondaries += fSteppingManager->GetfN2ndariesAlongStepDoIt();
970 nofSecondaries += fSteppingManager->GetfN2ndariesPostStepDoIt();
972 return nofSecondaries;
975 //_____________________________________________________________________________
976 void TG4StepManager::GetSecondary(Int_t index, Int_t& particleId,
977 TLorentzVector& position, TLorentzVector& momentum)
979 // Fills the parameters (particle encoding, position, momentum)
980 // of the generated secondary particle which is specified by index.
981 // !! Check if indexing of secondaries is same !!
985 CheckSteppingManager();
988 G4int nofSecondaries = NSecondaries();
989 G4TrackVector* secondaryTracks = fSteppingManager->GetSecondary();
992 if (!secondaryTracks) {
993 TG4Globals::Exception(
994 "TG4StepManager::GetSecondary(): secondary tracks vector is empty");
997 if (index >= nofSecondaries) {
998 TG4Globals::Exception(
999 "TG4StepManager::GetSecondary(): wrong secondary track index.");
1003 // the index of the first secondary of this step
1005 = secondaryTracks->size() - nofSecondaries;
1006 // (the secondaryTracks vector contains secondaries
1007 // produced by the track at previous steps, too)
1009 = (*secondaryTracks)[startIndex + index];
1011 // particle encoding
1013 = track->GetDynamicParticle()->GetDefinition()->GetPDGEncoding();
1016 G4ThreeVector positionVector = track->GetPosition();
1017 positionVector *= 1./(TG4G3Units::Length());
1018 G4double time = track->GetLocalTime();
1019 time /= TG4G3Units::Time();
1020 SetTLorentzVector(positionVector, time, position);
1022 // momentum & energy
1023 G4ThreeVector momentumVector = track->GetMomentum();
1024 G4double energy = track->GetDynamicParticle()->GetTotalEnergy();
1025 energy /= TG4G3Units::Energy();
1026 SetTLorentzVector(momentumVector, energy, momentum);
1029 //_____________________________________________________________________________
1030 AliMCProcess TG4StepManager::ProdProcess(Int_t isec) const
1032 // The process that has produced the secondary particles specified
1033 // with isec index in the current step.
1036 G4int nofSecondaries = NSecondaries();
1037 if (fStepStatus == kVertex || !nofSecondaries) return kPNoProcess;
1039 #ifdef TGEANT4_DEBUG
1040 CheckStep("ProdProcess");
1043 G4TrackVector* secondaryTracks = fSteppingManager->GetSecondary();
1045 #ifdef TGEANT4_DEBUG
1046 // should never happen
1047 if (!secondaryTracks) {
1048 TG4Globals::Exception(
1049 "TG4StepManager::ProdProcess(): secondary tracks vector is empty.");
1054 if (isec >= nofSecondaries) {
1055 TG4Globals::Exception(
1056 "TG4StepManager::GetSecondary(): wrong secondary track index.");
1062 // the index of the first secondary of this step
1064 = secondaryTracks->size() - nofSecondaries;
1065 // the secondaryTracks vector contains secondaries
1066 // produced by the track at previous steps, too
1068 // the secondary track with specified isec index
1069 G4Track* track = (*secondaryTracks)[startIndex + isec];
1071 const G4VProcess* kpProcess = track->GetCreatorProcess();
1073 AliMCProcess mcProcess
1074 = TG4PhysicsManager::Instance()->GetMCProcess(kpProcess);
1076 // distinguish kPDeltaRay from kPEnergyLoss
1077 if (mcProcess == kPEnergyLoss) mcProcess = kPDeltaRay;
1082 //_____________________________________________________________________________
1083 Int_t TG4StepManager::StepProcesses(TArrayI &proc) const
1085 // Fills the array of processes that were active in the current step
1086 // and returns the number of them.
1087 // TBD: Distinguish between kPDeltaRay and kPEnergyLoss
1090 if (fStepStatus == kVertex) {
1091 G4cout << "kVertex" << G4endl;
1092 G4int nofProcesses = 1;
1093 proc.Set(nofProcesses);
1095 return nofProcesses;
1098 #ifdef TGEANT4_DEBUG
1099 CheckSteppingManager();
1100 CheckStep("StepProcesses");
1103 // along step processes
1104 G4ProcessManager* processManager
1105 = fStep->GetTrack()->GetDefinition()->GetProcessManager();
1106 G4ProcessVector* alongStepProcessVector
1107 = processManager->GetAlongStepProcessVector();
1108 G4int nofProcesses = alongStepProcessVector->entries();
1110 // process defined step
1111 const G4VProcess* kpLastProcess
1112 = fStep->GetPostStepPoint()->GetProcessDefinedStep();
1114 // fill the array of processes
1115 proc.Set(nofProcesses);
1116 TG4PhysicsManager* physicsManager = TG4PhysicsManager::Instance();
1118 for (i=0; i<nofProcesses-1; i++) {
1119 G4VProcess* g4Process = (*alongStepProcessVector)[i];
1120 // do not fill transportation along step process
1121 if (g4Process->GetProcessName() != "Transportation") {
1122 physicsManager->GetMCProcess(g4Process);
1123 proc[i] = physicsManager->GetMCProcess(g4Process);
1126 proc[nofProcesses-1] = physicsManager->GetMCProcess(kpLastProcess);
1128 return nofProcesses;