Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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 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(ExGflashDetectorConstruction* det)
: G4VUserActionInitialization(), fDetector(det)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashActionInitialization::~ExGflashActionInitialization()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashActionInitialization::BuildForMaster() const
{
SetUserAction(new ExGflashRunAction(fDetector));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashActionInitialization::Build() const
{
SetUserAction(new ExGflashPrimaryGeneratorAction);
SetUserAction(new ExGflashRunAction(fDetector));
SetUserAction(new ExGflashEventAction(fDetector));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,322 @@
//
// ********************************************************************
// * 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 ExGflashDetectorConstruction.cc
/// \brief Implementation of the ExGflashDetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// User Classes
#include "ExGflashDetectorConstruction.hh"
#include "ExGflashSensitiveDetector.hh"
#include "ExGflashMessenger.hh"
#include "ExGflashHomoShowerTuning.hh"
// G4 Classes
#include "G4RunManager.hh"
#include "G4NistManager.hh"
#include "G4Material.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4AutoDelete.hh"
#include "globals.hh"
//fast simulation
#include "GFlashHomoShowerParameterisation.hh"
#include "G4FastSimulationManager.hh"
#include "GFlashShowerModel.hh"
#include "GFlashHitMaker.hh"
#include "GFlashParticleBounds.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal GFlashShowerModel* ExGflashDetectorConstruction::fFastShowerModel = 0;
G4ThreadLocal
GFlashHomoShowerParameterisation* ExGflashDetectorConstruction::fParameterisation = 0;
G4ThreadLocal GFlashParticleBounds* ExGflashDetectorConstruction::fParticleBounds = 0;
G4ThreadLocal GFlashHitMaker* ExGflashDetectorConstruction::fHitMaker = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4int kMaxBin = 500;
//const G4int kMaxRowCol = 50;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashDetectorConstruction::ExGflashDetectorConstruction()
:G4VUserDetectorConstruction(),fNbOfCrystals(10),
fCrystal_log(0),fDetMat(0),fRegion(0),
fVerbose(0),fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1)
{
G4cout<<"ExGflashDetectorConstruction::Detector constructor"<<G4endl;
fGflashMessenger = new ExGflashMessenger(this);
// Crystall
fCrystalWidth = 3*cm;
fCrystalLength = 24*cm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashDetectorConstruction::~ExGflashDetectorConstruction()
{
delete fGflashMessenger;
delete fFastShowerModel;
delete fParameterisation;
delete fParticleBounds;
delete fHitMaker;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExGflashDetectorConstruction::Construct()
{
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
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");
fDetMat = pbWO4;
//------------------------------
// Calorimeter segments
//------------------------------
// Simplified `CMS-like` PbWO4 crystal calorimeter
// Simplified `CMS-like` PbWO4 crystal calorimeter
// Calorimeter
G4double calo_xside = (fCrystalWidth*fNbOfCrystals);
G4double calo_yside = (fCrystalWidth*fNbOfCrystals);
G4double calo_zside = fCrystalLength;
//The Experimental Hall
G4double experimentalHall_x=calo_xside * 4;
G4double experimentalHall_y=calo_yside * 4;
G4double experimentalHall_z=calo_zside * 4;
G4VSolid* experimentalHall_box
= new G4Box("expHall_box", // World Volume
experimentalHall_x, // x size
experimentalHall_y, // y size
experimentalHall_z); // z size
G4LogicalVolume* experimentalHall_log
= new G4LogicalVolume(experimentalHall_box,
air,
"expHall_log",
0, //opt: fieldManager
0, //opt: SensitiveDetector
0); //opt: UserLimits
G4VPhysicalVolume* experimentalHall_phys
= new G4PVPlacement(0,
G4ThreeVector(), //at (0,0,0)
"expHall",
experimentalHall_log,
0,
false,
0);
G4Box* calo_box= new G4Box("Calorimeter", // its name
calo_xside/2., // size
calo_yside/2.,
calo_zside/2.);
G4LogicalVolume* calo_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 = calo_zside/2.;// face @ z= 0.0
new G4PVPlacement(0,
G4ThreeVector(xpos, ypos, zpos),
calo_log,
"calorimeter",
experimentalHall_log,
false,
1);
// Crystals
G4VSolid* crystal_box
= new G4Box("Crystal", // its name
fCrystalWidth/2,
fCrystalWidth/2,
fCrystalLength/2);
// size
fCrystal_log
= new G4LogicalVolume(crystal_box, // its solid
fDetMat, // its material
"Crystal_log"); // its name
for (G4int i=0; i<fNbOfCrystals; i++)
{
for (G4int j=0; j<fNbOfCrystals; j++)
{
G4int n = i*10+j;
G4ThreeVector crystalPos((i*fCrystalWidth)-(calo_xside-fCrystalWidth)/2.,
(j*fCrystalWidth)-(calo_yside-fCrystalWidth)/2.,0 );
new G4PVPlacement(0, // no rotation
crystalPos, // translation
fCrystal_log,
"crystal", // its name
calo_log,
false,
n);
}
}
G4cout << "There are " << fNbOfCrystals <<
" crystals per row in the calorimeter, so in total "<<
fNbOfCrystals*fNbOfCrystals << " crystals" << G4endl;
G4cout << "Total Calorimeter size" << calo_xside / cm << " cm x "
<< calo_yside / cm << " cm x "
<< calo_zside / cm << " cm" << G4endl;
G4cout << "They have width of " << fCrystalWidth /cm <<
" cm and a length of " << fCrystalLength /cm
<<" cm. The Material is "<< fDetMat
<<" Total: "<< fCrystalLength / fDetMat->GetRadlen()
<<" X0" << G4endl;
experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
G4VisAttributes* crystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
calo_log->SetVisAttributes(caloVisAtt);
fCrystal_log->SetVisAttributes(crystalVisAtt);
// define the fParameterisation region
G4cout << "\n ---> DetectorConstruction Region Definition" << G4endl;
fRegion = new G4Region("crystals");
calo_log->SetRegion(fRegion);
fRegion->AddRootLogicalVolume(calo_log);
return experimentalHall_phys;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashDetectorConstruction::ConstructSDandField()
{
// -- sensitive detectors:
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflashSensitiveDetector* SD =
new ExGflashSensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(SD);
if (fCrystal_log)
fCrystal_log->SetSensitiveDetector(SD);
// -- fast simulation models:
// **********************************************
// * Initializing shower modell
// ***********************************************
G4cout << "\n--> Creating shower parameterization models" << G4endl;
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
fParameterisation =
new GFlashHomoShowerParameterisation(fDetMat,
new ExGflashHomoShowerTuning());
fFastShowerModel->SetParameterisation(*fParameterisation);
// Energy Cuts to kill particles:
fParticleBounds = new GFlashParticleBounds();
fFastShowerModel->SetParticleBounds(*fParticleBounds);
// Makes the EnergieSpots
fHitMaker = new GFlashHitMaker();
fFastShowerModel->SetHitMaker(*fHitMaker);
G4cout<<"end shower parameterization."<<G4endl;
// **********************************************
// Get Rad Len and R molere ?
fSDRadLen = fDetMat->GetRadlen();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashDetectorConstruction::SetLBining(G4ThreeVector Value)
{
fNLtot = (G4int)Value(0);
if (fNLtot > kMaxBin) {
G4cout << "\n ---> warning from SetLBining: "
<< fNLtot << " truncated to " << kMaxBin << G4endl;
fNLtot = kMaxBin;
}
fDLradl = Value(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashDetectorConstruction::SetRBining(G4ThreeVector Value)
{
fNRtot = (G4int)Value(0);
if (fNRtot > kMaxBin) {
G4cout << "\n ---> warning from SetRBining: "
<< fNRtot << " truncated to " << kMaxBin << G4endl;
fNRtot = kMaxBin;
}
fDRradl = Value(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashDetectorConstruction::SetMaterial(G4String mat)
{
// search the material by its name
G4Material* pttoMaterial =
G4NistManager::Instance()->FindOrBuildMaterial(mat);
if(pttoMaterial && fDetMat != pttoMaterial) {
fDetMat = pttoMaterial;
if(fCrystal_log) { fCrystal_log->SetMaterial(fDetMat); }
if(fParameterisation) {
fParameterisation->SetMaterial(fDetMat);
fParameterisation->PrintMaterial(fDetMat);
// Get Rad Len and R molere ?
fSDRadLen = fDetMat->GetRadlen();
}
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,169 @@
//
// ********************************************************************
// * 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 ExGflashEventAction.cc
/// \brief Implementation of the ExGflashEventAction class
//
// Created by Joanna Weng 26.11.2004
#include "ExGflashEventAction.hh"
#include "ExGflashHit.hh"
#include "ExGflashHistoManager.hh"
#include "ExGflashDetectorConstruction.hh"
#include "G4EventManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4Event.hh"
#include "G4SystemOfUnits.hh"
//std
#include <iostream>
#include <algorithm>
#include <vector>
typedef std::vector<G4double> MyVector;
//Gflash
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashEventAction::ExGflashEventAction(ExGflashDetectorConstruction* det)
: G4UserEventAction(),fCalorimeterCollectionId(-1),fDet(det)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashEventAction::~ExGflashEventAction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashEventAction::BeginOfEventAction(const G4Event * /* evt */)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashEventAction::EndOfEventAction(const G4Event *evt)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
G4String colNam;
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(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->GetMomentumDirection();
G4double Ekin=pparticle->GetKineticEnergy();
G4double mass=pparticle->GetParticleDefinition()->GetPDGMass();
G4double Etot = Ekin/MeV + mass/MeV;
G4int nLbin = fDet->GetnLtot();
G4int nRbin = fDet->GetnRtot();
G4double dLradl = fDet->GetdLradl();
G4double dRradl = fDet->GetdRradl();
G4double SDRadl = fDet->GetSDRadLen(); // SD matrial
// init to to 0.0
MyVector dEdL(nLbin,0.0);
MyVector dEdR(nRbin,0.0);
G4AnalysisManager* fAnalysisManager = G4AnalysisManager::Instance();
fAnalysisManager->FillH1(1,n_hit + 0.5);
/// For all Hits in sensitive detector
for (int i=0;i<n_hit;i++)
{
G4double estep = (*THC)[i]->GetEdep();
fAnalysisManager->FillH1(2,estep/MeV);
estep /= MeV;
if (estep >0.0)
{
totE += estep;
G4ThreeVector hitpos=(*THC)[i]->GetPos();
// in shower coordinate system
// from shower start
G4ThreeVector l = hitpos - vtx;
//longitudinal profile
G4ThreeVector longitudinal = l.dot(mom) * mom;
// shower profiles (Radial)
G4ThreeVector radial = l - longitudinal;
G4int SlideNb = G4int((longitudinal.mag()/SDRadl) / dLradl);
G4int RingNb = G4int((radial.mag()/SDRadl) / dRradl);
if ( SlideNb >=0 && SlideNb < nLbin) dEdL[SlideNb] += estep;
if ( RingNb >=0 && RingNb < nLbin)dEdR[RingNb] += estep;
}
}
G4double Lnorm = 100. / dLradl / Etot;
G4double Lsum = 0.0;
for (int i=0;i<nLbin;i++)
{ // Slide
// fAnalysisManager->FillH1(3,(i +0.5) * dLradl,dEdL[i] * Lnorm);
fAnalysisManager->FillP1(0,(i +0.5) * dLradl,dEdL[i] * Lnorm);
Lsum += dEdL[i];
fAnalysisManager->FillP1(2,(i +0.5) * dLradl,Lsum * Lnorm);
}
G4double Rnorm = 100. / dRradl / Etot;
G4double Rsum = 0.0;
for (int i=0;i<nRbin;i++)
{ // Ring
// fAnalysisManager->FillH1(4,(i +0.5) * dRradl,dEdR[i] * Rnorm);
fAnalysisManager->FillP1(1,(i +0.5) * dRradl,dEdR[i] * Rnorm);
Rsum += dEdR[i];
fAnalysisManager->FillP1(3,(i +0.5) * dRradl,Rsum * Rnorm);
}
fAnalysisManager->FillH1(0,totE/Etot * 100.);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,110 @@
//
// ********************************************************************
// * 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 ExGflashHistoManager.cc
/// \brief Implementation of the ExGflasHistoManager class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExGflashHistoManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "ExGflashDetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashHistoManager::ExGflashHistoManager(ExGflashDetectorConstruction* myDet)
: fFileName("gflash01"),fDet(myDet)
{
Book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashHistoManager::~ExGflashHistoManager()
{
delete G4AnalysisManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashHistoManager::Book()
{
// Create or get analysis manager
// The choice of analysis technology is done via selection of a namespace
// in ExGflashHistoManager.hh
G4AnalysisManager* fAnalysisManager = G4AnalysisManager::Instance();
fAnalysisManager->SetFileName(fFileName);
fAnalysisManager->SetVerboseLevel(1);
fAnalysisManager->SetActivation(true); // enable inactivation of histograms
//
// Creating histograms
//
// const G4int kMaxHisto = 9;
// const G4int kMaxProf = 2;
G4int nLbin = fDet->GetnLtot();
G4int nRbin = fDet->GetnRtot();
G4double dLradl = fDet->GetdLradl();
G4double dRradl = fDet->GetdRradl();
fAnalysisManager->CreateH1( "h0","total energy deposit(percent of Einc)",
100,95.,105.);
fAnalysisManager->CreateH1( "h1","The number of Hits per event",
200,0.,4.0e5);
fAnalysisManager->CreateH1( "h2","The energy of Hit (in MeV)",
200,0.,10.);
// fAnalysisManager->CreateH1( "h3","longit energy profile (% of E inc)",
// nLbin,0.,nLbin*dLradl);
// fAnalysisManager->CreateH1( "h4","radial energy profile (% of E inc)",
// nRbin,0.,nRbin*dRradl);
fAnalysisManager->CreateP1( "p0","longit energy profile (% of E inc)",
nLbin,0.,nLbin*dLradl, 0., 2000.);
fAnalysisManager->CreateP1( "p1","radial energy profile (% of E inc)",
nRbin,0.,nRbin*dRradl, 0., 2000.);
fAnalysisManager->CreateP1( "p2","Comul longit energy profile (% of E inc)",
nLbin,0.,nLbin*dLradl, 0., 20000.);
fAnalysisManager->CreateP1( "p3","Cuml radial energy profile (% of E inc)",
nRbin,0.,nRbin*dRradl, 0., 20000.);
// Create all histograms as inactivated
// for (G4int k=0; k<kMaxHisto; k++) {
// fAnalysisManager->SetH1Activation(k, false);
// }
// for (G4int k=0; k<kMaxProf; k++) {
// fAnalysisManager->SetP1Activation(k, false);
// }
G4cout << "\n----> Histogram file " << fFileName << G4endl;
}
@@ -0,0 +1,106 @@
// ********************************************************************
// * 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 ExGflashHit.cc
/// \brief Implementation of the ExGflashHit class
//
#include "ExGflashHit.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal G4Allocator<ExGflashHit>* ExGflashHitAllocator=0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashHit::ExGflashHit()
: G4VHit()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashHit::~ExGflashHit()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashHit::ExGflashHit(const ExGflashHit &right)
: G4VHit(right)
//@@@ ExGflashHit:Is it right with the init?
{
fEdep = right.fEdep;
fPos = right.fPos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const ExGflashHit & ExGflashHit::operator=(const ExGflashHit &right)
{
G4VHit::operator=(right);
fEdep = right.fEdep;
fPos = right.fPos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExGflashHit::operator==(const ExGflashHit &right) const
{
// @@@@ return false;
if ((fPos==right.fPos) && (fEdep == right.fEdep)) return true;
else return false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(fPos);
circle.SetScreenSize(0.04);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashHit::Print()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * 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 ExGflashMessenger.cc
/// \brief Implementation of the ExGflashMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExGflashMessenger.hh"
#include "ExGflashDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashMessenger::ExGflashMessenger(ExGflashDetectorConstruction * Det)
:G4UImessenger(),fDetector(Det)
{
fExGflashDir = new G4UIdirectory("/exgflash/");
fExGflashDir->SetGuidance(" Gflash example commands.");
fVerbose = new G4UIcmdWithAnInteger("/exgflash/verbose",this);
fVerbose->SetGuidance("set exglash verbosity");
fVerbose->SetGuidance("0- silent, 1 - on exit, 2 - run , 3 - event");
fVerbose->SetParameterName("ver",false);
fVerbose->SetRange("ver >= 0");
fVerbose->AvailableForStates(G4State_PreInit,G4State_Idle);
fVerbose->SetToBeBroadcasted(false);
fDetDir = new G4UIdirectory("/exgflash/det/");
fDetDir->SetGuidance("detector construction commands");
fMaterCmd = new G4UIcmdWithAString("/exgflash/det/setMat",this);
fMaterCmd->SetGuidance("Select Material.");
fMaterCmd->SetParameterName("material",false);
fMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fMaterCmd->SetToBeBroadcasted(false);
fLBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setLbin",this);
fLBinCmd->SetGuidance("set longitudinal bining");
fLBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
// must have omitable==true we use 2 values only
fLBinCmd->SetParameterName("nLtot","dLradl"," ",true);
fLBinCmd->SetRange("nLtot>=1 && dLradl>0");
fLBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fLBinCmd->SetToBeBroadcasted(false);
fRBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setRbin",this);
fRBinCmd->SetGuidance("set radial bining");
fRBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
fRBinCmd->SetParameterName("nRtot","dRradl"," ",true);
fRBinCmd->SetRange("nRtot>=1 && dRradl>0");
fRBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRBinCmd->SetToBeBroadcasted(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashMessenger::~ExGflashMessenger()
{
delete fRBinCmd;
delete fLBinCmd;
delete fMaterCmd;
delete fDetDir;
delete fVerbose;
delete fExGflashDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == fMaterCmd )
{ fDetector->SetMaterial(newValue);}
if( command == fVerbose )
{ fDetector->SetVerbose(fVerbose->GetNewIntValue(newValue));}
if( command == fLBinCmd )
{ fDetector->SetLBining(fLBinCmd->GetNew3VectorValue(newValue));}
if( command == fRBinCmd )
{ fDetector->SetRBining(fRBinCmd->GetNew3VectorValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,56 @@
// ********************************************************************
// * 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 ExGflashPrimaryGeneratorAction.cc
/// \brief Implementation of the ExGflashPrimaryGeneratorAction class
//
#include "ExGflashPrimaryGeneratorAction.hh"
#include "G4GeneralParticleSource.hh"
#include "G4Event.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashPrimaryGeneratorAction::ExGflashPrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
{
fParticleGun=new G4GeneralParticleSource;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashPrimaryGeneratorAction::~ExGflashPrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,90 @@
// ********************************************************************
// * 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 ExGflashRunAction.cc
/// \brief Implementation of the ExGflashRunAction class
//
#include "ExGflashRunAction.hh"
#include "G4Run.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashRunAction::ExGflashRunAction(ExGflashDetectorConstruction* det)
// : G4UserRunAction(), fRunID(0), fDetector(det)
: G4UserRunAction(), fDetector(det)
{
fHistoManager = new ExGflashHistoManager(fDetector);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashRunAction::~ExGflashRunAction()
{
delete fHistoManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashRunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
//histograms file
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
if (analysis->IsActive()) analysis->OpenFile();
if (IsMaster()) fRunTimer.Start();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashRunAction::EndOfRunAction(const G4Run* aRun)
{
if (IsMaster()) {
// For MT we need Timer Merge
fRunTimer.Stop();
G4cout << G4endl;
G4cout << "******************************************";
G4cout << G4endl;
G4cout << "Run Real Elapsed Time is: "<< fRunTimer.GetRealElapsed();
G4cout << G4endl;
G4cout << "Run System Elapsed Time: " << fRunTimer.GetSystemElapsed();
G4cout << G4endl;
G4cout << "Run GetUserElapsed Time: " << fRunTimer.GetUserElapsed();
G4cout << G4endl;
G4cout << "******************************************"<< G4endl;
G4cout << "number of event = " << aRun->GetNumberOfEvent() << G4endl;
}
//save histograms
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
if (analysis->IsActive()) {
analysis->Write();
analysis->CloseFile();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,106 @@
// ********************************************************************
// * 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 ExGflashSensitiveDetector.cc
/// \brief Implementation of the ExGflashSensitiveDetector class
//
// Created by Joanna Weng 26.11.2004
#include "ExGflashSensitiveDetector.hh"
#include "ExGflashHit.hh"
#include "G4GFlashSpot.hh"
#include "ExGflashDetectorConstruction.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
//WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashSensitiveDetector::ExGflashSensitiveDetector(G4String name,
ExGflashDetectorConstruction* /* det */)
// : G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), fHCID(-1)
: G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fHCID(-1)
{
G4String caloname="ExGflashCollection";
collectionName.insert(caloname);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashSensitiveDetector::~ExGflashSensitiveDetector()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashSensitiveDetector::Initialize(G4HCofThisEvent* HCE)
{
if(fHCID<0){ fHCID = GetCollectionID(0); }
fCaloHitsCollection=new
ExGflashHitsCollection(SensitiveDetectorName,collectionName[0]); // first collection
HCE->AddHitsCollection( fHCID, fCaloHitsCollection );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExGflashSensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory* /* ROhist */)
{
G4double e=aStep->GetTotalEnergyDeposit();
if(e<=0.)return false;
ExGflashHit* caloHit=new ExGflashHit();
caloHit->SetEdep(e);
caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
fCaloHitsCollection->insert(caloHit);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// 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());
fCaloHitsCollection->insert(caloHit);
// if (ROhist){;}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......