22 modified files
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- GlobalGridXYSegmentation.hh 2 Jul 2013 22:57:42 -0000 1.2
+++ GlobalGridXYSegmentation.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GlobalGridXYSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GlobalGridXYSegmentation.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_GLOBALGRIDXYSEGMENTATION_HH
#define LCDD_DETECTORS_GLOBALGRIDXYSEGMENTATION_HH 1
@@ -44,7 +44,7 @@
* @param[in] localStepPos The local step position.
* @return The local cell position.
*/
- G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
+ //G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
/**
* Compute the ID bin values from a step.
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- GridXYZSegmentation.hh 2 Jul 2013 22:57:42 -0000 1.2
+++ GridXYZSegmentation.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GridXYZSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GridXYZSegmentation.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_G4GRIDXYZSEGMENTATION_HH
#define LCDD_DETECTORS_G4GRIDXYZSEGMENTATION_HH 1
@@ -49,13 +49,6 @@
//G4ThreeVector getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint);
/**
- * Compute the local hit position from a local step position.
- * @param[in] localStepPos The local step position.
- * @return The local hit position.
- */
- G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
-
- /**
* Set the valid bin names for this Segmentation.
*/
void setBinNames()
@@ -65,6 +58,13 @@
addBinName("z");
}
+ /**
+ * Compute the local hit position from a local step position.
+ * @param[in] localStepPos The local step position.
+ * @return The local hit position.
+ */
+ G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
+
protected:
/**
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- NonprojectiveCylinderSegmentation.hh 2 Jul 2013 22:57:42 -0000 1.2
+++ NonprojectiveCylinderSegmentation.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/NonprojectiveCylinderSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/NonprojectiveCylinderSegmentation.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_G4NONPROJECTIVECYLINDERSEGMENTATION
#define LCDD_DETECTORS_G4NONPROJECTIVECYLINDERSEGMENTATION 1
@@ -40,7 +40,7 @@
* @param[in] aPreStepPoint The G4StepPoint object.
* @return The global hit position for the step point.
*/
- G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
+ //G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
/**
* Compute bin values from a step.
@@ -52,7 +52,7 @@
* Compute bin values from a step point.
* @param[in] aPreStepStep The G4StepPoint object.
*/
- void setBins(const G4StepPoint* aPreStepPoint);
+ //void setBins(const G4StepPoint* aPreStepPoint);
/**
* Set the valid bin names for this Segmentation.
@@ -65,6 +65,9 @@
G4ThreeVector getLocalHitPos(const G4Step* aStep);
+ /**
+ * @todo This method should not exist.
+ */
G4ThreeVector getLocalHitPos(const G4StepPoint* aPreStepPoint);
bool isValidSolid(G4VSolid*);
@@ -73,18 +76,18 @@
double computeDeltaPhi(const G4Step* aStep);
- double computeDeltaPhi(const G4StepPoint* aPreStepPoint);
-
int computeBinPhi(const G4Step* aStep);
+ int computeBinZ(const G4ThreeVector& localStepPos);
+
int computeBinPhi(const G4StepPoint* aPreStepPoint);
- int computeBinZ(const G4ThreeVector& localStepPos);
+ double computeDeltaPhi(const G4StepPoint* aPreStepPoint);
private:
- double m_gridSizePhi;
- double m_gridSizeZ;
+ double _gridSizePhi;
+ double _gridSizeZ;
};
#endif
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- ProjectiveCylinderSegmentation.hh 2 Jul 2013 22:57:42 -0000 1.2
+++ ProjectiveCylinderSegmentation.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveCylinderSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveCylinderSegmentation.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_G4PROJECTIVECYLINDERSEGMENTATION_HH
#define LCDD_DETECTORS_G4PROJECTIVECYLINDERSEGMENTATION_HH 1
@@ -56,14 +56,14 @@
* @param[in] aPreStepPoint The G4StepPoint object.
* @return The radial position of the step point's cell.
*/
- double getRadius(const G4StepPoint* aPreStepPoint);
+ //double getRadius(const G4StepPoint* aPreStepPoint);
/**
* Get the Z coordinate of a cell from a step point.
* @param[in] aPreStepPoint The G4PreStepPoint object.
* @return The Z coordinate of the step point's cell.
*/
- double getZ(const G4StepPoint* aPreStepPoint);
+ //double getZ(const G4StepPoint* aPreStepPoint);
};
#endif
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- ProjectiveSegmentation.hh 2 Jul 2013 22:57:42 -0000 1.2
+++ ProjectiveSegmentation.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveSegmentation.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_PROJECTIVESEGMENTATION_HH
#define LCDD_DETECTORS_PROJECTIVESEGMENTATION_HH 1
@@ -17,8 +17,8 @@
/**
* Class constructor.
- * @param[in] ntheta The number of cells in theta.
- * @param[in] nphi The number of cells in phi.
+ * @param[in] ntheta The number of cells in theta per 180 degrees.
+ * @param[in] nphi The number of cells in phi per 360 degrees.
*/
ProjectiveSegmentation(int ntheta, int nphi);
@@ -29,14 +29,20 @@
public:
- // virtuals from G4Segmentation; should not be overridden
- // in subclasses
+ /**
+ * Compute the global hit position from the step.
+ * @param[in] aStep The G4Step object.
+ * @return The global hit position at the step.
+ */
G4ThreeVector getGlobalHitPos(const G4Step* aStep);
- //G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
-
+ /**
+ * Compute the bin values from a step.
+ * @param[in] aStep The G4Step object.
+ */
void setBins(const G4Step* aStep);
+ //G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
//void setBins(const G4StepPoint* aPreStepPoint);
/**
@@ -50,39 +56,82 @@
protected:
+ /**
+ * Get the number of theta cells.
+ * @return The number of theta cells.
+ */
int getNtheta() const;
+
+ /**
+ * Get the number of phi cells.
+ * @return The number of phi cells.
+ */
int getNphi() const;
- // bins from 3vect pos
+ /**
+ * Compute the theta bin from a 3D position.
+ * @return The theta bin.
+ */
int getThetaBin(const G4ThreeVector& globalStepPos);
+
+ /**
+ * Compute the phi bin from a 3D position.
+ * @return The phi bin.
+ */
int getPhiBin(const G4ThreeVector& globalStepPos);
- // dim from bin
+ /**
+ * Compute a theta coordinate from a bin value.
+ * @return The theta coordinate.
+ */
double getThetaDim(const int &thetaBin) const;
+
+ /**
+ * Compute a phi coordinate from a bin value.
+ * @return The phi coordinate.
+ */
double getPhiDim(const int &phiBin) const;
- // dim from step
+ /**
+ * Compute a theta coordinate from a step.
+ * @param[in] aStep The G4Step object.
+ * @return The theta coordinate.
+ */
double getThetaDim(const G4Step* aStep);
- // dim from prestep
- //double getThetaDim(const G4StepPoint* aPreStepPoint);
+ /**
+ * Compute a phi coordinate from a step.
+ * @param[in] aStep The G4Step object.
+ * @return The phi coordinate.
+ */
double getPhiDim(const G4Step* aStep);
- // dim from prestep point:
- //double getPhiDim(const G4StepPoint* aPreStepPoint);
- // These should be overridden in subclasses
- // for a specific shape or orientation.
+ /**
+ * Get the radius at the step, taken from the geometric cylinder layer at that point.
+ * @return The radius at the step from the geometric cylinder.
+ */
virtual double getRadius(const G4Step* aStep);
+
+ /**
+ * Get the Z at the step, taken from the layer of the geometric cylinder layer at that point.
+ * @return The Z at the step from the geometric layer.
+ */
virtual double getZ(const G4Step* aStep);
+
+ // dim from prestep
+ //double getThetaDim(const G4StepPoint* aPreStepPoint);
+ // dim from prestep point:
+ //double getPhiDim(const G4StepPoint* aPreStepPoint);
//virtual double getRadius(const G4StepPoint* aPreStepPoint);
//virtual double getZ(const G4StepPoint* aPreStepPoint);
+
private:
void computeDivisions();
private:
- int m_ntheta, m_nphi;
- double m_divTheta, m_divPhi;
+ int _ntheta, _nphi;
+ double _divTheta, _divPhi;
};
#endif
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- ProjectiveZPlaneSegmentation.hh 2 Jul 2013 22:57:42 -0000 1.2
+++ ProjectiveZPlaneSegmentation.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveZPlaneSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveZPlaneSegmentation.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_PROJECTIVEZPLANESEGMENTATION_HH
#define LCDD_DETECTORS_PROJECTIVEZPLANESEGMENTATION_HH 1
@@ -9,21 +9,41 @@
#include "globals.hh"
/**
- * @brief Projective segmentation using Z.
- * @note This class uses Z from current volume rather than the cylindrical radius.
+ * This is a projective segmentation using Z and phi.
+ * @note This class uses Z from current volume rather than the cylindrical radius.
+ * @todo Document this class better.
*/
class ProjectiveZPlaneSegmentation: public ProjectiveSegmentation
{
public:
+
+ /**
+ * Class constructor.
+ * @param[in] ntheta The number of theta bins per 180 degrees.
+ * @param[in] nphi The number of phi bins per 360 degrees.
+ */
ProjectiveZPlaneSegmentation(int ntheta, int nphi);
+ /**
+ * Class destructor.
+ */
virtual ~ProjectiveZPlaneSegmentation();
protected:
+ /**
+ * Get the radius of the step from the cylinder at that point.
+ * @return The radius at the step.
+ */
virtual double getRadius(const G4Step* aStep);
+
+ /**
+ * Get the Z of the step from the cylinder at that point.
+ * @return The Z at the step.
+ */
virtual double getZ(const G4Step* aStep);
+
//virtual double getRadius(const G4StepPoint* aPreStepPoint);
//virtual double getZ(const G4StepPoint* aPreStepPoint);
};
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- ReadoutUtil.hh 1 Jul 2013 21:00:41 -0000 1.2
+++ ReadoutUtil.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,5 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ReadoutUtil.hh,v 1.2 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ReadoutUtil.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
+
#ifndef LCDD_DETECTORS_READOUTUTIL_HH
#define LCDD_DETECTORS_READOUTUTIL_HH 1
@@ -17,62 +18,170 @@
#include <vector>
/**
- * @brief Static readout helper methods.
- * @note The readout utility functions should take
- * either G4Step or G4StepPoint as an argument
- * for maximum generality.
+ * This class provides static utility functions for detector and readout classes.
*/
class ReadoutUtil
{
-public:
+private:
+
+ /**
+ * Class constructor, which is private because class should not be instantiated.
+ */
ReadoutUtil()
{
}
+ /**
+ * Class destructor, which is private because class is never instantiated.
+ */
virtual ~ReadoutUtil()
{
}
public:
+ /**
+ * Compute the mean of two vectors e.g. the mid-point between them.
+ * @param[in] vec1 The first 3-vector.
+ * @param[in] vec2 The second 3-vector.
+ * @return The mean of the two vectors.
+ */
static G4ThreeVector computeThreeVectorMean(const G4ThreeVector& vec1, const G4ThreeVector& vec2);
+ /**
+ * Compute the midpoint of the step using the pre and post step points.
+ * @param[in] aStep The G4Step object.
+ * @return The midpoint of the step.
+ */
static G4ThreeVector computeMidPos(const G4Step* aStep);
+ /**
+ * Compute the distance between two points.
+ * @param[in] vec1 The first point.
+ * @param[in] vec2 The second point.
+ * @return The distance between the two points.
+ */
static G4double computeDistance(const G4ThreeVector& vec1, const G4ThreeVector& vec2);
+ /**
+ * Compute the distance between the pre and post step points of a step.
+ * @param[in] aStep The G4Step object.
+ * @return The length of the step.
+ */
static G4double computeDistance(const G4Step* aStep);
+ /**
+ * Get the solid at the step point.
+ * @param[in] aStepPoint The G4StepPoint object.
+ * @return The solid at the step point.
+ */
static G4VSolid* getSolidFromStepPoint(const G4StepPoint* aStepPoint);
- static G4TouchableHandle getTouchableFromStep(const G4Step* aStep);
+ //static G4TouchableHandle getTouchableFromStep(const G4Step* aStep);
+ /**
+ * Transform the given point into the global reference frame of the solid at the step point.
+ * @param[in] aStepPoint The G4StepPoint object.
+ * @return The transformed point based on the volume's coordinate system.
+ */
static G4ThreeVector getVolumeGlobalPosition(const G4StepPoint* aStepPoint, const G4ThreeVector& pnt);
+ /**
+ * Get the global position of the volume at the step point.
+ * @param[in] aStepPoint The G4StepPoint object.
+ * @return The position of the volume at the step point.
+ */
static G4ThreeVector getVolumeGlobalPosition(const G4StepPoint* aStepPoint);
+ /**
+ * Get the Tubs solid from the step.
+ * @param[in] aStep The G4Step object.
+ * @return The Tubs solid at the step
+ */
static const G4Tubs* getTubs(const G4Step* aStep);
+
+ /**
+ * Get the Tubs solid from the step point.
+ * @param[in] aStep The G4Step object.
+ * @return The Tubs solid at the step point.
+ */
static const G4Tubs* getTubs(const G4StepPoint* aStepPoint);
+ /**
+ * Get the midpoint between the inner and outer radii of the Tubs.
+ * @param[in] tubs The Tubs solid.
+ * @return The Tubs midpoint.
+ */
static double computeTubsMidRadius(const G4Tubs* tubs);
+ /**
+ * Get the midpoint between the inner and outer radii of the Tubs at the step.
+ * @param[in] aStep The G4Step object.
+ * @return The Tubs midpoint at the step.
+ */
static double computeTubsMidRadius(const G4Step* aStep);
- static double computeTubsMidRadius(const G4StepPoint* aStepPoint);
+ /**
+ * Get the thickness of the Tubs which is the distance between the inner and outer radii.
+ * @param[in] tubs The Tubs solid.
+ * @return The thickness of the Tubs solid.
+ */
static double getTubsThickness(const G4Tubs* tubs);
+ /**
+ * Transform local point to global reference frame of the step.
+ * @param[in] localPos The local position to transform.
+ * @return The position transformed from local to global coordinates.
+ */
static G4ThreeVector transformLocalToGlobal(const G4Step* aStep, const G4ThreeVector& localPos);
- static G4ThreeVector transformLocalToGlobal(const G4StepPoint* aPreStepPoint, const G4ThreeVector& localPos);
+
+ /**
+ * Transform global point to local reference frame of the step.
+ * @param[in] globalPos The global position to transform.
+ * @return The position transformed from global to local coordinates.
+ */
static G4ThreeVector transformGlobalToLocal(const G4Step* aStep, const G4ThreeVector& globalPos);
- static G4ThreeVector transformGlobalToLocal(const G4StepPoint* aPreStepPoint, const G4ThreeVector& globalPos);
+ /**
+ * Get the number of the volume at the given depth.
+ * @param[in] historyDepth The depth into the touchable history.
+ * @return The volume number.
+ */
static int getVolumeNumber(G4TouchableHandle theTouchable, int historyDepth = -1);
+ /**
+ * Get a list of PhysicalVolumes at the step.
+ * @param[in] aStep The G4Step object.
+ * @return The list of PhysicalVolumes at the step.
+ */
static std::vector<G4VPhysicalVolume*> getPhysVolList(G4Step* aStep);
+ /**
+ * Check if the step has a Geantino particle.
+ * @param[in] aStep The G4Step object.
+ * @return True if geantino is particle of step's track; false if not.
+ */
static bool isGeantino(G4Step* aStep);
+ /**
+ * @todo Remove this method.
+ * @deprecated
+ */
+ static double computeTubsMidRadius(const G4StepPoint* aStepPoint);
+
+ /**
+ * @todo Remove this method.
+ * @deprecated
+ */
+ static G4ThreeVector transformLocalToGlobal(const G4StepPoint* aPreStepPoint, const G4ThreeVector& localPos);
+
+ /**
+ * @todo Remove this method.
+ * @deprecated
+ */
+ static G4ThreeVector transformGlobalToLocal(const G4StepPoint* aPreStepPoint, const G4ThreeVector& globalPos);
+
public:
static const double PI;
lcdd/include/lcdd/detectors
diff -u -r1.1 -r1.2
--- ScorerSD.hh 1 Jul 2013 21:00:41 -0000 1.1
+++ ScorerSD.hh 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ScorerSD.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ScorerSD.hh,v 1.2 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_SCORERSD_HH
#define LCDD_DETECTORS_SCORERSD_HH 1
@@ -7,18 +7,32 @@
#include "TrackerSD.hh"
/**
- * @brief Scoring plane sensitive detector.
+ * A scoring plane detector which does not record energy, only hits.
*/
class ScorerSD: public TrackerSD
{
+
public:
+
+ /**
+ * Class constructor.
+ * @param[in] sdName The SD's name.
+ * @param[in] hcName The name of the hit collection.
+ */
ScorerSD(G4String sdName, G4String hcName);
protected:
- virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+
+ /**
+ * Create hits from G4Step.
+ * @param[in] aStep The G4Step object.
+ * @param[in] theTouchable The touchable handle into the geometry.
+ * @return True if created hits; false if not.
+ */
+ virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* theTouchable);
protected:
- int m_currentTrackID;
+ int _currentTrackID;
};
#endif
lcdd/include/lcdd/detectors
diff -u -r1.3 -r1.4
--- Segmentation.hh 2 Jul 2013 22:57:42 -0000 1.3
+++ Segmentation.hh 3 Jul 2013 20:03:49 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/Segmentation.hh,v 1.3 2013/07/02 22:57:42 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/Segmentation.hh,v 1.4 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_SEGMENTATION_HH
#define LCDD_DETECTORS_SEGMENTATION_HH 1
@@ -73,8 +73,8 @@
/**
* @deprecated Only used by G4OpticalCalorimeter.
- * @todo Move to G4OpticalCalorimeter.
- * @warning Dummy method only. Specific Segmentation types must implement.
+ * @todo n Move to G4OpticalCalorimeter.
+ * @warning Dummy method only. Specific Segmentation types must implement.
*/
G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
lcdd/include/lcdd/detectors
diff -u -r1.1 -r1.2
--- SegmentationFactory.hh 1 Jul 2013 21:00:41 -0000 1.1
+++ SegmentationFactory.hh 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SegmentationFactory.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SegmentationFactory.hh,v 1.2 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_SEGMENTATIONFACTORY_HH
#define LCDD_DETECTORS_SEGMENTATIONFACTORY_HH 1
@@ -10,19 +10,27 @@
#include <string>
/**
- * @brief Returns a concrete segmentation object depending on input tag.
- * @note Includes a single, static method.
+ * This is a factory for creating Segmentation objects from SAX objects and tag name.
*/
class SegmentationFactory
{
private:
- // should not be instantiated
+ /**
+ * Class constructor which should not be accessed.
+ */
SegmentationFactory()
{
}
public:
+
+ /**
+ * Create a Segmentation object from a SAX object and tag name.
+ * @param[in] obj The SAXObject of the segmentation.
+ * @param[in] tag The segmentation's tag name.
+ * @return The Segmentation object.
+ */
static Segmentation* createSegmentation(SAXObject* obj, const std::string& tag);
};
lcdd/include/lcdd/detectors
diff -u -r1.1 -r1.2
--- SensitiveDetector.hh 1 Jul 2013 21:00:41 -0000 1.1
+++ SensitiveDetector.hh 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SensitiveDetector.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SensitiveDetector.hh,v 1.2 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_SENSITIVEDETECTOR_HH
#define LCDD_DETECTORS_SENSITIVEDETECTOR_HH 1
@@ -19,244 +19,291 @@
* @brief Basic implementation of G4VSensitiveDetector.
* @note Primary attributes include verbosity, energy cut,
* IdSpec,and hits collections.
+ * @todo Move code to source file.
*/
-class SensitiveDetector: public G4VSensitiveDetector, protected StepReadout
-{
+class SensitiveDetector: public G4VSensitiveDetector, protected StepReadout {
public:
- /**
- * EType indicates the basic type of detector, e.g. tracker or calorimeter.
- */
- enum EType
- {
- eNone = 0, eTracker = 1, eCalorimeter = 2
- };
-
- static const std::string& trackerStr;
- static const std::string& calorimeterStr;
- static const std::string& noneStr;
+ /**
+ * EType indicates the basic type of detector, e.g. tracker or calorimeter.
+ */
+ enum EType {
+ eNone = 0, eTracker = 1, eCalorimeter = 2
+ };
+
+ static const std::string& trackerStr;
+ static const std::string& calorimeterStr;
+ static const std::string& noneStr;
public:
- SensitiveDetector(G4String sdName, G4String hcName, EType sdType);
+ SensitiveDetector(G4String sdName, G4String hcName, EType sdType);
- SensitiveDetector(G4String sdName, const std::vector<G4String>& hcNames, EType sdType);
+ SensitiveDetector(G4String sdName, const std::vector<G4String>& hcNames,
+ EType sdType);
- virtual ~SensitiveDetector();
+ virtual ~SensitiveDetector();
public:
- /**
- * Geant4 initialization function called at beginning of event.
- */
- virtual void Initialize(G4HCofThisEvent *);
-
- /**
- * Geant4 EndOfEvent hook.
- */
- virtual void EndOfEvent(G4HCofThisEvent *);
+ /**
+ * Geant4 initialization function called at beginning of event.
+ */
+ virtual void Initialize(G4HCofThisEvent *);
+
+ /**
+ * Geant4 EndOfEvent hook.
+ */
+ virtual void EndOfEvent(G4HCofThisEvent *);
protected:
- /**
- * Geant4 function to make hits from the step.
- */
- virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+ /**
+ * Geant4 function to make hits from the step.
+ */
+ virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
- /**
- * Return the type of this detector encoded as an int.
- */
- inline SensitiveDetector::EType getType() const
- {
- return m_type;
- }
-
- /**
- * Return the type of this detector encoded as a string.
- */
- inline const std::string& getTypeString() const;
-
- /**
- * Return the hits collection ID associated with this detector.
- */
- inline G4int getHCID() const
- {
- return m_hcids[0];
- }
-
- inline G4int getHCID(G4int nHC) const
- {
- if (nHC > getNumberOfHitsCollections() + 1 || nHC < 0) {
- G4cerr << "The index " << nHC << " is not valid for SD " << this->GetName() << "." << G4endl;
- G4Exception("", "", FatalException, "Invalid index.");
- }
- return m_hcids[nHC];
- }
-
- /**
- * Check whether the G4LogicalVolume can be readout by this detector.
- * Base function just returns if the volume was assigned to this detector.
- */
- inline virtual bool isValidVolume(G4LogicalVolume* lv)
- {
- return lv != 0;
- }
-
- /**
- * Return the hits collection name associated with this detector.
- */
- inline const std::string& getHCName() const
- {
- return collectionName[0];
- }
-
- inline const std::string& getHCName(G4int nHC) const
- {
- return collectionName[nHC];
- }
-
- /**
- * Set the verbosity level of this detector.
- */
- inline void setVerbose(unsigned int v)
- {
- m_verbose = v;
- }
-
- /**
- * Get the verbosity level of this detector.
- */
- inline unsigned int getVerbose() const
- {
- return m_verbose;
- }
-
- /**
- * Return the hit energy cut of this detector.
- */
- inline G4double getEcut()
- {
- return m_ecut;
- }
-
- /**
- * Set the hit energy cut of this detector.
- */
- inline void setEcut(G4double ecut)
- {
- m_ecut = ecut;
- }
-
- /**
- * Set the identifier specification for this detector.
- */
- inline void setIdSpec(IdSpec* idspec)
- {
- m_idspec = idspec;
- }
-
- /**
- * Return the identifier specification for this detector.
- */
- inline IdSpec* getIdSpec() const
- {
- return m_idspec;
- }
-
- /**
- * Returns whether or not this detector has an associated identifier specification.
+ /**
+ * Return the type of this detector encoded as an int.
+ */
+ inline SensitiveDetector::EType getType() const {
+ return m_type;
+ }
+
+ /**
+ * Return the type of this detector encoded as a string.
+ */
+ inline const std::string& getTypeString() const;
+
+ /**
+ * Return the hits collection ID associated with this detector.
+ */
+ inline G4int getHCID() const {
+ return m_hcids[0];
+ }
+
+ /**
+ * Get the hit collection ID from the index.
+ * @param[in] nHC The hit collection index.
+ * @return The hit collection ID.
+ */
+ inline G4int getHCID(G4int nHC) const {
+ if (nHC > getNumberOfHitsCollections() + 1 || nHC < 0) {
+ G4cerr << "The index " << nHC << " is not valid for SD "
+ << this->GetName() << "." << G4endl;
+ G4Exception("", "", FatalException, "Invalid index.");
+ }
+ return m_hcids[nHC];
+ }
+
+ /**
+ * Check whether the G4LogicalVolume can be readout by this detector.
+ * Base function just checks that the volume is not null.
+ * @param[in] lv The G4LogicalVolume object.
+ * @return True if volume is valid; false if not.
+ */
+ inline virtual bool isValidVolume(G4LogicalVolume* lv)
+ {
+ return lv != 0;
+ }
+
+ /**
+ * Get the hit collection name associated with this detector.
+ * @return The name of the hit collection.
+ */
+ inline const std::string& getHCName() const
+ {
+ return collectionName[0];
+ }
+
+ /**
+ * Get the hit collection by index.
+ * @return The hit collection by index.
+ */
+ inline const std::string& getHCName(G4int nHC) const
+ {
+ return collectionName[nHC];
+ }
+
+ /**
+ * Set the verbosity level of this detector.
+ * @param[in] v The verbosity level.
+ */
+ inline void setVerbose(unsigned int v)
+ {
+ m_verbose = v;
+ }
+
+ /**
+ * Get the verbosity level of this detector.
+ * @return The verbosity level of this detector.
+ */
+ inline unsigned int getVerbose() const
+ {
+ return m_verbose;
+ }
+
+ /**
+ * Get the hit energy cut of this detector (GeV).
+ * @return The energy cut.
+ */
+ inline G4double getEcut()
+ {
+ return m_ecut;
+ }
+
+ /**
+ * Set the hit energy cut of this detector.
+ * @param[in] ecut The energy cut.
+ */
+ inline void setEcut(G4double ecut)
+ {
+ m_ecut = ecut;
+ }
+
+ /**
+ * Set the identifier specification for this detector.
+ * @param[in] idspec The identifier specification.
+ */
+ inline void setIdSpec(IdSpec* idspec)
+ {
+ m_idspec = idspec;
+ }
+
+ /**
+ * Get the identifier specification for this detector.
+ * @return The identifier specification.
+ */
+ inline IdSpec* getIdSpec() const
+ {
+ return m_idspec;
+ }
+
+ /**
+ * Check whether this detector has an associated identifier specification.
+ * @return True if detector has identifier specification; false if not.
+ */
+ inline bool hasIdSpec() const
+ {
+ return m_idspec != 0;
+ }
+
+ /**
+ * Create a 64-bit identifier based on the current step information.
+ * @return A 64-bit identifier from the current step.
+ */
+ Id64bit makeId() const;
+
+ /**
+ * Set the endcap flag.
+ * @param[in] ec Set the endcap flag.
+ */
+ inline void setEndcapFlag(bool ec = true)
+ {
+ m_endcap = ec;
+ }
+
+ /**
+ * Get the endcap flag.
+ * @return The flag indicating endcap or not.
+ */
+ inline bool getEndcapFlag()
+ {
+ return m_endcap;
+ }
+
+ /**
+ * Print basic information about this detector.
+ * @param[in] os The output stream.
+ * @return The same output stream.
+ */
+ virtual std::ostream& printBasicInfo(std::ostream& os);
+
+ /**
+ * Print the number of hits to the output stream.
+ * @param[in] os The output stream.
+ * @return The same output stream.
+ */
+ virtual std::ostream& printNumberOfHits(std::ostream& os);
+
+ /**
+ * Print the number of hits to the output stream.
+ * @param[in] os The output stream.
+ * @return The same output stream.
+ */
+ virtual std::ostream& printEdep(std::ostream& os);
+
+ /**
+ * Print the names of volumes associated to this detector.
+ * @param[in] os The output stream.
+ * @return The same output stream.
+ */
+ virtual std::ostream& printVolumes(std::ostream& os);
+
+ /**
+ * Print the list of hits. Subclasses must implement this.
+ * @param[in] os The output stream.
+ * @return The same output stream.
+ */
+ virtual std::ostream& printHits(std::ostream& os)
+ {
+ return os;
+ }
+
+ /**
+ * Get the (first) hit collection associated with this detector.
+ * @return The hit collection associated with this detector.
+ */
+ G4VHitsCollection* getHitsCollection() const;
+
+ /**
+ * Get a hits collection, using the hits collection ID (HCID).
+ * @return The hit collection from the HC ID.
+ */
+ G4VHitsCollection* getHitsCollection(G4int) const;
+
+ /**
+ * Get the number of hits collections associated to this detector.
+ * @return The number of hit collections.
+ */
+ inline int getNumberOfHitsCollections() const
+ {
+ return m_hcids.size();
+ }
+
+ /**
+ * Get the total energy deposition from the hits of this detector.
+ * @note This method would requires access to concrete hit types,
+ * so this function must be implemented by subclasses.
+ * @return The total energy deposition of all the hits.
*/
- inline bool hasIdSpec() const
+ virtual double getEdep() const
{
- return m_idspec != 0;
+ return 0.0;
}
/**
- * Create a 64-bit identifier based on the current step information.
+ * Get a list of G4LogicalVolume objects that have been assigned to this detector.
+ * @return The list of G4LogicalVolume objects assigned to this detector.
*/
- Id64bit makeId() const;
-
- /**
- * Set the endcap flag.
- */
- inline void setEndcapFlag( bool ec = true )
- {
- m_endcap = ec;
- }
+ std::vector<G4LogicalVolume*> getLogicalVolumes() const;
/**
- * Return the endcap flag.
+ * Clear the list of hits after event processing.
+ * @note Sub-classes must implement this method.
*/
- inline bool getEndcapFlag()
+ virtual void clearHits()
{
- return m_endcap;
+ ;
}
- /**
- * Print basic information about this detector to the output stream.
- */
- virtual std::ostream& printBasicInfo(std::ostream& os);
-
- /**
- * Print the number of hits to the output stream.
- */
- virtual std::ostream& printNumberOfHits(std::ostream& os);
-
- /**
- * Print the number of hits to the output stream.
- */
- virtual std::ostream& printEdep(std::ostream& os);
-
- /**
- * Print the names of volumes associated to this detector.
- */
- virtual std::ostream& printVolumes(std::ostream& os);
-
- /**
- * Print the list of hits. Subclasses must implement this.
- */
- virtual std::ostream& printHits(std::ostream& os) {return os;}
-
- /**
- * Get single (first) HC associated with this detector.
- */
- G4VHitsCollection* getHitsCollection() const;
-
- /**
- * Retrieve the hits collection associated with this detector,
- * using the hits collection ID (HCID).
- */
- G4VHitsCollection* getHitsCollection(G4int) const;
-
- /**
- * Get the number of hits collections in this SD.
- */
- inline int getNumberOfHitsCollections() const {return m_hcids.size();}
-
- /**
- * Return the total energy deposition from the hits of this detector.
- * Requires access to concrete hit types, so this function must be
- * implemented by subclasses.
- */
- virtual double getEdep() const {return 0.0;}
-
- /**
- * Return a list of G4LogicalVolume objects that have been assigned
- * this sensitive detector.
- */
- std::vector<G4LogicalVolume*> getLogicalVolumes() const;
-
- /**
- * Subclasses need to implement this method.
- */
- virtual void clearHits() {;}
-
protected:
/**
* Set the Hits Collection ID for a single collection.
+ * @param[in] The hit collection ID.
*/
inline void setHCID(G4int hcid)
{
@@ -265,6 +312,8 @@
/**
* Set the Hits Collection ID for a given collection.
+ * @param[in] hcid The hit collection ID.
+ * @param[in] nHC The numerical index of the hit collection.
*/
inline void setHCID(G4int hcid, G4int nHC)
{
@@ -279,27 +328,27 @@
protected:
// vector containing Hit Collection ID's
- std::vector<G4int> m_hcids;
+ std::vector<G4int> m_hcids;
- // verbosity
- unsigned int m_verbose;
+ // verbosity
+ unsigned int m_verbose;
- // endcap flag for LCIO's CHBIT_BARREL bit
- bool m_endcap;
+ // endcap flag for LCIO's CHBIT_BARREL bit
+ bool m_endcap;
- // energy cut
- double m_ecut;
+ // energy cut
+ double m_ecut;
- // identifier field description
- IdSpec* m_idspec;
+ // identifier field description
+ IdSpec* m_idspec;
- private:
+private:
- // type = calorimeter or tracker
- EType m_type;
+ // type = calorimeter or tracker
+ EType m_type;
- // The Geant4 command messenger associated with this detector.
- G4UImessenger* m_messenger;
- };
+ // The Geant4 command messenger associated with this detector.
+ G4UImessenger* m_messenger;
+};
#endif
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- SensitiveDetectorFactory.hh 1 Jul 2013 21:00:41 -0000 1.2
+++ SensitiveDetectorFactory.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,11 +1,10 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SensitiveDetectorFactory.hh,v 1.2 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SensitiveDetectorFactory.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_SENSITIVEDETECTORFACTORY_HH
#define LCDD_DETECTORS_SENSITIVEDETECTORFACTORY_HH 1
// LCDD
#include "lcdd/core/LCDDProcessor.hh"
-
#include "lcdd/schema/SensitiveDetectorType.hh"
#include "lcdd/schema/calorimeter.hh"
#include "lcdd/schema/tracker.hh"
@@ -13,7 +12,6 @@
#include "lcdd/schema/IdSpecType.hh"
#include "lcdd/detectors/SensitiveDetector.hh"
#include "lcdd/detectors/SegmentationFactory.hh"
-
#include "lcdd/id/IdManager.hh"
#include "lcdd/id/IdSpec.hh"
@@ -28,51 +26,96 @@
class CalorimeterSD;
/**
- @class SensitiveDetectorFactory
- @brief Creates SDs based on XML tag data.
+ * This factory creates SensitiveDetector objects from detector tag names and parameters.
*/
class SensitiveDetectorFactory
{
private:
- // shouldn't be instantiated
+
+ /**
+ * Class constructor which is private.
+ */
SensitiveDetectorFactory()
{
}
-public:
+ /**
+ * Class destructor.
+ */
virtual ~SensitiveDetectorFactory()
{
}
- // all static functions
public:
+ /**
+ * Create a SensitiveDetector object.
+ * @param[in] object The SAXObject of the detector.
+ */
static SensitiveDetector* createSensitiveDetector(const SAXObject* object);
private:
+ /**
+ * Create a CalorimeterSD object.
+ * @param[in] object The SAXObject of the detector.
+ */
static CalorimeterSD* createCalorimeterSD(const SAXObject* object);
+ /**
+ * Create a TrackerSD object.
+ * @param[in] object The SAXObject of the detector.
+ */
static TrackerSD* createTrackerSD(const SAXObject* object);
+ /**
+ * Create a ScorerSD object.
+ * @param[in] object The SAXObject of the detector.
+ */
static ScorerSD* createScorerSD(const SAXObject* object);
/**
* Lookup the IdSpec of a detector SAX object based on the idspecref.
- * @throw G4Exception if the idspecref has a bad reference value.
+ * @param[id] sdt The SD type SAXObject.
* @return The IdSpec of this detector, or null if one does not exist.
+ * @throw G4Exception If the idspecref has a bad reference value.
*/
static IdSpec* findIdSpec(const SensitiveDetectorType* sdt);
+ /**
+ * Set the base parameters of the sensitive detector.
+ * @param[out] sd The target SD.
+ * @param[in] sdt The SAXObject of the SD.
+ */
static void setBaseSensitiveDetectorAttributes(SensitiveDetector* sd, const SensitiveDetectorType* sdt);
+ /**
+ * Compute the ecut for a detector.
+ * @param[in] sdt The SAXObject of the SD.
+ * @return The ecut (GeV).
+ */
static double computeEcut(const SensitiveDetectorType* sdt);
+ /**
+ * Convert input parameters to a verbosity level.
+ * @param[in] sdt The SAXObject of the SD.
+ * @return The verbosity level.
+ */
static int convertVerbose(const SensitiveDetectorType* sdt);
+ /**
+ * Check if the string is a legitimate Segmentation tag.
+ * @param[in] s The name of the tag.
+ * @return True if segmentation tag is valid; false if not.
+ */
static bool isSegmentationTag(const std::string& s);
+ /**
+ * Check if a hit collection name is valid, e.g. contains all valid characters.
+ * @param[in] s The hit collection name.
+ * @return True if hit collection name is valid; false if not.
+ */
static bool checkHCName(const std::string& s);
};
lcdd/include/lcdd/detectors
diff -u -r1.3 -r1.4
--- SensitiveDetectorMessenger.hh 1 Jul 2013 21:00:41 -0000 1.3
+++ SensitiveDetectorMessenger.hh 3 Jul 2013 20:03:49 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SensitiveDetectorMessenger.hh,v 1.3 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/SensitiveDetectorMessenger.hh,v 1.4 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_SENSITIVEDETECTORMESSENGER_HH
#define LCDD_DETECTORS_SENSITIVEDETECTORMESSENGER_HH 1
@@ -9,6 +9,7 @@
// LCDD
#include "SensitiveDetector.hh"
+// Geant4
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
@@ -16,22 +17,45 @@
class G4UIcmdWithADoubleAndUnit;
/**
- * @brief G4UImessenger subclass that automatically provides a macro command interface
- * to the sensitive detectors registered with LCDD.
+ * This is a Geant4 messenger class that automatically provides a macro command interface
+ * to a sensitive detector registered with LCDD.
*/
class SensitiveDetectorMessenger: public G4UImessenger
{
+
public:
+
+ /**
+ * Class constructor.
+ * @param[in] detector The SensitiveDetector to connect to the messenger.
+ */
SensitiveDetectorMessenger(SensitiveDetector* detector);
+ /**
+ * Class destructor.
+ */
virtual ~SensitiveDetectorMessenger();
public:
+ /**
+ * Execute a messenger command.
+ * @param[in] cmd The messenger command.
+ * @param[in] newVals The command arguments.
+ */
virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+ /**
+ * Create the directory for this detector.
+ */
static void makeDetectorsDir();
+private:
+
+ /**
+ * Define this messenger's commands.
+ * @param[in] The SensitiveDetector of this messenger.
+ */
void defineCommands(G4VSensitiveDetector* sd);
private:
lcdd/include/lcdd/detectors
diff -u -r1.2 -r1.3
--- StepReadout.hh 1 Jul 2013 21:00:41 -0000 1.2
+++ StepReadout.hh 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,13 +1,13 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/StepReadout.hh,v 1.2 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/StepReadout.hh,v 1.3 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_STEPREADOUT_HH
#define LCDD_DETECTORS_STEPREADOUT_HH 1
-// geant4
+// Geant4
#include "G4ThreeVector.hh"
#include "G4TouchableHandle.hh"
-// stl
+// STL
#include <vector>
// Geant4
@@ -26,95 +26,255 @@
class UserRegionInformation;
/**
- * @brief Utility functions to return information about a G4Step object.
- * @note The only cached data member is the step pointer.
+ * This is a set of static utility functions to compute derived information from a G4Step object.
+ * @note The only cached data member of this class is the step pointer.
*/
class StepReadout
{
+
public:
+
+ /**
+ * Class constructor.
+ */
StepReadout();
+
+ /**
+ * Class destructor.
+ */
virtual ~StepReadout();
public:
- // step
+ /**
+ * Set the G4Step object of this StepReadout.
+ * @param[in] s The G4Step object to be cached.
+ */
void setStep(G4Step* s);
+
+ /**
+ * Get the cached G4Step object.
+ * @return The cached G4Step object.
+ */
G4Step* step() const;
+
+ /**
+ * Check if this object has a cached G4Step.
+ * @return True if there is a cached G4Step; false if not.
+ */
bool hasStep() const;
- // step points
+ /**
+ * Get the pre step point of the current step.
+ * @return The pre step point of the current step.
+ */
G4StepPoint* pre() const;
+
+ /**
+ * Get the post step point of the current step.
+ * @return The post step point of the current step.
+ */
G4StepPoint* post() const;
- // PV from pre and post
+ /**
+ * Get the physical volume associated with the pre step point.
+ * @return The physical volume from the pre step point.
+ */
G4VPhysicalVolume* prePV() const;
+
+ /**
+ * Get the physical volume associated with the post step point.
+ * @return The physical volume from the post step point.
+ */
G4VPhysicalVolume* postPV() const;
- // solid from pre and post
+ /**
+ * Get the solid associated with the pre step point.
+ * @return The solid from the pre step point.
+ */
G4VSolid* preSolid() const;
+
+ /**
+ * Get the solid associated with the post step point
+ * @return The solid from the post step point.
+ */
G4VSolid* postSolid() const;
- // LV from pre and post
+ /**
+ * Get the logical volume from the pre step point.
+ * @return The logical volume from the pre step point.
+ */
G4LogicalVolume* preLV() const;
+
+ /**
+ * Get the logical volume from the post step point.
+ * @return The logical volume from the post step point.
+ */
G4LogicalVolume* postLV() const;
- // material from pre and post
+ /**
+ * Get the material from the pre step point.
+ * @return The material from the pre step point.
+ */
G4Material* preMaterial() const;
+
+ /**
+ * Get the material from the post step point.
+ * @return The material from post step point.
+ */
G4Material* postMaterial() const;
- // region from pre and post
+ /**
+ * Get the region from the pre step point.
+ * @return The region from the pre step point.
+ */
G4Region* preRegion() const;
+
+ /**
+ * Get the region from the post step point.
+ * @return The region from the post step point.
+ */
G4Region* postRegion() const;
- // pre and post position of PV
+ /**
+ * Get the center position of the volume pointed to by the touchable.
+ * @return The position of the volume from the touchable.
+ */
G4ThreeVector volumePosition(G4TouchableHandle theTouchable) const;
+
+ /**
+ * Get the center position of the volume from the pre step point.
+ * @return The center position of the volume from the pre step point.
+ */
G4ThreeVector preVolumePosition() const;
+
+ /**
+ * Get the center position of the volume from the post step point.
+ * @return The center position of the volume from the post step point.
+ */
G4ThreeVector postVolumePosition() const;
- // SD from pre and post
+ /**
+ * Get the sensitive detector from the pre step point.
+ * @return The sensitive detector from the pre step point.
+ */
G4VSensitiveDetector* preSD() const;
+
+ /**
+ * Get the sensitive detector from the post step point.
+ * @return The sensitive detector from the post step point.
+ */
G4VSensitiveDetector* postSD() const;
+
+ /**
+ * Get the sensitive detector from the step point.
+ * @return The sensitive detector from the step point.
+ */
G4VSensitiveDetector* getSD(G4StepPoint*) const;
- // are pre and post SD the same?
+ /**
+ * Check if the pre and post step point sensitive detectors are the same.
+ * @return True if the SDs are the same; false if not.
+ */
bool hasSameSD() const;
- // edep from step
+ /**
+ * Get the energy deposition of the step.
+ * @return The energy deposition of the step.
+ */
double edep() const;
- // track
+ /**
+ * Get the track from the step.
+ * @return The track from the step.
+ */
G4Track* track() const;
- // data from track
+ /**
+ * Get the global time of the track.
+ * @return The global time of the track.
+ */
double globalTime() const;
+
+ /**
+ * Get the ID of the track.
+ * @return The ID of the track.
+ */
int trackID() const;
+
+ /**
+ * Get the momentum of the track.
+ * @return The momentum of the track.
+ */
G4ThreeVector momentum() const;
+
+ /**
+ * Get the track information.
+ * @return The track information.
+ */
TrackInformation* trackInformation() const;
- // pre, mid and post positions
+ /**
+ * Get the position of the pre step point.
+ * @return The position of the pre step point.
+ */
G4ThreeVector prePosition() const;
+
+ /**
+ * Get the mid position of the step.
+ * @return The mid position of the step.
+ */
G4ThreeVector midPosition() const;
+
+ /**
+ * Get the position of the post step point.
+ * @return The position of the post step point.
+ */
G4ThreeVector postPosition() const;
- // pre, post and mean momentum
+ /**
+ * Get the momentum at the pre step point.
+ * @return The momentum at the pre step point.
+ */
G4ThreeVector preMomentum() const;
+
+ /**
+ * Get the momentum of the post step point.
+ * @return The momentum at the post step point.
+ */
G4ThreeVector postMomentum() const;
+
+ /**
+ * The mean of the pre and post momenta.
+ * @return The mean of the pre and post momenta.
+ */
G4ThreeVector meanMomentum() const;
- // pre and post handles
+ /**
+ * Get the touchable handle from the pre step point.
+ * @return The touchable handle from the pre step point.
+ */
G4TouchableHandle preTouchableHandle() const;
+
+ /**
+ * Get the touchable handle from the post step point.
+ * @return The touchable handle from the post step point.
+ */
G4TouchableHandle postTouchableHandle() const;
- // current step is a geantino or chargedgeantino?
+ /**
+ * Check if the current step points to a Geantino particle.
+ * @return True if the current step points to a Geantino; false if not.
+ */
bool isGeantino();
protected:
// cached step
- G4Step* m_step;
+ G4Step* _step;
// vector = [0,0,0]
- const G4ThreeVector m_origin;
+ const G4ThreeVector _origin;
};
#endif
lcdd/include/lcdd/detectors
diff -u -r1.1 -r1.2
--- TrackerCombineSD.hh 1 Jul 2013 21:00:41 -0000 1.1
+++ TrackerCombineSD.hh 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,32 +1,68 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/TrackerCombineSD.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/TrackerCombineSD.hh,v 1.2 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_TRACKERCOMBINESD_HH
#define LCDD_DETECTORS_TRACKERCOMBINESD_HH 1
#include "TrackerSD.hh"
/**
- * @brief Tracker subclass to combine multiple hits in the same tracker layer
- * into a single hit having the mean momentum and position.
- * @note The logic in this class is based on a refactoring of Mokka's TRKSD00.
+ * This is a Tracker subclass to combine multiple hits in the same tracker layer
+ * into a single hit having the mean momentum and position.
+ * @note Parts of the logic in this class is based on a refactoring of code from Mokka's TRKSD00.
*/
class TrackerCombineSD: public TrackerSD
{
public:
+
+ /**
+ * Class constructor.
+ * @param[in] sdName The name of the sensitive detector.
+ * @param[in] hcName The name of the hit collection.
+ */
TrackerCombineSD(G4String sdName, G4String hcName);
+ /**
+ * Class destructor.
+ */
virtual ~TrackerCombineSD();
public:
- virtual void EndOfEvent(G4HCofThisEvent *);
+
+ /**
+ * Perform end of event processing on the HC of this event.
+ * @param[in] hce The HC of this event.
+ */
+ virtual void EndOfEvent(G4HCofThisEvent* hce);
protected:
- virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+
+ /**
+ * Create hits from step data.
+ * @param[in] step The current G4Step object.
+ * @param[in] touchable The current touchable handle into the geometry.
+ */
+ virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* touchable);
private:
+ /**
+ * Start a new hit.
+ * @param[in] aStepPoint The pre step point.
+ */
void startHit(G4StepPoint* aStepPoint);
+
+ /**
+ * Update an existing hit with current step data.
+ */
void updateHit();
+
+ /**
+ * Insert a new hit after all data is added.
+ */
bool insertHit();
+
+ /**
+ * Clear the current hit.
+ */
void clear();
private:
lcdd/include/lcdd/detectors
diff -u -r1.1 -r1.2
--- TrackerSD.hh 1 Jul 2013 21:00:41 -0000 1.1
+++ TrackerSD.hh 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/TrackerSD.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/TrackerSD.hh,v 1.2 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_TRACKERSD_HH
#define LCDD_DETECTORS_TRACKERSD_HH 1
@@ -8,7 +8,7 @@
#include "lcdd/hits/TrackerHit.hh"
/**
- * @brief Geant4 binding for a tracker-type SD.
+ * The basic binding for a tracker type subdetector.
*/
class TrackerSD: public SensitiveDetector
{
@@ -17,23 +17,65 @@
typedef std::vector<TrackerHit*> G4TrackerHitList;
public:
+
+ /**
+ * Class constructor.
+ * @param[in] sdName The name of the sensitive detector.
+ * @param[in] hcName The hit collection name.
+ */
TrackerSD(G4String sdName, G4String hcName);
+ /**
+ * Class destructor.
+ */
virtual ~TrackerSD();
public:
- virtual void Initialize(G4HCofThisEvent *);
- virtual void EndOfEvent(G4HCofThisEvent *);
+
+ /**
+ * Perform initialization at start of event.
+ * @param[in] hce The hit collection of this event.
+ */
+ virtual void Initialize(G4HCofThisEvent* hce);
+
+ /**
+ * Perform end of event processing.
+ * @param[in] hce The hit collection of this event.
+ */
+ virtual void EndOfEvent(G4HCofThisEvent* hce);
+
+ /**
+ * Print out hit data.
+ * @param[in] os The output stream.
+ * @return The same output stream.
+ */
std::ostream& printHits(std::ostream& os);
+ /**
+ * Get the total energy deposition in the event.
+ * @return The total energy deposition.
+ */
double getEdep() const;
+ /**
+ * Clear the current hit list.
+ */
void clearHits();
+ /**
+ * Get the list of tracker hits.
+ * @return The list of tracker hits.
+ */
G4TrackerHitList getTrackerHitList();
protected:
- virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+
+ /**
+ * Process step to produce hits.
+ * @param[in] step The current G4Step object.
+ * @param[in] touchable The current touchable handle into the geometry.
+ */
+ virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* touchable);
protected:
G4TrackerHitsCollection* m_HC;
lcdd/include/lcdd/detectors
diff -u -r1.1 -r1.2
--- UnsegmentedCalorimeterSD.hh 1 Jul 2013 21:00:41 -0000 1.1
+++ UnsegmentedCalorimeterSD.hh 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Id: UnsegmentedCalorimeterSD.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Id: UnsegmentedCalorimeterSD.hh,v 1.2 2013/07/03 20:03:49 jeremy Exp $
#ifndef LCDD_DETECTORS_UNSEGMENTEDCALORIMETERSD_HH
#define LCDD_DETECTORS_UNSEGMENTEDCALORIMETERSD_HH 1
@@ -7,18 +7,37 @@
#include "CalorimeterSD.hh"
/**
- * @brief A sensitive detector that writes out a CalorimeterHit for
- * each step. It does not have any segmentation.
+ * A sensitive detector that writes out a CalorimeterHit for each step.
+ * It does not have any segmentation.
*/
class UnsegmentedCalorimeterSD: public CalorimeterSD
{
public:
+ /**
+ * Class constructor.
+ * @param[in] sdName The name of the sensitive detector.
+ * @param[in] hcName The name of the hit collection.
+ * @param[in] seg The segmentation (ignored???).
+ */
UnsegmentedCalorimeterSD(G4String sdName, G4String hcName, Segmentation* seg);
+ /**
+ * Class destructor.
+ */
+ ~UnsegmentedCalorimeterSD()
+ {
+ ;
+ }
+
protected:
- virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+ /**
+ * Process steps to produce hits.
+ * @param[in] step The current G4Step object.
+ * @param[in] touchable A touchable handle pointing to current volume.
+ */
+ G4bool ProcessHits(G4Step* step, G4TouchableHistory* touchable);
};
-#endif /* G4UNSEGMENTEDCALORIMETERSD_HH_ */
+#endif
lcdd/src/lcdd/detectors
diff -u -r1.1 -r1.2
--- NonprojectiveCylinderSegmentation.cc 1 Jul 2013 21:00:45 -0000 1.1
+++ NonprojectiveCylinderSegmentation.cc 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/NonprojectiveCylinderSegmentation.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/NonprojectiveCylinderSegmentation.cc,v 1.2 2013/07/03 20:03:49 jeremy Exp $
// LCDD
#include "lcdd/detectors/NonprojectiveCylinderSegmentation.hh"
@@ -11,7 +11,7 @@
#include <cmath>
NonprojectiveCylinderSegmentation::NonprojectiveCylinderSegmentation(double gridSizePhi, double gridSizeZ) :
- Segmentation(Segmentation::eNonprojective), m_gridSizePhi(gridSizePhi), m_gridSizeZ(gridSizeZ)
+ Segmentation(Segmentation::eNonprojective), _gridSizePhi(gridSizePhi), _gridSizeZ(gridSizeZ)
{
setBinNames();
@@ -36,6 +36,8 @@
return localCellPos;
}
+
+/*
G4ThreeVector NonprojectiveCylinderSegmentation::getGlobalHitPos(const G4StepPoint* aPreStepPoint)
{
// local cell pos
@@ -51,6 +53,8 @@
return localCellPos;
}
+*/
+
G4ThreeVector NonprojectiveCylinderSegmentation::getLocalHitPos(const G4Step* aStep)
{
G4ThreeVector globalMidPos = ReadoutUtil::computeMidPos(aStep);
@@ -74,7 +78,7 @@
// compute cell Z, phi
double cellPhi = computeDim(iphi, deltaPhi);
- double cellZ = computeDim(iz, m_gridSizeZ);
+ double cellZ = computeDim(iz, _gridSizeZ);
// compute X, Y
double cellX = rcyl * cos(cellPhi);
@@ -95,6 +99,7 @@
return cellCenter;
}
+
G4ThreeVector NonprojectiveCylinderSegmentation::getLocalHitPos(const G4StepPoint* aPreStepPoint)
{
G4ThreeVector globalPos = aPreStepPoint->GetPosition();
@@ -118,7 +123,7 @@
// compute cell Z, phi
double cellPhi = computeDim(iphi, deltaPhi);
- double cellZ = computeDim(iz, m_gridSizeZ);
+ double cellZ = computeDim(iz, _gridSizeZ);
// compute X, Y
double cellX = rcyl * cos(cellPhi);
@@ -149,7 +154,7 @@
double circ = 2.0 * ReadoutUtil::PI * mid_rad_layer;
// number of cells along phi in curr layer
- int nphi = (int) floor(circ / m_gridSizePhi);
+ int nphi = (int) floor(circ / _gridSizePhi);
// single phi division in degrees
double deltaPhi = (360.0 * deg) / nphi;
@@ -165,7 +170,7 @@
double circ = 2.0 * ReadoutUtil::PI * mid_rad_layer;
// number of cells along phi in curr layer
- int nphi = (int) floor(circ / m_gridSizePhi);
+ int nphi = (int) floor(circ / _gridSizePhi);
// single phi division in degrees
double deltaPhi = (360.0 * deg) / nphi;
@@ -184,18 +189,18 @@
setBin(0, bphi);
setBin(1, bz);
}
-void NonprojectiveCylinderSegmentation::setBins(const G4StepPoint* aPreStepPoint)
-{
- //G4cout << "G4NonprojectiveCylinderSegmentation::setBins()" << G4endl;
-
- G4ThreeVector globalPos = aPreStepPoint->GetPosition();
-
- int bphi = computeBinPhi(aPreStepPoint);
- int bz = computeBinZ(globalPos);
-
- setBin(0, bphi);
- setBin(1, bz);
-}
+//void NonprojectiveCylinderSegmentation::setBins(const G4StepPoint* aPreStepPoint)
+//{
+// //G4cout << "G4NonprojectiveCylinderSegmentation::setBins()" << G4endl;
+//
+// G4ThreeVector globalPos = aPreStepPoint->GetPosition();
+//
+// int bphi = computeBinPhi(aPreStepPoint);
+// int bz = computeBinZ(globalPos);
+//
+// setBin(0, bphi);
+// setBin(1, bz);
+//}
int NonprojectiveCylinderSegmentation::computeBinPhi(const G4Step* aStep)
{
G4ThreeVector globalMidPos = ReadoutUtil::computeMidPos(aStep);
@@ -243,7 +248,7 @@
//G4cout << "localStepPos.z() <" << localStepPos.z() << ">" << G4endl;
//G4cout << "m_gridSizeZ <" << m_gridSizeZ << ">" << G4endl;
- return computeBin(localStepPos.z(), m_gridSizeZ);
+ return computeBin(localStepPos.z(), _gridSizeZ);
}
bool NonprojectiveCylinderSegmentation::isValidSolid(G4VSolid* s)
lcdd/src/lcdd/detectors
diff -u -r1.2 -r1.3
--- ProjectiveSegmentation.cc 2 Jul 2013 22:57:43 -0000 1.2
+++ ProjectiveSegmentation.cc 3 Jul 2013 20:03:49 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveSegmentation.cc,v 1.2 2013/07/02 22:57:43 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveSegmentation.cc,v 1.3 2013/07/03 20:03:49 jeremy Exp $
// LCDD
#include "lcdd/detectors/ProjectiveSegmentation.hh"
@@ -12,7 +12,7 @@
#include "G4Tubs.hh"
ProjectiveSegmentation::ProjectiveSegmentation(G4int ntheta, G4int nphi) :
- Segmentation(Segmentation::eProjective), m_ntheta(ntheta), m_nphi(nphi)
+ Segmentation(Segmentation::eProjective), _ntheta(ntheta), _nphi(nphi)
{
//G4cout << "G4ProjectiveSegmentation" << G4endl;
//G4cout << "ntheta, nphi: " << ntheta << ", " << nphi << G4endl;
@@ -134,24 +134,24 @@
G4int ProjectiveSegmentation::getNtheta() const
{
- return m_ntheta;
+ return _ntheta;
}
G4int ProjectiveSegmentation::getNphi() const
{
- return m_nphi;
+ return _nphi;
}
void ProjectiveSegmentation::computeDivisions()
{
- m_divTheta = (180.0 * deg) / m_ntheta;
- m_divPhi = (360.0 * deg) / m_nphi;
+ _divTheta = (180.0 * deg) / _ntheta;
+ _divPhi = (360.0 * deg) / _nphi;
}
int ProjectiveSegmentation::getThetaBin(const G4ThreeVector& globalStepPos)
{
// theta needs to be in range 0 - PI
- return Segmentation::computeBin(globalStepPos.theta(), m_divTheta / radian);
+ return Segmentation::computeBin(globalStepPos.theta(), _divTheta / radian);
}
int ProjectiveSegmentation::getPhiBin(const G4ThreeVector& globalStepPos)
@@ -170,7 +170,7 @@
// OR use X, Y for phi calc
// compute and return bin
- return Segmentation::computeBin(sphi, m_divPhi / radian);
+ return Segmentation::computeBin(sphi, _divPhi / radian);
}
// default impl. returns mag of pos
@@ -202,12 +202,12 @@
double ProjectiveSegmentation::getThetaDim(const int &thetaBin) const
{
- return Segmentation::computeDim(thetaBin, m_divTheta);
+ return Segmentation::computeDim(thetaBin, _divTheta);
}
double ProjectiveSegmentation::getPhiDim(const int &phiBin) const
{
- return Segmentation::computeDim(phiBin, m_divPhi);
+ return Segmentation::computeDim(phiBin, _divPhi);
}
double ProjectiveSegmentation::getThetaDim(const G4Step* aStep)
lcdd/src/lcdd/detectors
diff -u -r1.1 -r1.2
--- ReadoutUtil.cc 26 Jun 2013 23:51:00 -0000 1.1
+++ ReadoutUtil.cc 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ReadoutUtil.cc,v 1.1 2013/06/26 23:51:00 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ReadoutUtil.cc,v 1.2 2013/07/03 20:03:49 jeremy Exp $
// LCDD
#include "lcdd/detectors/ReadoutUtil.hh"
@@ -40,10 +40,10 @@
return aStepPoint->GetTouchableHandle()->GetVolume()->GetLogicalVolume()->GetSolid();
}
-G4TouchableHandle ReadoutUtil::getTouchableFromStep(const G4Step* aStep)
-{
- return aStep->GetPreStepPoint()->GetTouchableHandle();
-}
+//G4TouchableHandle ReadoutUtil::getTouchableFromStep(const G4Step* aStep)
+//{
+// return aStep->GetPreStepPoint()->GetTouchableHandle();
+//}
G4ThreeVector ReadoutUtil::getVolumeGlobalPosition(const G4StepPoint* aStepPoint, const G4ThreeVector& pnt)
{
lcdd/src/lcdd/detectors
diff -u -r1.1 -r1.2
--- ScorerSD.cc 1 Jul 2013 21:00:45 -0000 1.1
+++ ScorerSD.cc 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ScorerSD.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ScorerSD.cc,v 1.2 2013/07/03 20:03:49 jeremy Exp $
// LCDD
#include "lcdd/detectors/ScorerSD.hh"
@@ -6,7 +6,7 @@
#include "lcdd/hits/TrackInformation.hh"
ScorerSD::ScorerSD(G4String sdName, G4String hcName) :
- TrackerSD(sdName, hcName), m_currentTrackID(-1)
+ TrackerSD(sdName, hcName), _currentTrackID(-1)
{
}
@@ -24,11 +24,11 @@
#ifdef G4VERBOSE
if ( m_verbose > 3 ) {
- std::cout << "current trackID <" << m_currentTrackID << ">" << std::endl;
+ std::cout << "current trackID <" << _currentTrackID << ">" << std::endl;
}
#endif
- if ((m_currentTrackID == -1) || (m_currentTrackID != trackID())) {
+ if ((_currentTrackID == -1) || (_currentTrackID != trackID())) {
#ifdef G4VERBOSE
if ( m_verbose > 2 ) {
@@ -36,7 +36,7 @@
}
#endif
- m_currentTrackID = trackID();
+ _currentTrackID = trackID();
} else {
#ifdef G4VERBOSE
if ( m_verbose > 2 ) {
@@ -90,7 +90,7 @@
} else {
#ifdef G4VERBOSE
if ( m_verbose > 0 ) {
- std::cout << "Skipping hit from track <" << m_currentTrackID << ">." << std::endl;
+ std::cout << "Skipping hit from track <" << _currentTrackID << ">." << std::endl;
}
#endif
}
lcdd/src/lcdd/detectors
diff -u -r1.1 -r1.2
--- StepReadout.cc 26 Jun 2013 23:51:00 -0000 1.1
+++ StepReadout.cc 3 Jul 2013 20:03:49 -0000 1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/StepReadout.cc,v 1.1 2013/06/26 23:51:00 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/StepReadout.cc,v 1.2 2013/07/03 20:03:49 jeremy Exp $
// LCDD
#include "lcdd/detectors/StepReadout.hh"
@@ -18,7 +18,7 @@
#include "G4LogicalVolume.hh"
StepReadout::StepReadout() :
- m_step(0)
+ _step(0)
{
}
@@ -28,17 +28,17 @@
void StepReadout::setStep(G4Step* s)
{
- m_step = s;
+ _step = s;
}
G4Step* StepReadout::step() const
{
- return m_step;
+ return _step;
}
bool StepReadout::hasStep() const
{
- return (0 != m_step);
+ return (0 != _step);
}
G4StepPoint* StepReadout::pre() const
@@ -124,7 +124,7 @@
G4ThreeVector StepReadout::volumePosition(G4TouchableHandle theTouchable) const
{
- return theTouchable->GetHistory()->GetTopTransform().Inverse().TransformPoint(m_origin);
+ return theTouchable->GetHistory()->GetTopTransform().Inverse().TransformPoint(_origin);
}
G4ThreeVector StepReadout::preVolumePosition() const
CVSspam 0.2.12