Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
$Id: History 85989 2014-11-06 15:40:05Z gcosmo $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
analysis/shared History file
|
||||
----------------------------
|
||||
This file should be used by the G4 example coordinator to briefly
|
||||
summarize all major modifications introduced in the code and keep
|
||||
track of all tags.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
06-11-14 I. Hrivnacova (analysisShared-V10-00-01)
|
||||
- Moved scripts from upper directory in shared
|
||||
|
||||
05-11-14 I. Hrivnacova (analysisShared-V10-00-00)
|
||||
- Tagged version which will be included in AnaEx0N examples
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file ActionInitialization.hh
|
||||
/// \brief Definition of the ActionInitialization class
|
||||
|
||||
#ifndef ActionInitialization_h
|
||||
#define ActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
class DetectorConstruction;
|
||||
|
||||
/// Action initialization class.
|
||||
///
|
||||
|
||||
class ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
ActionInitialization(DetectorConstruction* detector);
|
||||
virtual ~ActionInitialization();
|
||||
|
||||
virtual void BuildForMaster() const;
|
||||
virtual void Build() const;
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/DetectorConstruction.hh
|
||||
/// \brief Definition of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef DetectorConstruction_h
|
||||
#define DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Box;
|
||||
class G4LogicalVolume;
|
||||
class G4VPhysicalVolume;
|
||||
class G4Material;
|
||||
class DetectorMessenger;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
|
||||
DetectorConstruction();
|
||||
virtual ~DetectorConstruction();
|
||||
|
||||
public:
|
||||
|
||||
void SetAbsorberMaterial (G4String);
|
||||
void SetAbsorberThickness(G4double);
|
||||
|
||||
void SetGapMaterial (G4String);
|
||||
void SetGapThickness(G4double);
|
||||
|
||||
void SetCalorSizeYZ(G4double);
|
||||
void SetNbOfLayers (G4int);
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
|
||||
public:
|
||||
|
||||
void PrintCalorParameters();
|
||||
|
||||
G4double GetWorldSizeX() {return fWorldSizeX;};
|
||||
G4double GetWorldSizeYZ() {return fWorldSizeYZ;};
|
||||
|
||||
G4double GetCalorThickness() {return fCalorThickness;};
|
||||
G4double GetCalorSizeYZ() {return fCalorSizeYZ;};
|
||||
|
||||
G4int GetNbOfLayers() {return fNbOfLayers;};
|
||||
|
||||
G4Material* GetAbsorberMaterial() {return fAbsorberMaterial;};
|
||||
G4double GetAbsorberThickness() {return fAbsorberThickness;};
|
||||
|
||||
G4Material* GetGapMaterial() {return fGapMaterial;};
|
||||
G4double GetGapThickness() {return fGapThickness;};
|
||||
|
||||
const G4VPhysicalVolume* GetphysiWorld() {return fPhysiWorld;};
|
||||
const G4VPhysicalVolume* GetAbsorber() {return fPhysiAbsorber;};
|
||||
const G4VPhysicalVolume* GetGap() {return fPhysiGap;};
|
||||
|
||||
private:
|
||||
|
||||
G4Material* fAbsorberMaterial;
|
||||
G4double fAbsorberThickness;
|
||||
|
||||
G4Material* fGapMaterial;
|
||||
G4double fGapThickness;
|
||||
|
||||
G4int fNbOfLayers;
|
||||
G4double fLayerThickness;
|
||||
|
||||
G4double fCalorSizeYZ;
|
||||
G4double fCalorThickness;
|
||||
|
||||
G4Material* fDefaultMaterial;
|
||||
G4double fWorldSizeYZ;
|
||||
G4double fWorldSizeX;
|
||||
|
||||
G4Box* fSolidWorld; //pointer to the solid World
|
||||
G4LogicalVolume* fLogicWorld; //pointer to the logical World
|
||||
G4VPhysicalVolume* fPhysiWorld; //pointer to the physical World
|
||||
|
||||
G4Box* fSolidCalor; //pointer to the solid Calor
|
||||
G4LogicalVolume* fLogicCalor; //pointer to the logical Calor
|
||||
G4VPhysicalVolume* fPhysiCalor; //pointer to the physical Calor
|
||||
|
||||
G4Box* fSolidLayer; //pointer to the solid Layer
|
||||
G4LogicalVolume* fLogicLayer; //pointer to the logical Layer
|
||||
G4VPhysicalVolume* fPhysiLayer; //pointer to the physical Layer
|
||||
|
||||
G4Box* fSolidAbsorber; //pointer to the solid Absorber
|
||||
G4LogicalVolume* fLogicAbsorber; //pointer to the logical Absorber
|
||||
G4VPhysicalVolume* fPhysiAbsorber; //pointer to the physical Absorber
|
||||
|
||||
G4Box* fSolidGap; //pointer to the solid Gap
|
||||
G4LogicalVolume* fLogicGap; //pointer to the logical Gap
|
||||
G4VPhysicalVolume* fPhysiGap; //pointer to the physical Gap
|
||||
|
||||
DetectorMessenger* fDetectorMessenger; //pointer to the Messenger
|
||||
|
||||
private:
|
||||
|
||||
void DefineMaterials();
|
||||
void ComputeCalorParameters();
|
||||
G4VPhysicalVolume* ConstructCalorimeter();
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
inline void DetectorConstruction::ComputeCalorParameters()
|
||||
{
|
||||
// Compute derived parameters of the calorimeter
|
||||
fLayerThickness = fAbsorberThickness + fGapThickness;
|
||||
fCalorThickness = fNbOfLayers*fLayerThickness;
|
||||
|
||||
fWorldSizeX = 1.2*fCalorThickness; fWorldSizeYZ = 1.2*fCalorSizeYZ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/DetectorMessenger.hh
|
||||
/// \brief Definition of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef DetectorMessenger_h
|
||||
#define DetectorMessenger_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class DetectorConstruction;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithoutParameter;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class DetectorMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
DetectorMessenger(DetectorConstruction* );
|
||||
virtual ~DetectorMessenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
|
||||
G4UIdirectory* fN03Dir;
|
||||
G4UIdirectory* fDetDir;
|
||||
G4UIcmdWithAString* fAbsMaterCmd;
|
||||
G4UIcmdWithAString* fGapMaterCmd;
|
||||
G4UIcmdWithADoubleAndUnit* fAbsThickCmd;
|
||||
G4UIcmdWithADoubleAndUnit* fGapThickCmd;
|
||||
G4UIcmdWithADoubleAndUnit* fSizeYZCmd;
|
||||
G4UIcmdWithAnInteger* fNbLayersCmd;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/EventAction.hh
|
||||
/// \brief Definition of the EventAction class
|
||||
//
|
||||
//
|
||||
// $Id: EventAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef EventAction_h
|
||||
#define EventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class RunAction;
|
||||
class HistoManager;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
EventAction(RunAction*, HistoManager*);
|
||||
virtual ~EventAction();
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event*);
|
||||
virtual void EndOfEventAction(const G4Event*);
|
||||
|
||||
void AddAbs(G4double de, G4double dl) {fEnergyAbs += de; fTrackLAbs += dl;};
|
||||
void AddGap(G4double de, G4double dl) {fEnergyGap += de; fTrackLGap += dl;};
|
||||
|
||||
private:
|
||||
RunAction* fRunAct;
|
||||
HistoManager* fHistoManager;
|
||||
|
||||
G4double fEnergyAbs, fEnergyGap;
|
||||
G4double fTrackLAbs, fTrackLGap;
|
||||
|
||||
G4int fPrintModulo;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef PrimaryGeneratorAction_h
|
||||
#define PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
class DetectorConstruction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction(DetectorConstruction*);
|
||||
virtual ~PrimaryGeneratorAction();
|
||||
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun; //pointer a to G4 class
|
||||
DetectorConstruction* fDetector; //pointer to the geometry
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/RunAction.hh
|
||||
/// \brief Definition of the RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: RunAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef RunAction_h
|
||||
#define RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class G4Run;
|
||||
class HistoManager;
|
||||
|
||||
class RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
RunAction(HistoManager*);
|
||||
virtual ~RunAction();
|
||||
|
||||
virtual void BeginOfRunAction(const G4Run*);
|
||||
virtual void EndOfRunAction(const G4Run*);
|
||||
|
||||
void fillPerEvent(G4double, G4double, G4double, G4double);
|
||||
|
||||
private:
|
||||
HistoManager* fHistoManager;
|
||||
|
||||
G4double fSumEAbs, fSum2EAbs;
|
||||
G4double fSumEGap, fSum2EGap;
|
||||
|
||||
G4double fSumLAbs, fSum2LAbs;
|
||||
G4double fSumLGap, fSum2LGap;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/SteppingAction.hh
|
||||
/// \brief Definition of the SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef SteppingAction_h
|
||||
#define SteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
|
||||
class DetectorConstruction;
|
||||
class EventAction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class SteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
SteppingAction(DetectorConstruction*, EventAction*);
|
||||
virtual ~SteppingAction();
|
||||
|
||||
virtual void UserSteppingAction(const G4Step*);
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
EventAction* fEventAction;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
$Id: History 85773 2014-11-05 11:31:15Z ihrivnac $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
analysis/scripts History file
|
||||
----------------------------
|
||||
This file should be used by the G4 example coordinator to briefly
|
||||
summarize all major modifications introduced in the code and keep
|
||||
track of all tags.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
05-11-14 I. Hrivnacova (analysisScripts-V10-00-00)
|
||||
- Tagged version which will be included in AnaEx0N examples
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to remove classes copied from shared directory into include and src
|
||||
# via copy_files.sh
|
||||
#
|
||||
# By I. Hrivnacova, IPN Orsay
|
||||
|
||||
DIRNAME=$1
|
||||
|
||||
for FILE in `ls $DIRNAME/include`; do
|
||||
rm -f include/$FILE
|
||||
done
|
||||
for FILE in `ls $DIRNAME/src`; do
|
||||
rm -f src/$FILE
|
||||
done
|
||||
|
||||
echo "... clean_files.sh from $1 finished"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to copy classes from shared directory into include and src
|
||||
# as it is required by GNUmake build.
|
||||
# Usage: copy_files.sh directoryName
|
||||
#
|
||||
# By I. Hrivnacova, IPN Orsay
|
||||
|
||||
DIRNAME=$1
|
||||
|
||||
cp -rp $DIRNAME/include/* include
|
||||
cp -rp $DIRNAME/src/* src
|
||||
|
||||
echo "... copy_files.sh from $1 finished"
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
|
||||
: G4VUserActionInitialization(),
|
||||
fDetector(detector)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
// Histo manager
|
||||
HistoManager* histo = new HistoManager();
|
||||
|
||||
// Actions
|
||||
SetUserAction(new RunAction(histo));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
// Histo manager
|
||||
HistoManager* histo = new HistoManager();
|
||||
|
||||
// Actions
|
||||
//
|
||||
SetUserAction(new PrimaryGeneratorAction(fDetector));
|
||||
|
||||
RunAction* runAction = new RunAction(histo);
|
||||
SetUserAction(runAction);
|
||||
|
||||
EventAction* eventAction = new EventAction(runAction, histo);
|
||||
SetUserAction(eventAction);
|
||||
|
||||
SteppingAction* steppingAction = new SteppingAction(fDetector, eventAction);
|
||||
SetUserAction(steppingAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,340 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
:G4VUserDetectorConstruction(),
|
||||
fAbsorberMaterial(0),fGapMaterial(0),fDefaultMaterial(0),
|
||||
fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
|
||||
fSolidCalor(0),fLogicCalor(0),fPhysiCalor(0),
|
||||
fSolidLayer(0),fLogicLayer(0),fPhysiLayer(0),
|
||||
fSolidAbsorber(0),fLogicAbsorber(0),fPhysiAbsorber(0),
|
||||
fSolidGap (0),fLogicGap (0),fPhysiGap (0),
|
||||
fDetectorMessenger(0)
|
||||
{
|
||||
// default parameter values of the calorimeter
|
||||
fAbsorberThickness = 10.*mm;
|
||||
fGapThickness = 5.*mm;
|
||||
fNbOfLayers = 10;
|
||||
fCalorSizeYZ = 10.*cm;
|
||||
ComputeCalorParameters();
|
||||
|
||||
// materials
|
||||
DefineMaterials();
|
||||
SetAbsorberMaterial("G4_Pb");
|
||||
SetGapMaterial("G4_lAr");
|
||||
|
||||
// create commands for interactive definition of the calorimeter
|
||||
fDetectorMessenger = new DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{ delete fDetectorMessenger;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
return ConstructCalorimeter();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// use G4-NIST materials data base
|
||||
//
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
fDefaultMaterial = man->FindOrBuildMaterial("G4_Galactic");
|
||||
man->FindOrBuildMaterial("G4_Pb");
|
||||
man->FindOrBuildMaterial("G4_lAr");
|
||||
|
||||
// print table
|
||||
//
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
{
|
||||
|
||||
// Clean old geometry, if any
|
||||
//
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
|
||||
// complete the Calor parameters definition
|
||||
ComputeCalorParameters();
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
fSolidWorld = new G4Box("World", //its name
|
||||
fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //its size
|
||||
|
||||
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
|
||||
fDefaultMaterial, //its material
|
||||
"World"); //its name
|
||||
|
||||
fPhysiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fLogicWorld, //its logical volume
|
||||
"World", //its name
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Calorimeter
|
||||
//
|
||||
fSolidCalor=0; fLogicCalor=0; fPhysiCalor=0;
|
||||
fSolidLayer=0; fLogicLayer=0; fPhysiLayer=0;
|
||||
|
||||
if (fCalorThickness > 0.)
|
||||
{ fSolidCalor = new G4Box("Calorimeter", //its name
|
||||
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);//size
|
||||
|
||||
fLogicCalor = new G4LogicalVolume(fSolidCalor, //its solid
|
||||
fDefaultMaterial, //its material
|
||||
"Calorimeter"); //its name
|
||||
|
||||
fPhysiCalor = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fLogicCalor, //its logical volume
|
||||
"Calorimeter", //its name
|
||||
fLogicWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Layer
|
||||
//
|
||||
fSolidLayer = new G4Box("Layer", //its name
|
||||
fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
|
||||
|
||||
fLogicLayer = new G4LogicalVolume(fSolidLayer, //its solid
|
||||
fDefaultMaterial, //its material
|
||||
"Layer"); //its name
|
||||
if (fNbOfLayers > 1)
|
||||
fPhysiLayer = new G4PVReplica("Layer", //its name
|
||||
fLogicLayer, //its logical volume
|
||||
fLogicCalor, //its mother
|
||||
kXAxis, //axis of replication
|
||||
fNbOfLayers, //number of replica
|
||||
fLayerThickness); //witdth of replica
|
||||
else
|
||||
fPhysiLayer = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fLogicLayer, //its logical volume
|
||||
"Layer", //its name
|
||||
fLogicCalor, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
}
|
||||
|
||||
//
|
||||
// Absorber
|
||||
//
|
||||
fSolidAbsorber=0; fLogicAbsorber=0; fPhysiAbsorber=0;
|
||||
|
||||
if (fAbsorberThickness > 0.)
|
||||
{ fSolidAbsorber = new G4Box("Absorber", //its name
|
||||
fAbsorberThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
|
||||
|
||||
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, //its solid
|
||||
fAbsorberMaterial, //its material
|
||||
fAbsorberMaterial->GetName());//name
|
||||
|
||||
fPhysiAbsorber = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(-fGapThickness/2,0.,0.), //its position
|
||||
fLogicAbsorber, //its logical volume
|
||||
fAbsorberMaterial->GetName(), //its name
|
||||
fLogicLayer, //its mother
|
||||
false, //no boulean operat
|
||||
0); //copy number
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Gap
|
||||
//
|
||||
fSolidGap=0; fLogicGap=0; fPhysiGap=0;
|
||||
|
||||
if (fGapThickness > 0.)
|
||||
{ fSolidGap = new G4Box("Gap",
|
||||
fGapThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
|
||||
|
||||
fLogicGap = new G4LogicalVolume(fSolidGap,
|
||||
fGapMaterial,
|
||||
fGapMaterial->GetName());
|
||||
|
||||
fPhysiGap = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(fAbsorberThickness/2,0.,0.), //its position
|
||||
fLogicGap, //its logical volume
|
||||
fGapMaterial->GetName(), //its name
|
||||
fLogicLayer, //its mother
|
||||
false, //no boulean operat
|
||||
0); //copy number
|
||||
}
|
||||
|
||||
PrintCalorParameters();
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
fLogicWorld->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
fLogicCalor->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
//
|
||||
//always return the physical World
|
||||
//
|
||||
return fPhysiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::PrintCalorParameters()
|
||||
{
|
||||
G4cout << "\n------------------------------------------------------------"
|
||||
<< "\n---> The calorimeter is " << fNbOfLayers << " layers of: [ "
|
||||
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName()
|
||||
<< " + "
|
||||
<< fGapThickness/mm << "mm of " << fGapMaterial->GetName() << " ] "
|
||||
<< "\n------------------------------------------------------------\n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{
|
||||
fAbsorberMaterial = pttoMaterial;
|
||||
if ( fLogicAbsorber )
|
||||
{
|
||||
fLogicAbsorber->SetMaterial(fAbsorberMaterial);
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetGapMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{
|
||||
fGapMaterial = pttoMaterial;
|
||||
if ( fLogicGap )
|
||||
{
|
||||
fLogicGap->SetMaterial(fGapMaterial);
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetAbsorberThickness(G4double val)
|
||||
{
|
||||
// change Absorber thickness and recompute the calorimeter parameters
|
||||
fAbsorberThickness = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetGapThickness(G4double val)
|
||||
{
|
||||
// change Gap thickness and recompute the calorimeter parameters
|
||||
fGapThickness = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetCalorSizeYZ(G4double val)
|
||||
{
|
||||
// change the transverse size and recompute the calorimeter parameters
|
||||
fCalorSizeYZ = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetNbOfLayers(G4int val)
|
||||
{
|
||||
fNbOfLayers = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,142 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
|
||||
: G4UImessenger(),
|
||||
fDetector(Det),
|
||||
fN03Dir(0),
|
||||
fDetDir(0),
|
||||
fAbsMaterCmd(0),
|
||||
fGapMaterCmd(0),
|
||||
fAbsThickCmd(0),
|
||||
fGapThickCmd(0),
|
||||
fSizeYZCmd(0),
|
||||
fNbLayersCmd(0)
|
||||
{
|
||||
fN03Dir = new G4UIdirectory("/N03/");
|
||||
fN03Dir->SetGuidance("UI commands of this example");
|
||||
|
||||
G4bool broadcast = false;
|
||||
fDetDir = new G4UIdirectory("/N03/det/",broadcast);
|
||||
fDetDir->SetGuidance("detector control");
|
||||
|
||||
fAbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
|
||||
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
|
||||
fAbsMaterCmd->SetParameterName("choice",false);
|
||||
fAbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fGapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
|
||||
fGapMaterCmd->SetGuidance("Select Material of the Gap.");
|
||||
fGapMaterCmd->SetParameterName("choice",false);
|
||||
fGapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
|
||||
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
|
||||
fAbsThickCmd->SetParameterName("Size",false);
|
||||
fAbsThickCmd->SetRange("Size>=0.");
|
||||
fAbsThickCmd->SetUnitCategory("Length");
|
||||
fAbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
|
||||
fGapThickCmd->SetGuidance("Set Thickness of the Gap");
|
||||
fGapThickCmd->SetParameterName("Size",false);
|
||||
fGapThickCmd->SetRange("Size>=0.");
|
||||
fGapThickCmd->SetUnitCategory("Length");
|
||||
fGapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
|
||||
fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
|
||||
fSizeYZCmd->SetParameterName("Size",false);
|
||||
fSizeYZCmd->SetRange("Size>0.");
|
||||
fSizeYZCmd->SetUnitCategory("Length");
|
||||
fSizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fNbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
|
||||
fNbLayersCmd->SetGuidance("Set number of layers.");
|
||||
fNbLayersCmd->SetParameterName("NbLayers",false);
|
||||
fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
|
||||
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete fNbLayersCmd;
|
||||
delete fAbsMaterCmd; delete fGapMaterCmd;
|
||||
delete fAbsThickCmd; delete fGapThickCmd;
|
||||
delete fSizeYZCmd;
|
||||
delete fDetDir;
|
||||
delete fN03Dir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == fAbsMaterCmd )
|
||||
{ fDetector->SetAbsorberMaterial(newValue);}
|
||||
|
||||
if( command == fGapMaterCmd )
|
||||
{ fDetector->SetGapMaterial(newValue);}
|
||||
|
||||
if( command == fAbsThickCmd )
|
||||
{ fDetector->SetAbsorberThickness(fAbsThickCmd
|
||||
->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fGapThickCmd )
|
||||
{ fDetector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fSizeYZCmd )
|
||||
{ fDetector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fNbLayersCmd )
|
||||
{ fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/EventAction.cc
|
||||
/// \brief Implementation of the EventAction class
|
||||
//
|
||||
//
|
||||
// $Id: EventAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction(RunAction* run, HistoManager* histo)
|
||||
:G4UserEventAction(),
|
||||
fRunAct(run),fHistoManager(histo),
|
||||
fEnergyAbs(0.), fEnergyGap(0.),
|
||||
fTrackLAbs(0.), fTrackLGap(0.),
|
||||
fPrintModulo(0)
|
||||
{
|
||||
fPrintModulo = 100; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::~EventAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%fPrintModulo == 0)
|
||||
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
|
||||
|
||||
// initialisation per event
|
||||
fEnergyAbs = fEnergyGap = 0.;
|
||||
fTrackLAbs = fTrackLGap = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
//accumulates statistic
|
||||
//
|
||||
fRunAct->fillPerEvent(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
|
||||
|
||||
//fill histograms
|
||||
//
|
||||
fHistoManager->FillHisto(1, fEnergyAbs);
|
||||
fHistoManager->FillHisto(2, fEnergyGap);
|
||||
fHistoManager->FillHisto(3, fTrackLAbs);
|
||||
fHistoManager->FillHisto(4, fTrackLGap);
|
||||
|
||||
//fill ntuple
|
||||
//
|
||||
fHistoManager->FillNtuple(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0),
|
||||
fDetector(DC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="e-");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(500.*MeV);
|
||||
G4double position = -0.5*(fDetector->GetWorldSizeX());
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: RunAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(HistoManager* histo)
|
||||
: G4UserRunAction(),
|
||||
fHistoManager(histo),
|
||||
fSumEAbs(0.), fSum2EAbs(0.),
|
||||
fSumEGap(0.), fSum2EGap(0.),
|
||||
fSumLAbs(0.), fSum2LAbs(0.),
|
||||
fSumLGap(0.), fSum2LGap(0.)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
//initialize cumulative quantities
|
||||
//
|
||||
fSumEAbs = fSum2EAbs =fSumEGap = fSum2EGap = 0.;
|
||||
fSumLAbs = fSum2LAbs =fSumLGap = fSum2LGap = 0.;
|
||||
|
||||
//histograms
|
||||
//
|
||||
fHistoManager->book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::fillPerEvent(G4double EAbs, G4double EGap,
|
||||
G4double LAbs, G4double LGap)
|
||||
{
|
||||
//accumulate statistic
|
||||
//
|
||||
fSumEAbs += EAbs; fSum2EAbs += EAbs*EAbs;
|
||||
fSumEGap += EGap; fSum2EGap += EGap*EGap;
|
||||
|
||||
fSumLAbs += LAbs; fSum2LAbs += LAbs*LAbs;
|
||||
fSumLGap += LGap; fSum2LGap += LGap*LGap;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4int NbOfEvents = aRun->GetNumberOfEvent();
|
||||
if (NbOfEvents == 0) return;
|
||||
|
||||
//compute statistics: mean and rms
|
||||
//
|
||||
fSumEAbs /= NbOfEvents; fSum2EAbs /= NbOfEvents;
|
||||
G4double rmsEAbs = fSum2EAbs - fSumEAbs*fSumEAbs;
|
||||
if (rmsEAbs >0.) rmsEAbs = std::sqrt(rmsEAbs); else rmsEAbs = 0.;
|
||||
|
||||
fSumEGap /= NbOfEvents; fSum2EGap /= NbOfEvents;
|
||||
G4double rmsEGap = fSum2EGap - fSumEGap*fSumEGap;
|
||||
if (rmsEGap >0.) rmsEGap = std::sqrt(rmsEGap); else rmsEGap = 0.;
|
||||
|
||||
fSumLAbs /= NbOfEvents; fSum2LAbs /= NbOfEvents;
|
||||
G4double rmsLAbs = fSum2LAbs - fSumLAbs*fSumLAbs;
|
||||
if (rmsLAbs >0.) rmsLAbs = std::sqrt(rmsLAbs); else rmsLAbs = 0.;
|
||||
|
||||
fSumLGap /= NbOfEvents; fSum2LGap /= NbOfEvents;
|
||||
G4double rmsLGap = fSum2LGap - fSumLGap*fSumLGap;
|
||||
if (rmsLGap >0.) rmsLGap = std::sqrt(rmsLGap); else rmsLGap = 0.;
|
||||
|
||||
//print
|
||||
//
|
||||
G4cout
|
||||
<< "\n--------------------End of Run------------------------------\n"
|
||||
<< "\n mean Energy in Absorber : " << G4BestUnit(fSumEAbs,"Energy")
|
||||
<< " +- " << G4BestUnit(rmsEAbs,"Energy")
|
||||
<< "\n mean Energy in Gap : " << G4BestUnit(fSumEGap,"Energy")
|
||||
<< " +- " << G4BestUnit(rmsEGap,"Energy")
|
||||
<< G4endl;
|
||||
|
||||
G4cout
|
||||
<< "\n mean trackLength in Absorber : " << G4BestUnit(fSumLAbs,"Length")
|
||||
<< " +- " << G4BestUnit(rmsLAbs,"Length")
|
||||
<< "\n mean trackLength in Gap : " << G4BestUnit(fSumLGap,"Length")
|
||||
<< " +- " << G4BestUnit(rmsLGap,"Length")
|
||||
<< "\n------------------------------------------------------------\n"
|
||||
<< G4endl;
|
||||
|
||||
//save histograms
|
||||
//
|
||||
fHistoManager->PrintStatistic();
|
||||
fHistoManager->save();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/SteppingAction.cc
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(DetectorConstruction* det,
|
||||
EventAction* evt)
|
||||
: G4UserSteppingAction(),
|
||||
fDetector(det), fEventAction(evt)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::~SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
// get volume of the current step
|
||||
G4VPhysicalVolume* volume
|
||||
= aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
|
||||
|
||||
// collect energy and track length step by step
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
G4double stepl = 0.;
|
||||
if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.)
|
||||
stepl = aStep->GetStepLength();
|
||||
|
||||
if (volume == fDetector->GetAbsorber()) fEventAction->AddAbs(edep,stepl);
|
||||
if (volume == fDetector->GetGap()) fEventAction->AddGap(edep,stepl);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Reference in New Issue
Block a user