Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (copied from B1ActionInitialization)
|
||||
|
||||
#ifndef ActionInitialization_h
|
||||
#define ActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
/// Action initialization class.
|
||||
|
||||
class ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
ActionInitialization();
|
||||
virtual ~ActionInitialization();
|
||||
|
||||
virtual void BuildForMaster() const;
|
||||
virtual void Build() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (adapted from B2bChamberParameterisation)
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
|
||||
#ifndef CloudParameterisation_h
|
||||
#define CloudParameterisation_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <vector>
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4Box;
|
||||
|
||||
// Dummy declarations to get rid of warnings ...
|
||||
class G4Trd;
|
||||
class G4Trap;
|
||||
class G4Cons;
|
||||
class G4Orb;
|
||||
class G4Sphere;
|
||||
class G4Ellipsoid;
|
||||
class G4Torus;
|
||||
class G4Para;
|
||||
class G4Hype;
|
||||
class G4Tubs;
|
||||
class G4Polycone;
|
||||
class G4Polyhedra;
|
||||
|
||||
class CloudParameterisation : public G4VPVParameterisation
|
||||
{
|
||||
public:
|
||||
|
||||
CloudParameterisation(const std::vector<G4ThreeVector>& positions);
|
||||
|
||||
virtual ~CloudParameterisation();
|
||||
|
||||
void ComputeTransformation (const G4int copyNo,
|
||||
G4VPhysicalVolume* physVol) const;
|
||||
|
||||
void ComputeDimensions (G4Box&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Trd&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Trap&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Cons&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Tubs&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Orb&,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 (G4Polycone&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Polyhedra&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Sphere&,const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
private:
|
||||
|
||||
std::vector<G4ThreeVector> fPositions;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (adapted from B1DetectorConstruction)
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
|
||||
#ifndef DetectorConstruction_h
|
||||
#define DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "FastAerosol.hh"
|
||||
|
||||
#include "G4UserLimits.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
class DetectorConstructionMessenger;
|
||||
|
||||
/// Detector construction class to define materials and geometry.
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
DetectorConstruction();
|
||||
virtual ~DetectorConstruction();
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
|
||||
G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
|
||||
|
||||
// Physics
|
||||
G4double fStepLim = DBL_MAX; // global step limit
|
||||
G4UserLimits* fStepLimits; // physics implementation of limit
|
||||
|
||||
// Cloud build choice
|
||||
G4bool fFastAerosolCloud = false;
|
||||
G4bool fParameterisedCloud = false;
|
||||
G4bool fSmoothCloud = false;
|
||||
|
||||
// Cloud droplet details
|
||||
G4double fDropletR = 1;
|
||||
|
||||
// FastAerosol cloud details
|
||||
FastAerosol* fCloud = NULL; // the cloud bulk and droplet positions
|
||||
G4bool fPrePopulate = false; // whether to pre-load droplet positions (true) or not (false)
|
||||
G4double fDropletNumDens = 0; // number density of droplets
|
||||
G4double fMinSpacing = 0.0; // minimum spacing between droplets
|
||||
int fCloudSeed = 0; // random seed dictating droplet distribution
|
||||
|
||||
// parameterised cloud details
|
||||
G4double fSmartless = 2.0; // control the 'fSmartless' property of parameterised solid. Roughly how many voxels the volume is split into for geometry optimization
|
||||
|
||||
G4String fCloudShapeStr = "box"; // cloud bulk shape
|
||||
G4String fDropletShapeStr = "sphere"; // droplet shape
|
||||
|
||||
G4VSolid* fCloudShape; // actual cloud bulk shape
|
||||
G4VSolid* fDropletShape; // actual droplet solid
|
||||
|
||||
protected:
|
||||
G4LogicalVolume* fScoringVolume;
|
||||
|
||||
private:
|
||||
DetectorConstructionMessenger* fMessenger;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (adapted from B2aDetectorMessenger)
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
|
||||
#ifndef DetectorConstructionMessenger_h
|
||||
#define DetectorConstructionMessenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithADouble;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWithAString;
|
||||
class DetectorConstruction;
|
||||
|
||||
class DetectorConstructionMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
DetectorConstructionMessenger(DetectorConstruction* detectorIn);
|
||||
virtual ~DetectorConstructionMessenger();
|
||||
virtual void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
|
||||
G4UIdirectory* fGeometryDirectory;
|
||||
|
||||
G4UIcmdWithADoubleAndUnit* fStepLimCmd;
|
||||
|
||||
G4UIcmdWithADoubleAndUnit* fDropletRCmd;
|
||||
G4UIcmdWithADouble* fDropletNumDensCmd;
|
||||
|
||||
G4UIcmdWithABool* fFastAerosolCloudCmd;
|
||||
G4UIcmdWithABool* fParameterisedCloudCmd;
|
||||
G4UIcmdWithABool* fSmoothCloudCmd;
|
||||
|
||||
G4UIcmdWithAString* fCloudShapeCmd;
|
||||
G4UIcmdWithAString* fDropletShapeCmd;
|
||||
|
||||
G4UIcmdWithABool* fPrePopulateCmd;
|
||||
|
||||
G4UIcmdWithADoubleAndUnit* fMinSpacingCmd;
|
||||
|
||||
G4UIcmdWithADouble* fSmartlessCmd;
|
||||
|
||||
G4UIcmdWithAnInteger* fCloudSeedCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (copied from B1EventAction)
|
||||
|
||||
#ifndef EventAction_h
|
||||
#define EventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class RunAction;
|
||||
|
||||
/// Event action class
|
||||
///
|
||||
|
||||
class EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
EventAction(RunAction* runAction);
|
||||
virtual ~EventAction();
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event* event);
|
||||
virtual void EndOfEventAction(const G4Event* event);
|
||||
|
||||
void AddEdep(G4double edep) { fEdep += edep; }
|
||||
|
||||
private:
|
||||
RunAction* fRunAction;
|
||||
G4double fEdep;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (adapted from B1PrimaryGeneratorAction)
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
|
||||
#ifndef PrimaryGeneratorAction_h
|
||||
#define PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
class G4Box;
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction();
|
||||
virtual ~PrimaryGeneratorAction();
|
||||
|
||||
// method from the base class
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
|
||||
// method to access particle gun
|
||||
const G4ParticleGun* GetParticleGun() const { return fParticleGun; }
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun;
|
||||
G4Box* fWorldBox;
|
||||
};
|
||||
|
||||
#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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (copied from B1RunAction)
|
||||
|
||||
#ifndef RunAction_h
|
||||
#define RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "G4Accumulable.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
|
||||
/// Run action class
|
||||
///
|
||||
/// In EndOfRunAction(), it calculates the dose in the selected volume
|
||||
/// from the energy deposit accumulated via stepping and event actions.
|
||||
/// The computed dose is then printed on the screen.
|
||||
|
||||
class RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
RunAction();
|
||||
virtual ~RunAction();
|
||||
|
||||
// virtual G4Run* GenerateRun();
|
||||
virtual void BeginOfRunAction(const G4Run*);
|
||||
virtual void EndOfRunAction(const G4Run*);
|
||||
|
||||
void AddEdep (G4double edep);
|
||||
|
||||
private:
|
||||
G4Accumulable<G4double> fEdep;
|
||||
G4Accumulable<G4double> fEdep2;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// (copied from B1SteppingAction)
|
||||
|
||||
#ifndef SteppingAction_h
|
||||
#define SteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class EventAction;
|
||||
|
||||
class G4LogicalVolume;
|
||||
|
||||
/// Stepping action class
|
||||
///
|
||||
|
||||
class SteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
SteppingAction(EventAction* eventAction);
|
||||
virtual ~SteppingAction();
|
||||
|
||||
// method from the base class
|
||||
virtual void UserSteppingAction(const G4Step*);
|
||||
|
||||
private:
|
||||
EventAction* fEventAction;
|
||||
G4LogicalVolume* fScoringVolume;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,238 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// FastAerosol
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// A FastAerosol is a collection of points in a voxelized
|
||||
// arbitrarily-shaped volume with methods implementing population of
|
||||
// grids/voxels and for efficiently finding the nearest point.
|
||||
//
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef FastAerosol_h
|
||||
#define FastAerosol_h
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VSolid.hh"
|
||||
|
||||
// rotations and number density distribution
|
||||
#include <functional>
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include <atomic>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
class FastAerosol {
|
||||
public:
|
||||
// Constructor; creates a random cloud of droplets
|
||||
FastAerosol(const G4String& pName, G4VSolid* pCloud,
|
||||
G4double pR, G4double pMinD, G4double pAvgNumDens, G4double pdR,
|
||||
std::function<G4double (G4ThreeVector)> pNumDensDistribution);
|
||||
|
||||
FastAerosol(const G4String& pName, G4VSolid* pCloud,
|
||||
G4double pR, G4double pMinD, G4double pNumDens, G4double pdR);
|
||||
|
||||
FastAerosol(const G4String& pName, G4VSolid* pCloud,
|
||||
G4double pR, G4double pMinD, G4double pNumDens);
|
||||
|
||||
// Destructor; frees memory
|
||||
~FastAerosol();
|
||||
|
||||
// Populate all grids. Otherwise, they are populated on-the-fly
|
||||
void PopulateAllGrids();
|
||||
|
||||
// Save locations of droplets to a file for visualization/analysis purposes
|
||||
void SaveToFile(const char *filename);
|
||||
|
||||
// Get absolutely nearest droplet - must be public as FastAerosolSolid uses it
|
||||
bool GetNearestDroplet(const G4ThreeVector &p, G4ThreeVector ¢er, G4double &closestDistance, G4double stepLim, G4VSolid* droplet, std::function<G4RotationMatrix (G4ThreeVector)> rotation);
|
||||
|
||||
// Get nearest droplet along a vector - must be public as FastAerosolSolid uses it
|
||||
bool GetNearestDroplet(const G4ThreeVector &p, const G4ThreeVector &v, G4ThreeVector ¢er, G4double &closestDistance, G4double stepLim, G4VSolid* droplet, std::function<G4RotationMatrix (G4ThreeVector)> rotation);
|
||||
|
||||
// ======
|
||||
// Inline
|
||||
// ======
|
||||
// Input quantities
|
||||
inline G4String GetName() const; // aerosol name
|
||||
inline G4VSolid* GetBulk() const; // bulk shape
|
||||
inline G4double GetRadius() const; // droplet radius
|
||||
inline G4double GetAvgNumDens() const; // droplet number density
|
||||
//inline G4double GetPitch() const; // grid pitch
|
||||
|
||||
inline G4int GetNumDroplets() const; // in case the absolute number is more relevant than density
|
||||
|
||||
// Bulk quantities
|
||||
inline G4double GetXHalfLength() const;
|
||||
inline G4double GetYHalfLength() const;
|
||||
inline G4double GetZHalfLength() const;
|
||||
inline void GetBoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const;
|
||||
inline G4double GetCubicVolume() const;
|
||||
|
||||
inline G4double DistanceToCloud(const G4ThreeVector &p);
|
||||
inline G4double DistanceToCloud(const G4ThreeVector &p, const G4ThreeVector &v);
|
||||
|
||||
// Misc getters and setters
|
||||
inline long GetSeed();
|
||||
inline void SetSeed(long seed);
|
||||
|
||||
inline G4int GetNumPlacementTries();
|
||||
inline void SetNumPlacementTries(G4int numTries);
|
||||
|
||||
inline G4int GetPreSphereR();
|
||||
inline void SetPreSphereR(G4int fPreSphereRIn);
|
||||
|
||||
inline std::function<G4double (G4ThreeVector)> GetDistribution(); // the droplet number density distribution
|
||||
|
||||
inline G4double GetDropletsPerVoxel();
|
||||
inline void SetDropletsPerVoxel(G4double newDropletsPerVoxel);
|
||||
|
||||
// Printing diagnostic tool
|
||||
inline void PrintPopulationReport();
|
||||
|
||||
private:
|
||||
G4double kCarTolerance;
|
||||
|
||||
// Parameters, set in constructor
|
||||
G4String fName;
|
||||
|
||||
G4VSolid* fCloud; // Solid volume of the cloud
|
||||
G4double fDx, fDy, fDz; // Half widths
|
||||
|
||||
G4double fR; // Bounding radius of each droplet
|
||||
G4double fR2; // Bounding radius squared of each droplet
|
||||
|
||||
G4double fdR; // Uncertainty in DistanceToIn droplet when just using knowledge of droplet center
|
||||
|
||||
G4double fMinD; // Minimum distance allowed between faces of droplets when constructing random array of droplets
|
||||
|
||||
std::function<G4double (G4ThreeVector)> fDistribution;
|
||||
G4double fAvgNumDens; // Average droplet number density
|
||||
long int fNumDroplets = 0; // Number of droplets that have been created
|
||||
|
||||
G4double fGridPitch; // Pitch of collision detection grid. Must be greater than diameter of droplets for correctness of collision detection.
|
||||
|
||||
// Ramdom engine
|
||||
CLHEP::HepJamesRandom fCloudEngine;
|
||||
long fSeed = 0; // Global random seed
|
||||
|
||||
G4double fDropletsPerVoxel = 4.0; // Expected number of droplets per voxel
|
||||
|
||||
// How far the voxel center must be inside the bulk order for there to be no risk of placing a droplet outside
|
||||
G4double fEdgeDistance;
|
||||
|
||||
// Grid variables
|
||||
std::vector<std::vector<G4ThreeVector>> fGrid;// Grid of lists of inidices to grid points, used for fast collsion checking
|
||||
std::vector<G4double> fGridMean; // Array listing mean count for each voxel
|
||||
std::atomic<bool> *fGridValid; // Array listing validity of each grid. uses atomic variables
|
||||
|
||||
G4int fNx, fNy, fNz; // Number of x, y, and z elements in fGrid
|
||||
G4int fNxy; // Cached fNx*fNy
|
||||
long int fNumGridCells; // Cached fNx*fNy*fNz
|
||||
|
||||
|
||||
G4double fCollisionLimit2; // Threshold distance squared when checking for collsion
|
||||
G4int fNumNewPointTries = 100; // How many times we try to place droplets
|
||||
G4double fMaxDropPercent = 1.0; // The maximal percentage of skipped droplets before crashing0
|
||||
G4int fMaxDropCount; // The maximal number of skipped droplets before crashing
|
||||
G4int fNumDropped = 0; // Number of skipped droplets due to collisions/out of bulk placement
|
||||
|
||||
G4int fNumCollisions = 0; // How many collisions occured when attempting to place
|
||||
|
||||
// Droplet search variables
|
||||
G4int fVectorSearchRadius; // maximum vector search radius
|
||||
|
||||
// Droplet placement functions
|
||||
// ===========================
|
||||
void InitializeGrid();
|
||||
|
||||
G4bool FindNewPoint(G4bool edgeVoxel, G4double dX, G4double dY, G4double dZ, G4double minX, G4double minY, G4double minZ, G4ThreeVector &foundVec);
|
||||
|
||||
G4double VoxelOverlap(G4ThreeVector voxelCenter, G4int nStat, G4double epsilon);
|
||||
|
||||
bool CheckCollision(G4double x, G4double y, G4double z);
|
||||
bool CheckCollisionInsideGrid(G4double x, G4double y, G4double z, unsigned int xi, unsigned int yi, unsigned int zi);
|
||||
bool CheckCollisionWithDroplet(G4double x, G4double y, G4double z, G4ThreeVector p);
|
||||
|
||||
// Droplet distance functions
|
||||
// ==========================
|
||||
void SearchSphere(G4int searchRad, G4double &minDistance, std::vector<G4ThreeVector> &candidates, std::vector<G4double> &distances2, G4int xGrid, G4int yGrid, G4int zGrid, const G4ThreeVector &p);
|
||||
void GetNearestDropletInsideRegion(G4double &minDistance, G4ThreeVector ¢er, int xGrid, int yGrid, int zGrid, int xWidth, int yWidth, int zWidth, const G4ThreeVector &p, const G4ThreeVector &v, G4VSolid* droplet, std::function<G4RotationMatrix (G4ThreeVector)> rotation);
|
||||
void GetNearestDropletInsideGrid(G4double &minDistance, std::vector<G4ThreeVector> &candidates, std::vector<G4double> &distances2, unsigned int xGrid, unsigned int yGrid, unsigned int zGrid, const G4ThreeVector &p);
|
||||
void GetNearestDropletInsideGrid(G4double &minDistance, G4ThreeVector ¢er, unsigned int xGrid, unsigned int yGrid, unsigned int zGrid, const G4ThreeVector &p, const G4ThreeVector &v, G4VSolid* droplet, std::function<G4RotationMatrix (G4ThreeVector)> rotation);
|
||||
|
||||
// Voxelized sphere methods
|
||||
// ========================
|
||||
// a collection of points as in {{x1,y1},{x2,y2},...}
|
||||
typedef std::vector<std::vector<int>> fCircleType;
|
||||
|
||||
// a collection of points describing a spherical shell
|
||||
// with points (x,y,z)=(i-R,j-R,sphere[i][j][k])
|
||||
// that is, first index gives x-position, second index
|
||||
// gives y-position, and the value gives z-position
|
||||
//
|
||||
// this is done so that searching may be optimized:
|
||||
// if searching some x=i-R that is outside the
|
||||
// aerosol's bounding box, immediately increment i
|
||||
// (similar for y).
|
||||
typedef std::vector<std::vector<std::vector<int>>> fSphereType;
|
||||
|
||||
G4int fMaxCircleR;
|
||||
G4int fMaxSphereR;
|
||||
G4int fPreSphereR = 20;
|
||||
std::vector<fCircleType> fCircleCollection;
|
||||
std::vector<fSphereType> fSphereCollection;
|
||||
|
||||
fSphereType MakeSphere(G4int R);
|
||||
fCircleType MakeCircle(G4int R);
|
||||
fCircleType MakeHalfCircle(G4int R);
|
||||
|
||||
void PopulateGrid(unsigned int xi, unsigned int yi, unsigned int zi, unsigned int& gi);
|
||||
|
||||
// ======
|
||||
// Inline
|
||||
// ======
|
||||
inline bool GetGrid(const G4ThreeVector &p, G4int &xGrid, G4int &yGrid, G4int &zGrid);
|
||||
inline bool AnyIndexOutOfBounds(G4int xGrid, G4int yGrid, G4int zGrid);
|
||||
|
||||
inline unsigned int GetGridIndex(unsigned int xi, unsigned int yi, unsigned int zi);
|
||||
inline G4ThreeVector GetIndexCoord(G4int index);
|
||||
|
||||
inline std::pair<G4int, G4int> GetMinMaxSide(G4int index, G4int numGrids);
|
||||
};
|
||||
|
||||
#include "FastAerosol.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,252 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
//
|
||||
// FastAerosol.icc
|
||||
//
|
||||
// Implementation of inline methods of FastAerosol
|
||||
//
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
inline
|
||||
G4String FastAerosol::GetName() const
|
||||
{
|
||||
return(fName);
|
||||
}
|
||||
|
||||
inline
|
||||
G4VSolid* FastAerosol::GetBulk() const
|
||||
{
|
||||
return(fCloud);
|
||||
}
|
||||
|
||||
inline
|
||||
G4double FastAerosol::GetRadius() const
|
||||
{
|
||||
return(fR);
|
||||
}
|
||||
|
||||
inline
|
||||
G4double FastAerosol::GetAvgNumDens() const
|
||||
{
|
||||
return(fAvgNumDens);
|
||||
}
|
||||
|
||||
inline
|
||||
G4int FastAerosol::GetNumDroplets() const
|
||||
{
|
||||
return((int)(fAvgNumDens*GetCubicVolume()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline
|
||||
G4double FastAerosol::GetXHalfLength() const
|
||||
{
|
||||
return(fDx);
|
||||
}
|
||||
|
||||
inline
|
||||
G4double FastAerosol::GetYHalfLength() const
|
||||
{
|
||||
return(fDy);
|
||||
}
|
||||
|
||||
inline
|
||||
G4double FastAerosol::GetZHalfLength() const
|
||||
{
|
||||
return(fDz);
|
||||
}
|
||||
|
||||
inline
|
||||
void FastAerosol::GetBoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
|
||||
{
|
||||
pMin.setX(-fDx); pMax.setX(fDx);
|
||||
pMin.setY(-fDy); pMax.setY(fDy);
|
||||
pMin.setZ(-fDz); pMax.setZ(fDz);
|
||||
}
|
||||
|
||||
inline
|
||||
G4double FastAerosol::GetCubicVolume() const
|
||||
{
|
||||
return(fCloud->GetCubicVolume());
|
||||
}
|
||||
|
||||
|
||||
// Find the absolute distance to the cloud bulk from p
|
||||
inline
|
||||
G4double FastAerosol::DistanceToCloud(const G4ThreeVector &p) {
|
||||
if (fCloud->Inside(p)==kOutside)
|
||||
{
|
||||
return(fCloud->DistanceToIn(p));
|
||||
}
|
||||
else
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Find the distance to the cloud bulk from p along a vector v
|
||||
inline
|
||||
G4double FastAerosol::DistanceToCloud(const G4ThreeVector &p, const G4ThreeVector &v) {
|
||||
if (fCloud->Inside(p)==kInside)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(fCloud->DistanceToIn(p,v));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get and set the base of the random seed used to set droplet positions
|
||||
// For a given seed and a given geometry, the droplet positions are the same
|
||||
inline
|
||||
long FastAerosol::GetSeed() {
|
||||
return(fSeed);
|
||||
}
|
||||
|
||||
inline
|
||||
void FastAerosol::SetSeed(long seedIn) {
|
||||
fSeed = seedIn;
|
||||
}
|
||||
|
||||
|
||||
// Get and set the maximum radius of the voxelized spheres to pre-populate
|
||||
inline
|
||||
G4int FastAerosol::GetPreSphereR() {
|
||||
return(fPreSphereR);
|
||||
}
|
||||
|
||||
inline
|
||||
void FastAerosol::SetPreSphereR(G4int preSphereRIn) {
|
||||
fPreSphereR = preSphereRIn;
|
||||
}
|
||||
|
||||
|
||||
// Get the droplet distribution function
|
||||
inline
|
||||
std::function<G4double (G4ThreeVector)> FastAerosol::GetDistribution() {
|
||||
return(fDistribution);
|
||||
}
|
||||
|
||||
|
||||
// Get and set the maximum number of droplet placement tries in the solid
|
||||
// Skip placement if attempting to place a single droplet more than this
|
||||
inline
|
||||
G4int FastAerosol::GetNumPlacementTries()
|
||||
{
|
||||
return(fNumNewPointTries);
|
||||
}
|
||||
|
||||
inline
|
||||
void FastAerosol::SetNumPlacementTries(G4int numTries)
|
||||
{
|
||||
fNumNewPointTries = numTries;
|
||||
}
|
||||
|
||||
// Get and set the expected number of droplets per voxel (on average)
|
||||
inline
|
||||
G4double FastAerosol::GetDropletsPerVoxel()
|
||||
{
|
||||
return(fDropletsPerVoxel);
|
||||
}
|
||||
|
||||
inline
|
||||
void FastAerosol::SetDropletsPerVoxel(G4double newDropletsPerVoxel)
|
||||
{
|
||||
if (newDropletsPerVoxel >= std::pow(4.0*std::sqrt(2),-1.0))
|
||||
{
|
||||
fDropletsPerVoxel = newDropletsPerVoxel;
|
||||
InitializeGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid droplets/voxel for cloud: " << GetName() << "!" << G4endl
|
||||
<< " For grid pitch to be larger than radius (currently assumed),"
|
||||
<< " droplets/voxel must be greater than or equal to 1/(4*sqrt(2))"
|
||||
<< " newDropletsPerVoxel = " << newDropletsPerVoxel;
|
||||
G4Exception("FastAerosol::SetDropletsPerVoxel()", "GeomSolids0002",
|
||||
FatalErrorInArgument, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void FastAerosol::PrintPopulationReport() {
|
||||
G4cout << "Total grids: " << fNumGridCells << G4endl;
|
||||
G4cout << "Droplets created: " << fNumDroplets << G4endl;
|
||||
G4cout << "Average Number density: " << fAvgNumDens << G4endl;
|
||||
G4cout << "Droplets expected: " << GetNumDroplets() << G4endl;
|
||||
}
|
||||
|
||||
|
||||
// =======
|
||||
// Private
|
||||
// =======
|
||||
// Find the grid associated with a point. Return true if that is a valid grid,
|
||||
// false if it is out of bounds.
|
||||
inline
|
||||
bool FastAerosol::GetGrid(const G4ThreeVector &p, int &xGrid, int &yGrid, int &zGrid) {
|
||||
xGrid = (int)floorl((p.x() + fDx) / fGridPitch);
|
||||
yGrid = (int)floorl((p.y() + fDy) / fGridPitch);
|
||||
zGrid = (int)floorl((p.z() + fDz) / fGridPitch);
|
||||
return(!AnyIndexOutOfBounds(xGrid, yGrid, zGrid));
|
||||
}
|
||||
|
||||
// Return true if any grid index given is out of bounds, false otherwise
|
||||
inline
|
||||
bool FastAerosol::AnyIndexOutOfBounds(G4int xGrid, G4int yGrid, G4int zGrid) {
|
||||
return ((xGrid < 0) || (xGrid >= fNx) ||
|
||||
(yGrid < 0) || (yGrid >= fNy) ||
|
||||
(zGrid < 0) || (zGrid >= fNz));
|
||||
}
|
||||
|
||||
// Create index for grid
|
||||
inline
|
||||
unsigned int FastAerosol::GetGridIndex(unsigned int xi, unsigned int yi, unsigned int zi) {
|
||||
return(zi*fNxy + yi*fNx + xi);
|
||||
}
|
||||
|
||||
// Create get coordinates of index
|
||||
inline
|
||||
G4ThreeVector FastAerosol::GetIndexCoord(G4int index) {
|
||||
G4int x = index % fNx;
|
||||
G4int y = ( (index -x)/fNx ) % fNy;
|
||||
G4int z = (index -x -fNx*y )/(fNx*fNy);
|
||||
return(G4ThreeVector(x,y,z));
|
||||
}
|
||||
|
||||
// find lower and upper grid boundary
|
||||
inline
|
||||
std::pair<G4int, G4int> FastAerosol::GetMinMaxSide(G4int i, G4int numGrids) {
|
||||
return(std::make_pair((i == 0) ? 0 : (i-1),
|
||||
(i == (numGrids-1)) ? i : (i+1)));
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// FastAerosolSolid
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// A FastAerosolSolid is a collection of fDroplet solids
|
||||
// with positions set randomly by FastAerosol in a
|
||||
// volume given by a bulk shape given by FastAerosol member
|
||||
//
|
||||
// The FastAerosol member fCloud handles the optimization
|
||||
// (finding nearest droplet, populating the cloud) needed for
|
||||
// efficient simulations.
|
||||
//
|
||||
// This class is heavily based on system solids.
|
||||
//
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef FastAerosolSolid_HH
|
||||
#define FastAerosolSolid_HH
|
||||
|
||||
#include "FastAerosol.hh"
|
||||
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
// rotations
|
||||
#include <functional>
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class FastAerosolSolid : public G4VSolid
|
||||
{
|
||||
public:
|
||||
FastAerosolSolid(const G4String& pName,
|
||||
FastAerosol* pCloud,
|
||||
G4VSolid* pDroplet,
|
||||
std::function<G4RotationMatrix (G4ThreeVector)> pRotation);
|
||||
|
||||
FastAerosolSolid(const G4String& pName,
|
||||
FastAerosol* pCloud,
|
||||
G4VSolid* pDroplet);
|
||||
~FastAerosolSolid();
|
||||
|
||||
// Access functions
|
||||
inline G4double GetCubicVolume();
|
||||
inline G4double GetSurfaceArea();
|
||||
|
||||
// Solid standard methods
|
||||
G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pmin, G4double& pmax) const;
|
||||
EInside Inside(const G4ThreeVector& p) const;
|
||||
G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
|
||||
G4double DistanceToIn(const G4ThreeVector& p,
|
||||
const G4ThreeVector& v) const;
|
||||
G4double DistanceToIn(const G4ThreeVector& p) const;
|
||||
G4double DistanceToOut(const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm=G4bool(false),
|
||||
G4bool *validNorm=0,
|
||||
G4ThreeVector *n=0) const;
|
||||
G4double DistanceToOut(const G4ThreeVector& p) const;
|
||||
|
||||
G4GeometryType GetEntityType() const;
|
||||
|
||||
G4VSolid* Clone() const;
|
||||
|
||||
std::ostream& StreamInfo(std::ostream& os) const;
|
||||
|
||||
G4ThreeVector GetPointOnSurface() const;
|
||||
|
||||
G4Polyhedron* GetPolyhedron () const;
|
||||
void DescribeYourselfTo(G4VGraphicsScene& scene) const;
|
||||
G4VisExtent GetExtent() const;
|
||||
G4Polyhedron* CreatePolyhedron() const;
|
||||
|
||||
|
||||
public: // without description
|
||||
|
||||
FastAerosolSolid(__void__&);
|
||||
//
|
||||
// Fake default constructor for usage restricted to direct object
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
FastAerosolSolid(const FastAerosolSolid& rhs);
|
||||
FastAerosolSolid& operator=(const FastAerosolSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
inline void SetStepLim(G4double newLim);
|
||||
|
||||
private:
|
||||
|
||||
inline void Initialize();
|
||||
//
|
||||
// Reset relevant values to zero
|
||||
|
||||
G4double fStepLim = DBL_MAX; // Maximum step length. Allows speed up in droplet search
|
||||
|
||||
FastAerosol* fCloud; // FastAerosol which handles brunt of work
|
||||
G4VSolid* fDroplet; // Droplet shape
|
||||
G4VSolid* fBulk; // Aerosol bulk
|
||||
|
||||
G4double fR = 0.0; // Droplet bounding radius
|
||||
|
||||
G4double fVisDx, fVisDy, fVisDz; // Visual extent
|
||||
|
||||
G4double fCubicVolume = 0.0; // Cubic volume of all droplets
|
||||
G4double fSurfaceArea = 0.0; // Surface area of all droplets
|
||||
|
||||
G4double farFromCloudDist;
|
||||
|
||||
std::function<G4RotationMatrix (G4ThreeVector)> fRotation; // rotation function
|
||||
|
||||
protected: // without description
|
||||
|
||||
mutable G4bool fRebuildPolyhedron;
|
||||
mutable G4Polyhedron* fpPolyhedron;
|
||||
};
|
||||
|
||||
#include "FastAerosolSolid.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
//
|
||||
// FastAerosolSolid.icc
|
||||
//
|
||||
// Implementation of inline methods of FastAerosolSolid
|
||||
//
|
||||
// Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
inline
|
||||
G4double FastAerosolSolid::GetCubicVolume()
|
||||
{
|
||||
if(fCubicVolume != 0 ) {;}
|
||||
else
|
||||
{
|
||||
fCubicVolume = (fDroplet->GetCubicVolume())*(fCloud->GetNumDroplets());
|
||||
}
|
||||
return(fCubicVolume);
|
||||
}
|
||||
|
||||
inline
|
||||
G4double FastAerosolSolid::GetSurfaceArea()
|
||||
{
|
||||
if(fSurfaceArea != 0.) {;}
|
||||
else
|
||||
{
|
||||
fSurfaceArea = (fDroplet->GetSurfaceArea())*(fCloud->GetNumDroplets());
|
||||
}
|
||||
return(fSurfaceArea);
|
||||
}
|
||||
|
||||
inline
|
||||
void FastAerosolSolid::SetStepLim(G4double newLim)
|
||||
{
|
||||
fStepLim = newLim;
|
||||
}
|
||||
Reference in New Issue
Block a user