// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * 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. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // //Author: M. Esposito 19.03.13 // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "TrackingAction.hh" #include "Transport.hh" #include "RunAction.hh" //#include "Histo.hh" //#include "Pixel.hh" #include "G4Track.hh" #include "G4PhysicalConstants.hh" #include "G4SystemOfUnits.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... TrackingAction::TrackingAction() { //histo = new Histo(); transport= new Transport(); edeptot=edeptot_ele=RangeAbsInY=RangeAbsInZ=RangeAbsY=RangeAbsZ=RangeAbs2Y=RangeAbs2Z=RangeEpiY=RangeEpiZ=eKin=motherCopyNo=0; energyRT=-1; number=0; PDGid=0; } Transport* TrackingAction::GetTransport() {return transport;} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... TrackingAction::~TrackingAction() { delete transport; // delete histo; } #include "G4RunManager.hh" void TrackingAction::PreUserTrackingAction(const G4Track* aTrack){ if (aTrack->GetTrackID() == 1){ // number=number+1; // G4cout << number << " " << aTrack->GetTrackID() << G4endl; number = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID(); PDGid= aTrack->GetDefinition()->GetPDGEncoding(); transport->clearHit(number,PDGid); } } void TrackingAction::PostUserTrackingAction(const G4Track* aTrack) { //if (aTrack->GetTrackID() == 1){ //} //G4cout << "Save " << G4endl; //transport->GetPixel()->GetHisto()->SaveLog(data); //data.clear(); //G4cout << "Energy " << aTrack->GetKineticEnergy() << " ID " << aTrack->GetTrackID() << G4endl; // extract Projected Range of primary particle // G4double x = aTrack->GetPosition().x() + runAction->GetOffsetX(); //if(x > runAction->GetLength()) x = runAction->GetLength(); // runAction->GetHisto()->SaveLog(RangeAbsInY/mm,RangeAbsInZ/mm,RangeAbsY/mm,RangeAbsZ/mm,RangeAbs2Y/mm,RangeAbs2Z/mm,RangeEpiY/mm,RangeEpiZ/mm,edeptot/keV,edeptot_ele/keV); // if (eKin>1*eV){ // } // if (eKinSub>1*eV){ // histo->SaveLog("Secondaries_Sub",motherCopyNoSub,eKinSub/keV); // } //runAction->FillHisto(3, aTrack->GetKineticEnergy()/keV, 1.0); //G4cout << "E " << aTrack->GetKineticEnergy() << G4endl; // RangeAbsY=0; // RangeAbsZ=0; // RangeAbsInY=0; // RangeAbsInZ=0; // RangeAbs2Y=0; // RangeAbs2Z=0; // RangeEpiY=0; // RangeEpiZ=0; // edeptot=0; // edeptot_ele=0; // G4cout << " range= " << x << " x= " << aTrack->GetPosition().x() // << " ofset= " << runAction->GetOffsetX() << G4endl; // if(x > 0.0) runAction->AddProjRange(x); //runAction->FillHisto(2, x/mm, 1.0); //G4double y=aTrack->GetTrackLength(); //G4cout << " range= " << x << " x= " << aTrack->GetTrackLength() //<< " ofset= " << runAction->GetOffsetX() << G4endl; //if (y>0.0) runAction->AddRange(y); // } void TrackingAction::EndofEventLog(){ //G4cout << "Save " << G4endl; //G4cout << "Primary" << edeptot_ele/keV << "Secondary " << edeptot/keV << G4endl; //runAction->GetHisto()->SaveLog(RangeAbsInY/mm,RangeAbsInZ/mm,RangeAbsY/mm,RangeAbsZ/mm,RangeAbs2Y/mm,RangeAbs2Z/mm,RangeEpiY/mm,RangeEpiZ/mm, eKin/keV, edeptot/keV,edeptot_ele/keV); G4cout << "EndofEventLog" << G4endl; // transport-> GetPixel()->GetHisto()->FillBuffer(data); RangeAbsY=0; RangeAbsZ=0; RangeAbsInY=0; RangeAbsInZ=0; RangeAbs2Y=0; RangeAbs2Z=0; RangeEpiY=0; RangeEpiZ=0; edeptot=0; edeptot_ele=0; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......