Import Geant4 4.1.0 source tree
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeoNav.hh,v 1.2 2002/06/04 09:23:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// G4GeoNav
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef G4GeoNav_h
|
||||
#define G4GeoNav_h
|
||||
|
||||
#include "G4String.hh"
|
||||
#include "g4std/vector"
|
||||
#include <regex.h>
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
#include "tree.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class OlapDetConstr;
|
||||
|
||||
// qt-free version of G4GeoNav
|
||||
|
||||
typedef Tree<G4LogicalVolume*> LVTree;
|
||||
|
||||
class G4GeoNav
|
||||
{
|
||||
|
||||
public:
|
||||
G4GeoNav( G4LogicalVolume * root );
|
||||
~G4GeoNav();
|
||||
G4LogicalVolume * GetLV() { return theCurLV->data(); }
|
||||
|
||||
// get next logical volume which name matches aRegExp
|
||||
//G4LogicalVolume * NextLV(const G4String & aRegExp);
|
||||
|
||||
// returns a vector of LogicalVolumes which names match the aRegExp
|
||||
G4int FilterLV(const G4String & aRegExp,
|
||||
G4std::vector<G4LogicalVolume*> & result,
|
||||
G4bool stopAtFirst=false);
|
||||
// returns a vector of LogicalVolumes reflecting the hierarchy of theCurLVItem
|
||||
G4int PathLV(G4std::vector<G4LogicalVolume*> & result);
|
||||
// "cd /CMS/Tr.*/.*Barrel"
|
||||
G4LogicalVolume * ChangeLV(const G4String & aRegExp);
|
||||
// get next lv as seen from the current one
|
||||
G4LogicalVolume * NextLV();
|
||||
// "pwd"
|
||||
G4int PwdLV(G4std::vector<G4LogicalVolume *>&);
|
||||
// "ls"
|
||||
G4int LsLV(G4std::vector<G4LogicalVolume *>&);
|
||||
// theSubreeLVItem = theCurLVItem
|
||||
//void CurLVToSubtree() {theSubtreeLVItem = theCurLVItem;};
|
||||
//OlapDetConstr * GetDetConstr();
|
||||
const LVTree::node_t & root() const { return *(theLVTree->root()); }
|
||||
|
||||
protected:
|
||||
|
||||
void RecursiveFill(LVTree::node_t*);
|
||||
|
||||
void CountSubtreeNodes(LVTree::node_t*,G4int&);
|
||||
// recursive counting of nodes
|
||||
|
||||
G4int Tokenize(const G4String &, G4std::vector<G4String>&);
|
||||
|
||||
void FindLV(regex_t *, LVTree::node_t * ,
|
||||
G4std::vector<G4LogicalVolume*>&, G4bool stopAtFirst=false) ;
|
||||
|
||||
void populateLVTree(LVTree::node_t*); // recursive population of LV-Tree
|
||||
|
||||
LVTree * theLVTree ;
|
||||
LVTree::node_t * theCurLV; // used in the NewWorld
|
||||
LVTree::node_t * theRootLV; // root of the 'whole' geometry
|
||||
LVTree::node_t * theSubtreeEndLVItem; // (un)used ...
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapDetConstr.hh,v 1.1 2002/06/04 07:40:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapDetConstr
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapDetConstr_h
|
||||
#define OlapDetConstr_h
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
class G4Box;
|
||||
|
||||
|
||||
class OlapDetConstr : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
|
||||
OlapDetConstr(G4VUserDetectorConstruction * aGeometry,
|
||||
G4VPhysicalVolume *aWorld=0);
|
||||
|
||||
~OlapDetConstr();
|
||||
|
||||
// initialization of full geometry
|
||||
G4VPhysicalVolume * Construct();
|
||||
|
||||
// returns a new PV-World-Volume with just ONE depths of daughters
|
||||
G4VPhysicalVolume * SetNewWorld(G4LogicalVolume * aMotherLV, G4bool debugFlag=false);
|
||||
|
||||
// set the rotation of the 'new' world (axis + rotation angle)
|
||||
void SetRotation(G4double theta, G4double phi, G4double alpha);
|
||||
|
||||
// t.b.i.
|
||||
G4VPhysicalVolume * SetFullWorld();
|
||||
|
||||
// returns current 'new' World
|
||||
G4VPhysicalVolume * GetNewWorld();
|
||||
|
||||
// returns the 'full' World (the whole detector)
|
||||
G4VPhysicalVolume * GetFullWorld();
|
||||
|
||||
// pointer to original world
|
||||
G4LogicalVolume * GetOriginalWorld();
|
||||
|
||||
G4int GetNrLVs() { return nrLV; };
|
||||
|
||||
private:
|
||||
OlapDetConstr();
|
||||
// add: copy-ctor, assign-op
|
||||
|
||||
// resets Colors in FullWorld
|
||||
void ResetColors();
|
||||
void ResetColors(G4LogicalVolume*);
|
||||
void ColorFirstLevel();
|
||||
void ConstructNewWorld();
|
||||
void DeleteNewWorld();
|
||||
void SetVis(G4LogicalVolume *, G4VisAttributes *);
|
||||
void DrawPolyOutline(); // Draw only outlines of G4Polycones/-hedras into NewWorld
|
||||
|
||||
G4double theTheta, thePhi, theAlpha;
|
||||
G4RotationMatrix * theNewWorldRot;
|
||||
G4VUserDetectorConstruction * theFullGeometry;
|
||||
G4VPhysicalVolume * theWorld;
|
||||
G4VPhysicalVolume * theNewWorld;
|
||||
G4LogicalVolume * theNewWorldLV;
|
||||
G4LogicalVolume * theNewLV; // ptr to 'original' new-world inside full geometry
|
||||
G4Box * theNewWorldBox;
|
||||
G4VisAttributes * visMother;
|
||||
G4VisAttributes * visDaughterA;
|
||||
G4VisAttributes * visDaughterB;
|
||||
G4VisAttributes * visWorld;
|
||||
G4VisAttributes * visFullWorld;
|
||||
G4VisAttributes * visFirstLevel;
|
||||
G4VisAttributes * visInvisible;
|
||||
G4bool syncVis;
|
||||
G4int nrLV;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapEventAction.hh,v 1.1 2002/06/04 07:40:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapEventAction
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapEventAction_h
|
||||
#define OlapEventAction_h
|
||||
|
||||
#include "g4std/vector"
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4NavigationHistory.hh"
|
||||
#include "OlapSteppingAction.hh"
|
||||
|
||||
class OlapRunAction;
|
||||
class OlapDetConstr;
|
||||
|
||||
// class to collect detected overlaps
|
||||
class OlapInfo
|
||||
{
|
||||
public:
|
||||
OlapInfo(G4NavigationHistory & h1,
|
||||
G4NavigationHistory & h2,
|
||||
G4ThreeVector & p1,
|
||||
G4ThreeVector & p2,
|
||||
G4int a=0,
|
||||
G4LogicalVolume* original=0) :
|
||||
hist1(h1), hist2(h2), v1(p1), v2(p2),axis(a)
|
||||
{};
|
||||
|
||||
~OlapInfo();
|
||||
|
||||
G4bool operator==(const OlapInfo &);
|
||||
|
||||
G4NavigationHistory hist1, hist2;
|
||||
G4ThreeVector v1, v2;
|
||||
G4int axis;
|
||||
// geantino ray travelling parallel to that axis detected the olap
|
||||
G4std::vector<OlapStepInfo *> stAB;
|
||||
G4std::vector<OlapStepInfo *> stBA;
|
||||
G4String info;
|
||||
G4int probNot ;
|
||||
G4LogicalVolume* originalMother;
|
||||
};
|
||||
|
||||
G4std::ostream &
|
||||
operator<<(G4std::ostream& flux, OlapInfo & oi);
|
||||
|
||||
|
||||
// ------------==============-------------==============----------------
|
||||
|
||||
|
||||
class OlapEventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
OlapEventAction(OlapRunAction*);
|
||||
~OlapEventAction();
|
||||
|
||||
void BeginOfEventAction(const G4Event* anEvent);
|
||||
void EndOfEventAction(const G4Event* anEvent);
|
||||
|
||||
// returns true, if new olverlap was detected!
|
||||
G4bool InsertOI(OlapInfo *);
|
||||
|
||||
OlapRunAction * theRunAction;
|
||||
OlapDetConstr * theDet;
|
||||
G4std::vector<OlapStepInfo*> ABSteps;
|
||||
G4std::vector<OlapStepInfo*> BASteps;
|
||||
G4bool dontDelete;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapGenerator.hh,v 1.1 2002/06/04 07:40:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapGenerator
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapGenerator_h
|
||||
#define OlapGenerator_h
|
||||
|
||||
#include "g4std/vector"
|
||||
#include "globals.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4VisExtent;
|
||||
|
||||
class OlapGrid
|
||||
{
|
||||
public:
|
||||
OlapGrid();
|
||||
void Reset() { for (G4int i=0;i<3;i++) count[i]=0; axis=0; }
|
||||
void Next();
|
||||
G4std::vector<G4int> count; //
|
||||
G4std::vector<G4int> gsize; // gridsize
|
||||
G4int axis, eventsPerRun;
|
||||
};
|
||||
|
||||
|
||||
class OlapGenerator : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
|
||||
public:
|
||||
OlapGenerator();
|
||||
~OlapGenerator();
|
||||
|
||||
void GeneratePrimaries(G4Event*);
|
||||
|
||||
void SetExtent(const G4VisExtent&);
|
||||
|
||||
void SetExtent(G4double);
|
||||
|
||||
void SetAutoIncrement(G4bool b) { autoinc = b; }
|
||||
|
||||
void SetGrid(G4int,G4int,G4int);
|
||||
|
||||
void Reset();
|
||||
|
||||
G4int GetAxis() { return grid.axis; };
|
||||
|
||||
OlapGrid grid; // basically a vector of <int>, size==3
|
||||
G4std::vector<G4double> ext;
|
||||
G4ThreeVector posAB, posBA;
|
||||
G4bool autoinc;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapLogManager.hh,v 1.1 2002/06/04 07:40:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapLogManager
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapLogManager_h
|
||||
#define OlapLogManager_h
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class OlapLogManager
|
||||
{
|
||||
|
||||
public:
|
||||
~OlapLogManager();
|
||||
static OlapLogManager * GetOlapLogManager();
|
||||
|
||||
void Logging(G4String);
|
||||
void LogByVolume(G4String);
|
||||
G4bool areWeLogging;
|
||||
G4bool areWeLoggingByVolume;
|
||||
G4String filename;
|
||||
G4String logPath;
|
||||
|
||||
|
||||
private:
|
||||
OlapLogManager();
|
||||
static OlapLogManager * theInstance;
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapManager.hh,v 1.2 2002/06/04 09:23:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapManager
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapManager_h
|
||||
#define OlapManager_h
|
||||
|
||||
#include "g4std/vector"
|
||||
#include "g4std/map"
|
||||
#include "g4std/set"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "OlapNotify.hh"
|
||||
#include "OlapEventAction.hh" // class OlapInfo!
|
||||
|
||||
class OlapManagerMessenger;
|
||||
class OlapDetConstr;
|
||||
class OlapVolTree;
|
||||
class G4RunManager;
|
||||
class G4GeoNav;
|
||||
class OlapGui;
|
||||
class CMSPrimaryGeneratorAction;
|
||||
class OlapGenerator;
|
||||
|
||||
class OlapManager
|
||||
{
|
||||
public:
|
||||
~OlapManager();
|
||||
static OlapManager * GetOlapManager();
|
||||
void TriggerRun();
|
||||
void TriggerFull(G4int=10);
|
||||
G4VPhysicalVolume * GetNewWorld();
|
||||
G4VPhysicalVolume * GetFullWorld();
|
||||
//G4bool SetNextWorld(G4int=1);
|
||||
//G4bool SetPrevWorld(G4int=1);
|
||||
void SetGrid(G4int,G4int,G4int);
|
||||
void SetDelta(G4double d) { delta = d;}
|
||||
G4double Delta() { return delta;}
|
||||
G4bool Next();
|
||||
void ListLV(const G4String &);
|
||||
void GotoLV(const G4String &);
|
||||
void ChangeLV(const G4String &);
|
||||
void SetNewWorld(G4LogicalVolume*);
|
||||
void SetRotation(G4double theta, G4double phi, G4double alpha);
|
||||
G4LogicalVolume* GetOriginalWorld();
|
||||
void PwdLV();
|
||||
void LsLV();
|
||||
void TestVolTree();
|
||||
G4int GetNrLVs();
|
||||
//! interrupts olap-processing (only during 'triggerFull');
|
||||
// next trigger/triggerFull will continue!
|
||||
void Interrupt() { interrupt=true ; }
|
||||
void registerNotification(OlapNotify*n) { theNotifs.insert(n); }
|
||||
void notifyNewWorld(G4LogicalVolume*);
|
||||
void notifyOlaps(const G4std::vector<OlapInfo*> &);
|
||||
void deRegisterNotification(OlapNotify*n) { ; }
|
||||
// FIXME: handle completly different in next redesign!
|
||||
G4std::map<G4LogicalVolume *, G4bool> NoOlapMap;
|
||||
|
||||
private:
|
||||
|
||||
OlapManager();
|
||||
|
||||
OlapManagerMessenger * theMessenger;
|
||||
OlapDetConstr * theDet;
|
||||
|
||||
OlapGenerator * olapGenerator;
|
||||
CMSPrimaryGeneratorAction * cmsGenerator;
|
||||
G4double delta;
|
||||
G4int eventsPerRun;
|
||||
G4int lvPos;
|
||||
G4bool polyMode;
|
||||
G4RunManager * theRunManager;
|
||||
G4LogicalVolumeStore * theLVStore;
|
||||
G4std::vector<G4LogicalVolume*>::iterator theLVit;
|
||||
G4std::vector<G4LogicalVolume*> theLVs;
|
||||
static OlapManager * theInstance;
|
||||
G4GeoNav * theGeoNav;
|
||||
G4std::set<OlapNotify*> theNotifs;
|
||||
G4bool interrupt;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapManagerMessenger.hh,v 1.1 2002/06/04 07:40:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapManagerMessenger
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapManagerMessenger_h
|
||||
#define OlapManagerMessenger_h
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "OlapLogManager.hh"
|
||||
|
||||
class OlapManager;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWith3Vector;
|
||||
class G4UIcmdWith3VectorAndUnit;
|
||||
class G4UIcmdWithABool;
|
||||
|
||||
class OlapManagerMessenger : public G4UImessenger
|
||||
{
|
||||
|
||||
public:
|
||||
OlapManagerMessenger(OlapManager*);
|
||||
~OlapManagerMessenger();
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
G4UIdirectory * theOlapDir;
|
||||
G4UIcmdWith3VectorAndUnit * theRotationCmd;
|
||||
G4UIcmdWithoutParameter * theTriggerCmd;
|
||||
G4UIcmdWithAnInteger * theTriggerFullCmd;
|
||||
G4UIcmdWithAString * theGotoWorldCmd;
|
||||
G4UIcmdWithoutParameter * theLsCmd;
|
||||
G4UIcmdWithAString * theCdCmd;
|
||||
G4UIcmdWithAString * theListCmd;
|
||||
G4UIcmdWithoutParameter * thePwdCmd;
|
||||
G4UIcmdWithoutParameter * theWhereIsCmd;
|
||||
G4UIcmdWith3Vector * theSetGridCmd;
|
||||
G4UIcmdWithADoubleAndUnit * theDeltaCmd;
|
||||
G4UIcmdWithAString * theLogCmd;
|
||||
G4UIcmdWithAString * theLogByVolumeCmd;
|
||||
|
||||
OlapManager * theManager;
|
||||
OlapLogManager * theLogManager;
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapNotify.hh,v 1.1 2002/06/04 07:40:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapNotify
|
||||
//
|
||||
// Register a subclass of OlapNotify with OlapManager to be
|
||||
// notified when the geometry changes or when overlap are
|
||||
// reported.
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapNotify_h
|
||||
#define OlapNotify_h
|
||||
|
||||
#include "g4std/vector"
|
||||
|
||||
#include "OlapEventAction.hh"
|
||||
|
||||
class G4LogicalVolume;
|
||||
|
||||
class OlapNotify
|
||||
{
|
||||
public:
|
||||
OlapNotify();
|
||||
virtual ~OlapNotify();
|
||||
|
||||
virtual void worldChanged(G4LogicalVolume* newWorld) = 0;
|
||||
virtual void overlaps(const G4std::vector<OlapInfo*> &)=0;
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapPhysicsList.hh,v 1.1 2002/06/04 07:40:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapPhysicsList
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapPhysicsList_h
|
||||
#define OlapPhysicsList_h 1
|
||||
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class OlapPhysicsList: public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
OlapPhysicsList();
|
||||
~OlapPhysicsList();
|
||||
|
||||
protected:
|
||||
// Construct particle and physics
|
||||
virtual void ConstructParticle();
|
||||
virtual void ConstructProcess();
|
||||
|
||||
virtual void SetCuts();
|
||||
|
||||
public:
|
||||
// Set/Get cut values
|
||||
|
||||
protected:
|
||||
// these methods Construct particles
|
||||
void ConstructBosons();
|
||||
|
||||
protected:
|
||||
// these methods Construct physics processes and register them
|
||||
|
||||
private:
|
||||
G4double cutForGamma;
|
||||
G4double cutForElectron;
|
||||
G4double cutForProton;
|
||||
G4double currentDefaultCut;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapRunAction.hh,v 1.1 2002/06/04 07:40:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapRunAction
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapRunAction_h
|
||||
#define OlapRunAction_h
|
||||
|
||||
#include "g4std/vector"
|
||||
#include "g4std/fstream"
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "OlapEventAction.hh"
|
||||
#include "OlapLogManager.hh"
|
||||
|
||||
class OlapRunAction : public G4UserRunAction
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
OlapRunAction();
|
||||
~OlapRunAction();
|
||||
|
||||
void BeginOfRunAction(const G4Run* aRun);
|
||||
void EndOfRunAction(const G4Run* aRun);
|
||||
void DrawOlaps();
|
||||
|
||||
G4std::vector<OlapInfo *> theOlaps;
|
||||
|
||||
private:
|
||||
|
||||
G4std::ofstream FILE;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapSteppingAction.hh,v 1.1 2002/06/04 07:40:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapSteppingAction
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapSteppingAction_h
|
||||
#define OlapSteppingAction_h
|
||||
|
||||
#include "g4std/vector"
|
||||
#include "g4std/iostream"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4NavigationHistory.hh"
|
||||
|
||||
class OlapEventAction;
|
||||
|
||||
struct OlapStepInfo
|
||||
{
|
||||
G4ThreeVector thePoint;
|
||||
G4NavigationHistory theHist;
|
||||
|
||||
};
|
||||
|
||||
G4std::ostream& operator << (G4std::ostream &, const OlapStepInfo &);
|
||||
G4std::ostream& operator << (G4std::ostream &, G4std::vector<OlapStepInfo*> &);
|
||||
|
||||
class OlapSteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
OlapSteppingAction(OlapEventAction*);
|
||||
~OlapSteppingAction();
|
||||
|
||||
void UserSteppingAction(const G4Step *);
|
||||
|
||||
OlapEventAction * theEventAction;
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: OlapVisManager.hh,v 1.1 2002/06/04 07:40:20 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// OlapVisManager
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OLAPVISMANAGER_HH
|
||||
#define OLAPVISMANAGER_HH
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
class OlapVisManager: public G4VisManager
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
OlapVisManager (G4int verboseLevel = 0);
|
||||
// Controls initial verbose level of VisManager and VisMessenger.
|
||||
// Can be changed by /vis/set/verbose.
|
||||
|
||||
private:
|
||||
|
||||
virtual void RegisterGraphicsSystems ();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: RandomDetector.hh,v 1.1 2002/06/04 07:40:20 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// RandomDetector
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef RandomDetector_h
|
||||
#define RandomDetector_h
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
class RandomDetector : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
RandomDetector(G4double prop);
|
||||
//RandomDetector(G4int level, G4int perLevel, G4double);
|
||||
~RandomDetector();
|
||||
|
||||
G4VPhysicalVolume * Construct();
|
||||
|
||||
private:
|
||||
G4int levels_, perLevel_;
|
||||
G4double overlapProp_; // propability of overlap
|
||||
G4double worldDim_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: SolidAnalyser.hh,v 1.1 2002/06/04 07:40:20 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// SolidAnalyser
|
||||
//
|
||||
// Sigleton providing Geant4 solids specifications in a generic way.
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef SolidAnalyser_h
|
||||
#define SolidAnalyser_h
|
||||
|
||||
#include "g4std/vector"
|
||||
#include "g4std/algorithm"
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
// supported Geant4 solids:
|
||||
class G4VSolid;
|
||||
class G4Box;
|
||||
class G4Cons;
|
||||
class G4Polycone;
|
||||
class G4Polyhedra;
|
||||
class G4Trap;
|
||||
class G4Trd;
|
||||
class G4Tubs;
|
||||
|
||||
class SolidAnalyser
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static SolidAnalyser * GetSolidAnalyser();
|
||||
|
||||
//void Reset();
|
||||
|
||||
// user method to retrieve information
|
||||
G4int GetParam(const G4VSolid *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
|
||||
~SolidAnalyser();
|
||||
|
||||
protected:
|
||||
G4int GetParam(const G4Box *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
G4int GetParam(const G4Cons *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
G4int GetParam(const G4Polycone *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
G4int GetParam(const G4Polyhedra *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
G4int GetParam(const G4Trap *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
G4int GetParam(const G4Trd *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
G4int GetParam(const G4Tubs *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
|
||||
private:
|
||||
|
||||
SolidAnalyser();
|
||||
|
||||
G4int NotImplemented(const G4VSolid *,
|
||||
G4std::vector<G4std::pair<G4String,G4double> > & ) const;
|
||||
|
||||
static SolidAnalyser * theInstance;
|
||||
};
|
||||
|
||||
G4std::ostream & operator<<(G4std::ostream& flux,
|
||||
G4std::vector<G4std::pair<G4String,G4double> >& v);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,202 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: tree.hh,v 1.2 2002/06/04 09:23:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// Tree
|
||||
//
|
||||
// Very simple tree data-type to get rid of QT-ListView ...
|
||||
// Trees are build once and not to be modified.
|
||||
// No memory management for Data!
|
||||
//
|
||||
// Author: Martin Liendl - Martin.Liendl@cern.ch
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
#ifndef OlapTree_h
|
||||
#define OlapTree_h
|
||||
|
||||
#include "g4std/set"
|
||||
#include "g4std/vector"
|
||||
#include "g4std/list"
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
template <class Data> class TreeNodeIterator;
|
||||
|
||||
template <class Data>
|
||||
class TreeNode
|
||||
{
|
||||
|
||||
friend class TreeNodeIterator<Data>;
|
||||
|
||||
public:
|
||||
|
||||
TreeNode(TreeNode * parent, Data data)
|
||||
: parent_(parent), firstChild_(0),
|
||||
lastChild_(0), nextSibling_(0), data_(data)
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
if(!parent->firstChild_)
|
||||
{
|
||||
parent->firstChild_=this;
|
||||
parent->lastChild_=this;
|
||||
}
|
||||
else
|
||||
{
|
||||
parent->lastChild_->nextSibling_ = this;
|
||||
parent->lastChild_=this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~TreeNode() // deletes the whole subtree as well!
|
||||
{
|
||||
if (parent_)
|
||||
{
|
||||
TreeNode * i = parent_->firstChild_;
|
||||
while(*i)
|
||||
{
|
||||
TreeNode * temp = i;
|
||||
i = i->nextSibling_;
|
||||
delete temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TreeNode * parent() const { return parent_; }
|
||||
Data data() const { return data_; }
|
||||
|
||||
G4int childCount() const
|
||||
{
|
||||
TreeNode * i = firstChild_;
|
||||
G4int c=0;
|
||||
while (i)
|
||||
{
|
||||
i = i->nextSibling_; c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
TreeNode * firstChild() const { return firstChild_; }
|
||||
TreeNode * nextSibling() const { return nextSibling_; }
|
||||
TreeNode * lastChild() const { return lastChild_; }
|
||||
|
||||
protected:
|
||||
|
||||
TreeNode * parent_;
|
||||
TreeNode * firstChild_;
|
||||
TreeNode * lastChild_;
|
||||
TreeNode * nextSibling_;
|
||||
Data data_;
|
||||
|
||||
private:
|
||||
TreeNode(const TreeNode &);
|
||||
TreeNode & operator=(const TreeNode *);
|
||||
};
|
||||
|
||||
|
||||
template <class Data>
|
||||
class Tree
|
||||
{
|
||||
public:
|
||||
|
||||
typedef TreeNode<Data> node_t;
|
||||
|
||||
Tree(Data rt)
|
||||
: root_(new node_t(0,rt)) {}
|
||||
|
||||
node_t * root() { return root_; }
|
||||
|
||||
protected:
|
||||
|
||||
node_t * root_;
|
||||
};
|
||||
|
||||
|
||||
template<class Data>
|
||||
class TreeNodeIterator
|
||||
{
|
||||
public:
|
||||
TreeNodeIterator(TreeNode<Data> * np)
|
||||
: myroot_(np), curpos_(np)
|
||||
{
|
||||
//if (np->parent())
|
||||
//nexts_=++(np->parent()->firstChild());
|
||||
}
|
||||
|
||||
~TreeNodeIterator() { }
|
||||
|
||||
TreeNode<Data> * current() { return curpos_; }
|
||||
|
||||
TreeNode<Data> * next()
|
||||
{
|
||||
|
||||
if (curpos_->firstChild_)
|
||||
{
|
||||
curpos_ = curpos_->firstChild_;
|
||||
return curpos_;
|
||||
}
|
||||
|
||||
if (curpos_->nextSibling_)
|
||||
{
|
||||
curpos_ = curpos_->nextSibling_;
|
||||
return curpos_;
|
||||
}
|
||||
while(up())
|
||||
{
|
||||
if (curpos_->nextSibling_)
|
||||
{
|
||||
curpos_ = curpos_->nextSibling_;
|
||||
return curpos_;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
G4bool up()
|
||||
{
|
||||
G4bool result(true);
|
||||
if (curpos_->parent_)
|
||||
curpos_ = curpos_->parent_;
|
||||
else
|
||||
result=false;
|
||||
|
||||
if (curpos_==myroot_)
|
||||
{
|
||||
result=false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
TreeNode<Data> * myroot_;
|
||||
TreeNode<Data> * curpos_;
|
||||
//Tree<Data>::c_iterator nextc_;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user