Import Geant4 10.3.1 source tree

This commit is contained in:
Gabriele Cosmo
2017-02-28 16:18:37 +01:00
parent 4597adb7c4
commit 3a5407696b
563 changed files with 0 additions and 95641 deletions
@@ -1,73 +0,0 @@
//
// ********************************************************************
// * 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: G4TrajectoryDrawByTouchedVolume.hh 66264 2012-12-14 10:17:44Z allison $
//
// Class Description:
// Trajectory model which colours a trajectory according to
// the touched volume
// Class Description - End:
// Jane Tinslay March 2006
#ifndef G4TRAJECTORYDRAWBYTOUCHEDVOLUME
#define G4TRAJECTORYDRAWBYTOUCHEDVOLUME
#include "G4VTrajectoryModel.hh"
#include "G4Colour.hh"
#include "G4ModelColourMap.hh"
#include "G4String.hh"
#include <map>
class G4TrajectoryDrawByTouchedVolume : public G4VTrajectoryModel {
public: // With description
G4TrajectoryDrawByTouchedVolume(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
virtual ~G4TrajectoryDrawByTouchedVolume();
// Draw method
virtual void Draw(const G4VTrajectory& trajectory,
const G4bool& visible = true) const;
virtual void Print(std::ostream& ostr) const;
// Print configuration
void SetDefault(const G4String&);
void SetDefault(const G4Colour&);
void Set(const G4String& pvname, const G4String& colour);
void Set(const G4String& pvname, const G4Colour& colour);
// Configuration functions
private:
// Data members
G4ModelColourMap<G4String> fMap;
G4Colour fDefault;
};
#endif
@@ -1,68 +0,0 @@
//
// ********************************************************************
// * 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: G4TrajectoryTouchedVolumeFilter.hh 66264 2012-12-14 10:17:44Z allison $
//
// Filter trajectories according to touched volume name. Only registered
// volumes will pass the filter.
//
// John Allison, Feb 2016
//
#ifndef G4TRAJECTORYTOUCHEDVOLUMEFILTER_HH
#define G4TRAJECTORYTOUCHEDVOLUMEFILTER_HH
#include "G4SmartFilter.hh"
#include "G4VTrajectory.hh"
#include <vector>
class G4TrajectoryTouchedVolumeFilter : public G4SmartFilter<G4VTrajectory> {
public: // With description
// Construct with filter name
G4TrajectoryTouchedVolumeFilter(const G4String& name = "Unspecified");
virtual ~G4TrajectoryTouchedVolumeFilter();
// Evaluate this trajectory
virtual bool Evaluate(const G4VTrajectory&) const;
// Print configuration
virtual void Print(std::ostream& ostr) const;
// Clear filter
virtual void Clear();
// Configuration function
void Add(const G4String& volume);
private:
// Data member
std::vector<G4String> fVolumes;
};
#endif
@@ -1,150 +0,0 @@
//
// ********************************************************************
// * 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: G4TrajectoryDrawByTouchedVolume.cc 95107 2016-01-26 12:41:11Z allison $
//
// Jane Tinslay March 2006
#include "G4TrajectoryDrawByTouchedVolume.hh"
#include "G4TrajectoryDrawerUtils.hh"
#include "G4VTrajectory.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectoryPoint.hh"
#include "G4AttValue.hh"
#include "G4RichTrajectory.hh"
G4TrajectoryDrawByTouchedVolume::G4TrajectoryDrawByTouchedVolume(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
,fDefault(G4Colour::Grey())
{}
G4TrajectoryDrawByTouchedVolume::~G4TrajectoryDrawByTouchedVolume() {}
void
G4TrajectoryDrawByTouchedVolume::Draw(const G4VTrajectory& traj, const G4bool& visible) const
{
try
{
const G4RichTrajectory& richTrajectory = dynamic_cast<const G4RichTrajectory&>(traj);
G4Colour colour(fDefault);
G4String soughtPVName("none");
for (const auto& item: fMap.GetBasicMap()) {
soughtPVName = item.first;
for (G4int iPoint = 0; iPoint < richTrajectory.GetPointEntries(); iPoint++) {
G4VTrajectoryPoint* point = richTrajectory.GetPoint(iPoint);
if (!point) continue;
std::vector<G4AttValue>* attValues = point->CreateAttValues();
std::vector<G4AttValue>::const_iterator iAtt;
for (iAtt = attValues->begin(); iAtt != attValues->end(); ++iAtt) {
if (iAtt->GetName() == "PostVPath" &&
iAtt->GetValue().contains(soughtPVName)) break;
}
if (iAtt != attValues->end()) { // Required value found
fMap.GetColour(soughtPVName, colour);
break; // First found pvname determines colour.
}
}
}
G4VisTrajContext myContext(GetContext());
myContext.SetLineColour(colour);
myContext.SetVisible(visible);
if (GetVerbose()) {
G4cout
<< "G4TrajectoryDrawByTouchedVolume drawer named " << Name()
<< ", drawing trajectory touching physical volume " << soughtPVName
<< ", with configuration:" << G4endl;
myContext.Print(G4cout);
}
G4TrajectoryDrawerUtils::DrawLineAndPoints(richTrajectory, myContext);
}
catch (std::bad_cast)
{
G4ExceptionDescription ed;
ed << "Requires G4RichTrajectory - \"/vis/scene/add/trajectories rich\"";
G4Exception
("G4TrajectoryDrawByTouchedVolume::Draw(const G4VTrajectory& traj,...",
"modeling0125",
JustWarning, ed);
return;
}
}
void
G4TrajectoryDrawByTouchedVolume::SetDefault(const G4String& colour)
{
G4Colour myColour;
// Will not modify default colour if colour key does not exist
if (!G4Colour::GetColour(colour, myColour)) {
G4ExceptionDescription ed;
ed << "G4Colour with key "<<colour<<" does not exist ";
G4Exception
("G4TrajectoryDrawByTouchedParticleID::SetDefault(const G4String& colour)", "modeling0123", JustWarning, ed);
return;
}
SetDefault(myColour);
}
void
G4TrajectoryDrawByTouchedVolume::SetDefault(const G4Colour& colour)
{
fDefault = colour;
}
void
G4TrajectoryDrawByTouchedVolume::Set(const G4String& pvname, const G4String& colour)
{
fMap.Set(pvname, colour);
}
void
G4TrajectoryDrawByTouchedVolume::Set(const G4String& pvname, const G4Colour& colour)
{
fMap[pvname] = colour;
}
void
G4TrajectoryDrawByTouchedVolume::Print(std::ostream& ostr) const
{
ostr
<< "G4TrajectoryDrawByTouchedVolume model "<< Name()
<< ", colour scheme: "
<< ", Default " << fDefault
<< std::endl;
fMap.Print(ostr);
ostr << "Default configuration:" << std::endl;
GetContext().Print(ostr);
}
@@ -1,105 +0,0 @@
//
// ********************************************************************
// * 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: G4TrajectoryTouchedVolumeFilter.cc 95107 2016-01-26 12:41:11Z allison $
//
// Filter trajectories according to touched volume name. Only registered
// volumes will pass the filter.
//
// John Allison, Feb 2016
//
#include "G4TrajectoryTouchedVolumeFilter.hh"
#include "G4TransportationManager.hh"
#include "G4VTrajectoryPoint.hh"
#include "G4AttValue.hh"
#include "G4RichTrajectory.hh"
G4TrajectoryTouchedVolumeFilter::G4TrajectoryTouchedVolumeFilter(const G4String& name)
:G4SmartFilter<G4VTrajectory>(name)
{}
G4TrajectoryTouchedVolumeFilter::~G4TrajectoryTouchedVolumeFilter() {}
bool
G4TrajectoryTouchedVolumeFilter::Evaluate(const G4VTrajectory& traj) const
{
try
{
const G4RichTrajectory& richTrajectory = dynamic_cast<const G4RichTrajectory&>(traj);
for (const auto& pvname: fVolumes) {
for (G4int iPoint = 0; iPoint < richTrajectory.GetPointEntries(); iPoint++) {
G4VTrajectoryPoint* point = richTrajectory.GetPoint(iPoint);
if (!point) continue;
std::vector<G4AttValue>* attValues = point->CreateAttValues();
std::vector<G4AttValue>::const_iterator iAtt;
for (iAtt = attValues->begin(); iAtt != attValues->end(); ++iAtt) {
if (iAtt->GetName() == "PostVPath" &&
iAtt->GetValue().contains(pvname)) break;
}
if (iAtt != attValues->end()) { // Required value found
return true; // First found pvname determines selection.
}
}
}
return false;
}
catch (std::bad_cast)
{
G4ExceptionDescription ed;
ed << "Requires G4RichTrajectory - \"/vis/scene/add/trajectories rich\"";
G4Exception
("G4TrajectoryTouchedVolumeFilter::Evaluate(const G4VTrajectory& traj)",
"modeling0126",
JustWarning, ed);
return false;
}
}
void
G4TrajectoryTouchedVolumeFilter::Add(const G4String& volume)
{
fVolumes.push_back(volume);
}
void
G4TrajectoryTouchedVolumeFilter::Print(std::ostream& ostr) const
{
ostr<<"Volume names registered: "<<G4endl;
std::vector<G4String>::const_iterator iter = fVolumes.begin();
while (iter != fVolumes.end()) {
ostr<<*iter<<G4endl;
iter++;
}
}
void
G4TrajectoryTouchedVolumeFilter::Clear()
{
// Clear volume vector
fVolumes.clear();
}