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,39 +0,0 @@
// Copyright FreeHEP, 2005.
#include "cheprep/GZIPOutputStreamBuffer.h"
#include "cheprep/GZIPOutputStream.h"
/**
* @author Mark Donszelmann
* @version $Id: GZIPOutputStream.cc 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
using namespace std;
GZIPOutputStream::GZIPOutputStream(ostream &os)
: std::ostream(NULL) {
buffer = new GZIPOutputStreamBuffer(os.rdbuf());
init(buffer);
}
void GZIPOutputStream::setFilename(const string &filename) {
buffer->setFilename(filename);
}
void GZIPOutputStream::setComment(const string &comment) {
buffer->setComment(comment);
}
void GZIPOutputStream::close() {
buffer->close();
}
GZIPOutputStream::~GZIPOutputStream() {
delete buffer;
}
} // cheprep
@@ -1,44 +0,0 @@
// Copyright FreeHEP, 2005.
#include <iostream>
#include <ctime>
#include <vector>
#include "cheprep/ZipOutputStreamBuffer.h"
#include "cheprep/ZipOutputStream.h"
/**
* @author Mark Donszelmann
* @version $Id: ZipOutputStream.cc 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
ZipOutputStream::ZipOutputStream(std::ostream& os) : std::ostream(0) {
buffer = new ZipOutputStreamBuffer(os.rdbuf());
init(buffer);
}
void ZipOutputStream::closeEntry() {
buffer->closeEntry();
}
void ZipOutputStream::close() {
buffer->close();
}
void ZipOutputStream::putNextEntry(const std::string& name, bool compress) {
buffer->putNextEntry(name, compress);
}
void ZipOutputStream::setComment(const std::string& comment ) {
buffer->setComment(comment);
}
ZipOutputStream::~ZipOutputStream() {
close();
delete buffer;
}
} // cheprep
@@ -1,101 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtExportDialog.hh'
**
** Created: Tue Nov 22 09:56:58 2016
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtExportDialog.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtExportDialog.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtExportDialog[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
24, 23, 23, 23, 0x0a,
40, 23, 23, 23, 0x0a,
58, 23, 23, 23, 0x0a,
84, 23, 23, 23, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtExportDialog[] = {
"G4OpenGLQtExportDialog\0\0changeSizeBox()\0"
"changeVectorEPS()\0textWidthChanged(QString)\0"
"textHeightChanged(QString)\0"
};
void G4OpenGLQtExportDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtExportDialog *_t = static_cast<G4OpenGLQtExportDialog *>(_o);
switch (_id) {
case 0: _t->changeSizeBox(); break;
case 1: _t->changeVectorEPS(); break;
case 2: _t->textWidthChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 3: _t->textHeightChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtExportDialog::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtExportDialog::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_G4OpenGLQtExportDialog,
qt_meta_data_G4OpenGLQtExportDialog, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtExportDialog::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtExportDialog::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtExportDialog::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtExportDialog))
return static_cast<void*>(const_cast< G4OpenGLQtExportDialog*>(this));
return QDialog::qt_metacast(_clname);
}
int G4OpenGLQtExportDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -1,121 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtMovieDialog.hh'
**
** Created: Tue Nov 22 09:56:58 2016
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtMovieDialog.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtMovieDialog.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtMovieDialog[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
10, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
23, 22, 22, 22, 0x0a,
41, 22, 22, 22, 0x0a,
53, 22, 48, 22, 0x0a,
80, 22, 48, 22, 0x0a,
110, 22, 48, 22, 0x0a,
138, 22, 22, 22, 0x08,
164, 22, 22, 22, 0x08,
187, 22, 22, 22, 0x08,
214, 22, 22, 22, 0x08,
231, 22, 22, 22, 0x08,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtMovieDialog[] = {
"G4OpenGLQtMovieDialog\0\0stopFinishClose()\0"
"save()\0bool\0checkEncoderSwParameters()\0"
"checkSaveFileNameParameters()\0"
"checkTempFolderParameters()\0"
"selectEncoderPathAction()\0"
"selectTempPathAction()\0"
"selectSaveFileNameAction()\0resetRecording()\0"
"enabledApplyButton()\0"
};
void G4OpenGLQtMovieDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtMovieDialog *_t = static_cast<G4OpenGLQtMovieDialog *>(_o);
switch (_id) {
case 0: _t->stopFinishClose(); break;
case 1: _t->save(); break;
case 2: { bool _r = _t->checkEncoderSwParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 3: { bool _r = _t->checkSaveFileNameParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 4: { bool _r = _t->checkTempFolderParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 5: _t->selectEncoderPathAction(); break;
case 6: _t->selectTempPathAction(); break;
case 7: _t->selectSaveFileNameAction(); break;
case 8: _t->resetRecording(); break;
case 9: _t->enabledApplyButton(); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtMovieDialog::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtMovieDialog::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_G4OpenGLQtMovieDialog,
qt_meta_data_G4OpenGLQtMovieDialog, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtMovieDialog::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtMovieDialog::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtMovieDialog::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtMovieDialog))
return static_cast<void*>(const_cast< G4OpenGLQtMovieDialog*>(this));
return QDialog::qt_metacast(_clname);
}
int G4OpenGLQtMovieDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 10)
qt_static_metacall(this, _c, _id, _a);
_id -= 10;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -1,170 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtViewer.hh'
**
** Created: Tue Nov 22 09:56:58 2016
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtViewer.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtViewer.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtViewer[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
29, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
18, 17, 17, 17, 0x0a,
36, 17, 17, 17, 0x09,
71, 17, 17, 17, 0x08,
89, 17, 17, 17, 0x08,
119, 17, 17, 17, 0x08,
143, 17, 17, 17, 0x08,
170, 17, 17, 17, 0x08,
194, 17, 17, 17, 0x08,
210, 17, 17, 17, 0x08,
233, 17, 17, 17, 0x08,
258, 17, 17, 17, 0x08,
281, 17, 17, 17, 0x08,
306, 17, 17, 17, 0x08,
331, 17, 17, 17, 0x08,
351, 17, 17, 17, 0x08,
367, 17, 17, 17, 0x08,
393, 17, 17, 17, 0x08,
416, 17, 17, 17, 0x08,
440, 17, 17, 17, 0x08,
465, 17, 17, 17, 0x08,
495, 487, 17, 17, 0x08,
547, 17, 17, 17, 0x08,
588, 17, 17, 17, 0x08,
604, 17, 17, 17, 0x08,
629, 17, 17, 17, 0x08,
658, 17, 17, 17, 0x08,
686, 17, 17, 17, 0x08,
719, 710, 17, 17, 0x08,
768, 17, 17, 17, 0x08,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtViewer[] = {
"G4OpenGLQtViewer\0\0startPauseVideo()\0"
"updateToolbarAndMouseContextMenu()\0"
"actionSaveImage()\0actionChangeBackgroundColor()\0"
"actionChangeTextColor()\0"
"actionChangeDefaultColor()\0"
"actionMovieParameters()\0showShortcuts()\0"
"toggleMouseAction(int)\0toggleSurfaceAction(int)\0"
"toggleProjection(bool)\0toggleTransparency(bool)\0"
"toggleAntialiasing(bool)\0toggleHaloing(bool)\0"
"toggleAux(bool)\0toggleHiddenMarkers(bool)\0"
"toggleFullScreen(bool)\0processEncodeFinished()\0"
"processLookForFinished()\0processEncodeStdout()\0"
"item,id\0sceneTreeComponentItemChanged(QTreeWidgetItem*,int)\0"
"toggleSceneTreeComponentPickingCout(int)\0"
"togglePicking()\0currentTabActivated(int)\0"
"sceneTreeComponentSelected()\0"
"changeDepthInSceneTree(int)\0"
"changeSearchSelection()\0item,val\0"
"changeColorAndTransparency(QTreeWidgetItem*,int)\0"
"tableWidgetViewerSetItemChanged(QTableWidgetItem*)\0"
};
void G4OpenGLQtViewer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtViewer *_t = static_cast<G4OpenGLQtViewer *>(_o);
switch (_id) {
case 0: _t->startPauseVideo(); break;
case 1: _t->updateToolbarAndMouseContextMenu(); break;
case 2: _t->actionSaveImage(); break;
case 3: _t->actionChangeBackgroundColor(); break;
case 4: _t->actionChangeTextColor(); break;
case 5: _t->actionChangeDefaultColor(); break;
case 6: _t->actionMovieParameters(); break;
case 7: _t->showShortcuts(); break;
case 8: _t->toggleMouseAction((*reinterpret_cast< int(*)>(_a[1]))); break;
case 9: _t->toggleSurfaceAction((*reinterpret_cast< int(*)>(_a[1]))); break;
case 10: _t->toggleProjection((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 11: _t->toggleTransparency((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 12: _t->toggleAntialiasing((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 13: _t->toggleHaloing((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 14: _t->toggleAux((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 15: _t->toggleHiddenMarkers((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 16: _t->toggleFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 17: _t->processEncodeFinished(); break;
case 18: _t->processLookForFinished(); break;
case 19: _t->processEncodeStdout(); break;
case 20: _t->sceneTreeComponentItemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 21: _t->toggleSceneTreeComponentPickingCout((*reinterpret_cast< int(*)>(_a[1]))); break;
case 22: _t->togglePicking(); break;
case 23: _t->currentTabActivated((*reinterpret_cast< int(*)>(_a[1]))); break;
case 24: _t->sceneTreeComponentSelected(); break;
case 25: _t->changeDepthInSceneTree((*reinterpret_cast< int(*)>(_a[1]))); break;
case 26: _t->changeSearchSelection(); break;
case 27: _t->changeColorAndTransparency((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 28: _t->tableWidgetViewerSetItemChanged((*reinterpret_cast< QTableWidgetItem*(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtViewer::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtViewer::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_G4OpenGLQtViewer,
qt_meta_data_G4OpenGLQtViewer, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtViewer::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtViewer::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtViewer::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtViewer))
return static_cast<void*>(const_cast< G4OpenGLQtViewer*>(this));
if (!strcmp(_clname, "G4OpenGLViewer"))
return static_cast< G4OpenGLViewer*>(const_cast< G4OpenGLQtViewer*>(this));
return QObject::qt_metacast(_clname);
}
int G4OpenGLQtViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 29)
qt_static_metacall(this, _c, _id, _a);
_id -= 29;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -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();
}