New name and major changes

This commit is contained in:
David Baranyai 2018-09-04 23:25:14 +02:00
parent c076786494
commit 4dee12aa71
37 changed files with 2628 additions and 0 deletions

68
include/LXeEMPhysics.hh Normal file
View File

@ -0,0 +1,68 @@
//
// ********************************************************************
// * 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: LXeEMPhysics.hh 81557 2014-06-03 08:32:44Z gcosmo $
//
/// \file optical/LXe/include/LXeEMPhysics.hh
/// \brief Definition of the LXeEMPhysics class
//
//
#ifndef LXeEMPhysics_h
#define LXeEMPhysics_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4VPhysicsConstructor.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4eMultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
class LXeEMPhysics : public G4VPhysicsConstructor
{
public:
LXeEMPhysics(const G4String& name ="EM");
virtual ~LXeEMPhysics();
public:
// This method will be invoked in the Construct() method.
// each particle type will be instantiated
virtual void ConstructParticle();
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess();
};
#endif

View File

@ -0,0 +1,58 @@
//
// ********************************************************************
// * 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: LXeGeneralPhysics.hh 90338 2015-05-26 08:35:43Z gcosmo $
//
/// \file optical/LXe/include/LXeGeneralPhysics.hh
/// \brief Definition of the LXeGeneralPhysics class
//
//
#ifndef LXeGeneralPhysics_h
#define LXeGeneralPhysics_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4VPhysicsConstructor.hh"
class LXeGeneralPhysics : public G4VPhysicsConstructor
{
public:
LXeGeneralPhysics(const G4String& name = "general");
virtual ~LXeGeneralPhysics();
// This method will be invoked in the Construct() method.
// each particle type will be instantiated
virtual void ConstructParticle();
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess();
};
#endif

65
include/LXeMuonPhysics.hh Normal file
View File

@ -0,0 +1,65 @@
//
// ********************************************************************
// * 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: LXeMuonPhysics.hh 85587 2014-10-31 09:12:28Z gcosmo $
//
/// \file optical/LXe/include/LXeMuonPhysics.hh
/// \brief Definition of the LXeMuonPhysics class
//
//
#ifndef LXeMuonPhysics_h
#define LXeMuonPhysics_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4VPhysicsConstructor.hh"
#include "G4MuMultipleScattering.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4MuIonisation.hh"
#include "G4hIonisation.hh"
#include "G4MuonMinusCapture.hh"
class LXeMuonPhysics : public G4VPhysicsConstructor
{
public:
LXeMuonPhysics(const G4String& name="muon");
virtual ~LXeMuonPhysics();
// This method will be invoked in the Construct() method.
// each particle type will be instantiated
virtual void ConstructParticle();
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess();
};
#endif

52
include/LXePhysicsList.hh Normal file
View File

@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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: LXePhysicsList.hh 68752 2013-04-05 10:23:47Z gcosmo $
//
/// \file optical/LXe/include/LXePhysicsList.hh
/// \brief Definition of the LXePhysicsList class
//
//
#ifndef LXePhysicsList_h
#define LXePhysicsList_h 1
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
class LXePhysicsList: public G4VModularPhysicsList
{
public:
LXePhysicsList();
virtual ~LXePhysicsList();
public:
// SetCuts()
virtual void SetCuts();
};
#endif

87
include/LXeTrajectory.hh Normal file
View File

@ -0,0 +1,87 @@
//
// ********************************************************************
// * 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: LXeTrajectory.hh 72349 2013-07-16 12:13:16Z gcosmo $
//
/// \file optical/LXe/include/LXeTrajectory.hh
/// \brief Definition of the LXeTrajectory class
//
#ifndef LXeTrajectory_h
#define LXeTrajectory_h 1
#include "G4Trajectory.hh"
#include "G4Allocator.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4TrajectoryPoint.hh"
#include "G4Track.hh"
#include "G4Step.hh"
class G4Polyline; // Forward declaration.
class LXeTrajectory : public G4Trajectory
{
public:
LXeTrajectory();
LXeTrajectory(const G4Track* aTrack);
LXeTrajectory(LXeTrajectory &);
virtual ~LXeTrajectory();
virtual void DrawTrajectory() const;
inline void* operator new(size_t);
inline void operator delete(void*);
void SetDrawTrajectory(G4bool b){fDrawit=b;}
void WLS(){fWls=true;}
void SetForceDrawTrajectory(G4bool b){fForceDraw=b;}
void SetForceNoDrawTrajectory(G4bool b){fForceNoDraw=b;}
private:
G4bool fWls;
G4bool fDrawit;
G4bool fForceNoDraw;
G4bool fForceDraw;
G4ParticleDefinition* fParticleDefinition;
};
extern G4ThreadLocal G4Allocator<LXeTrajectory>* LXeTrajectoryAllocator;
inline void* LXeTrajectory::operator new(size_t)
{
if(!LXeTrajectoryAllocator)
LXeTrajectoryAllocator = new G4Allocator<LXeTrajectory>;
return (void*)LXeTrajectoryAllocator->MallocSingle();
}
inline void LXeTrajectory::operator delete(void* aTrajectory)
{
LXeTrajectoryAllocator->FreeSingle((LXeTrajectory*)aTrajectory);
}
#endif

View File

@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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: LXeUserEventInformation.hh 68752 2013-04-05 10:23:47Z gcosmo $
//
/// \file optical/LXe/include/LXeUserEventInformation.hh
/// \brief Definition of the LXeUserEventInformation class
//
#include "G4VUserEventInformation.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#ifndef LXeUserEventInformation_h
#define LXeUserEventInformation_h 1
class LXeUserEventInformation : public G4VUserEventInformation
{
public:
LXeUserEventInformation();
virtual ~LXeUserEventInformation();
inline virtual void Print()const{};
void IncPhotonCount_Scint(){fPhotonCount_Scint++;}
void IncPhotonCount_Ceren(){fPhotonCount_Ceren++;}
void IncEDep(G4double dep){fTotE+=dep;}
void IncAbsorption(){fAbsorptionCount++;}
void IncBoundaryAbsorption(){fBoundaryAbsorptionCount++;}
void IncHitCount(G4int i=1){fHitCount+=i;}
void SetEWeightPos(const G4ThreeVector& p){fEWeightPos=p;}
void SetReconPos(const G4ThreeVector& p){fReconPos=p;}
void SetConvPos(const G4ThreeVector& p){fConvPos=p;fConvPosSet=true;}
void SetPosMax(const G4ThreeVector& p,G4double edep){fPosMax=p;fEdepMax=edep;}
G4int GetPhotonCount_Scint()const {return fPhotonCount_Scint;}
G4int GetPhotonCount_Ceren()const {return fPhotonCount_Ceren;}
G4int GetHitCount()const {return fHitCount;}
G4double GetEDep()const {return fTotE;}
G4int GetAbsorptionCount()const {return fAbsorptionCount;}
G4int GetBoundaryAbsorptionCount() const {return fBoundaryAbsorptionCount;}
G4ThreeVector GetEWeightPos(){return fEWeightPos;}
G4ThreeVector GetReconPos(){return fReconPos;}
G4ThreeVector GetConvPos(){return fConvPos;}
G4ThreeVector GetPosMax(){return fPosMax;}
G4double GetEDepMax(){return fEdepMax;}
G4double IsConvPosSet(){return fConvPosSet;}
//Gets the total photon count produced
G4int GetPhotonCount(){return fPhotonCount_Scint+fPhotonCount_Ceren;}
void IncPMTSAboveThreshold(){fPMTsAboveThreshold++;}
G4int GetPMTSAboveThreshold(){return fPMTsAboveThreshold;}
private:
G4int fHitCount;
G4int fPhotonCount_Scint;
G4int fPhotonCount_Ceren;
G4int fAbsorptionCount;
G4int fBoundaryAbsorptionCount;
G4double fTotE;
//These only have meaning if totE > 0
//If totE = 0 then these wont be set by EndOfEventAction
G4ThreeVector fEWeightPos;
G4ThreeVector fReconPos; //Also relies on hitCount>0
G4ThreeVector fConvPos;//true (initial) converstion position
G4bool fConvPosSet;
G4ThreeVector fPosMax;
G4double fEdepMax;
G4int fPMTsAboveThreshold;
};
#endif

View File

@ -0,0 +1,28 @@
//
// SiPMActionInitialization.hh
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#ifndef SiPMActionInitialization_hh
#define SiPMActionInitialization_hh
#include "G4VUserActionInitialization.hh"
#include "SiPMPrimaryGeneratorAction.hh"
#include "SiPMRunAction.hh"
#include "SiPMEventAction.hh"
#include "SiPMSteppingAction.hh"
/// Action initialization class.
class SiPMActionInitialization : public G4VUserActionInitialization
{
public:
SiPMActionInitialization();
virtual ~SiPMActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
};
#endif /* SiPMActionInitialization_hh */

56
include/SiPMAnalysis.hh Normal file
View File

@ -0,0 +1,56 @@
//
// SiPMAnalysis.hh
// SiPM
//
// Created by Baranyai David on 2018. 04. 03 for Medtech simulation..
// Modified for SiPM Simulation on 2018. 08. 23
//
#ifndef SiPMAnalysis_hh
#define SiPMAnalysis_hh
#include <stdio.h>
#include <iostream>
#include "G4Threading.hh"
#include "G4AutoLock.hh"
#include "TTree.h"
#include "TFile.h"
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include "SiPMParameters.hh"
class SiPMAnalysis
{
private:
/* Here will be the instance stored. */
static SiPMAnalysis* instance;
std::vector<TTree*> ttree;
//TTree *tree;
//TTree *electrontree;
TFile *file;
G4Mutex SiPMAnalysisMutex;
/* Private constructor to prevent instancing. */
SiPMAnalysis();
double x, y, e, time;
int sipm;
int noOfSipm = 0;
public:
~SiPMAnalysis();
SiPMAnalysis(const SiPMAnalysis&) = delete;
SiPMAnalysis& operator=(const SiPMAnalysis&) = delete;
void Fill(int copyNo, double x1, double y1, double e1, int sipm1, double time1);
void Close();
/* Static access method. */
static SiPMAnalysis* getInstance();
};
#endif /* SiPMAnalysis_hh */

View File

@ -0,0 +1,47 @@
//
// SiPMDetectorConstruction.hh
// sipm
//
// here you can create and place your experiment
//
// Created by Baranyai David on 2018. 08. 22..
//
#ifndef SiPMDetectorConstruction_hh
#define SiPMDetectorConstruction_hh
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "G4RunManager.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Orb.hh"
#include "G4Sphere.hh"
#include "G4Trd.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
#include "G4RotationMatrix.hh"
#include "G4Tubs.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4OpticalSurface.hh"
#include "G4PVParameterised.hh"
#include "SiPMParameterisation.hh"
#include "SiPMParameters.hh"
/// Detector construction class to define materials and geometry.
class SiPMDetectorConstruction : public G4VUserDetectorConstruction
{
public:
SiPMDetectorConstruction();
virtual ~SiPMDetectorConstruction();
virtual G4VPhysicalVolume* Construct();
};
#endif /* SiPMDetectorConstruction_hh */

View File

@ -0,0 +1,44 @@
//
// SiPMEventAction.hh
// sipm
//
// event, like one gamma from start till leaving the world
// collect event-level information, like total energy deposit of one gamma
//
// Created by Baranyai David on 2018. 08. 22..
//
#ifndef SiPMEventAction_hh
#define SiPMEventAction_hh
#include "G4UserEventAction.hh"
#include "globals.hh"
#include "SiPMRun.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "LXeTrajectory.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "LXeUserEventInformation.hh"
/// Event action class
class SiPMEventAction : public G4UserEventAction
{
public:
SiPMEventAction();
virtual ~SiPMEventAction();
virtual void BeginOfEventAction(const G4Event* event);
virtual void EndOfEventAction(const G4Event* event);
void AddEdep(G4double edep) { fEdep += edep; }
private:
G4double fEdep;
bool fForcedrawphotons;
bool fForcenophotons;
};
#endif /* SiPMEventAction_hh */

View File

@ -0,0 +1,79 @@
//
// SiPMParameterisation.hpp
// sipm
//
// Created by Baranyai David on 2018. 08. 23..
//
#ifndef SiPMParameterisation_hpp
#define SiPMParameterisation_hpp
#include "globals.hh"
#include "G4VPVParameterisation.hh"
#include "G4ThreeVector.hh"
class G4VPhysicalVolume;
class G4Box;
// Dummy declarations to get rid of warnings ...
class G4Trd;
class G4Trap;
class G4Cons;
class G4Orb;
class G4Sphere;
class G4Ellipsoid;
class G4Torus;
class G4Para;
class G4Hype;
class G4Tubs;
class G4Polycone;
class G4Polyhedra;
/// A parameterisation that describes a series of boxes along X and Y.
///
/// The boxes have equal width, & their lengths are a linear equation.
/// They are spaced an equal distance apart, starting from given location.
class SiPMParameterisation : public G4VPVParameterisation
{
public:
SiPMParameterisation(G4int noChambersX,
G4int noChambersY,
G4double spacing,
G4double widthChamber);
virtual ~SiPMParameterisation();
void ComputeTransformation (const G4int copyNo,
G4VPhysicalVolume* physVol) const;
void ComputeDimensions (G4Tubs & trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions(G4Box&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Trd&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Trap&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Cons&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Sphere&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Orb&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Ellipsoid&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Torus&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Para&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Hype&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polycone&,const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polyhedra&,const G4int, const G4VPhysicalVolume*) const {}
private:
G4int fNoChambersX;
G4int fNoChambersY;
G4double fHalfWidth; // The half-width of each tracker chamber
G4double fWidth;
G4double fSpacing; // The distance between the chambers' center
G4int copyno = 0;
};
#endif /* SiPMParameterisation_hh */

80
include/SiPMParameters.hh Normal file
View File

@ -0,0 +1,80 @@
//
// Parameters.hh
// Parameters
//
// Created by Baranyai David on 2018. 06. 30..
// Modified for SiPM Simulation on 2018. 08. 23..
// Copyright © 2018. Baranyai David. All rights reserved.
//
#ifndef SiPMParameters_hh
#define SiPMParameters_hh
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include "G4ThreeVector.hh"
class SiPMParameters
{
public:
static SiPMParameters *GetInstance();
~SiPMParameters();
//---Particle Gun parameters---------------------------------------------------------------------------
void SetParticleGunPosition(G4ThreeVector pgp) { particleGun_position = pgp; }
void SetParticleGunPosition(G4double x, G4double y, G4double z) { particleGun_position.set(x, y, z); }
G4ThreeVector GetParticleGunPosition() { return particleGun_position; }
void SetParticleGunMomentumDirection(G4ThreeVector pgm) { particleGun_MomentumDirection = pgm; }
void SetParticleGunMomentumDirection(G4double x, G4double y, G4double z) { particleGun_MomentumDirection.set(x, y, z); }
G4ThreeVector GetParticleGunMomentumDirection() { return particleGun_MomentumDirection; }
void SetParticleGunEnergy(G4double pge) { particleGun_energy = pge; }
G4double GetParticleGunEnergy() { return particleGun_energy; }
//---SiPM parameters-----------------------------------------------------------------------------------
void SetSiPMSize(G4ThreeVector sipm_s) { sipm_Dimension = sipm_s; }
void SetSiPMSize(G4double x, G4double y, G4double z) { sipm_Dimension.set(x, y, z); }
G4ThreeVector GetSiPMSize() { return sipm_Dimension; }
//---Scintillator parameters---------------------------------------------------------------------------
void SetScintillatorLength(G4double sc_l) { scintillator_length = sc_l; }
G4double GetScintillatorLength() { return scintillator_length; }
//---Division parameters-------------------------------------------------------------------------------
void SetDivision(G4int x, G4int y) { x_division = x; y_division = y; };
void SetXDivision(G4int x) { x_division = x; }
void SetYDivision(G4int y) { y_division = y; }
G4int GetXDivison() { return x_division; }
G4int GetYDivison() { return y_division; }
//---Radius parameters---------------------------------------------------------------------------------
void SetScintillatorRadius(G4double sc_r) { scint_radius = sc_r; }
G4double GetScintillatorRadius() { return scint_radius; }
void ResetToDefaults();
private:
SiPMParameters();
static SiPMParameters *instance;
G4ThreeVector particleGun_position;
G4ThreeVector particleGun_MomentumDirection;
G4double particleGun_energy; //in GeV
G4ThreeVector sipm_Dimension; //applies to both (in cm)
G4double scintillator_length; //the size same as sipm
G4int x_division;
G4int y_division;
G4double scint_radius;
};
#endif /* Parameters_hh */

View File

@ -0,0 +1,40 @@
//
// SiPMPrimaryGeneratorAction.hh
// sipm
//
// particle, energy, momentum, position...
//
// Created by Baranyai David on 2018. 08. 22..
//
#ifndef SiPMPrimaryGeneratorAction_hh
#define SiPMPrimaryGeneratorAction_hh
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "globals.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4RunManager.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "SiPMParameters.hh"
class SiPMPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
SiPMPrimaryGeneratorAction();
virtual ~SiPMPrimaryGeneratorAction();
virtual void GeneratePrimaries(G4Event*);
private:
G4ParticleGun* fParticleGun; // pointer a to G4 gun class
};
#endif /* SiPMPrimaryGeneratorAction_hh */

32
include/SiPMRun.hh Normal file
View File

@ -0,0 +1,32 @@
//
// SiPMRun.hh
// sipm
//
// run for threads
//
// Created by Baranyai David on 2018. 08. 22..
//
#ifndef SiPMRun_hh
#define SiPMRun_hh
#include "G4Run.hh"
#include "globals.hh"
class SiPMRun : public G4Run
{
public:
SiPMRun();
virtual ~SiPMRun();
virtual void Merge(const G4Run*);
void AddEdep (G4double edep);
G4double GetEdep() const { return fEdep; }
private:
G4double fEdep;
};
#endif /* SiPMRun_hh */

36
include/SiPMRunAction.hh Normal file
View File

@ -0,0 +1,36 @@
//
// SiPMRunAction.hh
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#ifndef SiPMRunAction_hh
#define SiPMRunAction_hh
#include "G4UserRunAction.hh"
#include "globals.hh"
#include "SiPMPrimaryGeneratorAction.hh"
#include "SiPMDetectorConstruction.hh"
#include "SiPMRun.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "SiPMAnalysis.hh"
class SiPMRunAction : public G4UserRunAction
{
public:
SiPMRunAction();
virtual ~SiPMRunAction();
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
};
#endif /* SiPMRunAction_hh */

View File

@ -0,0 +1,47 @@
//
// SiPMSteppingAction.hh
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#ifndef SiPMSteppingAction_hh
#define SiPMSteppingAction_hh
#include "G4UserSteppingAction.hh"
#include "globals.hh"
#include "SiPMEventAction.hh"
#include "G4Step.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTypes.hh"
#include "SiPMAnalysis.hh"
/// Stepping action class
///
class SiPMSteppingAction : public G4UserSteppingAction
{
public:
SiPMSteppingAction(SiPMEventAction* eventAction);
SiPMSteppingAction(const SiPMSteppingAction &) = default;
void TestFunction();
virtual ~SiPMSteppingAction();
G4int Sipm0_Num() {return sipm0_num;}
G4int Sipm1_Num() {return sipm1_num;}
// method from the base class
virtual void UserSteppingAction(const G4Step*);
private:
G4int sipm0_num = 0;
G4int sipm1_num = 0;
SiPMEventAction* fEventAction;
};
#endif /* SiPMSteppingAction_hh */

12
macros/gui.mac Executable file
View File

@ -0,0 +1,12 @@
/control/execute icons.mac
/control/execute vis.mac
/gui/addMenu run Run
/gui/addButton run "beamOn 1" "/run/beamOn 1"
/gui/addButton run "beamOn 10" "/run/beamOn 10"
/gui/addButton run "beamOn 100" "/run/beamOn 100"
/gui/addButton run "beamOn 1000" "/run/beamOn 1000"
# User defined icon :
/gui/addIcon "Run beam on" user_icon "/run/beamOn 1" run.png

25
macros/icons.mac Executable file
View File

@ -0,0 +1,25 @@
/gui/addIcon "Open macro file" open /control/execute
/gui/addIcon "Save viewer state" save /vis/viewer/save
# Cursors style icons
/gui/addIcon "Move" move
/gui/addIcon "Rotate" rotate
# Particle
/gui/addMenu particle Particle
/gui/addButton particle muon- "/gun/particle mu-"
/gui/addButton particle electron- "/gun/particle e-"
/gui/addButton particle pion- "/gun/particle pi-"
/gui/addButton particle gamma "/gun/particle gamma"
#
# Energy
/gui/addMenu energy Energy
/gui/addButton energy 100-keV "/gun/energy 100 keV"
/gui/addButton energy 300-keV "/gun/energy 300 keV"
/gui/addButton energy 1-MeV "/gun/energy 1 MeV"
/gui/addButton energy 3-MeV "/gun/energy 3 MeV"
/gui/addButton energy 10-MeV "/gun/energy 10 MeV"
#
# Surface Style icons
/gui/addIcon "Surfaces" solid
/gui/addIcon "Wireframe" wireframe

BIN
macros/run.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

22
macros/vis.mac Executable file
View File

@ -0,0 +1,22 @@
/run/initialize
/vis/open OGL 600x600-0+0
/vis/drawVolume
/vis/geometry/set/visibility World 0 false
/vis/viewer/set/style surface
/vis/viewer/set/viewpointThetaPhi 120 150
/vis/viewer/set/autoRefresh true
/vis/scene/add/trajectories smooth
/vis/scene/endOfEventAction accumulate 1000
/vis/scene/add/axes
/vis/scene/add/eventID
/vis/scene/add/text 0 6 14 cm 18 4 4 Box
/vis/ogl/set/displayListLimit 50000
/run/beamOn 10

79
sipm.cc Normal file
View File

@ -0,0 +1,79 @@
//
// sipm.cpp
//
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMDetectorConstruction.hh"
#include "SiPMActionInitialization.hh"
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "QGSP_BIC_HP.hh"
#include "G4UImanager.hh"
#include "QBBC.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "FTFP_BERT.hh"
#include "G4StepLimiterPhysics.hh"
#include "Randomize.hh"
#include "QGSP_BIC.hh"
#include "G4OpticalPhysics.hh"
#include "G4OpticalProcessIndex.hh"
#include "LXePhysicsList.hh"
#include "SiPMAnalysis.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// parameter from command line
int NoE=0;
if (argc==2) NoE=atoi(argv[1]);
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
unsigned nthreads = 8;
runManager->SetNumberOfThreads(nthreads);
#else
G4RunManager* runManager = new G4RunManager;
#endif
//you will modify this part ///////////
runManager->SetUserInitialization(new LXePhysicsList());
runManager->SetUserInitialization(new SiPMDetectorConstruction());
//runManager->SetUserInitialization(new QGSP_BIC);
runManager->SetUserInitialization(new SiPMActionInitialization());
///////////////
SiPMAnalysis *analysis = SiPMAnalysis::getInstance();
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (argc==2) {
// batch mode
runManager->Initialize();
runManager->BeamOn(NoE);
}
else {
// interactive mode
G4UIExecutive* ui = 0;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
UImanager->ApplyCommand("/control/macroPath /Users/divaldo/Programming/DE-Detector"); //set for your environment
UImanager->ApplyCommand("/control/execute gui.mac");
ui->SessionStart();
delete ui;
}
delete visManager;
delete runManager;
}

127
src/LXeEMPhysics.cc Normal file
View File

@ -0,0 +1,127 @@
//
// ********************************************************************
// * 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: LXeEMPhysics.cc 81557 2014-06-03 08:32:44Z gcosmo $
//
/// \file optical/LXe/src/LXeEMPhysics.cc
/// \brief Implementation of the LXeEMPhysics class
//
//
#include "LXeEMPhysics.hh"
#include "globals.hh"
#include "G4ios.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeEMPhysics::LXeEMPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeEMPhysics::~LXeEMPhysics() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
void LXeEMPhysics::ConstructParticle()
{
// gamma
G4Gamma::GammaDefinition();
// electron
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ProcessManager.hh"
void LXeEMPhysics::ConstructProcess()
{
G4PhotoElectricEffect* fPhotoEffect =
new G4PhotoElectricEffect();
G4ComptonScattering* fComptonEffect =
new G4ComptonScattering();
G4GammaConversion* fPairProduction =
new G4GammaConversion();
// Electron physics
G4eMultipleScattering* fElectronMultipleScattering =
new G4eMultipleScattering();
G4eIonisation* fElectronIonisation =
new G4eIonisation();
G4eBremsstrahlung* fElectronBremsStrahlung =
new G4eBremsstrahlung();
//Positron physics
G4eMultipleScattering* fPositronMultipleScattering =
new G4eMultipleScattering();
G4eIonisation* fPositronIonisation =
new G4eIonisation();
G4eBremsstrahlung* fPositronBremsStrahlung =
new G4eBremsstrahlung();
G4eplusAnnihilation* fAnnihilation =
new G4eplusAnnihilation();
G4ProcessManager* pManager = 0;
// Gamma Physics
pManager = G4Gamma::Gamma()->GetProcessManager();
pManager->AddDiscreteProcess(fPhotoEffect);
pManager->AddDiscreteProcess(fComptonEffect);
pManager->AddDiscreteProcess(fPairProduction);
// Electron Physics
pManager = G4Electron::Electron()->GetProcessManager();
pManager->AddProcess(fElectronMultipleScattering, -1, 1, 1);
pManager->AddProcess(fElectronIonisation, -1, 2, 2);
pManager->AddProcess(fElectronBremsStrahlung, -1, 3, 3);
//Positron Physics
pManager = G4Positron::Positron()->GetProcessManager();
pManager->AddProcess(fPositronMultipleScattering, -1, 1, 1);
pManager->AddProcess(fPositronIonisation, -1, 2, 2);
pManager->AddProcess(fPositronBremsStrahlung, -1, 3, 3);
pManager->AddProcess(fAnnihilation, 0,-1, 4);
}

89
src/LXeGeneralPhysics.cc Normal file
View File

@ -0,0 +1,89 @@
//
// ********************************************************************
// * 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: LXeGeneralPhysics.cc 100259 2016-10-17 08:02:30Z gcosmo $
//
/// \file optical/LXe/src/LXeGeneralPhysics.cc
/// \brief Implementation of the LXeGeneralPhysics class
//
//
#include "LXeGeneralPhysics.hh"
#include "globals.hh"
#include "G4ios.hh"
#include <iomanip>
#include "G4Decay.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeGeneralPhysics::LXeGeneralPhysics(const G4String& name)
: G4VPhysicsConstructor(name) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeGeneralPhysics::~LXeGeneralPhysics() {
//fDecayProcess = NULL;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4Geantino.hh"
#include "G4ChargedGeantino.hh"
#include "G4GenericIon.hh"
#include "G4Proton.hh"
void LXeGeneralPhysics::ConstructParticle()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
G4GenericIon::GenericIonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeGeneralPhysics::ConstructProcess()
{
G4Decay* fDecayProcess = new G4Decay();
// Add Decay Process
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while( (*particleIterator)() ){
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (fDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(fDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
}
}
}

126
src/LXeMuonPhysics.cc Normal file
View File

@ -0,0 +1,126 @@
//
// ********************************************************************
// * 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: LXeMuonPhysics.cc 85911 2014-11-06 08:56:31Z gcosmo $
//
/// \file optical/LXe/src/LXeMuonPhysics.cc
/// \brief Implementation of the LXeMuonPhysics class
//
//
#include "LXeMuonPhysics.hh"
#include "globals.hh"
#include "G4ios.hh"
#include "G4PhysicalConstants.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeMuonPhysics::LXeMuonPhysics(const G4String& name)
: G4VPhysicsConstructor(name) {
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeMuonPhysics::~LXeMuonPhysics() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoMu.hh"
#include "G4Neutron.hh"
#include "G4Proton.hh"
#include "G4PionZero.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
void LXeMuonPhysics::ConstructParticle()
{
// Mu
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
//These are needed for the mu- capture
G4Neutron::Neutron();
G4Proton::Proton();
G4PionMinus::PionMinus();
G4PionZero::PionZero();
G4PionPlus::PionPlus();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ProcessManager.hh"
void LXeMuonPhysics::ConstructProcess()
{
G4MuIonisation* fMuPlusIonisation =
new G4MuIonisation();
G4MuMultipleScattering* fMuPlusMultipleScattering =
new G4MuMultipleScattering();
G4MuBremsstrahlung* fMuPlusBremsstrahlung=
new G4MuBremsstrahlung();
G4MuPairProduction* fMuPlusPairProduction=
new G4MuPairProduction();
G4MuIonisation* fMuMinusIonisation =
new G4MuIonisation();
G4MuMultipleScattering* fMuMinusMultipleScattering =
new G4MuMultipleScattering();
G4MuBremsstrahlung* fMuMinusBremsstrahlung =
new G4MuBremsstrahlung();
G4MuPairProduction* fMuMinusPairProduction =
new G4MuPairProduction();
G4MuonMinusCapture* fMuMinusCaptureAtRest =
new G4MuonMinusCapture();
G4ProcessManager * pManager = 0;
// Muon Plus Physics
pManager = G4MuonPlus::MuonPlus()->GetProcessManager();
pManager->AddProcess(fMuPlusMultipleScattering,-1, 1, 1);
pManager->AddProcess(fMuPlusIonisation, -1, 2, 2);
pManager->AddProcess(fMuPlusBremsstrahlung, -1, 3, 3);
pManager->AddProcess(fMuPlusPairProduction, -1, 4, 4);
// Muon Minus Physics
pManager = G4MuonMinus::MuonMinus()->GetProcessManager();
pManager->AddProcess(fMuMinusMultipleScattering,-1, 1, 1);
pManager->AddProcess(fMuMinusIonisation, -1, 2, 2);
pManager->AddProcess(fMuMinusBremsstrahlung, -1, 3, 3);
pManager->AddProcess(fMuMinusPairProduction, -1, 4, 4);
pManager->AddRestProcess(fMuMinusCaptureAtRest);
}

86
src/LXePhysicsList.cc Normal file
View File

@ -0,0 +1,86 @@
//
// ********************************************************************
// * 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: LXePhysicsList.cc 68752 2013-04-05 10:23:47Z gcosmo $
//
/// \file optical/LXe/src/LXePhysicsList.cc
/// \brief Implementation of the LXePhysicsList class
//
//
#include "LXePhysicsList.hh"
#include "LXeGeneralPhysics.hh"
#include "LXeEMPhysics.hh"
#include "LXeMuonPhysics.hh"
#include "G4OpticalPhysics.hh"
#include "G4OpticalProcessIndex.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePhysicsList::LXePhysicsList() : G4VModularPhysicsList()
{
// default cut value (1.0mm)
defaultCutValue = 1.0*mm;
// General Physics
RegisterPhysics( new LXeGeneralPhysics("general") );
// EM Physics
RegisterPhysics( new LXeEMPhysics("standard EM"));
// Muon Physics
RegisterPhysics( new LXeMuonPhysics("muon"));
// Optical Physics
G4OpticalPhysics* opticalPhysics = new G4OpticalPhysics();
RegisterPhysics( opticalPhysics );
opticalPhysics->SetWLSTimeProfile("delta");
opticalPhysics->SetScintillationYieldFactor(1.0);
opticalPhysics->SetScintillationExcitationRatio(0.0);
opticalPhysics->SetMaxNumPhotonsPerStep(100);
opticalPhysics->SetMaxBetaChangePerStep(10.0);
opticalPhysics->SetTrackSecondariesFirst(kCerenkov,true);
opticalPhysics->SetTrackSecondariesFirst(kScintillation,true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePhysicsList::~LXePhysicsList() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePhysicsList::SetCuts(){
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
// the default cut value for all particle types
SetCutsWithDefault();
}

163
src/LXeTrajectory.cc Normal file
View File

@ -0,0 +1,163 @@
//
// ********************************************************************
// * 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: LXeTrajectory.cc 72349 2013-07-16 12:13:16Z gcosmo $
//
/// \file optical/LXe/src/LXeTrajectory.cc
/// \brief Implementation of the LXeTrajectory class
//
//
#include "LXeTrajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4Trajectory.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4ThreeVector.hh"
#include "G4Polyline.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
#include "G4Polymarker.hh"
G4ThreadLocal G4Allocator<LXeTrajectory>* LXeTrajectoryAllocator = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrajectory::LXeTrajectory()
:G4Trajectory(),fWls(false),fDrawit(false),fForceNoDraw(false),fForceDraw(false)
{
fParticleDefinition=0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrajectory::LXeTrajectory(const G4Track* aTrack)
:G4Trajectory(aTrack),fWls(false),fDrawit(false)
{
fParticleDefinition=aTrack->GetDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrajectory::LXeTrajectory(LXeTrajectory &right)
:G4Trajectory(right),fWls(right.fWls),fDrawit(right.fDrawit)
{
fParticleDefinition=right.fParticleDefinition;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrajectory::~LXeTrajectory() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeTrajectory::DrawTrajectory() const
{
// i_mode is no longer available as an argument of G4VTrajectory.
// In this exampple it was always called with an argument of 50.
const G4int i_mode = 50;
// Consider using commands /vis/modeling/trajectories.
//Taken from G4VTrajectory and modified to select colours based on particle
//type and to selectively eliminate drawing of certain trajectories.
if(!fForceDraw && (!fDrawit || fForceNoDraw))
return;
// If i_mode>=0, draws a trajectory as a polyline and, if i_mode!=0,
// adds markers - yellow circles for step points and magenta squares
// for auxiliary points, if any - whose screen size in pixels is
// given by std::abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
// visible markers.
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (!pVVisManager) return;
const G4double markerSize = std::abs(i_mode)/1000;
G4bool lineRequired (i_mode >= 0);
G4bool markersRequired (markerSize > 0.);
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
for (G4int i = 0; i < GetPointEntries() ; i++) {
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
const std::vector<G4ThreeVector>* auxiliaries
= aTrajectoryPoint->GetAuxiliaryPoints();
if (auxiliaries) {
for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) {
const G4ThreeVector pos((*auxiliaries)[iAux]);
if (lineRequired) {
trajectoryLine.push_back(pos);
}
if (markersRequired) {
auxiliaryPoints.push_back(pos);
}
}
}
const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
if (lineRequired) {
trajectoryLine.push_back(pos);
}
if (markersRequired) {
stepPoints.push_back(pos);
}
}
if (lineRequired) {
G4Colour colour;
if(fParticleDefinition==G4OpticalPhoton::OpticalPhotonDefinition()){
if(fWls) //WLS photons are red
colour = G4Colour(1.,0.,0.);
else{ //Scintillation and Cerenkov photons are green
colour = G4Colour(0.,1.,0.);
}
}
else //All other particles are blue
colour = G4Colour(0.,0.,1.);
G4VisAttributes trajectoryLineAttribs(colour);
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(trajectoryLine);
}
if (markersRequired) {
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
auxiliaryPoints.SetScreenSize(markerSize);
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
pVVisManager->Draw(auxiliaryPoints);
stepPoints.SetMarkerType(G4Polymarker::circles);
stepPoints.SetScreenSize(markerSize);
stepPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow
stepPoints.SetVisAttributes(&stepPointsAttribs);
pVVisManager->Draw(stepPoints);
}
}

View File

@ -0,0 +1,43 @@
//
// ********************************************************************
// * 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: LXeUserEventInformation.cc 68752 2013-04-05 10:23:47Z gcosmo $
//
/// \file optical/LXe/src/LXeUserEventInformation.cc
/// \brief Implementation of the LXeUserEventInformation class
//
//
#include "LXeUserEventInformation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeUserEventInformation::LXeUserEventInformation()
:fHitCount(0),fPhotonCount_Scint(0),fPhotonCount_Ceren(0),fAbsorptionCount(0),
fBoundaryAbsorptionCount(0),fTotE(0.),fEWeightPos(0.),fReconPos(0.),fConvPos(0.),
fConvPosSet(false),fPosMax(0.),fEdepMax(0.),fPMTsAboveThreshold(0) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeUserEventInformation::~LXeUserEventInformation() {}

View File

@ -0,0 +1,46 @@
//
// SiPMActionInitialization.cpp
// sipm
//
// User actions like Run,Event,Stepping
// Stacking
// PrimaryGenerator
// for master and threads
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMActionInitialization.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMActionInitialization::SiPMActionInitialization()
: G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMActionInitialization::~SiPMActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMActionInitialization::BuildForMaster() const
{
SetUserAction(new SiPMRunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMActionInitialization::Build() const
{
SetUserAction(new SiPMPrimaryGeneratorAction);
SetUserAction(new SiPMRunAction);
SiPMEventAction* eventAction = new SiPMEventAction;
SetUserAction(eventAction);
SetUserAction(new SiPMSteppingAction(eventAction));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

106
src/SiPMAnalysis.cc Normal file
View File

@ -0,0 +1,106 @@
//
// SiPMAnalysis.cc
// SiPM
//
// Created by Baranyai David on 2018. 04. 03..
// Modified for SiPM Simulation on 2018. 08. 23
//
#include "SiPMAnalysis.hh"
SiPMAnalysis::SiPMAnalysis()
{
SiPMParameters *parameters = SiPMParameters::GetInstance();
G4int xDiv = parameters -> GetXDivison();
G4int yDiv = parameters -> GetYDivison();
noOfSipm = xDiv * yDiv;
G4int counter = 0;
char filename[20];
char treename[20];
snprintf(filename, 30, "data.root");
ttree = std::vector<TTree*>(noOfSipm,0);
for(int i = 0; i < xDiv; i++)
{
for (int j = 0; j < yDiv; j++)
{
snprintf(treename, 20, "%dx_%dy",i,j);
ttree[counter] = new TTree(treename, treename);
ttree[counter] -> Branch("x", &x, "x/D");
ttree[counter] -> Branch("y", &y, "y/D");
ttree[counter] -> Branch("e", &e, "e/D");
ttree[counter] -> Branch("sipm", &sipm, "sipm/D");
ttree[counter] -> Branch("time", &time, "x/D");
counter++;
}
}
counter = 0;
//ttree[0] = new TTree("tree", "tree");
file = new TFile(filename,"RECREATE");
instance = this;
SiPMAnalysisMutex = G4MUTEX_INITIALIZER;
/*
for(int i = 0; i < xDiv; i++)
{
for (int j = 0; j < yDiv; j++)
{
ttree[counter] -> Branch("x", &x, "x/D");
ttree[counter] -> Branch("y", &y, "x/D");
ttree[counter] -> Branch("e", &e, "x/D");
ttree[counter] -> Branch("sipm", &sipm, "x/D");
ttree[counter] -> Branch("time", &time, "x/D");
counter++;
}
}
counter = 0;
*/
}
SiPMAnalysis::~SiPMAnalysis()
{
}
SiPMAnalysis* SiPMAnalysis::getInstance()
{
if (instance == 0)
{
std::cout << "Created analysis instance" << std::endl;
instance = new SiPMAnalysis();
}
return instance;
}
void SiPMAnalysis::Fill(int copyNo, double x1, double y1, double e1, int sipm1, double time1)
{
G4AutoLock lock(&SiPMAnalysisMutex);
x = x1;
y = y1;
e = e1;
sipm = sipm1;
time = time1;
ttree[copyNo] -> Fill();
ttree[copyNo] -> FlushBaskets();
lock.unlock();
}
void SiPMAnalysis::Close()
{
for(int i = 0; i < noOfSipm; i++)
{
ttree[i] -> Write();
}
file -> Close();
}
/* Null, because instance will be initialized on demand. */
SiPMAnalysis* SiPMAnalysis::instance = 0;

View File

@ -0,0 +1,374 @@
//
// SiPMDetectorConstruction.cpp
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMDetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMDetectorConstruction::SiPMDetectorConstruction()
: G4VUserDetectorConstruction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMDetectorConstruction::~SiPMDetectorConstruction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* SiPMDetectorConstruction::Construct()
{
// Get nist material manager
G4NistManager* nist = G4NistManager::Instance();
//Get the parameters instance
SiPMParameters *parameters = SiPMParameters::GetInstance();
// Option to switch on/off checking of volumes overlaps
G4bool checkOverlaps = true;
// ------------- Materials -------------
G4double a, z, density;
G4int nelements;
// Air
//
G4Element* N = new G4Element("Nitrogen", "N", z=7 , a=14.01*g/mole);
G4Element* O = new G4Element("Oxygen" , "O", z=8 , a=16.00*g/mole);
G4Material* air = new G4Material("Air", density=1.29*mg/cm3, nelements=2);
air->AddElement(N, 70.*perCent);
air->AddElement(O, 30.*perCent);
// Water
//
G4Element* H = new G4Element("Hydrogen", "H", z=1 , a=1.01*g/mole);
G4Material* water = new G4Material("Water", density= 1.0*g/cm3, nelements=2);
water->AddElement(H, 2);
water->AddElement(O, 1);
/*
* Wolfram material
*/
G4Material *wolfram = nist -> FindOrBuildMaterial("G4_W");
//
// World
//
G4ThreeVector sipm_size = parameters -> GetSiPMSize();
G4double world_sizeX = parameters -> GetXDivison() * sipm_size.getX() * cm; //2*m;
G4double world_sizeY = parameters -> GetYDivison() * sipm_size.getY() * cm; //2*m;
G4double world_sizeZ = 2*sipm_size.getZ() + parameters -> GetScintillatorLength();
G4Material* world_mat = air; //nist->FindOrBuildMaterial("G4_AIR");
G4Box* solidWorld =
new G4Box("World", //its name
/*0.5**/world_sizeX, /*0.5**/world_sizeY, /*0.5**/world_sizeZ); //its size
G4LogicalVolume* logicWorld =
new G4LogicalVolume(solidWorld, //its solid
world_mat, //its material
"World"); //its name
G4VPhysicalVolume* physWorld =
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicWorld, //its logical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
0, //copy lxenumber
checkOverlaps); //overlaps checking
//Place a container which contains everything for G4Replica
G4double container_sizeX = sipm_size.getX()*cm;
G4double container_sizeY = sipm_size.getY()*cm;
G4double container_sizeZ = (sipm_size.getZ()*2 + parameters -> GetScintillatorLength())*cm;
G4Box *solidContainer =
new G4Box("Container", container_sizeX*0.5, container_sizeY*0.5, container_sizeZ*0.5);
G4LogicalVolume *logicContainer =
new G4LogicalVolume(solidContainer, world_mat, "Container");
/*
G4VPhysicalVolume *physContainer =
new G4PVPlacement(0,
G4ThreeVector(),
logicContainer,
"Container",
logicWorld,
false,
0,
checkOverlaps);
*/
G4Colour containerColour( 1.0, 1.0, 0.0);
G4VisAttributes* containerVisAtt = new G4VisAttributes( containerColour );
//logicContainer -> SetVisAttributes(containerVisAtt);
G4double sizeX = sipm_size.getX()*cm;
G4double sizeY = sipm_size.getY()*cm;
G4double sipm_width = sipm_size.getZ()*cm;
//
// Sipm0
//
G4Material* sipm0_mat = air; //nist->FindOrBuildMaterial("G4_Si");
// sipm0 shape
G4double sipm0_sizeX = sizeX;
G4double sipm0_sizeY = sizeY;
G4double sipm0_sizeZ = sipm_width;
G4ThreeVector pos_sipm0 = G4ThreeVector(0, 0*cm, (sipm_width/2)-container_sizeZ*0.5);
G4Box* solidSipm0 =
new G4Box("Sipm0", //its name
0.5*sipm0_sizeX, 0.5*sipm0_sizeY,
0.5*sipm0_sizeZ); //its size
G4LogicalVolume* logicSipm0 =
new G4LogicalVolume(solidSipm0, //its solid
sipm0_mat, //its material
"Sipm0"); //its name
G4VPhysicalVolume *physSipm0 =
new G4PVPlacement(0, //no rotation
pos_sipm0, //at position
logicSipm0, //its logical volume
"Sipm0", //its name
logicContainer, //its mother volume
false, //no boolean operation
0, //copy lxenumber
checkOverlaps); //overlaps checking
G4Colour sipmColour( 0.0, 1.0, 0.0);
G4VisAttributes* sipmVisAtt = new G4VisAttributes( sipmColour );
logicSipm0->SetVisAttributes(sipmVisAtt);
//
// Box
// Changed the scintillator construction so now the box is Wolfram whic contains the scintillator
//
//
G4Material* scint_mat = water; //nist->FindOrBuildMaterial("G4_Si");
// box shape
G4double scint_sizeX = sizeX;
G4double scint_sizeY = sizeY;
G4double scint_sizeZ = parameters -> GetScintillatorLength() * cm;
G4double z_pos = sipm_width + (scint_sizeZ*0.5);
G4ThreeVector posScint = G4ThreeVector(0, 0*cm, z_pos-container_sizeZ*0.5);
G4Box* solidScint_W =
new G4Box("Scintillator_W", //its name
0.5*scint_sizeX, 0.5*scint_sizeY,
0.5*scint_sizeZ); //its size
G4LogicalVolume* logicScint_W =
new G4LogicalVolume(solidScint_W, //its solid
wolfram, //its material
"Scintillator_W"); //its name
G4VPhysicalVolume *physScint_W =
new G4PVPlacement(0, //no rotation
posScint, //at position
logicScint_W, //its logical volume
"Scintillator_W", //its name
logicContainer, //its mother volume
false, //no boolean operation
0, //copy lxenumber
checkOverlaps); //overlaps checking
/*
* Scintillator
*/
G4double scint_radius = parameters -> GetScintillatorRadius()*cm;
G4Tubs * solidScint = new G4Tubs("tube", 0, scint_radius, 0.5*(scint_sizeZ+(0.5*mm)), 0, 2*CLHEP::pi); //name, inner R, outter R, Half length in Z, starting angle, angle of the segment in rad
new G4Box("Scintillator",
0.5*scint_sizeX,
0.5*scint_sizeY,
0.5*scint_sizeZ);
G4LogicalVolume *logicScint =
new G4LogicalVolume(solidScint, //its solid
scint_mat, //its material
"Scintillator"); //its name
G4VPhysicalVolume *physScint =
new G4PVPlacement(0, //no rotation
G4ThreeVector(0,0,0), //at position (as the mother volume is not the world, maybe this will be the right place)
logicScint, //its logical volume
"Scintillator", //its name
logicScint_W, //its mother volume
false, //no boolean operation
0, //copy lxenumber
checkOverlaps); //overlaps checking
G4Colour scintColour( 1.0, 0, 0.0);
G4VisAttributes* scintVisAtt = new G4VisAttributes( scintColour );
logicScint -> SetVisAttributes(scintVisAtt);
//
// Sipm1
//
G4double sipm2_pos_z = (0.5*sipm_width) + scint_sizeZ;
G4Material* sipm1_mat = air; //nist->FindOrBuildMaterial("G4_Si");
G4ThreeVector pos_sipm1 = G4ThreeVector(0, 0*cm, sipm_width+sipm2_pos_z-container_sizeZ*0.5);
// sipm1 shape -> same as sipm0
G4Box* solidSipm1 =
new G4Box("Sipm1", //its name
0.5*sipm0_sizeX, 0.5*sipm0_sizeY,
0.5*sipm0_sizeZ); //its size
G4LogicalVolume* logicSipm1 =
new G4LogicalVolume(solidSipm1, //its solid
sipm1_mat, //its material
"Sipm1"); //its name
G4VPhysicalVolume *physSipm1 =
new G4PVPlacement(0, //no rotation
pos_sipm1, //at position
logicSipm1, //its logical volume
"Sipm1", //its name
logicContainer, //its mother volume
false, //no boolean operation
0, //copy lxenumber
checkOverlaps); //overlaps checking
logicSipm1->SetVisAttributes(sipmVisAtt);
//----------------------------------General values--------------------------------------------------------
const G4int n = 2;
G4double pp[n] = {2.0*eV, 3.0*eV}; //distribution of optical photons produced in eV
//---------------------------------General Material Settings----------------------------------------------
//material of scintillator
G4double rind_scintillator[n] = {1.59, 1.57}; //refraction index
G4double absl[n] = {35.*cm, 35.*cm}; //absorption length
G4double slow[n] = {0.1, 1};
G4double fast[n] = {0.1, 1};
G4MaterialPropertiesTable *scint_material_mpt = new G4MaterialPropertiesTable();
scint_material_mpt -> AddProperty("RINDEX", pp, rind_scintillator, n);
scint_material_mpt -> AddProperty("ABSLENGTH", pp, absl, n);
scint_material_mpt -> AddProperty("SLOWCOMPONENT", pp, slow, n);
scint_material_mpt -> AddProperty("FASTCOMPONENT", pp, fast, n);
scint_material_mpt -> AddConstProperty("SCINTILLATIONYIELD", 50./MeV); //50 volt
scint_material_mpt -> AddConstProperty("RESOLUTIONSCALE", 1.0);
scint_material_mpt -> AddConstProperty("FASTTIMECONSTANT", 20.*ns);
scint_material_mpt -> AddConstProperty("SLOWTIMECONSTANT", 45.*ns);
scint_material_mpt -> AddConstProperty("YIELDRATIO", 1);
scint_mat -> SetMaterialPropertiesTable(scint_material_mpt);
//Surface of scintillator to wolfram
G4OpticalSurface *OpScintillatorSurface = new G4OpticalSurface("Scintillator Surface to Wolfram",glisur, polished, dielectric_metal);
G4LogicalBorderSurface *ScintillatorSurface = new G4LogicalBorderSurface("Scintillator Surface", physScint, physScint_W, OpScintillatorSurface);
G4double reflectivity_W[n] = {0.9, 0.9};
G4double efficiency_W[n] = {0, 0};
G4MaterialPropertiesTable *ScintillatorToWolframMaterialPropertyTable = new G4MaterialPropertiesTable();
ScintillatorToWolframMaterialPropertyTable -> AddProperty("REFLECTIVITY", pp, reflectivity_W, n);
ScintillatorToWolframMaterialPropertyTable -> AddProperty("EFFICIENCY", pp, efficiency_W, n);
OpScintillatorSurface -> SetMaterialPropertiesTable(ScintillatorToWolframMaterialPropertyTable);
//Surface from scintillator to sipm0 and sipm1
G4OpticalSurface *SurfacefromScintillatorToSipm = new G4OpticalSurface("SurfacefromScintillatorToSipm", glisur, polished, dielectric_metal);
G4LogicalBorderSurface *SurfacefromScintillatorToSipm0_logical = new G4LogicalBorderSurface("SurfacefromScintillatorToSipm0", physScint, physSipm0, SurfacefromScintillatorToSipm);
G4LogicalBorderSurface *SurfacefromScintillatorToSipm1_logical2 = new G4LogicalBorderSurface("SurfacefromScintillatorToSipm1", physScint, physSipm1, SurfacefromScintillatorToSipm);
//----------------------------------
G4double reflectivity[n] = {1, 1}; //ha nem 1,1 akkor nem éri el a sipm-et az aki eléri a scint végét.
G4MaterialPropertiesTable *ScintillatorMaterialPropertyTable = new G4MaterialPropertiesTable();
ScintillatorMaterialPropertyTable -> AddProperty("REFLECTIVITY", pp, reflectivity, n);
SurfacefromScintillatorToSipm -> SetMaterialPropertiesTable(ScintillatorMaterialPropertyTable);
//Surface
/*
G4int matrixX = 3;
G4int matrixY = 3;
G4VPVParameterisation *chamberParam = new SiPMParameterisation(matrixX,
matrixY,
0,
sipm_width);
*/
/*new G4PVParameterised("Chamber", // their name
logicContainer, // their logical volume
physWorld, // Mother logical volume
kXAxis, // Are placed along this axis
3, // Number of chambers
chamberParam, // The parametrisation
true); // checking overlaps
*/
/*
new G4PVParameterised("Chamber", // their name
logicContainer, // their logical volume
physWorld, // Mother logical volume
kYAxis, // Are placed along this axis
matrixX * matrixY, // Number of chambers
chamberParam, // The parametrisation
true); // checking overlaps
*/
//G4VPVParameterisation *paramSipm = new G4VPVParameterisation();
//Using G4PVPlacement instead of replica or others
int x = parameters -> GetXDivison();
int y = parameters -> GetYDivison();
int helper = 0;
G4VPhysicalVolume *physContainer[x][y];
char s1[30];
for(int i = 0; i < x; i++)
{
for(int j = 0; j < y; j++)
{
snprintf(s1, 30, "Container_x%d_y%d", i, j);
logicContainer -> SetName(s1);
physContainer[x][y] = new G4PVPlacement(0,
G4ThreeVector(i*cm, j*cm, 0),
logicContainer,
s1, //its name
logicWorld,
false,
helper, //copy number
checkOverlaps);
//physSipm0 -> SetCopyNo(helper);
//physSipm1 -> SetCopyNo(helper);
helper++;
}
}
return physWorld;
}

57
src/SiPMEventAction.cc Normal file
View File

@ -0,0 +1,57 @@
//
// SiPMEventAction.cpp
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMEventAction.hh"
SiPMEventAction::SiPMEventAction() : G4UserEventAction()
{
fForcenophotons = false;
fForcedrawphotons = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMEventAction::~SiPMEventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMEventAction::BeginOfEventAction(const G4Event*)
{
fEdep = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMEventAction::EndOfEventAction(const G4Event* anEvent)
{
// accumulate statistics in DERun
SiPMRun* run = static_cast<SiPMRun*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->AddEdep(fEdep);
/*LXeUserEventInformation* eventInformation = (LXeUserEventInformation*)anEvent->GetUserInformation();
G4TrajectoryContainer* trajectoryContainer=anEvent->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
*/
// extract the trajectories and draw them
/*if (G4VVisManager::GetConcreteInstance())
{
for (G4int i=0; i<n_trajectories; i++)
{
LXeTrajectory* trj = (LXeTrajectory*) ((*(anEvent->GetTrajectoryContainer()))[i]);
if(trj->GetParticleName()=="opticalphoton")
{
trj->SetForceDrawTrajectory(fForcedrawphotons);
trj->SetForceNoDrawTrajectory(fForcenophotons);
}
trj->DrawTrajectory();
}
}*/
}

View File

@ -0,0 +1,65 @@
//
// SiPMParameterisation.cc
// sipm
//
// Created by Baranyai David on 2018. 08. 23..
//
#include "SiPMParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMParameterisation::SiPMParameterisation(G4int noChambersX,
G4int noChambersY,
G4double spacingZ, // Z spacing of centers | The distance between the chambers' center
G4double widthChamber)
: G4VPVParameterisation()
{
fNoChambersX = noChambersX;
fNoChambersY = noChambersY;
fWidth = widthChamber + spacingZ;
fHalfWidth = 0.5*widthChamber;
fSpacing = spacingZ;
if (fNoChambersX < 0 || fNoChambersY < 0)
{
G4Exception("SiPMParameterisation::SiPMParameterisation()",
"InvalidSetup", FatalException,
"fNoChambersX or fNoChambersX < 0");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMParameterisation::~SiPMParameterisation()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMParameterisation::ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
// Note: copyNo will start with zero!
G4double Xposition = copyNo * fWidth;
G4ThreeVector origin(0,Xposition,0);
physVol->SetTranslation(origin);
physVol->SetRotation(0);
std::cout << "ComputeTransform called | Copy no: " << copyNo << std::endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMParameterisation::ComputeDimensions(G4Tubs& trackerChamber, const G4int copyNo, const G4VPhysicalVolume*) const
{
// Note: copyNo will start with zero!
/*
G4double rmax = fRmaxFirst + copyNo * fRmaxIncr;
trackerChamber.SetInnerRadius(0);
trackerChamber.SetOuterRadius(rmax);
trackerChamber.SetZHalfLength(fHalfWidth);
trackerChamber.SetStartPhiAngle(0.*deg);
trackerChamber.SetDeltaPhiAngle(360.*deg);
*/
}

46
src/SiPMParameters.cc Normal file
View File

@ -0,0 +1,46 @@
//
// Parameters.cc
// Parameters
//
// Created by Baranyai David on 2018. 06. 30..
// Modified for SiPM Simulation on 2018. 08. 23..
// Copyright © 2018. Baranyai David. All rights reserved.
//
#include "SiPMParameters.hh"
SiPMParameters* SiPMParameters::GetInstance()
{
if (instance == 0)
{
instance = new SiPMParameters();
}
return instance;
}
SiPMParameters* SiPMParameters::instance = 0;
SiPMParameters::SiPMParameters()
{
ResetToDefaults();
}
SiPMParameters::~SiPMParameters()
{
}
void SiPMParameters::ResetToDefaults()
{
particleGun_position = G4ThreeVector(50, -5, 0);
particleGun_MomentumDirection = G4ThreeVector(0.5, 1, 0);
particleGun_energy = 1; //in GeV
sipm_Dimension = G4ThreeVector(1, 1, 1); //applies to both (in cm)
scintillator_length = 40; //the size same as sipm
x_division = 10;
y_division = 10;
scint_radius = 0.25; //in cm
}

View File

@ -0,0 +1,39 @@
//
// SiPMPrimaryGeneratorAction.cpp
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMPrimaryGeneratorAction.hh"
SiPMPrimaryGeneratorAction::SiPMPrimaryGeneratorAction() : G4VUserPrimaryGeneratorAction(), fParticleGun(0)
{
SiPMParameters *parameters = SiPMParameters::GetInstance();
G4int n_particle = 1; //particles per event
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle = particleTable->FindParticle(particleName="mu+");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(parameters -> GetParticleGunMomentumDirection());
fParticleGun->SetParticleEnergy(parameters -> GetParticleGunEnergy()*GeV); //1GeV
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMPrimaryGeneratorAction::~SiPMPrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
SiPMParameters *parameters = SiPMParameters::GetInstance();
fParticleGun->SetParticlePosition(parameters -> GetParticleGunPosition());
fParticleGun->GeneratePrimaryVertex(anEvent);
}

34
src/SiPMRun.cc Normal file
View File

@ -0,0 +1,34 @@
//
// SiPMRun.cpp
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMRun.hh"
SiPMRun::SiPMRun()
: G4Run()
{fEdep=0.0;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMRun::~SiPMRun()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMRun::Merge(const G4Run* run)
{
const SiPMRun* localRun = static_cast<const SiPMRun*>(run);
fEdep += localRun->fEdep;
G4Run::Merge(run);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMRun::AddEdep (G4double edep)
{
fEdep += edep;
}

62
src/SiPMRunAction.cc Normal file
View File

@ -0,0 +1,62 @@
//
// SiPMRunAction.cpp
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMRunAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMRunAction::SiPMRunAction() : G4UserRunAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMRunAction::~SiPMRunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* SiPMRunAction::GenerateRun()
{
return new SiPMRun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMRunAction::BeginOfRunAction(const G4Run*)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMRunAction::EndOfRunAction(const G4Run* run)
{
G4int nofEvents = run->GetNumberOfEvent();
if (nofEvents == 0) return;
const SiPMRun* siPMRun = static_cast<const SiPMRun*>(run);
G4double edepInRuns = siPMRun->GetEdep();
// Print
//
if (IsMaster()) {
SiPMAnalysis *analysis = SiPMAnalysis::getInstance();
analysis -> Close();
G4cout
<< G4endl
<< "--------------------End of Global Run-----------------------";
}
else {
G4cout
<< G4endl
<< "--------------------End of Local Run------------------------";
}
G4cout
<< G4endl
<< " The run consists of " << nofEvents << " edep: "<< edepInRuns/keV
<< G4endl;
}

106
src/SiPMSteppingAction.cc Normal file
View File

@ -0,0 +1,106 @@
//
// SiPMSteppingAction.cpp
// sipm
//
// Created by Baranyai David on 2018. 08. 22..
//
#include "SiPMSteppingAction.hh"
SiPMSteppingAction::SiPMSteppingAction(SiPMEventAction* eventAction) : G4UserSteppingAction(),
fEventAction(eventAction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SiPMSteppingAction::~SiPMSteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SiPMSteppingAction::UserSteppingAction(const G4Step* step)
{
SiPMAnalysis *analysis = SiPMAnalysis::getInstance();
G4LogicalVolume* volume
= step->GetPreStepPoint()->GetTouchableHandle()
->GetVolume()->GetLogicalVolume();
G4Track *fTrack = step -> GetTrack();
G4int trackID = fTrack -> GetTrackID();
G4double postTime = step->GetPostStepPoint()->GetLocalTime();
if(fTrack->GetTrackStatus()!=fAlive) { return; } /// check if it is alive
G4VPhysicalVolume* prevolume = step -> GetPreStepPoint() -> GetTouchableHandle() -> GetVolume();
G4VPhysicalVolume* postvolume = step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume();
G4double preX = step->GetPreStepPoint()->GetPosition().x();
G4double preY = step->GetPreStepPoint()->GetPosition().y();
G4double preZ = step->GetPreStepPoint()->GetPosition().z();
G4double prekinE = step->GetPreStepPoint()->GetKineticEnergy();
G4double postX = step->GetPostStepPoint()->GetPosition().x();
G4double postY = step->GetPostStepPoint()->GetPosition().y();
G4double postZ = step->GetPostStepPoint()->GetPosition().z();
G4double postkinE = step->GetPostStepPoint()->GetKineticEnergy();
G4String preName = prevolume -> GetName();
G4String postName = postvolume -> GetName();
G4Track *theTrack = step->GetTrack();
G4ParticleDefinition* particleType = theTrack->GetDefinition();
if(particleType==G4OpticalPhoton::OpticalPhotonDefinition())
{
if(postZ >= 40.9*cm)
{
std::cout << "Possibly hits sipm1: " << postZ << " | " << particleType -> GetParticleName() << std::endl;
}
//std::cout << "Optical photon\n";
/*if(preName == "Scintillator" && postName == "Scintillator")
{
std::cout << "Photon inside Scintillator" << std::endl;
}*/
if(postName == "Sipm0")
{
fTrack -> SetTrackStatus(fStopAndKill);
std::cout << "Photon reached Sipm0 at: " << step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume(1) -> GetCopyNo() << std::endl;
std::cout << "Mother Logical name: " << step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume(1) -> GetName() << std::endl;
analysis -> Fill(step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume(1) -> GetCopyNo(), postX, postY, postkinE, 1, step -> GetPostStepPoint() -> GetGlobalTime());
//sipm0_num++;
}
if(postName == "Sipm1")
{
fTrack -> SetTrackStatus(fStopAndKill);
std::cout << "Photon reached Sipm1 at: " << step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume(1) -> GetCopyNo() << std::endl;
std::cout << "Mother Logical name: " << step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume(1) -> GetName() << std::endl;
std::cout << "Coordinates: " << postX << " " << postY << std::endl;
std::cout << "Global time: " << step -> GetPostStepPoint() -> GetGlobalTime() << std::endl;
std::cout << "Local time: " << postTime << std::endl;
//std::cout << "Photon reached Sipm1 at copy no: " << postvolume -> GetCopyNo() << std::endl;
//sipm1_num++;
analysis -> Fill(step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume(1) -> GetCopyNo(), postX, postY, postkinE, 2, step -> GetPostStepPoint() -> GetGlobalTime());
}
/*if(postName == "Scintillator_W")
{
//std::cout << "Photon reached wolfram" << std::endl;
}*/
}
else if(particleType==G4Electron::ElectronDefinition())
{
//std::cout << "Electron\n";
}
//std::cout << "Sipm0: " << sipm0_num << std::endl << "Sipm1: " << sipm1_num << std::endl;
// collect energy deposited in this step
G4double edepStep = step->GetTotalEnergyDeposit();
fEventAction->AddEdep(edepStep);
}