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,214 @@
//
// ********************************************************************
// * 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 ExGflash3DetectorConstruction.cc
/// \brief Implementation of the ExGflash3DetectorConstruction class
//
// Created by Joanna Weng 26.11.2004
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// User Classes
#include "ExGflash3DetectorConstruction.hh"
// G4 Classes
#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* ExGflash3DetectorConstruction::fFastShowerModel = 0;
G4ThreadLocal
GFlashHomoShowerParameterisation* ExGflash3DetectorConstruction::fParameterisation = 0;
G4ThreadLocal GFlashParticleBounds* ExGflash3DetectorConstruction::fParticleBounds = 0;
G4ThreadLocal GFlashHitMaker* ExGflash3DetectorConstruction::fHitMaker = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflash3DetectorConstruction::ExGflash3DetectorConstruction()
:G4VUserDetectorConstruction(), fRegion(nullptr)
{
G4cout<<"ExGflash3DetectorConstruction::Detector constructor"<<G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflash3DetectorConstruction::~ExGflash3DetectorConstruction()
{
delete fFastShowerModel;
delete fParameterisation;
delete fParticleBounds;
delete fHitMaker;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExGflash3DetectorConstruction::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");
/*******************************
* The Experimental Hall *
*******************************/
G4double experimentalHall_x=1000.*cm;
G4double experimentalHall_y=1000.*cm;
G4double experimentalHall_z=1000.*cm;
G4VSolid* experimentalHall_box
= new G4Box("expHall_box", // World Volume
experimentalHall_x, // x size
experimentalHall_y, // y size
experimentalHall_z); // z size
G4LogicalVolume* experimentalHallLog
= new G4LogicalVolume(experimentalHall_box,
air,
"expHallLog",
0, //opt: fieldManager
0, //opt: SensitiveDetector
0); //opt: UserLimits
G4VPhysicalVolume* experimentalHall_phys
= new G4PVPlacement(0,
G4ThreeVector(), //at (0,0,0)
"expHall",
experimentalHallLog,
0,
false,
0);
//------------------------------
// Calorimeter segments
//------------------------------
// Simplified `CMS-like` PbWO4 crystal calorimeter
G4int 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 :-(
// Simplified `CMS-like` PbWO4 crystal calorimeter
G4double calo_xside = 31*cm;
G4double calo_yside = 31*cm;
G4double calo_zside = 24*cm;
G4double crystalWidth = 3*cm;
G4double crystalLength = 24*cm;
calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
calo_zside = crystalLength;
G4Box* calo_box= new G4Box("CMS calorimeter", // its name
calo_xside/2., // size
calo_yside/2.,
calo_zside/2.);
G4LogicalVolume* caloLog
= new G4LogicalVolume(calo_box, // its solid
pbWO4, // 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;
new G4PVPlacement(0,
G4ThreeVector(xpos, ypos, zpos),
caloLog,
"calorimeter",
experimentalHallLog,
false,
1);
// Individual crystals are created as part of the readout geometry in the parallel world
experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
caloLog->SetVisAttributes(caloVisAtt);
// define the fParameterisation region
fRegion = new G4Region("crystals");
caloLog->SetRegion(fRegion);
fRegion->AddRootLogicalVolume(caloLog);
return experimentalHall_phys;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflash3DetectorConstruction::ConstructSDandField()
{
// SD moved to parallel world
// -- fast simulation models:
// **********************************************
// * Initializing shower modell
// ***********************************************
G4cout << "Creating shower parameterization models" << G4endl;
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
fParameterisation = new GFlashHomoShowerParameterisation(fRegion->GetMaterialIterator()[0]);
fFastShowerModel->SetParameterisation(*fParameterisation);
// Energy Cuts to kill particles:
fParticleBounds = new GFlashParticleBounds();
fFastShowerModel->SetParticleBounds(*fParticleBounds);
// Makes the EnergieSpots
fHitMaker = new GFlashHitMaker();
// Important: use SD defined in different geometry
fHitMaker->SetNameOfWorldWithSD("parallelWorld");
fFastShowerModel->SetHitMaker(*fHitMaker);
G4cout<<"end shower parameterization."<<G4endl;
// **********************************************
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,172 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// User Classes
#include "ExGflash3ParallelWorld.hh"
#include "ExGflash3SensitiveDetector.hh"
// G4 Classes
#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"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflash3ParallelWorld::ExGflash3ParallelWorld(G4String aWorldName)
:G4VUserParallelWorld(aWorldName), fCrystalLog(nullptr), fCrystalPhys{}
{
G4cout<<"ExGflash3ParallelWorld::Parralel world constructor"<<G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflash3ParallelWorld::~ExGflash3ParallelWorld() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflash3ParallelWorld::Construct()
{
// In parallel world material does not matter
G4Material* dummy = nullptr;
// Build parallel/ghost geometry:
auto ghostLogicalVolume = GetWorld()->GetLogicalVolume();
// Use part of the Ex1GflashDetectorConstruction (without individual crystals)
G4int 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 :-(
// Simplified `CMS-like` PbWO4 crystal calorimeter
G4double calo_xside = 31*cm;
G4double calo_yside = 31*cm;
G4double calo_zside = 24*cm;
G4double crystalWidth = 3*cm;
G4double crystalLength = 24*cm;
calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
calo_zside = crystalLength;
G4Box* calo_box= new G4Box("CMS calorimeter", // its name
calo_xside/2., // size
calo_yside/2.,
calo_zside/2.);
G4LogicalVolume* caloLog
= new G4LogicalVolume(calo_box, // its solid
dummy, // 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;
new G4PVPlacement(0,
G4ThreeVector(xpos, ypos, zpos),
caloLog,
"calorimeter",
ghostLogicalVolume,
false,
1);
// Crystals
G4VSolid* crystal_box
= new G4Box("Crystal", // its name
crystalWidth/2,
crystalWidth/2,
crystalLength/2);
// size
fCrystalLog
= new G4LogicalVolume(crystal_box, // its solid
dummy, // its material
"CrystalLog"); // its name
for (G4int i=0; i<nbOfCrystals; i++)
{
for (G4int j=0; j<nbOfCrystals; j++)
{
G4int n = i*10+j;
G4ThreeVector crystalPos((i*crystalWidth)-135,
(j*crystalWidth)-135,0 );
fCrystalPhys[n]
= new G4PVPlacement(0, // no rotation
crystalPos, // translation
fCrystalLog,
"crystal", // its name
caloLog,
false,
i);
}
}
G4cout << "There are " << nbOfCrystals <<
" crystals per row in the calorimeter, so in total "<<
nbOfCrystals*nbOfCrystals << " crystals" << G4endl;
G4cout << "They have width of " << crystalWidth /cm <<
" cm and a length of " << crystalLength /cm
<<" cm. " << G4endl;
G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
G4VisAttributes* crystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
caloLog->SetVisAttributes(caloVisAtt);
fCrystalLog->SetVisAttributes(crystalVisAtt);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflash3ParallelWorld::ConstructSD()
{
// -- sensitive detectors:
G4SDManager* SDman = G4SDManager::GetSDMpointer();
ExGflash3SensitiveDetector* CaloSD
= new ExGflash3SensitiveDetector("Calorimeter",this);
SDman->AddNewDetector(CaloSD);
fCrystalLog->SetSensitiveDetector(CaloSD);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,130 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file ExGflash3SensitiveDetector.cc
/// \brief Implementation of the ExGflash3SensitiveDetector class
//
// Created by Joanna Weng 26.11.2004
#include "ExGflash3SensitiveDetector.hh"
#include "ExGflashHit.hh"
#include "G4GFlashSpot.hh"
#include "ExGflash3DetectorConstruction.hh"
#include "ExGflash3ParallelWorld.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......
ExGflash3SensitiveDetector::ExGflash3SensitiveDetector(G4String name,
ExGflash3ParallelWorld* det)
: G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), fHCID(-1)
{
G4String caloname="ExGflashCollection";
collectionName.insert(caloname);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflash3SensitiveDetector::~ExGflash3SensitiveDetector()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflash3SensitiveDetector::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 ExGflash3SensitiveDetector::EndOfEvent(G4HCofThisEvent*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExGflash3SensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{
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());
fCaloHitsCollection->insert(caloHit);
if (ROhist){;}
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int crystalnum=0;
for(int i=0;i<100;i++) //@@@@@@@ ExGflash3SensitiveDetector:vorsichty
{
if(physVol == fDetector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Separate GFLASH interface
G4bool ExGflash3SensitiveDetector::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){;}
//cout <<pCurrentVolume->GetName() << endl;
G4int crystalnum=0;
for(int i=0;i<100;i++) //@@@@@@@ ExGflash3SensitiveDetector:vorsichty
{
if(pCurrentVolume == fDetector->GetCristal(i)) crystalnum= i;
}
caloHit->SetCrystalNum(crystalnum);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -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()
: 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......
@@ -0,0 +1,219 @@
//
// ********************************************************************
// * 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 "G4EventManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Event.hh"
#include "G4SystemOfUnits.hh"
//std
#include <iostream>
#include <algorithm>
//Gflash
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashEventAction::ExGflashEventAction()
: G4UserEventAction(),
fNevent(0),fDtime(0.0),fCalorimeterCollectionId(-1)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashEventAction::~ExGflashEventAction()
{
if ( fNevent > 0 ) {
G4cout << "Internal Real Elapsed Time /event is: "<< fDtime /fNevent<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashEventAction::BeginOfEventAction(const G4Event *evt)
{
fTimerIntern.Start();
G4cout<<" ------ Start ExGflashEventAction ----- "<<G4endl;
fNevent=evt->GetEventID();
G4cout<<" Start generating event Nr "<<fNevent<<G4endl<<G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashEventAction::EndOfEventAction(const G4Event *evt)
{
fTimerIntern.Stop();
G4cout << G4endl;
G4cout << "******************************************";
G4cout << G4endl;
G4cout << "Internal Real Elapsed Time is: "<< fTimerIntern.GetRealElapsed();
G4cout << G4endl;
G4cout << "Internal System Elapsed Time: " << fTimerIntern.GetSystemElapsed();
G4cout << G4endl;
G4cout << "Internal GetUserElapsed Time: " << fTimerIntern.GetUserElapsed();
G4cout << G4endl;
G4cout << "******************************************"<< G4endl;
fDtime+=fTimerIntern.GetRealElapsed();
G4cout<<" ------ ExGflashEventAction::End of event nr. "<<fNevent<<" -----"<< G4endl;
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->GetMomentum()/pparticle->GetMomentum().mag();
//@@@ ExGflashEventAction: Magicnumber
G4double energyincrystal[100];
G4int hitsincrystal[100];
for (int i=0;i<100;i++) energyincrystal[i]=0.;
for (int i=0;i<100;i++) hitsincrystal[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;
hitsincrystal[num]++;
//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];
// 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];
// 3x3 matrix of crystals around the crystal with the maximum energy deposit
G4int num3x3 =
hitsincrystal[index]+hitsincrystal[index+1]+hitsincrystal[index-1]+
hitsincrystal[index-10]+hitsincrystal[index-9]+hitsincrystal[index-11]+
hitsincrystal[index+10]+hitsincrystal[index+11]+hitsincrystal[index+9];
// 5x5 matrix of crystals around the crystal with the maximum energy deposit
G4int num5x5 =
hitsincrystal[index]+hitsincrystal[index+1]+hitsincrystal[index-1]+
hitsincrystal[index+2]+hitsincrystal[index-2]+
hitsincrystal[index-10]+hitsincrystal[index-9]+hitsincrystal[index-11]+
hitsincrystal[index-8]+hitsincrystal[index-12]+
hitsincrystal[index+10]+hitsincrystal[index+11]+hitsincrystal[index+9]+
hitsincrystal[index+12]+hitsincrystal[index+8];
G4cout << " e1 " << energyincrystal[index]
<< " e3x3 " << e3x3<< " GeV e5x5 " <<e5x5 <<G4endl;
G4cout << " num1 " << hitsincrystal[index]
<< " num3x3 " << num3x3<< " num5x5 " <<num5x5 <<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;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,131 @@
//
// ********************************************************************
// * 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 "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(), fLogV(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashHit::ExGflashHit(G4LogicalVolume* logVol)
: G4VHit(), fLogV(logVol)
{}
//....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;
fStart =right.fStart;
fRot = right.fRot;
fLogV = right.fLogV;
fCrystalNumber = right.fCrystalNumber;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const ExGflashHit & ExGflashHit::operator=(const ExGflashHit &right)
{
G4VHit::operator=(right);
fEdep = right.fEdep;
fStart =right.fStart;
fPos = right.fPos;
fRot = right.fRot;
fLogV = right.fLogV;
fCrystalNumber = right.fCrystalNumber;
fCrystalNumber = right.fCrystalNumber;
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)
{
G4Transform3D trans(fRot,fPos);
G4VisAttributes attribs;
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(*fLogV,attribs,trans);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashHit::Print()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * 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,73 @@
//
// ********************************************************************
// * 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()
: G4UserRunAction(), fRunID(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExGflashRunAction::~ExGflashRunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashRunAction::BeginOfRunAction(const G4Run* aRun)
{
((G4Run *)(aRun))->SetRunID(fRunID++);
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExGflashRunAction::EndOfRunAction(const G4Run* aRun)
{
G4cout << "number of event = " << aRun->GetNumberOfEvent() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......