Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -46,18 +46,12 @@
|
||||
WLSActionInitialization::WLSActionInitialization(WLSDetectorConstruction* det)
|
||||
: G4VUserActionInitialization(), fDetector(det)
|
||||
{
|
||||
//AND->3June2014, temporary to take into account new GPS
|
||||
//Create an instance of GPS in master so shared resources and messenger
|
||||
//exist in master.
|
||||
masterGPS = new G4GeneralParticleSource();
|
||||
//AND<-3June2014
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSActionInitialization::~WLSActionInitialization()
|
||||
{
|
||||
delete masterGPS;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: WLSEventAction.cc 70603 2013-06-03 11:23:16Z gcosmo $
|
||||
// $Id: WLSEventAction.cc 90240 2015-05-21 09:08:13Z gcosmo $
|
||||
//
|
||||
/// \file optical/wls/src/WLSEventAction.cc
|
||||
/// \brief Implementation of the WLSEventAction class
|
||||
@@ -46,23 +46,17 @@
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
// Purpose: Invoke visualization at the end
|
||||
// Also can accumulate statistics regarding hits
|
||||
// Purpose: Accumulates statistics regarding hits
|
||||
// in the PhotonDet detector
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSEventAction::WLSEventAction(WLSRunAction* runaction)
|
||||
: fRunAction(runaction), fVerboseLevel(0),
|
||||
fPrintModulo(100), fDrawFlag("all")
|
||||
: fRunAction(runaction), fVerboseLevel(0)
|
||||
{
|
||||
fMPPCCollID = 0;
|
||||
|
||||
fEventMessenger = new WLSEventActionMessenger(this);
|
||||
|
||||
fForceDrawPhotons = false;
|
||||
fForceNoPhotons = false;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -77,8 +71,6 @@ WLSEventAction::~WLSEventAction()
|
||||
void WLSEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%fPrintModulo == 0)
|
||||
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
|
||||
|
||||
if(fVerboseLevel>0)
|
||||
G4cout << "<<< Event " << evtNb << " started." << G4endl;
|
||||
@@ -86,55 +78,19 @@ void WLSEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Threading.hh"
|
||||
|
||||
void WLSEventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
|
||||
// Visualization of Trajectory
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
|
||||
G4int n_trajectories = 0;
|
||||
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
|
||||
G4cout << "n_trajectories: " << n_trajectories << G4endl;
|
||||
if (fDrawFlag == "all") G4cout << "draw all trajectories" << G4endl;
|
||||
if (fDrawFlag == "charged") G4cout << "draw only charged" << G4endl;
|
||||
|
||||
for(G4int i=0; i<n_trajectories; i++)
|
||||
{ WLSTrajectory* trj =
|
||||
(WLSTrajectory *)((*(evt->GetTrajectoryContainer()))[i]);
|
||||
if (fDrawFlag == "all") {
|
||||
G4cout << "Now calling DrawTrajectory" << G4endl;
|
||||
G4cout << "Particle Name: " << trj->GetParticleName() << G4endl;
|
||||
trj->DrawTrajectory();
|
||||
}
|
||||
else if ((fDrawFlag == "charged")&&(trj->GetCharge() != 0.))
|
||||
trj->DrawTrajectory();
|
||||
else if (trj->GetParticleName()=="opticalphoton")
|
||||
{
|
||||
G4cout << "We should be drawing an opticalphoton" << G4endl;
|
||||
trj->SetForceDrawTrajectory(fForceDrawPhotons);
|
||||
trj->SetForceNoDrawTrajectory(fForceNoPhotons);
|
||||
trj->DrawTrajectory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fVerboseLevel>0)
|
||||
G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
|
||||
|
||||
// Save the Random Engine Status at the of event
|
||||
if (fRunAction->GetRndmFreq() == 2)
|
||||
{
|
||||
G4Random::saveEngineStatus("endOfEvent.rndm");
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%fPrintModulo == 0)
|
||||
{
|
||||
G4cout << "\n---> End of Event: " << evtNb << G4endl;
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream os;
|
||||
os<<"endOfEvent_"<<G4Threading::G4GetThreadId()<<".rndm";
|
||||
G4Random::saveEngineStatus(os.str().c_str());
|
||||
}
|
||||
|
||||
// Get Hits from the detector if any
|
||||
G4SDManager * SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: WLSEventActionMessenger.cc 69561 2013-05-08 12:25:56Z gcosmo $
|
||||
// $Id: WLSEventActionMessenger.cc 90240 2015-05-21 09:08:13Z gcosmo $
|
||||
//
|
||||
/// \file optical/wls/src/WLSEventActionMessenger.cc
|
||||
/// \brief Implementation of the WLSEventActionMessenger class
|
||||
@@ -31,7 +31,6 @@
|
||||
//
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
#include "WLSEventAction.hh"
|
||||
@@ -46,20 +45,6 @@ WLSEventActionMessenger::WLSEventActionMessenger(WLSEventAction* eventaction)
|
||||
fSetVerboseCmd->SetGuidance("Set verbose level ." );
|
||||
fSetVerboseCmd->SetParameterName("level",true);
|
||||
fSetVerboseCmd->SetDefaultValue(0);
|
||||
|
||||
fDrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
|
||||
fDrawCmd->SetGuidance("Draw the tracks in the event");
|
||||
fDrawCmd->SetGuidance(" Choice : none,charged, all");
|
||||
fDrawCmd->SetParameterName("choice",true);
|
||||
fDrawCmd->SetDefaultValue("all");
|
||||
fDrawCmd->SetCandidates("none charged all");
|
||||
fDrawCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
fPrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
|
||||
fPrintCmd->SetGuidance("Print events modulo n");
|
||||
fPrintCmd->SetParameterName("EventNb",false);
|
||||
fPrintCmd->SetRange("EventNb>0");
|
||||
fPrintCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -67,8 +52,6 @@ WLSEventActionMessenger::WLSEventActionMessenger(WLSEventAction* eventaction)
|
||||
WLSEventActionMessenger::~WLSEventActionMessenger()
|
||||
{
|
||||
delete fSetVerboseCmd;
|
||||
delete fDrawCmd;
|
||||
delete fPrintCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -78,10 +61,4 @@ void WLSEventActionMessenger::SetNewValue(G4UIcommand* command,
|
||||
{
|
||||
if (command == fSetVerboseCmd)
|
||||
fEventAction->SetEventVerbose(fSetVerboseCmd->GetNewIntValue(newValue));
|
||||
|
||||
if (command == fDrawCmd)
|
||||
fEventAction->SetDrawFlag(newValue);
|
||||
|
||||
if (command == fPrintCmd)
|
||||
fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: WLSPrimaryGeneratorAction.cc 84718 2014-10-20 07:40:45Z gcosmo $
|
||||
// $Id: WLSPrimaryGeneratorAction.cc 88760 2015-03-09 12:21:59Z gcosmo $
|
||||
//
|
||||
/// \file optical/wls/src/WLSPrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the WLSPrimaryGeneratorAction class
|
||||
@@ -51,6 +51,12 @@
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace {
|
||||
G4Mutex gen_mutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool WLSPrimaryGeneratorAction::fFirst = false;
|
||||
@@ -189,6 +195,9 @@ void WLSPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
//fParticleGun->SetParticleEnergy(sampledEnergy);
|
||||
#endif
|
||||
|
||||
//The code behing this line is not thread safe because polarization
|
||||
//and time are randomly selected and GPS properties are global
|
||||
G4AutoLock l(&gen_mutex);
|
||||
if(fParticleGun->GetParticleDefinition()->GetParticleName()=="opticalphoton"){
|
||||
SetOptPhotonPolar();
|
||||
SetOptPhotonTime();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: WLSTrackingAction.cc 69561 2013-05-08 12:25:56Z gcosmo $
|
||||
// $Id: WLSTrackingAction.cc 90240 2015-05-21 09:08:13Z gcosmo $
|
||||
//
|
||||
/// \file optical/wls/src/WLSTrackingAction.cc
|
||||
/// \brief Implementation of the WLSTrackingAction class
|
||||
@@ -67,26 +67,3 @@ void WLSTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
|
||||
fpTrackingManager->SetUserTrackInformation(trackInformation);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
WLSTrajectory* trajectory =
|
||||
(WLSTrajectory*)fpTrackingManager->GimmeTrajectory();
|
||||
|
||||
if (aTrack->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition())
|
||||
{
|
||||
if (aTrack->GetParentID()==0) trajectory->SetDrawTrajectory(true);
|
||||
else {
|
||||
const G4VProcess* creator = aTrack->GetCreatorProcess();
|
||||
if (creator && creator->GetProcessName()=="OpWLS")
|
||||
{
|
||||
trajectory->WLS();
|
||||
trajectory->SetDrawTrajectory(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else //draw all other trajectories
|
||||
trajectory->SetDrawTrajectory(true);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: WLSTrajectory.cc 72065 2013-07-05 09:54:59Z gcosmo $
|
||||
// $Id: WLSTrajectory.cc 90240 2015-05-21 09:08:13Z gcosmo $
|
||||
//
|
||||
/// \file optical/wls/src/WLSTrajectory.cc
|
||||
/// \brief Implementation of the WLSTrajectory class
|
||||
@@ -61,11 +61,6 @@ WLSTrajectory::WLSTrajectory()
|
||||
fPDGCharge(0.0), fPDGEncoding(0), fParticleName(""),
|
||||
fInitialMomentum(G4ThreeVector())
|
||||
{
|
||||
fWLS = false;
|
||||
fDrawIt = false;
|
||||
fForceNoDraw = false;
|
||||
fForceDraw = false;
|
||||
|
||||
fParticleDefinition = NULL;
|
||||
}
|
||||
|
||||
@@ -83,11 +78,6 @@ WLSTrajectory::WLSTrajectory(const G4Track* aTrack)
|
||||
fpPointsContainer = new WLSTrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(aTrack));
|
||||
|
||||
fWLS = false;
|
||||
fDrawIt = false;
|
||||
fForceNoDraw = false;
|
||||
fForceDraw = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -108,11 +98,6 @@ WLSTrajectory::WLSTrajectory(WLSTrajectory & right) : G4VTrajectory()
|
||||
= (WLSTrajectoryPoint*)((*(right.fpPointsContainer))[i]);
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
|
||||
fWLS = right.fWLS;
|
||||
fDrawIt = right.fDrawIt;
|
||||
fForceNoDraw = right.fForceNoDraw;
|
||||
fForceDraw = right.fForceDraw;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -138,99 +123,6 @@ void WLSTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSTrajectory::DrawTrajectory() const
|
||||
{
|
||||
// i_mode is no longer available as an argument of G4VTrajectory.
|
||||
// In this exampple it was always called with an argument of 50.
|
||||
const G4int i_mode = 50;
|
||||
// Consider using commands /vis/modeling/trajectories.
|
||||
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
// G4VTrajectory::DrawTrajectory(i_mode);
|
||||
// ... or override with your own code here.
|
||||
|
||||
//Taken from G4VTrajectory and modified to select colours based on particle
|
||||
//type and to selectively eliminate drawing of certain trajectories.
|
||||
|
||||
if (!fForceDraw && (!fDrawIt || fForceNoDraw)) return;
|
||||
|
||||
// If i_mode>=0, draws a trajectory as a polyline and, if i_mode!=0,
|
||||
// adds markers - yellow circles for step points and magenta squares
|
||||
// for auxiliary points, if any - whose screen size in pixels is
|
||||
// given by std::abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
|
||||
// visible markers.
|
||||
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if (!pVVisManager) return;
|
||||
|
||||
const G4double markerSize = std::abs(i_mode)/1000;
|
||||
G4bool lineRequired (i_mode >= 0);
|
||||
G4bool markersRequired (markerSize > 0.);
|
||||
|
||||
G4Polyline trajectoryLine;
|
||||
G4Polymarker stepPoints;
|
||||
G4Polymarker auxiliaryPoints;
|
||||
|
||||
for (G4int i = 0; i < GetPointEntries() ; i++) {
|
||||
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
|
||||
const std::vector<G4ThreeVector>* auxiliaries
|
||||
= aTrajectoryPoint->GetAuxiliaryPoints();
|
||||
if (auxiliaries) {
|
||||
for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) {
|
||||
const G4ThreeVector pos((*auxiliaries)[iAux]);
|
||||
if (lineRequired) {
|
||||
trajectoryLine.push_back(pos);
|
||||
}
|
||||
if (markersRequired) {
|
||||
auxiliaryPoints.push_back(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
|
||||
if (lineRequired) {
|
||||
trajectoryLine.push_back(pos);
|
||||
}
|
||||
if (markersRequired) {
|
||||
stepPoints.push_back(pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (lineRequired) {
|
||||
G4Colour colour;
|
||||
|
||||
if(fParticleDefinition==G4OpticalPhoton::OpticalPhotonDefinition()){
|
||||
if(fWLS) //WLS photons are red
|
||||
colour = G4Colour(1.,0.,0.);
|
||||
else{ //Scintillation and Cerenkov photons are green
|
||||
colour = G4Colour(0.,1.,0.);
|
||||
}
|
||||
}
|
||||
else //All other particles are blue
|
||||
colour = G4Colour(0.,0.,1.);
|
||||
|
||||
G4VisAttributes trajectoryLineAttribs(colour);
|
||||
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
|
||||
pVVisManager->Draw(trajectoryLine);
|
||||
}
|
||||
if (markersRequired) {
|
||||
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
|
||||
auxiliaryPoints.SetScreenSize(markerSize);
|
||||
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
|
||||
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
|
||||
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
|
||||
pVVisManager->Draw(auxiliaryPoints);
|
||||
|
||||
stepPoints.SetMarkerType(G4Polymarker::circles);
|
||||
stepPoints.SetScreenSize(markerSize);
|
||||
stepPoints.SetFillStyle(G4VMarker::filled);
|
||||
G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow.
|
||||
stepPoints.SetVisAttributes(&stepPointsAttribs);
|
||||
pVVisManager->Draw(stepPoints);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(aStep));
|
||||
|
||||
Reference in New Issue
Block a user