Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,67 @@
#include "ExN04CalorimeterHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
G4Allocator<ExN04CalorimeterHit> ExN04CalorimeterHitAllocator;
ExN04CalorimeterHit::ExN04CalorimeterHit()
{pLogV=NULL;}
ExN04CalorimeterHit::ExN04CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi)
:pLogV(logVol),ZCellID(z),PhiCellID(phi)
{;}
ExN04CalorimeterHit::~ExN04CalorimeterHit()
{;}
ExN04CalorimeterHit::ExN04CalorimeterHit(const ExN04CalorimeterHit &right)
{
ZCellID = right.ZCellID;
PhiCellID = right.PhiCellID;
edep = right.edep;
pos = right.pos;
rot = right.rot;
pLogV = right.pLogV;
}
const ExN04CalorimeterHit& ExN04CalorimeterHit::operator=(const ExN04CalorimeterHit &right)
{
ZCellID = right.ZCellID;
PhiCellID = right.PhiCellID;
edep = right.edep;
pos = right.pos;
rot = right.rot;
pLogV = right.pLogV;
return *this;
}
int ExN04CalorimeterHit::operator==(const ExN04CalorimeterHit &right) const
{
return ((ZCellID==right.ZCellID)&&(PhiCellID==right.PhiCellID));
}
void ExN04CalorimeterHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Transform3D trans(rot,pos);
G4VisAttributes attribs;
const G4VisAttributes* pVA = pLogV->GetVisAttributes();
if(pVA) attribs = *pVA;
G4Colour colour(1.,0.,0.);
attribs.SetColour(colour);
attribs.SetForceWireframe(false);
attribs.SetForceSolid(true);
pVVisManager->Draw(*pLogV,attribs,trans);
}
}
void ExN04CalorimeterHit::Print()
{;}
@@ -0,0 +1,36 @@
#include "ExN04CalorimeterParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
ExN04CalorimeterParametrisation::ExN04CalorimeterParametrisation()
{
#include "ExN04DetectorParameterDef.icc"
}
ExN04CalorimeterParametrisation::~ExN04CalorimeterParametrisation()
{;}
void ExN04CalorimeterParametrisation::ComputeTransformation
(const G4int copyNo,G4VPhysicalVolume *physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
}
void ExN04CalorimeterParametrisation::ComputeDimensions
(G4Tubs & calorimeterLayer, const G4int copyNo,
const G4VPhysicalVolume * physVol) const
{
G4double innerRad = caloTubs_rmin
+ copyNo*(absorber_thick+scinti_thick);
calorimeterLayer.SetInnerRadius(innerRad);
calorimeterLayer.SetOuterRadius(innerRad+absorber_thick);
calorimeterLayer.SetZHalfLength(caloTubs_dz);
calorimeterLayer.SetStartPhiAngle(caloTubs_sphi);
calorimeterLayer.SetDeltaPhiAngle(caloTubs_dphi);
}
@@ -0,0 +1,87 @@
#include "ExN04CalorimeterROGeometry.hh"
#include "ExN04DummySD.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
ExN04CalorimeterROGeometry::ExN04CalorimeterROGeometry()
: G4VReadOutGeometry()
{
#include "ExN04DetectorParameterDef.icc"
}
ExN04CalorimeterROGeometry::ExN04CalorimeterROGeometry(G4String aString)
: G4VReadOutGeometry(aString)
{
#include "ExN04DetectorParameterDef.icc"
}
ExN04CalorimeterROGeometry::~ExN04CalorimeterROGeometry()
{
}
G4VPhysicalVolume* ExN04CalorimeterROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// ( It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
//Builds the ReadOut World:
G4Box *ROWorldBox = new G4Box("ROWorldBox", expHall_x, expHall_y, expHall_z);
G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorldBox, dummyMat,
"ROWorldLogical", 0, 0, 0);
G4PVPlacement *ROWorldPhys = new G4PVPlacement(0,G4ThreeVector(),
"ROWorldPhysical",
ROWorldLog,
0,false,0);
// Calorimeter volume:
G4VSolid * caloROtub
= new G4Tubs("caloROtub",caloTubs_rmin,caloTubs_rmax,
caloTubs_dz,caloTubs_sphi,caloTubs_dphi);
G4LogicalVolume * caloROlog
= new G4LogicalVolume(caloROtub,dummyMat,"caloROlogical",0,0,0);
G4VPhysicalVolume * caloROphys
= new G4PVPlacement(0,G4ThreeVector(),"calROphysical",caloROlog,
ROWorldPhys,false,0);
// -------------------------------
// Calorimeter readout division:
// -------------------------------
// Phi division first: 48 sectors
G4VSolid * caloROphiDivisionTub
= new G4Tubs("caloROphiDivision", caloCell_rmin, caloCell_rmax,
caloCell_dz, caloCell_sphi, caloCell_dphi);
G4LogicalVolume * caloROphiDivisionLog
= new G4LogicalVolume(caloROphiDivisionTub, dummyMat, "caloROphiDivisionLogical",0,0,0);
G4VPhysicalVolume * caloROphiDivisionPhys
= new G4PVReplica("caloROphiDivisionPhysical", caloROphiDivisionLog, caloROphys,
kPhi, segmentsinPhi, caloCell_dphi);
// then z division: 20 slices:
G4VSolid * caloROcellTub
= new G4Tubs("caloROcellTub", caloRing_rmin, caloRing_rmax,
caloRing_dz, caloRing_sphi, caloRing_dphi);
G4LogicalVolume * caloROcellLog
= new G4LogicalVolume(caloROcellTub, dummyMat, "caloROcellLogical",0,0,0);
G4VPhysicalVolume * caloROcellPhys
= new G4PVReplica("caloROcellPhysical", caloROcellLog, caloROphiDivisionPhys,
kZAxis, segmentsinZ,2.*caloRing_dz);
//Flags the cells as sensitive .The pointer here serves
// as a flag only to check for sensitivity.
// (Could we make it by a simple cast of a non-NULL value ?)
ExN04DummySD * dummySensi = new ExN04DummySD;
caloROcellLog->SetSensitiveDetector(dummySensi);
return ROWorldPhys;
}
@@ -0,0 +1,93 @@
#include "ExN04CalorimeterSD.hh"
#include "ExN04CalorimeterHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
ExN04CalorimeterSD::ExN04CalorimeterSD(G4String name)
:G4VSensitiveDetector(name),
numberOfCellsInZ(20),numberOfCellsInPhi(48)
{
G4String HCname;
collectionName.insert(HCname="calCollection");
}
ExN04CalorimeterSD::~ExN04CalorimeterSD()
{;}
void ExN04CalorimeterSD::Initialize(G4HCofThisEvent*HCE)
{
CalCollection = new ExN04CalorimeterHitsCollection
(SensitiveDetectorName,collectionName[0]);
for(int j=0;j<numberOfCellsInZ;j++)
for(int k=0;k<numberOfCellsInPhi;k++)
{
CellID[j][k] = -1;
}
}
G4bool ExN04CalorimeterSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
{
if(!ROhist) return false;
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false;
G4VPhysicalVolume* physVol = ROhist->GetVolume();
//ROhist->MoveUpHistory();
G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
int copyIDinZ = ROhist->GetReplicaNumber();
int copyIDinPhi = ROhist->GetReplicaNumber(1);
if(CellID[copyIDinZ][copyIDinPhi]==-1)
{
ExN04CalorimeterHit* calHit
= new ExN04CalorimeterHit
(physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi);
G4RotationMatrix rotM;
if(physVol->GetObjectRotation()) rotM = *(physVol->GetObjectRotation());
calHit->SetEdep( edep );
calHit->SetPos( physVol->GetTranslation() );
calHit->SetRot( rotM );
int icell = CalCollection->insert( calHit );
CellID[copyIDinZ][copyIDinPhi] = icell - 1;
if(verboseLevel>0)
{ G4cout << " New Calorimeter Hit on CellID "
<< copyIDinZ << " " << copyIDinPhi << endl; }
}
else
{
(*CalCollection)[CellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep);
if(verboseLevel>0)
{ G4cout << " Energy added to CellID "
<< copyIDinZ << " " << copyIDinPhi << endl; }
}
return true;
}
void ExN04CalorimeterSD::EndOfEvent(G4HCofThisEvent*HCE)
{
static G4int HCID = -1;
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection( HCID, CalCollection );
}
void ExN04CalorimeterSD::clear()
{
}
void ExN04CalorimeterSD::DrawAll()
{
}
void ExN04CalorimeterSD::PrintAll()
{
}
@@ -0,0 +1,240 @@
#include "ExN04DetectorConstruction.hh"
#include "ExN04TrackerSD.hh"
#include "ExN04CalorimeterSD.hh"
#include "ExN04CalorimeterROGeometry.hh"
#include "ExN04MuonSD.hh"
#include "ExN04TrackerParametrisation.hh"
#include "ExN04CalorimeterParametrisation.hh"
#include "ExN04Field.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
ExN04DetectorConstruction::ExN04DetectorConstruction()
{
#include "ExN04DetectorParameterDef.icc"
}
ExN04DetectorConstruction::~ExN04DetectorConstruction()
{;}
G4VPhysicalVolume* ExN04DetectorConstruction::Construct()
{
//-------------------------------------------------------------------------
// Magnetic field
//-------------------------------------------------------------------------
static G4bool fieldIsInitialized = false;
if(!fieldIsInitialized)
{
ExN04Field* myField = new ExN04Field;
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()
->GetFieldManager();
fieldMgr->SetDetectorField(myField);
fieldMgr->CreateChordFinder(myField);
fieldIsInitialized = true;
}
//-------------------------------------------------------------------------
// Materials
//-------------------------------------------------------------------------
G4double a, iz, z, density;
G4String name, symbol;
G4int nel;
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
a = 12.01*g/mole;
G4Element* elC = new G4Element(name="Carbon", symbol="C", iz=6., a);
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen", symbol="O", iz=8., a);
density = 1.29e-03*g/cm3;
G4Material* Air = new G4Material(name="Air", density, nel=2);
Air->AddElement(elN, .7);
Air->AddElement(elO, .3);
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* Lead = new G4Material(name="Lead", z=82., a, density);
a = 39.95*g/mole;
density = 1.782e-03*g/cm3;
G4Material* Ar = new G4Material(name="ArgonGas", z=18., a, density);
a = 28.09*g/mole;
density = 2.33*g/cm3;
G4Material * Silicon = new G4Material(name="Silicon", z=14., a, density);
density = 1.032*g/cm3;
G4Material* Scinti = new G4Material(name="Scintillator", density, nel=2);
Scinti->AddElement(elC, 9);
Scinti->AddElement(elH, 10);
//-------------------------------------------------------------------------
// Detector geometry
//-------------------------------------------------------------------------
//------------------------------ experimental hall
G4Box * experimentalHall_box
= new G4Box("expHall_b",expHall_x,expHall_y,expHall_z);
G4LogicalVolume * experimentalHall_log
= new G4LogicalVolume(experimentalHall_box,Air,"expHall_L",0,0,0);
G4VPhysicalVolume * experimentalHall_phys
= new G4PVPlacement(0,G4ThreeVector(),"expHall_P",
experimentalHall_log,0,false,0);
G4VisAttributes* experimentalHallVisAtt
= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
experimentalHallVisAtt->SetForceWireframe(true);
experimentalHall_log->SetVisAttributes(experimentalHallVisAtt);
//------------------------------ tracker
G4VSolid * tracker_tubs
= new G4Tubs("trkTubs_tubs",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
trkTubs_sphi,trkTubs_dphi);
G4LogicalVolume * tracker_log
= new G4LogicalVolume(tracker_tubs,Ar,"trackerT_L",0,0,0);
G4VPhysicalVolume * tracker_phys
= new G4PVPlacement(0,G4ThreeVector(),"tracker_phys",tracker_log,
experimentalHall_phys,false,0);
G4VisAttributes* tracker_logVisAtt
= new G4VisAttributes(G4Colour(1.0,0.0,1.0));
tracker_logVisAtt->SetForceWireframe(true);
tracker_log->SetVisAttributes(tracker_logVisAtt);
//------------------------------ tracker layers
// As an example for Parameterised volume
// dummy values for G4Tubs -- modified by parameterised volume
G4VSolid * trackerLayer_tubs
= new G4Tubs("trackerLayer_tubs",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
trkTubs_sphi,trkTubs_dphi);
G4LogicalVolume * trackerLayer_log
= new G4LogicalVolume(trackerLayer_tubs,Silicon,"trackerB_L",0,0,0);
G4VPVParameterisation * trackerParam
= new ExN04TrackerParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
G4VPhysicalVolume *trackerLayer_phys
= new G4PVParameterised("trackerLayer_phys",trackerLayer_log,tracker_phys,
kXAxis, notrkLayers, trackerParam);
G4VisAttributes* trackerLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
trackerLayer_logVisAtt->SetForceWireframe(true);
trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
//------------------------------ calorimeter
G4VSolid * calorimeter_tubs
= new G4Tubs("calorimeter_tubs",caloTubs_rmin,caloTubs_rmax,
caloTubs_dz,caloTubs_sphi,caloTubs_dphi);
G4LogicalVolume * calorimeter_log
= new G4LogicalVolume(calorimeter_tubs,Scinti,"caloT_L",0,0,0);
G4VPhysicalVolume * calorimeter_phys
= new G4PVPlacement(0,G4ThreeVector(),"caloM_P",calorimeter_log,
experimentalHall_phys,false,0);
G4VisAttributes* calorimeter_logVisATT
= new G4VisAttributes(G4Colour(1.0,1.0,0.0));
calorimeter_logVisATT->SetForceWireframe(true);
calorimeter_log->SetVisAttributes(calorimeter_logVisATT);
//------------------------------- Lead layers
// As an example for Parameterised volume
// dummy values for G4Tubs -- modified by parameterised volume
G4VSolid * caloLayer_tubs
= new G4Tubs("caloLayer_tubs",caloRing_rmin,caloRing_rmax,
caloRing_dz,caloRing_sphi,caloRing_dphi);
G4LogicalVolume * caloLayer_log
= new G4LogicalVolume(caloLayer_tubs,Lead,"caloR_L",0,0,0);
G4VPVParameterisation * calorimeterParam
= new ExN04CalorimeterParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
G4VPhysicalVolume * caloLayer_phys
= new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_phys,
kXAxis, nocaloLayers, calorimeterParam);
G4VisAttributes* caloLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.7,1.0,0.0));
caloLayer_logVisAtt->SetForceWireframe(true);
caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
//------------------------------ muon counters
// As an example of CSG volumes with rotation
G4VSolid * muoncounter_box
= new G4Box("muoncounter_box",muBox_width,muBox_thick,
muBox_length);
G4LogicalVolume * muoncounter_log
= new G4LogicalVolume(muoncounter_box,Scinti,"mucounter_L",0,0,0);
G4VPhysicalVolume * muoncounter_phys;
for(int i=0; i<nomucounter ; i++)
{
G4double phi, x, y, z;
phi = 360.*deg/nomucounter*i;
x = muBox_radius*sin(phi);
y = muBox_radius*cos(phi);
z = 0.*cm;
G4RotationMatrix rm;
rm.rotateZ(phi);
muoncounter_phys
= new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(x,y,z)),
"muoncounter_P",muoncounter_log,
experimentalHall_phys,false,i);
}
G4VisAttributes* muoncounter_logVisAtt
= new G4VisAttributes(G4Colour(0.0,1.0,1.0));
muoncounter_logVisAtt->SetForceWireframe(true);
muoncounter_log->SetVisAttributes(muoncounter_logVisAtt);
//------------------------------------------------------------------
// Sensitive Detector
//------------------------------------------------------------------
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String trackerSDname = "/mydet/tracker";
ExN04TrackerSD * trackerSD = new ExN04TrackerSD(trackerSDname);
SDman->AddNewDetector(trackerSD);
trackerLayer_log->SetSensitiveDetector(trackerSD);
G4String calorimeterSDname = "/mydet/calorimeter";
ExN04CalorimeterSD * calorimeterSD = new ExN04CalorimeterSD(calorimeterSDname);
G4String ROgeometryName = "CalorimeterROGeom";
G4VReadOutGeometry* calRO = new ExN04CalorimeterROGeometry(ROgeometryName);
calRO->BuildROGeometry();
calorimeterSD->SetROgeometry(calRO);
SDman->AddNewDetector(calorimeterSD);
calorimeter_log->SetSensitiveDetector(calorimeterSD);
G4String muonSDname = "/mydet/muon";
ExN04MuonSD * muonSD = new ExN04MuonSD(muonSDname);
SDman->AddNewDetector(muonSD);
muoncounter_log->SetSensitiveDetector(muonSD);
//------------------------------------------------------------------
// Digitizer modules
//------------------------------------------------------------------
return experimentalHall_phys;
}
@@ -0,0 +1,54 @@
expHall_x = 600.*cm;
expHall_y = 600.*cm;
expHall_z = 600.*cm;
trkTubs_rmax = 50.*cm;
trkTubs_rmin = 20.*cm;
trkTubs_dz = 100.*cm;
trkTubs_sphi = 0.*deg;
trkTubs_dphi = 360.*deg;
notrkLayers = 5;
tracker_radius[0] = 25.*cm;
tracker_radius[1] = 30.*cm;
tracker_radius[2] = 35.*cm;
tracker_radius[3] = 40.*cm;
tracker_radius[4] = 45.*cm;
tracker_thick = 0.5*cm;
for(int il=0;il<5;il++)
{
tracker_length[il] = tracker_radius[il];
}
caloTubs_rmax = 300.*cm;
caloTubs_rmin = 50.*cm;
caloTubs_dz = 200.*cm;
caloTubs_sphi = 0.*deg;
caloTubs_dphi = 360.*deg;
absorber_thick = 3.*cm;
scinti_thick = 2.*cm;
nocaloLayers = int((caloTubs_rmax-caloTubs_rmin)/(absorber_thick+scinti_thick));
segmentsinPhi = 48;
caloCell_rmax = caloTubs_rmax;
caloCell_rmin = caloTubs_rmin;
caloCell_dz = caloTubs_dz;
caloCell_sphi = caloTubs_sphi;
caloCell_dphi = caloTubs_dphi/segmentsinPhi;
segmentsinZ = 20;
caloRing_rmax = caloCell_rmax;
caloRing_rmin = caloCell_rmin;
caloRing_dz = caloCell_dz/segmentsinZ ;
caloRing_sphi = caloCell_sphi;
caloRing_dphi = caloCell_dphi;
nomucounter = 4;
muBox_radius = 350.*cm;
muBox_width = muBox_radius - 5.*cm;
muBox_thick = 1.*cm;
muBox_length = 2.*muBox_radius;
+100
View File
@@ -0,0 +1,100 @@
#include "ExN04EventAction.hh"
#include "ExN04TrackerHit.hh"
#include "ExN04CalorimeterHit.hh"
#include "ExN04MuonHit.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
ExN04EventAction::ExN04EventAction()
{
trackerCollID = -1;
calorimeterCollID = -1;
muonCollID = -1;
}
ExN04EventAction::~ExN04EventAction()
{;}
void ExN04EventAction::BeginOfEventAction()
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
if(trackerCollID<0||calorimeterCollID<0||muonCollID<0)
{
G4String colNam;
trackerCollID = SDman->GetCollectionID(colNam="trackerCollection");
calorimeterCollID = SDman->GetCollectionID(colNam="calCollection");
muonCollID = SDman->GetCollectionID(colNam="muonCollection");
}
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4UImanager::GetUIpointer()->ApplyCommand("/vis/draw/current");
}
}
void ExN04EventAction::EndOfEventAction()
{
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
G4cout << ">>> Event " << evt->GetEventID() << endl;
if(trackerCollID<0||calorimeterCollID<0||muonCollID<0) return;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
ExN04TrackerHitsCollection* THC = NULL;
ExN04CalorimeterHitsCollection* CHC = NULL;
ExN04MuonHitsCollection* MHC = NULL;
if(HCE)
{
THC = (ExN04TrackerHitsCollection*)(HCE->GetHC(trackerCollID));
CHC = (ExN04CalorimeterHitsCollection*)(HCE->GetHC(calorimeterCollID));
MHC = (ExN04MuonHitsCollection*)(HCE->GetHC(muonCollID));
}
if(THC)
{
int n_hit = THC->entries();
G4cout << " " << n_hit
<< " hits are stored in ExN04TrackerHitsCollection." << endl;
}
if(CHC)
{
int n_hit = CHC->entries();
G4cout << " " << n_hit
<< " hits are stored in ExN04CalorimeterHitsCollection." << endl;
G4double totE = 0;
for(int i=0;i<n_hit;i++)
{ totE += (*CHC)[i]->GetEdep(); }
G4cout << " Total energy deposition in calorimeter : "
<< totE / GeV << " (GeV)" << endl;
}
if(MHC)
{
int n_hit = MHC->entries();
G4cout << " " << n_hit
<< " hits are stored in ExN04MuonHitsCollection." << endl;
}
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
if(THC) THC->DrawAllHits();
if(CHC) CHC->DrawAllHits();
if(MHC) MHC->DrawAllHits();
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
}
}
+23
View File
@@ -0,0 +1,23 @@
#include "ExN04Field.hh"
ExN04Field::ExN04Field()
{
Bz = 3.0*tesla;
rmax_sq = sqr(50.*cm);
zmax = 100.*cm;
}
ExN04Field::~ExN04Field()
{;}
void ExN04Field::GetFieldValue(const double Point[3],double *Bfield) const
{
Bfield[0] = 0.;
Bfield[1] = 0.;
if(abs(Point[2])<zmax && (sqr(Point[0])+sqr(Point[1]))<rmax_sq)
{ Bfield[2] = Bz; }
else
{ Bfield[2] = 0.; }
}
+53
View File
@@ -0,0 +1,53 @@
#include "ExN04MuonHit.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
G4Allocator<ExN04MuonHit> ExN04MuonHitAllocator;
ExN04MuonHit::ExN04MuonHit()
{;}
ExN04MuonHit::~ExN04MuonHit()
{;}
ExN04MuonHit::ExN04MuonHit(const ExN04MuonHit &right)
{
edep = right.edep;
pos = right.pos;
}
const ExN04MuonHit& ExN04MuonHit::operator=(const ExN04MuonHit &right)
{
edep = right.edep;
pos = right.pos;
return *this;
}
int ExN04MuonHit::operator==(const ExN04MuonHit &right) const
{
return 0;
}
void ExN04MuonHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(pos);
circle.SetScreenSize(0.04);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
void ExN04MuonHit::Print()
{;}
+73
View File
@@ -0,0 +1,73 @@
#include "ExN04MuonSD.hh"
#include "ExN04MuonHit.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ios.hh"
ExN04MuonSD::ExN04MuonSD(G4String name)
:G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="muonCollection");
positionResolution = 5*cm;
}
ExN04MuonSD::~ExN04MuonSD(){;}
void ExN04MuonSD::Initialize(G4HCofThisEvent*HCE)
{
static int HCID = -1;
muonCollection = new ExN04MuonHitsCollection
(SensitiveDetectorName,collectionName[0]);
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection(HCID,muonCollection);
}
G4bool ExN04MuonSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
{
G4Track* aTrack = aStep->GetTrack();
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return true;
ExN04MuonHit* aHit;
int nHit = muonCollection->entries();
G4ThreeVector hitpos = aStep->GetPreStepPoint()->GetPosition();
for(int i=0;i<nHit;i++)
{
aHit = (*muonCollection)[i];
G4ThreeVector pos = aHit->GetPos();
G4double dist2 = sqr(pos.x()-hitpos.x())
+sqr(pos.y()-hitpos.y())+sqr(pos.z()-hitpos.z());
if(dist2<=sqr(positionResolution))
aHit->AddEdep(edep);
return true;
}
aHit = new ExN04MuonHit();
aHit->SetEdep( edep );
aHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
muonCollection->insert( aHit );
return true;
}
void ExN04MuonSD::EndOfEvent(G4HCofThisEvent*HCE)
{;}
void ExN04MuonSD::clear()
{
}
void ExN04MuonSD::DrawAll()
{
}
void ExN04MuonSD::PrintAll()
{
}
+669
View File
@@ -0,0 +1,669 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN04PhysicsList.cc,v 1.12 1998/12/14 21:17:58 stesting Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "ExN04PhysicsList.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include <iomanip.h>
#include "G4FastSimulationManagerProcess.hh"
ExN04PhysicsList::ExN04PhysicsList(): G4VUserPhysicsList()
{
SetVerboseLevel(1);
}
ExN04PhysicsList::~ExN04PhysicsList()
{
}
void ExN04PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
// create all particles
ConstructAllParticles();
}
void ExN04PhysicsList::ConstructProcess()
{
AddTransportation();
AddParameterisation();
ConstructEM();
ConstructLeptHad();
ConstructHad();
ConstructGeneral();
}
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
void ExN04PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
// Construct processes for gamma
pmanager->AddDiscreteProcess(new G4GammaConversion());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
} else if (particleName == "e-") {
//electron
// Construct processes for electron
G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
G4VProcess* theeminusIonisation = new G4eIonisation();
G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
// add processes
pmanager->AddProcess(theeminusMultipleScattering);
pmanager->AddProcess(theeminusIonisation);
pmanager->AddProcess(theeminusBremsstrahlung);
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep, 2);
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
} else if (particleName == "e+") {
//positron
// Construct processes for positron
G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
G4VProcess* theeplusIonisation = new G4eIonisation();
G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
// add processes
pmanager->AddProcess(theeplusMultipleScattering);
pmanager->AddProcess(theeplusIonisation);
pmanager->AddProcess(theeplusBremsstrahlung);
pmanager->AddProcess(theeplusAnnihilation);
// set ordering for AtRestDoIt
pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep, 2);
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
// Construct processes for muon+
G4VProcess* aMultipleScattering = new G4MultipleScattering();
G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
G4VProcess* aPairProduction = new G4MuPairProduction();
G4VProcess* anIonisation = new G4MuIonisation();
// add processes
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
pmanager->AddProcess(aBremsstrahlung);
pmanager->AddProcess(aPairProduction);
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
} else if( particleName == "GenericIon" ) {
G4VProcess* aionIonization = new G4ionIonisation;
G4VProcess* aMultipleScattering = new G4MultipleScattering();
pmanager->AddProcess(aionIonization);
pmanager->AddProcess(aMultipleScattering);
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(aionIonization, idxAlongStep, 2);
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(aionIonization, idxPostStep, 2);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
// all others charged particles except geantino
G4VProcess* aMultipleScattering = new G4MultipleScattering();
G4VProcess* anIonisation = new G4hIonisation();
// add processes
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
}
}
}
// Hadron Processes
#include "G4HadronElasticProcess.hh"
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "G4KaonPlusInelasticProcess.hh"
#include "G4KaonZeroSInelasticProcess.hh"
#include "G4KaonZeroLInelasticProcess.hh"
#include "G4KaonMinusInelasticProcess.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4AntiProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4AntiNeutronInelasticProcess.hh"
#include "G4LambdaInelasticProcess.hh"
#include "G4AntiLambdaInelasticProcess.hh"
#include "G4SigmaPlusInelasticProcess.hh"
#include "G4SigmaMinusInelasticProcess.hh"
#include "G4AntiSigmaPlusInelasticProcess.hh"
#include "G4AntiSigmaMinusInelasticProcess.hh"
#include "G4XiZeroInelasticProcess.hh"
#include "G4XiMinusInelasticProcess.hh"
#include "G4AntiXiZeroInelasticProcess.hh"
#include "G4AntiXiMinusInelasticProcess.hh"
#include "G4DeuteronInelasticProcess.hh"
#include "G4TritonInelasticProcess.hh"
#include "G4AlphaInelasticProcess.hh"
#include "G4OmegaMinusInelasticProcess.hh"
#include "G4AntiOmegaMinusInelasticProcess.hh"
// Low-energy Models
#include "G4LElastic.hh"
#include "G4LEPionPlusInelastic.hh"
#include "G4LEPionMinusInelastic.hh"
#include "G4LEKaonPlusInelastic.hh"
#include "G4LEKaonZeroSInelastic.hh"
#include "G4LEKaonZeroLInelastic.hh"
#include "G4LEKaonMinusInelastic.hh"
#include "G4LEProtonInelastic.hh"
#include "G4LEAntiProtonInelastic.hh"
#include "G4LENeutronInelastic.hh"
#include "G4LEAntiNeutronInelastic.hh"
#include "G4LELambdaInelastic.hh"
#include "G4LEAntiLambdaInelastic.hh"
#include "G4LESigmaPlusInelastic.hh"
#include "G4LESigmaMinusInelastic.hh"
#include "G4LEAntiSigmaPlusInelastic.hh"
#include "G4LEAntiSigmaMinusInelastic.hh"
#include "G4LEXiZeroInelastic.hh"
#include "G4LEXiMinusInelastic.hh"
#include "G4LEAntiXiZeroInelastic.hh"
#include "G4LEAntiXiMinusInelastic.hh"
#include "G4LEDeuteronInelastic.hh"
#include "G4LETritonInelastic.hh"
#include "G4LEAlphaInelastic.hh"
#include "G4LEOmegaMinusInelastic.hh"
#include "G4LEAntiOmegaMinusInelastic.hh"
// High-energy Models
#include "G4HEPionPlusInelastic.hh"
#include "G4HEPionMinusInelastic.hh"
#include "G4HEKaonPlusInelastic.hh"
#include "G4HEKaonZeroInelastic.hh"
#include "G4HEKaonZeroInelastic.hh"
#include "G4HEKaonMinusInelastic.hh"
#include "G4HEProtonInelastic.hh"
#include "G4HEAntiProtonInelastic.hh"
#include "G4HENeutronInelastic.hh"
#include "G4HEAntiNeutronInelastic.hh"
#include "G4HELambdaInelastic.hh"
#include "G4HEAntiLambdaInelastic.hh"
#include "G4HESigmaPlusInelastic.hh"
#include "G4HESigmaMinusInelastic.hh"
#include "G4HEAntiSigmaPlusInelastic.hh"
#include "G4HEAntiSigmaMinusInelastic.hh"
#include "G4HEXiZeroInelastic.hh"
#include "G4HEXiMinusInelastic.hh"
#include "G4HEAntiXiZeroInelastic.hh"
#include "G4HEAntiXiMinusInelastic.hh"
#include "G4HEOmegaMinusInelastic.hh"
#include "G4HEAntiOmegaMinusInelastic.hh"
// Stopping processes
#ifdef TRIUMF_STOP_PIMINUS
#include "G4PionMinusAbsorptionAtRest.hh"
#else
#include "G4PiMinusAbsorptionAtRest.hh"
#endif
#ifdef TRIUMF_STOP_KMINUS
#include "G4KaonMinusAbsorption.hh"
#else
#include "G4KaonMinusAbsorptionAtRest.hh"
#endif
//
// ConstructHad()
//
// Makes discrete physics processes for the hadrons, at present limited
// to those particles with GHEISHA interactions (INTRC > 0).
// The processes are: Elastic scattering and Inelastic scattering.
//
// F.W.Jones 09-JUL-1998
//
void ExN04PhysicsList::ConstructHad()
{
G4HadronElasticProcess* theElasticProcess =
new G4HadronElasticProcess;
G4LElastic* theElasticModel = new G4LElastic;
theElasticProcess->RegisterMe(theElasticModel);
theParticleIterator->reset();
while ((*theParticleIterator)()) {
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "pi+") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4PionPlusInelasticProcess* theInelasticProcess =
new G4PionPlusInelasticProcess("inelastic");
G4LEPionPlusInelastic* theLEInelasticModel =
new G4LEPionPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEPionPlusInelastic* theHEInelasticModel =
new G4HEPionPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "pi-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4PionMinusInelasticProcess* theInelasticProcess =
new G4PionMinusInelasticProcess("inelastic");
G4LEPionMinusInelastic* theLEInelasticModel =
new G4LEPionMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEPionMinusInelastic* theHEInelasticModel =
new G4HEPionMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
#ifdef TRIUMF_STOP_PIMINUS
pmanager->AddRestProcess(new G4PionMinusAbsorptionAtRest, ordDefault);
#else
G4String prcNam;
pmanager->AddRestProcess(
new G4PiMinusAbsorptionAtRest(
prcNam="PiMinusAbsorptionAtRest"), ordDefault);
#endif
}
else if (particleName == "kaon+") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonPlusInelasticProcess* theInelasticProcess =
new G4KaonPlusInelasticProcess("inelastic");
G4LEKaonPlusInelastic* theLEInelasticModel =
new G4LEKaonPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonPlusInelastic* theHEInelasticModel =
new G4HEKaonPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon0S") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonZeroSInelasticProcess* theInelasticProcess =
new G4KaonZeroSInelasticProcess("inelastic");
G4LEKaonZeroSInelastic* theLEInelasticModel =
new G4LEKaonZeroSInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonZeroInelastic* theHEInelasticModel =
new G4HEKaonZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon0L") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonZeroLInelasticProcess* theInelasticProcess =
new G4KaonZeroLInelasticProcess("inelastic");
G4LEKaonZeroLInelastic* theLEInelasticModel =
new G4LEKaonZeroLInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonZeroInelastic* theHEInelasticModel =
new G4HEKaonZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonMinusInelasticProcess* theInelasticProcess =
new G4KaonMinusInelasticProcess("inelastic");
G4LEKaonMinusInelastic* theLEInelasticModel =
new G4LEKaonMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonMinusInelastic* theHEInelasticModel =
new G4HEKaonMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
#ifdef TRIUMF_STOP_KMINUS
pmanager->AddRestProcess(new G4KaonMinusAbsorption, ordDefault);
#else
pmanager->AddRestProcess(new G4KaonMinusAbsorptionAtRest, ordDefault);
#endif
}
else if (particleName == "proton") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4ProtonInelasticProcess* theInelasticProcess =
new G4ProtonInelasticProcess("inelastic");
G4LEProtonInelastic* theLEInelasticModel = new G4LEProtonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEProtonInelastic* theHEInelasticModel = new G4HEProtonInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_proton") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiProtonInelasticProcess* theInelasticProcess =
new G4AntiProtonInelasticProcess("inelastic");
G4LEAntiProtonInelastic* theLEInelasticModel =
new G4LEAntiProtonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiProtonInelastic* theHEInelasticModel =
new G4HEAntiProtonInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "neutron") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4NeutronInelasticProcess* theInelasticProcess =
new G4NeutronInelasticProcess("inelastic");
G4LENeutronInelastic* theLEInelasticModel =
new G4LENeutronInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HENeutronInelastic* theHEInelasticModel =
new G4HENeutronInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_neutron") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiNeutronInelasticProcess* theInelasticProcess =
new G4AntiNeutronInelasticProcess("inelastic");
G4LEAntiNeutronInelastic* theLEInelasticModel =
new G4LEAntiNeutronInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiNeutronInelastic* theHEInelasticModel =
new G4HEAntiNeutronInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "lambda") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4LambdaInelasticProcess* theInelasticProcess =
new G4LambdaInelasticProcess("inelastic");
G4LELambdaInelastic* theLEInelasticModel = new G4LELambdaInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HELambdaInelastic* theHEInelasticModel = new G4HELambdaInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_lambda") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiLambdaInelasticProcess* theInelasticProcess =
new G4AntiLambdaInelasticProcess("inelastic");
G4LEAntiLambdaInelastic* theLEInelasticModel =
new G4LEAntiLambdaInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiLambdaInelastic* theHEInelasticModel =
new G4HEAntiLambdaInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "sigma+") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4SigmaPlusInelasticProcess* theInelasticProcess =
new G4SigmaPlusInelasticProcess("inelastic");
G4LESigmaPlusInelastic* theLEInelasticModel =
new G4LESigmaPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HESigmaPlusInelastic* theHEInelasticModel =
new G4HESigmaPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "sigma-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4SigmaMinusInelasticProcess* theInelasticProcess =
new G4SigmaMinusInelasticProcess("inelastic");
G4LESigmaMinusInelastic* theLEInelasticModel =
new G4LESigmaMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HESigmaMinusInelastic* theHEInelasticModel =
new G4HESigmaMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_sigma+") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiSigmaPlusInelasticProcess* theInelasticProcess =
new G4AntiSigmaPlusInelasticProcess("inelastic");
G4LEAntiSigmaPlusInelastic* theLEInelasticModel =
new G4LEAntiSigmaPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiSigmaPlusInelastic* theHEInelasticModel =
new G4HEAntiSigmaPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_sigma-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiSigmaMinusInelasticProcess* theInelasticProcess =
new G4AntiSigmaMinusInelasticProcess("inelastic");
G4LEAntiSigmaMinusInelastic* theLEInelasticModel =
new G4LEAntiSigmaMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiSigmaMinusInelastic* theHEInelasticModel =
new G4HEAntiSigmaMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "xi0") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4XiZeroInelasticProcess* theInelasticProcess =
new G4XiZeroInelasticProcess("inelastic");
G4LEXiZeroInelastic* theLEInelasticModel =
new G4LEXiZeroInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEXiZeroInelastic* theHEInelasticModel =
new G4HEXiZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "xi-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4XiMinusInelasticProcess* theInelasticProcess =
new G4XiMinusInelasticProcess("inelastic");
G4LEXiMinusInelastic* theLEInelasticModel =
new G4LEXiMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEXiMinusInelastic* theHEInelasticModel =
new G4HEXiMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_xi0") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiXiZeroInelasticProcess* theInelasticProcess =
new G4AntiXiZeroInelasticProcess("inelastic");
G4LEAntiXiZeroInelastic* theLEInelasticModel =
new G4LEAntiXiZeroInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiXiZeroInelastic* theHEInelasticModel =
new G4HEAntiXiZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_xi-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiXiMinusInelasticProcess* theInelasticProcess =
new G4AntiXiMinusInelasticProcess("inelastic");
G4LEAntiXiMinusInelastic* theLEInelasticModel =
new G4LEAntiXiMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiXiMinusInelastic* theHEInelasticModel =
new G4HEAntiXiMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "deuteron") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4DeuteronInelasticProcess* theInelasticProcess =
new G4DeuteronInelasticProcess("inelastic");
G4LEDeuteronInelastic* theLEInelasticModel =
new G4LEDeuteronInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "triton") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4TritonInelasticProcess* theInelasticProcess =
new G4TritonInelasticProcess("inelastic");
G4LETritonInelastic* theLEInelasticModel =
new G4LETritonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "alpha") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AlphaInelasticProcess* theInelasticProcess =
new G4AlphaInelasticProcess("inelastic");
G4LEAlphaInelastic* theLEInelasticModel =
new G4LEAlphaInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "omega-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4OmegaMinusInelasticProcess* theInelasticProcess =
new G4OmegaMinusInelasticProcess("inelastic");
G4LEOmegaMinusInelastic* theLEInelasticModel =
new G4LEOmegaMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEOmegaMinusInelastic* theHEInelasticModel =
new G4HEOmegaMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_omega-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiOmegaMinusInelasticProcess* theInelasticProcess =
new G4AntiOmegaMinusInelasticProcess("inelastic");
G4LEAntiOmegaMinusInelastic* theLEInelasticModel =
new G4LEAntiOmegaMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiOmegaMinusInelastic* theHEInelasticModel =
new G4HEAntiOmegaMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
}
}
void ExN04PhysicsList::ConstructLeptHad()
{;}
#include "G4Decay.hh"
void ExN04PhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
void ExN04PhysicsList::AddParameterisation()
{
G4FastSimulationManagerProcess*
theFastSimulationManagerProcess =
new G4FastSimulationManagerProcess();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
pmanager->AddDiscreteProcess(theFastSimulationManagerProcess);
}
}
void ExN04PhysicsList::SetCuts(G4double cut)
{
if (verboseLevel >0){
G4cout << "ExN04PhysicsList::SetCuts:";
G4cout << "CutLength : " << cut/mm << " (mm)" << endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cut, "gamma");
SetCutValue(cut, "e-");
SetCutValue(cut, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
SetCutValue(cut, "proton");
SetCutValue(cut, "anti_proton");
SetCutValueForOthers(cut);
if (verboseLevel>1) {
DumpCutValuesTable();
}
}
@@ -0,0 +1,46 @@
#include "ExN04PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4HEPEvtInterface.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "ExN04PrimaryGeneratorMessenger.hh"
ExN04PrimaryGeneratorAction::ExN04PrimaryGeneratorAction()
{
HEPEvt = new G4HEPEvtInterface("pythia_event.data");
G4int n_particle = 1;
G4ParticleGun* fParticleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu+");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
fParticleGun->SetParticleEnergy(100.*GeV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
particleGun = fParticleGun;
messenger = new ExN04PrimaryGeneratorMessenger(this);
useHEPEvt = true;
}
ExN04PrimaryGeneratorAction::~ExN04PrimaryGeneratorAction()
{
delete HEPEvt;
delete particleGun;
delete messenger;
}
void ExN04PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
if(useHEPEvt)
{ HEPEvt->GeneratePrimaryVertex(anEvent); }
else
{ particleGun->GeneratePrimaryVertex(anEvent); }
}
@@ -0,0 +1,48 @@
#include "ExN04PrimaryGeneratorMessenger.hh"
#include "ExN04PrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4ios.hh"
ExN04PrimaryGeneratorMessenger::ExN04PrimaryGeneratorMessenger(ExN04PrimaryGeneratorAction * mpga)
:myAction(mpga)
{
mydetDirectory = new G4UIdirectory("/mydet/");
mydetDirectory->SetGuidance("ExN04 detector control commands.");
genCmd = new G4UIcmdWithAString("/mydet/generator",this);
genCmd->SetGuidance("Select primary generator.");
genCmd->SetGuidance(" Available generators : PYTHIA, particleGun");
genCmd->SetParameterName("generator",true);
genCmd->SetDefaultValue("PYTHIA");
genCmd->SetCandidates("PYTHIA particleGun");
}
ExN04PrimaryGeneratorMessenger::~ExN04PrimaryGeneratorMessenger()
{
delete genCmd;
delete mydetDirectory;
}
void ExN04PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command==genCmd )
{ myAction->SetHEPEvtGenerator(newValue=="PYTHIA"); }
}
G4String ExN04PrimaryGeneratorMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String cv;
if( command==genCmd )
{
if(myAction->GetHEPEvtGenerator())
{ cv = "PYTHIA"; }
else
{ cv = "particleGun"; }
}
return cv;
}
@@ -0,0 +1,181 @@
#include "ExN04StackingAction.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "ExN04StackingActionMessenger.hh"
#include "G4ios.hh"
ExN04StackingAction::ExN04StackingAction()
:stage(0),trkHits(NULL),muonHits(NULL)
{
angRoI = 30.0*deg;
reqMuon = 2;
reqIso = 10;
theMessenger = new ExN04StackingActionMessenger(this);
}
ExN04StackingAction::~ExN04StackingAction()
{ delete theMessenger; }
G4ClassificationOfNewTrack
ExN04StackingAction::ClassifyNewTrack(G4Track *const aTrack)
{
G4ClassificationOfNewTrack classification = fWaiting;
switch(stage)
{
case 0: // Stage 0 : Primary muons only
if(aTrack->GetParentID()==0)
{
G4ParticleDefinition * particleType = aTrack->GetDefinition();
if((particleType==G4MuonPlus::MuonPlusDefinition())
||(particleType==G4MuonMinus::MuonMinusDefinition()))
{ classification = fUrgent; }
}
break;
case 1: // Stage 1 : Charged primaries only
// Suspended tracks will be sent to the waiting stack
if(aTrack->GetParentID()!=0) { break; }
if(aTrack->GetTrackStatus()==fSuspend) { break; }
if(aTrack->GetDefinition()->GetPDGCharge()==0.) { break; }
classification = fUrgent;
break;
default: // Stage 2 : Accept all primaries
// Accept all secondaries in RoI
// Kill secondaries outside RoI
if(aTrack->GetParentID()==0)
{
classification = fUrgent;
break;
}
if(InsideRoI(aTrack,angRoI))
{
classification = fUrgent;
break;
}
classification = fKill;
}
return classification;
}
G4bool ExN04StackingAction::InsideRoI(G4Track *const aTrack,G4double ang)
{
if(!muonHits)
{ muonHits = (ExN04MuonHitsCollection*)GetCollection("muonCollection"); }
if(!muonHits)
{ G4cerr << "muonCollection NOT FOUND" << endl;
return true; }
G4int nhits = muonHits->entries();
const G4ThreeVector trPos = aTrack->GetPosition();
for(G4int i=0;i<nhits;i++)
{
G4ThreeVector muHitPos = (*muonHits)[i]->GetPos();
G4double angl = muHitPos.angle(trPos);
if(angl<ang) { return true; }
}
return false;
}
G4VHitsCollection* ExN04StackingAction::GetCollection(G4String colName)
{
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
G4RunManager* runMan = G4RunManager::GetRunManager();
int colID = SDMan->GetCollectionID(colName);
if(colID>=0)
{
const G4Event* currentEvent = runMan->GetCurrentEvent();
G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
return HCE->GetHC(colID);
}
return NULL;
}
void ExN04StackingAction::NewStage()
{
stage++;
G4int nhits;
if(stage==1)
{
// Stage 0->1 : check if at least "reqMuon" hits on muon chamber
// otherwise abort current event
if(!muonHits)
{ muonHits = (ExN04MuonHitsCollection*)GetCollection("muonCollection"); }
if(!muonHits)
{ G4cerr << "muonCollection NOT FOUND" << endl;
return; }
nhits = muonHits->entries();
G4cout << "Stage 0->1 : " << nhits << " hits found in the muon chamber."
<< endl;
if(nhits<reqMuon)
{
stackManager->clear();
G4cout << "++++++++ event aborted" << endl;
return;
}
stackManager->ReClassify();
return;
}
else if(stage==2)
{
// Stage 1->2 : check the isolation of muon tracks
// at least "reqIsoMuon" isolated muons
// otherwise abort current event.
// Isolation requires "reqIso" or less hits
// (including own hits) in the RoI region
// in the tracker layers.
nhits = muonHits->entries();
if(!trkHits)
{ trkHits = (ExN04TrackerHitsCollection*)GetCollection("trackerCollection"); }
if(!trkHits)
{ G4cerr << "trackerCollection NOT FOUND" << endl;
return; }
G4int nTrkhits = trkHits->entries();
G4int isoMuon = 0;
for(G4int j=0;j<nhits;j++)
{
G4ThreeVector hitPos = (*muonHits)[j]->GetPos();
G4int nhitIn = 0;
for(G4int jj=0;(jj<nTrkhits)&&(nhitIn<=reqIso);jj++)
{
G4ThreeVector trkhitPos = (*trkHits)[jj]->GetPos();
if(trkhitPos.angle(hitPos)<angRoI) nhitIn++;
}
if(nhitIn<=reqIso) isoMuon++;
}
G4cout << "Stage 1->2 : " << isoMuon << " isolated muon found." << endl;
if(isoMuon<reqIsoMuon)
{
stackManager->clear();
G4cout << "++++++++ event aborted" << endl;
return;
}
stackManager->ReClassify();
return;
}
else
{
// Other stage change : just re-classify
stackManager->ReClassify();
}
}
void ExN04StackingAction::PrepareNewEvent()
{
stage = 0;
trkHits = NULL;
muonHits = NULL;
}
@@ -0,0 +1,71 @@
#include "ExN04StackingActionMessenger.hh"
#include "ExN04StackingAction.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4ios.hh"
ExN04StackingActionMessenger::ExN04StackingActionMessenger(ExN04StackingAction * msa)
:myAction(msa)
{
muonCmd = new G4UIcmdWithAnInteger("/mydet/reqmuon",this);
muonCmd->SetGuidance("Number of muon for the trigger.");
muonCmd->SetParameterName("N",true);
muonCmd->SetDefaultValue(2);
muonCmd->SetRange("N>=0");
isomuonCmd = new G4UIcmdWithAnInteger("/mydet/isomuon",this);
isomuonCmd->SetGuidance("Number of isolated muon for the trigger.");
isomuonCmd->SetParameterName("N",true);
isomuonCmd->SetDefaultValue(2);
isomuonCmd->SetRange("N>=0");
isoCmd = new G4UIcmdWithAnInteger("/mydet/isolation",this);
isoCmd->SetGuidance("Maximum allowed number of hits in tracker");
isoCmd->SetGuidance(" for an isolated muon track (includes hits by muon)");
isoCmd->SetParameterName("N",true);
isoCmd->SetDefaultValue(10);
isoCmd->SetRange("N>=0");
roiCmd = new G4UIcmdWithADoubleAndUnit("/mydet/RoIangle",this);
roiCmd->SetGuidance("Define RoI angle");
roiCmd->SetParameterName("theta",true,true);
roiCmd->SetDefaultUnit("deg");
}
ExN04StackingActionMessenger::~ExN04StackingActionMessenger()
{
delete muonCmd;
delete isomuonCmd;
delete isoCmd;
delete roiCmd;
}
void ExN04StackingActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command==muonCmd )
{ myAction->SetNRequestMuon(muonCmd->GetNewIntValue(newValue)); }
else if( command==isomuonCmd )
{ myAction->SetNRequestIsoMuon(isomuonCmd->GetNewIntValue(newValue)); }
else if( command==isoCmd )
{ myAction->SetNIsolation(isoCmd->GetNewIntValue(newValue)); }
else if( command==roiCmd )
{ myAction->SetRoIAngle(roiCmd->GetNewDoubleValue(newValue)); }
}
G4String ExN04StackingActionMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String cv;
if( command==muonCmd )
{ cv = muonCmd->ConvertToString(myAction->GetNRequestMuon()); }
else if( command==isomuonCmd )
{ cv = isomuonCmd->ConvertToString(myAction->GetNRequestIsoMuon()); }
else if( command==isoCmd )
{ cv = isoCmd->ConvertToString(myAction->GetNIsolation()); }
else if( command==roiCmd )
{ cv = roiCmd->ConvertToString(myAction->GetRoIAngle(),"deg"); }
return cv;
}
@@ -0,0 +1,50 @@
#include "ExN04SteppingAction.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
ExN04SteppingAction::ExN04SteppingAction()
{;}
ExN04SteppingAction::~ExN04SteppingAction()
{;}
void ExN04SteppingAction::UserSteppingAction()
{
G4SteppingManager * SM = GetOmnipotentSteppingManager();
G4Step * theStep = SM->GetStep();
G4Track * theTrack = theStep->GetTrack();
// check if it is alive
if(theTrack->GetTrackStatus()!=fAlive) { return; }
// check if it is primary
if(theTrack->GetParentID()!=0) { return; }
// check if it is NOT muon
G4ParticleDefinition * particleType = theTrack->GetDefinition();
if((particleType==G4MuonPlus::MuonPlusDefinition())
||(particleType==G4MuonMinus::MuonMinusDefinition()))
{ return; }
// check if it is entering to the calorimeter volume
G4StepPoint * thePrePoint = theStep->GetPreStepPoint();
G4VPhysicalVolume * thePrePV = thePrePoint->GetPhysicalVolume();
G4String thePrePVname = thePrePV->GetName();
if(thePrePVname(0,4)=="calo") { return; }
G4StepPoint * thePostPoint = theStep->GetPostStepPoint();
G4VPhysicalVolume * thePostPV = thePostPoint->GetPhysicalVolume();
G4String thePostPVname = thePostPV->GetName();
if(thePostPVname(0,4)!="calo") { return; }
// then suspend the track
theTrack->SetTrackStatus(fSuspend);
}
@@ -0,0 +1,53 @@
#include "ExN04TrackerHit.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
G4Allocator<ExN04TrackerHit> ExN04TrackerHitAllocator;
ExN04TrackerHit::ExN04TrackerHit()
{;}
ExN04TrackerHit::~ExN04TrackerHit()
{;}
ExN04TrackerHit::ExN04TrackerHit(const ExN04TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
}
const ExN04TrackerHit& ExN04TrackerHit::operator=(const ExN04TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
return *this;
}
int ExN04TrackerHit::operator==(const ExN04TrackerHit &right) const
{
return 0;
}
void ExN04TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(pos);
circle.SetScreenSize(0.04);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
void ExN04TrackerHit::Print()
{;}
@@ -0,0 +1,34 @@
#include "ExN04TrackerParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
ExN04TrackerParametrisation::ExN04TrackerParametrisation()
{
#include "ExN04DetectorParameterDef.icc"
}
ExN04TrackerParametrisation::~ExN04TrackerParametrisation()
{;}
void ExN04TrackerParametrisation::ComputeTransformation
(const G4int copyNo,G4VPhysicalVolume *physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
}
void ExN04TrackerParametrisation::ComputeDimensions
(G4Tubs & trackerLayer, const G4int copyNo,
const G4VPhysicalVolume * physVol) const
{
trackerLayer.SetInnerRadius(tracker_radius[copyNo]);
trackerLayer.SetOuterRadius(tracker_radius[copyNo]+tracker_thick);
trackerLayer.SetZHalfLength(tracker_length[copyNo]);
trackerLayer.SetStartPhiAngle(trkTubs_sphi);
trackerLayer.SetDeltaPhiAngle(trkTubs_dphi);
}
+55
View File
@@ -0,0 +1,55 @@
#include "ExN04TrackerSD.hh"
#include "ExN04TrackerHit.hh"
#include "G4Step.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
ExN04TrackerSD::ExN04TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="trackerCollection");
}
ExN04TrackerSD::~ExN04TrackerSD(){;}
void ExN04TrackerSD::Initialize(G4HCofThisEvent*HCE)
{
static int HCID = -1;
trackerCollection = new ExN04TrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection(HCID,trackerCollection);
}
G4bool ExN04TrackerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false;
ExN04TrackerHit* newHit = new ExN04TrackerHit();
newHit->SetEdep( edep );
newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
trackerCollection->insert( newHit );
return true;
}
void ExN04TrackerSD::EndOfEvent(G4HCofThisEvent*HCE)
{;}
void ExN04TrackerSD::clear()
{
}
void ExN04TrackerSD::DrawAll()
{
}
void ExN04TrackerSD::PrintAll()
{
}
@@ -0,0 +1,19 @@
#include "ExN04TrackingAction.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
void ExN04TrackingAction::PreUserTrackingAction()
{
G4TrackingManager* trackingManager = GetOmnipotentTrackingManager();
G4Track* aTrack = trackingManager->GetTrack();
// Create trajectory only for primaries
if(aTrack->GetParentID()==0)
{ trackingManager->SetStoreTrajectory(true); }
else
{ trackingManager->SetStoreTrajectory(false); }
}