Skip to content
Snippets Groups Projects
Commit ede428ca authored by Dmitry Popov's avatar Dmitry Popov
Browse files

CLEANUP of Geant4/G4* - removed /cmt /doc /srcnew and examples (repackaged)

parent 441fe492
Branches
Tags
1 merge request!24Migrate 'master' to G4 v10r3p3
Showing
with 0 additions and 4166 deletions
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file electromagnetic/TestEm3/src/SteppingAction.cc
/// \brief Implementation of the SteppingAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingAction.hh"
#include "DetectorConstruction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "HistoManager.hh"
#include "G4Step.hh"
#include "G4Positron.hh"
#include "G4RunManager.hh"
#include "G4PhysicalConstants.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det, RunAction* run,
EventAction* evt)
:G4UserSteppingAction(),fDetector(det),fRunAct(run),fEventAct(evt)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::~SteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
//track informations
const G4StepPoint* prePoint = aStep->GetPreStepPoint();
const G4StepPoint* endPoint = aStep->GetPostStepPoint();
const G4ParticleDefinition* particle = aStep->GetTrack()->GetDefinition();
//if World, return
//
G4VPhysicalVolume* volume = prePoint->GetTouchableHandle()->GetVolume();
//if sum of absorbers do not fill exactly a layer: check material, not volume.
G4Material* mat = volume->GetLogicalVolume()->GetMaterial();
if (mat == fDetector->GetWorldMaterial()) return;
//here we are in an absorber. Locate it
//
G4int absorNum = prePoint->GetTouchableHandle()->GetCopyNumber(0);
G4int layerNum = prePoint->GetTouchableHandle()->GetCopyNumber(1);
// collect energy deposit taking into account track weight
G4double edep = aStep->GetTotalEnergyDeposit()*aStep->GetTrack()->GetWeight();
// collect step length of charged particles
G4double stepl = 0.;
if (particle->GetPDGCharge() != 0.) {
stepl = aStep->GetStepLength();
fRunAct->AddChargedStep();
} else { fRunAct->AddNeutralStep(); }
// G4cout << "Nabs= " << absorNum << " edep(keV)= " << edep << G4endl;
// sum up per event
fEventAct->SumEnergy(absorNum,edep,stepl);
G4int Encoding=particle->GetPDGEncoding();
G4AnalysisManager* analysisManager=G4AnalysisManager::Instance();
//longitudinal profile of edep per absorber
if (edep>0.) {
G4AnalysisManager::Instance()->FillH1(MaxAbsor+absorNum,G4double(layerNum+1), edep);
if(absorNum==1){
if(Encoding==11){
analysisManager->FillH1(24,G4double(layerNum+1),edep);
}
else if(Encoding==-11){
analysisManager->FillH1(25,G4double(layerNum+1),edep);
}
else if(Encoding==22){
analysisManager->FillH1(23,G4double(layerNum+1),edep);
}
}
if(absorNum==2){
if(Encoding==11){
analysisManager->FillH1(27,G4double(layerNum+1),edep);
}
else if(Encoding==-11){
analysisManager->FillH1(28,G4double(layerNum+1),edep);
}
else if(Encoding==22){
analysisManager->FillH1(26,G4double(layerNum+1),edep);
}
}
if((Encoding!=11)&&(Encoding!=22)&&(Encoding!=-11)){
std::cout<<"Different particle created with id: "<<Encoding<<std::endl;
}
}
//energy flow
//
// unique identificator of layer+absorber
G4int Idnow = (fDetector->GetNbOfAbsor())*layerNum + absorNum;
G4int plane;
//
//leaving the absorber ?
if (endPoint->GetStepStatus() == fGeomBoundary) {
G4ThreeVector position = endPoint->GetPosition();
G4ThreeVector direction = endPoint->GetMomentumDirection();
G4double sizeYZ = 0.5*fDetector->GetCalorSizeYZ();
G4double Eflow = endPoint->GetKineticEnergy();
if (particle == G4Positron::Positron()) Eflow += 2*electron_mass_c2;
if ((std::abs(position.y()) >= sizeYZ) || (std::abs(position.z()) >= sizeYZ))
fRunAct->SumLateralEleak(Idnow, Eflow);
else if (direction.x() >= 0.) fRunAct->SumEnergyFlow(plane=Idnow+1, Eflow);
else fRunAct->SumEnergyFlow(plane=Idnow, -Eflow);
}
//// example of Birk attenuation
///G4double destep = aStep->GetTotalEnergyDeposit();
///G4double response = BirksAttenuation(aStep);
///G4cout << " Destep: " << destep/keV << " keV"
/// << " response after Birks: " << response/keV << " keV" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double SteppingAction::BirksAttenuation(const G4Step* aStep)
{
//Example of Birk attenuation law in organic scintillators.
//adapted from Geant3 PHYS337. See MIN 80 (1970) 239-244
//
G4Material* material = aStep->GetTrack()->GetMaterial();
G4double birk1 = material->GetIonisation()->GetBirksConstant();
G4double destep = aStep->GetTotalEnergyDeposit();
G4double stepl = aStep->GetStepLength();
G4double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
//
G4double response = destep;
if (birk1*destep*stepl*charge != 0.)
{
response = destep/(1. + birk1*destep/stepl);
}
return response;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
This diff is collapsed.
/include/
/src/
/TestEm5.cc
gaudi_depends_on_subdirs(Geant4/G4config)
gaudi_install_scripts()
gaudi_alias(MultipleScattering_test Em5run.sh)
# CMT-compatibility alias
gaudi_alias(testEm5.exe TestEm5)
# Required for tests
find_package(ROOT)
source /afs/cern.ch/lhcb/software/releases/LBSCRIPTS/prod/InstallArea/scripts/LbLogin.sh
SetupProject Geant4 HEAD --nightly lhcb-gauss-dev --user-area /afs/cern.ch/work/t/tiwillia/private/9.6p04cmtuser/
python /afs/cern.ch/work/t/tiwillia/private/9.6p04cmtuser/Geant4_HEAD/Xamples/extended/electromagnetic/G4TestEm5/x86_64-slc6-gcc48-opt/testEm5.exe /afs/cern.ch/work/t/tiwillia/private/9.6p04cmtuser/Geant4_HEAD/Xamples/extended/electromagnetic/G4TestEm5/Test/opt1NoApplyCuts/MacGen.py 1000
/afs/cern.ch/work/t/tiwillia/private/9.6p04cmtuser/Geant4_HEAD/Xamples/extended/electromagnetic/G4TestEm5/x86_64-slc6-gcc48-opt/testEm5.exe /afs/cern.ch/work/t/tiwillia/private/9.6p04cmtuser/Geant4_HEAD/Xamples/extended/electromagnetic/G4TestEm5/Test/opt1NoApplyCuts/BruteForce.mac 1000
cp RMSResults.root /afs/cern.ch/work/t/tiwillia/private/9.6p04cmtuser/Geant4_HEAD/Xamples/extended/electromagnetic/G4TestEm5/Test/opt1NoApplyCuts/run6RMSResults.root
cp Output* /afs/cern.ch/work/t/tiwillia/private/9.6p04cmtuser/Geant4_HEAD/Xamples/extended/electromagnetic/G4TestEm5/Test/opt1/run6Outputs/
import sys
n=int(sys.argv[1])
macout=file('BruteForce.mac','w')
macout.write('/control/verbose 2 \n/run/verbose 2 \n/testem/det/setAbsMat Silicon \n/testem/det/setAbsThick 300 um \n/testem/det/setAbsYZ 42 mm \n/testem/phys/addPhysics emstandard_opt1nocuts \n/testem/phys/setCuts 5 mm \n')
Energies=[1,2,3,4,5,7,9,12,15,20,25,30,40]
Limits=[4.0,3.0,2.0,1.5,1.0,0.6,0.5,0.5,0.4,0.2,0.2,0.15,0.15]
for E in Energies:
j=0
for i in range(0,n):
macout.write('/run/initialize \n/testem/gun/setDefault \n/gun/particle e- \n/gun/energy %.2f GeV \n/analysis/setFileName Output_%.2f \n/analysis/h1/set 1 100 0 100 keV #energy depostied in absorber \n/analysis/h1/set 10 100 0 100 keV #K.E at exit of world \n/analysis/h1/set 11 100 0 100 keV #Energy fluence dE/dOmega \n/analysis/h1/set 12 100 0.0 0.09 mrad #space angle dN/dOmega \n/analysis/h1/set 13 100 -%.2f %.2f mrad #projected angle at exit of world \n/analysis/h1/set 14 100 -14 14 nm #projected positon at exit of world \n/analysis/h1/set 15 100 0 44 mm #radius at exit of world \n/run/beamOn 10000 \n'%(E,E,Limits[j],Limits[j]))
j=j+1
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment