// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // #include "KM3TrackingAction.hh" #include "G4TrackingManager.hh" #include "G4Track.hh" #include "G4TrackVector.hh" #include "KM3TrackInformation.hh" #include "G4SystemOfUnits.hh" void KM3TrackingAction::PreUserTrackingAction(const G4Track *aTrack) { //if(aTrack->GetParentID() == 0){ //G4cout<<"PARENT TRACK ID: "<GetParentID()<<" Particle Type: "<GetParticleDefinition()->GetParticleName()<<"TRACK ID: "<GetTrackID()<GetParentID() > 0 && aTrack->GetParentID() <= numofInitialParticles) { if (aTrack->GetUserInformation() == 0) { KM3TrackInformation *anInfo = new KM3TrackInformation(aTrack); G4Track *theTrack = (G4Track *)aTrack; theTrack->SetUserInformation(anInfo); // write info on evt file about the muon capture or decay secondaries if (useANTARESformat) { G4String theCreatorProcess = aTrack->GetCreatorProcess()->GetProcessName(); if ((theCreatorProcess == "Decay") || (theCreatorProcess == "muMinusCaptureAtRest")) { G4int trackID = aTrack->GetTrackID(); G4int parentID = aTrack->GetParentID(); G4ThreeVector pos = aTrack->GetPosition(); G4ThreeVector ddd = aTrack->GetMomentumDirection(); G4double TotalEnergy = aTrack->GetTotalEnergy(); G4double time = aTrack->GetGlobalTime(); G4int idPDG = aTrack->GetDefinition()->GetPDGEncoding(); } } } else { // if(aTrack->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition()){ KM3TrackInformation *info = (KM3TrackInformation *)(aTrack->GetUserInformation()); if (info->GetEmittedAsScattered() && info->GetOriginalEnergy() == 0.0) { info->SetMoreInformation(aTrack); } // } } } } void KM3TrackingAction::PostUserTrackingAction(const G4Track *aTrack) { if(aTrack->GetParentID() == 0 && aTrack->GetTrackStatus() == fStopAndKill || aTrack->GetTrackStatus() == fStopButAlive) evtAANETWriter->AddTrackLength(aTrack->GetTrackID(), aTrack->GetTrackLength()); if (aTrack->GetParentID() > 0) { G4TrackVector *secondaries = fpTrackingManager->GimmeSecondaries(); if (secondaries) { KM3TrackInformation *info = (KM3TrackInformation *)(aTrack->GetUserInformation()); size_t nSeco = secondaries->size(); if (nSeco > 0) { for (size_t i = 0; i < nSeco; i++) { if ((*secondaries)[i]->GetUserInformation() == 0) { KM3TrackInformation *infoNew = new KM3TrackInformation(info); (*secondaries)[i]->SetUserInformation(infoNew); } else { // if((*secondaries)[i]->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition()){ KM3TrackInformation *infoNew = (KM3TrackInformation *)((*secondaries)[i] ->GetUserInformation()); if (infoNew->GetEmittedAsScattered() && infoNew->GetOriginalEnergy() == 0.0) { infoNew->SetMoreInformation(info); } // } } } } } } }