Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -2,7 +2,30 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
find_package(Geant4)
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
add_subdirectory(exgps)
add_subdirectory(HepMC)
add_subdirectory(particleGun)
add_subdirectory(pythia/decayer6)
#----------------------------------------------------------------------------
# HepMC examples require HepMC
#
find_package(HepMC QUIET)
if(HEPMC_FOUND)
add_subdirectory(HepMC)
else()
message(STATUS "G4 Examples: HepMC package not found. --> HepMC examples disabled.")
endif()
#----------------------------------------------------------------------------
# decayer6 example requires Pythia6
#
find_package(Pythia6 QUIET)
if(PYTHIA6_FOUND)
add_subdirectory(pythia/decayer6)
else()
message(STATUS "G4 Examples: Pythia6 package not found. --> decayer6 example disabled.")
endif()
@@ -2,6 +2,14 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
find_package(Geant4)
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# HepMC examples require HepMC
#
find_package(HepMC REQUIRED)
add_subdirectory(HepMCEx01)
add_subdirectory(HepMCEx02)
add_subdirectory(MCTruth)
@@ -5,16 +5,16 @@ $Id$
/*! \page ExampleHepMCEx01 Example HepMCEx01
HepMCEx01 is based on Example N04, which has a simplified collider detector
geometry. Only part of the primary generator action is replaced with new one.
HepMCEx01 is based on Example N04, which has a simplified collider detector
geometry. Only part of the primary generator action is replaced with new one.
This example demonstrates the following features.
\section ExampleHepMCEx01_s1 HepMC interface
ExN04PrimaryGeneratorAction has HepMCG4Interface as the generator.
There are two types of generators provided as samples. One generator reads
There are two types of generators provided as samples. One generator reads
primary information from a HepMC Ascii file (data/example_MyPythia.dat).
The other one generates primaries directly invoking PYTHIA routines
The other one generates primaries directly invoking PYTHIA routines
in every event.
\section ExampleHepMCEx01_s2 Readout geometry
@@ -30,7 +30,7 @@ a readout geometry to find the phi-z cell.
\section ExampleHepMCEx01_s3 Full set of "ordinary" physics processes
FTFP_BERT physics list defines almost all of leptons and hadrons which
Geant4 has dedicated classes for. Also almost all physics processes
Geant4 has dedicated classes for. Also almost all physics processes
Geant4 has are defined.
\section ExampleHepMCEx01_s4 Event filtering by the stacking mechanism.
@@ -48,10 +48,10 @@ ExN04StackingAction.
\section ExampleHepMCEx01_s5 Installation
See \ref Examples_HepMC how to build this example.
\section ExampleHepMCEx01_s6 Execution
\verbatim
% HepMCEx01 hepmc_pygen.in
\endverbatim
\endverbatim
*/
@@ -23,11 +23,7 @@ include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Find HepMC (required package)
#
find_package(HepMC QUIET)
if(NOT HEPMC_FOUND)
message(STATUS "G4 Examples: HepMC package not found. --> HepMCEx01 example disabled")
return()
endif()
find_package(HepMC REQUIRED)
#----------------------------------------------------------------------------
# Find Pythia6 (optional package)
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.6 2006-11-22 15:09:21 gcosmo Exp $
# $Id: GNUmakefile 73446 2013-08-27 11:32:59Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
@@ -1,4 +1,4 @@
$Id: History,v 1.15 2010-12-10 06:21:34 kmura Exp $
$Id: History 77801 2013-11-28 13:33:20Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -15,6 +15,12 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 13th 2013 K. Murakami
- new coding guideline
August 27th, 2013 G. Cosmo
- Added G4Ellipsoid among solids enabled for parameterisation.
November 21th, 2012 K. Murakami
- changed that AsciiReader uses IO_GenEvent instead of IO_AsciiParticles
- migration to CMake. CMakeLists.txt, added link to -lgfortran/-lg2c
@@ -1,4 +1,4 @@
$Id: README,v 1.3 2006-07-05 11:53:02 gcosmo Exp $
$Id: README 77801 2013-11-28 13:33:20Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -8,16 +8,16 @@ $Id: README,v 1.3 2006-07-05 11:53:02 gcosmo Exp $
HepMCEx01
---------
HepMCEx01 is based on ExampleN04, which has a simplified collider detector
geometry. Only part of the primary generator action is replaced with new one.
HepMCEx01 is based on ExampleN04, which has a simplified collider detector
geometry. Only part of the primary generator action is replaced with new one.
This example demonstrates the following features.
1. HepMC interface
ExN04PrimaryGeneratorAction has HepMCG4Interface as the generator.
There are two types of generators provided as samples. One generator reads
There are two types of generators provided as samples. One generator reads
primary information from a HepMC Ascii file (data/example_MyPythia.dat).
The other one generates primaries directly invoking PYTHIA routines
The other one generates primaries directly invoking PYTHIA routines
in every event.
2. Readout geometry
@@ -33,7 +33,7 @@ a readout geometry to find the phi-z cell.
3. Full set of "ordinary" physics processes
FTFP_BERT physics list defines almost all of leptons and hadrons which
Geant4 has dedicated classes for. Also almost all physics processes
Geant4 has dedicated classes for. Also almost all physics processes
Geant4 has are defined.
4. Event filtering by the stacking mechanism.
@@ -49,10 +49,10 @@ the isolated muons are tracked. All these examinations are applied in
ExN04StackingAction.
5. Installation
See HepMC/README how to build this example.
6. Execution
% HepMCEx01 hepmc_pygen.in
@@ -26,27 +26,24 @@
/// \file eventgenerator/HepMC/HepMCEx01/HepMCEx01.cc
/// \brief Main program of the eventgenerator/HepMC/HepMCEx01 example
//
// $Id: HepMCEx01.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// $Id$
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// --------------------------------------------------------------
// GEANT 4 - example derived from novice exampleN04
// --------------------------------------------------------------
#include "FTFP_BERT.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "ExN04DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "ExN04EventAction.hh"
#include "ExN04PrimaryGeneratorAction.hh"
#include "ExN04RunAction.hh"
#include "ExN04EventAction.hh"
#include "ExN04StackingAction.hh"
#include "ExN04TrackingAction.hh"
#include "ExN04SteppingAction.hh"
#include "ExN04SteppingVerbose.hh"
#include "ExN04TrackingAction.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
@@ -62,7 +59,7 @@ int main(int argc,char** argv)
//
G4VSteppingVerbose* verbosity = new ExN04SteppingVerbose;
G4VSteppingVerbose::SetInstance(verbosity);
// Run manager
//
G4RunManager* runManager = new G4RunManager;
@@ -74,7 +71,7 @@ int main(int argc,char** argv)
//
G4VUserPhysicsList* physics = new FTFP_BERT;
runManager->SetUserInitialization(physics);
runManager->Initialize();
// User Action classes
@@ -83,7 +80,7 @@ int main(int argc,char** argv)
runManager->SetUserAction(gen_action);
//
G4UserRunAction* run_action = new ExN04RunAction;
runManager->SetUserAction(run_action);
runManager->SetUserAction(run_action);
//
G4UserEventAction* event_action = new ExN04EventAction;
runManager->SetUserAction(event_action);
@@ -96,15 +93,15 @@ int main(int argc,char** argv)
//
G4UserSteppingAction* stepping_action = new ExN04SteppingAction;
runManager->SetUserAction(stepping_action);
#ifdef G4VIS_USE
// Visualization, if you choose to have it!
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
#endif
//get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
//get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (argc!=1) // batch mode
{
@@ -113,7 +110,7 @@ int main(int argc,char** argv)
#endif
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command+fileName);
}
else
{ // interactive mode : define UI session
@@ -136,4 +133,3 @@ int main(int argc,char** argv)
return 0;
}
@@ -26,86 +26,130 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04CalorimeterHit.hh
/// \brief Definition of the ExN04CalorimeterHit class
//
// $Id: ExN04CalorimeterHit.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04CalorimeterHit_h
#define ExN04CalorimeterHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4VHit.hh"
class ExN04CalorimeterHit : public G4VHit
{
public:
class ExN04CalorimeterHit : public G4VHit {
public:
ExN04CalorimeterHit();
ExN04CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi);
ExN04CalorimeterHit(const ExN04CalorimeterHit& right);
ExN04CalorimeterHit();
ExN04CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi);
~ExN04CalorimeterHit();
ExN04CalorimeterHit(const ExN04CalorimeterHit &right);
const ExN04CalorimeterHit& operator=(const ExN04CalorimeterHit &right);
G4int operator==(const ExN04CalorimeterHit &right) const;
virtual ~ExN04CalorimeterHit();
inline void *operator new(size_t);
inline void operator delete(void *aHit);
const ExN04CalorimeterHit& operator=(const ExN04CalorimeterHit& right);
G4int operator==(const ExN04CalorimeterHit& right) const;
void Draw();
void Print();
inline void* operator new(size_t);
inline void operator delete(void* aHit);
private:
G4int ZCellID;
G4int PhiCellID;
G4double edep;
G4ThreeVector pos;
G4RotationMatrix rot;
const G4LogicalVolume* pLogV;
virtual void Draw();
virtual void Print();
public:
inline void SetCellID(G4int z,G4int phi)
{
ZCellID = z;
PhiCellID = phi;
}
inline G4int GetZ() { return ZCellID; }
inline G4int GetPhi() { return PhiCellID; }
inline void SetEdep(G4double de)
{ edep = de; }
inline void AddEdep(G4double de)
{ edep += de; }
inline G4double GetEdep()
{ return edep; }
inline void SetPos(G4ThreeVector xyz)
{ pos = xyz; }
inline G4ThreeVector GetPos()
{ return pos; }
inline void SetRot(G4RotationMatrix rmat)
{ rot = rmat; }
inline G4RotationMatrix GetRot()
{ return rot; }
inline const G4LogicalVolume * GetLogV()
{ return pLogV; }
void SetCellID(G4int z,G4int phi);
G4int GetZ();
G4int GetPhi();
void SetEdep(G4double de);
void AddEdep(G4double de);
G4double GetEdep();
void SetPos(G4ThreeVector xyz);
G4ThreeVector GetPos();
void SetRot(G4RotationMatrix rmat);
G4RotationMatrix GetRot();
const G4LogicalVolume* GetLogV();
private:
G4int fZCellID;
G4int fPhiCellID;
G4double fedep;
G4ThreeVector fpos;
G4RotationMatrix frot;
const G4LogicalVolume* fpLogV;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void ExN04CalorimeterHit::SetCellID(G4int z,G4int phi)
{
fZCellID = z;
fPhiCellID = phi;
}
inline G4int ExN04CalorimeterHit::GetZ()
{
return fZCellID;
}
inline G4int ExN04CalorimeterHit::GetPhi()
{
return fPhiCellID;
}
inline void ExN04CalorimeterHit::SetEdep(G4double de)
{
fedep = de;
}
inline void ExN04CalorimeterHit::AddEdep(G4double de)
{
fedep += de;
}
inline G4double ExN04CalorimeterHit::GetEdep()
{
return fedep;
}
inline void ExN04CalorimeterHit::SetPos(G4ThreeVector xyz)
{
fpos = xyz;
}
inline G4ThreeVector ExN04CalorimeterHit::GetPos()
{
return fpos;
}
inline void ExN04CalorimeterHit::SetRot(G4RotationMatrix rmat)
{
frot = rmat;
}
inline G4RotationMatrix ExN04CalorimeterHit::GetRot()
{
return frot;
}
inline const G4LogicalVolume * ExN04CalorimeterHit::GetLogV()
{
return fpLogV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
typedef G4THitsCollection<ExN04CalorimeterHit> ExN04CalorimeterHitsCollection;
extern G4Allocator<ExN04CalorimeterHit> ExN04CalorimeterHitAllocator;
inline void* ExN04CalorimeterHit::operator new(size_t)
{
void *aHit;
aHit = (void *) ExN04CalorimeterHitAllocator.MallocSingle();
void* aHit;
aHit = (void*) ExN04CalorimeterHitAllocator.MallocSingle();
return aHit;
}
inline void ExN04CalorimeterHit::operator delete(void *aHit)
inline void ExN04CalorimeterHit::operator delete(void* aHit)
{
ExN04CalorimeterHitAllocator.FreeSingle((ExN04CalorimeterHit*) aHit);
}
#endif
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04CalorimeterParametrisation.hh
/// \brief Definition of the ExN04CalorimeterParametrisation class
//
// $Id: ExN04CalorimeterParametrisation.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04CalorimeterParametrisation_H
#define ExN04CalorimeterParametrisation_H 1
@@ -33,49 +35,58 @@
#include "globals.hh"
#include "G4VPVParameterisation.hh"
class G4VPhysicalVolume;
class G4Tubs;
class G4VPhysicalVolume;
// Dummy declarations to get rid of warnings ...
class G4Trd;
class G4Trap;
class G4Box;
class G4Cons;
class G4Ellipsoid;
class G4Hype;
class G4Orb;
class G4Sphere;
class G4Trd;
class G4Trap;
class G4Torus;
class G4Para;
class G4Hype;
class G4Box;
class G4Polycone;
class G4Polyhedra;
class ExN04CalorimeterParametrisation : public G4VPVParameterisation
{
public:
ExN04CalorimeterParametrisation();
virtual ~ExN04CalorimeterParametrisation();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
void ComputeDimensions( G4Tubs & calorimeterLayer,
const G4int copyNo,
const G4VPhysicalVolume * physVol) const;
class ExN04CalorimeterParametrisation : public G4VPVParameterisation {
public:
ExN04CalorimeterParametrisation();
virtual ~ExN04CalorimeterParametrisation();
private: // Dummy declarations to get rid of warnings ...
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume* physVol) const;
void ComputeDimensions(G4Tubs& calorimeterLayer, const G4int copyNo,
const G4VPhysicalVolume * physVol) 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 (G4Orb&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Sphere&,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 (G4Polycone&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*) 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(G4Orb&, 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(G4Polycone&, const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polyhedra&, const G4int,
const G4VPhysicalVolume*) const {}
#include "ExN04DetectorParameterDef.hh"
@@ -26,13 +26,15 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04CalorimeterROGeometry.hh
/// \brief Definition of the ExN04CalorimeterROGeometry class
//
// $Id: ExN04CalorimeterROGeometry.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04CalorimeterROGeometry_h
#define ExN04CalorimeterROGeometry_h 1
#include "G4VReadOutGeometry.hh"
class ExN04CalorimeterROGeometry : public G4VReadOutGeometry
{
class ExN04CalorimeterROGeometry : public G4VReadOutGeometry {
public:
ExN04CalorimeterROGeometry();
ExN04CalorimeterROGeometry(G4String);
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04CalorimeterSD.hh
/// \brief Definition of the ExN04CalorimeterSD class
//
// $Id: ExN04CalorimeterSD.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04CalorimeterSD_h
#define ExN04CalorimeterSD_h 1
@@ -36,29 +38,24 @@ class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class ExN04CalorimeterSD : public G4VSensitiveDetector
{
class ExN04CalorimeterSD : public G4VSensitiveDetector {
public:
ExN04CalorimeterSD(G4String name);
~ExN04CalorimeterSD();
public:
ExN04CalorimeterSD(G4String name);
~ExN04CalorimeterSD();
virtual void Initialize(G4HCofThisEvent*HCE);
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
virtual void EndOfEvent(G4HCofThisEvent*HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
ExN04CalorimeterHitsCollection* fCalCollection;
int fCellID[20][48];
const int fnumberOfCellsInZ;
const int fnumberOfCellsInPhi;
private:
ExN04CalorimeterHitsCollection *CalCollection;
int CellID[20][48];
const int numberOfCellsInZ;
const int numberOfCellsInPhi;
};
#endif
@@ -26,37 +26,35 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04DetectorConstruction.hh
/// \brief Definition of the ExN04DetectorConstruction class
//
// $Id: ExN04DetectorConstruction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04DetectorConstruction_h
#define ExN04DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
class G4VPhysicalVolume;
class G4Material;
class ExN04DetectorConstruction : public G4VUserDetectorConstruction
{
public:
ExN04DetectorConstruction();
~ExN04DetectorConstruction();
class ExN04DetectorConstruction : public G4VUserDetectorConstruction {
public:
ExN04DetectorConstruction();
~ExN04DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
virtual G4VPhysicalVolume* Construct();
private:
void DefineMaterials();
private:
void DefineMaterials();
#include "ExN04DetectorParameterDef.hh"
G4Material* Air;
G4Material* Ar;
G4Material* Silicon;
G4Material* Scinti;
G4Material* Lead;
G4Material* fAir;
G4Material* fAr;
G4Material* fSilicon;
G4Material* fScinti;
G4Material* fLead;
};
#endif
@@ -26,50 +26,50 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04DetectorParameterDef.hh
/// \brief Definition of the ExN04DetectorParameterDef class
//
// $Id: ExN04DetectorParameterDef.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
G4double expHall_x;
G4double expHall_y;
G4double expHall_z;
G4double fexpHall_x;
G4double fexpHall_y;
G4double fexpHall_z;
G4double trkTubs_rmax;
G4double trkTubs_rmin;
G4double trkTubs_dz;
G4double trkTubs_sphi;
G4double trkTubs_dphi;
G4double ftrkTubs_rmax;
G4double ftrkTubs_rmin;
G4double ftrkTubs_dz;
G4double ftrkTubs_sphi;
G4double ftrkTubs_dphi;
G4int notrkLayers;
G4double tracker_radius[5];
G4double tracker_thick;
G4double tracker_length[5];
G4int fnotrkLayers;
G4double ftracker_radius[5];
G4double ftracker_thick;
G4double ftracker_length[5];
G4double caloTubs_rmax;
G4double caloTubs_rmin;
G4double caloTubs_dz;
G4double caloTubs_sphi;
G4double caloTubs_dphi;
G4double fcaloTubs_rmax;
G4double fcaloTubs_rmin;
G4double fcaloTubs_dz;
G4double fcaloTubs_sphi;
G4double fcaloTubs_dphi;
G4int nocaloLayers;
G4double absorber_thick;
G4double scinti_thick;
G4int fnocaloLayers;
G4double fabsorber_thick;
G4double fscinti_thick;
G4int segmentsinZ;
G4double caloRing_rmax;
G4double caloRing_rmin;
G4double caloRing_dz;
G4double caloRing_sphi;
G4double caloRing_dphi;
G4int segmentsinPhi;
G4double caloCell_rmax;
G4double caloCell_rmin;
G4double caloCell_dz;
G4double caloCell_sphi;
G4double caloCell_dphi;
G4int nomucounter;
G4double muBox_radius;
G4double muBox_width;
G4double muBox_thick;
G4double muBox_length;
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 fnomucounter;
G4double fmuBox_radius;
G4double fmuBox_width;
G4double fmuBox_thick;
G4double fmuBox_length;
@@ -26,7 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04DummySD.hh
/// \brief Definition of the ExN04DummySD class
//
// $Id: ExN04DummySD.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// Dummy sensitive used only to flag sensitivity
// in cells of RO geometry.
//
@@ -37,12 +39,11 @@
#include "G4VSensitiveDetector.hh"
class G4Step;
class ExN04DummySD : public G4VSensitiveDetector
{
class ExN04DummySD : public G4VSensitiveDetector {
public:
ExN04DummySD();
~ExN04DummySD() {}
void Initialize(G4HCofThisEvent*) {}
G4bool ProcessHits(G4Step*,G4TouchableHistory*) {return false;}
void EndOfEvent(G4HCofThisEvent*) {}
@@ -50,7 +51,11 @@ public:
void DrawAll() {}
void PrintAll() {}
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04DummySD::ExN04DummySD()
: G4VSensitiveDetector("dummySD")
{}
{
}
#endif
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04EventAction.hh
/// \brief Definition of the ExN04EventAction class
//
// $Id: ExN04EventAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04EventAction_h
#define ExN04EventAction_h 1
@@ -33,22 +35,18 @@
#include "G4UserEventAction.hh"
#include "globals.hh"
class ExN04EventAction : public G4UserEventAction
{
public:
ExN04EventAction();
~ExN04EventAction();
class ExN04EventAction : public G4UserEventAction {
public:
ExN04EventAction();
~ExN04EventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
private:
G4int trackerCollID;
G4int calorimeterCollID;
G4int muonCollID;
private:
G4int ftrackerCollID;
G4int fcalorimeterCollID;
G4int fmuonCollID;
};
#endif
@@ -26,27 +26,26 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04Field.hh
/// \brief Definition of the ExN04Field class
//
// $Id: ExN04Field.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04Field_H
#define ExN04Field_H 1
#include "globals.hh"
#include "G4MagneticField.hh"
#include "globals.hh"
class ExN04Field : public G4MagneticField
{
public:
ExN04Field();
~ExN04Field();
class ExN04Field : public G4MagneticField {
public:
ExN04Field();
~ExN04Field();
void GetFieldValue( const double Point[3],
double *Bfield ) const;
void GetFieldValue( const double Point[3], double *Bfield ) const;
private:
G4double Bz;
G4double rmax_sq;
G4double zmax;
private:
G4double fBz;
G4double frmax_sq;
G4double fzmax;
};
#endif
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04MuonHit.hh
/// \brief Definition of the ExN04MuonHit class
//
// $Id: ExN04MuonHit.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04MuonHit_h
#define ExN04MuonHit_h 1
@@ -35,48 +37,39 @@
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
class ExN04MuonHit : public G4VHit
{
public:
class ExN04MuonHit : public G4VHit {
public:
ExN04MuonHit();
~ExN04MuonHit();
ExN04MuonHit(const ExN04MuonHit& right);
const ExN04MuonHit& operator=(const ExN04MuonHit &right);
G4int operator==(const ExN04MuonHit &right) const;
ExN04MuonHit();
~ExN04MuonHit();
ExN04MuonHit(const ExN04MuonHit &right);
const ExN04MuonHit& operator=(const ExN04MuonHit &right);
G4int operator==(const ExN04MuonHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual void Print();
inline void *operator new(size_t);
inline void operator delete(void *aHit);
void Draw();
void Print();
private:
G4double edep;
G4ThreeVector pos;
public:
inline void SetEdep(G4double de)
{ edep = de; }
inline void AddEdep(G4double de)
{ edep += de; }
inline G4double GetEdep()
{ return edep; }
inline void SetPos(G4ThreeVector xyz)
{ pos = xyz; }
inline G4ThreeVector GetPos()
{ return pos; }
inline void SetEdep(G4double de) { fedep = de; }
inline void AddEdep(G4double de) { fedep += de; }
inline G4double GetEdep() { return fedep; }
inline void SetPos(G4ThreeVector xyz) { fpos = xyz; }
inline G4ThreeVector GetPos() { return fpos; }
private:
G4double fedep;
G4ThreeVector fpos;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
typedef G4THitsCollection<ExN04MuonHit> ExN04MuonHitsCollection;
extern G4Allocator<ExN04MuonHit> ExN04MuonHitAllocator;
inline void* ExN04MuonHit::operator new(size_t)
{
void *aHit;
void* aHit;
aHit = (void *) ExN04MuonHitAllocator.MallocSingle();
return aHit;
}
@@ -87,5 +80,3 @@ inline void ExN04MuonHit::operator delete(void *aHit)
}
#endif
@@ -26,38 +26,35 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04MuonSD.hh
/// \brief Definition of the ExN04MuonSD class
//
// $Id: ExN04MuonSD.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04MuonSD_h
#define ExN04MuonSD_h 1
#include "G4VSensitiveDetector.hh"
#include "ExN04MuonHit.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class ExN04MuonSD : public G4VSensitiveDetector
{
class ExN04MuonSD : public G4VSensitiveDetector {
public:
ExN04MuonSD(G4String name);
~ExN04MuonSD();
public:
ExN04MuonSD(G4String name);
~ExN04MuonSD();
void Initialize(G4HCofThisEvent* HCE);
G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
void EndOfEvent(G4HCofThisEvent* HCE);
void clear();
void DrawAll();
void PrintAll();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
ExN04MuonHitsCollection * muonCollection;
G4double positionResolution;
private:
ExN04MuonHitsCollection * muonCollection;
G4double positionResolution;
};
#endif
@@ -26,12 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04PrimaryGeneratorAction.hh
/// \brief Definition of the ExN04PrimaryGeneratorAction class
//
// ====================================================================
// $Id: ExN04PrimaryGeneratorAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// ExN04PrimaryGeneratorAction.hh
// $Id$
//
// ====================================================================
#ifndef EXN04_PRIMARY_GENERATOR_ACTION_H
#define EXN04_PRIMARY_GENERATOR_ACTION_H
@@ -44,17 +41,6 @@ class G4VPrimaryGenerator;
class ExN04PrimaryGeneratorMessenger;
class ExN04PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
private:
G4VPrimaryGenerator* particleGun;
G4VPrimaryGenerator* hepmcAscii;
G4VPrimaryGenerator* pythiaGen;
G4VPrimaryGenerator* currentGenerator;
G4String currentGeneratorName;
std::map<G4String, G4VPrimaryGenerator*> gentypeMap;
ExN04PrimaryGeneratorMessenger* messenger;
public:
ExN04PrimaryGeneratorAction();
~ExN04PrimaryGeneratorAction();
@@ -66,35 +52,44 @@ public:
G4VPrimaryGenerator* GetGenerator() const;
G4String GetGeneratorName() const;
private:
G4VPrimaryGenerator* particleGun;
G4VPrimaryGenerator* hepmcAscii;
G4VPrimaryGenerator* pythiaGen;
G4VPrimaryGenerator* currentGenerator;
G4String currentGeneratorName;
std::map<G4String, G4VPrimaryGenerator*> gentypeMap;
ExN04PrimaryGeneratorMessenger* messenger;
};
// ====================================================================
// inline functions
// ====================================================================
inline void ExN04PrimaryGeneratorAction::SetGenerator
(G4VPrimaryGenerator* gen)
{
currentGenerator= gen;
}
inline void ExN04PrimaryGeneratorAction::SetGenerator(G4String genname)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void ExN04PrimaryGeneratorAction::SetGenerator(G4VPrimaryGenerator* gen)
{
std::map<G4String, G4VPrimaryGenerator*>::iterator pos= gentypeMap.find(genname);
if(pos != gentypeMap.end()) {
currentGenerator= pos->second;
currentGeneratorName= genname;
}
currentGenerator = gen;
}
inline G4VPrimaryGenerator* ExN04PrimaryGeneratorAction::GetGenerator() const
{
return currentGenerator;
inline void ExN04PrimaryGeneratorAction::SetGenerator(G4String genname)
{
std::map<G4String, G4VPrimaryGenerator*>::iterator pos =
gentypeMap.find(genname);
if ( pos != gentypeMap.end() ) {
currentGenerator = pos->second;
currentGeneratorName = genname;
}
}
inline G4String ExN04PrimaryGeneratorAction::GetGeneratorName() const
{
return currentGeneratorName;
inline G4VPrimaryGenerator* ExN04PrimaryGeneratorAction::GetGenerator() const
{
return currentGenerator;
}
inline G4String ExN04PrimaryGeneratorAction::GetGeneratorName() const
{
return currentGeneratorName;
}
#endif
@@ -26,27 +26,31 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04PrimaryGeneratorMessenger.hh
/// \brief Definition of the ExN04PrimaryGeneratorMessenger class
//
// ====================================================================
// $Id: ExN04PrimaryGeneratorMessenger.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// ExN04PrimaryGeneratorMessenger.hh
// $Id$
//
// ====================================================================
#ifndef EXN04_PRIMARY_GENERATOR_MESSENGER_H
#define EXN04_PRIMARY_GENERATOR_MESSENGER_H
#include "globals.hh"
#include "G4UImessenger.hh"
class ExN04PrimaryGeneratorAction;
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithoutParameter;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class G4UIcmdWithAString;
class ExN04PrimaryGeneratorAction;
class ExN04PrimaryGeneratorMessenger : public G4UImessenger {
public:
ExN04PrimaryGeneratorMessenger(ExN04PrimaryGeneratorAction* genaction);
~ExN04PrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
private:
ExN04PrimaryGeneratorAction* primaryAction;
@@ -54,13 +58,6 @@ private:
G4UIdirectory* mydetdir;
G4UIcmdWithAString* select;
public:
ExN04PrimaryGeneratorMessenger(ExN04PrimaryGeneratorAction* genaction);
~ExN04PrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
};
#endif
@@ -26,9 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04RunAction.hh
/// \brief Definition of the ExN04RunAction class
//
// $Id: ExN04RunAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -38,25 +37,14 @@
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4Run;
class ExN04RunAction : public G4UserRunAction
{
public:
ExN04RunAction();
~ExN04RunAction();
class ExN04RunAction : public G4UserRunAction {
public:
ExN04RunAction();
~ExN04RunAction();
public:
void BeginOfRunAction(const G4Run*);
void BeginOfRunAction(const G4Run*);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -26,55 +26,52 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04StackingAction.hh
/// \brief Definition of the ExN04StackingAction class
//
// $Id: ExN04StackingAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04StackingAction_H
#define ExN04StackingAction_H 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
#include "G4ThreeVector.hh"
class G4Track;
#include "G4UserStackingAction.hh"
#include "ExN04TrackerHit.hh"
#include "ExN04MuonHit.hh"
class G4Track;
class ExN04StackingActionMessenger;
class ExN04StackingAction : public G4UserStackingAction
{
public:
ExN04StackingAction();
virtual ~ExN04StackingAction();
class ExN04StackingAction : public G4UserStackingAction {
public:
ExN04StackingAction();
virtual ~ExN04StackingAction();
public:
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
private:
G4bool InsideRoI(const G4Track * aTrack,G4double ang);
G4VHitsCollection* GetCollection(G4String colName);
ExN04TrackerHitsCollection* trkHits;
ExN04MuonHitsCollection* muonHits;
ExN04StackingActionMessenger* theMessenger;
inline void SetNRequestMuon(G4int val) { reqMuon = val; }
inline G4int GetNRequestMuon() const { return reqMuon; }
inline void SetNRequestIsoMuon(G4int val) { reqIsoMuon = val; }
inline G4int GetNRequestIsoMuon() const { return reqIsoMuon; }
inline void SetNIsolation(G4int val) { reqIso = val; }
inline G4int GetNIsolation() const { return reqIso; }
inline void SetRoIAngle(G4double val) { angRoI = val; }
inline G4double GetRoIAngle() const { return angRoI; }
G4int stage;
G4int reqMuon;
G4int reqIsoMuon;
G4int reqIso;
G4double angRoI;
public:
inline void SetNRequestMuon(G4int val) { reqMuon = val; }
inline G4int GetNRequestMuon() const { return reqMuon; }
inline void SetNRequestIsoMuon(G4int val) { reqIsoMuon = val; }
inline G4int GetNRequestIsoMuon() const { return reqIsoMuon; }
inline void SetNIsolation(G4int val) { reqIso = val; }
inline G4int GetNIsolation() const { return reqIso; }
inline void SetRoIAngle(G4double val) { angRoI = val; }
inline G4double GetRoIAngle() const { return angRoI; }
private:
G4bool InsideRoI(const G4Track * aTrack,G4double ang);
G4VHitsCollection* GetCollection(G4String colName);
ExN04TrackerHitsCollection* trkHits;
ExN04MuonHitsCollection* muonHits;
ExN04StackingActionMessenger* theMessenger;
G4int stage;
G4int reqMuon;
G4int reqIsoMuon;
G4int reqIso;
G4double angRoI;
};
#endif
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04StackingActionMessenger.hh
/// \brief Definition of the ExN04StackingActionMessenger class
//
// $Id: ExN04StackingActionMessenger.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04StackingActionMessenger_h
#define ExN04StackingActionMessenger_h 1
@@ -37,27 +39,22 @@ class G4UIcmdWithADoubleAndUnit;
#include "G4UImessenger.hh"
#include "globals.hh"
class ExN04StackingActionMessenger: public G4UImessenger
{
public:
ExN04StackingActionMessenger(ExN04StackingAction* msa);
~ExN04StackingActionMessenger();
public:
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
class ExN04StackingActionMessenger: public G4UImessenger {
public:
ExN04StackingActionMessenger(ExN04StackingAction* msa);
~ExN04StackingActionMessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
private:
ExN04StackingAction * myAction;
G4UIcmdWithAnInteger * muonCmd;
G4UIcmdWithAnInteger * isomuonCmd;
G4UIcmdWithAnInteger * isoCmd;
G4UIcmdWithADoubleAndUnit * roiCmd;
private:
ExN04StackingAction * myAction;
private: //commands
G4UIcmdWithAnInteger * muonCmd;
G4UIcmdWithAnInteger * isomuonCmd;
G4UIcmdWithAnInteger * isoCmd;
G4UIcmdWithADoubleAndUnit * roiCmd;
};
#endif
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04SteppingAction.hh
/// \brief Definition of the ExN04SteppingAction class
//
// $Id: ExN04SteppingAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04SteppingAction_H
#define ExN04SteppingAction_H 1
@@ -33,14 +35,12 @@
#include "globals.hh"
#include "G4UserSteppingAction.hh"
class ExN04SteppingAction : public G4UserSteppingAction
{
public:
ExN04SteppingAction();
virtual ~ExN04SteppingAction();
class ExN04SteppingAction : public G4UserSteppingAction {
public:
ExN04SteppingAction();
virtual ~ExN04SteppingAction();
virtual void UserSteppingAction(const G4Step*);
virtual void UserSteppingAction(const G4Step*);
};
#endif
@@ -26,37 +26,28 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04SteppingVerbose.hh
/// \brief Definition of the ExN04SteppingVerbose class
//
// $Id: ExN04SteppingVerbose.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// $Id$
//
// This class manages the verbose outputs in G4SteppingManager.
// This class manages the verbose outputs in G4SteppingManager.
// It inherits from G4SteppingVerbose.
// It shows how to extract informations during the tracking of a particle.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN04SteppingVerbose;
#ifndef ExN04SteppingVerbose_h
#define ExN04SteppingVerbose_h 1
#include "G4SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN04SteppingVerbose;
class ExN04SteppingVerbose : public G4SteppingVerbose
{
public:
class ExN04SteppingVerbose : public G4SteppingVerbose {
public:
ExN04SteppingVerbose();
~ExN04SteppingVerbose();
~ExN04SteppingVerbose();
void StepInfo();
void TrackingStarted();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -26,54 +26,50 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04TrackerHit.hh
/// \brief Definition of the ExN04TrackerHit class
//
// $Id: ExN04TrackerHit.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04TrackerHit_h
#define ExN04TrackerHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4VHit.hh"
class ExN04TrackerHit : public G4VHit
{
public:
class ExN04TrackerHit : public G4VHit {
public:
ExN04TrackerHit();
~ExN04TrackerHit();
ExN04TrackerHit(const ExN04TrackerHit &right);
const ExN04TrackerHit& operator=(const ExN04TrackerHit &right);
G4int operator==(const ExN04TrackerHit &right) const;
ExN04TrackerHit();
~ExN04TrackerHit();
ExN04TrackerHit(const ExN04TrackerHit &right);
const ExN04TrackerHit& operator=(const ExN04TrackerHit &right);
G4int operator==(const ExN04TrackerHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
inline void *operator new(size_t);
inline void operator delete(void *aHit);
void Draw();
void Print();
void Draw();
void Print();
private:
G4double edep;
G4ThreeVector pos;
public:
inline void SetEdep(G4double de)
{ edep = de; }
inline G4double GetEdep()
{ return edep; }
inline void SetPos(G4ThreeVector xyz)
{ pos = xyz; }
inline G4ThreeVector GetPos()
{ return pos; }
inline void SetEdep(G4double de) { edep = de; }
inline G4double GetEdep() { return edep; }
inline void SetPos(G4ThreeVector xyz) { pos = xyz; }
inline G4ThreeVector GetPos() { return pos; }
private:
G4double edep;
G4ThreeVector pos;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
typedef G4THitsCollection<ExN04TrackerHit> ExN04TrackerHitsCollection;
extern G4Allocator<ExN04TrackerHit> ExN04TrackerHitAllocator;
inline void* ExN04TrackerHit::operator new(size_t)
{
void *aHit;
void* aHit;
aHit = (void *) ExN04TrackerHitAllocator.MallocSingle();
return aHit;
}
@@ -84,5 +80,3 @@ inline void ExN04TrackerHit::operator delete(void *aHit)
}
#endif
@@ -25,6 +25,8 @@
//
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04TrackerParametrisation.hh
/// \brief Definition of the ExN04TrackerParametrisation class
// $Id: ExN04TrackerParametrisation.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
//
#ifndef ExN04TrackerParametrisation_H
@@ -33,49 +35,58 @@
#include "globals.hh"
#include "G4VPVParameterisation.hh"
class G4VPhysicalVolume;
class G4Tubs;
class G4VPhysicalVolume;
// Dummy declarations to get rid of warnings ...
class G4Trd;
class G4Trap;
class G4Cons;
class G4Orb;
class G4Sphere;
class G4Torus;
class G4Para;
class G4Hype;
class G4Box;
class G4Cons;
class G4Ellipsoid;
class G4Hype;
class G4Orb;
class G4Para;
class G4Polycone;
class G4Polyhedra;
class G4Sphere;
class G4Torus;
class G4Trap;
class G4Trd;
class ExN04TrackerParametrisation : public G4VPVParameterisation
{
public:
ExN04TrackerParametrisation();
virtual ~ExN04TrackerParametrisation();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const;
void ComputeDimensions( G4Tubs & trackerLayer,
const G4int copyNo,
const G4VPhysicalVolume * physVol) const;
class ExN04TrackerParametrisation : public G4VPVParameterisation {
public:
ExN04TrackerParametrisation();
virtual ~ExN04TrackerParametrisation();
void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume* physVol) const;
void ComputeDimensions(G4Tubs& trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Trd&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trap&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Cons&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Orb&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Sphere&,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 (G4Polycone&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const {}
private:
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(G4Orb&,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(G4Polycone&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions(G4Polyhedra&, const G4int,
const G4VPhysicalVolume*) const {}
#include "ExN04DetectorParameterDef.hh"
@@ -26,38 +26,34 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04TrackerSD.hh
/// \brief Definition of the ExN04TrackerSD class
//
// $Id: ExN04TrackerSD.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04TrackerSD_h
#define ExN04TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "ExN04TrackerHit.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class ExN04TrackerSD : public G4VSensitiveDetector
{
class ExN04TrackerSD : public G4VSensitiveDetector {
public:
ExN04TrackerSD(G4String name);
~ExN04TrackerSD();
public:
ExN04TrackerSD(G4String name);
~ExN04TrackerSD();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
ExN04TrackerHitsCollection *trackerCollection;
private:
ExN04TrackerHitsCollection *trackerCollection;
public:
};
#endif
@@ -26,21 +26,20 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/ExN04TrackingAction.hh
/// \brief Definition of the ExN04TrackingAction class
//
// $Id: ExN04TrackingAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
#ifndef ExN04TrackingAction_h
#define ExN04TrackingAction_h 1
#include "G4UserTrackingAction.hh"
class ExN04TrackingAction : public G4UserTrackingAction {
public:
ExN04TrackingAction(){};
virtual ~ExN04TrackingAction(){};
public:
ExN04TrackingAction(){};
virtual ~ExN04TrackingAction(){};
virtual void PreUserTrackingAction(const G4Track*);
virtual void PreUserTrackingAction(const G4Track*);
};
#endif
@@ -26,12 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4AsciiReader.hh
/// \brief Definition of the HepMCG4AsciiReader class
//
// ====================================================================
// $Id: HepMCG4AsciiReader.hh 73446 2013-08-27 11:32:59Z gcosmo $
//
// HepMCG4AsciiReader.hh
// $Id$
//
// ====================================================================
#ifndef HEPMC_G4_ASCII_READER_H
#define HEPMC_G4_ASCII_READER_H
@@ -26,12 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4AsciiReaderMessenger.hh
/// \brief Definition of the HepMCG4AsciiReaderMessenger class
//
// ====================================================================
// $Id: HepMCG4AsciiReaderMessenger.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4AsciiReaderMessenger.hh
// $Id$
//
// ====================================================================
#ifndef HEPMC_G4_ASCII_READER_MESSENGER_H
#define HEPMC_G4_ASCII_READER_MESSENGER_H
@@ -44,6 +41,13 @@ class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class HepMCG4AsciiReaderMessenger : public G4UImessenger {
public:
HepMCG4AsciiReaderMessenger(HepMCG4AsciiReader* agen);
~HepMCG4AsciiReaderMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
private:
HepMCG4AsciiReader* gen;
@@ -51,12 +55,6 @@ private:
G4UIcmdWithAnInteger* verbose;
G4UIcmdWithAString* open;
public:
HepMCG4AsciiReaderMessenger(HepMCG4AsciiReader* agen);
~HepMCG4AsciiReaderMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
};
#endif
@@ -26,21 +26,18 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4Interface.hh
/// \brief Definition of the HepMCG4Interface class
//
// ====================================================================
// $Id: HepMCG4Interface.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4Interface.hh
// $Id$
//
// A base class for primary generation via HepMC object.
// This class is derived from G4VPrimaryGenerator.
//
// ====================================================================
#ifndef HEPMC_G4_INTERFACE_H
#define HEPMC_G4_INTERFACE_H
#include "G4VPrimaryGenerator.hh"
#include "HepMC/GenEvent.h"
/// A base class for primary generation via HepMC object.
/// This class is derived from G4VPrimaryGenerator.
class HepMCG4Interface : public G4VPrimaryGenerator {
protected:
// Note that the life of HepMC event object must be handled by users.
@@ -50,7 +47,7 @@ protected:
// We have to take care for the position of primaries because
// primary vertices outside the world voulme give rise to G4Execption.
// If the default implementation is not adequate, an alternative
// If the default implementation is not adequate, an alternative
// can be implemented in your own class.
virtual G4bool CheckVertexInsideWorld(const G4ThreeVector& pos) const;
@@ -61,7 +58,7 @@ protected:
// An empty event will be created in default.
virtual HepMC::GenEvent* GenerateHepMCEvent();
public:
public:
HepMCG4Interface();
virtual ~HepMCG4Interface();
@@ -73,13 +70,10 @@ public:
virtual void GeneratePrimaryVertex(G4Event* anEvent);
};
// ====================================================================
// inline functions
// ====================================================================
inline HepMC::GenEvent* HepMCG4Interface::GetHepMCGenEvent() const
{
return hepmcEvent;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline HepMC::GenEvent* HepMCG4Interface::GetHepMCGenEvent() const
{
return hepmcEvent;
}
#endif
@@ -26,14 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4PythiaInterface.hh
/// \brief Definition of the HepMCG4PythiaInterface class
//
// ====================================================================
// $Id: HepMCG4PythiaInterface.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4PythiaInterface.hh
// $Id$
//
// A generic interface class with Pythia event generator via HepMC.
//
// ====================================================================
#ifndef HEPMC_G4_PYTHIA_INTERFACE_H
#define HEPMC_G4_PYTHIA_INTERFACE_H
@@ -42,6 +37,8 @@
class HepMCG4PythiaMessenger;
/// A generic interface class with Pythia event generator via HepMC.
class HepMCG4PythiaInterface : public HepMCG4Interface {
protected:
G4int verbose;
@@ -50,7 +47,7 @@ protected:
HepMCG4PythiaMessenger* messenger;
// In default, this is automatic conversion, Pythia->HEPEVT->HepMC,
// In default, this is automatic conversion, Pythia->HEPEVT->HepMC,
// by HepMC utilities.
virtual HepMC::GenEvent* GenerateHepMCEvent();
@@ -60,13 +57,13 @@ public:
// set/get methods
void SetVerboseLevel(G4int i);
G4int GetVerboseLevel() const;
G4int GetVerboseLevel() const;
void SetPylist(G4int i);
G4int GetPylist() const;
G4int GetPylist() const;
// call pyxxx
void CallPyinit(G4String frame, G4String beam, G4String target,
void CallPyinit(G4String frame, G4String beam, G4String target,
G4double win);
void CallPystat(G4int istat);
@@ -84,10 +81,7 @@ public:
virtual void Print() const;
};
// ====================================================================
// inline functions
// ====================================================================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void HepMCG4PythiaInterface::SetVerboseLevel(G4int i)
{
verbose= i;
@@ -26,12 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4PythiaMessenger.hh
/// \brief Definition of the HepMCG4PythiaMessenger class
//
// ====================================================================
// $Id: HepMCG4PythiaMessenger.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4GenericPythiaMessenger.hh
// $Id$
//
// ====================================================================
#ifndef HEPMC_G4_PYTHIA_MESSENGER_H
#define HEPMC_G4_PYTHIA_MESSENGER_H
@@ -59,7 +56,7 @@ private:
G4UIcommand* cpyrget;
G4UIcommand* cpyrset;
G4UIcmdWithAString* printRandomStatus;
public:
HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen);
~HepMCG4PythiaMessenger();
@@ -26,71 +26,87 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04CalorimeterHit.cc
/// \brief Implementation of the ExN04CalorimeterHit class
//
// $Id: ExN04CalorimeterHit.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04CalorimeterHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
#include "ExN04CalorimeterHit.hh"
G4Allocator<ExN04CalorimeterHit> ExN04CalorimeterHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterHit::ExN04CalorimeterHit()
{pLogV=0;}
: fpLogV(NULL)
{
}
ExN04CalorimeterHit::ExN04CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi)
: ZCellID(z), PhiCellID(phi), pLogV(logVol)
{;}
ExN04CalorimeterHit::~ExN04CalorimeterHit()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterHit::ExN04CalorimeterHit(G4LogicalVolume* logVol,
G4int z, G4int phi)
: fZCellID(z), fPhiCellID(phi), fpLogV(logVol)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterHit::ExN04CalorimeterHit(const ExN04CalorimeterHit &right)
: G4VHit()
{
ZCellID = right.ZCellID;
PhiCellID = right.PhiCellID;
edep = right.edep;
pos = right.pos;
rot = right.rot;
pLogV = right.pLogV;
fZCellID = right.fZCellID;
fPhiCellID = right.fPhiCellID;
fedep = right.fedep;
fpos = right.fpos;
frot = right.frot;
fpLogV = right.fpLogV;
}
const ExN04CalorimeterHit& ExN04CalorimeterHit::operator=(const ExN04CalorimeterHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterHit::~ExN04CalorimeterHit()
{
ZCellID = right.ZCellID;
PhiCellID = right.PhiCellID;
edep = right.edep;
pos = right.pos;
rot = right.rot;
pLogV = right.pLogV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const ExN04CalorimeterHit& ExN04CalorimeterHit::operator=
(const ExN04CalorimeterHit &right)
{
fZCellID = right.fZCellID;
fPhiCellID = right.fPhiCellID;
fedep = right.fedep;
fpos = right.fpos;
frot = right.frot;
fpLogV = right.fpLogV;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int ExN04CalorimeterHit::operator==(const ExN04CalorimeterHit &right) const
{
return ((ZCellID==right.ZCellID)&&(PhiCellID==right.PhiCellID));
return ( (fZCellID == right.fZCellID) &&
(fPhiCellID == right.fPhiCellID) );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Transform3D trans(rot,pos);
if(pVVisManager) {
G4Transform3D trans(frot, fpos);
G4VisAttributes attribs;
const G4VisAttributes* pVA = pLogV->GetVisAttributes();
if(pVA) attribs = *pVA;
G4Colour colour(1.,0.,0.);
const G4VisAttributes* pVA = fpLogV-> GetVisAttributes();
if ( pVA ) attribs = *pVA;
G4Colour colour(1., 0., 0.);
attribs.SetColour(colour);
attribs.SetForceWireframe(false);
attribs.SetForceSolid(true);
pVVisManager->Draw(*pLogV,attribs,trans);
pVVisManager-> Draw(*fpLogV, attribs, trans);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterHit::Print()
{;}
{
}
@@ -26,37 +26,44 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04CalorimeterParametrisation.cc
/// \brief Implementation of the ExN04CalorimeterParametrisation class
//
// $Id: ExN04CalorimeterParametrisation.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04CalorimeterParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
#include "ExN04CalorimeterParametrisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterParametrisation::ExN04CalorimeterParametrisation()
{
#include "ExN04DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterParametrisation::~ExN04CalorimeterParametrisation()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterParametrisation::ComputeTransformation
(const G4int,G4VPhysicalVolume *physVol) const
(const G4int, G4VPhysicalVolume* physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
physVol-> SetTranslation(origin);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterParametrisation::ComputeDimensions
(G4Tubs & calorimeterLayer, const G4int copyNo, const G4VPhysicalVolume*) const
(G4Tubs& calorimeterLayer, const G4int copyNo,
const G4VPhysicalVolume*) const
{
G4double innerRad = caloTubs_rmin
+ copyNo*(absorber_thick+scinti_thick);
G4double innerRad = fcaloTubs_rmin +
copyNo * (fabsorber_thick + fscinti_thick);
calorimeterLayer.SetInnerRadius(innerRad);
calorimeterLayer.SetOuterRadius(innerRad+absorber_thick);
calorimeterLayer.SetZHalfLength(caloTubs_dz);
calorimeterLayer.SetStartPhiAngle(caloTubs_sphi);
calorimeterLayer.SetDeltaPhiAngle(caloTubs_dphi);
calorimeterLayer.SetOuterRadius(innerRad + fabsorber_thick);
calorimeterLayer.SetZHalfLength(fcaloTubs_dz);
calorimeterLayer.SetStartPhiAngle(fcaloTubs_sphi);
calorimeterLayer.SetDeltaPhiAngle(fcaloTubs_dphi);
}
@@ -26,84 +26,92 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04CalorimeterROGeometry.cc
/// \brief Implementation of the ExN04CalorimeterROGeometry class
//
#include "ExN04CalorimeterROGeometry.hh"
#include "ExN04DummySD.hh"
// $Id: ExN04CalorimeterROGeometry.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Material.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4VPhysicalVolume.hh"
#include "ExN04CalorimeterROGeometry.hh"
#include "ExN04DummySD.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterROGeometry::ExN04CalorimeterROGeometry()
: G4VReadOutGeometry()
{
#include "ExN04DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterROGeometry::ExN04CalorimeterROGeometry(G4String aString)
: G4VReadOutGeometry(aString)
{
#include "ExN04DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterROGeometry::~ExN04CalorimeterROGeometry()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExN04CalorimeterROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// ( It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
G4Material* dummyMat =
new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
//Builds the ReadOut World:
G4Box *ROWorldBox = new G4Box("ROWorldBox", expHall_x, expHall_y, expHall_z);
G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorldBox, dummyMat,
G4Box* ROWorldBox = new G4Box("ROWorldBox",
fexpHall_x, fexpHall_y, fexpHall_z);
G4LogicalVolume* ROWorldLog = new G4LogicalVolume(ROWorldBox, dummyMat,
"ROWorldLogical", 0, 0, 0);
G4PVPlacement *ROWorldPhys = new G4PVPlacement(0,G4ThreeVector(),
G4PVPlacement* ROWorldPhys = new G4PVPlacement(0, G4ThreeVector(),
"ROWorldPhysical",
ROWorldLog,
0,false,0);
0, false, 0);
// Calorimeter volume:
G4VSolid * caloROtub
= new G4Tubs("caloROtub",caloTubs_rmin,caloTubs_rmax,
caloTubs_dz,caloTubs_sphi,caloTubs_dphi);
G4LogicalVolume * caloROlog
= new G4LogicalVolume(caloROtub,dummyMat,"caloROlogical",0,0,0);
G4VPhysicalVolume * caloROphys
= new G4PVPlacement(0,G4ThreeVector(),"calROphysical",caloROlog,
ROWorldPhys,false,0);
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(), "calROphysical", caloROlog,
ROWorldPhys, false, 0);
// -------------------------------
// Calorimeter readout division:
// -------------------------------
// Phi division first: 48 sectors
G4VSolid * caloROphiDivisionTub
= new G4Tubs("caloROphiDivision", caloCell_rmin, caloCell_rmax,
caloCell_dz, caloCell_sphi, caloCell_dphi);
G4LogicalVolume * caloROphiDivisionLog
= new G4LogicalVolume(caloROphiDivisionTub, dummyMat, "caloROphiDivisionLogical",0,0,0);
G4VPhysicalVolume * caloROphiDivisionPhys
= new G4PVReplica("caloROphiDivisionPhysical", caloROphiDivisionLog, caloROphys,
kPhi, segmentsinPhi, caloCell_dphi);
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,
caloROphys, kPhi, fsegmentsinPhi, fcaloCell_dphi);
// then z division: 20 slices:
G4VSolid * caloROcellTub
= new G4Tubs("caloROcellTub", caloRing_rmin, caloRing_rmax,
caloRing_dz, caloRing_sphi, caloRing_dphi);
G4LogicalVolume * caloROcellLog
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, caloROphiDivisionPhys,
kZAxis, segmentsinZ,2.*caloRing_dz);
// G4VPhysicalVolume * caloROcellPhys =
new G4PVReplica("caloROcellPhysical", caloROcellLog, caloROphiDivisionPhys,
kZAxis, fsegmentsinZ, 2.*fcaloRing_dz);
//Flags the cells as sensitive .The pointer here serves
// as a flag only to check for sensitivity.
@@ -26,99 +26,111 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04CalorimeterSD.cc
/// \brief Implementation of the ExN04CalorimeterSD class
//
// $Id: ExN04CalorimeterSD.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "G4ios.hh"
#include "G4LogicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4Step.hh"
#include "G4SystemOfUnits.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VTouchable.hh"
#include "ExN04CalorimeterSD.hh"
#include "ExN04CalorimeterHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterSD::ExN04CalorimeterSD(G4String name)
:G4VSensitiveDetector(name),
numberOfCellsInZ(20),numberOfCellsInPhi(48)
: G4VSensitiveDetector(name), fnumberOfCellsInZ(20), fnumberOfCellsInPhi(48)
{
G4String HCname;
collectionName.insert(HCname="calCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04CalorimeterSD::~ExN04CalorimeterSD()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterSD::Initialize(G4HCofThisEvent*)
{
CalCollection = new ExN04CalorimeterHitsCollection
(SensitiveDetectorName,collectionName[0]);
for(G4int j=0;j<numberOfCellsInZ;j++)
for(G4int k=0;k<numberOfCellsInPhi;k++)
{
CellID[j][k] = -1;
fCalCollection = new ExN04CalorimeterHitsCollection
(SensitiveDetectorName, collectionName[0]);
for ( G4int j = 0; j < fnumberOfCellsInZ; j++) {
for(G4int k = 0; k < fnumberOfCellsInPhi; k++) {
fCellID[j][k] = -1;
}
}
verboseLevel = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExN04CalorimeterSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
{
if(!ROhist) return false;
G4double edep = aStep->GetTotalEnergyDeposit();
if(verboseLevel>1) G4cout << "Next step edep(MeV) = " << edep/MeV << G4endl;
if(edep==0.) return false;
if ( !ROhist ) return false;
G4double edep = aStep-> GetTotalEnergyDeposit();
if ( verboseLevel > 1 )
G4cout << "Next step edep(MeV) = " << edep/MeV << G4endl;
if ( edep == 0. ) return false;
G4VPhysicalVolume* physVol = ROhist->GetVolume();
G4VPhysicalVolume* physVol = ROhist-> GetVolume();
//ROhist->MoveUpHistory();
//G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
G4int copyIDinZ = ROhist->GetReplicaNumber();
G4int copyIDinPhi = ROhist->GetReplicaNumber(1);
G4int copyIDinZ = ROhist-> GetReplicaNumber();
G4int copyIDinPhi = ROhist-> GetReplicaNumber(1);
if(CellID[copyIDinZ][copyIDinPhi]==-1)
{
ExN04CalorimeterHit* calHit
= new ExN04CalorimeterHit
(physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi);
calHit->SetEdep( edep );
if ( fCellID[copyIDinZ][copyIDinPhi] == -1 ) {
ExN04CalorimeterHit* calHit =
new ExN04CalorimeterHit(physVol->GetLogicalVolume(),
copyIDinZ, copyIDinPhi);
calHit-> SetEdep(edep);
G4AffineTransform aTrans = ROhist->GetHistory()->GetTopTransform();
aTrans.Invert();
calHit->SetPos(aTrans.NetTranslation());
calHit->SetRot(aTrans.NetRotation());
G4int icell = CalCollection->insert( calHit );
CellID[copyIDinZ][copyIDinPhi] = icell - 1;
if(verboseLevel>0)
{ G4cout << " New Calorimeter Hit on CellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
}
else
{
(*CalCollection)[CellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep);
if(verboseLevel>0)
{ G4cout << " Energy added to CellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl; }
calHit-> SetPos(aTrans.NetTranslation());
calHit-> SetRot(aTrans.NetRotation());
G4int icell = fCalCollection->insert(calHit);
fCellID[copyIDinZ][copyIDinPhi] = icell - 1;
if(verboseLevel>0) {
G4cout << " New Calorimeter Hit on CellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl;
}
} else {
(*fCalCollection)[fCellID[copyIDinZ][copyIDinPhi]]-> AddEdep(edep);
if ( verboseLevel > 0 ) {
G4cout << " Energy added to CellID "
<< copyIDinZ << " " << copyIDinPhi << G4endl;
}
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterSD::EndOfEvent(G4HCofThisEvent*HCE)
{
static G4int HCID = -1;
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection( HCID, CalCollection );
if ( HCID < 0 ) {
HCID = GetCollectionID(0);
}
HCE-> AddHitsCollection(HCID, fCalCollection );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterSD::clear()
{
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterSD::DrawAll()
{
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04CalorimeterSD::PrintAll()
{
}
}
@@ -26,46 +26,50 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04DetectorConstruction.cc
/// \brief Implementation of the ExN04DetectorConstruction class
//
// $Id: ExN04DetectorConstruction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04DetectorConstruction.hh"
#include "ExN04TrackerSD.hh"
#include "ExN04CalorimeterSD.hh"
#include "ExN04CalorimeterROGeometry.hh"
#include "ExN04MuonSD.hh"
#include "ExN04TrackerParametrisation.hh"
#include "ExN04CalorimeterParametrisation.hh"
#include "ExN04Field.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "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 "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4PVParameterised.hh"
#include "G4PVPlacement.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4RotationMatrix.hh"
#include "G4Transform3D.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
#include "ExN04CalorimeterParametrisation.hh"
#include "ExN04CalorimeterROGeometry.hh"
#include "ExN04CalorimeterSD.hh"
#include "ExN04DetectorConstruction.hh"
#include "ExN04Field.hh"
#include "ExN04MuonSD.hh"
#include "ExN04TrackerParametrisation.hh"
#include "ExN04TrackerSD.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04DetectorConstruction::ExN04DetectorConstruction()
{
#include "ExN04DetectorParameterDef.icc"
DefineMaterials();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04DetectorConstruction::~ExN04DetectorConstruction()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04DetectorConstruction::DefineMaterials()
{
//-------------------------------------------------------------------------
@@ -80,24 +84,23 @@ void ExN04DetectorConstruction::DefineMaterials()
G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole);
Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
Air->AddElement(N, 70.*perCent);
Air->AddElement(O, 30.*perCent);
fAir = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
fAir-> AddElement(N, 70.*perCent);
fAir-> AddElement(O, 30.*perCent);
Lead =
new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
fLead = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
Ar =
new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
fAr = new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
Silicon =
new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
fSilicon = new G4Material("Silicon", z=14., a= 28.09*g/mole,
density= 2.33*g/cm3);
Scinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
Scinti->AddElement(C, 9);
Scinti->AddElement(H, 10);
fScinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2);
fScinti-> AddElement(C, 9);
fScinti-> AddElement(H, 10);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExN04DetectorConstruction::Construct()
{
//-------------------------------------------------------------------------
@@ -105,96 +108,94 @@ G4VPhysicalVolume* ExN04DetectorConstruction::Construct()
//-------------------------------------------------------------------------
static G4bool fieldIsInitialized = false;
if(!fieldIsInitialized)
{
if ( !fieldIsInitialized ) {
ExN04Field* myField = new ExN04Field;
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()
->GetFieldManager();
fieldMgr->SetDetectorField(myField);
fieldMgr->CreateChordFinder(myField);
= G4TransportationManager::GetTransportationManager()->
GetFieldManager();
fieldMgr-> SetDetectorField(myField);
fieldMgr-> CreateChordFinder(myField);
fieldIsInitialized = true;
}
//-------------------------------------------------------------------------
// Detector geometry
//-------------------------------------------------------------------------
//------------------------------ experimental hall
G4Box * experimentalHall_box
= new G4Box("expHall_b",expHall_x,expHall_y,expHall_z);
G4LogicalVolume * experimentalHall_log
= new G4LogicalVolume(experimentalHall_box,Air,"expHall_L",0,0,0);
G4VPhysicalVolume * experimentalHall_phys
= new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P",
0,false,0);
G4VisAttributes* experimentalHallVisAtt
= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
experimentalHallVisAtt->SetForceWireframe(true);
experimentalHall_log->SetVisAttributes(experimentalHallVisAtt);
G4Box* experimentalHall_box =
new G4Box("expHall_b", fexpHall_x, fexpHall_y, fexpHall_z);
G4LogicalVolume* experimentalHall_log =
new G4LogicalVolume(experimentalHall_box, fAir,"expHall_L", 0,0,0);
G4VPhysicalVolume * experimentalHall_phys =
new G4PVPlacement(0, G4ThreeVector(), experimentalHall_log,
"expHall_P", 0, false,0);
G4VisAttributes* experimentalHallVisAtt =
new G4VisAttributes(G4Colour(1.,1.,1.));
experimentalHallVisAtt-> SetForceWireframe(true);
experimentalHall_log-> SetVisAttributes(experimentalHallVisAtt);
//------------------------------ tracker
G4VSolid * tracker_tubs
= new G4Tubs("trkTubs_tubs",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
trkTubs_sphi,trkTubs_dphi);
G4LogicalVolume * tracker_log
= new G4LogicalVolume(tracker_tubs,Ar,"trackerT_L",0,0,0);
G4VSolid* tracker_tubs
= new G4Tubs("trkTubs_tubs", ftrkTubs_rmin, ftrkTubs_rmax, ftrkTubs_dz,
ftrkTubs_sphi, ftrkTubs_dphi);
G4LogicalVolume* tracker_log
= new G4LogicalVolume(tracker_tubs, fAr,"trackerT_L",0,0,0);
// G4VPhysicalVolume * tracker_phys =
new G4PVPlacement(0,G4ThreeVector(),tracker_log,"tracker_phys",
experimentalHall_log,false,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);
//------------------------------ 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",trkTubs_rmin,trkTubs_rmax,trkTubs_dz,
trkTubs_sphi,trkTubs_dphi);
G4LogicalVolume * trackerLayer_log
= new G4LogicalVolume(trackerLayer_tubs,Silicon,"trackerB_L",0,0,0);
G4VPVParameterisation * trackerParam
G4VSolid* trackerLayer_tubs
= new G4Tubs("trackerLayer_tubs", ftrkTubs_rmin, ftrkTubs_rmax, ftrkTubs_dz,
ftrkTubs_sphi, ftrkTubs_dphi);
G4LogicalVolume* trackerLayer_log
= new G4LogicalVolume(trackerLayer_tubs, fSilicon,"trackerB_L",0,0,0);
G4VPVParameterisation* trackerParam
= new ExN04TrackerParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
// G4VPhysicalVolume *trackerLayer_phys =
new G4PVParameterised("trackerLayer_phys",trackerLayer_log,tracker_log,
kXAxis, notrkLayers, trackerParam);
new G4PVParameterised("trackerLayer_phys", trackerLayer_log, tracker_log,
kXAxis, fnotrkLayers, trackerParam);
G4VisAttributes* trackerLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
trackerLayer_logVisAtt->SetForceWireframe(true);
trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
//------------------------------ calorimeter
G4VSolid * calorimeter_tubs
= new G4Tubs("calorimeter_tubs",caloTubs_rmin,caloTubs_rmax,
caloTubs_dz,caloTubs_sphi,caloTubs_dphi);
G4LogicalVolume * calorimeter_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);
G4LogicalVolume* calorimeter_log
= new G4LogicalVolume(calorimeter_tubs, fScinti, "caloT_L",0,0,0);
// G4VPhysicalVolume * calorimeter_phys =
new G4PVPlacement(0,G4ThreeVector(),calorimeter_log,"caloM_P",
experimentalHall_log,false,0);
new G4PVPlacement(0,G4ThreeVector(), calorimeter_log, "caloM_P",
experimentalHall_log, false,0);
G4VisAttributes* calorimeter_logVisATT
= new G4VisAttributes(G4Colour(1.0,1.0,0.0));
calorimeter_logVisATT->SetForceWireframe(true);
calorimeter_log->SetVisAttributes(calorimeter_logVisATT);
//------------------------------- Lead layers
// As an example for Parameterised volume
// As an example for Parameterised volume
// dummy values for G4Tubs -- modified by parameterised volume
G4VSolid * caloLayer_tubs
= new G4Tubs("caloLayer_tubs",caloRing_rmin,caloRing_rmax,
caloRing_dz,caloRing_sphi,caloRing_dphi);
G4LogicalVolume * caloLayer_log
= new G4LogicalVolume(caloLayer_tubs,Lead,"caloR_L",0,0,0);
G4VPVParameterisation * calorimeterParam
G4VSolid* caloLayer_tubs
= new G4Tubs("caloLayer_tubs", fcaloRing_rmin, fcaloRing_rmax,
fcaloRing_dz, fcaloRing_sphi, fcaloRing_dphi);
G4LogicalVolume* caloLayer_log
= new G4LogicalVolume(caloLayer_tubs, fLead, "caloR_L",0,0,0);
G4VPVParameterisation* calorimeterParam
= new ExN04CalorimeterParametrisation;
// dummy value : kXAxis -- modified by parameterised volume
// G4VPhysicalVolume * caloLayer_phys =
new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_log,
kXAxis, nocaloLayers, calorimeterParam);
kXAxis, fnocaloLayers, calorimeterParam);
G4VisAttributes* caloLayer_logVisAtt
= new G4VisAttributes(G4Colour(0.7,1.0,0.0));
caloLayer_logVisAtt->SetForceWireframe(true);
@@ -202,18 +203,16 @@ G4VPhysicalVolume* ExN04DetectorConstruction::Construct()
//------------------------------ muon counters
// As an example of CSG volumes with rotation
G4VSolid * muoncounter_box
= new G4Box("muoncounter_box",muBox_width,muBox_thick,
muBox_length);
G4LogicalVolume * muoncounter_log
= new G4LogicalVolume(muoncounter_box,Scinti,"mucounter_L",0,0,0);
G4VPhysicalVolume * muoncounter_phys;
for(int i=0; i<nomucounter ; i++)
{
G4VSolid* muoncounter_box
= new G4Box("muoncounter_box", fmuBox_width, fmuBox_thick, fmuBox_length);
G4LogicalVolume* muoncounter_log
= new G4LogicalVolume(muoncounter_box, fScinti, "mucounter_L",0,0,0);
G4VPhysicalVolume* muoncounter_phys;
for( G4int i = 0; i < fnomucounter; i++ ) {
G4double phi, x, y, z;
phi = 360.*deg/nomucounter*i;
x = muBox_radius*std::sin(phi);
y = muBox_radius*std::cos(phi);
phi = 360.*deg/fnomucounter*i;
x = fmuBox_radius*std::sin(phi);
y = fmuBox_radius*std::cos(phi);
z = 0.*cm;
G4RotationMatrix rm;
rm.rotateZ(phi);
@@ -239,7 +238,7 @@ G4VPhysicalVolume* ExN04DetectorConstruction::Construct()
trackerLayer_log->SetSensitiveDetector(trackerSD);
G4String calorimeterSDname = "/mydet/calorimeter";
ExN04CalorimeterSD * calorimeterSD = new ExN04CalorimeterSD(calorimeterSDname);
ExN04CalorimeterSD* calorimeterSD = new ExN04CalorimeterSD(calorimeterSDname);
G4String ROgeometryName = "CalorimeterROGeom";
G4VReadOutGeometry* calRO = new ExN04CalorimeterROGeometry(ROgeometryName);
calRO->BuildROGeometry();
@@ -248,7 +247,7 @@ G4VPhysicalVolume* ExN04DetectorConstruction::Construct()
calorimeter_log->SetSensitiveDetector(calorimeterSD);
G4String muonSDname = "/mydet/muon";
ExN04MuonSD * muonSD = new ExN04MuonSD(muonSDname);
ExN04MuonSD* muonSD = new ExN04MuonSD(muonSDname);
SDman->AddNewDetector(muonSD);
muoncounter_log->SetSensitiveDetector(muonSD);
@@ -258,4 +257,3 @@ G4VPhysicalVolume* ExN04DetectorConstruction::Construct()
return experimentalHall_phys;
}
@@ -25,57 +25,58 @@
//
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04DetectorParameterDef.icc
/// \brief The file with detector paremeter definistions
//
// $Id$
//
expHall_x = 600.*cm;
expHall_y = 600.*cm;
expHall_z = 600.*cm;
fexpHall_x = 600.*cm;
fexpHall_y = 600.*cm;
fexpHall_z = 600.*cm;
trkTubs_rmax = 50.*cm;
trkTubs_rmin = 20.*cm;
trkTubs_dz = 100.*cm;
trkTubs_sphi = 0.*deg;
trkTubs_dphi = 360.*deg;
ftrkTubs_rmax = 50.*cm;
ftrkTubs_rmin = 20.*cm;
ftrkTubs_dz = 100.*cm;
ftrkTubs_sphi = 0.*deg;
ftrkTubs_dphi = 360.*deg;
notrkLayers = 5;
tracker_radius[0] = 25.*cm;
tracker_radius[1] = 30.*cm;
tracker_radius[2] = 35.*cm;
tracker_radius[3] = 40.*cm;
tracker_radius[4] = 45.*cm;
fnotrkLayers = 5;
ftracker_radius[0] = 25.*cm;
ftracker_radius[1] = 30.*cm;
ftracker_radius[2] = 35.*cm;
ftracker_radius[3] = 40.*cm;
ftracker_radius[4] = 45.*cm;
ftracker_thick = 0.5*cm;
for( int il=0; il < 5; il++ ) {
ftracker_length[il] = ftracker_radius[il];
}
tracker_thick = 0.5*cm;
for(int il=0;il<5;il++)
{
tracker_length[il] = tracker_radius[il];
}
fcaloTubs_rmax = 300.*cm;
fcaloTubs_rmin = 50.*cm;
fcaloTubs_dz = 200.*cm;
fcaloTubs_sphi = 0.*deg;
fcaloTubs_dphi = 360.*deg;
caloTubs_rmax = 300.*cm;
caloTubs_rmin = 50.*cm;
caloTubs_dz = 200.*cm;
caloTubs_sphi = 0.*deg;
caloTubs_dphi = 360.*deg;
fabsorber_thick = 3.*cm;
fscinti_thick = 2.*cm;
fnocaloLayers = int( (fcaloTubs_rmax - fcaloTubs_rmin) /
(fabsorber_thick + fscinti_thick) );
absorber_thick = 3.*cm;
scinti_thick = 2.*cm;
nocaloLayers = int((caloTubs_rmax-caloTubs_rmin)/(absorber_thick+scinti_thick));
fsegmentsinPhi = 48;
fcaloCell_rmax = fcaloTubs_rmax;
fcaloCell_rmin = fcaloTubs_rmin;
fcaloCell_dz = fcaloTubs_dz;
fcaloCell_sphi = fcaloTubs_sphi;
fcaloCell_dphi = fcaloTubs_dphi / fsegmentsinPhi;
segmentsinPhi = 48;
caloCell_rmax = caloTubs_rmax;
caloCell_rmin = caloTubs_rmin;
caloCell_dz = caloTubs_dz;
caloCell_sphi = caloTubs_sphi;
caloCell_dphi = caloTubs_dphi/segmentsinPhi;
segmentsinZ = 20;
caloRing_rmax = caloCell_rmax;
caloRing_rmin = caloCell_rmin;
caloRing_dz = caloCell_dz/segmentsinZ ;
caloRing_sphi = caloCell_sphi;
caloRing_dphi = caloCell_dphi;
nomucounter = 4;
muBox_radius = 350.*cm;
muBox_width = muBox_radius - 5.*cm;
muBox_thick = 1.*cm;
muBox_length = expHall_z - 10.*cm;
fsegmentsinZ = 20;
fcaloRing_rmax = fcaloCell_rmax;
fcaloRing_rmin = fcaloCell_rmin;
fcaloRing_dz = fcaloCell_dz / fsegmentsinZ ;
fcaloRing_sphi = fcaloCell_sphi;
fcaloRing_dphi = fcaloCell_dphi;
fnomucounter = 4;
fmuBox_radius = 350.*cm;
fmuBox_width = fmuBox_radius - 5.*cm;
fmuBox_thick = 1.*cm;
fmuBox_length = fexpHall_z - 10.*cm;
@@ -26,83 +26,86 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04EventAction.cc
/// \brief Implementation of the ExN04EventAction class
//
#include "ExN04EventAction.hh"
#include "ExN04TrackerHit.hh"
#include "ExN04CalorimeterHit.hh"
#include "ExN04MuonHit.hh"
// $Id: ExN04EventAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4UImanager.hh"
#include "G4VHitsCollection.hh"
#include "ExN04EventAction.hh"
#include "ExN04CalorimeterHit.hh"
#include "ExN04MuonHit.hh"
#include "ExN04TrackerHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04EventAction::ExN04EventAction()
{
trackerCollID = -1;
calorimeterCollID = -1;
muonCollID = -1;
ftrackerCollID = -1;
fcalorimeterCollID = -1;
fmuonCollID = -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04EventAction::~ExN04EventAction()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04EventAction::BeginOfEventAction(const G4Event*)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
if(trackerCollID<0||calorimeterCollID<0||muonCollID<0)
{
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if ( ftrackerCollID<0 || fcalorimeterCollID<0 || fmuonCollID<0) {
G4String colNam;
trackerCollID = SDman->GetCollectionID(colNam="trackerCollection");
calorimeterCollID = SDman->GetCollectionID(colNam="calCollection");
muonCollID = SDman->GetCollectionID(colNam="muonCollection");
ftrackerCollID = SDman-> GetCollectionID(colNam="trackerCollection");
fcalorimeterCollID = SDman-> GetCollectionID(colNam="calCollection");
fmuonCollID = SDman-> GetCollectionID(colNam="muonCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04EventAction::EndOfEventAction(const G4Event* evt)
{
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
if(trackerCollID<0||calorimeterCollID<0||muonCollID<0) return;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
ExN04TrackerHitsCollection* THC = 0;
ExN04CalorimeterHitsCollection* CHC = 0;
ExN04MuonHitsCollection* MHC = 0;
if(HCE)
{
THC = (ExN04TrackerHitsCollection*)(HCE->GetHC(trackerCollID));
CHC = (ExN04CalorimeterHitsCollection*)(HCE->GetHC(calorimeterCollID));
MHC = (ExN04MuonHitsCollection*)(HCE->GetHC(muonCollID));
if( ftrackerCollID<0 || fcalorimeterCollID<0 || fmuonCollID<0) return;
G4HCofThisEvent* HCE = evt-> GetHCofThisEvent();
ExN04TrackerHitsCollection* THC = NULL;
ExN04CalorimeterHitsCollection* CHC = NULL;
ExN04MuonHitsCollection* MHC = NULL;
if( HCE ) {
THC = (ExN04TrackerHitsCollection*)(HCE->GetHC(ftrackerCollID));
CHC = (ExN04CalorimeterHitsCollection*)(HCE->GetHC(fcalorimeterCollID));
MHC = (ExN04MuonHitsCollection*)(HCE->GetHC(fmuonCollID));
}
if(THC)
{
int n_hit = THC->entries();
if( THC ) {
G4int n_hit = THC-> entries();
G4cout << " " << n_hit
<< " hits are stored in ExN04TrackerHitsCollection." << G4endl;
}
if(CHC)
{
int n_hit = CHC->entries();
if( CHC ) {
G4int n_hit = CHC-> entries();
G4cout << " " << n_hit
<< " hits are stored in ExN04CalorimeterHitsCollection." << G4endl;
G4double totE = 0;
for(int i=0;i<n_hit;i++)
{ totE += (*CHC)[i]->GetEdep(); }
for( int i = 0; i < n_hit; i++ ) {
totE += (*CHC)[i]-> GetEdep();
}
G4cout << " Total energy deposition in calorimeter : "
<< totE / GeV << " (GeV)" << G4endl;
}
if(MHC)
{
int n_hit = MHC->entries();
if( MHC ) {
G4int n_hit = MHC-> entries();
G4cout << " " << n_hit
<< " hits are stored in ExN04MuonHitsCollection." << G4endl;
}
}
@@ -26,27 +26,34 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04Field.cc
/// \brief Implementation of the ExN04Field class
//
// $Id: ExN04Field.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04Field.hh"
#include "G4SystemOfUnits.hh"
#include "ExN04Field.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04Field::ExN04Field()
{
Bz = 3.0*tesla;
rmax_sq = sqr(50.*cm);
zmax = 100.*cm;
fBz = 3.0*tesla;
frmax_sq = sqr(50.*cm);
fzmax = 100.*cm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04Field::~ExN04Field()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04Field::GetFieldValue(const double Point[3],double *Bfield) const
{
Bfield[0] = 0.;
Bfield[1] = 0.;
if(std::abs(Point[2])<zmax && (sqr(Point[0])+sqr(Point[1]))<rmax_sq)
{ Bfield[2] = Bz; }
else
{ Bfield[2] = 0.; }
if ( std::abs(Point[2]) < fzmax &&
(sqr(Point[0])+sqr(Point[1])) < frmax_sq ) {
Bfield[2] = fBz;
} else {
Bfield[2] = 0.;
}
}
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04MuonHit.cc
/// \brief Implementation of the ExN04MuonHit class
//
// $Id: ExN04MuonHit.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04MuonHit.hh"
#include "G4VVisManager.hh"
@@ -36,37 +38,44 @@
G4Allocator<ExN04MuonHit> ExN04MuonHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04MuonHit::ExN04MuonHit()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04MuonHit::~ExN04MuonHit()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04MuonHit::ExN04MuonHit(const ExN04MuonHit &right)
: G4VHit()
{
edep = right.edep;
pos = right.pos;
fedep = right.fedep;
fpos = right.fpos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const ExN04MuonHit& ExN04MuonHit::operator=(const ExN04MuonHit &right)
{
edep = right.edep;
pos = right.pos;
fedep = right.fedep;
fpos = right.fpos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int ExN04MuonHit::operator==(const ExN04MuonHit &right) const
{
return (this==&right) ? 1 : 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04MuonHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(pos);
if(pVVisManager) {
G4Circle circle(fpos);
circle.SetScreenSize(0.04);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
@@ -76,7 +85,7 @@ void ExN04MuonHit::Draw()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04MuonHit::Print()
{;}
{
}
@@ -26,36 +26,42 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04MuonSD.cc
/// \brief Implementation of the ExN04MuonSD class
//
// $Id: ExN04MuonSD.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04MuonSD.hh"
#include "ExN04MuonHit.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4ios.hh"
#include "G4Step.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "ExN04MuonSD.hh"
#include "ExN04MuonHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04MuonSD::ExN04MuonSD(G4String name)
:G4VSensitiveDetector(name)
: G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="muonCollection");
positionResolution = 5*cm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04MuonSD::~ExN04MuonSD(){;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04MuonSD::Initialize(G4HCofThisEvent*HCE)
{
static int HCID = -1;
muonCollection = new ExN04MuonHitsCollection
(SensitiveDetectorName,collectionName[0]);
(SensitiveDetectorName,collectionName[0]);
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection(HCID,muonCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExN04MuonSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
@@ -65,8 +71,7 @@ G4bool ExN04MuonSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
ExN04MuonHit* aHit;
int nHit = muonCollection->entries();
G4ThreeVector hitpos = aStep->GetPreStepPoint()->GetPosition();
for(int i=0;i<nHit;i++)
{
for(int i=0;i<nHit;i++) {
aHit = (*muonCollection)[i];
G4ThreeVector pos = aHit->GetPos();
G4double dist2 = sqr(pos.x()-hitpos.x())
@@ -84,18 +89,22 @@ G4bool ExN04MuonSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04MuonSD::EndOfEvent(G4HCofThisEvent*)
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04MuonSD::clear()
{
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04MuonSD::DrawAll()
{
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04MuonSD::PrintAll()
{
}
}
@@ -26,12 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04PrimaryGeneratorAction.cc
/// \brief Implementation of the ExN04PrimaryGeneratorAction class
//
// ====================================================================
// $Id: ExN04PrimaryGeneratorAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// ExN04PrimaryGeneratorAction.cc
// $Id$
//
// ====================================================================
#include "ExN04PrimaryGeneratorAction.hh"
#include "ExN04PrimaryGeneratorMessenger.hh"
@@ -40,42 +37,38 @@
#include "HepMCG4AsciiReader.hh"
#include "HepMCG4PythiaInterface.hh"
//////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04PrimaryGeneratorAction::ExN04PrimaryGeneratorAction()
//////////////////////////////////////////////////////////
{
// default generator is particle gun.
currentGenerator= particleGun= new G4ParticleGun();
currentGeneratorName= "particleGun";
hepmcAscii= new HepMCG4AsciiReader();
currentGenerator = particleGun= new G4ParticleGun();
currentGeneratorName = "particleGun";
hepmcAscii = new HepMCG4AsciiReader();
#ifdef G4LIB_USE_PYTHIA
pythiaGen= new HepMCG4PythiaInterface();
pythiaGen = new HepMCG4PythiaInterface();
#else
pythiaGen= 0;
pythiaGen = 0;
#endif
gentypeMap["particleGun"]= particleGun;
gentypeMap["hepmcAscii"]= hepmcAscii;
gentypeMap["pythia"]= pythiaGen;
gentypeMap["particleGun"] = particleGun;
gentypeMap["hepmcAscii"] = hepmcAscii;
gentypeMap["pythia"] = pythiaGen;
messenger= new ExN04PrimaryGeneratorMessenger(this);
messenger= new ExN04PrimaryGeneratorMessenger(this);
}
///////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04PrimaryGeneratorAction::~ExN04PrimaryGeneratorAction()
///////////////////////////////////////////////////////////
{
delete messenger;
}
/////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
/////////////////////////////////////////////////////////////////////
{
if(currentGenerator)
currentGenerator-> GeneratePrimaryVertex(anEvent);
else
G4Exception("ExN04PrimaryGeneratorAction::GeneratePrimaries",
else
G4Exception("ExN04PrimaryGeneratorAction::GeneratePrimaries",
"PrimaryGeneratorAction001", FatalException,
"generator is not instanciated." );
}
@@ -26,28 +26,23 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04PrimaryGeneratorMessenger.cc
/// \brief Implementation of the ExN04PrimaryGeneratorMessenger class
//
// ====================================================================
// $Id: ExN04PrimaryGeneratorMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// ExN04PrimaryGeneratorMessenger.cc
// $Id$
//
// ====================================================================
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIdirectory.hh"
#include "G4UIparameter.hh"
#include "ExN04PrimaryGeneratorMessenger.hh"
#include "ExN04PrimaryGeneratorAction.hh"
////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04PrimaryGeneratorMessenger::ExN04PrimaryGeneratorMessenger
(ExN04PrimaryGeneratorAction* genaction)
(ExN04PrimaryGeneratorAction* genaction)
: primaryAction(genaction)
////////////////////////////////////////////////////////////////////
{
mydetdir = new G4UIdirectory("/mydet/");
mydetdir-> SetGuidance("ExN04 detector control commands.");
@@ -62,39 +57,33 @@ ExN04PrimaryGeneratorMessenger::ExN04PrimaryGeneratorMessenger
select-> SetDefaultValue("particleGun");
}
/////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04PrimaryGeneratorMessenger::~ExN04PrimaryGeneratorMessenger()
/////////////////////////////////////////////////////////////////
{
delete select;
delete mydetdir;
delete dir;
}
}
//////////////////////////////////////////////////////////////////////
void ExN04PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
G4String newValues)
//////////////////////////////////////////////////////////////////////
{
if ( command==select) {
if ( command == select ) {
primaryAction-> SetGenerator(newValues);
G4cout << "current generator type: "
G4cout << "current generator type: "
<< primaryAction-> GetGeneratorName() << G4endl;
} else {
}
}
//////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String ExN04PrimaryGeneratorMessenger::GetCurrentValue(G4UIcommand* command)
//////////////////////////////////////////////////////////////////////////////
{
G4String cv, st;
if (command == select) {
cv= primaryAction-> GetGeneratorName();
}
if ( command == select ) {
cv = primaryAction-> GetGeneratorName();
}
return cv;
}
@@ -26,40 +26,26 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04RunAction.cc
/// \brief Implementation of the ExN04RunAction class
//
// $Id: ExN04RunAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN04RunAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "ExN04RunAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04RunAction::ExN04RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04RunAction::~ExN04RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04RunAction::~ExN04RunAction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun-> GetRunID() << " start." << G4endl;
G4RunManager::GetRunManager()-> SetRandomNumberStore(true);
}
@@ -26,8 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04StackingAction.cc
/// \brief Implementation of the ExN04StackingAction class
//
// $Id: ExN04StackingAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04StackingAction.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
@@ -38,21 +39,24 @@
#include "G4ParticleTypes.hh"
#include "ExN04StackingActionMessenger.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include "ExN04StackingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04StackingAction::ExN04StackingAction()
: trkHits(0), muonHits(0), stage(0)
{
angRoI = 30.0*deg;
{
angRoI = 30.0*deg;
reqMuon = 2;
reqIso = 10;
theMessenger = new ExN04StackingActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04StackingAction::~ExN04StackingAction()
{ delete theMessenger; }
G4ClassificationOfNewTrack
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack
ExN04StackingAction::ClassifyNewTrack(const G4Track * aTrack)
{
G4ClassificationOfNewTrack classification = fWaiting;
@@ -80,12 +84,12 @@ ExN04StackingAction::ClassifyNewTrack(const G4Track * aTrack)
// Accept all secondaries in RoI
// Kill secondaries outside RoI
if(aTrack->GetParentID()==0)
{
{
classification = fUrgent;
break;
}
if((angRoI<0.)||InsideRoI(aTrack,angRoI))
{
{
classification = fUrgent;
break;
}
@@ -94,6 +98,7 @@ ExN04StackingAction::ClassifyNewTrack(const G4Track * aTrack)
return classification;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExN04StackingAction::InsideRoI(const G4Track * aTrack,G4double ang)
{
if(!muonHits)
@@ -115,6 +120,7 @@ G4bool ExN04StackingAction::InsideRoI(const G4Track * aTrack,G4double ang)
return false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VHitsCollection* ExN04StackingAction::GetCollection(G4String colName)
{
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
@@ -129,6 +135,7 @@ G4VHitsCollection* ExN04StackingAction::GetCollection(G4String colName)
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04StackingAction::NewStage()
{
stage++;
@@ -146,7 +153,7 @@ void ExN04StackingAction::NewStage()
G4cout << "Stage 0->1 : " << nhits << " hits found in the muon chamber."
<< G4endl;
if(nhits<reqMuon)
{
{
stackManager->clear();
G4cout << "++++++++ event aborted" << G4endl;
return;
@@ -165,7 +172,8 @@ void ExN04StackingAction::NewStage()
// in the tracker layers.
nhits = muonHits->entries();
if(!trkHits)
{ trkHits = (ExN04TrackerHitsCollection*)GetCollection("trackerCollection"); }
{ trkHits =
(ExN04TrackerHitsCollection*)GetCollection("trackerCollection"); }
if(!trkHits)
{ G4cerr << "trackerCollection NOT FOUND" << G4endl;
return; }
@@ -199,12 +207,11 @@ void ExN04StackingAction::NewStage()
stackManager->ReClassify();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04StackingAction::PrepareNewEvent()
{
stage = 0;
{
stage = 0;
trkHits = 0;
muonHits = 0;
}
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04StackingActionMessenger.cc
/// \brief Implementation of the ExN04StackingActionMessenger class
//
// $Id: ExN04StackingActionMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04StackingActionMessenger.hh"
#include "ExN04StackingAction.hh"
@@ -33,8 +35,10 @@
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4ios.hh"
ExN04StackingActionMessenger::ExN04StackingActionMessenger(ExN04StackingAction * msa)
:myAction(msa)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04StackingActionMessenger::ExN04StackingActionMessenger
(ExN04StackingAction * msa)
: myAction(msa)
{
muonCmd = new G4UIcmdWithAnInteger("/mydet/reqmuon",this);
muonCmd->SetGuidance("Number of muon for the trigger.");
@@ -61,6 +65,7 @@ ExN04StackingActionMessenger::ExN04StackingActionMessenger(ExN04StackingAction *
roiCmd->SetDefaultUnit("deg");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04StackingActionMessenger::~ExN04StackingActionMessenger()
{
delete muonCmd;
@@ -69,7 +74,9 @@ ExN04StackingActionMessenger::~ExN04StackingActionMessenger()
delete roiCmd;
}
void ExN04StackingActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04StackingActionMessenger::SetNewValue
(G4UIcommand * command,G4String newValue)
{
if( command==muonCmd )
{ myAction->SetNRequestMuon(muonCmd->GetNewIntValue(newValue)); }
@@ -81,10 +88,11 @@ void ExN04StackingActionMessenger::SetNewValue(G4UIcommand * command,G4String ne
{ myAction->SetRoIAngle(roiCmd->GetNewDoubleValue(newValue)); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String ExN04StackingActionMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String cv;
if( command==muonCmd )
{ cv = muonCmd->ConvertToString(myAction->GetNRequestMuon()); }
else if( command==isomuonCmd )
@@ -93,7 +101,6 @@ G4String ExN04StackingActionMessenger::GetCurrentValue(G4UIcommand * command)
{ cv = isoCmd->ConvertToString(myAction->GetNIsolation()); }
else if( command==roiCmd )
{ cv = roiCmd->ConvertToString(myAction->GetRoIAngle(),"deg"); }
return cv;
}
@@ -26,8 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04SteppingAction.cc
/// \brief Implementation of the ExN04SteppingAction class
//
// $Id: ExN04SteppingAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04SteppingAction.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
@@ -36,16 +37,22 @@
#include "G4VPhysicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "ExN04SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04SteppingAction::ExN04SteppingAction()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04SteppingAction::~ExN04SteppingAction()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04SteppingAction::UserSteppingAction(const G4Step * theStep)
{
G4Track * theTrack = theStep->GetTrack();
G4Track* theTrack = theStep->GetTrack();
// check if it is alive
if(theTrack->GetTrackStatus()!=fAlive) { return; }
@@ -72,5 +79,3 @@ void ExN04SteppingAction::UserSteppingAction(const G4Step * theStep)
// then suspend the track
theTrack->SetTrackStatus(fSuspend);
}
@@ -26,8 +26,7 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04SteppingVerbose.cc
/// \brief Implementation of the ExN04SteppingVerbose class
//
//
// $Id$
// $Id: ExN04SteppingVerbose.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -38,37 +37,36 @@
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04SteppingVerbose::ExN04SteppingVerbose()
{}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04SteppingVerbose::~ExN04SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
@@ -81,15 +79,15 @@ void ExN04SteppingVerbose::StepInfo()
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< " ";
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << " "
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
@@ -104,7 +102,7 @@ void ExN04SteppingVerbose::StepInfo()
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
@@ -113,7 +111,7 @@ void ExN04SteppingVerbose::StepInfo()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< std::setw(6)
@@ -128,37 +126,35 @@ void ExN04SteppingVerbose::StepInfo()
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
@@ -179,5 +175,3 @@ G4int prec = G4cout.precision(3);
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,6 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04TrackerHit.cc
/// \brief Implementation of the ExN04TrackerHit class
//
// $Id: ExN04TrackerHit.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04TrackerHit.hh"
#include "G4VVisManager.hh"
@@ -33,15 +35,20 @@
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Allocator<ExN04TrackerHit> ExN04TrackerHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04TrackerHit::ExN04TrackerHit()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04TrackerHit::~ExN04TrackerHit()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04TrackerHit::ExN04TrackerHit(const ExN04TrackerHit &right)
: G4VHit()
{
@@ -49,6 +56,7 @@ ExN04TrackerHit::ExN04TrackerHit(const ExN04TrackerHit &right)
pos = right.pos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const ExN04TrackerHit& ExN04TrackerHit::operator=(const ExN04TrackerHit &right)
{
edep = right.edep;
@@ -56,11 +64,13 @@ const ExN04TrackerHit& ExN04TrackerHit::operator=(const ExN04TrackerHit &right)
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int ExN04TrackerHit::operator==(const ExN04TrackerHit &right) const
{
return (this==&right) ? 1 : 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
@@ -76,7 +86,7 @@ void ExN04TrackerHit::Draw()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerHit::Print()
{;}
{
}
@@ -26,37 +26,42 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04TrackerParametrisation.cc
/// \brief Implementation of the ExN04TrackerParametrisation class
//
// $Id: ExN04TrackerParametrisation.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04TrackerParametrisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
#include "ExN04TrackerParametrisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04TrackerParametrisation::ExN04TrackerParametrisation()
{
#include "ExN04DetectorParameterDef.icc"
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04TrackerParametrisation::~ExN04TrackerParametrisation()
{;}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerParametrisation::ComputeTransformation
(const G4int, G4VPhysicalVolume* physVol) const
(const G4int, G4VPhysicalVolume* physVol) const
{
G4ThreeVector origin;
physVol->SetTranslation(origin);
physVol-> SetTranslation(origin);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerParametrisation::ComputeDimensions
(G4Tubs& trackerLayer, const G4int copyNo, const G4VPhysicalVolume*) const
(G4Tubs& trackerLayer, const G4int copyNo, const G4VPhysicalVolume*) const
{
trackerLayer.SetInnerRadius(tracker_radius[copyNo]);
trackerLayer.SetOuterRadius(tracker_radius[copyNo]+tracker_thick);
trackerLayer.SetZHalfLength(tracker_length[copyNo]);
trackerLayer.SetStartPhiAngle(trkTubs_sphi);
trackerLayer.SetDeltaPhiAngle(trkTubs_dphi);
trackerLayer.SetInnerRadius(ftracker_radius[copyNo]);
trackerLayer.SetOuterRadius(ftracker_radius[copyNo] + ftracker_thick);
trackerLayer.SetZHalfLength(ftracker_length[copyNo]);
trackerLayer.SetStartPhiAngle(ftrkTubs_sphi);
trackerLayer.SetDeltaPhiAngle(ftrkTubs_dphi);
}
@@ -26,33 +26,38 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04TrackerSD.cc
/// \brief Implementation of the ExN04TrackerSD class
//
// $Id: ExN04TrackerSD.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04TrackerSD.hh"
#include "ExN04TrackerHit.hh"
#include "G4Step.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04TrackerSD::ExN04TrackerSD(G4String name)
:G4VSensitiveDetector(name)
: G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="trackerCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN04TrackerSD::~ExN04TrackerSD(){;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerSD::Initialize(G4HCofThisEvent* HCE)
{
static int HCID = -1;
trackerCollection = new ExN04TrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
(SensitiveDetectorName,collectionName[0]);
if(HCID<0)
{ HCID = GetCollectionID(0); }
HCE->AddHitsCollection(HCID,trackerCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExN04TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
@@ -66,18 +71,22 @@ G4bool ExN04TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerSD::EndOfEvent(G4HCofThisEvent*)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerSD::clear()
{
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerSD::DrawAll()
{
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackerSD::PrintAll()
{
}
}
@@ -26,19 +26,20 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/ExN04TrackingAction.cc
/// \brief Implementation of the ExN04TrackingAction class
//
// $Id: ExN04TrackingAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
#include "ExN04TrackingAction.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4TrackingManager.hh"
#include "ExN04TrackingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN04TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
{
// Create trajectory only for primaries
if(aTrack->GetParentID()==0)
{ fpTrackingManager->SetStoreTrajectory(true); }
else
{ fpTrackingManager->SetStoreTrajectory(false); }
if ( aTrack-> GetParentID() == 0 ) {
fpTrackingManager->SetStoreTrajectory(true);
} else {
fpTrackingManager->SetStoreTrajectory(false);
}
}
@@ -26,7 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/HEPEvtcom.cc
/// \brief Implementation of the HEPEvtcom class
//
//$Id$
// $Id: HEPEvtcom.cc 73446 2013-08-27 11:32:59Z gcosmo $
//
// ======================================================================
// PARAMETER (NMXHEP=4000)
// COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP),
@@ -26,53 +26,46 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4AsciiReader.cc
/// \brief Implementation of the HepMCG4AsciiReader class
//
// ====================================================================
// $Id: HepMCG4AsciiReader.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4AsciiReader.cc
// $Id$
//
// ====================================================================
#include "HepMCG4AsciiReader.hh"
#include "HepMCG4AsciiReaderMessenger.hh"
#include <iostream>
#include <fstream>
////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReader::HepMCG4AsciiReader()
: filename("xxx.dat"), verbose(0)
////////////////////////////////////////
{
asciiInput= new HepMC::IO_GenEvent(filename.c_str(), std::ios::in);
messenger= new HepMCG4AsciiReaderMessenger(this);
}
/////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReader::~HepMCG4AsciiReader()
/////////////////////////////////////////
{
delete asciiInput;
delete messenger;
}
/////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4AsciiReader::Initialize()
/////////////////////////////////////
{
delete asciiInput;
asciiInput= new HepMC::IO_GenEvent(filename.c_str(), std::ios::in);
}
/////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMC::GenEvent* HepMCG4AsciiReader::GenerateHepMCEvent()
/////////////////////////////////////////////////////////
{
HepMC::GenEvent* evt= asciiInput-> read_next_event();
if(!evt) return 0; // no more event
if(verbose>0) evt-> print();
return evt;
}
@@ -26,30 +26,25 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4AsciiReaderMessenger.cc
/// \brief Implementation of the HepMCG4AsciiReaderMessenger class
//
// ====================================================================
// $Id: HepMCG4AsciiReaderMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4AsciiReaderMessenger.cc
// $Id$
//
// ====================================================================
#include "HepMCG4AsciiReaderMessenger.hh"
#include "HepMCG4AsciiReader.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "HepMCG4AsciiReaderMessenger.hh"
#include "HepMCG4AsciiReader.hh"
////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger
(HepMCG4AsciiReader* agen)
: gen(agen)
////////////////////////////////////////////////////////
{
dir= new G4UIdirectory("/generator/hepmcAscii/");
dir-> SetGuidance("Reading HepMC event from an Ascii file");
verbose=
verbose=
new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this);
verbose-> SetGuidance("Set verbose level");
verbose-> SetParameterName("verboseLevel", false, false);
@@ -57,12 +52,11 @@ HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger
open= new G4UIcmdWithAString("/generator/hepmcAscii/open", this);
open-> SetGuidance("(re)open data file (HepMC Ascii format)");
open-> SetParameterName("input ascii file", true, true);
open-> SetParameterName("input ascii file", true, true);
}
///////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger()
///////////////////////////////////////////////////////////
{
delete verbose;
delete open;
@@ -70,26 +64,24 @@ HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger()
delete dir;
}
///////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4AsciiReaderMessenger::SetNewValue(G4UIcommand* command,
G4String newValues)
///////////////////////////////////////////////////////////////////
{
if (command==verbose) {
int level= verbose-> GetNewIntValue(newValues);
gen-> SetVerboseLevel(level);
} else if (command==open) {
gen-> SetFileName(newValues);
G4cout << "HepMC Ascii inputfile: "
G4cout << "HepMC Ascii inputfile: "
<< gen-> GetFileName() << G4endl;
gen-> Initialize();
}
}
///////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command)
///////////////////////////////////////////////////////////////////////////
{
G4String cv;
@@ -100,4 +92,3 @@ G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command)
}
return cv;
}
@@ -26,12 +26,9 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4Interface.cc
/// \brief Implementation of the HepMCG4Interface class
//
// ====================================================================
// $Id: HepMCG4Interface.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4Interface.cc
// $Id$
//
// ====================================================================
#include "HepMCG4Interface.hh"
#include "G4RunManager.hh"
@@ -43,24 +40,21 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4Interface::HepMCG4Interface()
: hepmcEvent(0)
////////////////////////////////////
{
}
/////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4Interface::~HepMCG4Interface()
/////////////////////////////////////
{
delete hepmcEvent;
}
/////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool HepMCG4Interface::CheckVertexInsideWorld
(const G4ThreeVector& pos) const
/////////////////////////////////////////////////////////
{
G4Navigator* navigator= G4TransportationManager::GetTransportationManager()
-> GetNavigatorForTracking();
@@ -73,17 +67,16 @@ G4bool HepMCG4Interface::CheckVertexInsideWorld
else return true;
}
////////////////////////////////////////////////////////////////
void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
G4Event* g4event)
////////////////////////////////////////////////////////////////
{
for(HepMC::GenEvent::vertex_const_iterator vitr= hepmcevt->vertices_begin();
vitr != hepmcevt->vertices_end(); ++vitr ) { // loop for vertex ...
// real vertex?
G4bool qvtx=false;
for (HepMC::GenVertex::particle_iterator
for (HepMC::GenVertex::particle_iterator
pitr= (*vitr)->particles_begin(HepMC::children);
pitr != (*vitr)->particles_end(HepMC::children); ++pitr) {
@@ -95,16 +88,16 @@ void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
if (!qvtx) continue;
// check world boundary
HepMC::FourVector pos= (*vitr)-> position();
HepMC::FourVector pos= (*vitr)-> position();
G4LorentzVector xvtx(pos.x(), pos.y(), pos.z(), pos.t());
if (! CheckVertexInsideWorld(xvtx.vect()*mm)) continue;
// create G4PrimaryVertex and associated G4PrimaryParticles
G4PrimaryVertex* g4vtx=
new G4PrimaryVertex(xvtx.x()*mm, xvtx.y()*mm, xvtx.z()*mm,
G4PrimaryVertex* g4vtx=
new G4PrimaryVertex(xvtx.x()*mm, xvtx.y()*mm, xvtx.z()*mm,
xvtx.t()*mm/c_light);
for (HepMC::GenVertex::particle_iterator
for (HepMC::GenVertex::particle_iterator
vpitr= (*vitr)->particles_begin(HepMC::children);
vpitr != (*vitr)->particles_end(HepMC::children); ++vpitr) {
@@ -113,27 +106,24 @@ void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
G4int pdgcode= (*vpitr)-> pdg_id();
pos= (*vpitr)-> momentum();
G4LorentzVector p(pos.px(), pos.py(), pos.pz(), pos.e());
G4PrimaryParticle* g4prim=
G4PrimaryParticle* g4prim=
new G4PrimaryParticle(pdgcode, p.x()*GeV, p.y()*GeV, p.z()*GeV);
g4vtx-> SetPrimary(g4prim);
}
g4event-> AddPrimaryVertex(g4vtx);
}
}
}
}
///////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMC::GenEvent* HepMCG4Interface::GenerateHepMCEvent()
///////////////////////////////////////////////////////
{
HepMC::GenEvent* aevent= new HepMC::GenEvent();
return aevent;
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4Interface::GeneratePrimaryVertex(G4Event* anEvent)
//////////////////////////////////////////////////////////////
{
// delete previous event object
delete hepmcEvent;
@@ -141,11 +131,10 @@ void HepMCG4Interface::GeneratePrimaryVertex(G4Event* anEvent)
// generate next event
hepmcEvent= GenerateHepMCEvent();
if(! hepmcEvent) {
G4cout << "HepMCInterface: no generated particles. run terminated..."
G4cout << "HepMCInterface: no generated particles. run terminated..."
<< G4endl;
G4RunManager::GetRunManager()-> AbortRun();
return;
}
HepMC2G4(hepmcEvent, anEvent);
}
@@ -26,21 +26,18 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4PythiaInterface.cc
/// \brief Implementation of the HepMCG4PythiaInterface class
//
// ====================================================================
// $Id: HepMCG4PythiaInterface.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4PythiaInterface.cc
// $Id$
//
// ====================================================================
#ifdef G4LIB_USE_PYTHIA
#include "HepMCG4PythiaInterface.hh"
#include "HepMCG4PythiaMessenger.hh"
#include "HepMC/GenEvent.h"
#include "HepMC/PythiaWrapper6_4.h"
#include "HepMC/GenEvent.h"
#include "HepMC/PythiaWrapper6_4.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// additional pythia calls
#define pygive pygive_
#define pyrget pyrget_
@@ -56,74 +53,65 @@ void call_pygive(G4String s) { pygive(s.c_str(), s.length()); }
void call_pyrget(int a, int b) { pyrget(&a, &b); }
void call_pyrset(int a, int b) { pyrset(&a, &b); }
////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaInterface::HepMCG4PythiaInterface()
: verbose(0), mpylist(0)
////////////////////////////////////////////////
{
#ifdef NEED_INITPYDATA
#ifdef NEED_INITPYDATA
initpydata();
// Some platforms may require the initialization of pythia PYDATA block
// data as external - if you get pythia initialization errors try
// Some platforms may require the initialization of pythia PYDATA block
// data as external - if you get pythia initialization errors try
// commenting in/out the below call to initpydata().
#endif
messenger= new HepMCG4PythiaMessenger(this);
}
/////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaInterface::~HepMCG4PythiaInterface()
/////////////////////////////////////////////////
{
delete messenger;
}
/////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPygive(G4String par)
/////////////////////////////////////////////////////
{
call_pygive(par);
}
//////////////////////////////////////////////////////////////////////
void HepMCG4PythiaInterface::CallPyinit(G4String frame, G4String beam,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPyinit(G4String frame, G4String beam,
G4String target, G4double win)
//////////////////////////////////////////////////////////////////////
{
call_pyinit(frame.c_str(), beam.c_str(), target.c_str(), win);
}
////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPystat(G4int istat)
////////////////////////////////////////////////////
{
call_pystat(istat);
}
///////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::SetRandomSeed(G4int iseed)
///////////////////////////////////////////////////////
{
pydatr.mrpy[1-1]= iseed;
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPyrget(G4int lun, G4int move)
//////////////////////////////////////////////////////////////
{
call_pyrget(lun, move);
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPyrset(G4int lun, G4int move)
//////////////////////////////////////////////////////////////
{
call_pyrset(lun, move);
}
//////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::PrintRandomStatus(std::ostream& ostr) const
//////////////////////////////////////////////////////////////////////////
{
ostr << "# Pythia random numbers status" << G4endl;
for (G4int j=0; j<6; j++) {
@@ -134,24 +122,22 @@ void HepMCG4PythiaInterface::PrintRandomStatus(std::ostream& ostr) const
}
}
////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::SetUserParameters()
////////////////////////////////////////////////
{
G4cout << "set user parameters of PYTHIA common." << G4endl
<< "nothing to be done in default."
<< G4endl;
}
/////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMC::GenEvent* HepMCG4PythiaInterface::GenerateHepMCEvent()
/////////////////////////////////////////////////////////////
{
static G4int nevent= 0; // event counter
call_pyevnt(); // generate one event with Pythia
if(mpylist >=1 && mpylist<= 3) call_pylist(mpylist);
call_pyhepc(1);
HepMC::GenEvent* evt= hepevtio.read_next_event();
@@ -161,9 +147,8 @@ HepMC::GenEvent* HepMCG4PythiaInterface::GenerateHepMCEvent()
return evt;
}
//////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::Print() const
//////////////////////////////////////////
{
G4cout << "PythiaInterface::Print()..." << G4endl;
}
@@ -26,30 +26,23 @@
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4PythiaMessenger.cc
/// \brief Implementation of the HepMCG4PythiaMessenger class
//
// ====================================================================
// $Id: HepMCG4PythiaMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4PythiaMessenger.cc
// $Id$
//
// ====================================================================
#ifdef G4LIB_USE_PYTHIA
#include "HepMCG4PythiaMessenger.hh"
#include "HepMCG4PythiaInterface.hh"
#include <sstream>
#include <fstream>
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "HepMCG4PythiaMessenger.hh"
#include "HepMCG4PythiaInterface.hh"
////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaMessenger::HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen)
: gen(agen)
////////////////////////////////////////////////////////////////////////////
{
dir= new G4UIdirectory("/generator/pythia/");
dir-> SetGuidance("Commands for Pythia event generation");
@@ -87,11 +80,11 @@ HepMCG4PythiaMessenger::HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen)
cpygive= new G4UIcommand("/generator/pythia/pygive",this);
cpygive-> SetGuidance("call PYGIVE");
G4UIparameter* parameter= new G4UIparameter ("Parameter", 's', false);
cpygive-> SetParameter(parameter);
cpygive-> SetParameter(parameter);
setUserParameters=
setUserParameters=
new G4UIcmdWithoutParameter("/generator/pythia/setUserParameters",this);
setUserParameters->
setUserParameters->
SetGuidance("Set user parameters in the Pythia common blocks");
setSeed= new G4UIcmdWithAnInteger("/generator/pythia/setSeed", this);
@@ -114,22 +107,21 @@ HepMCG4PythiaMessenger::HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen)
move-> SetDefaultValue(0);
cpyrset-> SetParameter(move);
printRandomStatus=
printRandomStatus=
new G4UIcmdWithAString("/generator/pythia/printRandomStatus", this);
printRandomStatus-> SetGuidance("print random number status.");
printRandomStatus-> SetParameterName("filename", true, false);
printRandomStatus-> SetDefaultValue("std::cout");
}
/////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaMessenger::~HepMCG4PythiaMessenger()
/////////////////////////////////////////////////
{
delete verbose;
delete mpylist;
delete print;
delete cpyinit;
delete cpystat;
delete cpystat;
delete cpygive;
delete setUserParameters;
delete setSeed;
@@ -140,10 +132,9 @@ HepMCG4PythiaMessenger::~HepMCG4PythiaMessenger()
delete dir;
}
//////////////////////////////////////////////////////////////
void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
G4String newValues)
//////////////////////////////////////////////////////////////
{
if(command == verbose) { // /verbose ...
G4int level= verbose-> GetNewIntValue(newValues);
@@ -199,7 +190,7 @@ void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
} else {
// to a file (overwrite mode)
std::ofstream ofs;
ofs.open(s.c_str(), std::ios::out);
ofs.open(s.c_str(), std::ios::out);
//ofs.open(randomStatusFileName.c_str(), std::ios::out|std::ios::app);
ofs.setf(std::ios::fixed | std::ios::showpoint);
gen-> PrintRandomStatus(ofs);
@@ -208,9 +199,8 @@ void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
}
}
//////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String HepMCG4PythiaMessenger::GetCurrentValue(G4UIcommand* command)
//////////////////////////////////////////////////////////////////////
{
G4String cv;
if (command == verbose) {
@@ -23,11 +23,7 @@ include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Find HepMC (required package)
#
find_package(HepMC QUIET)
if(NOT HEPMC_FOUND)
message(STATUS "G4 Examples: HepMC package not found. --> HepMCEx02 example disabled")
return()
endif()
find_package(HepMC REQUIRED)
#----------------------------------------------------------------------------
# Find Pythia6 (optional package)
@@ -1,4 +1,4 @@
$Id: History,v 1.11 2010-12-10 06:22:25 kmura Exp $
$Id: History 77801 2013-11-28 13:33:20Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -15,6 +15,9 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 13th 2013 K. Murakami
- new coding guideline
November 21th, 2012 K. Murakami (exHepMC-V09-05-01)
- changed that AsciiReader uses IO_GenEvent instead of IO_AsciiParticles
- migration to CMake. CMakeLists.txt, added link to -lgfortran/-lg2c
@@ -1,4 +1,4 @@
$Id: README,v 1.2 2010-05-24 05:32:50 kmura Exp $
$Id: README 73446 2013-08-27 11:32:59Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -27,8 +27,7 @@
/// \brief Main program of the eventgenerator/HepMC/HepMCEx02 example
//
//
// $Id$
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id: HepMCEx02.cc 73446 2013-08-27 11:32:59Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -26,24 +26,21 @@
/// \file eventgenerator/HepMC/HepMCEx02/include/H02DetectorConstruction.hh
/// \brief Definition of the H02DetectorConstruction class
//
// ====================================================================
// $Id: H02DetectorConstruction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02DetectorConstruction.hh
// $Id$
//
// ====================================================================
#ifndef H02_DETECTOR_CONSTRUCTION_H
#define H02_DETECTOR_CONSTRUCTION_H
#include "G4Types.hh"
#include "G4VUserDetectorConstruction.hh"
class H02DetectorConstruction : public G4VUserDetectorConstruction {
public:
H02DetectorConstruction();
~H02DetectorConstruction();
~H02DetectorConstruction();
virtual G4VPhysicalVolume* Construct();
virtual G4VPhysicalVolume* Construct();
};
@@ -26,12 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx02/include/H02EventAction.hh
/// \brief Definition of the H02EventAction class
//
// ====================================================================
// $Id: H02EventAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02EventAction.hh
// $Id$
//
// ====================================================================
#ifndef H02_EVENT_ACTION_H
#define H02_EVENT_ACTION_H
@@ -26,12 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx02/include/H02Field.hh
/// \brief Definition of the H02Field class
//
// ====================================================================
// $Id: H02Field.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02Field.hh
// $Id$
//
// ====================================================================
#ifndef H02_FIELD_H
#define H02_FIELD_H
@@ -42,10 +38,9 @@ class H02Field : public G4MagneticField {
public:
H02Field() { }
~H02Field() { }
void GetFieldValue(const G4double Point[3], G4double* Bfield ) const;
};
#endif
@@ -26,28 +26,17 @@
/// \file eventgenerator/HepMC/HepMCEx02/include/H02MuonHit.hh
/// \brief Definition of the H02MuonHit class
//
// ====================================================================
// $Id: H02MuonHit.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02MuonHit.hh
// $Id$
//
// ====================================================================
#ifndef H02_MUON_HIT_H
#define H02_MUON_HIT_H
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
class H02MuonHit : public G4VHit {
private:
G4int moduleID;
G4String pname;
G4ThreeVector momentum;
G4ThreeVector position;
G4double tof;
public:
H02MuonHit();
H02MuonHit(G4int imod, G4String aname, const G4ThreeVector& pxyz,
@@ -57,7 +46,7 @@ public:
H02MuonHit(const H02MuonHit& right);
const H02MuonHit& operator=(const H02MuonHit& right);
G4int operator==(const H02MuonHit& right) const;
void* operator new(size_t);
void operator delete(void* aHit);
@@ -79,20 +68,24 @@ public:
// methods...
virtual void Draw();
virtual void Print();
virtual void Print();
private:
G4int moduleID;
G4String pname;
G4ThreeVector momentum;
G4ThreeVector position;
G4double tof;
};
// ====================================================================
// inline functions
// ====================================================================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void H02MuonHit::SetModuleID(G4int i) { moduleID=i; }
inline G4int H02MuonHit::GetModuleID() const { return moduleID; }
inline void H02MuonHit::SetParticle(G4String aname) { pname=aname; }
inline G4String H02MuonHit::GetParticle() const { return pname; }
inline void H02MuonHit::SetMomentum(const G4ThreeVector& pxyz)
inline void H02MuonHit::SetMomentum(const G4ThreeVector& pxyz)
{ momentum=pxyz; }
inline G4ThreeVector H02MuonHit::GetMomentum() const { return momentum; }
@@ -26,15 +26,11 @@
/// \file eventgenerator/HepMC/HepMCEx02/include/H02MuonSD.hh
/// \brief Definition of the H02MuonSD class
//
// ====================================================================
// $Id: H02MuonSD.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02MuonSD.hh
// $Id$
//
// ====================================================================
#ifndef H02_MUON_SD_H
#define H02_MUON_SD_H
#include "G4VSensitiveDetector.hh"
#include "H02MuonHit.hh"
@@ -43,20 +39,20 @@ class G4HCofThisEvent;
class G4TouchableHistory;
class H02MuonSD : public G4VSensitiveDetector {
private:
H02MuonHitsCollection* hitCollection;
public:
H02MuonSD(G4String name);
~H02MuonSD();
virtual void Initialize(G4HCofThisEvent* HCE);
virtual G4bool ProcessHits(G4Step* astep, G4TouchableHistory* ROhist);
virtual void EndOfEvent(G4HCofThisEvent* HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
private:
H02MuonHitsCollection* hitCollection;
};
#endif
@@ -29,7 +29,7 @@
// ====================================================================
//
// H02PrimaryGeneratorAction.hh
// $Id$
// $Id: H02PrimaryGeneratorAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// ====================================================================
#ifndef H02_PRIMARY_GENERATOR_ACTION_H
@@ -44,17 +44,6 @@ class G4VPrimaryGenerator;
class H02PrimaryGeneratorMessenger;
class H02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
private:
G4VPrimaryGenerator* particleGun;
G4VPrimaryGenerator* hepmcAscii;
G4VPrimaryGenerator* pythiaGen;
G4VPrimaryGenerator* currentGenerator;
G4String currentGeneratorName;
std::map<G4String, G4VPrimaryGenerator*> gentypeMap;
H02PrimaryGeneratorMessenger* messenger;
public:
H02PrimaryGeneratorAction();
~H02PrimaryGeneratorAction();
@@ -66,34 +55,44 @@ public:
G4VPrimaryGenerator* GetGenerator() const;
G4String GetGeneratorName() const;
private:
G4VPrimaryGenerator* particleGun;
G4VPrimaryGenerator* hepmcAscii;
G4VPrimaryGenerator* pythiaGen;
G4VPrimaryGenerator* currentGenerator;
G4String currentGeneratorName;
std::map<G4String, G4VPrimaryGenerator*> gentypeMap;
H02PrimaryGeneratorMessenger* messenger;
};
// ====================================================================
// inline functions
// ====================================================================
inline void H02PrimaryGeneratorAction::SetGenerator(G4VPrimaryGenerator* gen)
{
currentGenerator= gen;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void H02PrimaryGeneratorAction::SetGenerator(G4VPrimaryGenerator* gen)
{
currentGenerator= gen;
}
inline void H02PrimaryGeneratorAction::SetGenerator(G4String genname)
inline void H02PrimaryGeneratorAction::SetGenerator(G4String genname)
{
std::map<G4String, G4VPrimaryGenerator*>::iterator pos= gentypeMap.find(genname);
std::map<G4String, G4VPrimaryGenerator*>::iterator
pos = gentypeMap.find(genname);
if(pos != gentypeMap.end()) {
currentGenerator= pos->second;
currentGeneratorName= genname;
}
}
}
inline G4VPrimaryGenerator* H02PrimaryGeneratorAction::GetGenerator() const
{
return currentGenerator;
inline G4VPrimaryGenerator* H02PrimaryGeneratorAction::GetGenerator() const
{
return currentGenerator;
}
inline G4String H02PrimaryGeneratorAction::GetGeneratorName() const
{
return currentGeneratorName;
inline G4String H02PrimaryGeneratorAction::GetGeneratorName() const
{
return currentGeneratorName;
}
#endif
@@ -26,12 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx02/include/H02PrimaryGeneratorMessenger.hh
/// \brief Definition of the H02PrimaryGeneratorMessenger class
//
// ====================================================================
// $Id: H02PrimaryGeneratorMessenger.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02PrimaryGeneratorMessenger.hh
// $Id$
//
// ====================================================================
#ifndef H02_PRIMARY_GENERATOR_MESSENGER_H
#define H02_PRIMARY_GENERATOR_MESSENGER_H
@@ -47,19 +43,19 @@ class G4UIcmdWithAnInteger;
class G4UIcmdWithAString;
class H02PrimaryGeneratorMessenger : public G4UImessenger {
public:
H02PrimaryGeneratorMessenger(H02PrimaryGeneratorAction* genaction);
~H02PrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
private:
H02PrimaryGeneratorAction* primaryAction;
G4UIdirectory* dir;
G4UIcmdWithAString* select;
public:
H02PrimaryGeneratorMessenger(H02PrimaryGeneratorAction* genaction);
~H02PrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
};
#endif
@@ -26,12 +26,8 @@
/// \file eventgenerator/HepMC/HepMCEx02/include/H02SteppingAction.hh
/// \brief Definition of the H02SteppingAction class
//
// ====================================================================
// $Id: H02SteppingAction.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02SteppingAction.hh
// $Id$
//
// ====================================================================
#ifndef H02_STEPPING_ACTION_H
#define H02_STEPPING_ACTION_H
@@ -41,7 +37,7 @@ class H02SteppingAction : public G4UserSteppingAction {
public:
H02SteppingAction();
virtual ~H02SteppingAction();
virtual void UserSteppingAction(const G4Step* astep);
};
@@ -23,15 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/include/HepMCG4AsciiReader.hh
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4AsciiReader.hh
/// \brief Definition of the HepMCG4AsciiReader class
//
// ====================================================================
// $Id: HepMCG4AsciiReader.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4AsciiReader.hh
// $Id$
//
// ====================================================================
#ifndef HEPMC_G4_ASCII_READER_H
#define HEPMC_G4_ASCII_READER_H
@@ -23,15 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/include/HepMCG4AsciiReaderMessenger.hh
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4AsciiReaderMessenger.hh
/// \brief Definition of the HepMCG4AsciiReaderMessenger class
//
// ====================================================================
// $Id: HepMCG4AsciiReaderMessenger.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4AsciiReaderMessenger.hh
// $Id$
//
// ====================================================================
#ifndef HEPMC_G4_ASCII_READER_MESSENGER_H
#define HEPMC_G4_ASCII_READER_MESSENGER_H
@@ -44,6 +41,13 @@ class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class HepMCG4AsciiReaderMessenger : public G4UImessenger {
public:
HepMCG4AsciiReaderMessenger(HepMCG4AsciiReader* agen);
~HepMCG4AsciiReaderMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
private:
HepMCG4AsciiReader* gen;
@@ -51,12 +55,6 @@ private:
G4UIcmdWithAnInteger* verbose;
G4UIcmdWithAString* open;
public:
HepMCG4AsciiReaderMessenger(HepMCG4AsciiReader* agen);
~HepMCG4AsciiReaderMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
};
#endif
@@ -23,24 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/include/HepMCG4Interface.hh
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4Interface.hh
/// \brief Definition of the HepMCG4Interface class
//
// ====================================================================
// $Id: HepMCG4Interface.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4Interface.hh
// $Id$
//
// A base class for primary generation via HepMC object.
// This class is derived from G4VPrimaryGenerator.
//
// ====================================================================
#ifndef HEPMC_G4_INTERFACE_H
#define HEPMC_G4_INTERFACE_H
#include "G4VPrimaryGenerator.hh"
#include "HepMC/GenEvent.h"
/// A base class for primary generation via HepMC object.
/// This class is derived from G4VPrimaryGenerator.
class HepMCG4Interface : public G4VPrimaryGenerator {
protected:
// Note that the life of HepMC event object must be handled by users.
@@ -50,7 +47,7 @@ protected:
// We have to take care for the position of primaries because
// primary vertices outside the world voulme give rise to G4Execption.
// If the default implementation is not adequate, an alternative
// If the default implementation is not adequate, an alternative
// can be implemented in your own class.
virtual G4bool CheckVertexInsideWorld(const G4ThreeVector& pos) const;
@@ -61,7 +58,7 @@ protected:
// An empty event will be created in default.
virtual HepMC::GenEvent* GenerateHepMCEvent();
public:
public:
HepMCG4Interface();
virtual ~HepMCG4Interface();
@@ -73,13 +70,10 @@ public:
virtual void GeneratePrimaryVertex(G4Event* anEvent);
};
// ====================================================================
// inline functions
// ====================================================================
inline HepMC::GenEvent* HepMCG4Interface::GetHepMCGenEvent() const
{
return hepmcEvent;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline HepMC::GenEvent* HepMCG4Interface::GetHepMCGenEvent() const
{
return hepmcEvent;
}
#endif
@@ -23,17 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/include/HepMCG4PythiaInterface.hh
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4PythiaInterface.hh
/// \brief Definition of the HepMCG4PythiaInterface class
//
// ====================================================================
// $Id: HepMCG4PythiaInterface.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4PythiaInterface.hh
// $Id$
//
// A generic interface class with Pythia event generator via HepMC.
//
// ====================================================================
#ifndef HEPMC_G4_PYTHIA_INTERFACE_H
#define HEPMC_G4_PYTHIA_INTERFACE_H
@@ -42,6 +37,8 @@
class HepMCG4PythiaMessenger;
/// A generic interface class with Pythia event generator via HepMC.
class HepMCG4PythiaInterface : public HepMCG4Interface {
protected:
G4int verbose;
@@ -50,7 +47,7 @@ protected:
HepMCG4PythiaMessenger* messenger;
// In default, this is automatic conversion, Pythia->HEPEVT->HepMC,
// In default, this is automatic conversion, Pythia->HEPEVT->HepMC,
// by HepMC utilities.
virtual HepMC::GenEvent* GenerateHepMCEvent();
@@ -60,13 +57,13 @@ public:
// set/get methods
void SetVerboseLevel(G4int i);
G4int GetVerboseLevel() const;
G4int GetVerboseLevel() const;
void SetPylist(G4int i);
G4int GetPylist() const;
G4int GetPylist() const;
// call pyxxx
void CallPyinit(G4String frame, G4String beam, G4String target,
void CallPyinit(G4String frame, G4String beam, G4String target,
G4double win);
void CallPystat(G4int istat);
@@ -84,10 +81,7 @@ public:
virtual void Print() const;
};
// ====================================================================
// inline functions
// ====================================================================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void HepMCG4PythiaInterface::SetVerboseLevel(G4int i)
{
verbose= i;
@@ -23,15 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/include/HepMCG4PythiaMessenger.hh
/// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4PythiaMessenger.hh
/// \brief Definition of the HepMCG4PythiaMessenger class
//
// ====================================================================
// $Id: HepMCG4PythiaMessenger.hh 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4GenericPythiaMessenger.hh
// $Id$
//
// ====================================================================
#ifndef HEPMC_G4_PYTHIA_MESSENGER_H
#define HEPMC_G4_PYTHIA_MESSENGER_H
@@ -59,7 +56,7 @@ private:
G4UIcommand* cpyrget;
G4UIcommand* cpyrset;
G4UIcmdWithAString* printRandomStatus;
public:
HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen);
~HepMCG4PythiaMessenger();
@@ -26,38 +26,26 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/H02DetectorConstruction.cc
/// \brief Implementation of the H02DetectorConstruction class
//
// ====================================================================
// H02DetectorConstruction.cc
// $Id$
//
// ====================================================================
#include "H02DetectorConstruction.hh"
// $Id: H02DetectorConstruction.cc 77801 2013-11-28 13:33:20Z gcosmo $
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4Tubs.hh"
#include "G4Box.hh"
#include "G4ChordFinder.hh"
#include "G4Element.hh"
#include "G4FieldManager.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4PVPlacement.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4TransportationManager.hh"
#include "G4Tubs.hh"
#include "G4VisAttributes.hh"
#include "H02Field.hh"
#include "H02DetectorConstruction.hh"
#include "H02MuonSD.hh"
// for magnetic field
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4ChordFinder.hh"
#include "H02Field.hh"
#include "G4SystemOfUnits.hh"
// ====================================================================
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// constants (detector parameters)
//
// ====================================================================
// [experimental hall]
static const G4double R_EXPHALL= 5.*m;
static const G4double DZ_EXPHALL= 10.*m;
@@ -82,28 +70,18 @@ static const G4double RIN_ENDCAP_MUON= 1.*m;
static const G4double ROUT_ENDCAP_MUON= 4.5*m;
static const G4double DZ_ENDCAP_MUON= 10.*cm;
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02DetectorConstruction::H02DetectorConstruction()
////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02DetectorConstruction::~H02DetectorConstruction()
/////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* H02DetectorConstruction::Construct()
//////////////////////////////////////////////////////
{
// ==============================================================
// Materials
@@ -147,10 +125,10 @@ G4VPhysicalVolume* H02DetectorConstruction::Construct()
// ==============================================================
// Experimental Hall (world)
// ==============================================================
G4Tubs* expHallSolid=
G4Tubs* expHallSolid=
new G4Tubs("EXP_HALL", 0., R_EXPHALL, DZ_EXPHALL, 0., 360.*deg);
G4LogicalVolume* expHallLV=
G4LogicalVolume* expHallLV=
new G4LogicalVolume(expHallSolid, Air, "EXP_HALL_LV");
// visualization attributes
@@ -167,18 +145,18 @@ G4VPhysicalVolume* H02DetectorConstruction::Construct()
// each detector component
// ==============================================================
// calorimeter system
G4Tubs* barrelCalSolid=
new G4Tubs("BARREL_CAL", RIN_BARREL_CAL, ROUT_BARREL_CAL,
G4Tubs* barrelCalSolid=
new G4Tubs("BARREL_CAL", RIN_BARREL_CAL, ROUT_BARREL_CAL,
DZ_BARREL_CAL, 0., 360.*deg);
G4Tubs* endcapCalSolid=
new G4Tubs("ENDCAP_CAL", RIN_ENDCAP_CAL, ROUT_ENDCAP_CAL,
G4Tubs* endcapCalSolid=
new G4Tubs("ENDCAP_CAL", RIN_ENDCAP_CAL, ROUT_ENDCAP_CAL,
DZ_ENDCAP_CAL, 0., 360.*deg);
G4LogicalVolume* barrelCalLV=
G4LogicalVolume* barrelCalLV=
new G4LogicalVolume(barrelCalSolid, Lead, "BARREL_CAL_LV");
G4LogicalVolume* endcapCalLV=
G4LogicalVolume* endcapCalLV=
new G4LogicalVolume(endcapCalSolid, Lead, "ENDCAP_CAL_LV");
G4VisAttributes* calVisAtt=
@@ -186,30 +164,30 @@ G4VPhysicalVolume* H02DetectorConstruction::Construct()
barrelCalLV-> SetVisAttributes(calVisAtt);
endcapCalLV-> SetVisAttributes(calVisAtt);
// G4PVPlacement* barrelCal=
// G4PVPlacement* barrelCal=
new G4PVPlacement(0, G4ThreeVector(), "BARREL_CAL_PV",
barrelCalLV, expHall, FALSE, 0);
G4ThreeVector posCal(0.,0.,6.*m);
// G4PVPlacement* endcapCal1=
// G4PVPlacement* endcapCal1=
new G4PVPlacement(0, posCal, "ENDCAP_CAL_PV",
endcapCalLV, expHall, FALSE, 0);
//G4PVPlacement* endcapCal2=
//G4PVPlacement* endcapCal2=
new G4PVPlacement(0, -posCal, "ENDCAP_CAL_PV",
endcapCalLV, expHall, FALSE, 1);
// muon system
G4Box* barrelMuonSolid= new G4Box("BARREL_MUON", DX_BARREL_MUON,
G4Box* barrelMuonSolid= new G4Box("BARREL_MUON", DX_BARREL_MUON,
DY_BARREL_MUON, DZ_BARREL_MUON);
G4Tubs* endcapMuonSolid=
new G4Tubs("ENDCAP_MUON", RIN_ENDCAP_MUON, ROUT_ENDCAP_MUON,
G4Tubs* endcapMuonSolid=
new G4Tubs("ENDCAP_MUON", RIN_ENDCAP_MUON, ROUT_ENDCAP_MUON,
DZ_ENDCAP_MUON, 0., 360.*deg);
G4LogicalVolume* barrelMuonLV=
G4LogicalVolume* barrelMuonLV=
new G4LogicalVolume(barrelMuonSolid, Ar, "BARREL_MUON_LV");
G4LogicalVolume* endcapMuonLV=
G4LogicalVolume* endcapMuonLV=
new G4LogicalVolume(endcapMuonSolid, Ar, "ENDCAP_MUON_LV");
G4VisAttributes* muonVisAtt=
@@ -232,11 +210,11 @@ G4VPhysicalVolume* H02DetectorConstruction::Construct()
}
G4ThreeVector posMuon(0.,0.,8.*m);
// G4PVPlacement* endcapMuon1=
// G4PVPlacement* endcapMuon1=
new G4PVPlacement(0, posMuon, "ENDCAP_MUON_PV",
endcapMuonLV, expHall, FALSE, 0);
// G4PVPlacement* endcapMuon2=
// G4PVPlacement* endcapMuon2=
new G4PVPlacement(0, -posMuon, "ENDCAP_MUON_PV",
endcapMuonLV, expHall, FALSE, 1);
@@ -252,11 +230,10 @@ G4VPhysicalVolume* H02DetectorConstruction::Construct()
// magnetic field
H02Field* myfield = new H02Field;
G4FieldManager* fieldMgr=
G4FieldManager* fieldMgr=
G4TransportationManager::GetTransportationManager()-> GetFieldManager();
fieldMgr-> SetDetectorField(myfield);
fieldMgr-> CreateChordFinder(myfield);
return expHall;
}
@@ -26,40 +26,26 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/H02EventAction.cc
/// \brief Implementation of the H02EventAction class
//
// ====================================================================
// $Id: H02EventAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02EventAction.cc
// $Id$
//
// ====================================================================
#include "H02EventAction.hh"
#include "G4Event.hh"
#include "G4SDManager.hh"
#include "H02EventAction.hh"
#include "H02MuonSD.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02EventAction::H02EventAction()
//////////////////////////////
{
}
///////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02EventAction::~H02EventAction()
///////////////////////////////
{
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02EventAction::BeginOfEventAction(const G4Event* anEvent)
//////////////////////////////////////////////////////////////
{
const G4Event* ev = anEvent; ev=0;
#ifdef DEBUG_HEPMC
@@ -69,18 +55,17 @@ void H02EventAction::BeginOfEventAction(const G4Event* anEvent)
G4int i;
for(i=0; i< nVtx; i++) {
const G4PrimaryVertex* primaryVertex= anEvent-> GetPrimaryVertex(i);
primaryVertex-> Print();
primaryVertex-> Print();
}
#endif
}
////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02EventAction::EndOfEventAction(const G4Event*)
////////////////////////////////////////////////////////////
{
G4cout << " Print out hit information" << G4endl;
G4SDManager* SDManager= G4SDManager::GetSDMpointer();
H02MuonSD* muonSD=
H02MuonSD* muonSD=
(H02MuonSD*)SDManager-> FindSensitiveDetector("/mydet/muon");
muonSD-> PrintAll();
muonSD-> DrawAll();
@@ -26,19 +26,14 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/H02Field.cc
/// \brief Implementation of the H02Field class
//
// ====================================================================
//
// H02Field.hh
// $Id$
// $Id: H02Field.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// ====================================================================
#include "H02Field.hh"
#include "G4SystemOfUnits.hh"
#include "H02Field.hh"
////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02Field::GetFieldValue(const G4double Point[3], G4double* Bfield) const
////////////////////////////////////////////////////////////////////////////
{
const G4double Bz= 3.0*tesla;
const G4double rmax_sq = sqr(1.*m);
@@ -48,8 +43,7 @@ void H02Field::GetFieldValue(const G4double Point[3], G4double* Bfield) const
Bfield[1] = 0.;
if(std::abs(Point[2])<zmax && (sqr(Point[0])+sqr(Point[1]))<rmax_sq) {
Bfield[2]= Bz;
} else {
Bfield[2]= 0.;
} else {
Bfield[2]= 0.;
}
}
@@ -26,56 +26,47 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/H02MuonHit.cc
/// \brief Implementation of the H02MuonHit class
//
// ====================================================================
// $Id: H02MuonHit.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02MuonHit.cc
// $Id$
//
// ====================================================================
#include "H02MuonHit.hh"
#include "G4VVisManager.hh"
#include <iomanip>
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4SystemOfUnits.hh"
#include <iomanip>
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
#include "H02MuonHit.hh"
G4Allocator<H02MuonHit> H02MuonHitAllocator;
////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02MuonHit::H02MuonHit()
: moduleID(-1)
////////////////////////
{
}
/////////////////////////////////////////////////////////////
H02MuonHit::H02MuonHit(G4int imod, G4String aname,
const G4ThreeVector& pxyz,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02MuonHit::H02MuonHit(G4int imod, G4String aname,
const G4ThreeVector& pxyz,
const G4ThreeVector& xyz, G4double atof)
: moduleID(imod), pname(aname), momentum(pxyz),
position(xyz), tof(atof)
/////////////////////////////////////////////////////////////
{
}
////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02MuonHit::~H02MuonHit()
////////////////////////
{
}
/////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02MuonHit::H02MuonHit(const H02MuonHit& right)
/////////////////////////////////////////////
: G4VHit()
{
*this= right;
}
////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const H02MuonHit& H02MuonHit::operator=(const H02MuonHit& right)
////////////////////////////////////////////////////////////////
{
moduleID= right.moduleID;
pname= right.pname;
@@ -86,16 +77,14 @@ const H02MuonHit& H02MuonHit::operator=(const H02MuonHit& right)
return *this;
}
/////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int H02MuonHit::operator==(const H02MuonHit& right) const
/////////////////////////////////////////////////////////
{
return (this==&right) ? 1 : 0;
}
///////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02MuonHit::Draw()
///////////////////////
{
const G4double pt_min=20.*GeV;
@@ -115,10 +104,9 @@ void H02MuonHit::Draw()
}
}
////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02MuonHit::Print()
////////////////////////
{
{
G4int id= moduleID;
G4String tag="B";
if(moduleID >=10) {
@@ -127,7 +115,7 @@ void H02MuonHit::Print()
}
G4cout << tag << id << " :" << std::setw(12) << pname.c_str()
<< " : pT=" << std::setprecision(3) << momentum.perp()/GeV
<< " : TOF=" << std::setprecision(3) << tof/ns
<< " : x=" << std::setprecision(3) << position*(1./m)
<< " : TOF=" << std::setprecision(3) << tof/ns
<< " : x=" << std::setprecision(3) << position*(1./m)
<< G4endl;
}
@@ -26,51 +26,41 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/H02MuonSD.cc
/// \brief Implementation of the H02MuonSD class
//
// ====================================================================
// $Id: H02MuonSD.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02MuonSD.cc
// $Id$
//
// ====================================================================
#include "H02MuonSD.hh"
#include "H02MuonHit.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ios.hh"
#include "G4VPhysicalVolume.hh"
#include "H02MuonHit.hh"
#include "H02MuonSD.hh"
/////////////////////////////////
H02MuonSD::H02MuonSD(G4String name)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02MuonSD::H02MuonSD(G4String name)
: G4VSensitiveDetector(name)
/////////////////////////////////
{
G4String HCname;
collectionName.insert("muonHit");
}
///////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02MuonSD::~H02MuonSD()
///////////////////////////////////////////////
{
}
///////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02MuonSD::Initialize(G4HCofThisEvent* HCE)
///////////////////////////////////////////////
{
static int HCID=-1;
hitCollection= new H02MuonHitsCollection(SensitiveDetectorName,
collectionName[0]);
hitCollection= new H02MuonHitsCollection(SensitiveDetectorName,
collectionName[0]);
if(HCID<0) HCID= GetCollectionID(0);
HCE-> AddHitsCollection(HCID, hitCollection);
}
///////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool H02MuonSD::ProcessHits(G4Step* astep, G4TouchableHistory*)
///////////////////////////////////////////////////////////////////////
{
G4ParticleDefinition* particle= astep-> GetTrack()-> GetDefinition();
if(particle-> GetPDGCharge() == 0.) return false;
@@ -86,39 +76,34 @@ G4bool H02MuonSD::ProcessHits(G4Step* astep, G4TouchableHistory*)
G4VPhysicalVolume* volume= prestep-> GetPhysicalVolume();
G4int id= volume-> GetCopyNo();
if(volume-> GetName() == "ENDCAP_MUON_PV") id +=10;
H02MuonHit* aHit=
new H02MuonHit(id, particle-> GetParticleName(), vmom, vpos, tof);
H02MuonHit* aHit=
new H02MuonHit(id, particle-> GetParticleName(), vmom, vpos, tof);
hitCollection-> insert(aHit);
return true;
}
///////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02MuonSD::EndOfEvent(G4HCofThisEvent*)
///////////////////////////////////////////////
{
}
//////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02MuonSD::clear()
//////////////////////
{
}
}
////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02MuonSD::DrawAll()
////////////////////////
{
}
}
/////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02MuonSD::PrintAll()
/////////////////////////
{
G4int nHit= hitCollection-> entries();
G4cout << "------------------------------------------" << G4endl
<< "*** Muon System Hit (#hits=" << nHit << ")" << G4endl;
hitCollection-> PrintAllHits();
}
}
@@ -25,24 +25,17 @@
//
/// \file eventgenerator/HepMC/HepMCEx02/src/H02PrimaryGeneratorAction.cc
/// \brief Implementation of the H02PrimaryGeneratorAction class
// $Id: H02PrimaryGeneratorAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// ====================================================================
//
// H02PrimaryGeneratorAction.cc
// $Id$
//
// ====================================================================
#include "H02PrimaryGeneratorAction.hh"
#include "H02PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "HepMCG4AsciiReader.hh"
#include "HepMCG4PythiaInterface.hh"
#include "H02PrimaryGeneratorAction.hh"
#include "H02PrimaryGeneratorMessenger.hh"
////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02PrimaryGeneratorAction::H02PrimaryGeneratorAction()
////////////////////////////////////////////////////
{
// default generator is particle gun.
currentGenerator= particleGun= new G4ParticleGun();
@@ -58,25 +51,22 @@ H02PrimaryGeneratorAction::H02PrimaryGeneratorAction()
gentypeMap["hepmcAscii"]= hepmcAscii;
gentypeMap["pythia"]= pythiaGen;
messenger= new H02PrimaryGeneratorMessenger(this);
messenger= new H02PrimaryGeneratorMessenger(this);
}
/////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02PrimaryGeneratorAction::~H02PrimaryGeneratorAction()
/////////////////////////////////////////////////////
{
delete messenger;
}
//////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//////////////////////////////////////////////////////////////////
{
if(currentGenerator)
currentGenerator-> GeneratePrimaryVertex(anEvent);
else
else
G4Exception("H02PrimaryGeneratorAction::GeneratePrimaries",
"InvalidSetup", FatalException,
"Generator is not instanciated.");
}
@@ -26,28 +26,22 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/H02PrimaryGeneratorMessenger.cc
/// \brief Implementation of the H02PrimaryGeneratorMessenger class
//
// ====================================================================
// $Id: H02PrimaryGeneratorMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02PrimaryGeneratorMessenger.cc
// $Id$
//
// ====================================================================
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIparameter.hh"
#include "H02PrimaryGeneratorMessenger.hh"
#include "H02PrimaryGeneratorAction.hh"
/////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02PrimaryGeneratorMessenger::H02PrimaryGeneratorMessenger
(H02PrimaryGeneratorAction* genaction)
: primaryAction(genaction)
/////////////////////////////////////////////////////////////////
{
dir= new G4UIdirectory("/generator/");
dir-> SetGuidance("Control commands for primary generator");
@@ -65,39 +59,34 @@ H02PrimaryGeneratorMessenger::H02PrimaryGeneratorMessenger
select-> SetDefaultValue("particleGun");
}
///////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02PrimaryGeneratorMessenger::~H02PrimaryGeneratorMessenger()
///////////////////////////////////////////////////////////
{
//delete verbose;
delete select;
delete dir;
}
}
///////////////////////////////////////////////////////////////////
void H02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
G4String newValues)
///////////////////////////////////////////////////////////////////
{
if ( command==select) {
primaryAction-> SetGenerator(newValues);
G4cout << "current generator type: "
G4cout << "current generator type: "
<< primaryAction-> GetGeneratorName() << G4endl;
} else {
}
}
///////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String H02PrimaryGeneratorMessenger::GetCurrentValue(G4UIcommand* command)
///////////////////////////////////////////////////////////////////////////
{
G4String cv, st;
if (command == select) {
cv= primaryAction-> GetGeneratorName();
}
}
return cv;
}
@@ -26,38 +26,31 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/H02SteppingAction.cc
/// \brief Implementation of the H02SteppingAction class
//
// ====================================================================
// $Id: H02SteppingAction.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// H02SteppingAction.cc
// $Id$
//
// ====================================================================
#include "H02SteppingAction.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4SteppingManager.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
#include "H02SteppingAction.hh"
////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02SteppingAction::H02SteppingAction()
////////////////////////////////////
{
}
/////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
H02SteppingAction::~H02SteppingAction()
/////////////////////////////////////
{
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void H02SteppingAction::UserSteppingAction(const G4Step* astep)
//////////////////////////////////////////////////////////////
{
G4Track* atrack= astep-> GetTrack();
@@ -75,4 +68,3 @@ void H02SteppingAction::UserSteppingAction(const G4Step* astep)
atrack-> SetTrackStatus(fKillTrackAndSecondaries);
}
}
@@ -26,10 +26,10 @@
/// \file eventgenerator/HepMC/HepMCEx02/src/HEPEvtcom.cc
/// \brief Implementation of the HEPEvtcom class
//
//$Id$
//$Id: HEPEvtcom.cc 77801 2013-11-28 13:33:20Z gcosmo $
// ======================================================================
// PARAMETER (NMXHEP=4000)
// COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP),
// PARAMETER (NMXHEP=4000)
// COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP),
// & JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP)
// ======================================================================
///**********************************************************/
@@ -59,12 +59,12 @@
///*========================================================*/
//
// This interface to HEPEVT common block treats the block as
// an array of bytes --- the precision and number of entries
// an array of bytes --- the precision and number of entries
// is determined "on the fly" by the wrapper and used to decode
// each entry.
//
// HEPEVT_EntriesAllocation is the maximum size of the HEPEVT common block
// that can be interfaced. It is NOT the actual size of the HEPEVT common
// HEPEVT_EntriesAllocation is the maximum size of the HEPEVT common block
// that can be interfaced. It is NOT the actual size of the HEPEVT common
// used in each individual application. The actual size can be changed on
// the fly using HepMC::HEPEVT_Wrapper::set_max_number_entries().
// Thus HEPEVT_EntriesAllocation should typically be set
@@ -75,7 +75,7 @@
enum {HEPEVT_EntriesAllocation=4000};
const unsigned int hepevt_bytes_allocation =
const unsigned int hepevt_bytes_allocation =
sizeof(long int) * ( 2 + 4 * HEPEVT_EntriesAllocation )
+ sizeof(double) * ( 9 * HEPEVT_EntriesAllocation );
@@ -84,4 +84,3 @@ extern "C" struct hepevt{
};
hepevt hepevt_;
@@ -23,56 +23,49 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/src/HepMCG4AsciiReader.cc
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4AsciiReader.cc
/// \brief Implementation of the HepMCG4AsciiReader class
//
// ====================================================================
// $Id: HepMCG4AsciiReader.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4AsciiReader.cc
// $Id$
//
// ====================================================================
#include "HepMCG4AsciiReader.hh"
#include "HepMCG4AsciiReaderMessenger.hh"
#include <iostream>
#include <fstream>
////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReader::HepMCG4AsciiReader()
: filename("xxx.dat"), verbose(0)
////////////////////////////////////////
{
asciiInput= new HepMC::IO_GenEvent(filename.c_str(), std::ios::in);
messenger= new HepMCG4AsciiReaderMessenger(this);
}
/////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReader::~HepMCG4AsciiReader()
/////////////////////////////////////////
{
delete asciiInput;
delete messenger;
}
/////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4AsciiReader::Initialize()
/////////////////////////////////////
{
delete asciiInput;
asciiInput= new HepMC::IO_GenEvent(filename.c_str(), std::ios::in);
}
/////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMC::GenEvent* HepMCG4AsciiReader::GenerateHepMCEvent()
/////////////////////////////////////////////////////////
{
HepMC::GenEvent* evt= asciiInput-> read_next_event();
if(!evt) return 0; // no more event
if(verbose>0) evt-> print();
return evt;
}
@@ -23,33 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/src/HepMCG4AsciiReaderMessenger.cc
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4AsciiReaderMessenger.cc
/// \brief Implementation of the HepMCG4AsciiReaderMessenger class
//
// ====================================================================
// $Id: HepMCG4AsciiReaderMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4AsciiReaderMessenger.cc
// $Id$
//
// ====================================================================
#include "HepMCG4AsciiReaderMessenger.hh"
#include "HepMCG4AsciiReader.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "HepMCG4AsciiReaderMessenger.hh"
#include "HepMCG4AsciiReader.hh"
////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger
(HepMCG4AsciiReader* agen)
: gen(agen)
////////////////////////////////////////////////////////
{
dir= new G4UIdirectory("/generator/hepmcAscii/");
dir-> SetGuidance("Reading HepMC event from an Ascii file");
verbose=
verbose=
new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this);
verbose-> SetGuidance("Set verbose level");
verbose-> SetParameterName("verboseLevel", false, false);
@@ -57,12 +52,11 @@ HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger
open= new G4UIcmdWithAString("/generator/hepmcAscii/open", this);
open-> SetGuidance("(re)open data file (HepMC Ascii format)");
open-> SetParameterName("input ascii file", true, true);
open-> SetParameterName("input ascii file", true, true);
}
///////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger()
///////////////////////////////////////////////////////////
{
delete verbose;
delete open;
@@ -70,26 +64,24 @@ HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger()
delete dir;
}
///////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4AsciiReaderMessenger::SetNewValue(G4UIcommand* command,
G4String newValues)
///////////////////////////////////////////////////////////////////
{
if (command==verbose) {
int level= verbose-> GetNewIntValue(newValues);
gen-> SetVerboseLevel(level);
} else if (command==open) {
gen-> SetFileName(newValues);
G4cout << "HepMC Ascii inputfile: "
G4cout << "HepMC Ascii inputfile: "
<< gen-> GetFileName() << G4endl;
gen-> Initialize();
}
}
///////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command)
///////////////////////////////////////////////////////////////////////////
{
G4String cv;
@@ -100,4 +92,3 @@ G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command)
}
return cv;
}
@@ -23,15 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/src/HepMCG4Interface.cc
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4Interface.cc
/// \brief Implementation of the HepMCG4Interface class
//
// ====================================================================
// $Id: HepMCG4Interface.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4Interface.cc
// $Id$
//
// ====================================================================
#include "HepMCG4Interface.hh"
#include "G4RunManager.hh"
@@ -43,24 +40,21 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4Interface::HepMCG4Interface()
: hepmcEvent(0)
////////////////////////////////////
{
}
/////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4Interface::~HepMCG4Interface()
/////////////////////////////////////
{
delete hepmcEvent;
}
/////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool HepMCG4Interface::CheckVertexInsideWorld
(const G4ThreeVector& pos) const
/////////////////////////////////////////////////////////
{
G4Navigator* navigator= G4TransportationManager::GetTransportationManager()
-> GetNavigatorForTracking();
@@ -73,17 +67,16 @@ G4bool HepMCG4Interface::CheckVertexInsideWorld
else return true;
}
////////////////////////////////////////////////////////////////
void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
G4Event* g4event)
////////////////////////////////////////////////////////////////
{
for(HepMC::GenEvent::vertex_const_iterator vitr= hepmcevt->vertices_begin();
vitr != hepmcevt->vertices_end(); ++vitr ) { // loop for vertex ...
// real vertex?
G4bool qvtx=false;
for (HepMC::GenVertex::particle_iterator
for (HepMC::GenVertex::particle_iterator
pitr= (*vitr)->particles_begin(HepMC::children);
pitr != (*vitr)->particles_end(HepMC::children); ++pitr) {
@@ -95,16 +88,16 @@ void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
if (!qvtx) continue;
// check world boundary
HepMC::FourVector pos= (*vitr)-> position();
HepMC::FourVector pos= (*vitr)-> position();
G4LorentzVector xvtx(pos.x(), pos.y(), pos.z(), pos.t());
if (! CheckVertexInsideWorld(xvtx.vect()*mm)) continue;
// create G4PrimaryVertex and associated G4PrimaryParticles
G4PrimaryVertex* g4vtx=
new G4PrimaryVertex(xvtx.x()*mm, xvtx.y()*mm, xvtx.z()*mm,
G4PrimaryVertex* g4vtx=
new G4PrimaryVertex(xvtx.x()*mm, xvtx.y()*mm, xvtx.z()*mm,
xvtx.t()*mm/c_light);
for (HepMC::GenVertex::particle_iterator
for (HepMC::GenVertex::particle_iterator
vpitr= (*vitr)->particles_begin(HepMC::children);
vpitr != (*vitr)->particles_end(HepMC::children); ++vpitr) {
@@ -113,27 +106,24 @@ void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt,
G4int pdgcode= (*vpitr)-> pdg_id();
pos= (*vpitr)-> momentum();
G4LorentzVector p(pos.px(), pos.py(), pos.pz(), pos.e());
G4PrimaryParticle* g4prim=
G4PrimaryParticle* g4prim=
new G4PrimaryParticle(pdgcode, p.x()*GeV, p.y()*GeV, p.z()*GeV);
g4vtx-> SetPrimary(g4prim);
}
g4event-> AddPrimaryVertex(g4vtx);
}
}
}
}
///////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMC::GenEvent* HepMCG4Interface::GenerateHepMCEvent()
///////////////////////////////////////////////////////
{
HepMC::GenEvent* aevent= new HepMC::GenEvent();
return aevent;
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4Interface::GeneratePrimaryVertex(G4Event* anEvent)
//////////////////////////////////////////////////////////////
{
// delete previous event object
delete hepmcEvent;
@@ -141,11 +131,10 @@ void HepMCG4Interface::GeneratePrimaryVertex(G4Event* anEvent)
// generate next event
hepmcEvent= GenerateHepMCEvent();
if(! hepmcEvent) {
G4cout << "HepMCInterface: no generated particles. run terminated..."
G4cout << "HepMCInterface: no generated particles. run terminated..."
<< G4endl;
G4RunManager::GetRunManager()-> AbortRun();
return;
}
HepMC2G4(hepmcEvent, anEvent);
}
@@ -23,24 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/src/HepMCG4PythiaInterface.cc
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4PythiaInterface.cc
/// \brief Implementation of the HepMCG4PythiaInterface class
//
// ====================================================================
// $Id: HepMCG4PythiaInterface.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4PythiaInterface.cc
// $Id$
//
// ====================================================================
#ifdef G4LIB_USE_PYTHIA
#include "HepMCG4PythiaInterface.hh"
#include "HepMCG4PythiaMessenger.hh"
#include "HepMC/GenEvent.h"
#include "HepMC/PythiaWrapper6_4.h"
#include "HepMC/GenEvent.h"
#include "HepMC/PythiaWrapper6_4.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// additional pythia calls
#define pygive pygive_
#define pyrget pyrget_
@@ -56,74 +53,65 @@ void call_pygive(G4String s) { pygive(s.c_str(), s.length()); }
void call_pyrget(int a, int b) { pyrget(&a, &b); }
void call_pyrset(int a, int b) { pyrset(&a, &b); }
////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaInterface::HepMCG4PythiaInterface()
: verbose(0), mpylist(0)
////////////////////////////////////////////////
{
#ifdef NEED_INITPYDATA
#ifdef NEED_INITPYDATA
initpydata();
// Some platforms may require the initialization of pythia PYDATA block
// data as external - if you get pythia initialization errors try
// Some platforms may require the initialization of pythia PYDATA block
// data as external - if you get pythia initialization errors try
// commenting in/out the below call to initpydata().
#endif
messenger= new HepMCG4PythiaMessenger(this);
}
/////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaInterface::~HepMCG4PythiaInterface()
/////////////////////////////////////////////////
{
delete messenger;
}
/////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPygive(G4String par)
/////////////////////////////////////////////////////
{
call_pygive(par);
}
//////////////////////////////////////////////////////////////////////
void HepMCG4PythiaInterface::CallPyinit(G4String frame, G4String beam,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPyinit(G4String frame, G4String beam,
G4String target, G4double win)
//////////////////////////////////////////////////////////////////////
{
call_pyinit(frame.c_str(), beam.c_str(), target.c_str(), win);
}
////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPystat(G4int istat)
////////////////////////////////////////////////////
{
call_pystat(istat);
}
///////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::SetRandomSeed(G4int iseed)
///////////////////////////////////////////////////////
{
pydatr.mrpy[1-1]= iseed;
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPyrget(G4int lun, G4int move)
//////////////////////////////////////////////////////////////
{
call_pyrget(lun, move);
}
//////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::CallPyrset(G4int lun, G4int move)
//////////////////////////////////////////////////////////////
{
call_pyrset(lun, move);
}
//////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::PrintRandomStatus(std::ostream& ostr) const
//////////////////////////////////////////////////////////////////////////
{
ostr << "# Pythia random numbers status" << G4endl;
for (G4int j=0; j<6; j++) {
@@ -134,24 +122,22 @@ void HepMCG4PythiaInterface::PrintRandomStatus(std::ostream& ostr) const
}
}
////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::SetUserParameters()
////////////////////////////////////////////////
{
G4cout << "set user parameters of PYTHIA common." << G4endl
<< "nothing to be done in default."
<< G4endl;
}
/////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMC::GenEvent* HepMCG4PythiaInterface::GenerateHepMCEvent()
/////////////////////////////////////////////////////////////
{
static G4int nevent= 0; // event counter
call_pyevnt(); // generate one event with Pythia
if(mpylist >=1 && mpylist<= 3) call_pylist(mpylist);
call_pyhepc(1);
HepMC::GenEvent* evt= hepevtio.read_next_event();
@@ -161,9 +147,8 @@ HepMC::GenEvent* HepMCG4PythiaInterface::GenerateHepMCEvent()
return evt;
}
//////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaInterface::Print() const
//////////////////////////////////////////
{
G4cout << "PythiaInterface::Print()..." << G4endl;
}
@@ -23,33 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file eventgenerator/HepMC/HepMCEx02/src/HepMCG4PythiaMessenger.cc
/// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4PythiaMessenger.cc
/// \brief Implementation of the HepMCG4PythiaMessenger class
//
// ====================================================================
// $Id: HepMCG4PythiaMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
//
// HepMCG4PythiaMessenger.cc
// $Id$
//
// ====================================================================
#ifdef G4LIB_USE_PYTHIA
#include "HepMCG4PythiaMessenger.hh"
#include "HepMCG4PythiaInterface.hh"
#include <sstream>
#include <fstream>
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "HepMCG4PythiaMessenger.hh"
#include "HepMCG4PythiaInterface.hh"
////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaMessenger::HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen)
: gen(agen)
////////////////////////////////////////////////////////////////////////////
{
dir= new G4UIdirectory("/generator/pythia/");
dir-> SetGuidance("Commands for Pythia event generation");
@@ -87,11 +80,11 @@ HepMCG4PythiaMessenger::HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen)
cpygive= new G4UIcommand("/generator/pythia/pygive",this);
cpygive-> SetGuidance("call PYGIVE");
G4UIparameter* parameter= new G4UIparameter ("Parameter", 's', false);
cpygive-> SetParameter(parameter);
cpygive-> SetParameter(parameter);
setUserParameters=
setUserParameters=
new G4UIcmdWithoutParameter("/generator/pythia/setUserParameters",this);
setUserParameters->
setUserParameters->
SetGuidance("Set user parameters in the Pythia common blocks");
setSeed= new G4UIcmdWithAnInteger("/generator/pythia/setSeed", this);
@@ -114,22 +107,21 @@ HepMCG4PythiaMessenger::HepMCG4PythiaMessenger(HepMCG4PythiaInterface* agen)
move-> SetDefaultValue(0);
cpyrset-> SetParameter(move);
printRandomStatus=
printRandomStatus=
new G4UIcmdWithAString("/generator/pythia/printRandomStatus", this);
printRandomStatus-> SetGuidance("print random number status.");
printRandomStatus-> SetParameterName("filename", true, false);
printRandomStatus-> SetDefaultValue("std::cout");
}
/////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HepMCG4PythiaMessenger::~HepMCG4PythiaMessenger()
/////////////////////////////////////////////////
{
delete verbose;
delete mpylist;
delete print;
delete cpyinit;
delete cpystat;
delete cpystat;
delete cpygive;
delete setUserParameters;
delete setSeed;
@@ -140,10 +132,9 @@ HepMCG4PythiaMessenger::~HepMCG4PythiaMessenger()
delete dir;
}
//////////////////////////////////////////////////////////////
void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
G4String newValues)
//////////////////////////////////////////////////////////////
{
if(command == verbose) { // /verbose ...
G4int level= verbose-> GetNewIntValue(newValues);
@@ -199,7 +190,7 @@ void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
} else {
// to a file (overwrite mode)
std::ofstream ofs;
ofs.open(s.c_str(), std::ios::out);
ofs.open(s.c_str(), std::ios::out);
//ofs.open(randomStatusFileName.c_str(), std::ios::out|std::ios::app);
ofs.setf(std::ios::fixed | std::ios::showpoint);
gen-> PrintRandomStatus(ofs);
@@ -208,9 +199,8 @@ void HepMCG4PythiaMessenger::SetNewValue(G4UIcommand* command,
}
}
//////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String HepMCG4PythiaMessenger::GetCurrentValue(G4UIcommand* command)
//////////////////////////////////////////////////////////////////////
{
G4String cv;
if (command == verbose) {
@@ -1,4 +1,4 @@
$Id: History,v 1.22 2010-12-10 06:23:16 kmura Exp $
$Id: History 77801 2013-11-28 13:33:20Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -15,6 +15,12 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 13th 2013 K. Murakami (exHepMC-V09-06-01)
- new coding guideline
August 27th, 2013 G. Cosmo (exHepMC-V09-06-00)
- Added G4Ellipsoid among solids enabled for parameterisation in HepMCEx01.
November 23th, 2012 I. Hrivnacova (exHepMC-V09-05-02)
- Renamed hepmcEx0N.cc to HepMCEx0N.cc to match exactly with the example directory name
(this allows to configure CMake build in the same way on both case sensitive
@@ -17,11 +17,7 @@ include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Find HepMC (required package)
#
find_package(HepMC QUIET)
if(NOT HEPMC_FOUND)
message(STATUS "G4 Examples: HepMC package not found. --> MCTruth example disabled")
return()
endif()
find_package(HepMC REQUIRED)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2010-12-02 15:37:20 witoldp Exp $
# $Id: GNUmakefile 73446 2013-08-27 11:32:59Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for examples module.
# --------------------------------------------------------------
@@ -1,4 +1,4 @@
$Id: History,v 1.4 2010-12-03 12:51:29 gcosmo Exp $
$Id: History 73446 2013-08-27 11:32:59Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -1,4 +1,4 @@
$Id: README,v 1.2 2010-12-02 15:37:20 witoldp Exp $
$Id: README 73446 2013-08-27 11:32:59Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -27,7 +27,7 @@
/// \brief Definition of the DetectorConstruction class
//
//
// $Id$
// $Id: DetectorConstruction.hh 73446 2013-08-27 11:32:59Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -27,7 +27,7 @@
/// \brief Definition of the MCTruthConfig class
//
//
// $Id$
// $Id: MCTruthConfig.hh 73446 2013-08-27 11:32:59Z gcosmo $
//
//
// --------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More