Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashDetectorConstruction.cc
/// \brief Implementation of the ExGflashDetectorConstruction class
//
// Created by Joanna Weng 26.11.2004
#include <iostream>
// G4 Classes
@@ -40,6 +43,7 @@
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
// User Classes
#include "ExGflashDetectorConstruction.hh"
@@ -60,163 +64,163 @@ m_calo_log(0),
m_experimentalHall_phys(0),
m_calo_phys(0)
{
G4cout<<"ExGflashDetectorConstruction::Detector constructor"<<G4endl;
// Simplified `CMS-like` PbWO4 crystal calorimeter
m_calo_xside=31*cm;
m_calo_yside=31*cm;
m_calo_zside=24*cm;
// GlashStuff
m_theParticleBounds = new GFlashParticleBounds(); // Energy Cuts to kill particles
m_theHMaker = new GFlashHitMaker(); // Makes the EnergieSpots
G4cout<<"ExGflashDetectorConstruction::Detector constructor"<<G4endl;
// Simplified `CMS-like` PbWO4 crystal calorimeter
m_calo_xside=31*cm;
m_calo_yside=31*cm;
m_calo_zside=24*cm;
// GlashStuff
m_theParticleBounds = new GFlashParticleBounds(); // Energy Cuts to kill particles
m_theHMaker = new GFlashHitMaker(); // Makes the EnergieSpots
}
ExGflashDetectorConstruction::~ExGflashDetectorConstruction()
{
//@@@ ExGflashDetectorConstruction::Soll ich alles dlete
delete m_theParameterisation;
delete m_theParticleBounds;
delete m_theHMaker;
delete m_theFastShowerModel;
delete m_theParameterisation;
delete m_theParticleBounds;
delete m_theHMaker;
delete m_theFastShowerModel;
}
G4VPhysicalVolume* ExGflashDetectorConstruction::Construct()
{
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
G4String mat= "PbWO4";
G4cout<<"Defining the materials"<<G4endl;
ExGflashMaterialManager *matManager=ExGflashMaterialManager::GetMaterialManager();
/*******************************
* The Experimental Hall *
*******************************/
m_experimentalHall_x=1000.*cm;
m_experimentalHall_y=1000.*cm;
m_experimentalHall_z=1000.*cm;
m_experimentalHall_box = new G4Box("expHall_box", // World Volume
m_experimentalHall_x, // x size
m_experimentalHall_y, // y size
m_experimentalHall_z); // z size
m_experimentalHall_log = new G4LogicalVolume(m_experimentalHall_box, //its solid
matManager->getMaterial("Air"), //its material
"expHall_log", // its name
0, //opt: fieldManager
0, //opt: SensitiveDetector
0); //opt: UserLimits
m_experimentalHall_phys = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
"expHall", //its name
m_experimentalHall_log, //its logical volume
0, //its mother volume
false, //no boolean operation
0); //copy number
//------------------------------
// Calorimeter segments
//------------------------------
// Simplified `CMS-like` PbWO4 crystal calorimeter
m_NbOfCrystals = 10; // this are the crystals PER ROW in this example
// cube of 10 x 10 crystals
// don't change it @the moment, since
// the readout in event action assumes this
// dimensions and is not automatically adapted
// in this version of the example :-(
m_CrystalWidht = 3*cm;
m_CrystalLenght= 24*cm;
m_calo_xside=(m_CrystalWidht*m_NbOfCrystals)+1*cm;
m_calo_yside=(m_CrystalWidht*m_NbOfCrystals)+1*cm;;
m_calo_zside=m_CrystalLenght;
G4Box *calo_box= new G4Box("CMS calorimeter", //its name
m_calo_xside/2., //size
m_calo_yside/2.,
m_calo_zside/2.);
m_calo_log = new G4LogicalVolume(calo_box, //its solid
matManager->getMaterial("Air"), //its material
"calo log", //its name
0, //opt: fieldManager
0, //opt: SensitiveDetector
0); //opt: UserLimit
G4double Xpos = 0.0;
G4double Ypos = 0.0;
G4double Zpos = 100.0*cm;
m_calo_phys = new G4PVPlacement(0, //no rotation
G4ThreeVector(Xpos,Ypos,Zpos), //at (0,0,0)
m_calo_log, //its logical volume
"calorimeter", //its name
m_experimentalHall_log, //its mother volume
false, //no boolean operation
1);
//Visibility
for (int i=0; i<m_NbOfCrystals;i++)
{
for (int j=0; j<m_NbOfCrystals;j++)
{
int n = i*10+j;
m_crystal[n]= new G4Box("Crystal", //its name
m_CrystalWidht/2,m_CrystalWidht/2,m_CrystalLenght/2); //size
m_crystal_log[n] = new G4LogicalVolume(m_crystal[n], //its solid
matManager->getMaterial(mat), //its material
"Crystal_log"); //its name
m_crystal_phys[n] = new G4PVPlacement(0, //no rotation
G4ThreeVector((i*m_CrystalWidht)-135,(j*m_CrystalWidht)-135,0 ), //at (0,0,0)
m_crystal_log[n], //its logical volume
"crystal", //its name
m_calo_log, //its mother volume
false, //no boolean operation
1); //Visibility
}
}
G4cout << "There are " << m_NbOfCrystals << " crystals per row in the calorimeter, so in total "<<
m_NbOfCrystals*m_NbOfCrystals << " crystals" << G4endl;
G4cout << "The have widthof " << m_CrystalWidht /cm << " cm and a lenght of " << m_CrystalLenght /cm
<<" cm. The Material is "<< matManager->getMaterial(mat) << G4endl;
// Sensitive Detector part
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflashSensitiveDetector* CaloSD=
new ExGflashSensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
m_experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
G4VisAttributes* CaloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
G4VisAttributes* CrystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
m_calo_log->SetVisAttributes(CaloVisAtt);
for (int i=0; i<100;i++)
{
m_crystal_log[i]->SetVisAttributes(CrystalVisAtt);
m_crystal_log[i]->SetSensitiveDetector(CaloSD);
}
// define the parameterisation region
aRegion = new G4Region("crystals");
m_calo_log->SetRegion(aRegion);
aRegion->AddRootLogicalVolume(m_calo_log);
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
G4String mat= "PbWO4";
G4cout<<"Defining the materials"<<G4endl;
ExGflashMaterialManager *matManager=ExGflashMaterialManager::GetMaterialManager();
/**********************************************
* Initializing shower modell
***********************************************/
G4cout<<"Shower parameterization"<<G4endl;
m_theFastShowerModel = new GFlashShowerModel("fastShowerModel",aRegion);
m_theParameterisation = new GFlashHomoShowerParameterisation(matManager->getMaterial(mat));
m_theFastShowerModel->SetParameterisation(*m_theParameterisation);
m_theFastShowerModel->SetParticleBounds(*m_theParticleBounds) ;
m_theFastShowerModel->SetHitMaker(*m_theHMaker);
G4cout<<"end shower parameterization"<<G4endl;
/**********************************************/
return m_experimentalHall_phys;
/*******************************
* The Experimental Hall *
*******************************/
m_experimentalHall_x=1000.*cm;
m_experimentalHall_y=1000.*cm;
m_experimentalHall_z=1000.*cm;
m_experimentalHall_box = new G4Box("expHall_box", // World Volume
m_experimentalHall_x, // x size
m_experimentalHall_y, // y size
m_experimentalHall_z); // z size
m_experimentalHall_log = new G4LogicalVolume(m_experimentalHall_box, //its solid
matManager->getMaterial("Air"), //its material
"expHall_log", // its name
0, //opt: fieldManager
0, //opt: SensitiveDetector
0); //opt: UserLimits
m_experimentalHall_phys = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
"expHall", //its name
m_experimentalHall_log, //its logical volume
0, //its mother volume
false, //no boolean operation
0); //copy number
//------------------------------
// Calorimeter segments
//------------------------------
// Simplified `CMS-like` PbWO4 crystal calorimeter
m_NbOfCrystals = 10; // this are the crystals PER ROW in this example
// cube of 10 x 10 crystals
// don't change it @the moment, since
// the readout in event action assumes this
// dimensions and is not automatically adapted
// in this version of the example :-(
m_CrystalWidht = 3*cm;
m_CrystalLenght= 24*cm;
m_calo_xside=(m_CrystalWidht*m_NbOfCrystals)+1*cm;
m_calo_yside=(m_CrystalWidht*m_NbOfCrystals)+1*cm;;
m_calo_zside=m_CrystalLenght;
G4Box *calo_box= new G4Box("CMS calorimeter", //its name
m_calo_xside/2., //size
m_calo_yside/2.,
m_calo_zside/2.);
m_calo_log = new G4LogicalVolume(calo_box, //its solid
matManager->getMaterial("Air"), //its material
"calo log", //its name
0, //opt: fieldManager
0, //opt: SensitiveDetector
0); //opt: UserLimit
G4double Xpos = 0.0;
G4double Ypos = 0.0;
G4double Zpos = 100.0*cm;
m_calo_phys = new G4PVPlacement(0, //no rotation
G4ThreeVector(Xpos,Ypos,Zpos), //at (0,0,0)
m_calo_log, //its logical volume
"calorimeter", //its name
m_experimentalHall_log, //its mother volume
false, //no boolean operation
1);
//Visibility
for (int i=0; i<m_NbOfCrystals;i++)
{
for (int j=0; j<m_NbOfCrystals;j++)
{
int n = i*10+j;
m_crystal[n]= new G4Box("Crystal", //its name
m_CrystalWidht/2,m_CrystalWidht/2,m_CrystalLenght/2); //size
m_crystal_log[n] = new G4LogicalVolume(m_crystal[n], //its solid
matManager->getMaterial(mat), //its material
"Crystal_log"); //its name
m_crystal_phys[n] = new G4PVPlacement(0, //no rotation
G4ThreeVector((i*m_CrystalWidht)-135,(j*m_CrystalWidht)-135,0 ), //at (0,0,0)
m_crystal_log[n], //its logical volume
"crystal", //its name
m_calo_log, //its mother volume
false, //no boolean operation
1); //Visibility
}
}
G4cout << "There are " << m_NbOfCrystals << " crystals per row in the calorimeter, so in total "<<
m_NbOfCrystals*m_NbOfCrystals << " crystals" << G4endl;
G4cout << "The have widthof " << m_CrystalWidht /cm << " cm and a lenght of " << m_CrystalLenght /cm
<<" cm. The Material is "<< matManager->getMaterial(mat) << G4endl;
// Sensitive Detector part
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflashSensitiveDetector* CaloSD=
new ExGflashSensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
m_experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
G4VisAttributes* CaloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
G4VisAttributes* CrystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
m_calo_log->SetVisAttributes(CaloVisAtt);
for (int i=0; i<100;i++)
{
m_crystal_log[i]->SetVisAttributes(CrystalVisAtt);
m_crystal_log[i]->SetSensitiveDetector(CaloSD);
}
// define the parameterisation region
aRegion = new G4Region("crystals");
m_calo_log->SetRegion(aRegion);
aRegion->AddRootLogicalVolume(m_calo_log);
/**********************************************
* Initializing shower modell
***********************************************/
G4cout<<"Shower parameterization"<<G4endl;
m_theFastShowerModel = new GFlashShowerModel("fastShowerModel",aRegion);
m_theParameterisation = new GFlashHomoShowerParameterisation(matManager->getMaterial(mat));
m_theFastShowerModel->SetParameterisation(*m_theParameterisation);
m_theFastShowerModel->SetParticleBounds(*m_theParticleBounds) ;
m_theFastShowerModel->SetHitMaker(*m_theHMaker);
G4cout<<"end shower parameterization"<<G4endl;
/**********************************************/
return m_experimentalHall_phys;
}
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashEventAction.cc
/// \brief Implementation of the ExGflashEventAction class
//
// Created by Joanna Weng 26.11.2004
@@ -33,6 +36,7 @@
#include "G4UImanager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Event.hh"
#include "G4SystemOfUnits.hh"
//std
#include <iostream>
#include <algorithm>
@@ -52,114 +56,114 @@ nevent(0),dtime(0.0),calorimeterCollectionId(-1)
ExGflashEventAction::~ExGflashEventAction()
{
G4cout << "Internal Real Elapsed Time /event is: "<< dtime /nevent<< G4endl;
G4cout << "Internal Real Elapsed Time /event is: "<< dtime /nevent<< G4endl;
}
void ExGflashEventAction::BeginOfEventAction(const G4Event *evt){
Timerintern.Start();
G4cout<<" ------ Start ExGflashEventAction ----- "<<G4endl;
nevent=evt->GetEventID();
G4cout<<" Start generating event Nr "<<nevent<<G4endl<<G4endl;
Timerintern.Start();
G4cout<<" ------ Start ExGflashEventAction ----- "<<G4endl;
nevent=evt->GetEventID();
G4cout<<" Start generating event Nr "<<nevent<<G4endl<<G4endl;
}
void ExGflashEventAction::EndOfEventAction(const G4Event *evt)
{
Timerintern.Stop();
G4cout << G4endl;
G4cout << "******************************************";
G4cout << G4endl;
G4cout << "Internal Real Elapsed Time is: "<< Timerintern.GetRealElapsed();
G4cout << G4endl;
G4cout << "Internal System Elapsed Time: " << Timerintern.GetSystemElapsed();
G4cout << G4endl;
G4cout << "Internal GetUserElapsed Time: " << Timerintern.GetUserElapsed();
G4cout << G4endl;
G4cout << "******************************************"<< G4endl;
dtime+=Timerintern.GetRealElapsed();
G4cout<<" ------ ExGflashEventAction::End of event nr. "<<nevent<<" -----"<< G4endl;
Timerintern.Stop();
G4cout << G4endl;
G4cout << "******************************************";
G4cout << G4endl;
G4cout << "Internal Real Elapsed Time is: "<< Timerintern.GetRealElapsed();
G4cout << G4endl;
G4cout << "Internal System Elapsed Time: " << Timerintern.GetSystemElapsed();
G4cout << G4endl;
G4cout << "Internal GetUserElapsed Time: " << Timerintern.GetUserElapsed();
G4cout << G4endl;
G4cout << "******************************************"<< G4endl;
dtime+=Timerintern.GetRealElapsed();
G4cout<<" ------ ExGflashEventAction::End of event nr. "<<nevent<<" -----"<< G4endl;
G4SDManager * SDman = G4SDManager::GetSDMpointer();
G4String colNam;
calorimeterCollectionId=SDman->GetCollectionID(colNam="ExGflashCollection");
if (calorimeterCollectionId<0) return;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
ExGflashHitsCollection* THC = 0;
G4double totE = 0;
// Read out of the crysta ECAL
THC=(ExGflashHitsCollection *)(HCE->GetHC(calorimeterCollectionId));
if (THC) {
/// Hits in sensitive Detector
int n_hit = THC->entries();
G4cout<<" " << n_hit<< " hits are stored in ExGflashHitsCollection "<<G4endl;
G4PrimaryVertex* pvertex=evt->GetPrimaryVertex();
///Computing (x,y,z) of vertex of initial particles
G4ThreeVector vtx=pvertex->GetPosition();
G4PrimaryParticle* pparticle=pvertex->GetPrimary();
// direction of the Shower
G4ThreeVector mom=pparticle->GetMomentum()/pparticle->GetMomentum().mag();
//@@@ ExGflashEventAction: Magicnumber
G4double energyincrystal[100];
for (int i=0;i<100;i++) energyincrystal[i]=0.;
//@@@ ExGflashEventAction: Magicnumber
/// For all Hits in sensitive detector
for (int i=0;i<n_hit;i++)
{
G4double estep = (*THC)[i]->GetEdep()/GeV;
if (estep >0.0)
{
totE += (*THC)[i]->GetEdep()/GeV;
G4int num=(*THC)[i]->GetCrystalNum();
energyincrystal[num]+=(*THC)[i]->GetEdep()/GeV;
//G4cout << num << G4endl;
// G4cout << " Crystal Nummer " << (*THC)[i]->GetCrystalNum() << G4endl;
// G4cout << (*THC)[i]->GetCrystalNum() /10 << " "<<(*THC)[i]->GetCrystalNum()%10 << G4endl;
G4ThreeVector hitpos=(*THC)[i]->GetPos();
G4ThreeVector l (hitpos.x(), hitpos.y(), hitpos.z());
// distance from shower start
l = l - vtx;
// projection on shower axis = longitudinal profile
G4ThreeVector longitudinal = l;
// shower profiles (Radial)
G4ThreeVector radial = vtx.cross(l);
}
}
G4double max=0;
G4int index=0;
//Find crystal with maximum energy
for (int i=0;i<100;i++)
{
//G4cout << i <<" " << energyincrystal[i] << G4endl;
if (max <energyincrystal[i])
{
max=energyincrystal[i];
index = i;
}
}
//G4cout << index <<" NMAX " << index << G4endl;
G4SDManager * SDman = G4SDManager::GetSDMpointer();
G4String colNam;
calorimeterCollectionId=SDman->GetCollectionID(colNam="ExGflashCollection");
if (calorimeterCollectionId<0) return;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
ExGflashHitsCollection* THC = 0;
G4double totE = 0;
// Read out of the crysta ECAL
THC=(ExGflashHitsCollection *)(HCE->GetHC(calorimeterCollectionId));
if (THC) {
/// Hits in sensitive Detector
int n_hit = THC->entries();
G4cout<<" " << n_hit<< " hits are stored in ExGflashHitsCollection "<<G4endl;
G4PrimaryVertex* pvertex=evt->GetPrimaryVertex();
///Computing (x,y,z) of vertex of initial particles
G4ThreeVector vtx=pvertex->GetPosition();
G4PrimaryParticle* pparticle=pvertex->GetPrimary();
// direction of the Shower
G4ThreeVector mom=pparticle->GetMomentum()/pparticle->GetMomentum().mag();
//@@@ ExGflashEventAction: Magicnumber
G4double energyincrystal[100];
for (int i=0;i<100;i++) energyincrystal[i]=0.;
//@@@ ExGflashEventAction: Magicnumber
/// For all Hits in sensitive detector
for (int i=0;i<n_hit;i++)
{
G4double estep = (*THC)[i]->GetEdep()/GeV;
if (estep >0.0)
{
totE += (*THC)[i]->GetEdep()/GeV;
G4int num=(*THC)[i]->GetCrystalNum();
energyincrystal[num]+=(*THC)[i]->GetEdep()/GeV;
//G4cout << num << G4endl;
// G4cout << " Crystal Nummer " << (*THC)[i]->GetCrystalNum() << G4endl;
// G4cout << (*THC)[i]->GetCrystalNum() /10 << " "<<(*THC)[i]->GetCrystalNum()%10 << G4endl;
G4ThreeVector hitpos=(*THC)[i]->GetPos();
G4ThreeVector l (hitpos.x(), hitpos.y(), hitpos.z());
// distance from shower start
l = l - vtx;
// projection on shower axis = longitudinal profile
G4ThreeVector longitudinal = l;
// shower profiles (Radial)
G4ThreeVector radial = vtx.cross(l);
}
}
G4double max=0;
G4int index=0;
//Find crystal with maximum energy
for (int i=0;i<100;i++)
{
//G4cout << i <<" " << energyincrystal[i] << G4endl;
if (max <energyincrystal[i])
{
max=energyincrystal[i];
index = i;
}
}
//G4cout << index <<" NMAX " << index << G4endl;
// 3x3 matrix of crystals around the crystal with the maximum energy deposit
G4double e3x3 = energyincrystal[index]+energyincrystal[index+1]+energyincrystal[index-1]+
energyincrystal[index-10]+energyincrystal[index-9]+energyincrystal[index-11]+
energyincrystal[index+10]+energyincrystal[index+11]+energyincrystal[index+9];
// 3x3 matrix of crystals around the crystal with the maximum energy deposit
G4double e3x3 = energyincrystal[index]+energyincrystal[index+1]+energyincrystal[index-1]+
energyincrystal[index-10]+energyincrystal[index-9]+energyincrystal[index-11]+
energyincrystal[index+10]+energyincrystal[index+11]+energyincrystal[index+9];
// 5x5 matrix of crystals around the crystal with the maximum energy deposit
G4double e5x5 = energyincrystal[index]+energyincrystal[index+1]+energyincrystal[index-1]+energyincrystal[index+2]+energyincrystal[index-2]+
energyincrystal[index-10]+energyincrystal[index-9]+energyincrystal[index-11]+energyincrystal[index-8]+energyincrystal[index-12]+
energyincrystal[index+10]+energyincrystal[index+11]+energyincrystal[index+9]+energyincrystal[index+12]+energyincrystal[index+8];
G4cout << " e1 " << energyincrystal[index] << " e3x3 " << e3x3<< " GeV e5x5 " <<e5x5 <<G4endl;
}
G4cout << " Total energy deposited in the calorimeter: " << totE << " (GeV)" << G4endl;
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if(trajectoryContainer){ n_trajectories = trajectoryContainer->entries(); }
G4cout << " " << n_trajectories << " trajectories stored in this event." << G4endl;
// 5x5 matrix of crystals around the crystal with the maximum energy deposit
G4double e5x5 = energyincrystal[index]+energyincrystal[index+1]+energyincrystal[index-1]+energyincrystal[index+2]+energyincrystal[index-2]+
energyincrystal[index-10]+energyincrystal[index-9]+energyincrystal[index-11]+energyincrystal[index-8]+energyincrystal[index-12]+
energyincrystal[index+10]+energyincrystal[index+11]+energyincrystal[index+9]+energyincrystal[index+12]+energyincrystal[index+8];
G4cout << " e1 " << energyincrystal[index] << " e3x3 " << e3x3<< " GeV e5x5 " <<e5x5 <<G4endl;
}
G4cout << " Total energy deposited in the calorimeter: " << totE << " (GeV)" << G4endl;
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if(trajectoryContainer){ n_trajectories = trajectoryContainer->entries(); }
G4cout << " " << n_trajectories << " trajectories stored in this event." << G4endl;
}
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashHit.cc
/// \brief Implementation of the ExGflashHit class
//
#include "ExGflashHit.hh"
@@ -71,9 +74,9 @@ const ExGflashHit & ExGflashHit::operator=(const ExGflashHit &right)
int ExGflashHit::operator==(const ExGflashHit &right) const
{
// @@@@ return 0;
if ((pos==right.pos) && (edep == right.edep)) return true;
else return false;
if ((pos==right.pos) && (edep == right.edep)) return true;
else return false;
}
void ExGflashHit::Draw()
@@ -23,105 +23,110 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashMaterialManager.cc
/// \brief Implementation of the ExGflashMaterialManager class
//
#include "ExGflashMaterialManager.hh"
#include "G4SystemOfUnits.hh"
using namespace std;
ExGflashMaterialManager* ExGflashMaterialManager::mpointer=0;
void ExGflashMaterialManager::storeElement(G4String name,G4String symbol, double z, double a)
{
if (elist.find(symbol)!=elist.end())
{
G4cout<<"attempt of redefining an existing element "<<symbol<<G4endl;
G4cout<<elist[symbol]<<G4endl;
}
else
{
G4Element *newelement=new G4Element(name,symbol,z,a);
elist[symbol]=newelement;
}
if (elist.find(symbol)!=elist.end())
{
G4cout<<"attempt of redefining an existing element "<<symbol<<G4endl;
G4cout<<elist[symbol]<<G4endl;
}
else
{
G4Element *newelement=new G4Element(name,symbol,z,a);
elist[symbol]=newelement;
}
}
G4Element* ExGflashMaterialManager::getElement(G4String symbol)
{
if (elist.find(symbol)==elist.end())
{
G4cout<<" element "<<symbol<<" not found!"<<G4endl;
return NULL;
}
else
return elist[symbol];
if (elist.find(symbol)==elist.end())
{
G4cout<<" element "<<symbol<<" not found!"<<G4endl;
return NULL;
}
else
return elist[symbol];
}
void ExGflashMaterialManager::storeMaterial(G4String name, double z, double a, double d)
{
if (mlist.find(name)!=mlist.end())
{
G4cout<<"attempt of redefining an existing material "<<G4endl;
G4cout<<mlist[name]<<G4endl;
}
else
{
G4Material *newmaterial=new G4Material(name,z,a,d);
mlist[name]=newmaterial;
}
if (mlist.find(name)!=mlist.end())
{
G4cout<<"attempt of redefining an existing material "<<G4endl;
G4cout<<mlist[name]<<G4endl;
}
else
{
G4Material *newmaterial=new G4Material(name,z,a,d);
mlist[name]=newmaterial;
}
}
void ExGflashMaterialManager::storeMaterial(G4String name, double d, int ncomponent)
{
if (mlist.find(name)!=mlist.end())
{
G4cout<<"attempt of redefining an existing material "<<G4endl;
G4cout<<mlist[name]<<G4endl;
}
else
{
G4Material *newmaterial=new G4Material(name,d,ncomponent);
mlist[name]=newmaterial;
}
if (mlist.find(name)!=mlist.end())
{
G4cout<<"attempt of redefining an existing material "<<G4endl;
G4cout<<mlist[name]<<G4endl;
}
else
{
G4Material *newmaterial=new G4Material(name,d,ncomponent);
mlist[name]=newmaterial;
}
}
G4Material* ExGflashMaterialManager::getMaterial(G4String name)
{
if (mlist.find(name)==mlist.end())
{
G4cout<<" material "<<name<<" not found!"<<G4endl;
return NULL;
}
else
{
// G4cout<<"returning material "<<name<<G4endl;
return mlist[name];
}
if (mlist.find(name)==mlist.end())
{
G4cout<<" material "<<name<<" not found!"<<G4endl;
return NULL;
}
else
{
// G4cout<<"returning material "<<name<<G4endl;
return mlist[name];
}
}
void ExGflashMaterialManager::addMaterial(G4String n1,G4String n2,double fraction)
{
G4Material *mat=getMaterial(n1);
mat->AddMaterial(getMaterial(n2),fraction);
G4Material *mat=getMaterial(n1);
mat->AddMaterial(getMaterial(n2),fraction);
}
void ExGflashMaterialManager::addElement(G4String n1,G4String n2,double fraction)
{
G4Material *mat=getMaterial(n1);
mat->AddElement(getElement(n2),fraction);
G4Material *mat=getMaterial(n1);
mat->AddElement(getElement(n2),fraction);
}
void ExGflashMaterialManager::addElement(G4String n1,G4String n2,int natoms)
{
G4Material *mat=getMaterial(n1);
mat->AddElement(getElement(n2),natoms);
G4Material *mat=getMaterial(n1);
mat->AddElement(getElement(n2),natoms);
}
void ExGflashMaterialManager::printMaterialTable()
{
MaterialList::iterator it;
for (it=mlist.begin();it!=mlist.end();it++) G4cout<<(*it).second<<G4endl;
MaterialList::iterator it;
for (it=mlist.begin();it!=mlist.end();it++) G4cout<<(*it).second<<G4endl;
}
void ExGflashMaterialManager::printElementTable()
{
ElementList::iterator it;
for (it=elist.begin();it!=elist.end();it++) G4cout<<(*it).second<<G4endl;
ElementList::iterator it;
for (it=elist.begin();it!=elist.end();it++) G4cout<<(*it).second<<G4endl;
}
void ExGflashMaterialManager::initialize()
@@ -129,57 +134,57 @@ void ExGflashMaterialManager::initialize()
G4String name,symbol;
double z,a,density;
int ncomponents,natoms;
//double fraction;
storeElement(name="Hydrogen",symbol="H" , z= 1., a=1.01*g/mole);
storeElement(name="Carbon" ,symbol="C" , z= 6., a=12.01*g/mole);
storeElement(name="Nitrogen",symbol="N" , z= 7., a=14.01*g/mole);
storeElement(name="Oxygen" ,symbol="O" , z= 8., a=16.00*g/mole);
storeElement(name="Silicon",symbol="Si" , z= 14., a=28.09*g/mole);
storeElement(name="Argon",symbol="Ar",z=18.,a=39.95*g/mole);
storeElement(name="Iron" ,symbol="Fe", z=26., a=55.85*g/mole);
storeElement(name="Aluminum",symbol="Al",z=13.,a=26.98*g/mole);
storeElement(name="Lead",symbol="Pb",z=82.,a=207.19*g/mole);
storeElement(name="Fluorine",symbol="F",z=9.,a=18.99*g/mole);
storeElement(name="Chlorine",symbol="Cl",z=17.,a=35.45*g/mole);
storeElement(name="Tungsten",symbol="W",z=74.,a=183.85*g/mole);
storeMaterial(name="Aluminium", z=13., a = 26.98*g/mole, density = 2.700*g/cm3);
storeMaterial(name="Iron",z=26., a=55.85*g/mole, density=7.87*g/cm3);
storeMaterial(name="Copper",z=29.,a=63.546*g/mole, density=8.96*g/cm3);
storeMaterial(name="Silicon",z=14.,a=28.0855*g/mole, density=2.33*g/cm3);
storeMaterial(name="Tungsten",z=74.,a=183.85*g/mole, density = 19.3*g/cm3 );
storeMaterial(name="Lead" , z=82., a= 207.19*g/mole,density = 11.35*g/cm3);
storeMaterial(name="LAr",z=18.,a=39.95*g/mole,density =1.39*g/cm3);
storeMaterial(name="Scintillator", density=1.032*g/cm3, ncomponents=2);
addElement("Scintillator","C",natoms=9);
addElement("Scintillator","H",natoms=10);
storeMaterial(name="PbWO4", density=8.28*g/cm3, ncomponents=3);
addElement("PbWO4","Pb",natoms=1);
addElement("PbWO4","W",natoms=1);
addElement("PbWO4","O",natoms=4);
// addElement("PbWO4","Pb", fraction=0.45532661 );
// addElement("PbWO4","W", fraction=0.40403397 );
// addElement("PbWO4","O", fraction=0.14063942);
storeMaterial(name="Air" , density=1.290*mg/cm3, ncomponents=2);
addElement("Air", "N", .7);
addElement("Air", "O", .3);
storeMaterial(name="CO2", density=1.977*mg/1000*cm3,ncomponents=2);
addElement("CO2","C",natoms=1);
addElement("CO2","O",natoms=2);
storeMaterial(name="ArCO2",density=1.8*mg/1000*cm3,ncomponents=2);
addElement("ArCO2","Ar",.93);
addMaterial("ArCO2","CO2",.07);
storeMaterial(name="RPCgas", density=1.977*mg/1000*cm3,ncomponents=3);
addElement("RPCgas","C",natoms=2);
addElement("RPCgas","H",natoms=2);
addElement("RPCgas","F",natoms=4);
storeMaterial(name="RPVC", density=1.4*g/cm3,ncomponents=3);
addElement("RPVC","C",natoms=2);
addElement("RPVC","H",natoms=3);
addElement("RPVC","Cl",natoms=1);
storeMaterial(name="Bakelite", density=1.4*g/cm3,ncomponents=3);
addElement("Bakelite","C",natoms=1);
addElement("Bakelite","H",natoms=4);
addElement("Bakelite","O",natoms=2);
//double fraction;
storeElement(name="Hydrogen",symbol="H" , z= 1., a=1.01*g/mole);
storeElement(name="Carbon" ,symbol="C" , z= 6., a=12.01*g/mole);
storeElement(name="Nitrogen",symbol="N" , z= 7., a=14.01*g/mole);
storeElement(name="Oxygen" ,symbol="O" , z= 8., a=16.00*g/mole);
storeElement(name="Silicon",symbol="Si" , z= 14., a=28.09*g/mole);
storeElement(name="Argon",symbol="Ar",z=18.,a=39.95*g/mole);
storeElement(name="Iron" ,symbol="Fe", z=26., a=55.85*g/mole);
storeElement(name="Aluminum",symbol="Al",z=13.,a=26.98*g/mole);
storeElement(name="Lead",symbol="Pb",z=82.,a=207.19*g/mole);
storeElement(name="Fluorine",symbol="F",z=9.,a=18.99*g/mole);
storeElement(name="Chlorine",symbol="Cl",z=17.,a=35.45*g/mole);
storeElement(name="Tungsten",symbol="W",z=74.,a=183.85*g/mole);
storeMaterial(name="Aluminium", z=13., a = 26.98*g/mole, density = 2.700*g/cm3);
storeMaterial(name="Iron",z=26., a=55.85*g/mole, density=7.87*g/cm3);
storeMaterial(name="Copper",z=29.,a=63.546*g/mole, density=8.96*g/cm3);
storeMaterial(name="Silicon",z=14.,a=28.0855*g/mole, density=2.33*g/cm3);
storeMaterial(name="Tungsten",z=74.,a=183.85*g/mole, density = 19.3*g/cm3 );
storeMaterial(name="Lead" , z=82., a= 207.19*g/mole,density = 11.35*g/cm3);
storeMaterial(name="LAr",z=18.,a=39.95*g/mole,density =1.39*g/cm3);
storeMaterial(name="Scintillator", density=1.032*g/cm3, ncomponents=2);
addElement("Scintillator","C",natoms=9);
addElement("Scintillator","H",natoms=10);
storeMaterial(name="PbWO4", density=8.28*g/cm3, ncomponents=3);
addElement("PbWO4","Pb",natoms=1);
addElement("PbWO4","W",natoms=1);
addElement("PbWO4","O",natoms=4);
// addElement("PbWO4","Pb", fraction=0.45532661 );
// addElement("PbWO4","W", fraction=0.40403397 );
// addElement("PbWO4","O", fraction=0.14063942);
storeMaterial(name="Air" , density=1.290*mg/cm3, ncomponents=2);
addElement("Air", "N", .7);
addElement("Air", "O", .3);
storeMaterial(name="CO2", density=1.977*mg/1000*cm3,ncomponents=2);
addElement("CO2","C",natoms=1);
addElement("CO2","O",natoms=2);
storeMaterial(name="ArCO2",density=1.8*mg/1000*cm3,ncomponents=2);
addElement("ArCO2","Ar",.93);
addMaterial("ArCO2","CO2",.07);
storeMaterial(name="RPCgas", density=1.977*mg/1000*cm3,ncomponents=3);
addElement("RPCgas","C",natoms=2);
addElement("RPCgas","H",natoms=2);
addElement("RPCgas","F",natoms=4);
storeMaterial(name="RPVC", density=1.4*g/cm3,ncomponents=3);
addElement("RPVC","C",natoms=2);
addElement("RPVC","H",natoms=3);
addElement("RPVC","Cl",natoms=1);
storeMaterial(name="Bakelite", density=1.4*g/cm3,ncomponents=3);
addElement("Bakelite","C",natoms=1);
addElement("Bakelite","H",natoms=4);
addElement("Bakelite","O",natoms=2);
}
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashPhysicsList.cc
/// \brief Implementation of the ExGflashPhysicsList class
//
#include "ExGflashPhysicsList.hh"
#include "globals.hh"
@@ -59,13 +62,13 @@ void ExGflashPhysicsList::ConstructParticle()
// This ensures that objects of these particle types will be
// created in the program.
std::cout<<"start construct particle"<<std::endl;
std::cout<<"start construct particle"<<std::endl;
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBaryons();
ConstructIons();
std::cout<<"end construct particle"<<std::endl;
std::cout<<"end construct particle"<<std::endl;
}
void ExGflashPhysicsList::ConstructBosons()
@@ -115,16 +118,16 @@ void ExGflashPhysicsList::ConstructIons()
void ExGflashPhysicsList::ConstructProcess()
{
// std::cout<<"1111"<<std::endl;
// std::cout<<"1111"<<std::endl;
AddTransportation();
// std::cout<<"2222"<<std::endl;
// std::cout<<"2222"<<std::endl;
AddParameterisation();
std::cout<<"AddParameterisation"<<std::endl;
ConstructEM();
std::cout<<"ConstructEM"<<std::endl;
ConstructGeneral();
// std::cout<<"5555"<<std::endl;
// std::cout<<"5555"<<std::endl;
}
@@ -259,8 +262,8 @@ void ExGflashPhysicsList::ConstructEM()
pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
// all others charged particles except geantino
G4VProcess* aMultipleScattering = new G4hMultipleScattering();
G4VProcess* anIonisation = new G4hIonisation();
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashPrimaryGeneratorAction.cc
/// \brief Implementation of the ExGflashPrimaryGeneratorAction class
//
#include "ExGflashPrimaryGeneratorAction.hh"
#include "G4Event.hh"
@@ -32,15 +35,15 @@
ExGflashPrimaryGeneratorAction::ExGflashPrimaryGeneratorAction()
{
particleGun=new G4GeneralParticleSource;
particleGun=new G4GeneralParticleSource;
}
ExGflashPrimaryGeneratorAction::~ExGflashPrimaryGeneratorAction()
{
delete particleGun;
delete particleGun;
}
void ExGflashPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashRunAction.cc
/// \brief Implementation of the ExGflashRunAction class
//
#include "ExGflashRunAction.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parameterisations/gflash/src/ExGflashSensitiveDetector.cc
/// \brief Implementation of the ExGflashSensitiveDetector class
//
// Created by Joanna Weng 26.11.2004
#include "ExGflashSensitiveDetector.hh"
#include "ExGflashHitsCollection.hh"
@@ -38,77 +41,77 @@ using namespace std;
ExGflashSensitiveDetector::ExGflashSensitiveDetector(G4String name, ExGflashDetectorConstruction* det):
G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), Detector(det)
{
//@@@@ xN08SensitiveDetector:: evtl name im constructor des G4VGFlashSensitiveDetector ?
G4String caloname="ExGflashCollection";
collectionName.insert(caloname);
//@@@@ xN08SensitiveDetector:: evtl name im constructor des G4VGFlashSensitiveDetector ?
G4String caloname="ExGflashCollection";
collectionName.insert(caloname);
}
ExGflashSensitiveDetector::~ExGflashSensitiveDetector() {}
void ExGflashSensitiveDetector::Initialize(G4HCofThisEvent*HCE)
{
G4cout<<"::Initializing the sensitive detector"<<G4endl;
static G4int HCID = -1;
if(HCID<0){ HCID = GetCollectionID(0); }
caloHitsCollection=new
ExGflashHitsCollection(SensitiveDetectorName,collectionName[0]); // first collection
HCE->AddHitsCollection( HCID, caloHitsCollection );
G4cout<<"::Initializing the sensitive detector"<<G4endl;
static G4int HCID = -1;
if(HCID<0){ HCID = GetCollectionID(0); }
caloHitsCollection=new
ExGflashHitsCollection(SensitiveDetectorName,collectionName[0]); // first collection
HCE->AddHitsCollection( HCID, caloHitsCollection );
}
void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*HCE)
{
if (HCE){;}
// No Hadronic
// cout<<"IEndOfEvent " << HCID << endl;
if (HCE){;}
// No Hadronic
// cout<<"IEndOfEvent " << HCID << endl;
}
G4bool ExGflashSensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{ //cout<<"This is ProcessHits"<<endl;
G4double e=aStep->GetTotalEnergyDeposit();
if(e<=0.)return false;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
{ //cout<<"This is ProcessHits"<<endl;
G4double e=aStep->GetTotalEnergyDeposit();
if(e<=0.)return false;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
// enrgy deposited -> make Hit
//const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
//G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
ExGflashHit* caloHit=new ExGflashHit();
caloHit->SetEdep(e);
caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
caloHitsCollection->insert(caloHit);
if (ROhist){;}
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int crystalnum=0;
for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
{
if(physVol == Detector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;
// enrgy deposited -> make Hit
//const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
//G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
ExGflashHit* caloHit=new ExGflashHit();
caloHit->SetEdep(e);
caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
caloHitsCollection->insert(caloHit);
if (ROhist){;}
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int crystalnum=0;
for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
{
if(physVol == Detector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;
}
// Separate GFLASH interface
G4bool ExGflashSensitiveDetector::ProcessHits(G4GFlashSpot*aSpot ,G4TouchableHistory* ROhist)
{ //cout<<"This is ProcessHits GFLASH"<<endl;
G4double e=aSpot->GetEnergySpot()->GetEnergy();
if(e<=0.)return false;
G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume();
ExGflashHit* caloHit=new ExGflashHit();
caloHit->SetEdep(e);
caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
caloHitsCollection->insert(caloHit);
if (ROhist){;}
//cout <<pCurrentVolume->GetName() << endl;
G4int crystalnum=0;
for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
{
if(pCurrentVolume == Detector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;
{ //cout<<"This is ProcessHits GFLASH"<<endl;
G4double e=aSpot->GetEnergySpot()->GetEnergy();
if(e<=0.)return false;
G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume();
ExGflashHit* caloHit=new ExGflashHit();
caloHit->SetEdep(e);
caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
caloHitsCollection->insert(caloHit);
if (ROhist){;}
//cout <<pCurrentVolume->GetName() << endl;
G4int crystalnum=0;
for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
{
if(pCurrentVolume == Detector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;
}