/// SolidTrackingAction.cc /// Author: Benton Pahlka /// Copyright: 2008 (C) NEMO3/SuperNEMO - University of Texas at Austin #include "SolidTrackingAction.hh" #include "SolidTrajectory.hh" #include "SolidTrackInformation.hh" #include "G4TrajectoryContainer.hh" #include "G4Trajectory.hh" #include "G4Event.hh" #include "G4VProcess.hh" #include "G4TrackVector.hh" #include "G4TrackingManager.hh" #include "G4EventManager.hh" #include "G4ParticleTypes.hh" #include "G4SystemOfUnits.hh" #include "globals.hh" SolidTrackingAction::SolidTrackingAction(){} SolidTrackingAction::~SolidTrackingAction(){} void SolidTrackingAction::PreUserTrackingAction(const G4Track* aTrack) { //attach a new TrackInformation to photons at scintillation G4String partname = aTrack->GetDefinition()->GetParticleName(); // G4cout<GetUserInformation() == 0 ){ if(aTrack->GetCreatorProcess()->GetProcessName() == "Scintillation"){ G4Track *theTrack = (G4Track*)aTrack; theTrack->SetUserInformation(new SolidTrackInformation(aTrack)); } } // Reset products of radioactive decay to start at time zero. // Otherwise every track may start at 10^10 years in the future. // G4cout << G4endl << "trackGlobalTime= " << aTrack->GetGlobalTime() << G4endl; // if( aTrack->GetParentID() == 1 && aTrack->GetGlobalTime() > 1.*s ) // { // (const_cast(aTrack))->SetGlobalTime( 0. ); // G4cout << G4endl << "trackGlobalTime= " << aTrack->GetGlobalTime() << G4endl; // } } void SolidTrackingAction::PostUserTrackingAction(const G4Track* aTrack) { //attach a new TrackInformation to WLS photons, add parent info...only for wavelength shifting!! //otherwise this should work fine. G4String partname = aTrack->GetDefinition()->GetParticleName(); if(partname != "opticalphoton") return; G4TrackVector* secondaries = fpTrackingManager->GimmeSecondaries(); if(!secondaries) return; size_t nSeco = secondaries->size(); if(nSeco<=0) return; int iwls=0; for(size_t i = 0; i < nSeco; i++){ G4String cproc = (*secondaries)[i]->GetCreatorProcess()->GetProcessName(); // G4Track * tr = (*secondaries)[i]; if(cproc == "OpWLS") { // G4cout<< "OpWLS photon" << i << ": parent particle =" << aTrack->GetDefinition()->GetParticleName() << G4endl; (*secondaries)[i]->SetUserInformation(new SolidTrackInformation(aTrack)); iwls++; } } }