Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
@@ -31,27 +31,24 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "QBBC.hh"
#include "RE05ActionInitialization.hh"
#include "RE05CalorimeterParallelWorld.hh"
#include "RE05DetectorConstruction.hh"
#include "RE05SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "RE05DetectorConstruction.hh"
#include "RE05CalorimeterParallelWorld.hh"
#include "QBBC.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE05ActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4RunManagerFactory.hh"
#include "G4Types.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Instantiate G4UIExecutive if there are no arguments (interactive mode)
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) {
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
@@ -65,13 +62,11 @@ int main(int argc,char** argv)
// User Initialization classes (mandatory)
//
auto detector = new RE05DetectorConstruction();
detector->RegisterParallelWorld
(new RE05CalorimeterParallelWorld(parallelWorldName));
detector->RegisterParallelWorld(new RE05CalorimeterParallelWorld(parallelWorldName));
runManager->SetUserInitialization(detector);
//
auto physicsList = new QBBC;
physicsList
->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
runManager->SetUserInitialization(physicsList);
//
auto actions = new RE05ActionInitialization;
@@ -82,16 +77,16 @@ int main(int argc,char** argv)
auto visManager = new G4VisExecutive;
visManager->Initialize();
//get the pointer to the User Interface manager
auto UImanager = G4UImanager::GetUIpointer();
// get the pointer to the User Interface manager
auto UImanager = G4UImanager::GetUIpointer();
if (!ui) // batch mode
if (!ui) // batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command + fileName);
}
else // interactive mode : define UI session
else // interactive mode : define UI session
{
UImanager->ApplyCommand("/control/execute vis.mac");
ui->SessionStart();
File diff suppressed because it is too large Load Diff
@@ -31,8 +31,8 @@
#ifndef RE05ActionInitialization_H
#define RE05ActionInitialization_H 1
#include "globals.hh"
#include "G4VUserActionInitialization.hh"
#include "globals.hh"
class RE05ActionInitialization : public G4VUserActionInitialization
{
@@ -45,4 +45,3 @@ class RE05ActionInitialization : public G4VUserActionInitialization
};
#endif
@@ -31,70 +31,60 @@
#ifndef RE05CalorimeterHit_h
#define RE05CalorimeterHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4Types.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4Types.hh"
#include "G4VHit.hh"
class G4AttDef;
class RE05CalorimeterHit : public G4VHit
{
public:
RE05CalorimeterHit();
RE05CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi);
virtual ~RE05CalorimeterHit();
RE05CalorimeterHit(const RE05CalorimeterHit& right);
const RE05CalorimeterHit& operator=(const RE05CalorimeterHit& right);
G4bool operator==(const RE05CalorimeterHit& right) const;
RE05CalorimeterHit();
RE05CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi);
virtual ~RE05CalorimeterHit();
RE05CalorimeterHit(const RE05CalorimeterHit &right);
const RE05CalorimeterHit& operator=(const RE05CalorimeterHit &right);
G4bool operator==(const RE05CalorimeterHit &right) const;
inline void* operator new(size_t);
inline void operator delete(void* aHit);
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void Print();
virtual void Draw();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void Print();
private:
G4int fZCellID;
G4int fPhiCellID;
G4double fEdep;
G4ThreeVector fPos;
G4RotationMatrix fRot;
const G4LogicalVolume* fLogV;
static std::map<G4String,G4AttDef> fAttDefs;
G4int fZCellID;
G4int fPhiCellID;
G4double fEdep;
G4ThreeVector fPos;
G4RotationMatrix fRot;
const G4LogicalVolume* fLogV;
static std::map<G4String, G4AttDef> fAttDefs;
public:
inline void SetCellID(G4int z,G4int phi)
{
fZCellID = z;
fPhiCellID = phi;
}
inline G4int GetZ() { return fZCellID; }
inline G4int GetPhi() { return fPhiCellID; }
inline void SetEdep(G4double de)
{ fEdep = de; }
inline void AddEdep(G4double de)
{ fEdep += de; }
inline G4double GetEdep()
{ return fEdep; }
inline void SetPos(G4ThreeVector xyz)
{ fPos = xyz; }
inline G4ThreeVector GetPos()
{ return fPos; }
inline void SetRot(G4RotationMatrix rmat)
{ fRot = rmat; }
inline G4RotationMatrix GetRot()
{ return fRot; }
inline const G4LogicalVolume * GetLogV()
{ return fLogV; }
inline void SetCellID(G4int z, G4int phi)
{
fZCellID = z;
fPhiCellID = phi;
}
inline G4int GetZ() { return fZCellID; }
inline G4int GetPhi() { return fPhiCellID; }
inline void SetEdep(G4double de) { fEdep = de; }
inline void AddEdep(G4double de) { fEdep += de; }
inline G4double GetEdep() { return fEdep; }
inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
inline G4ThreeVector GetPos() { return fPos; }
inline void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
inline G4RotationMatrix GetRot() { return fRot; }
inline const G4LogicalVolume* GetLogV() { return fLogV; }
};
typedef G4THitsCollection<RE05CalorimeterHit> RE05CalorimeterHitsCollection;
@@ -103,14 +93,14 @@ extern G4ThreadLocal G4Allocator<RE05CalorimeterHit>* RE05CalorimeterHitAllocato
inline void* RE05CalorimeterHit::operator new(size_t)
{
if(!RE05CalorimeterHitAllocator)
if (!RE05CalorimeterHitAllocator)
RE05CalorimeterHitAllocator = new G4Allocator<RE05CalorimeterHit>;
return (void*) RE05CalorimeterHitAllocator->MallocSingle();
return (void*)RE05CalorimeterHitAllocator->MallocSingle();
}
inline void RE05CalorimeterHit::operator delete(void *aHit)
inline void RE05CalorimeterHit::operator delete(void* aHit)
{
RE05CalorimeterHitAllocator->FreeSingle((RE05CalorimeterHit*) aHit);
RE05CalorimeterHitAllocator->FreeSingle((RE05CalorimeterHit*)aHit);
}
#endif
@@ -35,17 +35,16 @@
class RE05CalorimeterParallelWorld : public G4VUserParallelWorld
{
public:
RE05CalorimeterParallelWorld(G4String& parallelWorldName);
virtual ~RE05CalorimeterParallelWorld();
public:
RE05CalorimeterParallelWorld(G4String& parallelWorldName);
virtual ~RE05CalorimeterParallelWorld();
public:
virtual void Construct();
virtual void ConstructSD();
public:
virtual void Construct();
virtual void ConstructSD();
private:
private:
#include "RE05DetectorParameterDef.hh"
};
#endif
@@ -31,8 +31,8 @@
#ifndef RE05CalorimeterParametrisation_H
#define RE05CalorimeterParametrisation_H 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
#include "globals.hh"
class G4VPhysicalVolume;
class G4Tubs;
@@ -52,49 +52,31 @@ class G4Polycone;
class G4Polyhedra;
class RE05CalorimeterParametrisation : public G4VPVParameterisation
{
{
public:
RE05CalorimeterParametrisation();
~RE05CalorimeterParametrisation();
~RE05CalorimeterParametrisation();
virtual void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
virtual void ComputeDimensions(G4Tubs & calorimeterLayer,
const G4int copyNo,
const G4VPhysicalVolume * physVol) const;
virtual void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const;
virtual void ComputeDimensions(G4Tubs& calorimeterLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
virtual void ComputeDimensions (G4Trd&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Trap&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Cons&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Orb&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Sphere&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Ellipsoid&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Torus&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Para&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Hype&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Box&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Polycone&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Polyhedra&,const G4int,
const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Trd&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Trap&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Cons&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Orb&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Sphere&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Ellipsoid&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Torus&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Para&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Hype&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Box&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Polycone&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Polyhedra&, const G4int, const G4VPhysicalVolume*) const {}
private:
#include "RE05DetectorParameterDef.hh"
};
#endif
@@ -31,8 +31,9 @@
#ifndef RE05CalorimeterSD_h
#define RE05CalorimeterSD_h 1
#include "G4VSensitiveDetector.hh"
#include "RE05CalorimeterHit.hh"
#include "G4VSensitiveDetector.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
@@ -40,21 +41,21 @@ class G4TouchableHistory;
class RE05CalorimeterSD : public G4VSensitiveDetector
{
public:
RE05CalorimeterSD(G4String name);
virtual ~RE05CalorimeterSD();
RE05CalorimeterSD(G4String name);
virtual ~RE05CalorimeterSD();
virtual void Initialize(G4HCofThisEvent*HCE);
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
virtual void EndOfEvent(G4HCofThisEvent*HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void Initialize(G4HCofThisEvent* HCE);
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
virtual void EndOfEvent(G4HCofThisEvent* HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
private:
RE05CalorimeterHitsCollection *fCalCollection;
G4int fCellID[20][48];
const G4int fNumberOfCellsInZ;
const G4int fNumberOfCellsInPhi;
RE05CalorimeterHitsCollection* fCalCollection;
G4int fCellID[20][48];
const G4int fNumberOfCellsInZ;
const G4int fNumberOfCellsInPhi;
};
#endif
@@ -45,19 +45,19 @@ class RE05DetectorConstruction : public G4VUserDetectorConstruction
virtual ~RE05DetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
private:
void DefineMaterials();
void DefineMaterials();
#include "RE05DetectorParameterDef.hh"
G4Material* fAir;
G4Material* fAr;
G4Material* fSilicon;
G4Material* fScinti;
G4Material* fLead;
G4Material* fAir;
G4Material* fAr;
G4Material* fSilicon;
G4Material* fScinti;
G4Material* fLead;
};
#endif
@@ -28,47 +28,47 @@
/// \brief Definition of the RE05DetectorParameterDef class
//
G4double fExpHall_x;
G4double fExpHall_y;
G4double fExpHall_z;
G4double fExpHall_x;
G4double fExpHall_y;
G4double fExpHall_z;
G4double fTrkTubs_rmax;
G4double fTrkTubs_rmin;
G4double fTrkTubs_dz;
G4double fTrkTubs_sphi;
G4double fTrkTubs_dphi;
G4double fTrkTubs_rmax;
G4double fTrkTubs_rmin;
G4double fTrkTubs_dz;
G4double fTrkTubs_sphi;
G4double fTrkTubs_dphi;
G4int fNotrkLayers;
G4double fTracker_radius[5];
G4double fTracker_thick;
G4double fTracker_length[5];
G4int fNotrkLayers;
G4double fTracker_radius[5];
G4double fTracker_thick;
G4double fTracker_length[5];
G4double fCaloTubs_rmax;
G4double fCaloTubs_rmin;
G4double fCaloTubs_dz;
G4double fCaloTubs_sphi;
G4double fCaloTubs_dphi;
G4double fCaloTubs_rmax;
G4double fCaloTubs_rmin;
G4double fCaloTubs_dz;
G4double fCaloTubs_sphi;
G4double fCaloTubs_dphi;
G4int fNocaloLayers;
G4double fAbsorber_thick;
G4double fScinti_thick;
G4int fNocaloLayers;
G4double fAbsorber_thick;
G4double fScinti_thick;
G4int fSegmentsinZ;
G4double fCaloRing_rmax;
G4double fCaloRing_rmin;
G4double fCaloRing_dz;
G4double fCaloRing_sphi;
G4double fCaloRing_dphi;
G4int fSegmentsinZ;
G4double fCaloRing_rmax;
G4double fCaloRing_rmin;
G4double fCaloRing_dz;
G4double fCaloRing_sphi;
G4double fCaloRing_dphi;
G4int fSegmentsinPhi;
G4double fCaloCell_rmax;
G4double fCaloCell_rmin;
G4double fCaloCell_dz;
G4double fCaloCell_sphi;
G4double fCaloCell_dphi;
G4int fSegmentsinPhi;
G4double fCaloCell_rmax;
G4double fCaloCell_rmin;
G4double fCaloCell_dz;
G4double fCaloCell_sphi;
G4double fCaloCell_dphi;
G4int fNomucounter;
G4double fMuBox_radius;
G4double fMuBox_width;
G4double fMuBox_thick;
G4double fMuBox_length;
G4int fNomucounter;
G4double fMuBox_radius;
G4double fMuBox_width;
G4double fMuBox_thick;
G4double fMuBox_length;
@@ -40,18 +40,16 @@ class G4Step;
class RE05DummySD : public G4VSensitiveDetector
{
public:
RE05DummySD();
virtual ~RE05DummySD() {}
virtual void Initialize(G4HCofThisEvent*) {}
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*) {return false;}
virtual void EndOfEvent(G4HCofThisEvent*) {}
virtual void clear() {}
virtual void DrawAll() {}
virtual void PrintAll() {}
public:
RE05DummySD();
virtual ~RE05DummySD() {}
virtual void Initialize(G4HCofThisEvent*) {}
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*) { return false; }
virtual void EndOfEvent(G4HCofThisEvent*) {}
virtual void clear() {}
virtual void DrawAll() {}
virtual void PrintAll() {}
};
RE05DummySD::RE05DummySD()
: G4VSensitiveDetector("dummySD")
{}
RE05DummySD::RE05DummySD() : G4VSensitiveDetector("dummySD") {}
#endif
@@ -51,5 +51,3 @@ class RE05EventAction : public G4UserEventAction
};
#endif
@@ -31,8 +31,8 @@
#ifndef RE05Field_H
#define RE05Field_H 1
#include "globals.hh"
#include "G4MagneticField.hh"
#include "globals.hh"
class RE05Field : public G4MagneticField
{
@@ -40,8 +40,7 @@ class RE05Field : public G4MagneticField
RE05Field();
virtual ~RE05Field();
virtual void GetFieldValue(const double Point[3],
double *Bfield ) const;
virtual void GetFieldValue(const double Point[3], double* Bfield) const;
private:
G4double fBz;
@@ -50,4 +49,3 @@ class RE05Field : public G4MagneticField
};
#endif
@@ -31,48 +31,42 @@
#ifndef RE05MuonHit_h
#define RE05MuonHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4Types.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4Types.hh"
#include "G4VHit.hh"
class G4AttDef;
class RE05MuonHit : public G4VHit
{
public:
RE05MuonHit();
virtual ~RE05MuonHit();
RE05MuonHit(const RE05MuonHit& right);
const RE05MuonHit& operator=(const RE05MuonHit& right);
G4bool operator==(const RE05MuonHit& right) const;
RE05MuonHit();
virtual ~RE05MuonHit();
RE05MuonHit(const RE05MuonHit &right);
const RE05MuonHit& operator=(const RE05MuonHit &right);
G4bool operator==(const RE05MuonHit &right) const;
inline void* operator new(size_t);
inline void operator delete(void* aHit);
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void Print();
virtual void Draw();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void Print();
private:
G4double fEdep;
G4ThreeVector fPos;
static std::map<G4String,G4AttDef> fAttDefs;
G4double fEdep;
G4ThreeVector fPos;
static std::map<G4String, G4AttDef> fAttDefs;
public:
inline void SetEdep(G4double de)
{ fEdep = de; }
inline void AddEdep(G4double de)
{ fEdep += de; }
inline G4double GetEdep()
{ return fEdep; }
inline void SetPos(G4ThreeVector xyz)
{ fPos = xyz; }
inline G4ThreeVector GetPos()
{ return fPos; }
inline void SetEdep(G4double de) { fEdep = de; }
inline void AddEdep(G4double de) { fEdep += de; }
inline G4double GetEdep() { return fEdep; }
inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
inline G4ThreeVector GetPos() { return fPos; }
};
typedef G4THitsCollection<RE05MuonHit> RE05MuonHitsCollection;
@@ -81,13 +75,13 @@ extern G4ThreadLocal G4Allocator<RE05MuonHit>* RE05MuonHitAllocator;
inline void* RE05MuonHit::operator new(size_t)
{
if(!RE05MuonHitAllocator) RE05MuonHitAllocator = new G4Allocator<RE05MuonHit>;
return (void *) RE05MuonHitAllocator->MallocSingle();
if (!RE05MuonHitAllocator) RE05MuonHitAllocator = new G4Allocator<RE05MuonHit>;
return (void*)RE05MuonHitAllocator->MallocSingle();
}
inline void RE05MuonHit::operator delete(void *aHit)
inline void RE05MuonHit::operator delete(void* aHit)
{
RE05MuonHitAllocator->FreeSingle((RE05MuonHit*) aHit);
RE05MuonHitAllocator->FreeSingle((RE05MuonHit*)aHit);
}
#endif
@@ -31,29 +31,29 @@
#ifndef RE05MuonSD_h
#define RE05MuonSD_h 1
#include "G4VSensitiveDetector.hh"
#include "RE05MuonHit.hh"
#include "G4VSensitiveDetector.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class RE05MuonSD : public G4VSensitiveDetector
{
public:
RE05MuonSD(G4String name);
virtual ~RE05MuonSD();
RE05MuonSD(G4String name);
virtual ~RE05MuonSD();
virtual void Initialize(G4HCofThisEvent*HCE);
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
virtual void EndOfEvent(G4HCofThisEvent*HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void Initialize(G4HCofThisEvent* HCE);
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
virtual void EndOfEvent(G4HCofThisEvent* HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
private:
RE05MuonHitsCollection* fMuonCollection;
G4double fPositionResolution;
RE05MuonHitsCollection* fMuonCollection;
G4double fPositionResolution;
};
#endif
@@ -54,10 +54,8 @@ class RE05PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
G4bool fUseHEPEvt;
public:
inline void SetHEPEvtGenerator(G4bool option)
{ fUseHEPEvt = option; }
inline G4bool GetHEPEvtGenerator()
{ return fUseHEPEvt; }
inline void SetHEPEvtGenerator(G4bool option) { fUseHEPEvt = option; }
inline G4bool GetHEPEvtGenerator() { return fUseHEPEvt; }
};
#endif
@@ -38,22 +38,22 @@ class G4UIcmdWithAString;
#include "G4UImessenger.hh"
#include "globals.hh"
class RE05PrimaryGeneratorMessenger: public G4UImessenger
class RE05PrimaryGeneratorMessenger : public G4UImessenger
{
public:
RE05PrimaryGeneratorMessenger(RE05PrimaryGeneratorAction* mpga);
virtual ~RE05PrimaryGeneratorMessenger();
public:
virtual void SetNewValue(G4UIcommand * command,G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand * command);
virtual void SetNewValue(G4UIcommand* command, G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand* command);
private:
RE05PrimaryGeneratorAction * fMyAction;
//commands
G4UIdirectory * fMydetDirectory;
G4UIcmdWithAString * fGenCmd;
RE05PrimaryGeneratorAction* fMyAction;
// commands
G4UIdirectory* fMydetDirectory;
G4UIcmdWithAString* fGenCmd;
};
#endif
@@ -31,14 +31,14 @@
#ifndef RE05StackingAction_H
#define RE05StackingAction_H 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
#include "G4ThreeVector.hh"
#include "G4UserStackingAction.hh"
#include "globals.hh"
class G4Track;
#include "RE05TrackerHit.hh"
#include "RE05MuonHit.hh"
#include "RE05TrackerHit.hh"
class RE05StackingActionMessenger;
class RE05StackingAction : public G4UserStackingAction
@@ -53,9 +53,9 @@ class RE05StackingAction : public G4UserStackingAction
virtual void PrepareNewEvent();
private:
G4bool InsideRoI(const G4Track * aTrack,G4double ang);
G4bool InsideRoI(const G4Track* aTrack, G4double ang);
G4VHitsCollection* GetCollection(G4String colName);
RE05TrackerHitsCollection* fTrkHits;
RE05MuonHitsCollection* fMuonHits;
RE05StackingActionMessenger* fMessenger;
@@ -65,7 +65,7 @@ class RE05StackingAction : public G4UserStackingAction
G4int fReqIsoMuon;
G4int fReqIso;
G4double fAngRoI;
public:
inline void SetNRequestMuon(G4int val) { fReqMuon = val; }
inline G4int GetNRequestMuon() const { return fReqMuon; }
@@ -38,24 +38,24 @@ class G4UIcmdWithADoubleAndUnit;
#include "G4UImessenger.hh"
#include "globals.hh"
class RE05StackingActionMessenger: public G4UImessenger
class RE05StackingActionMessenger : public G4UImessenger
{
public:
RE05StackingActionMessenger(RE05StackingAction* msa);
virtual ~RE05StackingActionMessenger();
public:
virtual void SetNewValue(G4UIcommand * command,G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand * command);
virtual void SetNewValue(G4UIcommand* command, G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand* command);
private:
RE05StackingAction * fMyAction;
//commands
RE05StackingAction* fMyAction;
// commands
G4UIcmdWithAnInteger* fMuonCmd;
G4UIcmdWithAnInteger* fIsoMuonCmd;
G4UIcmdWithAnInteger* fIsoCmd;
G4UIcmdWithADoubleAndUnit* fRoiCmd;
G4UIcmdWithADoubleAndUnit* fRoiCmd;
};
#endif
@@ -31,8 +31,8 @@
#ifndef RE05SteppingAction_H
#define RE05SteppingAction_H 1
#include "globals.hh"
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class RE05SteppingAction : public G4UserSteppingAction
{
@@ -40,22 +40,20 @@ class RE05SteppingVerbose;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// This class manages the verbose outputs in G4SteppingManager.
/// This class manages the verbose outputs in G4SteppingManager.
/// It inherits from G4SteppingVerbose.
/// It shows how to extract informations during the tracking of a particle.
class RE05SteppingVerbose : public G4SteppingVerbose
class RE05SteppingVerbose : public G4SteppingVerbose
{
public:
RE05SteppingVerbose();
virtual ~RE05SteppingVerbose();
public:
RE05SteppingVerbose();
virtual ~RE05SteppingVerbose();
virtual G4VSteppingVerbose* Clone()
{ return new RE05SteppingVerbose; }
virtual G4VSteppingVerbose* Clone() { return new RE05SteppingVerbose; }
void StepInfo();
void TrackingStarted();
void StepInfo();
void TrackingStarted();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -31,46 +31,41 @@
#ifndef RE05TrackerHit_h
#define RE05TrackerHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4Types.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4Types.hh"
#include "G4VHit.hh"
class G4AttDef;
class RE05TrackerHit : public G4VHit
{
public:
RE05TrackerHit();
virtual ~RE05TrackerHit();
RE05TrackerHit(const RE05TrackerHit& right);
const RE05TrackerHit& operator=(const RE05TrackerHit& right);
G4bool operator==(const RE05TrackerHit& right) const;
RE05TrackerHit();
virtual ~RE05TrackerHit();
RE05TrackerHit(const RE05TrackerHit &right);
const RE05TrackerHit& operator=(const RE05TrackerHit &right);
G4bool operator==(const RE05TrackerHit &right) const;
inline void* operator new(size_t);
inline void operator delete(void* aHit);
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void Print();
virtual void Draw();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void Print();
private:
G4double fEdep;
G4ThreeVector fPos;
static std::map<G4String,G4AttDef> fAttDefs;
G4double fEdep;
G4ThreeVector fPos;
static std::map<G4String, G4AttDef> fAttDefs;
public:
inline void SetEdep(G4double de)
{ fEdep = de; }
inline G4double GetEdep()
{ return fEdep; }
inline void SetPos(G4ThreeVector xyz)
{ fPos = xyz; }
inline G4ThreeVector GetPos()
{ return fPos; }
inline void SetEdep(G4double de) { fEdep = de; }
inline G4double GetEdep() { return fEdep; }
inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
inline G4ThreeVector GetPos() { return fPos; }
};
typedef G4THitsCollection<RE05TrackerHit> RE05TrackerHitsCollection;
@@ -79,13 +74,13 @@ extern G4ThreadLocal G4Allocator<RE05TrackerHit>* RE05TrackerHitAllocator;
inline void* RE05TrackerHit::operator new(size_t)
{
if(!RE05TrackerHitAllocator) RE05TrackerHitAllocator = new G4Allocator<RE05TrackerHit>;
return (void *) RE05TrackerHitAllocator->MallocSingle();
if (!RE05TrackerHitAllocator) RE05TrackerHitAllocator = new G4Allocator<RE05TrackerHit>;
return (void*)RE05TrackerHitAllocator->MallocSingle();
}
inline void RE05TrackerHit::operator delete(void *aHit)
inline void RE05TrackerHit::operator delete(void* aHit)
{
RE05TrackerHitAllocator->FreeSingle((RE05TrackerHit*) aHit);
RE05TrackerHitAllocator->FreeSingle((RE05TrackerHit*)aHit);
}
#endif
@@ -31,8 +31,8 @@
#ifndef RE05TrackerParametrisation_H
#define RE05TrackerParametrisation_H 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
#include "globals.hh"
class G4VPhysicalVolume;
class G4Tubs;
@@ -52,37 +52,31 @@ class G4Polycone;
class G4Polyhedra;
class RE05TrackerParametrisation : public G4VPVParameterisation
{
{
public:
RE05TrackerParametrisation();
~RE05TrackerParametrisation();
~RE05TrackerParametrisation();
virtual void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
virtual void ComputeDimensions(G4Tubs & trackerLayer,
const G4int copyNo,
const G4VPhysicalVolume * physVol) const;
virtual void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const;
virtual void ComputeDimensions(G4Tubs& trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
virtual void ComputeDimensions (G4Trd&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Trap&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Cons&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Orb&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Sphere&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Ellipsoid&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Torus&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Para&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Hype&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Box&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Polycone&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Trd&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Trap&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Cons&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Orb&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Sphere&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Ellipsoid&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Torus&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Para&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Hype&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Box&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Polycone&, const G4int, const G4VPhysicalVolume*) const {}
virtual void ComputeDimensions(G4Polyhedra&, const G4int, const G4VPhysicalVolume*) const {}
private:
#include "RE05DetectorParameterDef.hh"
};
#endif
@@ -31,8 +31,9 @@
#ifndef RE05TrackerSD_h
#define RE05TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "RE05TrackerHit.hh"
#include "G4VSensitiveDetector.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
@@ -40,18 +41,18 @@ class G4TouchableHistory;
class RE05TrackerSD : public G4VSensitiveDetector
{
public:
RE05TrackerSD(G4String name);
virtual ~RE05TrackerSD();
RE05TrackerSD(G4String name);
virtual ~RE05TrackerSD();
virtual void Initialize(G4HCofThisEvent*HCE);
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
virtual void EndOfEvent(G4HCofThisEvent*HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void Initialize(G4HCofThisEvent* HCE);
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
virtual void EndOfEvent(G4HCofThisEvent* HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
private:
RE05TrackerHitsCollection* fTrackerCollection;
RE05TrackerHitsCollection* fTrackerCollection;
};
#endif
@@ -33,12 +33,12 @@
#include "G4UserTrackingAction.hh"
class RE05TrackingAction : public G4UserTrackingAction {
class RE05TrackingAction : public G4UserTrackingAction
{
public:
RE05TrackingAction() : G4UserTrackingAction() {}
virtual ~RE05TrackingAction() {}
virtual void PreUserTrackingAction(const G4Track*);
};
@@ -29,23 +29,21 @@
//
#include "RE05ActionInitialization.hh"
#include "RE05EventAction.hh"
#include "RE05PrimaryGeneratorAction.hh"
#include "RE05RunAction.hh"
#include "RE05EventAction.hh"
#include "RE05StackingAction.hh"
#include "RE05TrackingAction.hh"
#include "RE05SteppingAction.hh"
#include "RE05TrackingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05ActionInitialization::RE05ActionInitialization()
: G4VUserActionInitialization()
{}
RE05ActionInitialization::RE05ActionInitialization() : G4VUserActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05ActionInitialization::~RE05ActionInitialization()
{}
RE05ActionInitialization::~RE05ActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,44 +29,41 @@
//
#include "RE05CalorimeterHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4AttCheck.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4UIcommand.hh"
#include "G4UnitsTable.hh"
#include "G4AttValue.hh"
#include "G4AttDef.hh"
#include "G4AttCheck.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
#include "G4ios.hh"
G4ThreadLocal G4Allocator<RE05CalorimeterHit>* RE05CalorimeterHitAllocator=0;
G4ThreadLocal G4Allocator<RE05CalorimeterHit>* RE05CalorimeterHitAllocator = 0;
std::map<G4String,G4AttDef> RE05CalorimeterHit::fAttDefs;
std::map<G4String, G4AttDef> RE05CalorimeterHit::fAttDefs;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterHit::RE05CalorimeterHit()
: G4VHit(),
fZCellID(-1),fPhiCellID(-1),fEdep(0.),fPos(),fRot(),fLogV(0)
: G4VHit(), fZCellID(-1), fPhiCellID(-1), fEdep(0.), fPos(), fRot(), fLogV(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterHit::RE05CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi)
: G4VHit(),
fZCellID(z), fPhiCellID(phi),fEdep(0.),fPos(),fRot(),fLogV(logVol)
RE05CalorimeterHit::RE05CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi)
: G4VHit(), fZCellID(z), fPhiCellID(phi), fEdep(0.), fPos(), fRot(), fLogV(logVol)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterHit::~RE05CalorimeterHit()
{}
RE05CalorimeterHit::~RE05CalorimeterHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterHit::RE05CalorimeterHit(const RE05CalorimeterHit &right)
: G4VHit()
RE05CalorimeterHit::RE05CalorimeterHit(const RE05CalorimeterHit& right) : G4VHit()
{
fZCellID = right.fZCellID;
fPhiCellID = right.fPhiCellID;
@@ -78,7 +75,7 @@ RE05CalorimeterHit::RE05CalorimeterHit(const RE05CalorimeterHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const RE05CalorimeterHit& RE05CalorimeterHit::operator=(const RE05CalorimeterHit &right)
const RE05CalorimeterHit& RE05CalorimeterHit::operator=(const RE05CalorimeterHit& right)
{
fZCellID = right.fZCellID;
fPhiCellID = right.fPhiCellID;
@@ -91,9 +88,9 @@ const RE05CalorimeterHit& RE05CalorimeterHit::operator=(const RE05CalorimeterHit
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RE05CalorimeterHit::operator==(const RE05CalorimeterHit &right) const
G4bool RE05CalorimeterHit::operator==(const RE05CalorimeterHit& right) const
{
return ((fZCellID==right.fZCellID)&&(fPhiCellID==right.fPhiCellID));
return ((fZCellID == right.fZCellID) && (fPhiCellID == right.fPhiCellID));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -101,31 +98,28 @@ G4bool RE05CalorimeterHit::operator==(const RE05CalorimeterHit &right) const
void RE05CalorimeterHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Transform3D trans(fRot,fPos);
if (pVVisManager) {
G4Transform3D trans(fRot, fPos);
G4VisAttributes attribs;
const G4VisAttributes* pVA = fLogV->GetVisAttributes();
if(pVA) attribs = *pVA;
G4Colour colour(1.,0.,0.);
if (pVA) attribs = *pVA;
G4Colour colour(1., 0., 0.);
attribs.SetColour(colour);
attribs.SetForceSolid(true);
pVVisManager->Draw(*fLogV,attribs,trans);
pVVisManager->Draw(*fLogV, attribs, trans);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String,G4AttDef>* RE05CalorimeterHit::GetAttDefs() const
const std::map<G4String, G4AttDef>* RE05CalorimeterHit::GetAttDefs() const
{
// G4AttDefs have to have long life. Use static member...
if (fAttDefs.empty()) {
fAttDefs["HitType"] =
G4AttDef("HitType","Type of hit","Physics","","G4String");
fAttDefs["ZID"] = G4AttDef("ZID","Z Cell ID","Physics","","G4int");
fAttDefs["PhiID"] = G4AttDef("PhiID","Phi Cell ID","Physics","","G4int");
fAttDefs["EDep"] =
G4AttDef("EDep","Energy defPosited","Physics","G4BestUnit","G4double");
fAttDefs["HitType"] = G4AttDef("HitType", "Type of hit", "Physics", "", "G4String");
fAttDefs["ZID"] = G4AttDef("ZID", "Z Cell ID", "Physics", "", "G4int");
fAttDefs["PhiID"] = G4AttDef("PhiID", "Phi Cell ID", "Physics", "", "G4int");
fAttDefs["EDep"] = G4AttDef("EDep", "Energy defPosited", "Physics", "G4BestUnit", "G4double");
}
return &fAttDefs;
}
@@ -136,22 +130,16 @@ std::vector<G4AttValue>* RE05CalorimeterHit::CreateAttValues() const
{
// Create expendable G4AttsValues for picking...
std::vector<G4AttValue>* attValues = new std::vector<G4AttValue>;
attValues->push_back
(G4AttValue("HitType","RE05CalorimeterHit",""));
attValues->push_back
(G4AttValue("ZID",G4UIcommand::ConvertToString(fZCellID),""));
attValues->push_back
(G4AttValue("PhiID",G4UIcommand::ConvertToString(fPhiCellID),""));
attValues->push_back
(G4AttValue("EDep",G4BestUnit(fEdep,"Energy"),""));
//G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
attValues->push_back(G4AttValue("HitType", "RE05CalorimeterHit", ""));
attValues->push_back(G4AttValue("ZID", G4UIcommand::ConvertToString(fZCellID), ""));
attValues->push_back(G4AttValue("PhiID", G4UIcommand::ConvertToString(fPhiCellID), ""));
attValues->push_back(G4AttValue("EDep", G4BestUnit(fEdep, "Energy"), ""));
// G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
return attValues;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterHit::Print()
{}
void RE05CalorimeterHit::Print() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,24 +28,24 @@
/// \brief Implementation of the RE05CalorimeterParallelWorld class
//
#include "RE05CalorimeterParallelWorld.hh"
#include "RE05CalorimeterSD.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Material.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"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterParallelWorld::
RE05CalorimeterParallelWorld(G4String& parallelWorldName)
RE05CalorimeterParallelWorld::RE05CalorimeterParallelWorld(G4String& parallelWorldName)
: G4VUserParallelWorld(parallelWorldName)
{
#include "RE05DetectorParameterDef.icc"
@@ -53,61 +53,54 @@ RE05CalorimeterParallelWorld(G4String& parallelWorldName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterParallelWorld::~RE05CalorimeterParallelWorld()
{}
RE05CalorimeterParallelWorld::~RE05CalorimeterParallelWorld() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterParallelWorld::Construct()
{
G4Material* dummyMat = 0;
G4Material* dummyMat = 0;
// the ReadOut World:
G4VPhysicalVolume* ROWorldPhys = GetWorld();
G4LogicalVolume* ROWorldLog = ROWorldPhys->GetLogicalVolume();
// Calorimeter volume:
G4VSolid* caloROtub
= new G4Tubs("caloROtub",fCaloTubs_rmin,fCaloTubs_rmax,
fCaloTubs_dz,fCaloTubs_sphi,fCaloTubs_dphi);
G4LogicalVolume* caloROlog
= new G4LogicalVolume(caloROtub,dummyMat,"caloROlogical",0,0,0);
// G4VPhysicalVolume* caloROphys =
new G4PVPlacement(0,G4ThreeVector(),caloROlog,"calROphysical",
ROWorldLog,false,0);
G4VSolid* caloROtub = new G4Tubs("caloROtub", fCaloTubs_rmin, fCaloTubs_rmax, fCaloTubs_dz,
fCaloTubs_sphi, fCaloTubs_dphi);
G4LogicalVolume* caloROlog = new G4LogicalVolume(caloROtub, dummyMat, "caloROlogical", 0, 0, 0);
// G4VPhysicalVolume* caloROphys =
new G4PVPlacement(0, G4ThreeVector(), caloROlog, "calROphysical", ROWorldLog, false, 0);
// -------------------------------
// Calorimeter readout division:
// -------------------------------
// Phi division first: 48 sectors
G4VSolid* caloROphiDivisionTub
= new G4Tubs("caloROphiDivision", fCaloCell_rmin, fCaloCell_rmax,
fCaloCell_dz, fCaloCell_sphi, fCaloCell_dphi);
G4LogicalVolume* caloROphiDivisionLog
= new G4LogicalVolume(caloROphiDivisionTub, dummyMat,
"caloROphiDivisionLogical",0,0,0);
// G4VPhysicalVolume* caloROphiDivisionPhys =
new G4PVReplica("caloROphiDivisionPhysical", caloROphiDivisionLog,
caloROlog, kPhi, fSegmentsinPhi, fCaloCell_dphi);
G4VSolid* caloROphiDivisionTub = new G4Tubs("caloROphiDivision", fCaloCell_rmin, fCaloCell_rmax,
fCaloCell_dz, fCaloCell_sphi, fCaloCell_dphi);
G4LogicalVolume* caloROphiDivisionLog =
new G4LogicalVolume(caloROphiDivisionTub, dummyMat, "caloROphiDivisionLogical", 0, 0, 0);
// G4VPhysicalVolume* caloROphiDivisionPhys =
new G4PVReplica("caloROphiDivisionPhysical", caloROphiDivisionLog, caloROlog, kPhi,
fSegmentsinPhi, fCaloCell_dphi);
// then z division: 20 slices:
G4VSolid* caloROcellTub
= new G4Tubs("caloROcellTub", fCaloRing_rmin, fCaloRing_rmax,
fCaloRing_dz, fCaloRing_sphi, fCaloRing_dphi);
G4LogicalVolume * caloROcellLog
= new G4LogicalVolume(caloROcellTub, dummyMat, "caloROcellLogical",0,0,0);
// G4VPhysicalVolume * caloROcellPhys =
new G4PVReplica("caloROcellPhysical", caloROcellLog, caloROphiDivisionLog,
kZAxis, fSegmentsinZ,2.*fCaloRing_dz);
G4VSolid* caloROcellTub = new G4Tubs("caloROcellTub", fCaloRing_rmin, fCaloRing_rmax,
fCaloRing_dz, fCaloRing_sphi, fCaloRing_dphi);
G4LogicalVolume* caloROcellLog =
new G4LogicalVolume(caloROcellTub, dummyMat, "caloROcellLogical", 0, 0, 0);
// G4VPhysicalVolume * caloROcellPhys =
new G4PVReplica("caloROcellPhysical", caloROcellLog, caloROphiDivisionLog, kZAxis, fSegmentsinZ,
2. * fCaloRing_dz);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterParallelWorld::ConstructSD()
{
G4String calorimeterSDname = "/mydet/calorimeter";
RE05CalorimeterSD * calorimeterSD = new RE05CalorimeterSD(calorimeterSDname);
RE05CalorimeterSD* calorimeterSD = new RE05CalorimeterSD(calorimeterSDname);
G4SDManager::GetSDMpointer()->AddNewDetector(calorimeterSD);
SetSensitiveDetector("caloROcellLogical",calorimeterSD);
SetSensitiveDetector("caloROcellLogical", calorimeterSD);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -30,28 +30,26 @@
#include "RE05CalorimeterParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterParametrisation::RE05CalorimeterParametrisation()
: G4VPVParameterisation()
RE05CalorimeterParametrisation::RE05CalorimeterParametrisation() : G4VPVParameterisation()
{
#include "RE05DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterParametrisation::~RE05CalorimeterParametrisation()
{}
RE05CalorimeterParametrisation::~RE05CalorimeterParametrisation() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterParametrisation::ComputeTransformation
(const G4int,G4VPhysicalVolume *physVol) const
void RE05CalorimeterParametrisation::ComputeTransformation(const G4int,
G4VPhysicalVolume* physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
@@ -59,15 +57,14 @@ void RE05CalorimeterParametrisation::ComputeTransformation
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterParametrisation::ComputeDimensions
(G4Tubs & calorimeterLayer, const G4int copyNo, const G4VPhysicalVolume*) const
void RE05CalorimeterParametrisation::ComputeDimensions(G4Tubs& calorimeterLayer, const G4int copyNo,
const G4VPhysicalVolume*) const
{
G4double innerRad = fCaloTubs_rmin
+ copyNo*(fAbsorber_thick+fScinti_thick);
G4double innerRad = fCaloTubs_rmin + copyNo * (fAbsorber_thick + fScinti_thick);
calorimeterLayer.SetInnerRadius(innerRad);
calorimeterLayer.SetOuterRadius(innerRad+fAbsorber_thick);
calorimeterLayer.SetOuterRadius(innerRad + fAbsorber_thick);
calorimeterLayer.SetZHalfLength(fCaloTubs_dz);
calorimeterLayer.SetStartPhiAngle(fCaloTubs_sphi,false);
calorimeterLayer.SetStartPhiAngle(fCaloTubs_sphi, false);
calorimeterLayer.SetDeltaPhiAngle(fCaloTubs_dphi);
}
@@ -29,85 +29,80 @@
//
#include "RE05CalorimeterSD.hh"
#include "RE05CalorimeterHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4Step.hh"
#include "G4SystemOfUnits.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VTouchable.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterSD::RE05CalorimeterSD(G4String name)
:G4VSensitiveDetector(name),
fNumberOfCellsInZ(20),fNumberOfCellsInPhi(48)
: G4VSensitiveDetector(name), fNumberOfCellsInZ(20), fNumberOfCellsInPhi(48)
{
G4String HCname;
collectionName.insert(HCname="calCollection");
collectionName.insert(HCname = "calCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05CalorimeterSD::~RE05CalorimeterSD()
{}
RE05CalorimeterSD::~RE05CalorimeterSD() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterSD::Initialize(G4HCofThisEvent*)
{
fCalCollection = new RE05CalorimeterHitsCollection
(SensitiveDetectorName,collectionName[0]);
for(G4int j=0;j<fNumberOfCellsInZ;j++)
for(G4int k=0;k<fNumberOfCellsInPhi;k++)
{
fCellID[j][k] = -1;
}
fCalCollection = new RE05CalorimeterHitsCollection(SensitiveDetectorName, collectionName[0]);
for (G4int j = 0; j < fNumberOfCellsInZ; j++)
for (G4int k = 0; k < fNumberOfCellsInPhi; k++) {
fCellID[j][k] = -1;
}
verboseLevel = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RE05CalorimeterSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
G4bool RE05CalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
//***** RE05CalorimeterSD has been migrated to Geant4 version 10 that does not
//***** support Readout Geometry in multi-threaded mode. Now RE05CalorimeterSD
//***** is assigned to a dedicated parallel world. The pointer "aStep" points to
//***** a G4Step object for the parallel world.
//***** RE05CalorimeterSD has been migrated to Geant4 version 10 that does not
//***** support Readout Geometry in multi-threaded mode. Now RE05CalorimeterSD
//***** is assigned to a dedicated parallel world. The pointer "aStep" points to
//***** a G4Step object for the parallel world.
G4double edep = aStep->GetTotalEnergyDeposit();
if(verboseLevel>1) G4cout << "Next step edep(MeV) = " << edep/MeV << G4endl;
if(edep==0.) return false;
if (verboseLevel > 1) G4cout << "Next step edep(MeV) = " << edep / MeV << G4endl;
if (edep == 0.) return false;
const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable();
G4int copyIDinZ = touchable->GetReplicaNumber(0);
G4int copyIDinPhi = touchable->GetReplicaNumber(1);
if(fCellID[copyIDinZ][copyIDinPhi]==-1)
{
RE05CalorimeterHit* calHit
= new RE05CalorimeterHit
(touchable->GetVolume()->GetLogicalVolume(),copyIDinZ,copyIDinPhi);
calHit->SetEdep( edep );
if (fCellID[copyIDinZ][copyIDinPhi] == -1) {
RE05CalorimeterHit* calHit =
new RE05CalorimeterHit(touchable->GetVolume()->GetLogicalVolume(), copyIDinZ, copyIDinPhi);
calHit->SetEdep(edep);
G4AffineTransform aTrans = touchable->GetHistory()->GetTopTransform();
aTrans.Invert();
calHit->SetPos(aTrans.NetTranslation());
calHit->SetRot(aTrans.NetRotation());
G4int icell = fCalCollection->insert( calHit );
G4int icell = fCalCollection->insert(calHit);
fCellID[copyIDinZ][copyIDinPhi] = icell - 1;
if(verboseLevel>0)
{ G4cout << " New Calorimeter Hit on fCellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
if (verboseLevel > 0) {
G4cout << " New Calorimeter Hit on fCellID " << copyIDinZ << " " << copyIDinPhi << G4endl;
}
}
else
{
else {
(*fCalCollection)[fCellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep);
if(verboseLevel>0)
{ G4cout << " Energy added to fCellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
if (verboseLevel > 0) {
G4cout << " Energy added to fCellID " << copyIDinZ << " " << copyIDinPhi << G4endl;
}
}
return true;
@@ -115,27 +110,25 @@ G4bool RE05CalorimeterSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterSD::EndOfEvent(G4HCofThisEvent*HCE)
void RE05CalorimeterSD::EndOfEvent(G4HCofThisEvent* HCE)
{
static G4int HCID = -1;
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection( HCID, fCalCollection );
if (HCID < 0) {
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID, fCalCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterSD::clear()
{}
void RE05CalorimeterSD::clear() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterSD::DrawAll()
{}
void RE05CalorimeterSD::DrawAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05CalorimeterSD::PrintAll()
{}
void RE05CalorimeterSD::PrintAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,46 +29,43 @@
//
#include "RE05DetectorConstruction.hh"
#include "RE05TrackerSD.hh"
#include "RE05CalorimeterParametrisation.hh"
#include "RE05CalorimeterSD.hh"
#include "RE05Field.hh"
#include "RE05MuonSD.hh"
#include "RE05TrackerParametrisation.hh"
#include "RE05CalorimeterParametrisation.hh"
#include "RE05Field.hh"
#include "RE05TrackerSD.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Box.hh"
#include "G4Colour.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 "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4PVParameterised.hh"
#include "G4PVPlacement.hh"
#include "G4RotationMatrix.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4TransportationManager.hh"
#include "G4Tubs.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05DetectorConstruction::RE05DetectorConstruction()
: G4VUserDetectorConstruction()
RE05DetectorConstruction::RE05DetectorConstruction() : G4VUserDetectorConstruction()
{
#include "RE05DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05DetectorConstruction::~RE05DetectorConstruction()
{}
RE05DetectorConstruction::~RE05DetectorConstruction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -81,25 +78,22 @@ void RE05DetectorConstruction::DefineMaterials()
G4double a, z, density;
G4int nel;
G4Element* H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole);
G4Element* C = new G4Element("Carbon", "C", z=6., a= 12.01*g/mole);
G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole);
G4Element* H = new G4Element("Hydrogen", "H", z = 1., a = 1.01 * g / mole);
G4Element* C = new G4Element("Carbon", "C", z = 6., a = 12.01 * g / mole);
G4Element* N = new G4Element("Nitrogen", "N", z = 7., a = 14.01 * g / mole);
G4Element* O = new G4Element("Oxygen", "O", z = 8., a = 16.00 * g / mole);
fAir = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
fAir->AddElement(N, 70.*perCent);
fAir->AddElement(O, 30.*perCent);
fAir = new G4Material("Air", density = 1.29 * mg / cm3, nel = 2);
fAir->AddElement(N, 70. * perCent);
fAir->AddElement(O, 30. * perCent);
fLead =
new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
fLead = new G4Material("Lead", z = 82., a = 207.19 * g / mole, density = 11.35 * g / cm3);
fAr =
new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
fAr = new G4Material("ArgonGas", z = 18., a = 39.95 * g / mole, density = 1.782 * mg / cm3);
fSilicon =
new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
fSilicon = new G4Material("Silicon", z = 14., a = 28.09 * g / mole, density = 2.33 * g / cm3);
fScinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
fScinti = new G4Material("Scintillator", density = 1.032 * g / cm3, nel = 2);
fScinti->AddElement(C, 9);
fScinti->AddElement(H, 10);
}
@@ -115,101 +109,82 @@ G4VPhysicalVolume* RE05DetectorConstruction::Construct()
//-------------------------------------------------------------------------
//------------------------------ experimental hall
G4Box * experimentalHall_box
= new G4Box("expHall_b",fExpHall_x,fExpHall_y,fExpHall_z);
G4LogicalVolume * experimentalHall_log
= new G4LogicalVolume(experimentalHall_box,fAir,"expHall_L",0,0,0);
G4VPhysicalVolume * experimentalHall_phys
= new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
0,false,0);
G4Box* experimentalHall_box = new G4Box("expHall_b", fExpHall_x, fExpHall_y, fExpHall_z);
G4LogicalVolume* experimentalHall_log =
new G4LogicalVolume(experimentalHall_box, fAir, "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 * fTracker_tubs
= new G4Tubs("trkTubs_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
fTrkTubs_sphi,fTrkTubs_dphi);
G4LogicalVolume * fTracker_log
= new G4LogicalVolume(fTracker_tubs,fAr,"trackerT_L",0,0,0);
G4VSolid* fTracker_tubs = new G4Tubs("trkTubs_tubs", fTrkTubs_rmin, fTrkTubs_rmax, fTrkTubs_dz,
fTrkTubs_sphi, fTrkTubs_dphi);
G4LogicalVolume* fTracker_log = new G4LogicalVolume(fTracker_tubs, fAr, "trackerT_L", 0, 0, 0);
// G4VPhysicalVolume * fTracker_phys =
new G4PVPlacement(0,G4ThreeVector(),fTracker_log,"tracker_phys",
experimentalHall_log,false,0);
G4VisAttributes* fTracker_logVisAtt
= new G4VisAttributes(G4Colour(1.0,0.0,1.0));
new G4PVPlacement(0, G4ThreeVector(), fTracker_log, "tracker_phys", experimentalHall_log, false,
0);
G4VisAttributes* fTracker_logVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0));
fTracker_log->SetVisAttributes(fTracker_logVisAtt);
//------------------------------ tracker layers
// As an example for Parameterised volume
// As an example for Parameterised volume
// dummy values for G4Tubs -- modified by parameterised volume
G4VSolid * trackerLayer_tubs
= new G4Tubs("trackerLayer_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
fTrkTubs_sphi,fTrkTubs_dphi);
G4LogicalVolume * trackerLayer_log
= new G4LogicalVolume(trackerLayer_tubs,fSilicon,"trackerB_L",0,0,0);
G4VPVParameterisation * trackerParam
= new RE05TrackerParametrisation;
G4VSolid* trackerLayer_tubs = new G4Tubs("trackerLayer_tubs", fTrkTubs_rmin, fTrkTubs_rmax,
fTrkTubs_dz, fTrkTubs_sphi, fTrkTubs_dphi);
G4LogicalVolume* trackerLayer_log =
new G4LogicalVolume(trackerLayer_tubs, fSilicon, "trackerB_L", 0, 0, 0);
G4VPVParameterisation* trackerParam = new RE05TrackerParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
// G4VPhysicalVolume *trackerLayer_phys =
new G4PVParameterised("trackerLayer_phys",trackerLayer_log,fTracker_log,
kXAxis, fNotrkLayers, trackerParam);
G4VisAttributes* trackerLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
new G4PVParameterised("trackerLayer_phys", trackerLayer_log, fTracker_log, kXAxis, fNotrkLayers,
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",fCaloTubs_rmin,fCaloTubs_rmax,
fCaloTubs_dz,fCaloTubs_sphi,fCaloTubs_dphi);
G4LogicalVolume * calorimeter_log
= new G4LogicalVolume(calorimeter_tubs,fScinti,"caloT_L",0,0,0);
G4VSolid* calorimeter_tubs = new G4Tubs("calorimeter_tubs", fCaloTubs_rmin, fCaloTubs_rmax,
fCaloTubs_dz, fCaloTubs_sphi, fCaloTubs_dphi);
G4LogicalVolume* calorimeter_log =
new G4LogicalVolume(calorimeter_tubs, fScinti, "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));
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
// As an example for Parameterised volume
// dummy values for G4Tubs -- modified by parameterised volume
G4VSolid * caloLayer_tubs
= new G4Tubs("caloLayer_tubs",fCaloRing_rmin,fCaloRing_rmax,
fCaloRing_dz,fCaloRing_sphi,fCaloRing_dphi);
G4LogicalVolume * caloLayer_log
= new G4LogicalVolume(caloLayer_tubs,fLead,"caloR_L",0,0,0);
G4VPVParameterisation * calorimeterParam
= new RE05CalorimeterParametrisation;
G4VSolid* caloLayer_tubs = new G4Tubs("caloLayer_tubs", fCaloRing_rmin, fCaloRing_rmax,
fCaloRing_dz, fCaloRing_sphi, fCaloRing_dphi);
G4LogicalVolume* caloLayer_log = new G4LogicalVolume(caloLayer_tubs, fLead, "caloR_L", 0, 0, 0);
G4VPVParameterisation* calorimeterParam = new RE05CalorimeterParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
// G4VPhysicalVolume * caloLayer_phys =
new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_log,
kXAxis, fNocaloLayers, calorimeterParam);
G4VisAttributes* caloLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.7,1.0,0.0));
new G4PVParameterised("caloLayer_phys", caloLayer_log, calorimeter_log, kXAxis, fNocaloLayers,
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",fMuBox_width,fMuBox_thick,
fMuBox_length);
G4LogicalVolume * muoncounter_log
= new G4LogicalVolume(muoncounter_box,fScinti,"mucounter_L",0,0,0);
for(int i=0; i<fNomucounter ; i++)
{
G4VSolid* muoncounter_box =
new G4Box("muoncounter_box", fMuBox_width, fMuBox_thick, fMuBox_length);
G4LogicalVolume* muoncounter_log =
new G4LogicalVolume(muoncounter_box, fScinti, "mucounter_L", 0, 0, 0);
for (int i = 0; i < fNomucounter; i++) {
G4double phi, x, y, z;
phi = 360.*deg/fNomucounter*i;
x = fMuBox_radius*std::sin(phi);
y = fMuBox_radius*std::cos(phi);
z = 0.*cm;
phi = 360. * deg / fNomucounter * i;
x = fMuBox_radius * std::sin(phi);
y = fMuBox_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);
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));
G4VisAttributes* muoncounter_logVisAtt = new G4VisAttributes(G4Colour(0.0, 1.0, 1.0));
muoncounter_logVisAtt->SetForceWireframe(true);
muoncounter_log->SetVisAttributes(muoncounter_logVisAtt);
@@ -224,8 +199,7 @@ void RE05DetectorConstruction::ConstructSDandField()
// Magnetic field
//-------------------------------------------------------------------------
RE05Field* myField = new RE05Field;
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
fieldMgr->SetDetectorField(myField);
fieldMgr->CreateChordFinder(myField);
@@ -233,14 +207,14 @@ void RE05DetectorConstruction::ConstructSDandField()
// Sensitive Detectors
//------------------------------------------------------------------
G4String trackerSDname = "/mydet/tracker";
RE05TrackerSD * trackerSD = new RE05TrackerSD(trackerSDname);
RE05TrackerSD* trackerSD = new RE05TrackerSD(trackerSDname);
G4SDManager::GetSDMpointer()->AddNewDetector(trackerSD);
SetSensitiveDetector("trackerB_L",trackerSD);
SetSensitiveDetector("trackerB_L", trackerSD);
G4String muonSDname = "/mydet/muon";
RE05MuonSD * muonSD = new RE05MuonSD(muonSDname);
RE05MuonSD* muonSD = new RE05MuonSD(muonSDname);
G4SDManager::GetSDMpointer()->AddNewDetector(muonSD);
SetSensitiveDetector("mucounter_L",muonSD);
SetSensitiveDetector("mucounter_L", muonSD);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -30,47 +30,42 @@
#include "RE05EventAction.hh"
#include "RE05TrackerHit.hh"
#include "RE05CalorimeterHit.hh"
#include "RE05MuonHit.hh"
#include "RE05TrackerHit.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 "G4Trajectory.hh"
#include "G4TrajectoryContainer.hh"
#include "G4UImanager.hh"
#include "G4VHitsCollection.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05EventAction::RE05EventAction()
: G4UserEventAction(),
fTrackerCollID(-1),
fCalorimeterCollID(-1),
fMuonCollID(-1)
: G4UserEventAction(), fTrackerCollID(-1), fCalorimeterCollID(-1), fMuonCollID(-1)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05EventAction::~RE05EventAction()
{}
RE05EventAction::~RE05EventAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05EventAction::BeginOfEventAction(const G4Event*)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
if(fTrackerCollID<0||fCalorimeterCollID<0||fMuonCollID<0)
{
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if (fTrackerCollID < 0 || fCalorimeterCollID < 0 || fMuonCollID < 0) {
G4String colNam;
fTrackerCollID = SDman->GetCollectionID(colNam="trackerCollection");
fCalorimeterCollID = SDman->GetCollectionID(colNam="calCollection");
fMuonCollID = SDman->GetCollectionID(colNam="muonCollection");
fTrackerCollID = SDman->GetCollectionID(colNam = "trackerCollection");
fCalorimeterCollID = SDman->GetCollectionID(colNam = "calCollection");
fMuonCollID = SDman->GetCollectionID(colNam = "muonCollection");
}
}
@@ -79,42 +74,35 @@ void RE05EventAction::BeginOfEventAction(const G4Event*)
void RE05EventAction::EndOfEventAction(const G4Event* evt)
{
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
if(fTrackerCollID<0||fCalorimeterCollID<0||fMuonCollID<0) return;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
if (fTrackerCollID < 0 || fCalorimeterCollID < 0 || fMuonCollID < 0) return;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
RE05TrackerHitsCollection* THC = 0;
RE05CalorimeterHitsCollection* CHC = 0;
RE05MuonHitsCollection* MHC = 0;
if(HCE)
{
if (HCE) {
THC = (RE05TrackerHitsCollection*)(HCE->GetHC(fTrackerCollID));
CHC = (RE05CalorimeterHitsCollection*)(HCE->GetHC(fCalorimeterCollID));
MHC = (RE05MuonHitsCollection*)(HCE->GetHC(fMuonCollID));
}
if(THC)
{
if (THC) {
int n_hit = THC->entries();
G4cout << " " << n_hit
<< " hits are stored in RE05TrackerHitsCollection." << G4endl;
G4cout << " " << n_hit << " hits are stored in RE05TrackerHitsCollection." << G4endl;
}
if(CHC)
{
if (CHC) {
int n_hit = CHC->entries();
G4cout << " " << n_hit
<< " hits are stored in RE05CalorimeterHitsCollection." << G4endl;
G4cout << " " << n_hit << " hits are stored in RE05CalorimeterHitsCollection." << 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;
for (int i = 0; i < n_hit; i++) {
totE += (*CHC)[i]->GetEdep();
}
G4cout << " Total energy deposition in calorimeter : " << totE / GeV << " (GeV)" << G4endl;
}
if(MHC)
{
if (MHC) {
int n_hit = MHC->entries();
G4cout << " " << n_hit
<< " hits are stored in RE05MuonHitsCollection." << G4endl;
G4cout << " " << n_hit << " hits are stored in RE05MuonHitsCollection." << G4endl;
}
}
@@ -29,34 +29,34 @@
//
#include "RE05Field.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05Field::RE05Field()
: G4MagneticField()
RE05Field::RE05Field() : G4MagneticField()
{
fBz = 3.0*tesla;
fRmax_sq = sqr(50.*cm);
fZmax = 100.*cm;
fBz = 3.0 * tesla;
fRmax_sq = sqr(50. * cm);
fZmax = 100. * cm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05Field::~RE05Field()
{}
RE05Field::~RE05Field() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05Field::GetFieldValue(const double Point[3],double *Bfield) const
void RE05Field::GetFieldValue(const double Point[3], double* Bfield) const
{
Bfield[0] = 0.;
Bfield[1] = 0.;
if(std::abs(Point[2])<fZmax && (sqr(Point[0])+sqr(Point[1]))<fRmax_sq)
{ Bfield[2] = fBz; }
else
{ Bfield[2] = 0.; }
if (std::abs(Point[2]) < fZmax && (sqr(Point[0]) + sqr(Point[1])) < fRmax_sq) {
Bfield[2] = fBz;
}
else {
Bfield[2] = 0.;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,32 +29,29 @@
//
#include "RE05MuonHit.hh"
#include "G4VVisManager.hh"
#include "G4AttCheck.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4UnitsTable.hh"
#include "G4AttValue.hh"
#include "G4AttDef.hh"
#include "G4AttCheck.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
G4ThreadLocal G4Allocator<RE05MuonHit>* RE05MuonHitAllocator=0;
G4ThreadLocal G4Allocator<RE05MuonHit>* RE05MuonHitAllocator = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05MuonHit::RE05MuonHit()
: G4VHit(),fEdep(0.),fPos()
{}
RE05MuonHit::RE05MuonHit() : G4VHit(), fEdep(0.), fPos() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05MuonHit::~RE05MuonHit()
{}
RE05MuonHit::~RE05MuonHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05MuonHit::RE05MuonHit(const RE05MuonHit &right)
: G4VHit()
RE05MuonHit::RE05MuonHit(const RE05MuonHit& right) : G4VHit()
{
fEdep = right.fEdep;
fPos = right.fPos;
@@ -62,7 +59,7 @@ RE05MuonHit::RE05MuonHit(const RE05MuonHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const RE05MuonHit& RE05MuonHit::operator=(const RE05MuonHit &right)
const RE05MuonHit& RE05MuonHit::operator=(const RE05MuonHit& right)
{
fEdep = right.fEdep;
fPos = right.fPos;
@@ -71,24 +68,23 @@ const RE05MuonHit& RE05MuonHit::operator=(const RE05MuonHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RE05MuonHit::operator==(const RE05MuonHit &right) const
G4bool RE05MuonHit::operator==(const RE05MuonHit& right) const
{
return (this==&right) ? true : false;
return (this == &right) ? true : false;
}
std::map<G4String,G4AttDef> RE05MuonHit::fAttDefs;
std::map<G4String, G4AttDef> RE05MuonHit::fAttDefs;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05MuonHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
if (pVVisManager) {
G4Circle circle(fPos);
circle.SetScreenSize(0.04);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4Colour colour(1., 0., 0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
@@ -97,12 +93,11 @@ void RE05MuonHit::Draw()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String,G4AttDef>* RE05MuonHit::GetAttDefs() const
const std::map<G4String, G4AttDef>* RE05MuonHit::GetAttDefs() const
{
// G4AttDefs have to have long life. Use static member...
if (fAttDefs.empty()) {
fAttDefs["HitType"] =
G4AttDef("HitType","Type of hit","Physics","","G4String");
fAttDefs["HitType"] = G4AttDef("HitType", "Type of hit", "Physics", "", "G4String");
}
return &fAttDefs;
}
@@ -113,15 +108,13 @@ std::vector<G4AttValue>* RE05MuonHit::CreateAttValues() const
{
// Create expendable G4AttsValues for picking...
std::vector<G4AttValue>* attValues = new std::vector<G4AttValue>;
attValues->push_back
(G4AttValue("HitType","RE05MuonHit",""));
//G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
attValues->push_back(G4AttValue("HitType", "RE05MuonHit", ""));
// G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
return attValues;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05MuonHit::Print()
{}
void RE05MuonHit::Print() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,90 +29,84 @@
//
#include "RE05MuonSD.hh"
#include "RE05MuonHit.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4SystemOfUnits.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05MuonSD::RE05MuonSD(G4String name)
:G4VSensitiveDetector(name),
fMuonCollection(0), fPositionResolution(0.)
: G4VSensitiveDetector(name), fMuonCollection(0), fPositionResolution(0.)
{
G4String HCname;
collectionName.insert(HCname="muonCollection");
fPositionResolution = 5*cm;
collectionName.insert(HCname = "muonCollection");
fPositionResolution = 5 * cm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05MuonSD::~RE05MuonSD()
{}
RE05MuonSD::~RE05MuonSD() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05MuonSD::Initialize(G4HCofThisEvent*HCE)
void RE05MuonSD::Initialize(G4HCofThisEvent* HCE)
{
static int HCID = -1;
fMuonCollection = new RE05MuonHitsCollection
(SensitiveDetectorName,collectionName[0]);
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection(HCID,fMuonCollection);
fMuonCollection = new RE05MuonHitsCollection(SensitiveDetectorName, collectionName[0]);
if (HCID < 0) {
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID, fMuonCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RE05MuonSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
G4bool RE05MuonSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return true;
if (edep == 0.) return true;
RE05MuonHit* aHit;
int nHit = fMuonCollection->entries();
G4ThreeVector hitpos = aStep->GetPreStepPoint()->GetPosition();
for(int i=0;i<nHit;i++)
{
for (int i = 0; i < nHit; i++) {
aHit = (*fMuonCollection)[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(fPositionResolution))
aHit->AddEdep(edep);
G4double dist2 =
sqr(pos.x() - hitpos.x()) + sqr(pos.y() - hitpos.y()) + sqr(pos.z() - hitpos.z());
if (dist2 <= sqr(fPositionResolution)) aHit->AddEdep(edep);
return true;
}
aHit = new RE05MuonHit();
aHit->SetEdep( edep );
aHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
fMuonCollection->insert( aHit );
aHit->SetEdep(edep);
aHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
fMuonCollection->insert(aHit);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05MuonSD::EndOfEvent(G4HCofThisEvent*)
{}
void RE05MuonSD::EndOfEvent(G4HCofThisEvent*) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05MuonSD::clear()
{}
void RE05MuonSD::clear() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05MuonSD::DrawAll()
{}
void RE05MuonSD::DrawAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05MuonSD::PrintAll()
{}
void RE05MuonSD::PrintAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,36 +29,34 @@
//
#include "RE05PrimaryGeneratorAction.hh"
#include "RE05PrimaryGeneratorMessenger.hh"
#include "G4AutoLock.hh"
#include "G4Event.hh"
#include "G4HEPEvtInterface.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "G4AutoLock.hh"
namespace {
G4Mutex RE05PrimGenDestrMutex = G4MUTEX_INITIALIZER;
G4Mutex RE05PrimGenMutex = G4MUTEX_INITIALIZER;
}
namespace
{
G4Mutex RE05PrimGenDestrMutex = G4MUTEX_INITIALIZER;
G4Mutex RE05PrimGenMutex = G4MUTEX_INITIALIZER;
} // namespace
G4VPrimaryGenerator* RE05PrimaryGeneratorAction::fHEPEvt = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05PrimaryGeneratorAction::RE05PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fMessenger(0),
fUseHEPEvt(false)
: G4VUserPrimaryGeneratorAction(), fParticleGun(0), fMessenger(0), fUseHEPEvt(false)
{
G4AutoLock lock(&RE05PrimGenDestrMutex);
if(!fHEPEvt)
{
if (!fHEPEvt) {
const char* filename = "pythia_event.data";
fHEPEvt = new G4HEPEvtInterface(filename,1);
fHEPEvt = new G4HEPEvtInterface(filename, 1);
}
lock.unlock();
@@ -66,12 +64,11 @@ RE05PrimaryGeneratorAction::RE05PrimaryGeneratorAction()
G4ParticleGun* particleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu+");
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "mu+");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
particleGun->SetParticleEnergy(100.*GeV);
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
particleGun->SetParticleMomentumDirection(G4ThreeVector(0., 1., 0.));
particleGun->SetParticleEnergy(100. * GeV);
particleGun->SetParticlePosition(G4ThreeVector(0. * cm, 0. * cm, 0. * cm));
fParticleGun = particleGun;
fMessenger = new RE05PrimaryGeneratorMessenger(this);
@@ -83,7 +80,10 @@ RE05PrimaryGeneratorAction::RE05PrimaryGeneratorAction()
RE05PrimaryGeneratorAction::~RE05PrimaryGeneratorAction()
{
G4AutoLock lock(&RE05PrimGenDestrMutex);
if(fHEPEvt) { delete fHEPEvt; fHEPEvt=0; }
if (fHEPEvt) {
delete fHEPEvt;
fHEPEvt = 0;
}
delete fParticleGun;
delete fMessenger;
}
@@ -92,13 +92,13 @@ RE05PrimaryGeneratorAction::~RE05PrimaryGeneratorAction()
void RE05PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
if(fUseHEPEvt)
{
if (fUseHEPEvt) {
G4AutoLock lock(&RE05PrimGenMutex);
fHEPEvt->GeneratePrimaryVertex(anEvent);
}
else
{ fParticleGun->GeneratePrimaryVertex(anEvent); }
else {
fParticleGun->GeneratePrimaryVertex(anEvent);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,24 +29,25 @@
//
#include "RE05PrimaryGeneratorMessenger.hh"
#include "RE05PrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIdirectory.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05PrimaryGeneratorMessenger::RE05PrimaryGeneratorMessenger(RE05PrimaryGeneratorAction * mpga)
: G4UImessenger(),
fMyAction(mpga), fMydetDirectory(0), fGenCmd(0)
RE05PrimaryGeneratorMessenger::RE05PrimaryGeneratorMessenger(RE05PrimaryGeneratorAction* mpga)
: G4UImessenger(), fMyAction(mpga), fMydetDirectory(0), fGenCmd(0)
{
fMydetDirectory = new G4UIdirectory("/mydet/");
fMydetDirectory->SetGuidance("RE05 detector control commands.");
fGenCmd = new G4UIcmdWithAString("/mydet/generator",this);
fGenCmd = new G4UIcmdWithAString("/mydet/generator", this);
fGenCmd->SetGuidance("Select primary generator.");
fGenCmd->SetGuidance(" Available generators : PYTHIA, particleGun");
fGenCmd->SetParameterName("generator",true);
fGenCmd->SetParameterName("generator", true);
fGenCmd->SetDefaultValue("PYTHIA");
fGenCmd->SetCandidates("PYTHIA particleGun");
}
@@ -61,26 +62,28 @@ RE05PrimaryGeneratorMessenger::~RE05PrimaryGeneratorMessenger()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
void RE05PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command==fGenCmd )
{ fMyAction->SetHEPEvtGenerator(newValue=="PYTHIA"); }
if (command == fGenCmd) {
fMyAction->SetHEPEvtGenerator(newValue == "PYTHIA");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String RE05PrimaryGeneratorMessenger::GetCurrentValue(G4UIcommand * command)
G4String RE05PrimaryGeneratorMessenger::GetCurrentValue(G4UIcommand* command)
{
G4String cv;
if( command==fGenCmd )
{
if(fMyAction->GetHEPEvtGenerator())
{ cv = "PYTHIA"; }
else
{ cv = "particleGun"; }
if (command == fGenCmd) {
if (fMyAction->GetHEPEvtGenerator()) {
cv = "PYTHIA";
}
else {
cv = "particleGun";
}
}
return cv;
}
@@ -38,22 +38,19 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05RunAction::RE05RunAction()
: G4UserRunAction()
{}
RE05RunAction::RE05RunAction() : G4UserRunAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05RunAction::~RE05RunAction()
{}
RE05RunAction::~RE05RunAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// G4RunManager::GetRunManager()->SetRandomNumberStore(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,98 +29,110 @@
//
#include "RE05StackingAction.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "RE05StackingActionMessenger.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "RE05StackingActionMessenger.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05StackingAction::RE05StackingAction()
: G4UserStackingAction(),
fTrkHits(0), fMuonHits(0), fMessenger(0),
fStage(0),
fReqMuon(2),
fReqIso(10),
fAngRoI(30.0*deg)
{
: G4UserStackingAction(),
fTrkHits(0),
fMuonHits(0),
fMessenger(0),
fStage(0),
fReqMuon(2),
fReqIso(10),
fAngRoI(30.0 * deg)
{
fMessenger = new RE05StackingActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05StackingAction::~RE05StackingAction()
{ delete fMessenger; }
{
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack
RE05StackingAction::ClassifyNewTrack(const G4Track * aTrack)
G4ClassificationOfNewTrack RE05StackingAction::ClassifyNewTrack(const G4Track* aTrack)
{
G4ClassificationOfNewTrack classification = fWaiting;
switch(fStage)
{
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;
switch (fStage) {
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)
{
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;
}
if((fAngRoI<0.)||InsideRoI(aTrack,fAngRoI))
{
classification = fUrgent;
break;
}
classification = fKill;
default: // Stage 2 : Accept all primaries
// Accept all secondaries in RoI
// Kill secondaries outside RoI
if (aTrack->GetParentID() == 0) {
classification = fUrgent;
break;
}
if ((fAngRoI < 0.) || InsideRoI(aTrack, fAngRoI)) {
classification = fUrgent;
break;
}
classification = fKill;
}
return classification;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RE05StackingAction::InsideRoI(const G4Track * aTrack,G4double ang)
G4bool RE05StackingAction::InsideRoI(const G4Track* aTrack, G4double ang)
{
if(!fMuonHits)
{ fMuonHits = (RE05MuonHitsCollection*)GetCollection("muonCollection"); }
if(!fMuonHits)
{ G4cerr << "muonCollection NOT FOUND" << G4endl;
return true; }
if (!fMuonHits) {
fMuonHits = (RE05MuonHitsCollection*)GetCollection("muonCollection");
}
if (!fMuonHits) {
G4cerr << "muonCollection NOT FOUND" << G4endl;
return true;
}
G4int nhits = fMuonHits->entries();
const G4ThreeVector trPos = aTrack->GetPosition();
for(G4int i=0;i<nhits;i++)
{
for (G4int i = 0; i < nhits; i++) {
G4ThreeVector muHitPos = (*fMuonHits)[i]->GetPos();
G4double angl = muHitPos.angle(trPos);
if(angl<ang) { return true; }
if (angl < ang) {
return true;
}
}
return false;
@@ -133,8 +145,7 @@ G4VHitsCollection* RE05StackingAction::GetCollection(G4String colName)
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
G4RunManager* runMan = G4RunManager::GetRunManager();
int colID = SDMan->GetCollectionID(colName);
if(colID>=0)
{
if (colID >= 0) {
const G4Event* currentEvent = runMan->GetCurrentEvent();
G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
return HCE->GetHC(colID);
@@ -148,78 +159,75 @@ void RE05StackingAction::NewStage()
{
fStage++;
G4int nhits;
if(fStage==1)
{
// Stage 0->1 : check if at least "fReqMuon" hits on muon chamber
// otherwise abort current event
if(!fMuonHits)
{ fMuonHits = (RE05MuonHitsCollection*)GetCollection("muonCollection"); }
if(!fMuonHits)
{ G4cerr << "muonCollection NOT FOUND" << G4endl;
return; }
if (fStage == 1) {
// Stage 0->1 : check if at least "fReqMuon" hits on muon chamber
// otherwise abort current event
if (!fMuonHits) {
fMuonHits = (RE05MuonHitsCollection*)GetCollection("muonCollection");
}
if (!fMuonHits) {
G4cerr << "muonCollection NOT FOUND" << G4endl;
return;
}
nhits = fMuonHits->entries();
//// G4cout << "Stage 0->1 : " << nhits << " hits found in the muon chamber."
//// << G4endl;
if(nhits<fReqMuon)
{
//// G4cout << "Stage 0->1 : " << nhits << " hits found in the muon chamber."
//// << G4endl;
if (nhits < fReqMuon) {
stackManager->clear();
//// G4cout << "++++++++ event aborted" << G4endl;
//// G4cout << "++++++++ event aborted" << G4endl;
return;
}
stackManager->ReClassify();
return;
}
else if(fStage==2)
{
// Stage 1->2 : check the isolation of muon tracks
// at least "fReqIsoMuon" isolated muons
// otherwise abort current event.
// Isolation requires "fReqIso" or less hits
// (including own hits) in the RoI region
// in the tracker layers.
else if (fStage == 2) {
// Stage 1->2 : check the isolation of muon tracks
// at least "fReqIsoMuon" isolated muons
// otherwise abort current event.
// Isolation requires "fReqIso" or less hits
// (including own hits) in the RoI region
// in the tracker layers.
nhits = fMuonHits->entries();
if(!fTrkHits)
{ fTrkHits = (RE05TrackerHitsCollection*)GetCollection("trackerCollection"); }
if(!fTrkHits)
{ G4cerr << "trackerCollection NOT FOUND" << G4endl;
return; }
if (!fTrkHits) {
fTrkHits = (RE05TrackerHitsCollection*)GetCollection("trackerCollection");
}
if (!fTrkHits) {
G4cerr << "trackerCollection NOT FOUND" << G4endl;
return;
}
G4int nTrkhits = fTrkHits->entries();
G4int isoMuon = 0;
for(G4int j=0;j<nhits;j++)
{
for (G4int j = 0; j < nhits; j++) {
G4ThreeVector hitPos = (*fMuonHits)[j]->GetPos();
G4int nhitIn = 0;
for(G4int jj=0;(jj<nTrkhits)&&(nhitIn<=fReqIso);jj++)
{
for (G4int jj = 0; (jj < nTrkhits) && (nhitIn <= fReqIso); jj++) {
G4ThreeVector trkhitPos = (*fTrkHits)[jj]->GetPos();
if(trkhitPos.angle(hitPos)<fAngRoI) nhitIn++;
if (trkhitPos.angle(hitPos) < fAngRoI) nhitIn++;
}
if(nhitIn<=fReqIso) isoMuon++;
if (nhitIn <= fReqIso) isoMuon++;
}
//// G4cout << "Stage 1->2 : " << isoMuon << " isolated muon found." << G4endl;
if(isoMuon<fReqIsoMuon)
{
//// G4cout << "Stage 1->2 : " << isoMuon << " isolated muon found." << G4endl;
if (isoMuon < fReqIsoMuon) {
stackManager->clear();
//// G4cout << "++++++++ event aborted" << G4endl;
//// G4cout << "++++++++ event aborted" << G4endl;
return;
}
stackManager->ReClassify();
return;
}
else
{
// Other fStage change : just re-classify
else {
// Other fStage change : just re-classify
stackManager->ReClassify();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05StackingAction::PrepareNewEvent()
{
fStage = 0;
{
fStage = 0;
fTrkHits = 0;
fMuonHits = 0;
}
@@ -29,40 +29,40 @@
//
#include "RE05StackingActionMessenger.hh"
#include "RE05StackingAction.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05StackingActionMessenger::RE05StackingActionMessenger(RE05StackingAction * msa)
: G4UImessenger(),
fMyAction(msa),
fMuonCmd(0), fIsoMuonCmd(0), fIsoCmd(0), fRoiCmd(0)
RE05StackingActionMessenger::RE05StackingActionMessenger(RE05StackingAction* msa)
: G4UImessenger(), fMyAction(msa), fMuonCmd(0), fIsoMuonCmd(0), fIsoCmd(0), fRoiCmd(0)
{
fMuonCmd = new G4UIcmdWithAnInteger("/mydet/reqmuon",this);
fMuonCmd = new G4UIcmdWithAnInteger("/mydet/reqmuon", this);
fMuonCmd->SetGuidance("Number of muon for the trigger.");
fMuonCmd->SetParameterName("N",true);
fMuonCmd->SetParameterName("N", true);
fMuonCmd->SetDefaultValue(2);
fMuonCmd->SetRange("N>=0");
fIsoMuonCmd = new G4UIcmdWithAnInteger("/mydet/isomuon",this);
fIsoMuonCmd = new G4UIcmdWithAnInteger("/mydet/isomuon", this);
fIsoMuonCmd->SetGuidance("Number of isolated muon for the trigger.");
fIsoMuonCmd->SetParameterName("N",true);
fIsoMuonCmd->SetParameterName("N", true);
fIsoMuonCmd->SetDefaultValue(2);
fIsoMuonCmd->SetRange("N>=0");
fIsoCmd = new G4UIcmdWithAnInteger("/mydet/isolation",this);
fIsoCmd = new G4UIcmdWithAnInteger("/mydet/isolation", this);
fIsoCmd->SetGuidance("Maximum allowed number of hits in tracker");
fIsoCmd->SetGuidance(" for an isolated muon track (includes hits by muon)");
fIsoCmd->SetParameterName("N",true);
fIsoCmd->SetParameterName("N", true);
fIsoCmd->SetDefaultValue(10);
fIsoCmd->SetRange("N>=0");
fRoiCmd = new G4UIcmdWithADoubleAndUnit("/mydet/RoIangle",this);
fRoiCmd = new G4UIcmdWithADoubleAndUnit("/mydet/RoIangle", this);
fRoiCmd->SetGuidance("Define RoI angle");
fRoiCmd->SetParameterName("theta",true,true);
fRoiCmd->SetParameterName("theta", true, true);
fRoiCmd->SetDefaultUnit("deg");
}
@@ -78,33 +78,41 @@ RE05StackingActionMessenger::~RE05StackingActionMessenger()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05StackingActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
void RE05StackingActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command==fMuonCmd )
{ fMyAction->SetNRequestMuon(fMuonCmd->GetNewIntValue(newValue)); }
else if( command==fIsoMuonCmd )
{ fMyAction->SetNRequestIsoMuon(fIsoMuonCmd->GetNewIntValue(newValue)); }
else if( command==fIsoCmd )
{ fMyAction->SetNIsolation(fIsoCmd->GetNewIntValue(newValue)); }
else if( command==fRoiCmd )
{ fMyAction->SetRoIAngle(fRoiCmd->GetNewDoubleValue(newValue)); }
if (command == fMuonCmd) {
fMyAction->SetNRequestMuon(fMuonCmd->GetNewIntValue(newValue));
}
else if (command == fIsoMuonCmd) {
fMyAction->SetNRequestIsoMuon(fIsoMuonCmd->GetNewIntValue(newValue));
}
else if (command == fIsoCmd) {
fMyAction->SetNIsolation(fIsoCmd->GetNewIntValue(newValue));
}
else if (command == fRoiCmd) {
fMyAction->SetRoIAngle(fRoiCmd->GetNewDoubleValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String RE05StackingActionMessenger::GetCurrentValue(G4UIcommand * command)
G4String RE05StackingActionMessenger::GetCurrentValue(G4UIcommand* command)
{
G4String cv;
if( command==fMuonCmd )
{ cv = fMuonCmd->ConvertToString(fMyAction->GetNRequestMuon()); }
else if( command==fIsoMuonCmd )
{ cv = fIsoMuonCmd->ConvertToString(fMyAction->GetNRequestIsoMuon()); }
else if( command==fIsoCmd )
{ cv = fIsoCmd->ConvertToString(fMyAction->GetNIsolation()); }
else if( command==fRoiCmd )
{ cv = fRoiCmd->ConvertToString(fMyAction->GetRoIAngle(),"deg"); }
if (command == fMuonCmd) {
cv = fMuonCmd->ConvertToString(fMyAction->GetNRequestMuon());
}
else if (command == fIsoMuonCmd) {
cv = fIsoMuonCmd->ConvertToString(fMyAction->GetNRequestIsoMuon());
}
else if (command == fIsoCmd) {
cv = fIsoCmd->ConvertToString(fMyAction->GetNIsolation());
}
else if (command == fRoiCmd) {
cv = fRoiCmd->ConvertToString(fMyAction->GetRoIAngle(), "deg");
}
return cv;
}
@@ -29,53 +29,61 @@
//
#include "RE05SteppingAction.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"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05SteppingAction::RE05SteppingAction()
: G4UserSteppingAction()
{}
RE05SteppingAction::RE05SteppingAction() : G4UserSteppingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05SteppingAction::~RE05SteppingAction()
{}
RE05SteppingAction::~RE05SteppingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05SteppingAction::UserSteppingAction(const G4Step * theStep)
void RE05SteppingAction::UserSteppingAction(const G4Step* theStep)
{
G4Track * theTrack = theStep->GetTrack();
G4Track* theTrack = theStep->GetTrack();
// check if it is alive
if(theTrack->GetTrackStatus()!=fAlive) { return; }
if (theTrack->GetTrackStatus() != fAlive) {
return;
}
// check if it is primary
if(theTrack->GetParentID()!=0) { return; }
if (theTrack->GetParentID() != 0) {
return;
}
// check if it is NOT muon
G4ParticleDefinition * particleType = theTrack->GetDefinition();
if((particleType==G4MuonPlus::MuonPlusDefinition())
||(particleType==G4MuonMinus::MuonMinusDefinition()))
{ return; }
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();
G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();
G4String thePrePVname = thePrePV->GetName();
if(thePrePVname.substr(0,4)=="calo") { return; }
G4StepPoint * thePostPoint = theStep->GetPostStepPoint();
G4VPhysicalVolume * thePostPV = thePostPoint->GetPhysicalVolume();
if (thePrePVname.substr(0, 4) == "calo") {
return;
}
G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
G4String thePostPVname = thePostPV->GetName();
if(thePostPVname.substr(0,4)!="calo") { return; }
if (thePostPVname.substr(0, 4) != "calo") {
return;
}
// then suspend the track
theTrack->SetTrackStatus(fSuspend);
@@ -38,104 +38,87 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05SteppingVerbose::RE05SteppingVerbose()
: G4SteppingVerbose()
{}
RE05SteppingVerbose::RE05SteppingVerbose() : G4SteppingVerbose() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05SteppingVerbose::~RE05SteppingVerbose()
{}
RE05SteppingVerbose::~RE05SteppingVerbose() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05SteppingVerbose::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;
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")
<< " ";
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 ) {
// if( fStepStatus != fWorldBoundary){
if (fTrack->GetNextVolume() != 0) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
}
else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
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){
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()
<< " ---------------"
<< "#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)
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;
<< "-- EndOf2ndaries Info ---------------" << G4endl;
}
}
}
G4cout.precision(prec);
}
@@ -144,38 +127,35 @@ void RE05SteppingVerbose::StepInfo()
void RE05SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
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) << "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") << " ";
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()){
if (fTrack->GetNextVolume()) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
}
else {
G4cout << std::setw(10) << "OutOfWorld";
}
G4cout << " initStep" << G4endl;
G4cout << " initStep" << G4endl;
}
G4cout.precision(prec);
}
@@ -29,34 +29,30 @@
//
#include "RE05TrackerHit.hh"
#include "G4VVisManager.hh"
#include "G4AttCheck.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4UnitsTable.hh"
#include "G4AttValue.hh"
#include "G4AttDef.hh"
#include "G4AttCheck.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
G4ThreadLocal G4Allocator<RE05TrackerHit>* RE05TrackerHitAllocator=0;
std::map<G4String,G4AttDef> RE05TrackerHit::fAttDefs;
G4ThreadLocal G4Allocator<RE05TrackerHit>* RE05TrackerHitAllocator = 0;
std::map<G4String, G4AttDef> RE05TrackerHit::fAttDefs;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05TrackerHit::RE05TrackerHit()
: G4VHit(),
fEdep(0.),fPos()
{}
RE05TrackerHit::RE05TrackerHit() : G4VHit(), fEdep(0.), fPos() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05TrackerHit::~RE05TrackerHit()
{}
RE05TrackerHit::~RE05TrackerHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05TrackerHit::RE05TrackerHit(const RE05TrackerHit &right)
: G4VHit()
RE05TrackerHit::RE05TrackerHit(const RE05TrackerHit& right) : G4VHit()
{
fEdep = right.fEdep;
fPos = right.fPos;
@@ -64,7 +60,7 @@ RE05TrackerHit::RE05TrackerHit(const RE05TrackerHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const RE05TrackerHit& RE05TrackerHit::operator=(const RE05TrackerHit &right)
const RE05TrackerHit& RE05TrackerHit::operator=(const RE05TrackerHit& right)
{
fEdep = right.fEdep;
fPos = right.fPos;
@@ -73,9 +69,9 @@ const RE05TrackerHit& RE05TrackerHit::operator=(const RE05TrackerHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RE05TrackerHit::operator==(const RE05TrackerHit &right) const
G4bool RE05TrackerHit::operator==(const RE05TrackerHit& right) const
{
return (this==&right) ? true : false;
return (this == &right) ? true : false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -83,12 +79,11 @@ G4bool RE05TrackerHit::operator==(const RE05TrackerHit &right) const
void RE05TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
if (pVVisManager) {
G4Circle circle(fPos);
circle.SetScreenSize(0.04);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4Colour colour(1., 0., 0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
@@ -97,12 +92,11 @@ void RE05TrackerHit::Draw()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String,G4AttDef>* RE05TrackerHit::GetAttDefs() const
const std::map<G4String, G4AttDef>* RE05TrackerHit::GetAttDefs() const
{
// G4AttDefs have to have long life. Use static member...
if (fAttDefs.empty()) {
fAttDefs["HitType"] =
G4AttDef("HitType","Type of hit","Physics","","G4String");
fAttDefs["HitType"] = G4AttDef("HitType", "Type of hit", "Physics", "", "G4String");
}
return &fAttDefs;
}
@@ -113,16 +107,13 @@ std::vector<G4AttValue>* RE05TrackerHit::CreateAttValues() const
{
// Create expendable G4AttsValues for picking...
std::vector<G4AttValue>* attValues = new std::vector<G4AttValue>;
attValues->push_back
(G4AttValue("HitType","RE05TrackerHit",""));
//G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
attValues->push_back(G4AttValue("HitType", "RE05TrackerHit", ""));
// G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
return attValues;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerHit::Print()
{}
void RE05TrackerHit::Print() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -30,30 +30,26 @@
#include "RE05TrackerParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05TrackerParametrisation::RE05TrackerParametrisation()
: G4VPVParameterisation()
RE05TrackerParametrisation::RE05TrackerParametrisation() : G4VPVParameterisation()
{
#include "RE05DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05TrackerParametrisation::~RE05TrackerParametrisation()
{}
RE05TrackerParametrisation::~RE05TrackerParametrisation() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerParametrisation::ComputeTransformation
(const G4int, G4VPhysicalVolume* physVol) const
void RE05TrackerParametrisation::ComputeTransformation(const G4int,
G4VPhysicalVolume* physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
@@ -61,13 +57,13 @@ void RE05TrackerParametrisation::ComputeTransformation
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerParametrisation::ComputeDimensions
(G4Tubs& trackerLayer, const G4int copyNo, const G4VPhysicalVolume*) const
void RE05TrackerParametrisation::ComputeDimensions(G4Tubs& trackerLayer, const G4int copyNo,
const G4VPhysicalVolume*) const
{
trackerLayer.SetInnerRadius(fTracker_radius[copyNo]);
trackerLayer.SetOuterRadius(fTracker_radius[copyNo]+fTracker_thick);
trackerLayer.SetOuterRadius(fTracker_radius[copyNo] + fTracker_thick);
trackerLayer.SetZHalfLength(fTracker_length[copyNo]);
trackerLayer.SetStartPhiAngle(fTrkTubs_sphi,false);
trackerLayer.SetStartPhiAngle(fTrkTubs_sphi, false);
trackerLayer.SetDeltaPhiAngle(fTrkTubs_dphi);
}
@@ -29,37 +29,36 @@
//
#include "RE05TrackerSD.hh"
#include "RE05TrackerHit.hh"
#include "G4Step.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05TrackerSD::RE05TrackerSD(G4String name)
: G4VSensitiveDetector(name),
fTrackerCollection(0)
RE05TrackerSD::RE05TrackerSD(G4String name) : G4VSensitiveDetector(name), fTrackerCollection(0)
{
G4String HCname;
collectionName.insert(HCname="trackerCollection");
collectionName.insert(HCname = "trackerCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05TrackerSD::~RE05TrackerSD()
{}
RE05TrackerSD::~RE05TrackerSD() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerSD::Initialize(G4HCofThisEvent* HCE)
{
static int HCID = -1;
fTrackerCollection = new RE05TrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection(HCID,fTrackerCollection);
fTrackerCollection = new RE05TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
if (HCID < 0) {
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID, fTrackerCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -67,34 +66,30 @@ void RE05TrackerSD::Initialize(G4HCofThisEvent* HCE)
G4bool RE05TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false;
if (edep == 0.) return false;
RE05TrackerHit* newHit = new RE05TrackerHit();
newHit->SetEdep( edep );
newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
fTrackerCollection->insert( newHit );
newHit->SetEdep(edep);
newHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
fTrackerCollection->insert(newHit);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerSD::EndOfEvent(G4HCofThisEvent*)
{}
void RE05TrackerSD::EndOfEvent(G4HCofThisEvent*) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerSD::clear()
{}
void RE05TrackerSD::clear() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerSD::DrawAll()
{}
void RE05TrackerSD::DrawAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackerSD::PrintAll()
{}
void RE05TrackerSD::PrintAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,18 +29,21 @@
//
#include "RE05TrackingAction.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4TrackingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
{
// Create trajectory only for primaries
if(aTrack->GetParentID()==0)
{ fpTrackingManager->SetStoreTrajectory(true); }
else
{ fpTrackingManager->SetStoreTrajectory(false); }
if (aTrack->GetParentID() == 0) {
fpTrackingManager->SetStoreTrajectory(true);
}
else {
fpTrackingManager->SetStoreTrajectory(false);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......