Import Geant4 9.4.0 source tree
This commit is contained in:
@@ -1,219 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01AnalysisManager.cc,v 1.18 2009/05/13 08:33:17 gbarrand Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 14th Septembre 2000.
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
|
||||
#include <AIDA/IAnalysisFactory.h>
|
||||
#include <AIDA/ITreeFactory.h>
|
||||
#include <AIDA/ITupleFactory.h>
|
||||
#include <AIDA/IHistogramFactory.h>
|
||||
#include <AIDA/ITree.h>
|
||||
#include <AIDA/IHistogram1D.h>
|
||||
#include <AIDA/ITuple.h>
|
||||
|
||||
#include "AnaEx01CalorHit.hh"
|
||||
#include "AnaEx01AnalysisManager.hh"
|
||||
|
||||
AnaEx01AnalysisManager::AnaEx01AnalysisManager(AIDA::IAnalysisFactory* aAIDA)
|
||||
:fCalorimeterCollID(-1)
|
||||
,fAIDA(aAIDA)
|
||||
,fTree(0)
|
||||
,fEAbs(0)
|
||||
,fLAbs(0)
|
||||
,fEGap(0)
|
||||
,fLGap(0)
|
||||
,fTuple(0)
|
||||
{
|
||||
// Could fail if no AIDA implementation found :
|
||||
if(!fAIDA) {
|
||||
G4cout << "AIDA analysis factory not found." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
AIDA::ITreeFactory* treeFactory = fAIDA->createTreeFactory();
|
||||
if(!treeFactory) return;
|
||||
|
||||
// Create a tree-like container to handle histograms.
|
||||
// This tree is associated to a AnaEx01.<format> file.
|
||||
|
||||
std::string h_name_EAbs("EAbs");
|
||||
std::string h_name_LAbs("LAbs");
|
||||
std::string h_name_EGap("EGap");
|
||||
std::string h_name_LGap("LGap");
|
||||
std::string t_name("AnaEx01");
|
||||
|
||||
// File format :
|
||||
std::string format("xml");
|
||||
//std::string format("hbook");
|
||||
//std::string format("root");
|
||||
|
||||
std::string file("AnaEx01");
|
||||
std::string ext;
|
||||
ext = "."+format;
|
||||
|
||||
std::string opts;
|
||||
if(format=="hbook") {
|
||||
opts = "compress=no";
|
||||
|
||||
h_name_EAbs = "1";
|
||||
h_name_LAbs = "2";
|
||||
h_name_EGap = "3";
|
||||
h_name_LGap = "4";
|
||||
t_name = "101";
|
||||
|
||||
} else if(format=="root") {
|
||||
opts = "compress=yes";
|
||||
|
||||
} else if(format=="xml") {
|
||||
ext = ".aida";
|
||||
opts = "compress=no";
|
||||
|
||||
} else {
|
||||
G4cout << "storage format \"" << format << "\""
|
||||
<< " not handled in this example."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
file += ext;
|
||||
fTree = treeFactory->create(file,format,false,true,opts);
|
||||
|
||||
// Factories are not "managed" by an AIDA analysis system.
|
||||
// They must be deleted by the AIDA user code.
|
||||
delete treeFactory;
|
||||
|
||||
if(!fTree) {
|
||||
G4cout << "can't create tree associated to file \"" << file << "\"."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
fTree->mkdir("histograms");
|
||||
fTree->cd("histograms");
|
||||
|
||||
// Create an histo factory that will create histo in the tree :
|
||||
AIDA::IHistogramFactory* histoFactory =
|
||||
fAIDA->createHistogramFactory(*fTree);
|
||||
if(histoFactory) {
|
||||
fEAbs = histoFactory->createHistogram1D(h_name_EAbs,"EAbs",100,0,100);
|
||||
if(!fEAbs) G4cout << "can't create histo EAbs." << G4endl;
|
||||
fLAbs = histoFactory->createHistogram1D(h_name_LAbs,"LAbs",100,0,100);
|
||||
if(!fLAbs) G4cout << "can't create histo LAbs." << G4endl;
|
||||
fEGap = histoFactory->createHistogram1D(h_name_EGap,"EGap",100,0,10);
|
||||
if(!fEGap) G4cout << "can't create histo EGap." << G4endl;
|
||||
fLGap = histoFactory->createHistogram1D(h_name_LGap,"LGap",100,0,100);
|
||||
if(!fLGap) G4cout << "can't create histo LGap." << G4endl;
|
||||
delete histoFactory;
|
||||
}
|
||||
|
||||
fTree->cd("..");
|
||||
fTree->mkdir("tuples");
|
||||
fTree->cd("tuples");
|
||||
|
||||
// Get a tuple factory :
|
||||
AIDA::ITupleFactory* tupleFactory = fAIDA->createTupleFactory(*fTree);
|
||||
if(tupleFactory) {
|
||||
|
||||
// Create a tuple :
|
||||
fTuple = tupleFactory->create(t_name,"AnaEx01",
|
||||
"double EAbs,double LAbs,double EGap,double LGap");
|
||||
if(!fTuple) G4cout << "can't create tuple." << G4endl;
|
||||
|
||||
delete tupleFactory;
|
||||
}
|
||||
|
||||
fTree->cd("..");
|
||||
}
|
||||
AnaEx01AnalysisManager::~AnaEx01AnalysisManager() {
|
||||
}
|
||||
|
||||
void AnaEx01AnalysisManager::BeginOfRun(const G4Run* aRun){
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
}
|
||||
|
||||
void AnaEx01AnalysisManager::EndOfRun(const G4Run*){
|
||||
if(fTree) fTree->commit();
|
||||
if(fEAbs) {
|
||||
G4cout << "Histo : EAbs : mean " << fEAbs->mean() << " rms : " << fEAbs->rms() << G4endl;
|
||||
G4cout << "Histo : LAbs : mean " << fLAbs->mean() << " rms : " << fLAbs->rms() << G4endl;
|
||||
G4cout << "Histo : EGap : mean " << fEGap->mean() << " rms : " << fEGap->rms() << G4endl;
|
||||
G4cout << "Histo : LGap : mean " << fLGap->mean() << " rms : " << fLGap->rms() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
void AnaEx01AnalysisManager::BeginOfEvent(const G4Event*){
|
||||
if(fCalorimeterCollID==-1) {
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
fCalorimeterCollID = SDman->GetCollectionID("CalCollection");
|
||||
}
|
||||
}
|
||||
|
||||
void AnaEx01AnalysisManager::EndOfEvent(const G4Event* aEvent){
|
||||
if(!fEAbs) return; // No histo booked !
|
||||
if(!fTuple) return; // No tuple booked !
|
||||
|
||||
//G4int evtNb = aEvent->GetEventID();
|
||||
|
||||
G4HCofThisEvent* HCE = aEvent->GetHCofThisEvent();
|
||||
AnaEx01CalorHitsCollection* CHC =
|
||||
HCE ? (AnaEx01CalorHitsCollection*)(HCE->GetHC(fCalorimeterCollID)) : 0;
|
||||
|
||||
if(CHC) {
|
||||
G4int n_hit = CHC->entries();
|
||||
for (G4int i=0;i<n_hit;i++) {
|
||||
G4double EAbs = (*CHC)[i]->GetEdepAbs();
|
||||
G4double LAbs = (*CHC)[i]->GetTrakAbs();
|
||||
G4double EGap = (*CHC)[i]->GetEdepGap();
|
||||
G4double LGap = (*CHC)[i]->GetTrakGap();
|
||||
fEAbs->fill(EAbs);
|
||||
fLAbs->fill(LAbs);
|
||||
fEGap->fill(EGap);
|
||||
fLGap->fill(LGap);
|
||||
|
||||
fTuple->fill(0,EAbs);
|
||||
fTuple->fill(1,LAbs);
|
||||
fTuple->fill(2,EGap);
|
||||
fTuple->fill(3,LGap);
|
||||
fTuple->addRow();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void AnaEx01AnalysisManager::Step(const G4Step*){}
|
||||
|
||||
#endif
|
||||
@@ -1,142 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01CalorimeterSD.cc,v 1.5 2006/06/29 16:33:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "AnaEx01CalorimeterSD.hh"
|
||||
|
||||
#include "AnaEx01CalorHit.hh"
|
||||
#include "AnaEx01DetectorConstruction.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
AnaEx01CalorimeterSD::AnaEx01CalorimeterSD(G4String name,
|
||||
AnaEx01DetectorConstruction* det)
|
||||
:G4VSensitiveDetector(name),Detector(det)
|
||||
{
|
||||
collectionName.insert("CalCollection");
|
||||
HitID = new G4int[500];
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
AnaEx01CalorimeterSD::~AnaEx01CalorimeterSD()
|
||||
{
|
||||
delete [] HitID;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01CalorimeterSD::Initialize(G4HCofThisEvent*)
|
||||
{
|
||||
CalCollection = new AnaEx01CalorHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
for (G4int j=0;j<Detector->GetNbOfLayers();j++) {HitID[j] = -1;};
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool AnaEx01CalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
G4double stepl = 0.;
|
||||
if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.)
|
||||
stepl = aStep->GetStepLength();
|
||||
|
||||
if ((edep==0.)&&(stepl==0.)) return false;
|
||||
|
||||
G4TouchableHistory* theTouchable
|
||||
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
|
||||
|
||||
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
|
||||
//theTouchable->MoveUpHistory();
|
||||
G4int LayerNumber = 0;
|
||||
if (Detector->GetNbOfLayers()>1) LayerNumber=theTouchable->GetReplicaNumber(1);
|
||||
|
||||
if (HitID[LayerNumber]==-1)
|
||||
{
|
||||
AnaEx01CalorHit* calHit = new AnaEx01CalorHit();
|
||||
if (physVol == Detector->GetAbsorber()) calHit->AddAbs(edep,stepl);
|
||||
if (physVol == Detector->GetGap ()) calHit->AddGap(edep,stepl);
|
||||
HitID[LayerNumber] = CalCollection->insert(calHit) - 1;
|
||||
if (verboseLevel>0)
|
||||
G4cout << " New Calorimeter Hit on layer: " << LayerNumber << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (physVol == Detector->GetAbsorber())
|
||||
(*CalCollection)[HitID[LayerNumber]]->AddAbs(edep,stepl);
|
||||
if (physVol == Detector->GetGap())
|
||||
(*CalCollection)[HitID[LayerNumber]]->AddGap(edep,stepl);
|
||||
if (verboseLevel>0)
|
||||
G4cout << " Energy added to Layer: " << LayerNumber << G4endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01CalorimeterSD::EndOfEvent(G4HCofThisEvent* HCE)
|
||||
{
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0)
|
||||
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection(HCID,CalCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01CalorimeterSD::clear()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01CalorimeterSD::DrawAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01CalorimeterSD::PrintAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01EventAction.cc,v 1.6 2006/06/29 16:33:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AnaEx01AnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
#include "AnaEx01EventAction.hh"
|
||||
|
||||
AnaEx01EventAction::AnaEx01EventAction(
|
||||
AnaEx01AnalysisManager* aAnalysisManager
|
||||
):fAnalysisManager(aAnalysisManager){}
|
||||
|
||||
AnaEx01EventAction::~AnaEx01EventAction(){}
|
||||
|
||||
void AnaEx01EventAction::BeginOfEventAction(const G4Event* aEvent){
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->BeginOfEvent(aEvent);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AnaEx01EventAction::EndOfEventAction(const G4Event* aEvent) {
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->EndOfEvent(aEvent);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,375 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PhysicsList.cc,v 1.5 2006/06/29 16:33:55 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "AnaEx01PhysicsList.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
AnaEx01PhysicsList::AnaEx01PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
currentDefaultCut = defaultCutValue = 1.0*mm;
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForProton = defaultCutValue;
|
||||
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
AnaEx01PhysicsList::~AnaEx01PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
ConstructMesons();
|
||||
ConstructBaryons();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::ConstructBosons()
|
||||
{
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
// optical photon
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::ConstructMesons()
|
||||
{
|
||||
// mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::ConstructBaryons()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
|
||||
#include "G4MultipleScattering.hh"
|
||||
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
#include "G4MuIonisation.hh"
|
||||
#include "G4MuBremsstrahlung.hh"
|
||||
#include "G4MuPairProduction.hh"
|
||||
|
||||
#include "G4hIonisation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
// gamma
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion());
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering());
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* theeminusIonisation = new G4eIonisation();
|
||||
G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(theeminusMultipleScattering);
|
||||
pmanager->AddProcess(theeminusIonisation);
|
||||
pmanager->AddProcess(theeminusBremsstrahlung);
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,2);
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2);
|
||||
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* theeplusIonisation = new G4eIonisation();
|
||||
G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
|
||||
G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(theeplusMultipleScattering);
|
||||
pmanager->AddProcess(theeplusIonisation);
|
||||
pmanager->AddProcess(theeplusBremsstrahlung);
|
||||
pmanager->AddProcess(theeplusAnnihilation);
|
||||
//
|
||||
// set ordering for AtRestDoIt
|
||||
pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2);
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep,2);
|
||||
pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep,3);
|
||||
pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep,4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
G4VProcess* aMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
|
||||
G4VProcess* aPairProduction = new G4MuPairProduction();
|
||||
G4VProcess* anIonisation = new G4MuIonisation();
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(anIonisation);
|
||||
pmanager->AddProcess(aMultipleScattering);
|
||||
pmanager->AddProcess(aBremsstrahlung);
|
||||
pmanager->AddProcess(aPairProduction);
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
|
||||
pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3);
|
||||
pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
// all others charged particles except geantino
|
||||
G4VProcess* aMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* anIonisation = new G4hIonisation();
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(anIonisation);
|
||||
pmanager->AddProcess(aMultipleScattering);
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4Decay.hh"
|
||||
|
||||
void AnaEx01PhysicsList::ConstructGeneral()
|
||||
{
|
||||
// Add Decay Process
|
||||
G4Decay* theDecayProcess = new G4Decay();
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (theDecayProcess->IsApplicable(*particle)) {
|
||||
pmanager ->AddProcess(theDecayProcess);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PhysicsList::SetCuts()
|
||||
{
|
||||
// reactualise cutValues
|
||||
if (currentDefaultCut != defaultCutValue)
|
||||
{
|
||||
if(cutForGamma == currentDefaultCut) cutForGamma = defaultCutValue;
|
||||
if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
|
||||
if(cutForProton == currentDefaultCut) cutForProton = defaultCutValue;
|
||||
currentDefaultCut = defaultCutValue;
|
||||
}
|
||||
|
||||
if (verboseLevel >0){
|
||||
G4cout << "AnaEx01PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(cutForGamma, "gamma");
|
||||
SetCutValue(cutForElectron, "e-");
|
||||
SetCutValue(cutForElectron, "e+");
|
||||
|
||||
// set cut values for proton and anti_proton before all other hadrons
|
||||
// because some processes for hadrons need cut values for proton/anti_proton
|
||||
SetCutValue(cutForProton, "proton");
|
||||
SetCutValue(cutForProton, "anti_proton");
|
||||
|
||||
SetCutValueForOthers(defaultCutValue);
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
void AnaEx01PhysicsList::SetCutForGamma(G4double cut)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForGamma = cut;
|
||||
}
|
||||
|
||||
void AnaEx01PhysicsList::SetCutForElectron(G4double cut)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForElectron = cut;
|
||||
}
|
||||
|
||||
void AnaEx01PhysicsList::SetCutForProton(G4double cut)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForProton = cut;
|
||||
}
|
||||
|
||||
G4double AnaEx01PhysicsList::GetCutForGamma() const
|
||||
{
|
||||
return cutForGamma;
|
||||
}
|
||||
|
||||
G4double AnaEx01PhysicsList::GetCutForElectron() const
|
||||
{
|
||||
return cutForElectron;
|
||||
}
|
||||
|
||||
G4double AnaEx01PhysicsList::GetCutForProton() const
|
||||
{
|
||||
return cutForGamma;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01RunAction.cc,v 1.7 2006/06/29 16:34:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AnaEx01AnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
#include "AnaEx01RunAction.hh"
|
||||
|
||||
AnaEx01RunAction::AnaEx01RunAction(
|
||||
AnaEx01AnalysisManager* aAnalysisManager
|
||||
):fAnalysisManager(aAnalysisManager){}
|
||||
|
||||
AnaEx01RunAction::~AnaEx01RunAction(){}
|
||||
|
||||
void AnaEx01RunAction::BeginOfRunAction(const G4Run* aRun) {
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->BeginOfRun(aRun);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AnaEx01RunAction::EndOfRunAction(const G4Run* aRun){
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->EndOfRun(aRun);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01SteppingAction.cc,v 1.7 2006/06/29 16:34:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AnaEx01AnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
#include "AnaEx01SteppingAction.hh"
|
||||
|
||||
AnaEx01SteppingAction::AnaEx01SteppingAction(
|
||||
AnaEx01AnalysisManager* aAnalysisManager
|
||||
):fAnalysisManager(aAnalysisManager){}
|
||||
|
||||
AnaEx01SteppingAction::~AnaEx01SteppingAction(){}
|
||||
void AnaEx01SteppingAction::UserSteppingAction(const G4Step* aStep){
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->Step(aStep);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01SteppingVerbose.cc,v 1.7 2006/06/29 16:34:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// AnaEx01SteppingVerbose.cc
|
||||
//
|
||||
// Description:
|
||||
// Implementation of the AnaEx01SteppingVerbose class
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "AnaEx01SteppingVerbose.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
////////////////////////////////////////////////
|
||||
AnaEx01SteppingVerbose::AnaEx01SteppingVerbose()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
AnaEx01SteppingVerbose::~AnaEx01SteppingVerbose()
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
void AnaEx01SteppingVerbose::StepInfo()
|
||||
/////////////////////////////////////////
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << std::setw( 5) << "#Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "NextVolu"
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
}
|
||||
|
||||
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << "User Limit";
|
||||
}
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << " :----- List of 2ndaries - "
|
||||
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(G4int lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(int)(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
void AnaEx01SteppingVerbose::TrackingStarted()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "NextVolu"
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld" << " ";
|
||||
}
|
||||
G4cout << std::setw(10) << "initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
+106
-270
@@ -24,58 +24,42 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01DetectorConstruction.cc,v 1.5 2006/06/29 16:33:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: DetectorConstruction.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "AnaEx01DetectorConstruction.hh"
|
||||
#include "AnaEx01DetectorMessenger.hh"
|
||||
|
||||
#include "AnaEx01CalorimeterSD.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
AnaEx01DetectorConstruction::AnaEx01DetectorConstruction()
|
||||
:AbsorberMaterial(NULL)
|
||||
,GapMaterial(NULL)
|
||||
,defaultMaterial(NULL)
|
||||
,solidWorld(NULL)
|
||||
,logicWorld(NULL)
|
||||
,physiWorld(NULL)
|
||||
,solidCalor(NULL)
|
||||
,logicCalor(NULL)
|
||||
,physiCalor(NULL)
|
||||
,solidLayer(NULL)
|
||||
,logicLayer(NULL)
|
||||
,physiLayer(NULL)
|
||||
,solidAbsorber(NULL)
|
||||
,logicAbsorber(NULL)
|
||||
,physiAbsorber(NULL)
|
||||
,solidGap(NULL)
|
||||
,logicGap(NULL)
|
||||
,physiGap(NULL)
|
||||
,magField(NULL)
|
||||
,calorimeterSD(NULL)
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
:AbsorberMaterial(0),GapMaterial(0),defaultMaterial(0),
|
||||
solidWorld(0),logicWorld(0),physiWorld(0),
|
||||
solidCalor(0),logicCalor(0),physiCalor(0),
|
||||
solidLayer(0),logicLayer(0),physiLayer(0),
|
||||
solidAbsorber(0),logicAbsorber(0),physiAbsorber(0),
|
||||
solidGap (0),logicGap (0),physiGap (0)
|
||||
{
|
||||
// default parameter values of the calorimeter
|
||||
AbsorberThickness = 10.*mm;
|
||||
@@ -83,168 +67,57 @@ AnaEx01DetectorConstruction::AnaEx01DetectorConstruction()
|
||||
NbOfLayers = 10;
|
||||
CalorSizeYZ = 10.*cm;
|
||||
ComputeCalorParameters();
|
||||
|
||||
// create commands for interactive definition of the calorimeter
|
||||
detectorMessenger = new AnaEx01DetectorMessenger(this);
|
||||
|
||||
// materials
|
||||
DefineMaterials();
|
||||
SetAbsorberMaterial("G4_Pb");
|
||||
SetGapMaterial("G4_lAr");
|
||||
|
||||
// create commands for interactive definition of the calorimeter
|
||||
detectorMessenger = new DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01DetectorConstruction::~AnaEx01DetectorConstruction()
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{ delete detectorMessenger;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* AnaEx01DetectorConstruction::Construct()
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
DefineMaterials();
|
||||
return ConstructCalorimeter();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::DefineMaterials()
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
//This function illustrates the possible ways to define materials
|
||||
|
||||
G4String name, symbol; //a=mass of a mole;
|
||||
G4double a, z, density; //z=mean number of protons;
|
||||
G4int iz, n; //iz=number of protons in an isotope;
|
||||
// n=number of nucleons in an isotope;
|
||||
|
||||
G4int ncomponents, natoms;
|
||||
G4double abundance, fractionmass;
|
||||
G4double temperature, pressure;
|
||||
|
||||
// use G4-NIST materials data base
|
||||
//
|
||||
// define Elements
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
defaultMaterial = man->FindOrBuildMaterial("G4_Galactic");
|
||||
man->FindOrBuildMaterial("G4_Pb");
|
||||
man->FindOrBuildMaterial("G4_lAr");
|
||||
|
||||
// print table
|
||||
//
|
||||
|
||||
a = 1.01*g/mole;
|
||||
G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
|
||||
|
||||
a = 12.01*g/mole;
|
||||
G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
|
||||
|
||||
a = 14.01*g/mole;
|
||||
G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
|
||||
|
||||
a = 16.00*g/mole;
|
||||
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
|
||||
|
||||
a = 28.09*g/mole;
|
||||
G4Element* Si = new G4Element(name="Silicon",symbol="Si" , z= 14., a);
|
||||
|
||||
//
|
||||
// define an Element from isotopes, by relative abundance
|
||||
//
|
||||
|
||||
G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole);
|
||||
G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole);
|
||||
|
||||
G4Element* U = new G4Element(name="enriched Uranium", symbol="U", ncomponents=2);
|
||||
U->AddIsotope(U5, abundance= 90.*perCent);
|
||||
U->AddIsotope(U8, abundance= 10.*perCent);
|
||||
|
||||
//
|
||||
// define simple materials
|
||||
//
|
||||
|
||||
density = 1.390*g/cm3;
|
||||
a = 39.95*g/mole;
|
||||
G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
|
||||
|
||||
density = 11.35*g/cm3;
|
||||
a = 207.19*g/mole;
|
||||
G4Material* Pb = new G4Material(name="Lead" , z=82., a, density);
|
||||
|
||||
//
|
||||
// define a material from elements. case 1: chemical molecule
|
||||
//
|
||||
|
||||
density = 1.000*g/cm3;
|
||||
G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
|
||||
H2O->AddElement(H, natoms=2);
|
||||
H2O->AddElement(O, natoms=1);
|
||||
|
||||
density = 1.032*g/cm3;
|
||||
G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
|
||||
Sci->AddElement(C, natoms=9);
|
||||
Sci->AddElement(H, natoms=10);
|
||||
|
||||
density = 2.200*g/cm3;
|
||||
G4Material* SiO2 = new G4Material(name="quartz", density, ncomponents=2);
|
||||
SiO2->AddElement(Si, natoms=1);
|
||||
SiO2->AddElement(O , natoms=2);
|
||||
|
||||
//
|
||||
// define a material from elements. case 2: mixture by fractional mass
|
||||
//
|
||||
|
||||
density = 1.290*mg/cm3;
|
||||
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
|
||||
Air->AddElement(N, fractionmass=0.7);
|
||||
Air->AddElement(O, fractionmass=0.3);
|
||||
|
||||
//
|
||||
// define a material from elements and/or others materials (mixture of mixtures)
|
||||
//
|
||||
|
||||
density = 0.200*g/cm3;
|
||||
G4Material* Aerog = new G4Material(name="Aerogel", density, ncomponents=3);
|
||||
Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent);
|
||||
Aerog->AddMaterial(H2O , fractionmass=37.4*perCent);
|
||||
Aerog->AddElement (C , fractionmass= 0.1*perCent);
|
||||
|
||||
//
|
||||
// examples of gas in non STP conditions
|
||||
//
|
||||
|
||||
density = 27.*mg/cm3;
|
||||
pressure = 50.*atmosphere;
|
||||
temperature = 325.*kelvin;
|
||||
G4Material* CO2 = new G4Material(name="CarbonicGas", density, ncomponents=2,
|
||||
kStateGas,temperature,pressure);
|
||||
CO2->AddElement(C, natoms=1);
|
||||
CO2->AddElement(O, natoms=2);
|
||||
|
||||
density = 0.3*mg/cm3;
|
||||
pressure = 2.*atmosphere;
|
||||
temperature = 500.*kelvin;
|
||||
G4Material* steam = new G4Material(name="WaterSteam", density, ncomponents=1,
|
||||
kStateGas,temperature,pressure);
|
||||
steam->AddMaterial(H2O, fractionmass=1.);
|
||||
|
||||
//
|
||||
// examples of vacuum
|
||||
//
|
||||
|
||||
density = universe_mean_density; //from PhysicalConstants.h
|
||||
pressure = 3.e-18*pascal;
|
||||
temperature = 2.73*kelvin;
|
||||
new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,
|
||||
kStateGas,temperature,pressure);
|
||||
|
||||
density = 1.e-5*g/cm3;
|
||||
pressure = 2.e-2*bar;
|
||||
temperature = STP_Temperature; //from PhysicalConstants.h
|
||||
G4Material* beam = new G4Material(name="Beam", density, ncomponents=1,
|
||||
kStateGas,temperature,pressure);
|
||||
beam->AddMaterial(Air, fractionmass=1.);
|
||||
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//default materials of the calorimeter
|
||||
AbsorberMaterial = Pb;
|
||||
GapMaterial = lAr;
|
||||
defaultMaterial = Air;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
{
|
||||
// complete the Calor parameters definition
|
||||
|
||||
// Clean old geometry, if any
|
||||
//
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
|
||||
// complete the Calor parameters definition
|
||||
ComputeCalorParameters();
|
||||
|
||||
//
|
||||
@@ -259,17 +132,17 @@ G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
|
||||
physiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
logicWorld, //its logical volume
|
||||
"World", //its name
|
||||
logicWorld, //its logical volume
|
||||
NULL, //its mother volume
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Calorimeter
|
||||
//
|
||||
solidCalor=NULL; logicCalor=NULL; physiCalor=NULL;
|
||||
solidLayer=NULL; logicLayer=NULL; physiLayer=NULL;
|
||||
solidCalor=0; logicCalor=0; physiCalor=0;
|
||||
solidLayer=0; logicLayer=0; physiLayer=0;
|
||||
|
||||
if (CalorThickness > 0.)
|
||||
{ solidCalor = new G4Box("Calorimeter", //its name
|
||||
@@ -281,9 +154,9 @@ G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
|
||||
physiCalor = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"Calorimeter", //its name
|
||||
logicCalor, //its logical volume
|
||||
physiWorld, //its mother volume
|
||||
"Calorimeter", //its name
|
||||
logicWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
@@ -299,16 +172,16 @@ G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
if (NbOfLayers > 1)
|
||||
physiLayer = new G4PVReplica("Layer", //its name
|
||||
logicLayer, //its logical volume
|
||||
physiCalor, //its mother
|
||||
logicCalor, //its mother
|
||||
kXAxis, //axis of replication
|
||||
NbOfLayers, //number of replica
|
||||
LayerThickness); //witdth of replica
|
||||
else
|
||||
physiLayer = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
logicLayer, //its logical volume
|
||||
"Layer", //its name
|
||||
logicLayer, //its logical volume
|
||||
physiCalor, //its mother volume
|
||||
logicCalor, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
}
|
||||
@@ -316,7 +189,7 @@ G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
//
|
||||
// Absorber
|
||||
//
|
||||
solidAbsorber=NULL; logicAbsorber=NULL; physiAbsorber=NULL;
|
||||
solidAbsorber=0; logicAbsorber=0; physiAbsorber=0;
|
||||
|
||||
if (AbsorberThickness > 0.)
|
||||
{ solidAbsorber = new G4Box("Absorber", //its name
|
||||
@@ -324,13 +197,13 @@ G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
|
||||
logicAbsorber = new G4LogicalVolume(solidAbsorber, //its solid
|
||||
AbsorberMaterial, //its material
|
||||
"Absorber"); //its name
|
||||
AbsorberMaterial->GetName()); //name
|
||||
|
||||
physiAbsorber = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(-GapThickness/2,0.,0.), //its position
|
||||
"Absorber", //its name
|
||||
logicAbsorber, //its logical volume
|
||||
physiLayer, //its mother
|
||||
logicAbsorber, //its logical volume
|
||||
AbsorberMaterial->GetName(), //its name
|
||||
logicLayer, //its mother
|
||||
false, //no boulean operat
|
||||
0); //copy number
|
||||
|
||||
@@ -339,7 +212,7 @@ G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
//
|
||||
// Gap
|
||||
//
|
||||
solidGap=NULL; logicGap=NULL; physiGap=NULL;
|
||||
solidGap=0; logicGap=0; physiGap=0;
|
||||
|
||||
if (GapThickness > 0.)
|
||||
{ solidGap = new G4Box("Gap",
|
||||
@@ -347,50 +220,37 @@ G4VPhysicalVolume* AnaEx01DetectorConstruction::ConstructCalorimeter()
|
||||
|
||||
logicGap = new G4LogicalVolume(solidGap,
|
||||
GapMaterial,
|
||||
"Gap");
|
||||
GapMaterial->GetName());
|
||||
|
||||
physiGap = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(AbsorberThickness/2,0.,0.), //its position
|
||||
"Gap", //its name
|
||||
logicGap, //its logical volume
|
||||
physiLayer, //its mother
|
||||
logicGap, //its logical volume
|
||||
GapMaterial->GetName(), //its name
|
||||
logicLayer, //its mother
|
||||
false, //no boulean operat
|
||||
0); //copy number
|
||||
}
|
||||
|
||||
//
|
||||
// Sensitive Detectors: Absorber and Gap
|
||||
//
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
if(!calorimeterSD)
|
||||
{
|
||||
calorimeterSD = new AnaEx01CalorimeterSD("CalorSD",this);
|
||||
SDman->AddNewDetector( calorimeterSD );
|
||||
}
|
||||
if (logicAbsorber)
|
||||
logicAbsorber->SetSensitiveDetector(calorimeterSD);
|
||||
if (logicGap)
|
||||
logicGap ->SetSensitiveDetector(calorimeterSD);
|
||||
}
|
||||
|
||||
PrintCalorParameters();
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
logicCalor->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
|
||||
//
|
||||
//always return the physical World
|
||||
//
|
||||
PrintCalorParameters();
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::PrintCalorParameters()
|
||||
void DetectorConstruction::PrintCalorParameters()
|
||||
{
|
||||
G4cout << "\n------------------------------------------------------------"
|
||||
<< "\n---> The calorimeter is " << NbOfLayers << " layers of: [ "
|
||||
@@ -400,88 +260,64 @@ void AnaEx01DetectorConstruction::PrintCalorParameters()
|
||||
<< "\n------------------------------------------------------------\n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
|
||||
void DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{AbsorberMaterial = pttoMaterial;
|
||||
logicAbsorber->SetMaterial(pttoMaterial);
|
||||
PrintCalorParameters();
|
||||
}
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial) AbsorberMaterial = pttoMaterial;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::SetGapMaterial(G4String materialChoice)
|
||||
void DetectorConstruction::SetGapMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{GapMaterial = pttoMaterial;
|
||||
logicGap->SetMaterial(pttoMaterial);
|
||||
PrintCalorParameters();
|
||||
}
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial) GapMaterial = pttoMaterial;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::SetAbsorberThickness(G4double val)
|
||||
void DetectorConstruction::SetAbsorberThickness(G4double val)
|
||||
{
|
||||
// change Absorber thickness and recompute the calorimeter parameters
|
||||
AbsorberThickness = val;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::SetGapThickness(G4double val)
|
||||
void DetectorConstruction::SetGapThickness(G4double val)
|
||||
{
|
||||
// change Gap thickness and recompute the calorimeter parameters
|
||||
GapThickness = val;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::SetCalorSizeYZ(G4double val)
|
||||
void DetectorConstruction::SetCalorSizeYZ(G4double val)
|
||||
{
|
||||
// change the transverse size and recompute the calorimeter parameters
|
||||
CalorSizeYZ = val;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::SetNbOfLayers(G4int val)
|
||||
void DetectorConstruction::SetNbOfLayers(G4int val)
|
||||
{
|
||||
NbOfLayers = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorConstruction::SetMagField(G4double fieldValue)
|
||||
{
|
||||
//apply a global uniform magnetic field along Z axis
|
||||
G4FieldManager* fieldMgr
|
||||
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
|
||||
if(magField) delete magField; //delete the existing magn field
|
||||
|
||||
if(fieldValue!=0.) // create a new one if non nul
|
||||
{ magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
|
||||
fieldMgr->SetDetectorField(magField);
|
||||
fieldMgr->CreateChordFinder(magField);
|
||||
} else {
|
||||
magField = NULL;
|
||||
fieldMgr->SetDetectorField(magField);
|
||||
}
|
||||
}
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01DetectorConstruction::UpdateGeometry()
|
||||
void DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+43
-49
@@ -24,121 +24,115 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01DetectorMessenger.cc,v 1.5 2006/06/29 16:33:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: DetectorMessenger.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "AnaEx01DetectorMessenger.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "AnaEx01DetectorConstruction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01DetectorMessenger::AnaEx01DetectorMessenger(AnaEx01DetectorConstruction * AnaEx01Det)
|
||||
:AnaEx01Detector(AnaEx01Det)
|
||||
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
|
||||
:Detector(Det)
|
||||
{
|
||||
AnaEx01detDir = new G4UIdirectory("/calor/");
|
||||
AnaEx01detDir->SetGuidance("AnaEx01 detector control.");
|
||||
|
||||
AbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
|
||||
N03Dir = new G4UIdirectory("/N03/");
|
||||
N03Dir->SetGuidance("UI commands of this example");
|
||||
|
||||
detDir = new G4UIdirectory("/N03/det/");
|
||||
detDir->SetGuidance("detector control");
|
||||
|
||||
AbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
|
||||
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
|
||||
AbsMaterCmd->SetParameterName("choice",false);
|
||||
AbsMaterCmd->AvailableForStates(G4State_Idle);
|
||||
AbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
GapMaterCmd = new G4UIcmdWithAString("/calor/setGapMat",this);
|
||||
GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
|
||||
GapMaterCmd->SetGuidance("Select Material of the Gap.");
|
||||
GapMaterCmd->SetParameterName("choice",false);
|
||||
GapMaterCmd->AvailableForStates(G4State_Idle);
|
||||
GapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
|
||||
AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
|
||||
AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
|
||||
AbsThickCmd->SetParameterName("Size",false);
|
||||
AbsThickCmd->SetRange("Size>=0.");
|
||||
AbsThickCmd->SetUnitCategory("Length");
|
||||
AbsThickCmd->AvailableForStates(G4State_Idle);
|
||||
AbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
GapThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setGapThick",this);
|
||||
GapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
|
||||
GapThickCmd->SetGuidance("Set Thickness of the Gap");
|
||||
GapThickCmd->SetParameterName("Size",false);
|
||||
GapThickCmd->SetRange("Size>=0.");
|
||||
GapThickCmd->SetUnitCategory("Length");
|
||||
GapThickCmd->AvailableForStates(G4State_Idle);
|
||||
GapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setSizeYZ",this);
|
||||
SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
|
||||
SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
|
||||
SizeYZCmd->SetParameterName("Size",false);
|
||||
SizeYZCmd->SetRange("Size>0.");
|
||||
SizeYZCmd->SetUnitCategory("Length");
|
||||
SizeYZCmd->AvailableForStates(G4State_Idle);
|
||||
SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
NbLayersCmd = new G4UIcmdWithAnInteger("/calor/setNbOfLayers",this);
|
||||
NbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
|
||||
NbLayersCmd->SetGuidance("Set number of layers.");
|
||||
NbLayersCmd->SetParameterName("NbLayers",false);
|
||||
NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
|
||||
NbLayersCmd->AvailableForStates(G4State_Idle);
|
||||
NbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
|
||||
UpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
|
||||
UpdateCmd->SetGuidance("Update calorimeter geometry.");
|
||||
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
UpdateCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
|
||||
MagFieldCmd->SetGuidance("Define magnetic field.");
|
||||
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
|
||||
MagFieldCmd->SetParameterName("Bz",false);
|
||||
MagFieldCmd->SetUnitCategory("Magnetic flux density");
|
||||
MagFieldCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01DetectorMessenger::~AnaEx01DetectorMessenger()
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete NbLayersCmd;
|
||||
delete AbsMaterCmd; delete GapMaterCmd;
|
||||
delete AbsThickCmd; delete GapThickCmd;
|
||||
delete SizeYZCmd; delete UpdateCmd;
|
||||
delete MagFieldCmd;
|
||||
delete AnaEx01detDir;
|
||||
delete detDir;
|
||||
delete N03Dir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == AbsMaterCmd )
|
||||
{ AnaEx01Detector->SetAbsorberMaterial(newValue);}
|
||||
{ Detector->SetAbsorberMaterial(newValue);}
|
||||
|
||||
if( command == GapMaterCmd )
|
||||
{ AnaEx01Detector->SetGapMaterial(newValue);}
|
||||
{ Detector->SetGapMaterial(newValue);}
|
||||
|
||||
if( command == AbsThickCmd )
|
||||
{ AnaEx01Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));}
|
||||
{ Detector->SetAbsorberThickness(AbsThickCmd
|
||||
->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == GapThickCmd )
|
||||
{ AnaEx01Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
|
||||
{ Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == SizeYZCmd )
|
||||
{ AnaEx01Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
{ Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == NbLayersCmd )
|
||||
{ AnaEx01Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
|
||||
{ Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == UpdateCmd )
|
||||
{ AnaEx01Detector->UpdateGeometry(); }
|
||||
|
||||
if( command == MagFieldCmd )
|
||||
{ AnaEx01Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
|
||||
{ Detector->UpdateGeometry(); }
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+52
-49
@@ -24,65 +24,68 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01CalorHit.cc,v 1.6 2006/06/29 16:33:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: EventAction.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "AnaEx01CalorHit.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
G4Allocator<AnaEx01CalorHit> AnaEx01CalorHitAllocator;
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
#include "G4Event.hh"
|
||||
|
||||
AnaEx01CalorHit::AnaEx01CalorHit()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction(RunAction* run, HistoManager* histo)
|
||||
:runAct(run),histoManager(histo)
|
||||
{
|
||||
EdepAbs = 0.; TrackLengthAbs = 0.;
|
||||
EdepGap = 0.; TrackLengthGap = 0.;
|
||||
printModulo = 100; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::~EventAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%printModulo == 0)
|
||||
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
|
||||
|
||||
// initialisation per event
|
||||
EnergyAbs = EnergyGap = 0.;
|
||||
TrackLAbs = TrackLGap = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01CalorHit::~AnaEx01CalorHit()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
AnaEx01CalorHit::AnaEx01CalorHit(const AnaEx01CalorHit& right)
|
||||
: G4VHit(right)
|
||||
void EventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
|
||||
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const AnaEx01CalorHit& AnaEx01CalorHit::operator=(const AnaEx01CalorHit& right)
|
||||
{
|
||||
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
|
||||
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
int AnaEx01CalorHit::operator==(const AnaEx01CalorHit& right) const
|
||||
{
|
||||
return (this==&right) ? 1 : 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01CalorHit::Draw()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01CalorHit::Print()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//accumulates statistic
|
||||
//
|
||||
runAct->fillPerEvent(EnergyAbs, EnergyGap, TrackLAbs, TrackLGap);
|
||||
|
||||
//fill histograms
|
||||
//
|
||||
histoManager->FillHisto(1, EnergyAbs);
|
||||
histoManager->FillHisto(2, EnergyGap);
|
||||
histoManager->FillHisto(3, TrackLAbs);
|
||||
histoManager->FillHisto(4, TrackLGap);
|
||||
|
||||
//fill ntuple
|
||||
//
|
||||
histoManager->FillNtuple(0, EnergyAbs);
|
||||
histoManager->FillNtuple(1, EnergyGap);
|
||||
histoManager->FillNtuple(2, TrackLAbs);
|
||||
histoManager->FillNtuple(3, TrackLGap);
|
||||
histoManager->AddRowNtuple();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,239 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: HistoManager.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "HistoManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AIDA/AIDA.h"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::HistoManager()
|
||||
:af(0),tree(0)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Creating the analysis factory
|
||||
//
|
||||
af = AIDA_createAnalysisFactory();
|
||||
if(!af) {
|
||||
G4cout << " HistoManager::HistoManager :"
|
||||
<< " problem creating the AIDA analysis factory."
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// histograms
|
||||
for (G4int k=0; k<MaxHisto; k++) histo[k] = 0;
|
||||
|
||||
// ntuple
|
||||
ntupl = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
delete af;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::book()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(!af) return;
|
||||
|
||||
// Creating a tree container to handle histograms and ntuples.
|
||||
// This tree is associated to an output file.
|
||||
//
|
||||
G4String fileName = "AnaEx01";
|
||||
G4String fileType = "root"; // hbook root xml
|
||||
G4String fileOption = " ";
|
||||
//// G4String fileOption = "uncompress compress=no"; //for xml
|
||||
//// G4String fileOption = "--noErrors"; //for hbook
|
||||
|
||||
fileName = fileName + "." + fileType;
|
||||
G4bool readOnly = false;
|
||||
G4bool createNew = true;
|
||||
AIDA::ITreeFactory* tf = af->createTreeFactory();
|
||||
tree = tf->create(fileName, fileType, readOnly, createNew, fileOption);
|
||||
delete tf;
|
||||
if(!tree) {
|
||||
G4cout << " HistoManager::book :"
|
||||
<< " problem creating the AIDA tree with "
|
||||
<< " storeName = " << fileName
|
||||
<< " storeType = " << fileType
|
||||
<< " readOnly = " << readOnly
|
||||
<< " createNew = " << createNew
|
||||
<< " options = " << fileOption
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Creating a histogram factory, whose histograms will be handled by the tree
|
||||
//
|
||||
AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);
|
||||
|
||||
// create histos in subdirectory "histograms"
|
||||
//
|
||||
tree->mkdir("histograms");
|
||||
tree->cd("histograms");
|
||||
|
||||
histo[1] = hf->createHistogram1D("1", "Edep in absorber", 100, 0., 800*MeV);
|
||||
if (!histo[1]) G4cout << "\n can't create histo 1" << G4endl;
|
||||
histo[2] = hf->createHistogram1D("2", "Edep in gap", 100, 0., 100*MeV);
|
||||
if (!histo[2]) G4cout << "\n can't create histo 2" << G4endl;
|
||||
histo[3] = hf->createHistogram1D("3", "trackL in absorber", 100, 0., 1*m);
|
||||
if (!histo[3]) G4cout << "\n can't create histo 3" << G4endl;
|
||||
histo[4] = hf->createHistogram1D("4", "trackL in gap", 100, 0., 50*cm);
|
||||
if (!histo[4]) G4cout << "\n can't create histo 4" << G4endl;
|
||||
|
||||
delete hf;
|
||||
tree->cd("..");
|
||||
|
||||
// Creating a ntuple factory, handled by the tree
|
||||
//
|
||||
AIDA::ITupleFactory* ntf = af->createTupleFactory(*tree);
|
||||
|
||||
// create 1 ntuple in subdirectory "tuples"
|
||||
//
|
||||
tree->mkdir("tuples");
|
||||
tree->cd("tuples");
|
||||
|
||||
ntupl = ntf->create("101", "Edep and TrackL", "double Eabs, Egap, Labs, Lgap");
|
||||
|
||||
delete ntf;
|
||||
tree->cd("..");
|
||||
|
||||
G4cout << "\n----> Histogram Tree is opened in " << fileName << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::save()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (af && tree) {
|
||||
tree->commit(); // Writing the histograms to the file
|
||||
tree->close(); // and closing the tree (and the file)
|
||||
G4cout << "\n----> Histogram Tree is saved \n" << G4endl;
|
||||
|
||||
delete tree;
|
||||
tree = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::FillHisto(G4int ih, G4double xbin, G4double weight)
|
||||
{
|
||||
if (ih >= MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::FillHisto() : histo " << ih
|
||||
<< " does not exist. (xbin=" << xbin << " weight=" << weight << ")"
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (histo[ih]) histo[ih]->fill(xbin, weight);
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::Normalize(G4int ih, G4double fac)
|
||||
{
|
||||
if (ih >= MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::Normalize() : histo " << ih
|
||||
<< " does not exist. (fac=" << fac << ")" << G4endl;
|
||||
return;
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (histo[ih]) histo[ih]->scale(fac);
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::FillNtuple(G4int column, G4double value)
|
||||
{
|
||||
if (column > 3) {
|
||||
G4cout << "---> warning from HistoManager::FillNtuple : "
|
||||
<< "column=" << column << " value=" << value << G4endl;
|
||||
return;
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (ntupl) ntupl->fill(column, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::AddRowNtuple()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (ntupl) ntupl->addRow();
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::PrintStatistic()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(histo[1]) {
|
||||
G4cout << "\n ----> print histograms statistic \n" << G4endl;
|
||||
|
||||
G4cout
|
||||
<< " EAbs : mean = " << G4BestUnit(histo[1]->mean(), "Energy")
|
||||
<< " rms = " << G4BestUnit(histo[1]->rms(), "Energy") << G4endl;
|
||||
G4cout
|
||||
<< " EGap : mean = " << G4BestUnit(histo[2]->mean(), "Energy")
|
||||
<< " rms = " << G4BestUnit(histo[2]->rms(), "Energy") << G4endl;
|
||||
G4cout
|
||||
<< " LAbs : mean = " << G4BestUnit(histo[3]->mean(), "Length")
|
||||
<< " rms = " << G4BestUnit(histo[3]->rms(), "Length") << G4endl;
|
||||
G4cout
|
||||
<< " LGap : mean = " << G4BestUnit(histo[4]->mean(), "Length")
|
||||
<< " rms = " << G4BestUnit(histo[4]->rms(), "Length") << G4endl;
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: PhysicsList.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
#include "G4BosonConstructor.hh"
|
||||
#include "G4LeptonConstructor.hh"
|
||||
#include "G4MesonConstructor.hh"
|
||||
#include "G4BosonConstructor.hh"
|
||||
#include "G4BaryonConstructor.hh"
|
||||
#include "G4IonConstructor.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsList::PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 1.0*mm;
|
||||
SetVerboseLevel(0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsList::~PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
|
||||
G4BosonConstructor pBosonConstructor;
|
||||
pBosonConstructor.ConstructParticle();
|
||||
|
||||
G4LeptonConstructor pLeptonConstructor;
|
||||
pLeptonConstructor.ConstructParticle();
|
||||
|
||||
G4MesonConstructor pMesonConstructor;
|
||||
pMesonConstructor.ConstructParticle();
|
||||
|
||||
G4BaryonConstructor pBaryonConstructor;
|
||||
pBaryonConstructor.ConstructParticle();
|
||||
|
||||
G4IonConstructor pIonConstructor;
|
||||
pIonConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructDecay();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
#include "G4MuMultipleScattering.hh"
|
||||
#include "G4MuIonisation.hh"
|
||||
#include "G4MuBremsstrahlung.hh"
|
||||
#include "G4MuPairProduction.hh"
|
||||
|
||||
#include "G4hMultipleScattering.hh"
|
||||
#include "G4hIonisation.hh"
|
||||
#include "G4hBremsstrahlung.hh"
|
||||
#include "G4hPairProduction.hh"
|
||||
|
||||
#include "G4ionIonisation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
// gamma
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering);
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4eMultipleScattering,-1, 1, 1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
pmanager->AddProcess(new G4eMultipleScattering,-1, 1, 1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
pmanager->AddProcess(new G4MuMultipleScattering,-1, 1, 1);
|
||||
pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4);
|
||||
|
||||
} else if( particleName == "proton" ||
|
||||
particleName == "pi-" ||
|
||||
particleName == "pi+" ) {
|
||||
//proton
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4hPairProduction, -1, 4, 4);
|
||||
|
||||
} else if( particleName == "alpha" ||
|
||||
particleName == "He3" ) {
|
||||
//alpha
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
|
||||
|
||||
} else if( particleName == "GenericIon" ) {
|
||||
//Ions
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Decay.hh"
|
||||
|
||||
void PhysicsList::ConstructDecay()
|
||||
{
|
||||
// Add Decay Process
|
||||
G4Decay* theDecayProcess = new G4Decay();
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (theDecayProcess->IsApplicable(*particle)) {
|
||||
pmanager ->AddProcess(theDecayProcess);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
//
|
||||
SetCutValue(defaultCutValue, "gamma");
|
||||
SetCutValue(defaultCutValue, "e-");
|
||||
SetCutValue(defaultCutValue, "e+");
|
||||
SetCutValue(defaultCutValue, "proton");
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
+16
-32
@@ -24,36 +24,29 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PrimaryGeneratorAction.cc,v 1.5 2006/06/29 16:33:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: PrimaryGeneratorAction.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "AnaEx01PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "AnaEx01DetectorConstruction.hh"
|
||||
#include "AnaEx01PrimaryGeneratorMessenger.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01PrimaryGeneratorAction::AnaEx01PrimaryGeneratorAction(
|
||||
AnaEx01DetectorConstruction* AnaEx01DC)
|
||||
:AnaEx01Detector(AnaEx01DC),rndmFlag("off")
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
|
||||
:Detector(DC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
//create a messenger for this class
|
||||
gunMessenger = new AnaEx01PrimaryGeneratorMessenger(this);
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
@@ -63,36 +56,27 @@ AnaEx01PrimaryGeneratorAction::AnaEx01PrimaryGeneratorAction(
|
||||
= particleTable->FindParticle(particleName="e-");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
particleGun->SetParticleEnergy(30.*MeV);
|
||||
G4double position = -0.5*(AnaEx01Detector->GetWorldSizeX());
|
||||
particleGun->SetParticleEnergy(500.*MeV);
|
||||
G4double position = -0.5*(Detector->GetWorldSizeX());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01PrimaryGeneratorAction::~AnaEx01PrimaryGeneratorAction()
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete gunMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void AnaEx01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
G4double x0 = -0.5*(AnaEx01Detector->GetWorldSizeX());
|
||||
G4double y0 = 0.*cm, z0 = 0.*cm;
|
||||
if (rndmFlag == "on")
|
||||
{y0 = (AnaEx01Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5);
|
||||
z0 = (AnaEx01Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5);
|
||||
}
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(HistoManager* histo)
|
||||
:histoManager(histo)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
//initialize cumulative quantities
|
||||
//
|
||||
sumEAbs = sum2EAbs =sumEGap = sum2EGap = 0.;
|
||||
sumLAbs = sum2LAbs =sumLGap = sum2LGap = 0.;
|
||||
|
||||
//histograms
|
||||
//
|
||||
histoManager->book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::fillPerEvent(G4double EAbs, G4double EGap,
|
||||
G4double LAbs, G4double LGap)
|
||||
{
|
||||
//accumulate statistic
|
||||
//
|
||||
sumEAbs += EAbs; sum2EAbs += EAbs*EAbs;
|
||||
sumEGap += EGap; sum2EGap += EGap*EGap;
|
||||
|
||||
sumLAbs += LAbs; sum2LAbs += LAbs*LAbs;
|
||||
sumLGap += LGap; sum2LGap += LGap*LGap;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4int NbOfEvents = aRun->GetNumberOfEvent();
|
||||
if (NbOfEvents == 0) return;
|
||||
|
||||
//compute statistics: mean and rms
|
||||
//
|
||||
sumEAbs /= NbOfEvents; sum2EAbs /= NbOfEvents;
|
||||
G4double rmsEAbs = sum2EAbs - sumEAbs*sumEAbs;
|
||||
if (rmsEAbs >0.) rmsEAbs = std::sqrt(rmsEAbs); else rmsEAbs = 0.;
|
||||
|
||||
sumEGap /= NbOfEvents; sum2EGap /= NbOfEvents;
|
||||
G4double rmsEGap = sum2EGap - sumEGap*sumEGap;
|
||||
if (rmsEGap >0.) rmsEGap = std::sqrt(rmsEGap); else rmsEGap = 0.;
|
||||
|
||||
sumLAbs /= NbOfEvents; sum2LAbs /= NbOfEvents;
|
||||
G4double rmsLAbs = sum2LAbs - sumLAbs*sumLAbs;
|
||||
if (rmsLAbs >0.) rmsLAbs = std::sqrt(rmsLAbs); else rmsLAbs = 0.;
|
||||
|
||||
sumLGap /= NbOfEvents; sum2LGap /= NbOfEvents;
|
||||
G4double rmsLGap = sum2LGap - sumLGap*sumLGap;
|
||||
if (rmsLGap >0.) rmsLGap = std::sqrt(rmsLGap); else rmsLGap = 0.;
|
||||
|
||||
//print
|
||||
//
|
||||
G4cout
|
||||
<< "\n--------------------End of Run------------------------------\n"
|
||||
<< "\n mean Energy in Absorber : " << G4BestUnit(sumEAbs,"Energy")
|
||||
<< " +- " << G4BestUnit(rmsEAbs,"Energy")
|
||||
<< "\n mean Energy in Gap : " << G4BestUnit(sumEGap,"Energy")
|
||||
<< " +- " << G4BestUnit(rmsEGap,"Energy")
|
||||
<< G4endl;
|
||||
|
||||
G4cout
|
||||
<< "\n mean trackLength in Absorber : " << G4BestUnit(sumLAbs,"Length")
|
||||
<< " +- " << G4BestUnit(rmsLAbs,"Length")
|
||||
<< "\n mean trackLength in Gap : " << G4BestUnit(sumLGap,"Length")
|
||||
<< " +- " << G4BestUnit(rmsLGap,"Length")
|
||||
<< "\n------------------------------------------------------------\n"
|
||||
<< G4endl;
|
||||
|
||||
//save histograms
|
||||
//
|
||||
histoManager->PrintStatistic();
|
||||
histoManager->save();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+34
-32
@@ -24,47 +24,49 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PrimaryGeneratorMessenger.cc,v 1.5 2006/06/29 16:33:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: SteppingAction.cc,v 1.1 2010/11/08 10:38:44 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
#include "AnaEx01PrimaryGeneratorMessenger.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "AnaEx01PrimaryGeneratorAction.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4Step.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01PrimaryGeneratorMessenger::AnaEx01PrimaryGeneratorMessenger(AnaEx01PrimaryGeneratorAction* AnaEx01Gun)
|
||||
:AnaEx01Action(AnaEx01Gun)
|
||||
{
|
||||
RndmCmd = new G4UIcmdWithAString("/gun/random",this);
|
||||
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
|
||||
RndmCmd->SetGuidance(" Choice : on(default), off");
|
||||
RndmCmd->SetParameterName("choice",true);
|
||||
RndmCmd->SetDefaultValue("on");
|
||||
RndmCmd->SetCandidates("on off");
|
||||
RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
SteppingAction::SteppingAction(DetectorConstruction* det,
|
||||
EventAction* evt)
|
||||
:detector(det), eventaction(evt)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
AnaEx01PrimaryGeneratorMessenger::~AnaEx01PrimaryGeneratorMessenger()
|
||||
SteppingAction::~SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
delete RndmCmd;
|
||||
// get volume of the current step
|
||||
G4VPhysicalVolume* volume
|
||||
= aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
|
||||
|
||||
// collect energy and track length step by step
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
G4double stepl = 0.;
|
||||
if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.)
|
||||
stepl = aStep->GetStepLength();
|
||||
|
||||
if (volume == detector->GetAbsorber()) eventaction->AddAbs(edep,stepl);
|
||||
if (volume == detector->GetGap()) eventaction->AddGap(edep,stepl);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void AnaEx01PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command == RndmCmd )
|
||||
{ AnaEx01Action->SetRndmFlag(newValue);}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Reference in New Issue
Block a user