Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04CalorimeterHit.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04CalorimeterHit.cc
|
||||
/// \brief Implementation of the ExN04CalorimeterHit class
|
||||
//
|
||||
|
||||
#include "ExN04CalorimeterHit.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
G4Allocator<ExN04CalorimeterHit> ExN04CalorimeterHitAllocator;
|
||||
|
||||
ExN04CalorimeterHit::ExN04CalorimeterHit()
|
||||
{pLogV=0;}
|
||||
|
||||
ExN04CalorimeterHit::ExN04CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi)
|
||||
: ZCellID(z), PhiCellID(phi), pLogV(logVol)
|
||||
{;}
|
||||
|
||||
ExN04CalorimeterHit::~ExN04CalorimeterHit()
|
||||
{;}
|
||||
|
||||
ExN04CalorimeterHit::ExN04CalorimeterHit(const ExN04CalorimeterHit &right)
|
||||
: G4VHit()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
G4int 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,64 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ExN04CalorimeterParametrisation.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04CalorimeterParametrisation.cc
|
||||
/// \brief Implementation of the ExN04CalorimeterParametrisation class
|
||||
//
|
||||
|
||||
#include "ExN04CalorimeterParametrisation.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
ExN04CalorimeterParametrisation::ExN04CalorimeterParametrisation()
|
||||
{
|
||||
#include "ExN04DetectorParameterDef.icc"
|
||||
}
|
||||
|
||||
ExN04CalorimeterParametrisation::~ExN04CalorimeterParametrisation()
|
||||
{;}
|
||||
|
||||
void ExN04CalorimeterParametrisation::ComputeTransformation
|
||||
(const G4int,G4VPhysicalVolume *physVol) const
|
||||
{
|
||||
G4ThreeVector origin;
|
||||
physVol->SetTranslation(origin);
|
||||
}
|
||||
|
||||
void ExN04CalorimeterParametrisation::ComputeDimensions
|
||||
(G4Tubs & calorimeterLayer, const G4int copyNo, const G4VPhysicalVolume*) 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,120 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04CalorimeterROGeometry.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04CalorimeterROGeometry.cc
|
||||
/// \brief Implementation of the ExN04CalorimeterROGeometry class
|
||||
//
|
||||
#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"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
ExN04CalorimeterROGeometry::ExN04CalorimeterROGeometry()
|
||||
: G4VReadOutGeometry()
|
||||
{
|
||||
#include "ExN04DetectorParameterDef.icc"
|
||||
}
|
||||
|
||||
|
||||
ExN04CalorimeterROGeometry::ExN04CalorimeterROGeometry(G4String aString)
|
||||
: G4VReadOutGeometry(aString), dummyMat(0)
|
||||
{
|
||||
#include "ExN04DetectorParameterDef.icc"
|
||||
}
|
||||
|
||||
ExN04CalorimeterROGeometry::~ExN04CalorimeterROGeometry()
|
||||
{
|
||||
delete dummyMat;
|
||||
}
|
||||
|
||||
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.)
|
||||
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);
|
||||
ROWorldLog->SetVisAttributes(G4VisAttributes::Invisible);
|
||||
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,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: ExN04CalorimeterSD.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04CalorimeterSD.cc
|
||||
/// \brief Implementation of the ExN04CalorimeterSD class
|
||||
//
|
||||
|
||||
#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 "G4SystemOfUnits.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*)
|
||||
{
|
||||
CalCollection = new ExN04CalorimeterHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
for(G4int j=0;j<numberOfCellsInZ;j++)
|
||||
for(G4int k=0;k<numberOfCellsInPhi;k++)
|
||||
{
|
||||
CellID[j][k] = -1;
|
||||
}
|
||||
verboseLevel = 0;
|
||||
}
|
||||
|
||||
G4bool ExN04CalorimeterSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
|
||||
{
|
||||
if(!ROhist) return false;
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if(verboseLevel>1) G4cout << "Next step edep(MeV) = " << edep/MeV << G4endl;
|
||||
if(edep==0.) return false;
|
||||
|
||||
G4VPhysicalVolume* physVol = ROhist->GetVolume();
|
||||
//ROhist->MoveUpHistory();
|
||||
//G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
|
||||
G4int copyIDinZ = ROhist->GetReplicaNumber();
|
||||
G4int copyIDinPhi = ROhist->GetReplicaNumber(1);
|
||||
|
||||
if(CellID[copyIDinZ][copyIDinPhi]==-1)
|
||||
{
|
||||
ExN04CalorimeterHit* calHit
|
||||
= new ExN04CalorimeterHit
|
||||
(physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi);
|
||||
calHit->SetEdep( edep );
|
||||
G4AffineTransform aTrans = ROhist->GetHistory()->GetTopTransform();
|
||||
aTrans.Invert();
|
||||
calHit->SetPos(aTrans.NetTranslation());
|
||||
calHit->SetRot(aTrans.NetRotation());
|
||||
G4int icell = CalCollection->insert( calHit );
|
||||
CellID[copyIDinZ][copyIDinPhi] = icell - 1;
|
||||
if(verboseLevel>0)
|
||||
{ G4cout << " New Calorimeter Hit on CellID "
|
||||
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
|
||||
}
|
||||
else
|
||||
{
|
||||
(*CalCollection)[CellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep);
|
||||
if(verboseLevel>0)
|
||||
{ G4cout << " Energy added to CellID "
|
||||
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
|
||||
}
|
||||
|
||||
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,268 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04DetectorConstruction.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04DetectorConstruction.cc
|
||||
/// \brief Implementation of the ExN04DetectorConstruction class
|
||||
//
|
||||
|
||||
#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"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
ExN04DetectorConstruction::ExN04DetectorConstruction()
|
||||
{
|
||||
|
||||
#include "ExN04DetectorParameterDef.icc"
|
||||
DefineMaterials();
|
||||
|
||||
}
|
||||
|
||||
ExN04DetectorConstruction::~ExN04DetectorConstruction()
|
||||
{
|
||||
delete Scinti;
|
||||
delete Silicon;
|
||||
delete Ar;
|
||||
delete Lead;
|
||||
delete Air;
|
||||
|
||||
delete O;
|
||||
delete N;
|
||||
delete C;
|
||||
delete H;
|
||||
}
|
||||
|
||||
void ExN04DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
// Materials
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
G4double a, z, density;
|
||||
G4int nel;
|
||||
|
||||
H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole);
|
||||
C = new G4Element("Carbon", "C", z=6., a= 12.01*g/mole);
|
||||
N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
|
||||
O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole);
|
||||
|
||||
Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
|
||||
Air->AddElement(N, 70.*perCent);
|
||||
Air->AddElement(O, 30.*perCent);
|
||||
|
||||
Lead =
|
||||
new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
|
||||
|
||||
Ar =
|
||||
new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
|
||||
|
||||
Silicon =
|
||||
new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
|
||||
|
||||
Scinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
|
||||
Scinti->AddElement(C, 9);
|
||||
Scinti->AddElement(H, 10);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// 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(),experimentalHall_log,"expHall_P",
|
||||
0,false,0);
|
||||
experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
//------------------------------ 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_log,"tracker_phys",
|
||||
experimentalHall_log,false,0);
|
||||
G4VisAttributes* tracker_logVisAtt
|
||||
= new G4VisAttributes(G4Colour(1.0,0.0,1.0));
|
||||
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_log,
|
||||
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(),calorimeter_log,"caloM_P",
|
||||
experimentalHall_log,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_log,
|
||||
kXAxis, nocaloLayers, calorimeterParam);
|
||||
G4VisAttributes* caloLayer_logVisAtt
|
||||
= new G4VisAttributes(G4Colour(0.7,1.0,0.0));
|
||||
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);
|
||||
for(int i=0; i<nomucounter ; i++)
|
||||
{
|
||||
G4double phi, x, y, z;
|
||||
phi = 360.*deg/nomucounter*i;
|
||||
x = muBox_radius*std::sin(phi);
|
||||
y = muBox_radius*std::cos(phi);
|
||||
z = 0.*cm;
|
||||
G4RotationMatrix rm;
|
||||
rm.rotateZ(phi);
|
||||
new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(x,y,z)),
|
||||
muoncounter_log, "muoncounter_P",
|
||||
experimentalHall_log,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();
|
||||
calRO->SetName(ROgeometryName);
|
||||
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,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04DetectorParameterDef.icc
|
||||
/// \brief Definition of detector paremeters
|
||||
//
|
||||
|
||||
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 = expHall_z - 10.*cm;
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04EventAction.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04EventAction.cc
|
||||
/// \brief Implementation of the ExN04EventAction class
|
||||
//
|
||||
|
||||
#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 "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
ExN04EventAction::ExN04EventAction()
|
||||
{
|
||||
trackerCollID = -1;
|
||||
calorimeterCollID = -1;
|
||||
muonCollID = -1;
|
||||
}
|
||||
|
||||
ExN04EventAction::~ExN04EventAction()
|
||||
{;}
|
||||
|
||||
void ExN04EventAction::BeginOfEventAction(const G4Event*)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
void ExN04EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
|
||||
|
||||
if(trackerCollID<0||calorimeterCollID<0||muonCollID<0) return;
|
||||
|
||||
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
|
||||
ExN04TrackerHitsCollection* THC = 0;
|
||||
ExN04CalorimeterHitsCollection* CHC = 0;
|
||||
ExN04MuonHitsCollection* MHC = 0;
|
||||
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." << G4endl;
|
||||
}
|
||||
if(CHC)
|
||||
{
|
||||
int n_hit = CHC->entries();
|
||||
G4cout << " " << n_hit
|
||||
<< " hits are stored in ExN04CalorimeterHitsCollection." << G4endl;
|
||||
G4double totE = 0;
|
||||
for(int i=0;i<n_hit;i++)
|
||||
{ totE += (*CHC)[i]->GetEdep(); }
|
||||
G4cout << " Total energy deposition in calorimeter : "
|
||||
<< totE / GeV << " (GeV)" << G4endl;
|
||||
}
|
||||
if(MHC)
|
||||
{
|
||||
int n_hit = MHC->entries();
|
||||
G4cout << " " << n_hit
|
||||
<< " hits are stored in ExN04MuonHitsCollection." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04Field.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04Field.cc
|
||||
/// \brief Implementation of the ExN04Field class
|
||||
//
|
||||
|
||||
#include "ExN04Field.hh"
|
||||
#include "G4SystemOfUnits.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(std::abs(Point[2])<zmax && (sqr(Point[0])+sqr(Point[1]))<rmax_sq)
|
||||
{ Bfield[2] = Bz; }
|
||||
else
|
||||
{ Bfield[2] = 0.; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04MuonHit.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04MuonHit.cc
|
||||
/// \brief Implementation of the ExN04MuonHit class
|
||||
//
|
||||
|
||||
#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)
|
||||
: G4VHit()
|
||||
{
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
}
|
||||
|
||||
const ExN04MuonHit& ExN04MuonHit::operator=(const ExN04MuonHit &right)
|
||||
{
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4int ExN04MuonHit::operator==(const ExN04MuonHit &right) const
|
||||
{
|
||||
return (this==&right) ? 1 : 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()
|
||||
{;}
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04MuonSD.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04MuonSD.cc
|
||||
/// \brief Implementation of the ExN04MuonSD class
|
||||
//
|
||||
|
||||
#include "ExN04MuonSD.hh"
|
||||
#include "ExN04MuonHit.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SystemOfUnits.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*)
|
||||
{
|
||||
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*)
|
||||
{;}
|
||||
|
||||
void ExN04MuonSD::clear()
|
||||
{
|
||||
}
|
||||
|
||||
void ExN04MuonSD::DrawAll()
|
||||
{
|
||||
}
|
||||
|
||||
void ExN04MuonSD::PrintAll()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04PrimaryGeneratorAction.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the ExN04PrimaryGeneratorAction class
|
||||
//
|
||||
|
||||
#include "ExN04PrimaryGeneratorAction.hh"
|
||||
#include "ExN04PrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4HEPEvtInterface.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
ExN04PrimaryGeneratorAction::ExN04PrimaryGeneratorAction()
|
||||
{
|
||||
const char* filename = "pythia_event.data";
|
||||
HEPEvt = new G4HEPEvtInterface(filename);
|
||||
|
||||
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,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04PrimaryGeneratorMessenger.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04PrimaryGeneratorMessenger.cc
|
||||
/// \brief Implementation of the ExN04PrimaryGeneratorMessenger class
|
||||
//
|
||||
|
||||
#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,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04RunAction.cc
|
||||
/// \brief Implementation of the ExN04RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: ExN04RunAction.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN04RunAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN04RunAction::ExN04RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN04RunAction::~ExN04RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN04RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,212 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04StackingAction.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04StackingAction.cc
|
||||
/// \brief Implementation of the ExN04StackingAction class
|
||||
//
|
||||
|
||||
#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 "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
ExN04StackingAction::ExN04StackingAction()
|
||||
: trkHits(0), muonHits(0), stage(0)
|
||||
{
|
||||
angRoI = 30.0*deg;
|
||||
reqMuon = 2;
|
||||
reqIso = 10;
|
||||
theMessenger = new ExN04StackingActionMessenger(this);
|
||||
}
|
||||
|
||||
ExN04StackingAction::~ExN04StackingAction()
|
||||
{ delete theMessenger; }
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
ExN04StackingAction::ClassifyNewTrack(const G4Track * 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((angRoI<0.)||InsideRoI(aTrack,angRoI))
|
||||
{
|
||||
classification = fUrgent;
|
||||
break;
|
||||
}
|
||||
classification = fKill;
|
||||
}
|
||||
return classification;
|
||||
}
|
||||
|
||||
G4bool ExN04StackingAction::InsideRoI(const G4Track * aTrack,G4double ang)
|
||||
{
|
||||
if(!muonHits)
|
||||
{ muonHits = (ExN04MuonHitsCollection*)GetCollection("muonCollection"); }
|
||||
if(!muonHits)
|
||||
{ G4cerr << "muonCollection NOT FOUND" << G4endl;
|
||||
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 0;
|
||||
}
|
||||
|
||||
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" << G4endl;
|
||||
return; }
|
||||
nhits = muonHits->entries();
|
||||
G4cout << "Stage 0->1 : " << nhits << " hits found in the muon chamber."
|
||||
<< G4endl;
|
||||
if(nhits<reqMuon)
|
||||
{
|
||||
stackManager->clear();
|
||||
G4cout << "++++++++ event aborted" << G4endl;
|
||||
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" << G4endl;
|
||||
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." << G4endl;
|
||||
if(isoMuon<reqIsoMuon)
|
||||
{
|
||||
stackManager->clear();
|
||||
G4cout << "++++++++ event aborted" << G4endl;
|
||||
return;
|
||||
}
|
||||
stackManager->ReClassify();
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Other stage change : just re-classify
|
||||
stackManager->ReClassify();
|
||||
}
|
||||
}
|
||||
|
||||
void ExN04StackingAction::PrepareNewEvent()
|
||||
{
|
||||
stage = 0;
|
||||
trkHits = 0;
|
||||
muonHits = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04StackingActionMessenger.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04StackingActionMessenger.cc
|
||||
/// \brief Implementation of the ExN04StackingActionMessenger class
|
||||
//
|
||||
|
||||
#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,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04SteppingAction.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04SteppingAction.cc
|
||||
/// \brief Implementation of the ExN04SteppingAction class
|
||||
//
|
||||
|
||||
#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(const G4Step * theStep)
|
||||
{
|
||||
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,183 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04SteppingVerbose.cc
|
||||
/// \brief Implementation of the ExN04SteppingVerbose class
|
||||
//
|
||||
//
|
||||
// $Id: ExN04SteppingVerbose.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN04SteppingVerbose.hh"
|
||||
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN04SteppingVerbose::ExN04SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN04SteppingVerbose::~ExN04SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN04SteppingVerbose::StepInfo()
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << std::setw( 5) << "#Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
}
|
||||
|
||||
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << " "
|
||||
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << " UserLimit";
|
||||
}
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << " :----- List of 2ndaries - "
|
||||
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN04SteppingVerbose::TrackingStarted()
|
||||
{
|
||||
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
G4cout << " initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04TrackerHit.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04TrackerHit.cc
|
||||
/// \brief Implementation of the ExN04TrackerHit class
|
||||
//
|
||||
|
||||
#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)
|
||||
: G4VHit()
|
||||
{
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
}
|
||||
|
||||
const ExN04TrackerHit& ExN04TrackerHit::operator=(const ExN04TrackerHit &right)
|
||||
{
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4int ExN04TrackerHit::operator==(const ExN04TrackerHit &right) const
|
||||
{
|
||||
return (this==&right) ? 1 : 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,64 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ExN04TrackerParametrisation.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04TrackerParametrisation.cc
|
||||
/// \brief Implementation of the ExN04TrackerParametrisation class
|
||||
//
|
||||
|
||||
#include "ExN04TrackerParametrisation.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
ExN04TrackerParametrisation::ExN04TrackerParametrisation()
|
||||
{
|
||||
|
||||
#include "ExN04DetectorParameterDef.icc"
|
||||
|
||||
}
|
||||
|
||||
ExN04TrackerParametrisation::~ExN04TrackerParametrisation()
|
||||
{;}
|
||||
|
||||
void ExN04TrackerParametrisation::ComputeTransformation
|
||||
(const G4int, G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4ThreeVector origin;
|
||||
physVol->SetTranslation(origin);
|
||||
}
|
||||
|
||||
void ExN04TrackerParametrisation::ComputeDimensions
|
||||
(G4Tubs& trackerLayer, const G4int copyNo, const G4VPhysicalVolume*) 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);
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04TrackerSD.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04TrackerSD.cc
|
||||
/// \brief Implementation of the ExN04TrackerSD class
|
||||
//
|
||||
|
||||
#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*)
|
||||
{
|
||||
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*)
|
||||
{
|
||||
}
|
||||
|
||||
void ExN04TrackerSD::clear()
|
||||
{
|
||||
}
|
||||
|
||||
void ExN04TrackerSD::DrawAll()
|
||||
{
|
||||
}
|
||||
|
||||
void ExN04TrackerSD::PrintAll()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN04TrackingAction.cc 66587 2012-12-21 11:06:44Z ihrivnac $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ExN04TrackingAction.cc
|
||||
/// \brief Implementation of the ExN04TrackingAction class
|
||||
//
|
||||
|
||||
|
||||
#include "ExN04TrackingAction.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
void ExN04TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
// Create trajectory only for primaries
|
||||
if(aTrack->GetParentID()==0)
|
||||
{ fpTrackingManager->SetStoreTrajectory(true); }
|
||||
else
|
||||
{ fpTrackingManager->SetStoreTrajectory(false); }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParRunManager.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN04/src/ParRunManager.cc
|
||||
/// \brief Implementation of the ParRunManager class
|
||||
//
|
||||
#ifdef G4USE_TOPC
|
||||
|
||||
#include "G4Timer.hh"
|
||||
|
||||
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VPersistencyManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
#include "ParRunManager.hh"
|
||||
//include file for marshaling structures
|
||||
#include "MarshaledG4HCofThisEvent.h"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <sstream> // Geant4 8.x and beyond
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
/*
|
||||
* The TopC call backs are implemented by using the 5 static data members to store
|
||||
* the data and using the 3 static member functions to point to the corresponding
|
||||
* functions of the singleton class instance.
|
||||
*/
|
||||
G4StateManager* ParRunManager::stateManager;
|
||||
G4int ParRunManager::n_event;
|
||||
G4int ParRunManager::n_select;
|
||||
G4String ParRunManager::msg;
|
||||
ParRunManager* ParRunManager::myRunManager = 0;
|
||||
|
||||
//cross-context variables
|
||||
static long* g_Seeds;
|
||||
|
||||
// TOP-C callbacks functions
|
||||
TOPC_BUF ParRunManager::MyDoEvent( void *input_buf ) {
|
||||
return myRunManager->DoEvent(input_buf);
|
||||
}
|
||||
TOPC_ACTION ParRunManager::MyCheckEventResult( void * input_buf, void *buf ) {
|
||||
return myRunManager->CheckEventResult(input_buf, buf);
|
||||
}
|
||||
|
||||
|
||||
static void trace_event_input( void */*input*/ ) {
|
||||
//G4cout << "Event " << *(G4int *)input << G4endl;
|
||||
}
|
||||
|
||||
/*
|
||||
* DoEventLoop is the most important piece in RunManager class to control the program runs,
|
||||
* this is where we embed the TopC parallelism callbacks.
|
||||
*/
|
||||
void ParRunManager::DoEventLoop( G4int n_event, const char* macroFile, G4int n_select )
|
||||
{
|
||||
TOPC_OPT_trace_input = trace_event_input;
|
||||
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
#ifdef G4_ORIGINAL
|
||||
cout << "ParRunManager::DoEventLoop" << endl;
|
||||
G4RunManager::DoEventLoop(n_event, macroFile, n_select);
|
||||
return;
|
||||
#endif
|
||||
|
||||
if(verboseLevel>0)
|
||||
{ timer->Start(); }
|
||||
|
||||
G4String msg;
|
||||
if(macroFile!=0)
|
||||
{
|
||||
if(n_select<0) n_select = n_event;
|
||||
msg = "/control/execute ";
|
||||
msg += macroFile;
|
||||
}
|
||||
else
|
||||
{ n_select = -1; }
|
||||
|
||||
|
||||
// BeginOfEventAction() and EndOfEventAction() would normally be
|
||||
// called inside G4EventManager::ProcessOneEvent() in ParRunManager::DoEvent
|
||||
// on slave. Since this is often where hits are collected and where
|
||||
// histogram data is first stored, must do it
|
||||
// on master instead, to process hits. So, set user event action to NULL.
|
||||
// Keep private copy, and execute it in CheckTaskResult().
|
||||
// If user later does: SetUserAction( (G4UserEventAction *)NULL );
|
||||
// we won't notice and copy it to origUserEventAction.
|
||||
if ( eventManager->GetUserEventAction() ) {
|
||||
origUserEventAction = eventManager->GetUserEventAction();
|
||||
SetUserAction( (G4UserEventAction *)0 );
|
||||
}
|
||||
|
||||
// Make these variables accessible to TOP-C callback functions
|
||||
ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
|
||||
|
||||
|
||||
// Setup random seeds for each slave
|
||||
g_Seeds = (long*)calloc(n_event, sizeof(long));
|
||||
|
||||
for( G4int i_event=0; i_event<n_event; i_event++ )
|
||||
{
|
||||
g_Seeds[i_event] = (long) (100000000L * HepRandom::getTheGenerator()->flat());
|
||||
}
|
||||
|
||||
// This is where all the parallelism occurs
|
||||
TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
|
||||
|
||||
if(TOPC_is_master()){
|
||||
for(G4int i_event=0; i_event<n_event; i_event++ )
|
||||
{
|
||||
TOPC_raw_submit_task_input(TOPC_MSG( &i_event, sizeof(G4int)));
|
||||
if (runAborted) break;
|
||||
}
|
||||
}
|
||||
TOPC_raw_end_master_slave();
|
||||
|
||||
free(g_Seeds);
|
||||
|
||||
if ( verboseLevel > 0 ) {
|
||||
timer->Stop();
|
||||
G4cout << "Run terminated." << G4endl;
|
||||
G4cout << "Run Summary" << G4endl;
|
||||
if ( runAborted ) {
|
||||
G4cout << " Run Aborted." << G4endl;
|
||||
} else {
|
||||
G4cout << " Number of events processed : " << n_event << G4endl;
|
||||
}
|
||||
G4cout << " " << *timer << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
static MarshaledG4HCofThisEvent *aMarshaledObj = NULL;
|
||||
|
||||
TOPC_BUF ParRunManager::DoEvent( void *input_buf )
|
||||
{
|
||||
static
|
||||
G4int i_event;
|
||||
memcpy(&i_event, input_buf, sizeof(G4int));
|
||||
HepRandom::setTheSeed(g_Seeds[i_event]);
|
||||
|
||||
// removed for Geant4.6
|
||||
// stateManager->SetNewState(G4State_EventProc);
|
||||
|
||||
currentEvent = GenerateEvent(i_event);
|
||||
eventManager->ProcessOneEvent(currentEvent);
|
||||
|
||||
G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
|
||||
|
||||
if(aMarshaledObj) delete aMarshaledObj;
|
||||
aMarshaledObj = new MarshaledG4HCofThisEvent(HCE);
|
||||
|
||||
// removed for Geant4.6
|
||||
//stateManager->SetNewState( G4State_GeomClosed );
|
||||
StackPreviousEvent( currentEvent );
|
||||
currentEvent = 0;
|
||||
return TOPC_MSG( aMarshaledObj->getBuffer(), aMarshaledObj->getBufferSize());
|
||||
}
|
||||
|
||||
|
||||
TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf )
|
||||
{
|
||||
G4int i_event;
|
||||
memcpy(&i_event, input_buf, sizeof(G4int));
|
||||
|
||||
// removed for Geant4.6
|
||||
//stateManager->SetNewState(G4State_EventProc);
|
||||
// Geant4 6.0 requires the state to be G4State_GeomClosed
|
||||
// before calling EventManager::ProcessOneEvent(..)
|
||||
|
||||
if ( !userPrimaryGeneratorAction ) {
|
||||
G4Exception("ParRunManager::CheckEventResult", "InvalidSetup",
|
||||
FatalException,
|
||||
"G4VUserPrimaryGeneratorAction is not defined.");
|
||||
}
|
||||
|
||||
//This creates a trivial event in lieu of GenerateEvent(i_event);
|
||||
currentEvent = new G4Event( i_event );
|
||||
|
||||
//
|
||||
SetUserAction( (G4UserEventAction *)0 );
|
||||
|
||||
// When Geant4 4.0 sees empty event, it still calls userStackingAction.
|
||||
// On master, only trivial events exist, so we delete userStackingAction
|
||||
SetUserAction( (G4UserStackingAction*)0 );
|
||||
eventManager->ProcessOneEvent( currentEvent ); // Processing the trivial event
|
||||
|
||||
// Called with output_buf and no size, creates object for unmarshaling
|
||||
// using marshalgen
|
||||
MarshaledG4HCofThisEvent marshaledObj( output_buf );
|
||||
G4HCofThisEvent* oldCE = currentEvent->GetHCofThisEvent();
|
||||
G4HCofThisEvent* HCE = new G4HCofThisEvent(oldCE->GetNumberOfCollections());
|
||||
|
||||
marshaledObj.unmarshalTo(HCE);
|
||||
if(oldCE) delete(oldCE);
|
||||
|
||||
currentEvent->SetHCofThisEvent(HCE);
|
||||
|
||||
// Original UserEventAction was saved and set to NULL. Do it now on master.
|
||||
HepRandom::setTheSeed(g_Seeds[i_event]);
|
||||
if ( origUserEventAction )
|
||||
origUserEventAction->BeginOfEventAction( currentEvent );
|
||||
|
||||
if ( origUserEventAction )
|
||||
origUserEventAction->EndOfEventAction( currentEvent );
|
||||
|
||||
AnalyzeEvent(currentEvent);
|
||||
|
||||
if (i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
|
||||
// Geant4 6.0 requires the state to be G4State_GeomClosed
|
||||
stateManager->SetNewState( G4State_GeomClosed );
|
||||
StackPreviousEvent(currentEvent);
|
||||
currentEvent = 0;
|
||||
return NO_ACTION;
|
||||
}
|
||||
|
||||
#endif /* G4USE_TOPC */
|
||||
Reference in New Issue
Block a user