Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * 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: ExGflashActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file ExGflashActionInitialization.cc
/// \brief Implementation of the ExGflashActionInitialization class
#include "ExGflashActionInitialization.hh"
#include "ExGflashPrimaryGeneratorAction.hh"
#include "ExGflashRunAction.hh"
#include "ExGflashEventAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashActionInitialization::ExGflashActionInitialization()
: G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashActionInitialization::~ExGflashActionInitialization()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashActionInitialization::BuildForMaster() const
{
// SetUserAction(new ExGflashRunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashActionInitialization::Build() const
{
SetUserAction(new ExGflashPrimaryGeneratorAction);
SetUserAction(new ExGflashRunAction);
SetUserAction(new ExGflashEventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExGflashDetectorConstruction.cc 73006 2013-08-15 08:17:11Z gcosmo $
//
/// \file parameterisations/gflash/src/ExGflashDetectorConstruction.cc
/// \brief Implementation of the ExGflashDetectorConstruction class
//
// Created by Joanna Weng 26.11.2004
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <iostream>
// G4 Classes
#include "globals.hh"
@@ -36,6 +42,7 @@
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4Box.hh"
#include "G4NistManager.hh"
#include "G4SDManager.hh"
#include "G4Material.hh"
#include "G4GeometryManager.hh"
@@ -48,7 +55,7 @@
// User Classes
#include "ExGflashDetectorConstruction.hh"
#include "ExGflashSensitiveDetector.hh"
#include "ExGflashMaterialManager.hh"
//fast simulation
#include "GFlashHomoShowerParameterisation.hh"
#include "G4FastSimulationManager.hh"
@@ -58,181 +65,211 @@
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashDetectorConstruction::ExGflashDetectorConstruction()
:m_experimentalHall_log(0),
m_calo_log(0),
m_experimentalHall_phys(0),
m_calo_phys(0)
:fExperimentalHall_log(0),
fCalo_log(0),
fExperimentalHall_phys(0),
fCalo_phys(0),
fTheParameterisation(0),
fTheHMaker(0),
fTheParticleBounds(0),
fTheFastShowerModel(0)
{
G4cout<<"ExGflashDetectorConstruction::Detector constructor"<<G4endl;
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;
fCalo_xside=31*cm;
fCalo_yside=31*cm;
fCalo_zside=24*cm;
// GlashStuff
m_theParticleBounds = new GFlashParticleBounds(); // Energy Cuts to kill particles
m_theHMaker = new GFlashHitMaker(); // Makes the EnergieSpots
//Energy Cuts to kill particles
// fTheParticleBounds = new GFlashParticleBounds();
// Makes the EnergieSpots
// fTheHMaker = new GFlashHitMaker();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashDetectorConstruction::~ExGflashDetectorConstruction()
{
//@@@ ExGflashDetectorConstruction::Soll ich alles dlete
delete m_theParameterisation;
delete m_theParticleBounds;
delete m_theHMaker;
delete m_theFastShowerModel;
//@@@ ExGflashDetectorConstruction::Soll ich alles dlete
// -- !! this is not properly deleted in MT where
// -- !! as there is one parameterisation/thread
// -- !! and only the last one is remembered.
if ( fTheParameterisation ) delete fTheParameterisation;
if ( fTheParticleBounds ) delete fTheParticleBounds;
if ( fTheHMaker ) delete fTheHMaker;
if ( fTheFastShowerModel ) delete fTheFastShowerModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExGflashDetectorConstruction::Construct()
{
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
G4String mat= "PbWO4";
G4cout<<"Defining the materials"<<G4endl;
ExGflashMaterialManager *matManager=ExGflashMaterialManager::GetMaterialManager();
G4cout << "Defining the materials" << G4endl;
// Get nist material manager
G4NistManager* nistManager = G4NistManager::Instance();
// Build materials
G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
/*******************************
* The Experimental Hall *
*******************************/
m_experimentalHall_x=1000.*cm;
m_experimentalHall_y=1000.*cm;
m_experimentalHall_z=1000.*cm;
* The Experimental Hall *
*******************************/
fExperimentalHall_x=1000.*cm;
fExperimentalHall_y=1000.*cm;
fExperimentalHall_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
fExperimentalHall_box = new G4Box("expHall_box", // World Volume
fExperimentalHall_x, // x size
fExperimentalHall_y, // y size
fExperimentalHall_z); // z size
fExperimentalHall_log = new G4LogicalVolume(fExperimentalHall_box,
air,
"expHall_log",
0, //opt: fieldManager
0, //opt: SensitiveDetector
0); //opt: UserLimits
fExperimentalHall_phys = new G4PVPlacement(0,
G4ThreeVector(), //at (0,0,0)
"expHall",
fExperimentalHall_log,
0,
false,
0);
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
fNbOfCrystals = 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 :-(
fCrystalWidth = 3*cm;
fCrystalLenght= 24*cm;
fCalo_xside=(fCrystalWidth*fNbOfCrystals)+1*cm;
fCalo_yside=(fCrystalWidth*fNbOfCrystals)+1*cm;
fCalo_zside=fCrystalLenght;
G4Box *calo_box= new G4Box("CMS calorimeter", // its name
fCalo_xside/2., // size
fCalo_yside/2.,
fCalo_zside/2.);
fCalo_log = new G4LogicalVolume(calo_box, // its solid
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;
fCalo_phys = new G4PVPlacement(0,
G4ThreeVector(Xpos,Ypos,Zpos),
fCalo_log,
"calorimeter",
fExperimentalHall_log,
false,
1);
//Visibility
for (int i=0; i<fNbOfCrystals;i++)
{
for (int j=0; j<fNbOfCrystals;j++)
{
int n = i*10+j;
fCrystal[n]= new G4Box("Crystal", // its name
fCrystalWidth/2,
fCrystalWidth/2,
fCrystalLenght/2); // size
fCrystal_log[n] = new G4LogicalVolume(fCrystal[n], // its solid
pbWO4, // its material
"Crystal_log"); // its name
G4ThreeVector crystalPos((i*fCrystalWidth)-135,
(j*fCrystalWidth)-135,0 );
fCrystal_phys[n] = new G4PVPlacement(0, // no rotation
crystalPos, // translation
fCrystal_log[n],
"crystal", // its name
fCalo_log,
false,
1);
}
}
G4cout << "There are " << fNbOfCrystals <<
" crystals per row in the calorimeter, so in total "<<
fNbOfCrystals*fNbOfCrystals << " crystals" << G4endl;
G4cout << "The have widthof " << fCrystalWidth /cm <<
" cm and a lenght of " << fCrystalLenght /cm
<<" cm. The Material is "<< pbWO4 << G4endl;
// Sensitive Detector part
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflashSensitiveDetector* CaloSD=
new ExGflashSensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
m_experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
fExperimentalHall_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);
fCalo_log->SetVisAttributes(CaloVisAtt);
for (int i=0; i<100;i++)
{
m_crystal_log[i]->SetVisAttributes(CrystalVisAtt);
m_crystal_log[i]->SetSensitiveDetector(CaloSD);
}
{
fCrystal_log[i]->SetVisAttributes(CrystalVisAtt);
}
// define the parameterisation region
aRegion = new G4Region("crystals");
m_calo_log->SetRegion(aRegion);
aRegion->AddRootLogicalVolume(m_calo_log);
fRegion = new G4Region("crystals");
fCalo_log->SetRegion(fRegion);
fRegion->AddRootLogicalVolume(fCalo_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;
return fExperimentalHall_phys;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashDetectorConstruction::ConstructSDandField()
{
// -- sensitive detectors:
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflashSensitiveDetector* CaloSD=
new ExGflashSensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
for (int i=0; i<100;i++)
{
fCrystal_log[i]->SetSensitiveDetector(CaloSD);
}
// Get nist material manager
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
// -- fast simulation models:
// **********************************************
// * Initializing shower modell
// ***********************************************
G4cout << "Creating shower parameterization models" << G4endl;
GFlashShowerModel* lTheFastShowerModel =
new GFlashShowerModel("fastShowerModel",fRegion);
GFlashHomoShowerParameterisation* lTheParameterisation =
new GFlashHomoShowerParameterisation(pbWO4);
lTheFastShowerModel->SetParameterisation(*lTheParameterisation);
// Energy Cuts to kill particles:
GFlashParticleBounds* lTheParticleBounds = new GFlashParticleBounds();
lTheFastShowerModel->SetParticleBounds(*lTheParticleBounds);
// Makes the EnergieSpots
GFlashHitMaker* lTheHMaker = new GFlashHitMaker();
lTheFastShowerModel->SetHitMaker(*lTheHMaker);
G4cout<<"end shower parameterization."<<G4endl;
// **********************************************
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExGflashEventAction.cc 75838 2013-11-06 17:25:50Z gcosmo $
//
/// \file parameterisations/gflash/src/ExGflashEventAction.cc
/// \brief Implementation of the ExGflashEventAction class
//
@@ -43,62 +45,59 @@
//Gflash
using namespace std;
#include "G4Timer.hh"
extern G4Timer Timer;
extern G4Timer Timerintern;
ExGflashEventAction::ExGflashEventAction():
nevent(0),dtime(0.0),calorimeterCollectionId(-1)
fNevent(0),fDtime(0.0),fCalorimeterCollectionId(-1)
{
}
ExGflashEventAction::~ExGflashEventAction()
{
G4cout << "Internal Real Elapsed Time /event is: "<< dtime /nevent<< G4endl;
if ( fNevent > 0 ) G4cout << "Internal Real Elapsed Time /event is: "<< fDtime /fNevent<< G4endl;
}
void ExGflashEventAction::BeginOfEventAction(const G4Event *evt){
Timerintern.Start();
void ExGflashEventAction::BeginOfEventAction(const G4Event *evt)
{
fTimerIntern.Start();
G4cout<<" ------ Start ExGflashEventAction ----- "<<G4endl;
nevent=evt->GetEventID();
G4cout<<" Start generating event Nr "<<nevent<<G4endl<<G4endl;
fNevent=evt->GetEventID();
G4cout<<" Start generating event Nr "<<fNevent<<G4endl<<G4endl;
}
void ExGflashEventAction::EndOfEventAction(const G4Event *evt)
{
Timerintern.Stop();
fTimerIntern.Stop();
G4cout << G4endl;
G4cout << "******************************************";
G4cout << G4endl;
G4cout << "Internal Real Elapsed Time is: "<< Timerintern.GetRealElapsed();
G4cout << "Internal Real Elapsed Time is: "<< fTimerIntern.GetRealElapsed();
G4cout << G4endl;
G4cout << "Internal System Elapsed Time: " << Timerintern.GetSystemElapsed();
G4cout << "Internal System Elapsed Time: " << fTimerIntern.GetSystemElapsed();
G4cout << G4endl;
G4cout << "Internal GetUserElapsed Time: " << Timerintern.GetUserElapsed();
G4cout << "Internal GetUserElapsed Time: " << fTimerIntern.GetUserElapsed();
G4cout << G4endl;
G4cout << "******************************************"<< G4endl;
dtime+=Timerintern.GetRealElapsed();
G4cout<<" ------ ExGflashEventAction::End of event nr. "<<nevent<<" -----"<< G4endl;
fDtime+=fTimerIntern.GetRealElapsed();
G4cout<<" ------ ExGflashEventAction::End of event nr. "<<fNevent<<" -----"<< G4endl;
G4SDManager * SDman = G4SDManager::GetSDMpointer();
G4String colNam;
calorimeterCollectionId=SDman->GetCollectionID(colNam="ExGflashCollection");
if (calorimeterCollectionId<0) return;
fCalorimeterCollectionId=SDman->GetCollectionID(colNam="ExGflashCollection");
if (fCalorimeterCollectionId<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();
THC=(ExGflashHitsCollection *)(HCE->GetHC(fCalorimeterCollectionId));
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();
@@ -110,53 +109,60 @@ void ExGflashEventAction::EndOfEventAction(const G4Event *evt)
//@@@ 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 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;
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];
// 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 << 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];
// 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;
@@ -164,6 +170,7 @@ void ExGflashEventAction::EndOfEventAction(const G4Event *evt)
G4int n_trajectories = 0;
if(trajectoryContainer){ n_trajectories = trajectoryContainer->entries(); }
G4cout << " " << n_trajectories << " trajectories stored in this event." << G4endl;
}
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExGflashHit.cc 72372 2013-07-16 14:30:39Z gcosmo $
//
/// \file parameterisations/gflash/src/ExGflashHit.cc
/// \brief Implementation of the ExGflashHit class
//
@@ -35,13 +37,13 @@
#include "G4LogicalVolume.hh"
#include "G4ios.hh"
G4Allocator<ExGflashHit>ExGflashHitAllocator;
G4ThreadLocal G4Allocator<ExGflashHit>* ExGflashHitAllocator=0;
ExGflashHit::ExGflashHit()
{pLogV=NULL;}
{fLogV=NULL;}
ExGflashHit::ExGflashHit(G4LogicalVolume* logVol)
:pLogV(logVol)
:fLogV(logVol)
{;}
ExGflashHit::~ExGflashHit()
@@ -51,30 +53,30 @@ ExGflashHit::ExGflashHit(const ExGflashHit &right)
:G4VHit()
//@@@ ExGflashHit:Is it right with the init?
{
edep = right.edep;
pos = right.pos;
start =right.start;
rot = right.rot;
pLogV = right.pLogV;
crystalnumber = right.crystalnumber;
fEdep = right.fEdep;
fPos = right.fPos;
fStart =right.fStart;
fRot = right.fRot;
fLogV = right.fLogV;
fCrystalNumber = right.fCrystalNumber;
}
const ExGflashHit & ExGflashHit::operator=(const ExGflashHit &right)
{
edep = right.edep;
start =right.start;
pos = right.pos;
rot = right.rot;
pLogV = right.pLogV;
crystalnumber = right.crystalnumber;
crystalnumber = right.crystalnumber;
fEdep = right.fEdep;
fStart =right.fStart;
fPos = right.fPos;
fRot = right.fRot;
fLogV = right.fLogV;
fCrystalNumber = right.fCrystalNumber;
fCrystalNumber = right.fCrystalNumber;
return *this;
}
int ExGflashHit::operator==(const ExGflashHit &right) const
{
// @@@@ return 0;
if ((pos==right.pos) && (edep == right.edep)) return true;
if ((fPos==right.fPos) && (fEdep == right.fEdep)) return true;
else return false;
}
@@ -84,15 +86,15 @@ void ExGflashHit::Draw()
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Transform3D trans(rot,pos);
G4Transform3D trans(fRot,fPos);
G4VisAttributes attribs;
const G4VisAttributes* pVA = pLogV->GetVisAttributes();
const G4VisAttributes* pVA = fLogV->GetVisAttributes();
if(pVA) attribs = *pVA;
G4Colour colour(1.,0.,0.);
attribs.SetColour(colour);
attribs.SetForceWireframe(false);
attribs.SetForceSolid(true);
pVVisManager->Draw(*pLogV,attribs,trans);
pVVisManager->Draw(*fLogV,attribs,trans);
}
}
@@ -1,200 +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. *
// ********************************************************************
//
/// \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;
}
}
G4Element* ExGflashMaterialManager::getElement(G4String 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;
}
}
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;
}
}
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];
}
}
void ExGflashMaterialManager::addMaterial(G4String n1,G4String n2,double 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);
}
void ExGflashMaterialManager::addElement(G4String n1,G4String n2,int 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;
}
void ExGflashMaterialManager::printElementTable()
{
ElementList::iterator it;
for (it=elist.begin();it!=elist.end();it++) G4cout<<(*it).second<<G4endl;
}
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);
}
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExGflashPhysicsList.cc 70923 2013-06-07 13:10:39Z gcosmo $
//
/// \file parameterisations/gflash/src/ExGflashPhysicsList.cc
/// \brief Implementation of the ExGflashPhysicsList class
//
@@ -118,16 +120,13 @@ void ExGflashPhysicsList::ConstructIons()
void ExGflashPhysicsList::ConstructProcess()
{
// std::cout<<"1111"<<std::endl;
AddTransportation();
// std::cout<<"2222"<<std::endl;
AddParameterisation();
std::cout<<"AddParameterisation"<<std::endl;
ConstructEM();
std::cout<<"ConstructEM"<<std::endl;
ConstructGeneral();
// std::cout<<"5555"<<std::endl;
}
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExGflashPrimaryGeneratorAction.cc 70923 2013-06-07 13:10:39Z gcosmo $
//
/// \file parameterisations/gflash/src/ExGflashPrimaryGeneratorAction.cc
/// \brief Implementation of the ExGflashPrimaryGeneratorAction class
//
@@ -35,15 +37,15 @@
ExGflashPrimaryGeneratorAction::ExGflashPrimaryGeneratorAction()
{
particleGun=new G4GeneralParticleSource;
fParticleGun=new G4GeneralParticleSource;
}
ExGflashPrimaryGeneratorAction::~ExGflashPrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
void ExGflashPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExGflashRunAction.cc 70923 2013-06-07 13:10:39Z gcosmo $
//
/// \file parameterisations/gflash/src/ExGflashRunAction.cc
/// \brief Implementation of the ExGflashRunAction class
//
@@ -35,7 +37,7 @@
ExGflashRunAction::ExGflashRunAction(): runID(0)
ExGflashRunAction::ExGflashRunAction(): fRunID(0)
{
}
@@ -47,7 +49,7 @@ ExGflashRunAction::~ExGflashRunAction()
void ExGflashRunAction::BeginOfRunAction(const G4Run* aRun)
{
((G4Run *)(aRun))->SetRunID(runID++);
((G4Run *)(aRun))->SetRunID(fRunID++);
std::cout << "### Run " << aRun->GetRunID() << " start." << std::endl;
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExGflashSensitiveDetector.cc 72372 2013-07-16 14:30:39Z gcosmo $
//
/// \file parameterisations/gflash/src/ExGflashSensitiveDetector.cc
/// \brief Implementation of the ExGflashSensitiveDetector class
//
@@ -37,11 +39,13 @@
#include "G4SDManager.hh"
#include <iostream>
using namespace std;
//WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
ExGflashSensitiveDetector::ExGflashSensitiveDetector(G4String name, ExGflashDetectorConstruction* det):
G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), Detector(det)
ExGflashSensitiveDetector::ExGflashSensitiveDetector(G4String name,
ExGflashDetectorConstruction* det):
G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), HCID(-1)
{
//@@@@ xN08SensitiveDetector:: evtl name im constructor des G4VGFlashSensitiveDetector ?
G4String caloname="ExGflashCollection";
collectionName.insert(caloname);
}
@@ -50,12 +54,10 @@ 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
fCaloHitsCollection=new
ExGflashHitsCollection(SensitiveDetectorName,collectionName[0]); // first collection
HCE->AddHitsCollection( HCID, caloHitsCollection );
HCE->AddHitsCollection( HCID, fCaloHitsCollection );
}
void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*HCE)
@@ -66,27 +68,28 @@ void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*HCE)
}
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());
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
// enrgy deposited -> make Hit
//const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
//G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
//G4TouchableHistory* theTouchable =
// (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
ExGflashHit* caloHit=new ExGflashHit();
caloHit->SetEdep(e);
caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
caloHitsCollection->insert(caloHit);
fCaloHitsCollection->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;
}
{
if(physVol == fDetector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;
@@ -103,14 +106,14 @@ G4bool ExGflashSensitiveDetector::ProcessHits(G4GFlashSpot*aSpot ,G4TouchableHis
ExGflashHit* caloHit=new ExGflashHit();
caloHit->SetEdep(e);
caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
caloHitsCollection->insert(caloHit);
fCaloHitsCollection->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;
}
{
if(pCurrentVolume == fDetector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;