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
+18 -27
View File
@@ -38,27 +38,25 @@
//
// --------------------------------------------------------------
#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "RE01DetectorConstruction.hh"
#include "RE01CalorimeterROGeometry.hh"
#include "QGSP_BERT.hh"
#include "G4UnknownDecayPhysics.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE01ActionInitialization.hh"
#include "RE01CalorimeterROGeometry.hh"
#include "RE01DetectorConstruction.hh"
#include "G4VisExecutive.hh"
#include "G4ParallelWorldPhysics.hh"
#include "G4RunManagerFactory.hh"
#include "G4Types.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4UnknownDecayPhysics.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 ) {
ui = new G4UIExecutive(argc, argv);
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
auto* runManager = G4RunManagerFactory::CreateRunManager();
@@ -68,34 +66,28 @@ int main(int argc,char** argv)
visManager->Initialize();
G4String parallelWorldName = "ReadoutWorld";
G4VUserDetectorConstruction* detector
= new RE01DetectorConstruction();
detector->RegisterParallelWorld(
new RE01CalorimeterROGeometry(parallelWorldName));
G4VUserDetectorConstruction* detector = new RE01DetectorConstruction();
detector->RegisterParallelWorld(new RE01CalorimeterROGeometry(parallelWorldName));
runManager->SetUserInitialization(detector);
G4VModularPhysicsList* physicsList = new QGSP_BERT;
physicsList->RegisterPhysics(new G4UnknownDecayPhysics);
physicsList->RegisterPhysics(
new G4ParallelWorldPhysics(parallelWorldName));
physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
runManager->SetUserInitialization(physicsList);
runManager->SetUserInitialization(
new RE01ActionInitialization);
runManager->SetUserInitialization(new RE01ActionInitialization);
runManager->Initialize();
if(ui)
{
if (ui) {
ui->SessionStart();
delete ui;
}
else
{
else {
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command + fileName);
}
delete visManager;
@@ -104,4 +96,3 @@ int main(int argc,char** argv)
return 0;
}
@@ -31,21 +31,20 @@
#ifndef RE01ActionInitialization_H
#define RE01ActionInitialization_H 1
#include "globals.hh"
#include "G4VUserActionInitialization.hh"
#include "globals.hh"
class RE01ActionInitialization : public G4VUserActionInitialization
{
public:
RE01ActionInitialization();
RE01ActionInitialization();
virtual ~RE01ActionInitialization();
virtual void Build() const;
virtual void BuildForMaster() const;
private:
//G4bool m_bParallelWorld;
private:
// G4bool m_bParallelWorld;
};
#endif
@@ -31,87 +31,87 @@
#ifndef RE01CalorimeterHit_h
#define RE01CalorimeterHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "RE01TrackInformation.hh"
#include "G4Allocator.hh"
#include "G4LogicalVolume.hh"
#include "G4RotationMatrix.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4Types.hh"
#include "G4VHit.hh"
class G4AttDef;
class G4AttValue;
class RE01CalorimeterHit : public G4VHit
{
public:
RE01CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi);
virtual ~RE01CalorimeterHit();
inline void *operator new(size_t);
inline void operator delete(void *aHit);
public:
RE01CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi);
virtual ~RE01CalorimeterHit();
virtual void Draw();
virtual void Print();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
inline void* operator new(size_t);
inline void operator delete(void* aHit);
inline G4int GetZ() { return fZCellID; }
inline G4int GetPhi() { return fPhiCellID; }
inline void SetEdep(G4double de)
{ fEdep = de; fEdepByATrack = de; }
inline void AddEdep(G4double de)
{ fEdep += de; fEdepByATrack += de; }
inline G4double GetEdep()
{ return fEdep; }
inline G4double GetEdepByATrack()
{ return fEdepByATrack; }
inline void ClearEdepByATrack()
{ fEdepByATrack = 0.; fTrackInfo = RE01TrackInformation(); }
inline void SetPos(G4ThreeVector xyz)
{ fPos = xyz; }
inline void SetRot(G4RotationMatrix rmat)
{ fRot = rmat; }
inline void SetTrackInformation(const G4Track* aTrack)
{
RE01TrackInformation* anInfo =
(RE01TrackInformation*)(aTrack->GetUserInformation());
fTrackInfo = *anInfo;
}
inline RE01TrackInformation* GetTrackInformation()
{ return &fTrackInfo; }
virtual void Draw();
virtual void Print();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
private:
G4int fZCellID;
G4int fPhiCellID;
G4double fEdep;
G4ThreeVector fPos;
G4RotationMatrix fRot;
const G4LogicalVolume* fPLogV;
G4double fEdepByATrack;
RE01TrackInformation fTrackInfo;
inline G4int GetZ() { return fZCellID; }
inline G4int GetPhi() { return fPhiCellID; }
inline void SetEdep(G4double de)
{
fEdep = de;
fEdepByATrack = de;
}
inline void AddEdep(G4double de)
{
fEdep += de;
fEdepByATrack += de;
}
inline G4double GetEdep() { return fEdep; }
inline G4double GetEdepByATrack() { return fEdepByATrack; }
inline void ClearEdepByATrack()
{
fEdepByATrack = 0.;
fTrackInfo = RE01TrackInformation();
}
inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
inline void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
inline void SetTrackInformation(const G4Track* aTrack)
{
RE01TrackInformation* anInfo = (RE01TrackInformation*)(aTrack->GetUserInformation());
fTrackInfo = *anInfo;
}
inline RE01TrackInformation* GetTrackInformation() { return &fTrackInfo; }
private:
G4int fZCellID;
G4int fPhiCellID;
G4double fEdep;
G4ThreeVector fPos;
G4RotationMatrix fRot;
const G4LogicalVolume* fPLogV;
G4double fEdepByATrack;
RE01TrackInformation fTrackInfo;
};
typedef G4THitsCollection<RE01CalorimeterHit> RE01CalorimeterHitsCollection;
extern G4ThreadLocal G4Allocator<RE01CalorimeterHit> * RE01CalorimeterHitAllocator;
extern G4ThreadLocal G4Allocator<RE01CalorimeterHit>* RE01CalorimeterHitAllocator;
inline void* RE01CalorimeterHit::operator new(size_t)
{
if(!RE01CalorimeterHitAllocator)
if (!RE01CalorimeterHitAllocator)
RE01CalorimeterHitAllocator = new G4Allocator<RE01CalorimeterHit>;
return (void *) RE01CalorimeterHitAllocator->MallocSingle();
return (void*)RE01CalorimeterHitAllocator->MallocSingle();
}
inline void RE01CalorimeterHit::operator delete(void *aHit)
inline void RE01CalorimeterHit::operator delete(void* aHit)
{
RE01CalorimeterHitAllocator->FreeSingle((RE01CalorimeterHit*) aHit);
RE01CalorimeterHitAllocator->FreeSingle((RE01CalorimeterHit*)aHit);
}
#endif
@@ -31,8 +31,8 @@
#ifndef RE01CalorimeterParametrisation_H
#define RE01CalorimeterParametrisation_H 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
#include "globals.hh"
class G4VPhysicalVolume;
class G4Tubs;
@@ -52,47 +52,31 @@ class G4Polycone;
class G4Polyhedra;
class RE01CalorimeterParametrisation : public G4VPVParameterisation
{
public:
RE01CalorimeterParametrisation();
~RE01CalorimeterParametrisation();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
void ComputeDimensions(G4Tubs & calorimeterLayer,
const G4int copyNo,
const G4VPhysicalVolume * physVol) const;
{
public:
RE01CalorimeterParametrisation();
~RE01CalorimeterParametrisation();
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions(G4Trd&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Trap&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Cons&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Sphere&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Ellipsoid&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Torus&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Para&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Hype&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Box&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Orb&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Polycone&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Polyhedra&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const;
void ComputeDimensions(G4Tubs& calorimeterLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private:
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions(G4Trd&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Trap&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Cons&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Sphere&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Ellipsoid&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Torus&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Para&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Hype&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Box&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Orb&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polycone&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polyhedra&, const G4int, const G4VPhysicalVolume*) const {}
private:
#include "RE01DetectorParameterDef.hh"
};
#endif
@@ -35,17 +35,16 @@
class RE01CalorimeterROGeometry : public G4VUserParallelWorld
{
public:
RE01CalorimeterROGeometry(G4String&);
virtual ~RE01CalorimeterROGeometry();
public:
RE01CalorimeterROGeometry(G4String&);
virtual ~RE01CalorimeterROGeometry();
protected:
virtual void Construct();
virtual void ConstructSD();
protected:
virtual void Construct();
virtual void ConstructSD();
private:
private:
#include "RE01DetectorParameterDef.hh"
};
#endif
@@ -31,31 +31,29 @@
#ifndef RE01CalorimeterSD_h
#define RE01CalorimeterSD_h 1
#include "G4VSensitiveDetector.hh"
#include "RE01CalorimeterHit.hh"
#include "G4VSensitiveDetector.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class RE01CalorimeterSD : public G4VSensitiveDetector
{
public:
RE01CalorimeterSD(G4String name);
virtual ~RE01CalorimeterSD();
public:
RE01CalorimeterSD(G4String name);
virtual ~RE01CalorimeterSD();
virtual void Initialize(G4HCofThisEvent*HCE);
virtual void Initialize(G4HCofThisEvent* HCE);
protected:
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
private:
RE01CalorimeterHitsCollection *fCalCollection;
int fCellID[20][48];
const int fNumberOfCellsInZ;
const int fNumberOfCellsInPhi;
protected:
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
private:
RE01CalorimeterHitsCollection* fCalCollection;
int fCellID[20][48];
const int fNumberOfCellsInZ;
const int fNumberOfCellsInPhi;
};
#endif
@@ -39,20 +39,19 @@ class G4LogicalVolume;
class RE01DetectorConstruction : public G4VUserDetectorConstruction
{
public:
RE01DetectorConstruction();
virtual ~RE01DetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
private:
public:
RE01DetectorConstruction();
virtual ~RE01DetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
private:
#include "RE01DetectorParameterDef.hh"
G4LogicalVolume * fTrackerLayer_log;
G4LogicalVolume * fCalorimeter_log;
G4LogicalVolume* fTrackerLayer_log;
G4LogicalVolume* fCalorimeter_log;
};
#endif
@@ -28,41 +28,41 @@
//
//
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;
@@ -38,21 +38,19 @@ class G4PrimaryParticle;
class RE01EventAction : public G4UserEventAction
{
public:
RE01EventAction();//G4bool);
virtual ~RE01EventAction();
public:
RE01EventAction(); // G4bool);
virtual ~RE01EventAction();
public:
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
public:
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
private:
G4int fTrackerCollID;
G4int fCalorimeterCollID;
void PrintPrimary(G4PrimaryParticle* pp,G4int ind);
private:
G4int fTrackerCollID;
G4int fCalorimeterCollID;
void PrintPrimary(G4PrimaryParticle* pp, G4int ind);
};
#endif
@@ -31,23 +31,21 @@
#ifndef RE01Field_H
#define RE01Field_H 1
#include "globals.hh"
#include "G4MagneticField.hh"
#include "globals.hh"
class RE01Field : public G4MagneticField
{
public:
RE01Field();
virtual ~RE01Field();
virtual void GetFieldValue( const double point[3],
double *bfield ) const;
private:
G4double fBz;
G4double fRmax_sq;
G4double fZmax;
public:
RE01Field();
virtual ~RE01Field();
virtual void GetFieldValue(const double point[3], double* bfield) const;
private:
G4double fBz;
G4double fRmax_sq;
G4double fZmax;
};
#endif
@@ -38,27 +38,22 @@ class G4VPrimaryGenerator;
class G4Event;
class RE01PrimaryGeneratorMessenger;
class RE01PrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction
class RE01PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
RE01PrimaryGeneratorAction();
virtual ~RE01PrimaryGeneratorAction();
public:
RE01PrimaryGeneratorAction();
virtual ~RE01PrimaryGeneratorAction();
public:
virtual void GeneratePrimaries(G4Event* anEvent);
inline void SetHEPEvtGenerator(G4bool f)
{ fUseHEPEvt = f; }
inline G4bool GetHEPEvtGenerator()
{ return fUseHEPEvt; }
private:
G4VPrimaryGenerator* fHEPEvt;
G4VPrimaryGenerator* fParticleGun;
RE01PrimaryGeneratorMessenger* fMessenger;
G4bool fUseHEPEvt;
public:
virtual void GeneratePrimaries(G4Event* anEvent);
inline void SetHEPEvtGenerator(G4bool f) { fUseHEPEvt = f; }
inline G4bool GetHEPEvtGenerator() { return fUseHEPEvt; }
private:
G4VPrimaryGenerator* fHEPEvt;
G4VPrimaryGenerator* fParticleGun;
RE01PrimaryGeneratorMessenger* fMessenger;
G4bool fUseHEPEvt;
};
#endif
@@ -38,25 +38,22 @@ class RE01PrimaryGeneratorAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class RE01PrimaryGeneratorMessenger: public G4UImessenger
class RE01PrimaryGeneratorMessenger : public G4UImessenger
{
public:
RE01PrimaryGeneratorMessenger(RE01PrimaryGeneratorAction* mpga);
virtual ~RE01PrimaryGeneratorMessenger();
public:
RE01PrimaryGeneratorMessenger(RE01PrimaryGeneratorAction* mpga);
virtual ~RE01PrimaryGeneratorMessenger();
public:
virtual void SetNewValue(G4UIcommand * command,G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand * command);
public:
virtual void SetNewValue(G4UIcommand* command, G4String newValues);
virtual G4String GetCurrentValue(G4UIcommand* command);
private:
RE01PrimaryGeneratorAction * fMyAction;
private: //commands
G4UIdirectory * fMydetDirectory;
G4UIcmdWithAString * fGenCmd;
private:
RE01PrimaryGeneratorAction* fMyAction;
private: // commands
G4UIdirectory* fMydetDirectory;
G4UIcmdWithAString* fGenCmd;
};
#endif
@@ -32,26 +32,25 @@
#ifndef RE01RegionInformation_H
#define RE01RegionInformation_H 1
#include "globals.hh"
#include "G4VUserRegionInformation.hh"
#include "globals.hh"
class RE01RegionInformation : public G4VUserRegionInformation
{
public:
RE01RegionInformation();
virtual ~RE01RegionInformation();
virtual void Print() const;
public:
RE01RegionInformation();
virtual ~RE01RegionInformation();
virtual void Print() const;
inline void SetWorld(G4bool v=true) {fIsWorld = v;}
inline void SetTracker(G4bool v=true) {fIsTracker = v;}
inline void SetCalorimeter(G4bool v=true) {fIsCalorimeter = v;}
inline G4bool IsCalorimeter() const {return fIsCalorimeter;}
inline void SetWorld(G4bool v = true) { fIsWorld = v; }
inline void SetTracker(G4bool v = true) { fIsTracker = v; }
inline void SetCalorimeter(G4bool v = true) { fIsCalorimeter = v; }
inline G4bool IsCalorimeter() const { return fIsCalorimeter; }
private:
G4bool fIsWorld;
G4bool fIsTracker;
G4bool fIsCalorimeter;
private:
G4bool fIsWorld;
G4bool fIsTracker;
G4bool fIsCalorimeter;
};
#endif
@@ -27,7 +27,7 @@
/// \brief Definition of the RE01RunAction class
//
//
//
//
#ifndef RE01RunAction_h
#define RE01RunAction_h 1
@@ -39,18 +39,13 @@ class G4Run;
class RE01RunAction : public G4UserRunAction
{
public:
RE01RunAction();
virtual ~RE01RunAction();
public:
RE01RunAction();
virtual ~RE01RunAction();
public:
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
public:
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
};
#endif
@@ -31,29 +31,28 @@
#ifndef RE01StackingAction_H
#define RE01StackingAction_H 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
#include "globals.hh"
class G4Track;
class G4VHitsCollection;
class RE01StackingAction : public G4UserStackingAction
{
public:
RE01StackingAction();
virtual ~RE01StackingAction();
public:
RE01StackingAction();
virtual ~RE01StackingAction();
public:
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
public:
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
private:
G4VHitsCollection* GetCalCollection();
G4int fStage;
G4int fCalorimeterHitsColID;
private:
G4VHitsCollection* GetCalCollection();
G4int fStage;
G4int fCalorimeterHitsColID;
};
#endif
@@ -31,17 +31,16 @@
#ifndef RE01SteppingAction_H
#define RE01SteppingAction_H 1
#include "globals.hh"
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class RE01SteppingAction : public G4UserSteppingAction
{
public:
RE01SteppingAction();
virtual ~RE01SteppingAction();
virtual void UserSteppingAction(const G4Step*);
public:
RE01SteppingAction();
virtual ~RE01SteppingAction();
virtual void UserSteppingAction(const G4Step*);
};
#endif
@@ -32,76 +32,76 @@
#ifndef RE01TrackInformation_h
#define RE01TrackInformation_h 1
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleDefinition.hh"
#include "G4Track.hh"
#include "G4Allocator.hh"
#include "G4ParticleDefinition.hh"
#include "G4ThreeVector.hh"
#include "G4Track.hh"
#include "G4VUserTrackInformation.hh"
#include "globals.hh"
class RE01TrackInformation : public G4VUserTrackInformation
class RE01TrackInformation : public G4VUserTrackInformation
{
public:
RE01TrackInformation();
RE01TrackInformation(const G4Track* aTrack);
RE01TrackInformation(const RE01TrackInformation* aTrackInfo);
virtual ~RE01TrackInformation();
inline void *operator new(size_t);
inline void operator delete(void *aTrackInfo);
public:
RE01TrackInformation();
RE01TrackInformation(const G4Track* aTrack);
RE01TrackInformation(const RE01TrackInformation* aTrackInfo);
virtual ~RE01TrackInformation();
RE01TrackInformation& operator =(const RE01TrackInformation& right);
void SetSourceTrackInformation(const G4Track* aTrack);
virtual void Print() const;
inline void* operator new(size_t);
inline void operator delete(void* aTrackInfo);
public:
inline G4int GetTrackingStatus() const {return fTrackingStatus;}
inline void SetTrackingStatus(G4int i) {fTrackingStatus = i;}
inline G4int GetSourceTrackID() const {return fSourceTrackID;}
inline void SetSuspendedStepID(G4int i) {fSuspendedStepID = i;}
inline G4int GetSuspendedStepID() const {return fSuspendedStepID;}
RE01TrackInformation& operator=(const RE01TrackInformation& right);
private:
// Information of the primary track at the primary vertex
G4int fOriginalTrackID; // Track ID of primary particle
G4ParticleDefinition* fParticleDefinition;
G4ThreeVector fOriginalPosition;
G4ThreeVector fOriginalMomentum;
G4double fOriginalEnergy;
G4double fOriginalTime;
void SetSourceTrackInformation(const G4Track* aTrack);
virtual void Print() const;
G4int fTrackingStatus;
// trackingStatus = 1 : primary or secondary track which has not yet reached
// to calorimeter
// = 0 : track which or ancester of which has reached to
// calorimeter
// = 2 : track or its ancester had reached to calorimeter
// and then escaped from it
// Information of the track which reached to the calorimeter boundary at the
// boundary surface.
// This information is valid only for trackingStatus = 0 or 2
G4int fSourceTrackID;
G4ParticleDefinition* fSourceDefinition;
G4ThreeVector fSourcePosition;
G4ThreeVector fSourceMomentum;
G4double fSourceEnergy;
G4double fSourceTime;
G4int fSuspendedStepID;
public:
inline G4int GetTrackingStatus() const { return fTrackingStatus; }
inline void SetTrackingStatus(G4int i) { fTrackingStatus = i; }
inline G4int GetSourceTrackID() const { return fSourceTrackID; }
inline void SetSuspendedStepID(G4int i) { fSuspendedStepID = i; }
inline G4int GetSuspendedStepID() const { return fSuspendedStepID; }
private:
// Information of the primary track at the primary vertex
G4int fOriginalTrackID; // Track ID of primary particle
G4ParticleDefinition* fParticleDefinition;
G4ThreeVector fOriginalPosition;
G4ThreeVector fOriginalMomentum;
G4double fOriginalEnergy;
G4double fOriginalTime;
G4int fTrackingStatus;
// trackingStatus = 1 : primary or secondary track which has not yet reached
// to calorimeter
// = 0 : track which or ancester of which has reached to
// calorimeter
// = 2 : track or its ancester had reached to calorimeter
// and then escaped from it
// Information of the track which reached to the calorimeter boundary at the
// boundary surface.
// This information is valid only for trackingStatus = 0 or 2
G4int fSourceTrackID;
G4ParticleDefinition* fSourceDefinition;
G4ThreeVector fSourcePosition;
G4ThreeVector fSourceMomentum;
G4double fSourceEnergy;
G4double fSourceTime;
G4int fSuspendedStepID;
};
extern G4ThreadLocal
G4Allocator<RE01TrackInformation> * aTrackInformationAllocator;
extern G4ThreadLocal G4Allocator<RE01TrackInformation>* aTrackInformationAllocator;
inline void* RE01TrackInformation::operator new(size_t)
{
if(!aTrackInformationAllocator)
if (!aTrackInformationAllocator)
aTrackInformationAllocator = new G4Allocator<RE01TrackInformation>;
return (void*)aTrackInformationAllocator->MallocSingle();
}
inline void RE01TrackInformation::operator delete(void *aTrackInfo)
{ aTrackInformationAllocator->FreeSingle((RE01TrackInformation*)aTrackInfo);}
inline void RE01TrackInformation::operator delete(void* aTrackInfo)
{
aTrackInformationAllocator->FreeSingle((RE01TrackInformation*)aTrackInfo);
}
#endif
@@ -31,63 +31,55 @@
#ifndef RE01TrackerHit_h
#define RE01TrackerHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4Types.hh"
#include "G4VHit.hh"
class G4AttDef;
class G4AttValue;
class RE01TrackerHit : public G4VHit
{
public:
public:
RE01TrackerHit();
virtual ~RE01TrackerHit();
RE01TrackerHit();
virtual ~RE01TrackerHit();
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual void Print();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
inline void* operator new(size_t);
inline void operator delete(void* aHit);
public:
inline void SetEdep(G4double de)
{ fEdep = de; }
inline G4double GetEdep() const
{ return fEdep; }
inline void SetPos(G4ThreeVector xyz)
{ fPos = xyz; }
inline void SetTrackID(G4int i)
{ fTrackID = i; }
inline G4int GetTrackID() const
{ return fTrackID; }
virtual void Draw();
virtual void Print();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
private:
G4double fEdep;
G4ThreeVector fPos;
G4int fTrackID;
public:
inline void SetEdep(G4double de) { fEdep = de; }
inline G4double GetEdep() const { return fEdep; }
inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
inline void SetTrackID(G4int i) { fTrackID = i; }
inline G4int GetTrackID() const { return fTrackID; }
private:
G4double fEdep;
G4ThreeVector fPos;
G4int fTrackID;
};
typedef G4THitsCollection<RE01TrackerHit> RE01TrackerHitsCollection;
extern G4ThreadLocal G4Allocator<RE01TrackerHit> * RE01TrackerHitAllocator;
extern G4ThreadLocal G4Allocator<RE01TrackerHit>* RE01TrackerHitAllocator;
inline void* RE01TrackerHit::operator new(size_t)
{
if(!RE01TrackerHitAllocator)
RE01TrackerHitAllocator = new G4Allocator<RE01TrackerHit>;
return (void *) RE01TrackerHitAllocator->MallocSingle();
if (!RE01TrackerHitAllocator) RE01TrackerHitAllocator = new G4Allocator<RE01TrackerHit>;
return (void*)RE01TrackerHitAllocator->MallocSingle();
}
inline void RE01TrackerHit::operator delete(void *aHit)
inline void RE01TrackerHit::operator delete(void* aHit)
{
RE01TrackerHitAllocator->FreeSingle((RE01TrackerHit*) aHit);
RE01TrackerHitAllocator->FreeSingle((RE01TrackerHit*)aHit);
}
#endif
@@ -31,8 +31,8 @@
#ifndef RE01TrackerParametrisation_H
#define RE01TrackerParametrisation_H 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
#include "globals.hh"
class G4VPhysicalVolume;
class G4Tubs;
@@ -52,48 +52,31 @@ class G4Polycone;
class G4Polyhedra;
class RE01TrackerParametrisation : public G4VPVParameterisation
{
public:
RE01TrackerParametrisation();
~RE01TrackerParametrisation();
{
public:
RE01TrackerParametrisation();
~RE01TrackerParametrisation();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
void ComputeDimensions(G4Tubs & trackerLayer,
const G4int copyNo,
const G4VPhysicalVolume * physVol) const;
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const;
void ComputeDimensions(G4Tubs& trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions(G4Trd&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Trap&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Cons&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Sphere&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Ellipsoid&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Torus&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Para&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Hype&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Box&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Orb&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polycone&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polyhedra&, const G4int, const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Trd&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Trap&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Cons&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Sphere&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Ellipsoid&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Torus&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Para&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Hype&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Box&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Orb&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Polycone&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions(G4Polyhedra&,const G4int,const G4VPhysicalVolume*)
const {}
private:
private:
#include "RE01DetectorParameterDef.hh"
};
#endif
@@ -31,28 +31,27 @@
#ifndef RE01TrackerSD_h
#define RE01TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "RE01TrackerHit.hh"
#include "G4VSensitiveDetector.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class RE01TrackerSD : public G4VSensitiveDetector
{
public:
RE01TrackerSD(G4String name);
virtual ~RE01TrackerSD();
public:
RE01TrackerSD(G4String name);
virtual ~RE01TrackerSD();
virtual void Initialize(G4HCofThisEvent*HCE);
virtual void EndOfEvent(G4HCofThisEvent*HCE);
protected:
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
virtual void Initialize(G4HCofThisEvent* HCE);
virtual void EndOfEvent(G4HCofThisEvent* HCE);
private:
RE01TrackerHitsCollection *fTrackerCollection;
protected:
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
private:
RE01TrackerHitsCollection* fTrackerCollection;
};
#endif
@@ -33,15 +33,14 @@
#include "G4UserTrackingAction.hh"
class RE01TrackingAction : public G4UserTrackingAction
class RE01TrackingAction : public G4UserTrackingAction
{
public:
RE01TrackingAction();
virtual ~RE01TrackingAction(){};
virtual void PreUserTrackingAction(const G4Track*);
virtual void PostUserTrackingAction(const G4Track*);
public:
RE01TrackingAction();
virtual ~RE01TrackingAction() {};
virtual void PreUserTrackingAction(const G4Track*);
virtual void PostUserTrackingAction(const G4Track*);
};
#endif
@@ -32,16 +32,17 @@
#ifndef RE01Trajectory_h
#define RE01Trajectory_h 1
#include "G4VTrajectory.hh"
#include "G4Allocator.hh"
#include <stdlib.h>
#include "G4ThreeVector.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4TrajectoryPoint.hh"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4Track.hh"
#include "G4TrajectoryPoint.hh"
#include "G4VTrajectory.hh"
#include "G4ios.hh"
#include "globals.hh"
#include <stdlib.h>
#include <vector>
class G4Polyline;
@@ -52,53 +53,49 @@ typedef std::vector<G4VTrajectoryPoint*> RE01TrajectoryPointContainer;
class RE01Trajectory : public G4VTrajectory
{
public:
RE01Trajectory(const G4Track* aTrack);
virtual ~RE01Trajectory();
public:
RE01Trajectory(const G4Track* aTrack);
virtual ~RE01Trajectory();
virtual void ShowTrajectory(std::ostream& os=G4cout) const;
virtual void DrawTrajectory() const;
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void AppendStep(const G4Step* aStep);
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
virtual void ShowTrajectory(std::ostream& os = G4cout) const;
virtual void DrawTrajectory() const;
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
virtual std::vector<G4AttValue>* CreateAttValues() const;
virtual void AppendStep(const G4Step* aStep);
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
inline void* operator new(size_t);
inline void operator delete(void*);
inline int operator == (const RE01Trajectory& right) const
{return (this==&right);}
inline void* operator new(size_t);
inline void operator delete(void*);
inline int operator==(const RE01Trajectory& right) const { return (this == &right); }
virtual G4int GetTrackID() const { return fTrackID; }
virtual G4int GetParentID() const { return fParentID; }
virtual G4String GetParticleName() const { return fParticleName; }
virtual G4double GetCharge() const { return fPDGCharge; }
virtual G4int GetPDGEncoding() const { return fPDGEncoding; }
virtual G4ThreeVector GetInitialMomentum() const { return fMomentum; }
virtual int GetPointEntries() const { return fPositionRecord->size(); }
virtual G4VTrajectoryPoint* GetPoint(G4int i) const
{ return (*fPositionRecord)[i]; }
private:
RE01TrajectoryPointContainer* fPositionRecord;
G4int fTrackID;
G4int fParentID;
G4int fTrackStatus;
G4ParticleDefinition* fParticleDefinition;
G4String fParticleName;
G4double fPDGCharge;
G4int fPDGEncoding;
G4ThreeVector fMomentum;
G4ThreeVector fVertexPosition;
G4double fGlobalTime;
virtual G4int GetTrackID() const { return fTrackID; }
virtual G4int GetParentID() const { return fParentID; }
virtual G4String GetParticleName() const { return fParticleName; }
virtual G4double GetCharge() const { return fPDGCharge; }
virtual G4int GetPDGEncoding() const { return fPDGEncoding; }
virtual G4ThreeVector GetInitialMomentum() const { return fMomentum; }
virtual int GetPointEntries() const { return fPositionRecord->size(); }
virtual G4VTrajectoryPoint* GetPoint(G4int i) const { return (*fPositionRecord)[i]; }
private:
RE01TrajectoryPointContainer* fPositionRecord;
G4int fTrackID;
G4int fParentID;
G4int fTrackStatus;
G4ParticleDefinition* fParticleDefinition;
G4String fParticleName;
G4double fPDGCharge;
G4int fPDGEncoding;
G4ThreeVector fMomentum;
G4ThreeVector fVertexPosition;
G4double fGlobalTime;
};
extern G4ThreadLocal G4Allocator<RE01Trajectory> * myTrajectoryAllocator;
extern G4ThreadLocal G4Allocator<RE01Trajectory>* myTrajectoryAllocator;
inline void* RE01Trajectory::operator new(size_t)
{
if(!myTrajectoryAllocator)
myTrajectoryAllocator = new G4Allocator<RE01Trajectory>;
if (!myTrajectoryAllocator) myTrajectoryAllocator = new G4Allocator<RE01Trajectory>;
return (void*)myTrajectoryAllocator->MallocSingle();
}
@@ -108,4 +105,3 @@ inline void RE01Trajectory::operator delete(void* aTrajectory)
}
#endif
File diff suppressed because it is too large Load Diff
@@ -29,21 +29,25 @@
//
#include "RE01ActionInitialization.hh"
#include "RE01EventAction.hh"
#include "RE01PrimaryGeneratorAction.hh"
#include "RE01RunAction.hh"
#include "RE01EventAction.hh"
#include "RE01StackingAction.hh"
#include "RE01TrackingAction.hh"
#include "RE01SteppingAction.hh"
#include "RE01TrackingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01ActionInitialization::RE01ActionInitialization()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01ActionInitialization::~RE01ActionInitialization()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01ActionInitialization::Build() const
@@ -70,4 +74,3 @@ void RE01ActionInitialization::BuildForMaster() const
G4UserRunAction* run_action = new RE01RunAction;
SetUserAction(run_action);
}
@@ -30,79 +30,86 @@
//
#include "RE01CalorimeterHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4AttDefStore.hh"
#include "G4AttDef.hh"
#include "G4AttDefStore.hh"
#include "G4AttValue.hh"
#include "G4Colour.hh"
#include "G4LogicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4UIcommand.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
G4ThreadLocal G4Allocator<RE01CalorimeterHit> * RE01CalorimeterHitAllocator = 0;
G4ThreadLocal G4Allocator<RE01CalorimeterHit>* RE01CalorimeterHitAllocator = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterHit::RE01CalorimeterHit(G4LogicalVolume* logVol,
G4int z, G4int phi)
:G4VHit(), fZCellID(z), fPhiCellID(phi), fEdep(0.0),
fPos(0),fRot(0.,0.,0.),fPLogV(logVol),fEdepByATrack(0.0),fTrackInfo()
{;}
RE01CalorimeterHit::RE01CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi)
: G4VHit(),
fZCellID(z),
fPhiCellID(phi),
fEdep(0.0),
fPos(0),
fRot(0., 0., 0.),
fPLogV(logVol),
fEdepByATrack(0.0),
fTrackInfo()
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterHit::~RE01CalorimeterHit()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01CalorimeterHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Transform3D trans(fRot,fPos);
if (pVVisManager) {
G4Transform3D trans(fRot, fPos);
G4VisAttributes attribs;
const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
if(pVA) attribs = *pVA;
G4Colour colour(1.,0.,0.);
if (pVA) attribs = *pVA;
G4Colour colour(1., 0., 0.);
attribs.SetColour(colour);
attribs.SetForceWireframe(false);
attribs.SetForceSolid(true);
pVVisManager->Draw(*fPLogV,attribs,trans);
pVVisManager->Draw(*fPLogV, attribs, trans);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String,G4AttDef>* RE01CalorimeterHit::GetAttDefs() const
const std::map<G4String, G4AttDef>* RE01CalorimeterHit::GetAttDefs() const
{
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("RE01CalorimeterHit",isNew);
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01CalorimeterHit", isNew);
if (isNew) {
G4String hitType("HitType");
(*store)[hitType] = G4AttDef(hitType,"Hit Type","Physics","","G4String");
(*store)[hitType] = G4AttDef(hitType, "Hit Type", "Physics", "", "G4String");
G4String zCellID("ZCellID");
(*store)[zCellID] = G4AttDef(zCellID,"Z Cell ID","Physics","","G4int");
(*store)[zCellID] = G4AttDef(zCellID, "Z Cell ID", "Physics", "", "G4int");
G4String phiCellID("PhiCellID");
(*store)[phiCellID] = G4AttDef(phiCellID,"Phi Cell ID","Physics","","G4int");
(*store)[phiCellID] = G4AttDef(phiCellID, "Phi Cell ID", "Physics", "", "G4int");
G4String energy("Energy");
(*store)[energy] = G4AttDef(energy,"Energy Deposited","Physics","G4BestUnit",
"G4double");
(*store)[energy] = G4AttDef(energy, "Energy Deposited", "Physics", "G4BestUnit", "G4double");
G4String eTrack("ETrack");
(*store)[eTrack] = G4AttDef(eTrack,"Energy Deposited By Track","Physics",
"G4BestUnit","G4double");
(*store)[eTrack] =
G4AttDef(eTrack, "Energy Deposited By Track", "Physics", "G4BestUnit", "G4double");
G4String pos("Pos");
(*store)[pos] = G4AttDef(pos, "Position",
"Physics","G4BestUnit","G4ThreeVector");
(*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
G4String lvol("LVol");
(*store)[lvol] = G4AttDef(lvol,"Logical Volume","Physics","","G4String");
(*store)[lvol] = G4AttDef(lvol, "Logical Volume", "Physics", "", "G4String");
}
return store;
@@ -113,29 +120,22 @@ std::vector<G4AttValue>* RE01CalorimeterHit::CreateAttValues() const
{
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
values->push_back(G4AttValue("HitType","RE01CalorimeterHit",""));
values->push_back(G4AttValue("HitType", "RE01CalorimeterHit", ""));
values->push_back
(G4AttValue("ZCellID",G4UIcommand::ConvertToString(fZCellID),""));
values->push_back(G4AttValue("ZCellID", G4UIcommand::ConvertToString(fZCellID), ""));
values->push_back
(G4AttValue("PhiCellID",G4UIcommand::ConvertToString(fPhiCellID),""));
values->push_back(G4AttValue("PhiCellID", G4UIcommand::ConvertToString(fPhiCellID), ""));
values->push_back
(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
values->push_back
(G4AttValue("ETrack",G4BestUnit(fEdepByATrack,"Energy"),""));
values->push_back(G4AttValue("ETrack", G4BestUnit(fEdepByATrack, "Energy"), ""));
values->push_back
(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
if (fPLogV)
values->push_back
(G4AttValue("LVol",fPLogV->GetName(),""));
values->push_back(G4AttValue("LVol", fPLogV->GetName(), ""));
else
values->push_back
(G4AttValue("LVol"," ",""));
values->push_back(G4AttValue("LVol", " ", ""));
return values;
}
@@ -143,8 +143,6 @@ std::vector<G4AttValue>* RE01CalorimeterHit::CreateAttValues() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01CalorimeterHit::Print()
{
G4cout << "Cell[" << fZCellID << "," << fPhiCellID << "] "
<< fEdep/GeV << " [GeV]" << G4endl;
G4cout << "Cell[" << fZCellID << "," << fPhiCellID << "] " << fEdep / GeV << " [GeV]"
<< G4endl;
}
@@ -30,38 +30,38 @@
#include "RE01CalorimeterParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterParametrisation::RE01CalorimeterParametrisation()
:G4VPVParameterisation()
RE01CalorimeterParametrisation::RE01CalorimeterParametrisation() : G4VPVParameterisation()
{
#include "RE01DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterParametrisation::~RE01CalorimeterParametrisation()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01CalorimeterParametrisation::ComputeTransformation
(const G4int,G4VPhysicalVolume *physVol) const
void RE01CalorimeterParametrisation::ComputeTransformation(const G4int,
G4VPhysicalVolume* physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01CalorimeterParametrisation::ComputeDimensions
(G4Tubs & calorimeterLayer, const G4int copyNo, const G4VPhysicalVolume*) const
void RE01CalorimeterParametrisation::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);
calorimeterLayer.SetDeltaPhiAngle(fCaloTubs_dphi);
@@ -29,21 +29,21 @@
//
#include "RE01CalorimeterROGeometry.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4NistManager.hh"
#include "G4Material.hh"
#include "G4SystemOfUnits.hh"
#include "G4Tubs.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterROGeometry::
RE01CalorimeterROGeometry(G4String& parallelWorldName)
RE01CalorimeterROGeometry::RE01CalorimeterROGeometry(G4String& parallelWorldName)
: G4VUserParallelWorld(parallelWorldName)
{
#include "RE01DetectorParameterDef.icc"
@@ -51,7 +51,9 @@ RE01CalorimeterROGeometry(G4String& parallelWorldName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterROGeometry::~RE01CalorimeterROGeometry()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01CalorimeterROGeometry::Construct()
@@ -59,45 +61,38 @@ void RE01CalorimeterROGeometry::Construct()
// A dummy material is used to fill the volumes of the readout geometry.
// ( It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = nullptr;
G4Material* dummyMat = nullptr;
//the ReadOut World:
// the ReadOut World:
G4VPhysicalVolume* ROWorldPhys = GetWorld();
G4LogicalVolume *ROWorldLog = ROWorldPhys->GetLogicalVolume();
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);
}
#include "RE01CalorimeterSD.hh"
@@ -108,8 +103,7 @@ void RE01CalorimeterROGeometry::ConstructSD()
// Sensitive Detector
//------------------------------------------------------------------
G4String calorimeterSDname = "/mydet/calorimeter";
RE01CalorimeterSD * calorimeterSD = new RE01CalorimeterSD(calorimeterSDname);
RE01CalorimeterSD* calorimeterSD = new RE01CalorimeterSD(calorimeterSDname);
G4SDManager::GetSDMpointer()->AddNewDetector(calorimeterSD);
SetSensitiveDetector("caloROcellLogical", calorimeterSD);
}
@@ -29,94 +29,91 @@
//
#include "RE01CalorimeterSD.hh"
#include "RE01CalorimeterHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VTouchable.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VTouchable.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterSD::RE01CalorimeterSD(G4String name)
:G4VSensitiveDetector(name), fCalCollection(0),
fNumberOfCellsInZ(20),fNumberOfCellsInPhi(48)
: G4VSensitiveDetector(name), fCalCollection(0), fNumberOfCellsInZ(20), fNumberOfCellsInPhi(48)
{
// Initialize data member.
for(G4int j=0;j<fNumberOfCellsInZ;j++)
for(G4int k=0;k<fNumberOfCellsInPhi;k++)
{
fCellID[j][k] = -1;
}
for (G4int j = 0; j < fNumberOfCellsInZ; j++)
for (G4int k = 0; k < fNumberOfCellsInPhi; k++) {
fCellID[j][k] = -1;
}
//
G4String HCname;
collectionName.insert(HCname="calCollection");
collectionName.insert(HCname = "calCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01CalorimeterSD::~RE01CalorimeterSD()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01CalorimeterSD::Initialize(G4HCofThisEvent* HCE)
{
fCalCollection = new RE01CalorimeterHitsCollection
(SensitiveDetectorName,collectionName[0]);
for(G4int j=0;j<fNumberOfCellsInZ;j++)
for(G4int k=0;k<fNumberOfCellsInPhi;k++)
{
fCellID[j][k] = -1;
}
fCalCollection = new RE01CalorimeterHitsCollection(SensitiveDetectorName, collectionName[0]);
for (G4int j = 0; j < fNumberOfCellsInZ; j++)
for (G4int k = 0; k < fNumberOfCellsInPhi; k++) {
fCellID[j][k] = -1;
}
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......
G4bool RE01CalorimeterSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
G4bool RE01CalorimeterSD::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 dedicaed 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 dedicaed parallel world. The pointer "aStep" points to
//***** a G4Step object for the parallel world.
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false;
if (edep == 0.) return false;
const G4VTouchable* ROhist = aStep->GetPreStepPoint()->GetTouchable();
G4int copyIDinZ = ROhist->GetReplicaNumber();
G4int copyIDinPhi = ROhist->GetReplicaNumber(1);
if(fCellID[copyIDinZ][copyIDinPhi]==-1)
{
RE01CalorimeterHit* calHit = new RE01CalorimeterHit
(ROhist->GetVolume()->GetLogicalVolume(),copyIDinZ,copyIDinPhi);
calHit->SetEdep( edep );
if (fCellID[copyIDinZ][copyIDinPhi] == -1) {
RE01CalorimeterHit* calHit =
new RE01CalorimeterHit(ROhist->GetVolume()->GetLogicalVolume(), copyIDinZ, copyIDinPhi);
calHit->SetEdep(edep);
G4AffineTransform aTrans = ROhist->GetHistory()->GetTopTransform();
aTrans.Invert();
calHit->SetPos(aTrans.NetTranslation());
calHit->SetRot(aTrans.NetRotation());
calHit->SetTrackInformation(aStep->GetTrack());
G4int icell = fCalCollection->insert( calHit );
G4int icell = fCalCollection->insert(calHit);
fCellID[copyIDinZ][copyIDinPhi] = icell - 1;
if(verboseLevel>0)
{ G4cout << " New Calorimeter Hit on CellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
if (verboseLevel > 0) {
G4cout << " New Calorimeter Hit on CellID " << copyIDinZ << " " << copyIDinPhi << G4endl;
}
}
else
{
else {
(*fCalCollection)[fCellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep);
(*fCalCollection)[fCellID[copyIDinZ][copyIDinPhi]]
->SetTrackInformation(aStep->GetTrack());
if(verboseLevel>0)
{ G4cout << " Energy added to CellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
(*fCalCollection)[fCellID[copyIDinZ][copyIDinPhi]]->SetTrackInformation(aStep->GetTrack());
if (verboseLevel > 0) {
G4cout << " Energy added to CellID " << copyIDinZ << " " << copyIDinPhi << G4endl;
}
}
return true;
}
@@ -29,44 +29,46 @@
//
#include "RE01DetectorConstruction.hh"
#include "RE01TrackerSD.hh"
#include "RE01TrackerParametrisation.hh"
#include "RE01CalorimeterParametrisation.hh"
#include "RE01Field.hh"
#include "RE01RegionInformation.hh"
#include "RE01TrackerParametrisation.hh"
#include "RE01TrackerSD.hh"
#include "G4NistManager.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 "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4NistManager.hh"
#include "G4PVParameterised.hh"
#include "G4PVPlacement.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4SystemOfUnits.hh"
#include "G4RotationMatrix.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4TransportationManager.hh"
#include "G4Tubs.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01DetectorConstruction::RE01DetectorConstruction()
: G4VUserDetectorConstruction()
RE01DetectorConstruction::RE01DetectorConstruction() : G4VUserDetectorConstruction()
{
#include "RE01DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01DetectorConstruction::~RE01DetectorConstruction()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* RE01DetectorConstruction::Construct()
@@ -79,21 +81,21 @@ G4VPhysicalVolume* RE01DetectorConstruction::Construct()
G4String name, symbol;
G4int nel;
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
a = 1.01 * g / mole;
G4Element* elH = new G4Element(name = "Hydrogen", symbol = "H", iz = 1., a);
a = 12.01*g/mole;
G4Element* elC = new G4Element(name="Carbon", symbol="C", iz=6., a);
a = 12.01 * g / mole;
G4Element* elC = new G4Element(name = "Carbon", symbol = "C", iz = 6., a);
// Material Information imported from NIST database.
G4NistManager* NISTman = G4NistManager::Instance();
G4Material* air = NISTman->FindOrBuildMaterial("G4_AIR");
G4Material* lead = NISTman->FindOrBuildMaterial("G4_Pb");
G4Material* arGas = NISTman->FindOrBuildMaterial("G4_Ar");
G4Material* air = NISTman->FindOrBuildMaterial("G4_AIR");
G4Material* lead = NISTman->FindOrBuildMaterial("G4_Pb");
G4Material* arGas = NISTman->FindOrBuildMaterial("G4_Ar");
G4Material* silicon = NISTman->FindOrBuildMaterial("G4_Si");
density = 1.032*g/cm3;
G4Material* scinti = new G4Material(name="Scintillator", density, nel=2);
density = 1.032 * g / cm3;
G4Material* scinti = new G4Material(name = "Scintillator", density, nel = 2);
scinti->AddElement(elC, 9);
scinti->AddElement(elH, 10);
@@ -101,15 +103,12 @@ G4VPhysicalVolume* RE01DetectorConstruction::Construct()
// Detector geometry
//-------------------------------------------------------------------------
//------------------------------ experimental hall
G4Box * experimentalHall_box
= new G4Box("expHall_b",fExpHall_x,fExpHall_y,fExpHall_z);
G4LogicalVolume * experimentalHall_log
= new G4LogicalVolume(experimentalHall_box,air,"expHall_L",0,0,0);
G4VPhysicalVolume * experimentalHall_phys
= new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
0,false,0);
G4VisAttributes* experimentalHallVisAtt
= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
G4Box* experimentalHall_box = new G4Box("expHall_b", fExpHall_x, fExpHall_y, fExpHall_z);
G4LogicalVolume* experimentalHall_log =
new G4LogicalVolume(experimentalHall_box, air, "expHall_L", 0, 0, 0);
G4VPhysicalVolume* experimentalHall_phys =
new G4PVPlacement(0, G4ThreeVector(), experimentalHall_log, "expHall_P", 0, false, 0);
G4VisAttributes* experimentalHallVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
experimentalHallVisAtt->SetForceWireframe(true);
experimentalHall_log->SetVisAttributes(experimentalHallVisAtt);
G4Region* defaultRegion = (*(G4RegionStore::GetInstance()))[0];
@@ -119,16 +118,13 @@ G4VPhysicalVolume* RE01DetectorConstruction::Construct()
defaultRegion->SetUserInformation(defaultRInfo);
//------------------------------ tracker
G4VSolid * tracker_tubs
= new G4Tubs("trkTubs_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz,
fTrkTubs_sphi,fTrkTubs_dphi);
G4LogicalVolume * tracker_log
= new G4LogicalVolume(tracker_tubs,arGas,"trackerT_L",0,0,0);
G4VSolid* tracker_tubs = new G4Tubs("trkTubs_tubs", fTrkTubs_rmin, fTrkTubs_rmax, fTrkTubs_dz,
fTrkTubs_sphi, fTrkTubs_dphi);
G4LogicalVolume* tracker_log = new G4LogicalVolume(tracker_tubs, arGas, "trackerT_L", 0, 0, 0);
// G4VPhysicalVolume * tracker_phys =
new G4PVPlacement(0,G4ThreeVector(),tracker_log,"tracker_phys",
experimentalHall_log,false,0);
G4VisAttributes* tracker_logVisAtt
= new G4VisAttributes(G4Colour(1.0,0.0,1.0));
new G4PVPlacement(0, G4ThreeVector(), tracker_log, "tracker_phys", experimentalHall_log, false,
0);
G4VisAttributes* tracker_logVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0));
tracker_logVisAtt->SetForceWireframe(true);
tracker_log->SetVisAttributes(tracker_logVisAtt);
G4Region* trackerRegion = new G4Region("TrackerRegion");
@@ -139,65 +135,52 @@ G4VPhysicalVolume* RE01DetectorConstruction::Construct()
trackerRegion->AddRootLogicalVolume(tracker_log);
//------------------------------ 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);
fTrackerLayer_log
= new G4LogicalVolume(trackerLayer_tubs,silicon,"trackerB_L",0,0,0);
G4VPVParameterisation * trackerParam
= new RE01TrackerParametrisation;
G4VSolid* trackerLayer_tubs = new G4Tubs("trackerLayer_tubs", fTrkTubs_rmin, fTrkTubs_rmax,
fTrkTubs_dz, fTrkTubs_sphi, fTrkTubs_dphi);
fTrackerLayer_log = new G4LogicalVolume(trackerLayer_tubs, silicon, "trackerB_L", 0, 0, 0);
G4VPVParameterisation* trackerParam = new RE01TrackerParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
// G4VPhysicalVolume *trackerLayer_phys =
new G4PVParameterised("trackerLayer_phys",fTrackerLayer_log,tracker_log,
kXAxis, fNotrkLayers, trackerParam);
G4VisAttributes* trackerLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
new G4PVParameterised("trackerLayer_phys", fTrackerLayer_log, tracker_log, kXAxis, fNotrkLayers,
trackerParam);
G4VisAttributes* trackerLayer_logVisAtt = new G4VisAttributes(G4Colour(0.5, 0.0, 1.0));
trackerLayer_logVisAtt->SetForceWireframe(true);
fTrackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
//------------------------------ calorimeter
G4VSolid * calorimeter_tubs
= new G4Tubs("calorimeter_tubs",fCaloTubs_rmin,fCaloTubs_rmax,
fCaloTubs_dz,fCaloTubs_sphi,fCaloTubs_dphi);
fCalorimeter_log
= new G4LogicalVolume(calorimeter_tubs,scinti,"caloT_L",0,0,0);
G4VSolid* calorimeter_tubs = new G4Tubs("calorimeter_tubs", fCaloTubs_rmin, fCaloTubs_rmax,
fCaloTubs_dz, fCaloTubs_sphi, fCaloTubs_dphi);
fCalorimeter_log = new G4LogicalVolume(calorimeter_tubs, scinti, "caloT_L", 0, 0, 0);
// G4VPhysicalVolume * calorimeter_phys =
new G4PVPlacement(0,G4ThreeVector(),fCalorimeter_log,"caloM_P",
experimentalHall_log,false,0);
G4VisAttributes* calorimeter_logVisATT
= new G4VisAttributes(G4Colour(1.0,1.0,0.0));
new G4PVPlacement(0, G4ThreeVector(), fCalorimeter_log, "caloM_P", experimentalHall_log, false,
0);
G4VisAttributes* calorimeter_logVisATT = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
calorimeter_logVisATT->SetForceWireframe(true);
fCalorimeter_log->SetVisAttributes(calorimeter_logVisATT);
G4Region* calorimeterRegion = new G4Region("CalorimeterRegion");
RE01RegionInformation* calorimeterInfo
= new RE01RegionInformation();
RE01RegionInformation* calorimeterInfo = new RE01RegionInformation();
calorimeterInfo->SetCalorimeter();
calorimeterRegion->SetUserInformation(calorimeterInfo);
fCalorimeter_log->SetRegion(calorimeterRegion);
calorimeterRegion->AddRootLogicalVolume(fCalorimeter_log);
//------------------------------- 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,lead,"caloR_L",0,0,0);
G4VPVParameterisation * calorimeterParam
= new RE01CalorimeterParametrisation;
G4VSolid* caloLayer_tubs = new G4Tubs("caloLayer_tubs", fCaloRing_rmin, fCaloRing_rmax,
fCaloRing_dz, fCaloRing_sphi, fCaloRing_dphi);
G4LogicalVolume* caloLayer_log = new G4LogicalVolume(caloLayer_tubs, lead, "caloR_L", 0, 0, 0);
G4VPVParameterisation* calorimeterParam = new RE01CalorimeterParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
// G4VPhysicalVolume * caloLayer_phys =
new G4PVParameterised("caloLayer_phys",caloLayer_log,fCalorimeter_log,
kXAxis, fNocaloLayers, calorimeterParam);
G4VisAttributes* caloLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.7,1.0,0.0));
new G4PVParameterised("caloLayer_phys", caloLayer_log, fCalorimeter_log, kXAxis, fNocaloLayers,
calorimeterParam);
G4VisAttributes* caloLayer_logVisAtt = new G4VisAttributes(G4Colour(0.7, 1.0, 0.0));
caloLayer_logVisAtt->SetForceWireframe(true);
caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
return experimentalHall_phys;
}
@@ -207,9 +190,9 @@ void RE01DetectorConstruction::ConstructSDandField()
//------------------------------------------------------------------
// Sensitive Detector
//------------------------------------------------------------------
G4String trackerSDname = "/mydet/tracker";
RE01TrackerSD * trackerSD = new RE01TrackerSD(trackerSDname);
RE01TrackerSD* trackerSD = new RE01TrackerSD(trackerSDname);
G4SDManager::GetSDMpointer()->AddNewDetector(trackerSD);
SetSensitiveDetector(fTrackerLayer_log, trackerSD);
@@ -218,11 +201,9 @@ void RE01DetectorConstruction::ConstructSDandField()
//-------------------------------------------------------------------------
// Magnetic field
//-------------------------------------------------------------------------
RE01Field* myField = new RE01Field;
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
fieldMgr->SetDetectorField(myField);
fieldMgr->CreateChordFinder(myField);
}
@@ -29,42 +29,44 @@
//
#include "RE01EventAction.hh"
#include "RE01TrackerHit.hh"
#include "RE01CalorimeterHit.hh"
#include "RE01TrackerHit.hh"
#include "RE01Trajectory.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "RE01Trajectory.hh"
#include "G4PrimaryVertex.hh"
#include "G4PrimaryParticle.hh"
#include "G4SystemOfUnits.hh"
#include "G4PrimaryVertex.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4TrajectoryContainer.hh"
#include "G4UImanager.hh"
#include "G4VHitsCollection.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01EventAction::RE01EventAction()
:G4UserEventAction(),
fTrackerCollID(-1),fCalorimeterCollID(-1)
{;}
RE01EventAction::RE01EventAction() : G4UserEventAction(), fTrackerCollID(-1), fCalorimeterCollID(-1)
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01EventAction::~RE01EventAction()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01EventAction::BeginOfEventAction(const G4Event*)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
if(fTrackerCollID<0||fCalorimeterCollID<0)
{
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if (fTrackerCollID < 0 || fCalorimeterCollID < 0) {
G4String colNam;
fTrackerCollID = SDman->GetCollectionID(colNam="trackerCollection");
fCalorimeterCollID = SDman->GetCollectionID(colNam="calCollection");
fTrackerCollID = SDman->GetCollectionID(colNam = "trackerCollection");
fCalorimeterCollID = SDman->GetCollectionID(colNam = "calCollection");
}
}
@@ -72,53 +74,45 @@ void RE01EventAction::BeginOfEventAction(const G4Event*)
void RE01EventAction::EndOfEventAction(const G4Event* evt)
{
G4cout << ">>> Summary of Event " << evt->GetEventID() << G4endl;
if(evt->GetNumberOfPrimaryVertex()==0)
{
if (evt->GetNumberOfPrimaryVertex() == 0) {
G4cout << "Event is empty." << G4endl;
return;
}
if(fTrackerCollID<0||fCalorimeterCollID<0) return;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
if (fTrackerCollID < 0 || fCalorimeterCollID < 0) return;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
RE01TrackerHitsCollection* THC = 0;
RE01CalorimeterHitsCollection* CHC = 0;
if(HCE)
{
if (HCE) {
THC = (RE01TrackerHitsCollection*)(HCE->GetHC(fTrackerCollID));
CHC = (RE01CalorimeterHitsCollection*)(HCE->GetHC(fCalorimeterCollID));
}
if(THC)
{
if (THC) {
int n_hit = THC->entries();
G4cout << G4endl;
G4cout << "Tracker hits " <<
"--------------------------------------------------------------"
<< G4endl;
G4cout << n_hit << " hits are stored in RE01TrackerHitsCollection."
<< G4endl;
if(fpEventManager->GetVerboseLevel()>0)
{
G4cout << "Tracker hits "
<< "--------------------------------------------------------------" << G4endl;
G4cout << n_hit << " hits are stored in RE01TrackerHitsCollection." << G4endl;
if (fpEventManager->GetVerboseLevel() > 0) {
G4cout << "List of hits in tracker" << G4endl;
for(int i=0;i<n_hit;i++)
{ (*THC)[i]->Print(); }
for (int i = 0; i < n_hit; i++) {
(*THC)[i]->Print();
}
}
}
if(CHC)
{
if (CHC) {
int n_hit = CHC->entries();
G4cout << G4endl;
G4cout << "Calorimeter hits "<<
"--------------------------------------------------------------"
<< G4endl;
G4cout << n_hit << " hits are stored in RE01CalorimeterHitsCollection."
<< G4endl;
G4cout << "Calorimeter hits "
<< "--------------------------------------------------------------" << G4endl;
G4cout << n_hit << " hits are stored in RE01CalorimeterHitsCollection." << 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;
}
// get number of stored trajectories
@@ -127,37 +121,28 @@ void RE01EventAction::EndOfEventAction(const G4Event* evt)
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
// extract the trajectories and print them out
G4cout << G4endl;
G4cout << "Trajectories in tracker "<<
"--------------------------------------------------------------"
<< G4endl;
if(fpEventManager->GetVerboseLevel()>0)
{
for(G4int i=0; i<n_trajectories; i++)
{
RE01Trajectory* trj =
(RE01Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
G4cout << "Trajectories in tracker "
<< "--------------------------------------------------------------" << G4endl;
if (fpEventManager->GetVerboseLevel() > 0) {
for (G4int i = 0; i < n_trajectories; i++) {
RE01Trajectory* trj = (RE01Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
trj->ShowTrajectory();
}
}
G4cout << G4endl;
G4cout << "Primary particles "<<
"--------------------------------------------------------------"
<< G4endl;
G4cout << "Primary particles "
<< "--------------------------------------------------------------" << G4endl;
G4int n_vertex = evt->GetNumberOfPrimaryVertex();
for(G4int iv=0;iv<n_vertex;iv++)
{
for (G4int iv = 0; iv < n_vertex; iv++) {
G4PrimaryVertex* pv = evt->GetPrimaryVertex(iv);
G4cout << G4endl;
G4cout << "Primary vertex "
<< G4ThreeVector(pv->GetX0(),pv->GetY0(),pv->GetZ0())
<< " at t = " << (pv->GetT0())/ns << " [ns]" << G4endl;
if(fpEventManager->GetVerboseLevel()>0)
{
G4cout << "Primary vertex " << G4ThreeVector(pv->GetX0(), pv->GetY0(), pv->GetZ0())
<< " at t = " << (pv->GetT0()) / ns << " [ns]" << G4endl;
if (fpEventManager->GetVerboseLevel() > 0) {
G4PrimaryParticle* pp = pv->GetPrimary();
while(pp)
{
PrintPrimary(pp,0);
while (pp) {
PrintPrimary(pp, 0);
pp = pp->GetNext();
}
}
@@ -165,27 +150,29 @@ void RE01EventAction::EndOfEventAction(const G4Event* evt)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01EventAction::PrintPrimary(G4PrimaryParticle* pp,G4int ind)
void RE01EventAction::PrintPrimary(G4PrimaryParticle* pp, G4int ind)
{
for(G4int ii=0;ii<=ind;ii++)
{ G4cout << " "; }
for (G4int ii = 0; ii <= ind; ii++) {
G4cout << " ";
}
G4cout << "==PDGcode " << pp->GetPDGcode() << " ";
if(pp->GetG4code()!=0)
{ G4cout << "(" << pp->GetG4code()->GetParticleName() << ")"; }
else
{ G4cout << "is not defined in G4"; }
G4cout << " " << pp->GetMomentum()/GeV << " [GeV] ";
if(pp->GetTrackID()<0)
{ G4cout << G4endl; }
else
{ G4cout << ">>> G4Track ID " << pp->GetTrackID() << G4endl; }
if (pp->GetG4code() != 0) {
G4cout << "(" << pp->GetG4code()->GetParticleName() << ")";
}
else {
G4cout << "is not defined in G4";
}
G4cout << " " << pp->GetMomentum() / GeV << " [GeV] ";
if (pp->GetTrackID() < 0) {
G4cout << G4endl;
}
else {
G4cout << ">>> G4Track ID " << pp->GetTrackID() << G4endl;
}
G4PrimaryParticle* daughter = pp->GetDaughter();
while(daughter)
{
PrintPrimary(daughter,ind+1);
while (daughter) {
PrintPrimary(daughter, ind + 1);
daughter = daughter->GetNext();
}
}
@@ -29,29 +29,32 @@
//
#include "RE01Field.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01Field::RE01Field()
:G4MagneticField()
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01Field::RE01Field() : 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......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01Field::~RE01Field()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01Field::GetFieldValue(const double point[3],double *bfield) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01Field::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.;
}
}
@@ -29,19 +29,19 @@
//
#include "RE01PrimaryGeneratorAction.hh"
#include "RE01PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4HEPEvtInterface.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01PrimaryGeneratorAction::RE01PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fHEPEvt(0), fParticleGun(0), fMessenger(0)
: G4VUserPrimaryGeneratorAction(), fHEPEvt(0), fParticleGun(0), fMessenger(0)
{
const char* filename = "pythia_event.data";
fHEPEvt = new G4HEPEvtInterface(filename);
@@ -50,30 +50,32 @@ RE01PrimaryGeneratorAction::RE01PrimaryGeneratorAction()
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 RE01PrimaryGeneratorMessenger(this);
fUseHEPEvt = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4AutoLock.hh"
namespace {
G4Mutex RE01PrimGenDestrMutex = G4MUTEX_INITIALIZER;
G4Mutex RE01PrimGenMutex = G4MUTEX_INITIALIZER;
}
namespace
{
G4Mutex RE01PrimGenDestrMutex = G4MUTEX_INITIALIZER;
G4Mutex RE01PrimGenMutex = G4MUTEX_INITIALIZER;
} // namespace
RE01PrimaryGeneratorAction::~RE01PrimaryGeneratorAction()
{
G4AutoLock lock(&RE01PrimGenDestrMutex);
if(fHEPEvt) {delete fHEPEvt; fHEPEvt = 0;}
if (fHEPEvt) {
delete fHEPEvt;
fHEPEvt = 0;
}
delete fParticleGun;
delete fMessenger;
}
@@ -81,16 +83,15 @@ RE01PrimaryGeneratorAction::~RE01PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
if(fUseHEPEvt)
{
if (fUseHEPEvt) {
G4AutoLock lock(&RE01PrimGenMutex);
fHEPEvt->GeneratePrimaryVertex(anEvent);
if(anEvent->GetNumberOfPrimaryVertex()==0)
{ // End-of-file
G4Exception("RE01PrimaryGeneratorAction::GeneratePrimaries",
"RE01_0001",RunMustBeAborted,"End of file detected.");
if (anEvent->GetNumberOfPrimaryVertex() == 0) { // End-of-file
G4Exception("RE01PrimaryGeneratorAction::GeneratePrimaries", "RE01_0001", RunMustBeAborted,
"End of file detected.");
}
}
else
{ fParticleGun->GeneratePrimaryVertex(anEvent); }
else {
fParticleGun->GeneratePrimaryVertex(anEvent);
}
}
@@ -29,56 +29,56 @@
//
#include "RE01PrimaryGeneratorMessenger.hh"
#include "RE01PrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIdirectory.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01PrimaryGeneratorMessenger
::RE01PrimaryGeneratorMessenger(RE01PrimaryGeneratorAction * mpga)
:G4UImessenger(),fMyAction(mpga),
fMydetDirectory(0),fGenCmd(0)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01PrimaryGeneratorMessenger ::RE01PrimaryGeneratorMessenger(RE01PrimaryGeneratorAction* mpga)
: G4UImessenger(), fMyAction(mpga), fMydetDirectory(0), fGenCmd(0)
{
fMydetDirectory = new G4UIdirectory("/mydet/");
fMydetDirectory->SetGuidance("RE01 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");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01PrimaryGeneratorMessenger::~RE01PrimaryGeneratorMessenger()
{
delete fGenCmd;
delete fMydetDirectory;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01PrimaryGeneratorMessenger
::SetNewValue(G4UIcommand * command,G4String newValue)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01PrimaryGeneratorMessenger ::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command==fGenCmd )
{ fMyAction->SetHEPEvtGenerator(newValue=="PYTHIA"); }
if (command == fGenCmd) {
fMyAction->SetHEPEvtGenerator(newValue == "PYTHIA");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String RE01PrimaryGeneratorMessenger::GetCurrentValue(G4UIcommand * command)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String RE01PrimaryGeneratorMessenger::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;
}
@@ -30,26 +30,37 @@
//
#include "RE01RegionInformation.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01RegionInformation::RE01RegionInformation()
:G4VUserRegionInformation(),
fIsWorld(false),fIsTracker(false),fIsCalorimeter(false)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01RegionInformation::~RE01RegionInformation()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01RegionInformation::Print() const
: G4VUserRegionInformation(), fIsWorld(false), fIsTracker(false), fIsCalorimeter(false)
{
G4cout << "I'm ";
if(fIsWorld) { G4cout << "World."; }
else if(fIsTracker) { G4cout << "Tracker."; }
else if(fIsCalorimeter) { G4cout << "Calorimeter."; }
else { G4cout << "unknown."; }
G4cout << G4endl;
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01RegionInformation::~RE01RegionInformation()
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01RegionInformation::Print() const
{
G4cout << "I'm ";
if (fIsWorld) {
G4cout << "World.";
}
else if (fIsTracker) {
G4cout << "Tracker.";
}
else if (fIsCalorimeter) {
G4cout << "Calorimeter.";
}
else {
G4cout << "unknown.";
}
G4cout << G4endl;
}
@@ -27,7 +27,7 @@
/// \brief Implementation of the RE01RunAction class
//
//
//
//
#include "RE01RunAction.hh"
@@ -35,14 +35,17 @@
#include "G4RunManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01RunAction::RE01RunAction()
:G4UserRunAction()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01RunAction::RE01RunAction() : G4UserRunAction()
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01RunAction::~RE01RunAction()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01RunAction::BeginOfRunAction(const G4Run* aRun)
@@ -51,10 +54,8 @@ void RE01RunAction::BeginOfRunAction(const G4Run* aRun)
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01RunAction::EndOfRunAction(const G4Run*)
{;}
{
;
}
@@ -29,51 +29,53 @@
//
#include "RE01StackingAction.hh"
#include "RE01TrackInformation.hh"
#include "RE01CalorimeterHit.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "RE01CalorimeterHit.hh"
#include "RE01TrackInformation.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01StackingAction::RE01StackingAction()
:G4UserStackingAction(),
fStage(0),fCalorimeterHitsColID(-1)
{;}
: G4UserStackingAction(), fStage(0), fCalorimeterHitsColID(-1)
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01StackingAction::~RE01StackingAction()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack RE01StackingAction
::ClassifyNewTrack(const G4Track * aTrack)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack RE01StackingAction ::ClassifyNewTrack(const G4Track* aTrack)
{
G4ClassificationOfNewTrack classification = fUrgent;
if(fStage==0)
{
if (fStage == 0) {
RE01TrackInformation* trackInfo;
if(aTrack->GetTrackStatus()==fSuspend) // Track reached to calorimeter
if (aTrack->GetTrackStatus() == fSuspend) // Track reached to calorimeter
{
trackInfo = (RE01TrackInformation*)(aTrack->GetUserInformation());
trackInfo->SetTrackingStatus(0);
trackInfo->SetSourceTrackInformation(aTrack);
// G4cout << "Track " << aTrack->GetTrackID()
// << " (parentID " << aTrack->GetParentID()
// << ") has reached to calorimeter and has been suspended at "
// << aTrack->GetPosition() << G4endl;
// G4cout << "Track " << aTrack->GetTrackID()
// << " (parentID " << aTrack->GetParentID()
// << ") has reached to calorimeter and has been suspended at "
// << aTrack->GetPosition() << G4endl;
classification = fWaiting;
}
else if(aTrack->GetParentID()==0) // Primary particle
else if (aTrack->GetParentID() == 0) // Primary particle
{
trackInfo = new RE01TrackInformation(aTrack);
trackInfo->SetTrackingStatus(1);
@@ -84,15 +86,15 @@ G4ClassificationOfNewTrack RE01StackingAction
return classification;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VHitsCollection* RE01StackingAction::GetCalCollection()
{
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
G4RunManager* runMan = G4RunManager::GetRunManager();
if(fCalorimeterHitsColID<0)
{ fCalorimeterHitsColID = SDMan->GetCollectionID("calCollection"); }
if(fCalorimeterHitsColID>=0)
{
if (fCalorimeterHitsColID < 0) {
fCalorimeterHitsColID = SDMan->GetCollectionID("calCollection");
}
if (fCalorimeterHitsColID >= 0) {
const G4Event* currentEvent = runMan->GetCurrentEvent();
G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
return HCE->GetHC(fCalorimeterHitsColID);
@@ -100,75 +102,64 @@ G4VHitsCollection* RE01StackingAction::GetCalCollection()
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01StackingAction::NewStage()
{
// G4cout << "+++++++++++ Stage " << fStage << G4endl;
if(fStage==0)
{
if (fStage == 0) {
// display trajetory information in the tracking region
G4cout << G4endl;
G4cout << "Tracks in tracking region have been processed. -- Stage 0 over."
<< G4endl;
G4cout << "Tracks in tracking region have been processed. -- Stage 0 over." << G4endl;
G4cout << G4endl;
}
else
{
// display calorimeter information caused by a "source" track
else {
// display calorimeter information caused by a "source" track
// in the tracker region
// G4cout << G4endl;
// G4cout << "Processing one shower originated by a source track "
// << "in tracker region is over." << G4endl;
// G4cout << G4endl;
RE01CalorimeterHitsCollection* CHC =
(RE01CalorimeterHitsCollection*)GetCalCollection();
if(CHC)
{
RE01CalorimeterHitsCollection* CHC = (RE01CalorimeterHitsCollection*)GetCalCollection();
if (CHC) {
int n_hit = CHC->entries();
G4double totE = 0;
G4int n_hitByATrack = 0;
for(int i=0;i<n_hit;i++)
{
for (int i = 0; i < n_hit; i++) {
G4double edepByATrack = (*CHC)[i]->GetEdepByATrack();
if(edepByATrack>0.)
{
if (edepByATrack > 0.) {
totE += edepByATrack;
if(n_hitByATrack==0)
{ (*CHC)[i]->GetTrackInformation()->Print(); }
if (n_hitByATrack == 0) {
(*CHC)[i]->GetTrackInformation()->Print();
}
n_hitByATrack++;
G4cout << "Cell[" << (*CHC)[i]->GetZ() << ","
<< (*CHC)[i]->GetPhi() << "] "
<< edepByATrack/GeV << " [GeV]" << G4endl;
G4cout << "Cell[" << (*CHC)[i]->GetZ() << "," << (*CHC)[i]->GetPhi() << "] "
<< edepByATrack / GeV << " [GeV]" << G4endl;
(*CHC)[i]->ClearEdepByATrack();
}
}
if(n_hitByATrack>0)
{
G4cout <<
"### Total energy deposition in calorimeter by a source track in "
<< n_hitByATrack << " cells : " << totE / GeV << " (GeV)"
<< G4endl;
if (n_hitByATrack > 0) {
G4cout << "### Total energy deposition in calorimeter by a source track in "
<< n_hitByATrack << " cells : " << totE / GeV << " (GeV)" << G4endl;
G4cout << G4endl;
}
}
}
if(stackManager->GetNUrgentTrack())
{
if (stackManager->GetNUrgentTrack()) {
// Transfer all tracks in Urgent stack to Waiting stack, since all tracks
// in Waiting stack have already been transfered to Urgent stack before
// invokation of this method.
stackManager->TransferStackedTracks(fUrgent,fWaiting);
stackManager->TransferStackedTracks(fUrgent, fWaiting);
// Then, transfer only one track to Urgent stack.
stackManager->TransferOneStackedTrack(fWaiting,fUrgent);
stackManager->TransferOneStackedTrack(fWaiting, fUrgent);
fStage++;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01StackingAction::PrepareNewEvent()
{
fStage = 0;
{
fStage = 0;
}
@@ -29,65 +29,64 @@
//
#include "RE01SteppingAction.hh"
#include "RE01RegionInformation.hh"
#include "RE01TrackInformation.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Region.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01SteppingAction::RE01SteppingAction()
: G4UserSteppingAction()
{;}
RE01SteppingAction::RE01SteppingAction() : G4UserSteppingAction()
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01SteppingAction::~RE01SteppingAction()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01SteppingAction::UserSteppingAction(const G4Step * theStep)
void RE01SteppingAction::UserSteppingAction(const G4Step* theStep)
{
// Suspend a track if it is entering into the calorimeter
// check if it is alive
G4Track * theTrack = theStep->GetTrack();
if(theTrack->GetTrackStatus()!=fAlive) { return; }
G4Track* theTrack = theStep->GetTrack();
if (theTrack->GetTrackStatus() != fAlive) {
return;
}
// get region information
G4StepPoint * thePrePoint = theStep->GetPreStepPoint();
G4LogicalVolume * thePreLV =
thePrePoint->GetPhysicalVolume()->GetLogicalVolume();
RE01RegionInformation* thePreRInfo
= (RE01RegionInformation*)(thePreLV->GetRegion()->GetUserInformation());
G4StepPoint * thePostPoint = theStep->GetPostStepPoint();
G4LogicalVolume * thePostLV =
thePostPoint->GetPhysicalVolume()->GetLogicalVolume();
RE01RegionInformation* thePostRInfo
= (RE01RegionInformation*)(thePostLV->GetRegion()->GetUserInformation());
G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
G4LogicalVolume* thePreLV = thePrePoint->GetPhysicalVolume()->GetLogicalVolume();
RE01RegionInformation* thePreRInfo =
(RE01RegionInformation*)(thePreLV->GetRegion()->GetUserInformation());
G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
G4LogicalVolume* thePostLV = thePostPoint->GetPhysicalVolume()->GetLogicalVolume();
RE01RegionInformation* thePostRInfo =
(RE01RegionInformation*)(thePostLV->GetRegion()->GetUserInformation());
// check if it is entering to the calorimeter volume
if(!(thePreRInfo->IsCalorimeter()) && (thePostRInfo->IsCalorimeter()))
{
if (!(thePreRInfo->IsCalorimeter()) && (thePostRInfo->IsCalorimeter())) {
// if the track had already been suspended at the previous step, let it go.
RE01TrackInformation* trackInfo
= static_cast<RE01TrackInformation*>(theTrack->GetUserInformation());
if(trackInfo->GetSuspendedStepID()>-1)
{
if(fpSteppingManager->GetverboseLevel()>0)
{
G4cout<<"++++ This track had already been suspended at step #"
<<trackInfo->GetSuspendedStepID()<<". Tracking resumed."
<<G4endl;
RE01TrackInformation* trackInfo =
static_cast<RE01TrackInformation*>(theTrack->GetUserInformation());
if (trackInfo->GetSuspendedStepID() > -1) {
if (fpSteppingManager->GetverboseLevel() > 0) {
G4cout << "++++ This track had already been suspended at step #"
<< trackInfo->GetSuspendedStepID() << ". Tracking resumed." << G4endl;
}
}
else
{
else {
trackInfo->SetSuspendedStepID(theTrack->GetCurrentStepNumber());
theTrack->SetTrackStatus(fSuspend);
}
@@ -30,120 +30,114 @@
//
#include "RE01TrackInformation.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
G4ThreadLocal G4Allocator<RE01TrackInformation> *
aTrackInformationAllocator = 0;
G4ThreadLocal G4Allocator<RE01TrackInformation>* aTrackInformationAllocator = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackInformation::RE01TrackInformation()
: G4VUserTrackInformation()
RE01TrackInformation::RE01TrackInformation() : G4VUserTrackInformation()
{
fOriginalTrackID = 0;
fParticleDefinition = 0;
fOriginalPosition = G4ThreeVector(0.,0.,0.);
fOriginalMomentum = G4ThreeVector(0.,0.,0.);
fOriginalEnergy = 0.;
fOriginalTime = 0.;
fTrackingStatus = 1;
fSourceTrackID = -1;
fSourceDefinition = 0;
fSourcePosition = G4ThreeVector(0.,0.,0.);
fSourceMomentum = G4ThreeVector(0.,0.,0.);
fSourceEnergy = 0.;
fSourceTime = 0.;
fSuspendedStepID = -1;
fOriginalTrackID = 0;
fParticleDefinition = 0;
fOriginalPosition = G4ThreeVector(0., 0., 0.);
fOriginalMomentum = G4ThreeVector(0., 0., 0.);
fOriginalEnergy = 0.;
fOriginalTime = 0.;
fTrackingStatus = 1;
fSourceTrackID = -1;
fSourceDefinition = 0;
fSourcePosition = G4ThreeVector(0., 0., 0.);
fSourceMomentum = G4ThreeVector(0., 0., 0.);
fSourceEnergy = 0.;
fSourceTime = 0.;
fSuspendedStepID = -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackInformation::RE01TrackInformation(const G4Track* aTrack)
: G4VUserTrackInformation()
RE01TrackInformation::RE01TrackInformation(const G4Track* aTrack) : G4VUserTrackInformation()
{
fOriginalTrackID = aTrack->GetTrackID();
fParticleDefinition = aTrack->GetDefinition();
fOriginalPosition = aTrack->GetPosition();
fOriginalMomentum = aTrack->GetMomentum();
fOriginalEnergy = aTrack->GetTotalEnergy();
fOriginalTime = aTrack->GetGlobalTime();
fTrackingStatus = 1;
fSourceTrackID = -1;
fSourceDefinition = 0;
fSourcePosition = G4ThreeVector(0.,0.,0.);
fSourceMomentum = G4ThreeVector(0.,0.,0.);
fSourceEnergy = 0.;
fSourceTime = 0.;
fSuspendedStepID = -1;
fOriginalTrackID = aTrack->GetTrackID();
fParticleDefinition = aTrack->GetDefinition();
fOriginalPosition = aTrack->GetPosition();
fOriginalMomentum = aTrack->GetMomentum();
fOriginalEnergy = aTrack->GetTotalEnergy();
fOriginalTime = aTrack->GetGlobalTime();
fTrackingStatus = 1;
fSourceTrackID = -1;
fSourceDefinition = 0;
fSourcePosition = G4ThreeVector(0., 0., 0.);
fSourceMomentum = G4ThreeVector(0., 0., 0.);
fSourceEnergy = 0.;
fSourceTime = 0.;
fSuspendedStepID = -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackInformation
::RE01TrackInformation(const RE01TrackInformation* aTrackInfo)
RE01TrackInformation ::RE01TrackInformation(const RE01TrackInformation* aTrackInfo)
: G4VUserTrackInformation()
{
fOriginalTrackID = aTrackInfo->fOriginalTrackID;
fParticleDefinition = aTrackInfo->fParticleDefinition;
fOriginalPosition = aTrackInfo->fOriginalPosition;
fOriginalMomentum = aTrackInfo->fOriginalMomentum;
fOriginalEnergy = aTrackInfo->fOriginalEnergy;
fOriginalTime = aTrackInfo->fOriginalTime;
fTrackingStatus = aTrackInfo->fTrackingStatus;
fSourceTrackID = aTrackInfo->fSourceTrackID;
fSourceDefinition = aTrackInfo->fSourceDefinition;
fSourcePosition = aTrackInfo->fSourcePosition;
fSourceMomentum = aTrackInfo->fSourceMomentum;
fSourceEnergy = aTrackInfo->fSourceEnergy;
fSourceTime = aTrackInfo->fSourceTime;
fSuspendedStepID = -1;
fOriginalTrackID = aTrackInfo->fOriginalTrackID;
fParticleDefinition = aTrackInfo->fParticleDefinition;
fOriginalPosition = aTrackInfo->fOriginalPosition;
fOriginalMomentum = aTrackInfo->fOriginalMomentum;
fOriginalEnergy = aTrackInfo->fOriginalEnergy;
fOriginalTime = aTrackInfo->fOriginalTime;
fTrackingStatus = aTrackInfo->fTrackingStatus;
fSourceTrackID = aTrackInfo->fSourceTrackID;
fSourceDefinition = aTrackInfo->fSourceDefinition;
fSourcePosition = aTrackInfo->fSourcePosition;
fSourceMomentum = aTrackInfo->fSourceMomentum;
fSourceEnergy = aTrackInfo->fSourceEnergy;
fSourceTime = aTrackInfo->fSourceTime;
fSuspendedStepID = -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackInformation::~RE01TrackInformation()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackInformation& RE01TrackInformation
::operator =(const RE01TrackInformation& aTrackInfo)
RE01TrackInformation& RE01TrackInformation ::operator=(const RE01TrackInformation& aTrackInfo)
{
fOriginalTrackID = aTrackInfo.fOriginalTrackID;
fParticleDefinition = aTrackInfo.fParticleDefinition;
fOriginalPosition = aTrackInfo.fOriginalPosition;
fOriginalMomentum = aTrackInfo.fOriginalMomentum;
fOriginalEnergy = aTrackInfo.fOriginalEnergy;
fOriginalTime = aTrackInfo.fOriginalTime;
fTrackingStatus = aTrackInfo.fTrackingStatus;
fSourceTrackID = aTrackInfo.fSourceTrackID;
fSourceDefinition = aTrackInfo.fSourceDefinition;
fSourcePosition = aTrackInfo.fSourcePosition;
fSourceMomentum = aTrackInfo.fSourceMomentum;
fSourceEnergy = aTrackInfo.fSourceEnergy;
fSourceTime = aTrackInfo.fSourceTime;
fSuspendedStepID = -1;
fOriginalTrackID = aTrackInfo.fOriginalTrackID;
fParticleDefinition = aTrackInfo.fParticleDefinition;
fOriginalPosition = aTrackInfo.fOriginalPosition;
fOriginalMomentum = aTrackInfo.fOriginalMomentum;
fOriginalEnergy = aTrackInfo.fOriginalEnergy;
fOriginalTime = aTrackInfo.fOriginalTime;
fTrackingStatus = aTrackInfo.fTrackingStatus;
fSourceTrackID = aTrackInfo.fSourceTrackID;
fSourceDefinition = aTrackInfo.fSourceDefinition;
fSourcePosition = aTrackInfo.fSourcePosition;
fSourceMomentum = aTrackInfo.fSourceMomentum;
fSourceEnergy = aTrackInfo.fSourceEnergy;
fSourceTime = aTrackInfo.fSourceTime;
fSuspendedStepID = -1;
return *this;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackInformation::SetSourceTrackInformation(const G4Track* aTrack)
{
fSourceTrackID = aTrack->GetTrackID();
fSourceDefinition = aTrack->GetDefinition();
fSourcePosition = aTrack->GetPosition();
fSourceMomentum = aTrack->GetMomentum();
fSourceEnergy = aTrack->GetTotalEnergy();
fSourceTime = aTrack->GetGlobalTime();
fSourceTrackID = aTrack->GetTrackID();
fSourceDefinition = aTrack->GetDefinition();
fSourcePosition = aTrack->GetPosition();
fSourceMomentum = aTrack->GetMomentum();
fSourceEnergy = aTrack->GetTotalEnergy();
fSourceTime = aTrack->GetGlobalTime();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackInformation::Print() const
{
G4cout
<< "Source track ID " << fSourceTrackID << " ("
<< fSourceDefinition->GetParticleName() << ","
<< fSourceEnergy/GeV << "[GeV]) at " << fSourcePosition << G4endl;
G4cout
<< "Original primary track ID " << fOriginalTrackID << " ("
<< fParticleDefinition->GetParticleName() << ","
<< fOriginalEnergy/GeV << "[GeV])" << G4endl;
G4cout << "Source track ID " << fSourceTrackID << " (" << fSourceDefinition->GetParticleName()
<< "," << fSourceEnergy / GeV << "[GeV]) at " << fSourcePosition << G4endl;
G4cout << "Original primary track ID " << fOriginalTrackID << " ("
<< fParticleDefinition->GetParticleName() << "," << fOriginalEnergy / GeV << "[GeV])"
<< G4endl;
}
@@ -30,98 +30,93 @@
#include "RE01TrackerHit.hh"
#include "G4VVisManager.hh"
#include "G4AttDef.hh"
#include "G4AttDefStore.hh"
#include "G4AttValue.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4AttDefStore.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
#include "G4SystemOfUnits.hh"
#include "G4UIcommand.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
#include "G4SystemOfUnits.hh"
G4ThreadLocal G4Allocator<RE01TrackerHit> * RE01TrackerHitAllocator = 0;
G4ThreadLocal G4Allocator<RE01TrackerHit>* RE01TrackerHitAllocator = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerHit::RE01TrackerHit()
: G4VHit(), fEdep(0.0), fPos(0),fTrackID(-1)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerHit::RE01TrackerHit() : G4VHit(), fEdep(0.0), fPos(0), fTrackID(-1)
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerHit::~RE01TrackerHit()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackerHit::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);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String,G4AttDef>* RE01TrackerHit::GetAttDefs() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String, G4AttDef>* RE01TrackerHit::GetAttDefs() const
{
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("RE01TrackerHit",isNew);
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01TrackerHit", isNew);
if (isNew) {
G4String hitType("HitType");
(*store)[hitType] = G4AttDef(hitType,"Hit Type","Physics","","G4String");
(*store)[hitType] = G4AttDef(hitType, "Hit Type", "Physics", "", "G4String");
G4String trackID("TrackID");
(*store)[trackID] = G4AttDef(trackID,"Track ID","Physics","","G4int");
(*store)[trackID] = G4AttDef(trackID, "Track ID", "Physics", "", "G4int");
G4String energy("Energy");
(*store)[energy] = G4AttDef(energy,"Energy Deposited","Physics",
"G4BestUnit","G4double");
(*store)[energy] = G4AttDef(energy, "Energy Deposited", "Physics", "G4BestUnit", "G4double");
G4String eTrack("ETrack");
(*store)[eTrack] = G4AttDef(eTrack,"Energy Deposited By Track","Physics",
"G4BestUnit","G4double");
(*store)[eTrack] =
G4AttDef(eTrack, "Energy Deposited By Track", "Physics", "G4BestUnit", "G4double");
G4String pos("Pos");
(*store)[pos] = G4AttDef(pos, "Position",
"Physics","G4BestUnit","G4ThreeVector");
(*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
}
return store;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<G4AttValue>* RE01TrackerHit::CreateAttValues() const
{
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
values->push_back(G4AttValue("HitType","RE01TrackerHit",""));
values->push_back(G4AttValue("HitType", "RE01TrackerHit", ""));
values->push_back
(G4AttValue("TrackID",G4UIcommand::ConvertToString(fTrackID),""));
values->push_back(G4AttValue("TrackID", G4UIcommand::ConvertToString(fTrackID), ""));
values->push_back
(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
G4double noEnergy = 0.*MeV;
values->push_back
(G4AttValue("ETrack",G4BestUnit(noEnergy,"Energy"),""));
G4double noEnergy = 0. * MeV;
values->push_back(G4AttValue("ETrack", G4BestUnit(noEnergy, "Energy"), ""));
values->push_back
(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
return values;
values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
return values;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackerHit::Print()
{
G4cout << "TrackID " << fTrackID << " Position " << fPos << " : "
<< fEdep/keV << " [keV]" << G4endl;
G4cout << "TrackID " << fTrackID << " Position " << fPos << " : " << fEdep / keV
<< " [keV]" << G4endl;
}
@@ -30,36 +30,36 @@
#include "RE01TrackerParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerParametrisation::RE01TrackerParametrisation()
: G4VPVParameterisation()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerParametrisation::RE01TrackerParametrisation() : G4VPVParameterisation()
{
#include "RE01DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerParametrisation::~RE01TrackerParametrisation()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackerParametrisation
::ComputeTransformation(const G4int, G4VPhysicalVolume* physVol) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackerParametrisation ::ComputeTransformation(const G4int,
G4VPhysicalVolume* physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
}
void RE01TrackerParametrisation
::ComputeDimensions(G4Tubs& trackerLayer, const G4int copyNo,
const G4VPhysicalVolume*) const
void RE01TrackerParametrisation ::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);
trackerLayer.SetDeltaPhiAngle(fTrkTubs_dphi);
@@ -29,56 +29,63 @@
//
#include "RE01TrackerSD.hh"
#include "RE01TrackerHit.hh"
#include "RE01TrackInformation.hh"
#include "G4Step.hh"
#include "RE01TrackInformation.hh"
#include "RE01TrackerHit.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerSD::RE01TrackerSD(G4String name)
:G4VSensitiveDetector(name),fTrackerCollection(0)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerSD::RE01TrackerSD(G4String name) : G4VSensitiveDetector(name), fTrackerCollection(0)
{
G4String HCname;
collectionName.insert(HCname="trackerCollection");
collectionName.insert(HCname = "trackerCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerSD::~RE01TrackerSD(){;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackerSD::~RE01TrackerSD()
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackerSD::Initialize(G4HCofThisEvent* HCE)
{
static int HCID = -1;
fTrackerCollection = new RE01TrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection(HCID,fTrackerCollection);
fTrackerCollection = new RE01TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
if (HCID < 0) {
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID, fTrackerCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RE01TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false;
if (edep == 0.) return false;
RE01TrackerHit* newHit = new RE01TrackerHit();
newHit->SetEdep( edep );
newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
RE01TrackInformation* trackInfo =
newHit->SetEdep(edep);
newHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
RE01TrackInformation* trackInfo =
(RE01TrackInformation*)(aStep->GetTrack()->GetUserInformation());
if(trackInfo->GetTrackingStatus()>0)
{ newHit->SetTrackID( aStep->GetTrack()->GetTrackID() ); }
else
{ newHit->SetTrackID( -1 ); }
fTrackerCollection->insert( newHit );
if (trackInfo->GetTrackingStatus() > 0) {
newHit->SetTrackID(aStep->GetTrack()->GetTrackID());
}
else {
newHit->SetTrackID(-1);
}
fTrackerCollection->insert(newHit);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackerSD::EndOfEvent(G4HCofThisEvent*)
{;}
{
;
}
@@ -29,50 +29,45 @@
//
#include "RE01TrackingAction.hh"
#include "RE01Trajectory.hh"
#include "RE01TrackInformation.hh"
#include "RE01Trajectory.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4TrackingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackingAction::RE01TrackingAction()
:G4UserTrackingAction()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01TrackingAction::RE01TrackingAction() : G4UserTrackingAction()
{
;
}
void RE01TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
{
// Create trajectory only for track in tracking region
RE01TrackInformation* trackInfo =
(RE01TrackInformation*)(aTrack->GetUserInformation());
RE01TrackInformation* trackInfo = (RE01TrackInformation*)(aTrack->GetUserInformation());
if(trackInfo->GetTrackingStatus() > 0)
{
if (trackInfo->GetTrackingStatus() > 0) {
fpTrackingManager->SetStoreTrajectory(true);
fpTrackingManager->SetTrajectory(new RE01Trajectory(aTrack));
}
else
{ fpTrackingManager->SetStoreTrajectory(false); }
else {
fpTrackingManager->SetStoreTrajectory(false);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
G4TrackVector* secondaries = fpTrackingManager->GimmeSecondaries();
if(secondaries)
{
RE01TrackInformation* info =
(RE01TrackInformation*)(aTrack->GetUserInformation());
if (secondaries) {
RE01TrackInformation* info = (RE01TrackInformation*)(aTrack->GetUserInformation());
size_t nSeco = secondaries->size();
if(nSeco>0)
{
for(size_t i=0;i<nSeco;i++)
{
if (nSeco > 0) {
for (size_t i = 0; i < nSeco; i++) {
RE01TrackInformation* infoNew = new RE01TrackInformation(info);
(*secondaries)[i]->SetUserInformation(infoNew);
}
}
}
}
@@ -30,246 +30,223 @@
//
#include "RE01Trajectory.hh"
#include "RE01TrackInformation.hh"
#include "G4AttDef.hh"
#include "G4AttDefStore.hh"
#include "G4AttValue.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4Polyline.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4AttDefStore.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
#include "G4UIcommand.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
#include "G4UnitsTable.hh"
#include "G4DynamicParticle.hh"
#include "G4PrimaryParticle.hh"
#include "RE01TrackInformation.hh"
#include "G4UIcommand.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4VisAttributes.hh"
G4ThreadLocal G4Allocator<RE01Trajectory> * myTrajectoryAllocator = 0;
G4ThreadLocal G4Allocator<RE01Trajectory>* myTrajectoryAllocator = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01Trajectory::RE01Trajectory(const G4Track* aTrack)
:G4VTrajectory(),
fPositionRecord(0),fParticleDefinition(0)
: G4VTrajectory(), fPositionRecord(0), fParticleDefinition(0)
{
fParticleDefinition = aTrack->GetDefinition();
fParticleName = fParticleDefinition->GetParticleName();
fPDGCharge = fParticleDefinition->GetPDGCharge();
fPDGEncoding = fParticleDefinition->GetPDGEncoding();
if(fParticleName=="unknown")
{
G4PrimaryParticle*pp = aTrack->GetDynamicParticle()->GetPrimaryParticle();
if(pp)
{
if(pp->GetCharge()<DBL_MAX) fPDGCharge = pp->GetCharge();
fPDGEncoding = pp->GetPDGcode();
if(pp->GetG4code()!=0)
{
fParticleName += " : ";
fParticleName += pp->GetG4code()->GetParticleName();
}
}
}
fTrackID = aTrack->GetTrackID();
RE01TrackInformation* trackInfo
= (RE01TrackInformation*)(aTrack->GetUserInformation());
fTrackStatus = trackInfo->GetTrackingStatus();
if(fTrackStatus == 1)
{ fParentID = aTrack->GetParentID(); }
else if(fTrackStatus == 2)
{ fParentID = trackInfo->GetSourceTrackID(); }
else
{ fParentID = -1; }
fPositionRecord = new RE01TrajectoryPointContainer();
fPositionRecord->push_back(new G4TrajectoryPoint(aTrack->GetPosition()));
fMomentum = aTrack->GetMomentum();
fVertexPosition = aTrack->GetPosition();
fGlobalTime = aTrack->GetGlobalTime();
fParticleDefinition = aTrack->GetDefinition();
fParticleName = fParticleDefinition->GetParticleName();
fPDGCharge = fParticleDefinition->GetPDGCharge();
fPDGEncoding = fParticleDefinition->GetPDGEncoding();
if (fParticleName == "unknown") {
G4PrimaryParticle* pp = aTrack->GetDynamicParticle()->GetPrimaryParticle();
if (pp) {
if (pp->GetCharge() < DBL_MAX) fPDGCharge = pp->GetCharge();
fPDGEncoding = pp->GetPDGcode();
if (pp->GetG4code() != 0) {
fParticleName += " : ";
fParticleName += pp->GetG4code()->GetParticleName();
}
}
}
fTrackID = aTrack->GetTrackID();
RE01TrackInformation* trackInfo = (RE01TrackInformation*)(aTrack->GetUserInformation());
fTrackStatus = trackInfo->GetTrackingStatus();
if (fTrackStatus == 1) {
fParentID = aTrack->GetParentID();
}
else if (fTrackStatus == 2) {
fParentID = trackInfo->GetSourceTrackID();
}
else {
fParentID = -1;
}
fPositionRecord = new RE01TrajectoryPointContainer();
fPositionRecord->push_back(new G4TrajectoryPoint(aTrack->GetPosition()));
fMomentum = aTrack->GetMomentum();
fVertexPosition = aTrack->GetPosition();
fGlobalTime = aTrack->GetGlobalTime();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE01Trajectory::~RE01Trajectory()
{
size_t i;
for(i=0;i<fPositionRecord->size();i++){
delete (*fPositionRecord)[i];
for (i = 0; i < fPositionRecord->size(); i++) {
delete (*fPositionRecord)[i];
}
fPositionRecord->clear();
delete fPositionRecord;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01Trajectory::ShowTrajectory(std::ostream& os) const
{
os << G4endl << "TrackID =" << fTrackID
<< " : ParentID=" << fParentID << " : TrackStatus=" << fTrackStatus << G4endl;
os << "Particle name : " << fParticleName << " PDG code : " << fPDGEncoding
<< " Charge : " << fPDGCharge << G4endl;
os << "Original momentum : " <<
G4BestUnit(fMomentum,"Energy") << G4endl;
os << "Vertex : " << G4BestUnit(fVertexPosition,"Length")
<< " Global time : " << G4BestUnit(fGlobalTime,"Time") << G4endl;
os << " Current trajectory has " << fPositionRecord->size()
<< " points." << G4endl;
os << G4endl << "TrackID =" << fTrackID << " : ParentID=" << fParentID
<< " : TrackStatus=" << fTrackStatus << G4endl;
os << "Particle name : " << fParticleName << " PDG code : " << fPDGEncoding
<< " Charge : " << fPDGCharge << G4endl;
os << "Original momentum : " << G4BestUnit(fMomentum, "Energy") << G4endl;
os << "Vertex : " << G4BestUnit(fVertexPosition, "Length")
<< " Global time : " << G4BestUnit(fGlobalTime, "Time") << G4endl;
os << " Current trajectory has " << fPositionRecord->size() << " points." << G4endl;
for( size_t i=0 ; i < fPositionRecord->size() ; i++){
G4TrajectoryPoint* aTrajectoryPoint =
(G4TrajectoryPoint*)((*fPositionRecord)[i]);
os << "Point[" << i << "]"
<< " Position= " << aTrajectoryPoint->GetPosition() << G4endl;
}
for (size_t i = 0; i < fPositionRecord->size(); i++) {
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*fPositionRecord)[i]);
os << "Point[" << i << "]"
<< " Position= " << aTrajectoryPoint->GetPosition() << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01Trajectory::DrawTrajectory() const
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
G4ThreeVector pos;
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
G4ThreeVector pos;
G4Polyline pPolyline;
for (size_t i = 0; i < fPositionRecord->size(); i++) {
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*fPositionRecord)[i]);
pos = aTrajectoryPoint->GetPosition();
pPolyline.push_back(pos);
}
G4Polyline pPolyline;
for (size_t i = 0; i < fPositionRecord->size() ; i++) {
G4TrajectoryPoint* aTrajectoryPoint =
(G4TrajectoryPoint*)((*fPositionRecord)[i]);
pos = aTrajectoryPoint->GetPosition();
pPolyline.push_back( pos );
}
G4Colour colour(0.2, 0.2, 0.2);
if (fParticleDefinition == G4Gamma::GammaDefinition())
colour = G4Colour(0., 0., 1.);
else if (fParticleDefinition == G4Electron::ElectronDefinition()
|| fParticleDefinition == G4Positron::PositronDefinition())
colour = G4Colour(1., 1., 0.);
else if (fParticleDefinition == G4MuonMinus::MuonMinusDefinition()
|| fParticleDefinition == G4MuonPlus::MuonPlusDefinition())
colour = G4Colour(0., 1., 0.);
else if (fParticleDefinition->GetParticleType() == "meson") {
if (fPDGCharge != 0.)
colour = G4Colour(1., 0., 0.);
else
colour = G4Colour(0.5, 0., 0.);
}
else if (fParticleDefinition->GetParticleType() == "baryon") {
if (fPDGCharge != 0.)
colour = G4Colour(0., 1., 1.);
else
colour = G4Colour(0., 0.5, 0.5);
}
G4Colour colour(0.2,0.2,0.2);
if(fParticleDefinition==G4Gamma::GammaDefinition())
colour = G4Colour(0.,0.,1.);
else if(fParticleDefinition==G4Electron::ElectronDefinition()
||fParticleDefinition==G4Positron::PositronDefinition())
colour = G4Colour(1.,1.,0.);
else if(fParticleDefinition==G4MuonMinus::MuonMinusDefinition()
||fParticleDefinition==G4MuonPlus::MuonPlusDefinition())
colour = G4Colour(0.,1.,0.);
else if(fParticleDefinition->GetParticleType()=="meson")
{
if(fPDGCharge!=0.)
colour = G4Colour(1.,0.,0.);
else
colour = G4Colour(0.5,0.,0.);
}
else if(fParticleDefinition->GetParticleType()=="baryon")
{
if(fPDGCharge!=0.)
colour = G4Colour(0.,1.,1.);
else
colour = G4Colour(0.,0.5,0.5);
}
G4VisAttributes attribs(colour);
pPolyline.SetVisAttributes(attribs);
if(pVVisManager) pVVisManager->Draw(pPolyline);
G4VisAttributes attribs(colour);
pPolyline.SetVisAttributes(attribs);
if (pVVisManager) pVVisManager->Draw(pPolyline);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String,G4AttDef>* RE01Trajectory::GetAttDefs() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const std::map<G4String, G4AttDef>* RE01Trajectory::GetAttDefs() const
{
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("RE01Trajectory",isNew);
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01Trajectory", isNew);
if (isNew) {
G4String id("ID");
(*store)[id] = G4AttDef(id,"Track ID","Bookkeeping","","G4int");
(*store)[id] = G4AttDef(id, "Track ID", "Bookkeeping", "", "G4int");
G4String pid("PID");
(*store)[pid] = G4AttDef(pid,"Parent ID","Bookkeeping","","G4int");
(*store)[pid] = G4AttDef(pid, "Parent ID", "Bookkeeping", "", "G4int");
G4String status("Status");
(*store)[status] = G4AttDef(status,"Track Status","Bookkeeping","","G4int");
(*store)[status] = G4AttDef(status, "Track Status", "Bookkeeping", "", "G4int");
G4String pn("PN");
(*store)[pn] = G4AttDef(pn,"Particle Name","Bookkeeping","","G4String");
(*store)[pn] = G4AttDef(pn, "Particle Name", "Bookkeeping", "", "G4String");
G4String ch("Ch");
(*store)[ch] = G4AttDef(ch,"Charge","Physics","e+","G4double");
(*store)[ch] = G4AttDef(ch, "Charge", "Physics", "e+", "G4double");
G4String pdg("PDG");
(*store)[pdg] = G4AttDef(pdg,"PDG Encoding","Bookkeeping","","G4int");
(*store)[pdg] = G4AttDef(pdg, "PDG Encoding", "Bookkeeping", "", "G4int");
G4String imom("IMom");
(*store)[imom] = G4AttDef(imom, "Momentum of track at start of trajectory",
"Physics","G4BestUnit","G4ThreeVector");
(*store)[imom] = G4AttDef(imom, "Momentum of track at start of trajectory", "Physics",
"G4BestUnit", "G4ThreeVector");
G4String imag("IMag");
(*store)[imag] =
G4AttDef(imag, "Magnitude of momentum of track at start of trajectory",
"Physics","G4BestUnit","G4double");
(*store)[imag] = G4AttDef(imag, "Magnitude of momentum of track at start of trajectory",
"Physics", "G4BestUnit", "G4double");
G4String vtxPos("VtxPos");
(*store)[vtxPos] = G4AttDef(vtxPos, "Vertex position",
"Physics","G4BestUnit","G4ThreeVector");
(*store)[vtxPos] =
G4AttDef(vtxPos, "Vertex position", "Physics", "G4BestUnit", "G4ThreeVector");
G4String ntp("NTP");
(*store)[ntp] = G4AttDef(ntp,"No. of points","Bookkeeping","","G4int");
(*store)[ntp] = G4AttDef(ntp, "No. of points", "Bookkeeping", "", "G4int");
}
return store;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector<G4AttValue>* RE01Trajectory::CreateAttValues() const
{
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
values->push_back
(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fTrackID), ""));
values->push_back
(G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
values->push_back(G4AttValue("PID", G4UIcommand::ConvertToString(fParentID), ""));
values->push_back
(G4AttValue("Status",G4UIcommand::ConvertToString(fTrackStatus),""));
values->push_back(G4AttValue("Status", G4UIcommand::ConvertToString(fTrackStatus), ""));
values->push_back(G4AttValue("PN",fParticleName,""));
values->push_back(G4AttValue("PN", fParticleName, ""));
values->push_back
(G4AttValue("Ch",G4UIcommand::ConvertToString(fPDGCharge),""));
values->push_back(G4AttValue("Ch", G4UIcommand::ConvertToString(fPDGCharge), ""));
values->push_back
(G4AttValue("PDG",G4UIcommand::ConvertToString(fPDGEncoding),""));
values->push_back(G4AttValue("PDG", G4UIcommand::ConvertToString(fPDGEncoding), ""));
values->push_back
(G4AttValue("IMom",G4BestUnit(fMomentum,"Energy"),""));
values->push_back(G4AttValue("IMom", G4BestUnit(fMomentum, "Energy"), ""));
values->push_back
(G4AttValue("IMag",G4BestUnit(fMomentum.mag(),"Energy"),""));
values->push_back(G4AttValue("IMag", G4BestUnit(fMomentum.mag(), "Energy"), ""));
values->push_back
(G4AttValue("VtxPos",G4BestUnit(fVertexPosition,"Length"),""));
values->push_back(G4AttValue("VtxPos", G4BestUnit(fVertexPosition, "Length"), ""));
values->push_back
(G4AttValue("NTP",G4UIcommand::ConvertToString(GetPointEntries()),""));
values->push_back(G4AttValue("NTP", G4UIcommand::ConvertToString(GetPointEntries()), ""));
return values;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01Trajectory::AppendStep(const G4Step* aStep)
{
fPositionRecord->push_back(
new G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition() ));
fPositionRecord->push_back(new G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE01Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
{
if(!secondTrajectory) return;
if (!secondTrajectory) return;
RE01Trajectory* seco = (RE01Trajectory*)secondTrajectory;
G4int ent = seco->GetPointEntries();
//
// initial point of the second trajectory should not be merged
for(int i=1;i<ent;i++)
{
for (int i = 1; i < ent; i++) {
fPositionRecord->push_back((*(seco->fPositionRecord))[i]);
}
delete (*seco->fPositionRecord)[0];
seco->fPositionRecord->clear();
}