Commit in lcdd on MAIN
include/lcdd/bfield/Cartesian3DMagneticFieldMap.hh+33-21.5 -> 1.6
                   /Dipole.hh+58-21.3 -> 1.4
include/lcdd/detectors/CalorimeterHitProcessor.hh+17-31.4 -> 1.5
                      /CalorimeterSD.hh+8-21.2 -> 1.3
                      /CellReadout2D.hh+24-61.3 -> 1.4
                      /CellReadout2DSegmentation.hh+37-81.3 -> 1.4
                      /Cerenkov.hh+22-21.3 -> 1.4
                      /GlobalGridXYSegmentation.hh+72-161.1 -> 1.2
                      /GridXYZSegmentation.hh+73-171.1 -> 1.2
                      /HitComparator.hh+14-31.3 -> 1.4
                      /NonprojectiveCylinderSegmentation.hh+51-81.1 -> 1.2
                      /OpticalCalorimeterSD.hh+27-11.1 -> 1.2
                      /PositionComparator.hh+13-31.3 -> 1.4
                      /ProjectiveCylinderSegmentation.hh+44-71.1 -> 1.2
                      /ProjectiveSegmentation.hh+25-81.1 -> 1.2
                      /ProjectiveZPlaneSegmentation.hh+3-31.1 -> 1.2
                      /Segmentation.hh+49-441.2 -> 1.3
src/lcdd/detectors/OpticalCalorimeterSD.cc+134added 1.1
                  /GlobalGridXYSegmentation.cc+6-61.1 -> 1.2
                  /GridXYZSegmentation.cc+16-141.1 -> 1.2
                  /ProjectiveCylinderSegmentation.cc+7-11.1 -> 1.2
                  /ProjectiveSegmentation.cc+28-211.1 -> 1.2
                  /ProjectiveZPlaneSegmentation.cc+5-11.1 -> 1.2
                  /Segmentation.cc+13-81.1 -> 1.2
                  /OpticalCalorimeter.cc-1161.1 removed
+779-302
1 added + 1 removed + 23 modified, total 25 files
move a method from Segmentation interface to OptCal (work in progress); comment out unused Segmentation methods dealing with G4PreStepPoints; add more doxygen comments

lcdd/include/lcdd/bfield
Cartesian3DMagneticFieldMap.hh 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- Cartesian3DMagneticFieldMap.hh	2 Jul 2013 21:19:43 -0000	1.5
+++ Cartesian3DMagneticFieldMap.hh	2 Jul 2013 22:57:42 -0000	1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/bfield/Cartesian3DMagneticFieldMap.hh,v 1.5 2013/07/02 21:19:43 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/bfield/Cartesian3DMagneticFieldMap.hh,v 1.6 2013/07/02 22:57:42 jeremy Exp $
 
 #ifndef LCDD_BFIELD_CARTESIAN3DMAGNETICFIELDMAP_HH
 #define LCDD_BFIELD_CARTESIAN3DMAGNETICFIELDMAP_HH 1
@@ -13,7 +13,38 @@
 /**
  * A 3D B-field map defined as a grid of points with associated B-field values.  Values are
  * interpolated to obtain B-field information at points in between.
- * @note Original PurgMagTabulatedField3D code developed by: S.Larsson and J. Generowicz.
+ *
+ * The header format of the input data file is as follows:
+ *
+ * 1) Blank line
+ *
+ * 2) int int int
+ *
+ * Number of X, Y, and Z grid points (N_x, N_y, N_z)
+ *
+ * 3-8) int String
+ *
+ * A description of fields in the lines of the map.  In our case it is literally:
+ *
+ * 1 X
+ * 2 Y
+ * 3 Z
+ * 4 BX
+ * 5 BY
+ * 6 BZ
+ *
+ * 9) int String
+ *
+ * Header terminator
+ *
+ * 10+) float float float float float float
+ *
+ * N_x*N_y*N_z+9
+ *
+ * x y z B_x B_y B_z
+ *
+ * Original PurgMagTabulatedField3D code developed by: S.Larsson and J. Generowicz.
+ *
  * @author Norman Graf
  */
 class Cartesian3DMagneticFieldMap: public G4MagneticField

lcdd/include/lcdd/bfield
Dipole.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- Dipole.hh	2 Jul 2013 21:19:43 -0000	1.3
+++ Dipole.hh	2 Jul 2013 22:57:42 -0000	1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/bfield/Dipole.hh,v 1.3 2013/07/02 21:19:43 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/bfield/Dipole.hh,v 1.4 2013/07/02 22:57:42 jeremy Exp $
 
 #ifndef LCDD_BFIELD_DIPOLE_HH
 #define LCDD_BFIELD_DIPOLE_HH 1
@@ -10,7 +10,8 @@
 #include <vector>
 
 /**
- * An implementation of a simple parameterized dipole as a G4MagneticField.
+ * The Geant4 implementation of parameterized dipole field that has one or more numerical cofficients.
+ * @todo This class's algorithm for computing B-field components from coefficients needs to be documented.
  */
 class Dipole: public G4MagneticField
 {
@@ -33,30 +34,85 @@
 
 public:
 
+    /**
+     * Compute the field value at a point.
+     * @param[in] Point  The global position.
+     * @param[in] Bfield The computed B-field data.
+     */
     void GetFieldValue(const double Point[3], double *Bfield) const;
 
+    /**
+     * Set the max Z.
+     * @param[in] The max Z.
+     */
     void setZMax(double zmax);
 
+    /**
+     * Get the max Z.
+     * @return The max Z.
+     */
     double getZMax();
 
+    /**
+     * Set the max R.
+     * @param[in] rmax The max R.
+     */
     void setRMax(double rmax);
 
+    /**
+     * Get the max R.
+     * @return The max R.
+     */
     double getRMax();
 
+    /**
+     * Set the Z min.
+     * @param[in] zmin The min Z.
+     */
     void setZMin(double zmin);
 
+    /**
+     * Get the Z min.
+     * @return The Z min.
+     */
     double getZMin();
 
+    /**
+     * Add a dipole coefficient.
+     * @param[in] coeff The numerical coefficient.
+     */
     void addCoeff(double coeff);
 
+    /**
+     * Get the list of coefficients.
+     * @return The list of dipole coefficients.
+     */
     const std::vector<double>& getCoeffs();
 
+    /**
+     * Set the field unit in CLHEP system of units.
+     * Default is Tesla.
+     * @param[in] unit The field unit.
+     */
     void setFieldUnit(double unit);
 
+    /**
+     * Get the field unit.
+     * @return The field unit.
+     */
     double getFieldUnit();
 
+    /**
+     * Set the length unit in CLHEP system of units.
+     * Default is mm.
+     * @param[in] unit The length unit.
+     */
     void setLengthUnit(double unit);
 
+    /**
+     * Get the length unit.
+     * @return The length unit.
+     */
     double getLengthUnit();
 
 private:

lcdd/include/lcdd/detectors
CalorimeterHitProcessor.hh 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- CalorimeterHitProcessor.hh	2 Jul 2013 01:46:54 -0000	1.4
+++ CalorimeterHitProcessor.hh	2 Jul 2013 22:57:42 -0000	1.5
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/CalorimeterHitProcessor.hh,v 1.4 2013/07/02 01:46:54 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/CalorimeterHitProcessor.hh,v 1.5 2013/07/02 22:57:42 jeremy Exp $
 
 #ifndef LCDD_DETECTORS_CALORIMETERHITPROCESSOR_HH
 #define LCDD_DETECTORS_CALORIMETERHITPROCESSOR_HH 1
@@ -17,11 +17,25 @@
 {
 
 public:
-    CalorimeterHitProcessor(CellReadout*);
+
+	/**
+	 * Class constructor.
+	 * @param[in] ro The CellReadout used by the processor.
+	 */
+    CalorimeterHitProcessor(CellReadout* ro);
+
+    /**
+     * Class destructor.
+     */
     virtual ~CalorimeterHitProcessor();
 
 public:
-    bool processHits(G4Step*);
+
+    /**
+     * Process the step to make hits.
+     * @param[in] The G4Step object of the energy deposition.
+     */
+    bool processHits(G4Step* aStep);
 
 private:
     CellReadout* m_readout;

lcdd/include/lcdd/detectors
CalorimeterSD.hh 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- CalorimeterSD.hh	2 Jul 2013 01:46:54 -0000	1.2
+++ CalorimeterSD.hh	2 Jul 2013 22:57:42 -0000	1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/CalorimeterSD.hh,v 1.2 2013/07/02 01:46:54 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/CalorimeterSD.hh,v 1.3 2013/07/02 22:57:42 jeremy Exp $
 
 #ifndef LCDD_DETECTORS_CALORIMETERSD_HH
 #define LCDD_DETECTORS_CALORIMETERSD_HH 1
@@ -136,7 +136,13 @@
     CalorimeterHitList getCalorimeterHitList(G4int nHC);
 
 protected:
-    virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+
+    /**
+     * Process step to make hits.
+     * @param[in] step      The G4Step of the energy deposition.
+     * @param[in] touchable The touchable handle to the geometry.
+     */
+    virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* touchable);
 
 protected:
     Segmentation* m_segmentation;

lcdd/include/lcdd/detectors
CellReadout2D.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- CellReadout2D.hh	1 Jul 2013 22:10:34 -0000	1.3
+++ CellReadout2D.hh	2 Jul 2013 22:57:42 -0000	1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/CellReadout2D.hh,v 1.3 2013/07/01 22:10:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/CellReadout2D.hh,v 1.4 2013/07/02 22:57:42 jeremy Exp $
 
 #ifndef LCDD_DETECTORS_CELLREADOUT2D_HH
 #define LCDD_DETECTORS_CELLREADOUT2D_HH 1
@@ -37,18 +37,21 @@
 
     /**
      * Get the position of the cell.
+     * @param[in] id The CellId.
      */
-    Position2D position(CellId);
+    Position2D position(CellId id);
 
     /**
      * Compute cell ID from local position.
+     * @param[in] pos The 2D position.
      */
-    CellId cellId(Position2D);
+    CellId cellId(Position2D pos);
 
     /**
      * Create a list of neighbor cells from a cell ID.
+     * @param[in] id The CellId.
      */
-    Neighbors neighbors(CellId);
+    Neighbors neighbors(CellId id);
 
     /**
      * ----------------------------------------------------------
@@ -56,47 +59,62 @@
 
     /**
      * Get the X cell size.
+     * @return The cell size X.
      */
     double getCellSizeX();
 
     /**
      * Get the Y cell size.
+     * @return The cell size Y.
      */
     double getCellSizeY();
 
     /**
      * Get the X index from a position.
+     * @param[in] x The X coordinate.
+     * @return The X bin value.
      */
     int getXIndex(double x);
 
     /**
      * Get the Y index from a position.
+     * @param[in] y The Y coordinate.
+     * @return The Y bin value.
      */
     int getYIndex(double y);
 
     /*
      * Get the X position from a cell index.
+     * @param[in] ix The X index.
+     * @return The X coordinate.
      */
     double getCellPositionX(int ix);
 
     /**
      * Get the Y position from a Y bin value.
+     * @param[in] iy The Y index.
+     * @return The Y coordinate.
      */
     double getCellPositionY(int iy);
 
     /**
-     * Get a pair of indices representing a cell.
-     * This method should check that the indices are valid.
+     * Create a pair of indices representing a cell.
+     * @param[in] x The X cell index.
+     * @param[in] y The Y cell index.
      */
     CellId createCell(int x, int y);
 
     /**
      * Given an index and cell size, compute the corresponding coordinate.
+     * @param[in] u        The cell index.
+     * @param[in] cellSize The size of the cell in the corresponding dimension.
      */
     double getCellCoordinate(int u, double cellSize);
 
     /**
      * Given a coordinate and cell size, compute the corresponding cell index.
+     * @param[in] x        The coordinate value.
+     * @param[in] cellSize The size of the cell in the corresponding dimension.
      */
     int getCellIndex(double x, double cellSize);
 

lcdd/include/lcdd/detectors
CellReadout2DSegmentation.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- CellReadout2DSegmentation.hh	1 Jul 2013 22:10:34 -0000	1.3
+++ CellReadout2DSegmentation.hh	2 Jul 2013 22:57:42 -0000	1.4
@@ -11,26 +11,55 @@
 class G4Step;
 
 /**
- * @brief Adapt a CellReadout2D to the LCDD Segmentation interface.
+ * Adapt a CellReadout2D to the LCDD Segmentation interface.
  */
 class CellReadout2DSegmentation: public Segmentation
 {
 
 public:
 
+	/**
+	 * Class constructor.
+	 * @param[in] cellSizeX The cell size X.
+	 * @param[in] cellSizeY The cell size Y.
+	 */
     CellReadout2DSegmentation(double cellSizeX, double cellSizeY);
 
+    /**
+     * Class destructor.
+     */
     virtual ~CellReadout2DSegmentation();
 
-    G4ThreeVector getGlobalHitPos(const G4Step*);
-
-    void setBins(const G4Step*);
-
+    /**
+     * Get the global cell center position from a step.
+     * @param[in] The Geant4 step.
+     * @return The cell's 3D position.
+     */
+    G4ThreeVector getGlobalHitPos(const G4Step* step);
+
+    /**
+     * Compute the bin values from a Geant4 step.
+     * @param[in] The G4Step object.
+     */
+    void setBins(const G4Step* step);
+
+    /**
+     * Set the bin names for this Segmentation.
+     */
     void setBinNames();
 
-    void setup(const G4Step*);
-
-    CellReadout2D::Position2D localToReadoutCoordinates(G4ThreeVector&);
+    /**
+     * Setup the Segmentation from the G4Step.
+     * @param[in] The G4Step object.
+     */
+    void setup(const G4Step* step);
+
+    /**
+     * Convert local to readout coordinates.
+     * @param[in] pos The local position.
+     * @return The readout coordinates.
+     */
+    CellReadout2D::Position2D localToReadoutCoordinates(G4ThreeVector& pos);
 
 private:
 

lcdd/include/lcdd/detectors
Cerenkov.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- Cerenkov.hh	1 Jul 2013 22:10:34 -0000	1.3
+++ Cerenkov.hh	2 Jul 2013 22:57:42 -0000	1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/Cerenkov.hh,v 1.3 2013/07/01 22:10:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/Cerenkov.hh,v 1.4 2013/07/02 22:57:42 jeremy Exp $
 
 /* ------------------------------------------------------------------------
  |\___/|       
@@ -34,10 +34,30 @@
 class Cerenkov
 {
 public:
+
+	/**
+	 * Class constructor.
+	 */
     Cerenkov();
+
+    /**
+     * Class destructor.
+     */
     ~Cerenkov();
+
+    /**
+     * Initialize the Cerenkov data.
+     */
     void Initialize();
-    G4double GetAverageNumberOfPhotons(const G4double, const G4double, const G4String) const;
+
+    /**
+     * Compute average number of photons.
+     * @param[in] charge   The particle PDG charge value.
+     * @param[in] beta     Velocity of the track in unit of c (light velocity).
+     * @param[in] material The name of the G4Material.
+     */
+    G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4String material) const;
+
 private:
     std::vector<G4String> CAI;
     std::vector<G4PhysicsOrderedFreeVector*> CerenkovAngleIntegrals;

lcdd/include/lcdd/detectors
GlobalGridXYSegmentation.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- GlobalGridXYSegmentation.hh	1 Jul 2013 21:00:41 -0000	1.1
+++ GlobalGridXYSegmentation.hh	2 Jul 2013 22:57:42 -0000	1.2
@@ -1,4 +1,5 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GlobalGridXYSegmentation.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GlobalGridXYSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
+
 #ifndef LCDD_DETECTORS_GLOBALGRIDXYSEGMENTATION_HH
 #define LCDD_DETECTORS_GLOBALGRIDXYSEGMENTATION_HH 1
 
@@ -9,51 +10,106 @@
 #include "globals.hh"
 
 /**
- * @brief Uniform 3D grid segmentation class.
- * @note  Version of grid segmentation with binning on global coordinates, not local.
+ * An XY grid Segmentation in global coordinates.
+ * @note This is a version of grid segmentation with binning on global coordinates.
  */
 class GlobalGridXYSegmentation: public Segmentation
 {
 
 public:
 
+	/**
+	 * Class constructor.
+	 * @param[in] gridSizeX The grid size X.
+	 * @param[in] gridSizeY The grid size Y.
+	 */
     GlobalGridXYSegmentation(double gridSizeX, double gridSizeY);
 
+    /**
+     * Class destructor.
+     */
     virtual ~GlobalGridXYSegmentation();
 
 public:
 
-    // from par class
-    virtual G4ThreeVector getGlobalHitPos(const G4Step* aStep);
-
-    // hit position from step position
+    /**
+     * Compute a global hit position from a G4Step.
+     * @param[in] The G4Step object.
+     * @return The cell global position.
+     */
+    G4ThreeVector getGlobalHitPos(const G4Step* aStep);
+
+    /**
+     * Compute a local cell position from a local step position.
+     * @param[in] localStepPos The local step position.
+     * @return The local cell position.
+     */
     G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
 
-    virtual void setBins(const G4Step* aStep);
-
-    virtual void setBinNames()
+    /**
+     * Compute the ID bin values from a step.
+     * @param[in] aStep The G4Step object.
+     */
+    void setBins(const G4Step* aStep);
+
+    /**
+     * Set the bin names for this Segmentation.
+     */
+    void setBinNames()
     {
         addBinName("x");
         addBinName("y");
     }
 
-protected:
+private:
 
-    // compute signed int bin values with base at local origin
+    /**
+     * Compute the X bin value from a local coordinate.
+     * @param[in] localStepPos The local step position.
+     * @return The X bin value.
+     */
     int computeBinX(const G4ThreeVector& localStepPos);
+
+    /**
+     * Compute the Y bin value from a local coordinate.
+     * @param[in] localStepPos The local step position.
+     * @return The Y bin value.
+     */
     int computeBinY(const G4ThreeVector& localStepPos);
+
+    /**
+     * Compute the z bin value from a local coordinate.
+     * @param[in] localStepPos The local step position.
+     * @return The Z bin value.
+     */
     int computeBinZ(const G4ThreeVector& localStepPos);
 
-    // individual position dim from bin 
+    /**
+     * Compute the X coordinate from a bin value.
+     * @param[in] The X bin value.
+     * @return The X coordinate value.
+     */
     double computeDimX(int bin);
+
+    /**
+     * Compute the Y coordinate from a bin value.
+     * @param[in] The Y bin value.
+     * @return The Y coordinate value.
+     */
     double computeDimY(int bin);
+
+    /**
+     * Compute the Z coordinate from a bin value.
+     * @param[in] The Z bin value.
+     * @return The Z coordinate value.
+     */
     double computeDimZ(int bin);
 
 private:
 
-    double m_gridSizeX;
-    double m_gridSizeY;
-    double m_gridSizeZ;
+    double _gridSizeX;
+    double _gridSizeY;
+    double _gridSizeZ;
 };
 
 #endif

lcdd/include/lcdd/detectors
GridXYZSegmentation.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- GridXYZSegmentation.hh	1 Jul 2013 21:00:41 -0000	1.1
+++ GridXYZSegmentation.hh	2 Jul 2013 22:57:42 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GridXYZSegmentation.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/GridXYZSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
 #ifndef LCDD_DETECTORS_G4GRIDXYZSEGMENTATION_HH
 #define LCDD_DETECTORS_G4GRIDXYZSEGMENTATION_HH 1
 
@@ -9,32 +9,56 @@
 #include "globals.hh"
 
 /**
- * @brief Uniform 3D grid segmentation class.
- * @note  This class performs calculations to divide a box-like volume into a uniform, 3D grid with square cells.
+ * A Segmentation that defines a grid in a combination of X, Y or Z coordinates.
+ * @brief This class performs calculations to divide a box-like volume into a uniform, 3D grid of cells.
  */
 class GridXYZSegmentation: public Segmentation
 {
 
 public:
 
+	/**
+	 * Class constructor.
+	 * @param[in] gridSizeX The grid size in X.
+	 * @param[in] gridSizeY The grid size in Y.
+	 * @param[in] gridSizeZ The grid size in Z.
+	 */
     GridXYZSegmentation(double gridSizeX, double gridSizeY, double gridSizeZ);
 
+    /**
+     * Class destructor.
+     */
     virtual ~GridXYZSegmentation();
 
 public:
 
-    // from par class
-    virtual G4ThreeVector getGlobalHitPos(const G4Step* aStep);
-
-    virtual void setBins(const G4Step* aStep);
-
-    // DEPRECATED
-    virtual G4ThreeVector getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint);
+    /**
+     * Compute the global hit position from a step.
+     * @param[in] aStep The G4Step object.
+     * @return The global hit position.
+     */
+    G4ThreeVector getGlobalHitPos(const G4Step* aStep);
+
+    /**
+     * Compute the bin values from a step.
+     * @param[in] aStep The G4Step object.
+     */
+    void setBins(const G4Step* aStep);
 
     // DEPRECATED
-    virtual G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
+    //G4ThreeVector getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint);
 
-    virtual void setBinNames()
+    /**
+     * 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()
     {
         addBinName("x");
         addBinName("y");
@@ -43,21 +67,53 @@
 
 protected:
 
-    // compute signed int bin values with base at local origin
+    /**
+     * Compute X bin value from a local coordinate.
+     * @param[in] localStepPos The local step position.
+     * @return The X bin value.
+     */
     int computeBinX(const G4ThreeVector& localStepPos);
+
+    /**
+     * Compute Y bin value from a local coordinate.
+     * @param[in] localStepPos The local step position.
+     * @return The Y bin value.
+     */
     int computeBinY(const G4ThreeVector& localStepPos);
+
+    /**
+     * Compute Z bin value from a local coordinate.
+     * @param[in] localStepPos The local step position.
+     * @return The Z bin value.
+     */
     int computeBinZ(const G4ThreeVector& localStepPos);
 
-    // individual position dim from bin 
+    /**
+     * Compute a cell center X coordinate from a bin value.
+     * @param[in] The bin value.
+     * @return The corresponding 1D cell coordinate value.
+     */
     double computeDimX(int bin);
+
+    /**
+     * Compute a cell center Y coordinate from a bin value.
+     * @param[in] The bin value.
+     * @return The corresponding 1D cell coordinate value.
+     */
     double computeDimY(int bin);
+
+    /**
+     * Compute a cell center Z coordinate from a bin value.
+     * @param[in] The bin value.
+     * @return The corresponding 1D cell coordinate value.
+     */
     double computeDimZ(int bin);
 
 private:
 
-    double m_gridSizeX;
-    double m_gridSizeY;
-    double m_gridSizeZ;
+    double _gridSizeX;
+    double _gridSizeY;
+    double _gridSizeZ;
 };
 
 #endif

lcdd/include/lcdd/detectors
HitComparator.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- HitComparator.hh	1 Jul 2013 22:10:34 -0000	1.3
+++ HitComparator.hh	2 Jul 2013 22:57:42 -0000	1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/HitComparator.hh,v 1.3 2013/07/01 22:10:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/HitComparator.hh,v 1.4 2013/07/02 22:57:42 jeremy Exp $
 #ifndef LCDD_DETECTORS_HITCOMPARATOR_HH
 #define LCDD_DETECTORS_HITCOMPARATOR_HH 1
 
@@ -6,17 +6,28 @@
 #include "lcdd/hits/CalorimeterHit.hh"
 
 /**
- * @brief Interface for comparing LCDD CalorimeterHit objects.
+ * This is an interface for comparing two LCDD CalorimeterHit objects.
  */
 class HitComparator
 {
+
 public:
+
+	/**
+	 * Class destructor.
+	 */
     virtual ~HitComparator()
     {
     }
 
 public:
-    virtual bool compare(const CalorimeterHit&, const CalorimeterHit&) = 0;
+
+    /**
+     * Compare two hits for equality.  The compared parameters depends on the implementation.
+     * @param[in] hit1 The first hit to compare.
+     * @param[in] hit2 The second hit to compare.
+     */
+    virtual bool compare(const CalorimeterHit& hit1, const CalorimeterHit& hit2) = 0;
 };
 
 #endif

lcdd/include/lcdd/detectors
NonprojectiveCylinderSegmentation.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- NonprojectiveCylinderSegmentation.hh	1 Jul 2013 21:00:41 -0000	1.1
+++ NonprojectiveCylinderSegmentation.hh	2 Jul 2013 22:57:42 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/NonprojectiveCylinderSegmentation.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/NonprojectiveCylinderSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
 #ifndef LCDD_DETECTORS_G4NONPROJECTIVECYLINDERSEGMENTATION
 #define LCDD_DETECTORS_G4NONPROJECTIVECYLINDERSEGMENTATION 1
 
@@ -6,36 +6,79 @@
 #include "Segmentation.hh"
 
 /**
- * @brief Segmentation using a nonprojective cylinder.
+ * A Segmentation class that implements a nonprojective cylinder.
+ * @todo This class needs much better documentation.  Much of the computational code is a black box.
  */
 class NonprojectiveCylinderSegmentation: public Segmentation
 {
+
 public:
+
+	/**
+	 * Class constructor.
+	 * @param[in] gridSizePhi The grid size in phi (radians).
+	 * @param[in] gridSizeZ   The grid size in Z (mm).
+	 */
     NonprojectiveCylinderSegmentation(double gridSizePhi, double gridSizeZ);
+
+    /**
+     * Class destructor.
+     */
     virtual ~NonprojectiveCylinderSegmentation();
 
 public:
 
-    virtual G4ThreeVector getGlobalHitPos(const G4Step* aStep);
-    virtual G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
-    virtual void setBins(const G4Step* aStep);
-    virtual void setBins(const G4StepPoint* aPreStepPoint);
-    virtual void setBinNames()
+    /**
+     * Compute the global hit position from a step.
+     * @param[in] aStep The G4Step object.
+     * @return The global hit position for the step.
+     */
+    G4ThreeVector getGlobalHitPos(const G4Step* aStep);
+
+    /**
+     * Compute the global hit position a step point.
+     * @param[in] aPreStepPoint The G4StepPoint object.
+     * @return The global hit position for the step point.
+     */
+    G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
+
+    /**
+     * Compute bin values from a step.
+     * @param[in] aStep The G4Step object.
+     */
+    void setBins(const G4Step* aStep);
+
+    /**
+     * Compute bin values from a step point.
+     * @param[in] aPreStepStep The G4StepPoint object.
+     */
+    void setBins(const G4StepPoint* aPreStepPoint);
+
+    /**
+     * Set the valid bin names for this Segmentation.
+     */
+    void setBinNames()
     {
         addBinName("phi");
         addBinName("z");
     }
 
     G4ThreeVector getLocalHitPos(const G4Step* aStep);
+
     G4ThreeVector getLocalHitPos(const G4StepPoint* aPreStepPoint);
-    virtual bool isValidSolid(G4VSolid*);
+
+    bool isValidSolid(G4VSolid*);
 
 private:
 
     double computeDeltaPhi(const G4Step* aStep);
+
     double computeDeltaPhi(const G4StepPoint* aPreStepPoint);
+
     int computeBinPhi(const G4Step* aStep);
+
     int computeBinPhi(const G4StepPoint* aPreStepPoint);
+
     int computeBinZ(const G4ThreeVector& localStepPos);
 
 private:

lcdd/include/lcdd/detectors
OpticalCalorimeterSD.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- OpticalCalorimeterSD.hh	1 Jul 2013 21:00:41 -0000	1.1
+++ OpticalCalorimeterSD.hh	2 Jul 2013 22:57:42 -0000	1.2
@@ -14,23 +14,49 @@
  */
 class OpticalCalorimeterSD: public CalorimeterSD
 {
+
 private:
     Cerenkov* CerenGenerator;
+
 public:
+
     //enum for the two Hit Collections (cerenkov and edep):
     enum HCType
     {
         eEdep = 0, eCerenkov = 1
     };
 
+    /**
+     * Class constructor.
+     */
     OpticalCalorimeterSD(G4String sdName, G4String hcName, Segmentation* sdSeg, HitComparator* compare = 0);
 
+    /**
+     * Class constructor.
+     */
     OpticalCalorimeterSD(G4String sdName, const std::vector<G4String>& hcNames, Segmentation* sdSeg, HitComparator* compare = 0);
 
+    /**
+     * Class destructor.
+     */
     virtual ~OpticalCalorimeterSD();
 
 protected:
-    virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+
+    /**
+     * Process step to make one or more hits.
+     * @param[in] step      The G4Step object.
+     * @param[in] touchable The touchable handle pointing at the current geometric volume.
+     */
+    G4bool ProcessHits(G4Step* step, G4TouchableHistory* touchable);
+
+private:
+
+    /**
+     * Compute the global hit position from the position of a G4StepPoint.
+     * @param[in] aPreStepPoint The G4StepPoint object.
+     */
+    G4ThreeVector getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint);
 };
 
 #endif

lcdd/include/lcdd/detectors
PositionComparator.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- PositionComparator.hh	1 Jul 2013 22:10:34 -0000	1.3
+++ PositionComparator.hh	2 Jul 2013 22:57:42 -0000	1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/PositionComparator.hh,v 1.3 2013/07/01 22:10:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/PositionComparator.hh,v 1.4 2013/07/02 22:57:42 jeremy Exp $
 #ifndef LCDD_DETECTORS_POSITIONCOMPARATOR_HH
 #define LCDD_DETECTORS_POSITIONCOMPARATOR_HH 1
 
@@ -6,20 +6,30 @@
 #include "HitComparator.hh"
 
 /**
- * @brief Compare the positions of two LCDD CalorimeterHit objects.
+ * An implementation of HitComparator that compares two CalorimeterHit objects for equality
+ * by using their positions.
  */
 class PositionComparator: public HitComparator
 {
 
 public:
 
+	/**
+	 * Class destructor.
+	 */
     virtual ~PositionComparator()
     {
     }
 
 public:
 
-    virtual bool compare(const CalorimeterHit& hit1, const CalorimeterHit& hit2)
+    /**
+     * Compare two hits for equality by position.
+     * @param[in] hit1 The first hit.
+     * @param[in] hit2 The second hit.
+     * @return True if positions are equal; false if not.
+     */
+    bool compare(const CalorimeterHit& hit1, const CalorimeterHit& hit2)
     {
 //     std::cout << "POS --> hit1 " << hit1.getPos() << " == hit2 " << hit2.getPos() << std::endl;
 //     if ( hit1.getPos() == hit2.getPos() ) {

lcdd/include/lcdd/detectors
ProjectiveCylinderSegmentation.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ProjectiveCylinderSegmentation.hh	1 Jul 2013 21:00:41 -0000	1.1
+++ ProjectiveCylinderSegmentation.hh	2 Jul 2013 22:57:42 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveCylinderSegmentation.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveCylinderSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
 #ifndef LCDD_DETECTORS_G4PROJECTIVECYLINDERSEGMENTATION_HH
 #define LCDD_DETECTORS_G4PROJECTIVECYLINDERSEGMENTATION_HH 1
 
@@ -9,24 +9,61 @@
 #include "globals.hh"
 
 /**
- * @brief Simulation class for projective cylinder segmentation.
+ * The Geant4 implementation of a projective cylinder Segmentation divided into theta and phi bins.
  */
 class ProjectiveCylinderSegmentation: public ProjectiveSegmentation
 {
 
 public:
+
+	/**
+	 * Class constructor.
+	 * @param[in] ntheta Number of cells in theta.
+	 * @param[in] nphi   Number of cells in phi.
+	 */
     ProjectiveCylinderSegmentation(G4int ntheta, G4int nphi);
 
+    /**
+     * Class destructor.
+     */
     virtual ~ProjectiveCylinderSegmentation();
 
-    virtual bool isValidSolid(G4VSolid* s);
+    /**
+     * Check whether a Geant4 solid is valid for this Segmentation.
+     * @param[in] s The G4VSolid object.
+     * @return True if input sold is valid for the Segmentation; false if not.
+     */
+    bool isValidSolid(G4VSolid* s);
 
 protected:
 
-    virtual double getRadius(const G4Step* aStep);
-    virtual double getZ(const G4Step* aStep);
-    virtual double getRadius(const G4StepPoint* aPreStepPoint);
-    virtual double getZ(const G4StepPoint* aPreStepPoint);
+    /**
+     * Get the radial position of the solid pointed to by the step.
+     * @param[in] aStep The G4Step object.
+     * @return The radial position of the step's cell.
+     */
+    double getRadius(const G4Step* aStep);
+
+    /**
+     * Get the Z coordinate of a cell from the step.
+     * @param[in] aStep The G4Step object.
+     * @return The Z coordinate of the step's cell.
+     */
+    double getZ(const G4Step* aStep);
+
+    /**
+     * Get the radial position of the cell pointed to by the step point.
+     * @param[in] aPreStepPoint The G4StepPoint object.
+     * @return The radial position of the step point's cell.
+     */
+    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);
 };
 
 #endif

lcdd/include/lcdd/detectors
ProjectiveSegmentation.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ProjectiveSegmentation.hh	1 Jul 2013 21:00:41 -0000	1.1
+++ ProjectiveSegmentation.hh	2 Jul 2013 22:57:42 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveSegmentation.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
 #ifndef LCDD_DETECTORS_PROJECTIVESEGMENTATION_HH
 #define LCDD_DETECTORS_PROJECTIVESEGMENTATION_HH 1
 
@@ -7,14 +7,24 @@
 #include "globals.hh"
 
 /**
- * @brief Generic projective segmentation class.
+ * The base class for projective type Segmentation classes.
+ * @todo Should this class be pure virtual or have a protected constructor?
  */
 class ProjectiveSegmentation: public Segmentation
 {
 
 public:
+
+	/**
+	 * Class constructor.
+	 * @param[in] ntheta The number of cells in theta.
+	 * @param[in] nphi   The number of cells in phi.
+	 */
     ProjectiveSegmentation(int ntheta, int nphi);
 
+    /**
+     * Class destructor.
+     */
     virtual ~ProjectiveSegmentation();
 
 public:
@@ -22,9 +32,16 @@
     // virtuals from G4Segmentation; should not be overridden
     // in subclasses
     G4ThreeVector getGlobalHitPos(const G4Step* aStep);
-    G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
+
+    //G4ThreeVector getGlobalHitPos(const G4StepPoint* aPreStepPoint);
+
     void setBins(const G4Step* aStep);
-    void setBins(const G4StepPoint* aPreStepPoint);
+
+    //void setBins(const G4StepPoint* aPreStepPoint);
+
+    /**
+     * Get the valid bin names for this Segmentation.
+     */
     virtual void setBinNames()
     {
         addBinName("theta");
@@ -47,18 +64,18 @@
     // dim from step
     double getThetaDim(const G4Step* aStep);
     // dim from prestep
-    double getThetaDim(const G4StepPoint* aPreStepPoint);
+    //double getThetaDim(const G4StepPoint* aPreStepPoint);
 
     double getPhiDim(const G4Step* aStep);
     // dim from prestep point:
-    double getPhiDim(const G4StepPoint* aPreStepPoint);
+    //double getPhiDim(const G4StepPoint* aPreStepPoint);
 
     // These should be overridden in subclasses 
     // for a specific shape or orientation.
     virtual double getRadius(const G4Step* aStep);
     virtual double getZ(const G4Step* aStep);
-    virtual double getRadius(const G4StepPoint* aPreStepPoint);
-    virtual double getZ(const G4StepPoint* aPreStepPoint);
+    //virtual double getRadius(const G4StepPoint* aPreStepPoint);
+    //virtual double getZ(const G4StepPoint* aPreStepPoint);
 private:
 
     void computeDivisions();

lcdd/include/lcdd/detectors
ProjectiveZPlaneSegmentation.hh 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ProjectiveZPlaneSegmentation.hh	1 Jul 2013 21:00:41 -0000	1.1
+++ ProjectiveZPlaneSegmentation.hh	2 Jul 2013 22:57:42 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveZPlaneSegmentation.hh,v 1.1 2013/07/01 21:00:41 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/ProjectiveZPlaneSegmentation.hh,v 1.2 2013/07/02 22:57:42 jeremy Exp $
 #ifndef LCDD_DETECTORS_PROJECTIVEZPLANESEGMENTATION_HH
 #define LCDD_DETECTORS_PROJECTIVEZPLANESEGMENTATION_HH 1
 
@@ -24,8 +24,8 @@
 
     virtual double getRadius(const G4Step* aStep);
     virtual double getZ(const G4Step* aStep);
-    virtual double getRadius(const G4StepPoint* aPreStepPoint);
-    virtual double getZ(const G4StepPoint* aPreStepPoint);
+    //virtual double getRadius(const G4StepPoint* aPreStepPoint);
+    //virtual double getZ(const G4StepPoint* aPreStepPoint);
 };
 
 #endif

lcdd/include/lcdd/detectors
Segmentation.hh 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- Segmentation.hh	2 Jul 2013 01:46:54 -0000	1.2
+++ Segmentation.hh	2 Jul 2013 22:57:42 -0000	1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/Segmentation.hh,v 1.2 2013/07/02 01:46:54 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/lcdd/detectors/Segmentation.hh,v 1.3 2013/07/02 22:57:42 jeremy Exp $
 
 #ifndef LCDD_DETECTORS_SEGMENTATION_HH
 #define LCDD_DETECTORS_SEGMENTATION_HH 1
@@ -13,7 +13,8 @@
 
 /**
  * This is the base class for calorimeter Segmentation implementations.
- * @todo Add method setVolume(G4LogicalVolume*) for setting up segmentation with current step volume.
+ * @todo Add method setVolume(G4LogicalVolume*) for setting up segmentation from the current G4Step.
+ * @todo Move code from header to source file.
  */
 class Segmentation
 {
@@ -33,7 +34,14 @@
     typedef std::vector<std::string> BinNames;
 
 public:
+
+    /**
+     * Class Constructor.
+     * @param[in] segType The type of Segmentation.
+     * @param[in] nbins   The number of bins defined by this Segmentation.
+     */
     Segmentation(EType segType, int nbins = 2);
+
     virtual ~Segmentation();
 
 public:
@@ -41,8 +49,9 @@
     /**
      * Compute the global hit position from a step using this Segmentation.
      * @param[in] aStep The Geant4 step.
+     * @return The hit's global position.
      */
-    virtual G4ThreeVector getGlobalHitPos(const G4Step* aStep);
+    virtual G4ThreeVector getGlobalHitPos(const G4Step* aStep) = 0;
 
     /**
      * Set the identifier bin values from a step.
@@ -51,62 +60,40 @@
     virtual void setBins(const G4Step* aStep) = 0;
 
     /**
-     * Add the list of valid bin names.
+     * Set the valid bin names for this Segmentation.
      * @note This should only be called once.
      */
     virtual void setBinNames() = 0;
 
-    /**
-     * Compute the bin given a coordinate in one dimension.
-     * @param[in] localDim The 1D coordinate value.
-     * @param[in] gridDim  The dimension of the readout grid.
-     * @return The value of the bin at that coordinate.
-     */
-    static int computeBin(double localDim, double gridDim)
-    {
-        return int(floor(localDim / gridDim));
-
-    }
-
-    /**
-     * Compute the coordinate of a cell center at a given a bin value.
-     * @param[in] bin  The bin value.
-     * @param[in] incr The grid size.
-     * @return The coordinate of the cell center.
-     */
-    static double computeDim(const int &bin, const double &incr)
-    {
-        return (double(bin) + .5) * incr;
-    }
-
-    /**
-     * @deprecated Only used by G4OpticalCalorimeter.
-     * @todo Move to G4OpticalCalorimeter.
+    /*
+     * Check whether the solid is valid for this segmentation.
+     * @return True if solid is valid; false if not.
      */
-    virtual G4ThreeVector getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint);
+    virtual bool isValidSolid(G4VSolid*);
 
     /**
      * @deprecated Only used by G4OpticalCalorimeter.
      * @todo Move to G4OpticalCalorimeter.
+     * @warning Dummy method only.  Specific Segmentation types must implement.
      */
     G4ThreeVector getLocalHitPos(const G4ThreeVector& localStepPos);
 
     /**
-     * Reset the current bin values to all zeros.
+     * Reset the bins values to all zero.
      */
     void resetBins();
 
     /**
-     * Get the type of the segmentation.
-     * @return The segmentation type as an enum.
+     * Get the type of this segmentation.
+     * @return The Segmentation type as an enum.
      */
     EType getType();
 
     /**
-     * Get a string for this segmentation type.
-     * @return The segmentation type as a string.
+     * Get a string for this Segmentation type.
+     * @return The Segmentation type as a string.
      */
-    inline const G4String& getTypeString()
+    const G4String& getTypeString()
     {
         static G4String typestr;
         if (m_type == eProjective) {
@@ -126,7 +113,7 @@
      * @return The bin value.
      * @todo Change this method's name to "getBinValue".
      */
-    inline int getBin(int idx)
+    int getBin(int idx)
     {
         return m_bins.at(idx);
     }
@@ -136,7 +123,7 @@
      * @param[in] idx The bin index.
      * @return The name of the bin.
      */
-    inline const std::string& getBinName(int idx)
+    const std::string& getBinName(int idx)
     {
         return m_binNames.at(idx);
     }
@@ -145,7 +132,7 @@
      * Add a bin name to the end of the list.
      * @param[in] The name of the bin.
      */
-    inline void addBinName(const std::string& binName)
+    void addBinName(const std::string& binName)
     {
         m_binNames.push_back(binName);
     }
@@ -188,6 +175,8 @@
         printOutBins(os, m_bins);
     }
 
+protected:
+
     /**
      * Print the bin values to an output stream.
      * @param[in] os   The output stream.
@@ -195,11 +184,27 @@
      */
     static void printOutBins(std::ostream& os, const std::vector<int>& bins);
 
-    /*
-     * Check whether the solid is valid for this segmentation.
-     * @return True if solid is valid; false if not.
+    /**
+     * Compute the bin given a coordinate in one dimension.
+     * @param[in] localDim The 1D coordinate value.
+     * @param[in] gridDim  The dimension of the readout grid.
+     * @return The value of the bin at that coordinate.
      */
-    virtual bool isValidSolid(G4VSolid*);
+    static int computeBin(double localDim, double gridDim)
+    {
+        return int(floor(localDim / gridDim));
+    }
+
+    /**
+     * Compute the coordinate of a cell center at a given a bin value.
+     * @param[in] bin  The bin value.
+     * @param[in] incr The grid size.
+     * @return The coordinate of the cell center.
+     */
+    static double computeDim(const int &bin, const double &incr)
+    {
+        return (double(bin) + .5) * incr;
+    }
 
 private:
 

lcdd/src/lcdd/detectors
OpticalCalorimeterSD.cc added at 1.1
diff -N OpticalCalorimeterSD.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ OpticalCalorimeterSD.cc	2 Jul 2013 22:57:43 -0000	1.1
@@ -0,0 +1,134 @@
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/OpticalCalorimeterSD.cc,v 1.1 2013/07/02 22:57:43 jeremy Exp $
+
+// LCDD
+#include "lcdd/detectors/OpticalCalorimeterSD.hh"
+#include "lcdd/detectors/ReadoutUtil.hh"
+#include "lcdd/detectors/Segmentation.hh"
+#include "lcdd/detectors/Cerenkov.hh"
+
+// Geant4
+#include "G4OpticalPhoton.hh"
+#include "G4TransportationManager.hh"
+#include "G4VProcess.hh"
+#include "G4Poisson.hh"
+
+using std::vector;
+
+/**
+ * Constructor for the case only one Hit Collection is given.
+ * In this case the only the energy deposited by aborbed Cerenkov 
+ * photons is stored. Probably this will be dropped in the 
+ * near future.
+ */
+OpticalCalorimeterSD::OpticalCalorimeterSD(G4String sdName, G4String hcName, Segmentation* sdSeg, HitComparator* compare) :
+        CalorimeterSD(sdName, hcName, sdSeg, compare)
+{
+    CerenGenerator = 0;
+}
+
+/**
+ * Constructor for multiple Hit Collections.
+ *
+ * The current implementation uses the first Hit Collection for the 
+ * Cerenkov Photons and the second Collection to store the ionization losses. 
+ * If more than 2 collections are given the additional Hit collections will 
+ * be ignored.
+ */
+OpticalCalorimeterSD::OpticalCalorimeterSD(G4String sdName, const vector<G4String>& hcNames, Segmentation* sdSeg, HitComparator* compare) :
+        CalorimeterSD(sdName, hcNames, sdSeg, compare)
+{
+    CerenGenerator = 0;
+}
+
+OpticalCalorimeterSD::~OpticalCalorimeterSD()
+{
+}
+
+G4bool OpticalCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory* tahis)
+{
+    if (!CerenGenerator)
+        CerenGenerator = new Cerenkov();
+    G4int NCerenPhotons = 0;
+    G4Track* theTrack = aStep->GetTrack();
+    const G4double charge = theTrack->GetDefinition()->GetPDGCharge();
+    G4StepPoint* pPreStepPoint = aStep->GetPreStepPoint();
+    G4StepPoint* pPostStepPoint = aStep->GetPostStepPoint();
+    G4double beta = 0.5 * (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta());
+    const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
+    G4String thematerial = touch->GetVolume()->GetLogicalVolume()->GetMaterial()->GetName();
+    G4double MeanNumberOfPhotons = CerenGenerator->GetAverageNumberOfPhotons(charge, beta, thematerial);
+    if (MeanNumberOfPhotons > 0.0) {
+        G4double step_length = aStep->GetStepLength();
+        MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
+        NCerenPhotons = (G4int) G4Poisson(MeanNumberOfPhotons);
+    } else {
+        NCerenPhotons = 0;
+    }
+
+    if (NCerenPhotons <= 0) {
+        return CalorimeterSD::ProcessHits(aStep, tahis);
+    } else {
+        SensitiveDetector::ProcessHits(aStep, 0);
+        G4ThreeVector myPoint = aStep->GetPreStepPoint()->GetPosition();
+        G4StepPoint* apreStepPoint = aStep->GetPreStepPoint();
+        G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
+        G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint);
+        if (getVerbose() > 2) {
+            G4cout << "Physical volume       = " << myVolume->GetName() << G4endl;
+            G4cout << "Point of interaction  = " << myPoint<< G4endl;
+            G4cout << "sdname " << GetName() << "  hcname " <<collectionName[0]<< G4endl;
+        }
+            // total photon energy
+            // G4double theEdep = aTrack->GetTotalEnergy();
+        G4double theEdep = double(NCerenPhotons);
+        // get global cell pos from seg
+        G4ThreeVector globalCellPos = getGlobalHitPosPreStep(apreStepPoint);
+        // reset the seg bins
+        m_segmentation->resetBins();
+        // set the seg bins
+        m_segmentation->setBins(aStep);
+        // create id and pack into 64
+        Id64bit id64 = makeId();
+        // find hit by simple lkp of new hit with above info
+        CalorimeterHit* thisHit = new CalorimeterHit(theEdep, globalCellPos);
+        thisHit->setId64bit(id64.getId0(), id64.getId1());
+        CalorimeterHit* fndHit = 0;
+        // hit is not found?
+        if (!(fndHit = findHit(thisHit, eCerenkov))) {
+            // add it to lkp map    
+            hits_vector[eCerenkov].push_back(thisHit);
+            // add to the HC
+            m_hitsCollections[eCerenkov]->insert(thisHit);
+        } else {
+            // found a hit
+            // don't need to insert thisHit, so delete it
+            delete thisHit;
+            thisHit = 0;
+            // incr total edep of the hit
+            fndHit->incrEdep(theEdep);
+            // for setting contrib
+            thisHit = fndHit;
+        }
+        // add McpHitContrib to this hit, setting info from step info
+        thisHit->addMcpHitContrib(HitContribution(aStep));
+        //        aTrack->SetTrackStatus(fStopAndKill); // don't step photon any further
+        return true;
+    }  // end Cerenkov photon treatment
+}
+
+G4ThreeVector OpticalCalorimeterSD::getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint)
+{
+    G4ThreeVector globalStepPos = aPreStepPoint->GetPosition();
+
+    // Figure out local step pos using touchable and global midpoint.
+    G4ThreeVector localStepPos = ReadoutUtil::transformGlobalToLocal(aPreStepPoint, globalStepPos);
+
+    // Compute local cell pos.
+    G4ThreeVector localCellPos = this->getSegmentation()->getLocalHitPos(localStepPos);
+
+    // Compute global cell pos.
+    G4ThreeVector globalCellPos = ReadoutUtil::transformLocalToGlobal(aPreStepPoint, localCellPos);
+
+    return globalCellPos;
+}
+

lcdd/src/lcdd/detectors
GlobalGridXYSegmentation.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- GlobalGridXYSegmentation.cc	1 Jul 2013 21:00:45 -0000	1.1
+++ GlobalGridXYSegmentation.cc	2 Jul 2013 22:57:43 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/GlobalGridXYSegmentation.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/GlobalGridXYSegmentation.cc,v 1.2 2013/07/02 22:57:43 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/GlobalGridXYSegmentation.hh"
@@ -8,7 +8,7 @@
 #include "G4NavigationHistory.hh"
 
 GlobalGridXYSegmentation::GlobalGridXYSegmentation(double gridSizeX, double gridSizeY) :
-        Segmentation(Segmentation::eNonprojective), m_gridSizeX(gridSizeX), m_gridSizeY(gridSizeY)
+        Segmentation(Segmentation::eNonprojective), _gridSizeX(gridSizeX), _gridSizeY(gridSizeY)
 {
     setBinNames();
 }
@@ -52,20 +52,20 @@
 
 int GlobalGridXYSegmentation::computeBinX(const G4ThreeVector& stepPos)
 {
-    return Segmentation::computeBin(stepPos.x(), m_gridSizeX);
+    return Segmentation::computeBin(stepPos.x(), _gridSizeX);
 }
 
 int GlobalGridXYSegmentation::computeBinY(const G4ThreeVector& stepPos)
 {
-    return Segmentation::computeBin(stepPos.y(), m_gridSizeY);
+    return Segmentation::computeBin(stepPos.y(), _gridSizeY);
 }
 
 double GlobalGridXYSegmentation::computeDimX(int bin)
 {
-    return Segmentation::computeDim(bin, m_gridSizeX);
+    return Segmentation::computeDim(bin, _gridSizeX);
 }
 
 double GlobalGridXYSegmentation::computeDimY(int bin)
 {
-    return Segmentation::computeDim(bin, m_gridSizeY);
+    return Segmentation::computeDim(bin, _gridSizeY);
 }

lcdd/src/lcdd/detectors
GridXYZSegmentation.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- GridXYZSegmentation.cc	1 Jul 2013 21:00:45 -0000	1.1
+++ GridXYZSegmentation.cc	2 Jul 2013 22:57:43 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/GridXYZSegmentation.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/GridXYZSegmentation.cc,v 1.2 2013/07/02 22:57:43 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/GridXYZSegmentation.hh"
@@ -8,7 +8,7 @@
 #include "G4NavigationHistory.hh"
 
 GridXYZSegmentation::GridXYZSegmentation(double gridSizeX, double gridSizeY, double gridSizeZ) :
-        Segmentation(Segmentation::eNonprojective), m_gridSizeX(gridSizeX), m_gridSizeY(gridSizeY), m_gridSizeZ(gridSizeZ)
+        Segmentation(Segmentation::eNonprojective), _gridSizeX(gridSizeX), _gridSizeY(gridSizeY), _gridSizeZ(gridSizeZ)
 {
     setBinNames();
 }
@@ -63,8 +63,8 @@
 int GridXYZSegmentation::computeBinX(const G4ThreeVector& localStepPos)
 {
     int ret;
-    if (m_gridSizeX != 0) {
-        ret = Segmentation::computeBin(localStepPos.x(), m_gridSizeX);
+    if (_gridSizeX != 0) {
+        ret = Segmentation::computeBin(localStepPos.x(), _gridSizeX);
     } else {
         ret = 0;
     }
@@ -74,8 +74,8 @@
 int GridXYZSegmentation::computeBinY(const G4ThreeVector& localStepPos)
 {
     int ret;
-    if (m_gridSizeY != 0) {
-        ret = Segmentation::computeBin(localStepPos.y(), m_gridSizeY);
+    if (_gridSizeY != 0) {
+        ret = Segmentation::computeBin(localStepPos.y(), _gridSizeY);
     } else {
         ret = 0;
     }
@@ -85,8 +85,8 @@
 int GridXYZSegmentation::computeBinZ(const G4ThreeVector& localStepPos)
 {
     int ret;
-    if (m_gridSizeZ != 0) {
-        ret = Segmentation::computeBin(localStepPos.z(), m_gridSizeZ);
+    if (_gridSizeZ != 0) {
+        ret = Segmentation::computeBin(localStepPos.z(), _gridSizeZ);
     } else {
         ret = 0;
     }
@@ -95,19 +95,20 @@
 
 double GridXYZSegmentation::computeDimX(int bin)
 {
-    return Segmentation::computeDim(bin, m_gridSizeX);
+    return Segmentation::computeDim(bin, _gridSizeX);
 }
 
 double GridXYZSegmentation::computeDimY(int bin)
 {
-    return Segmentation::computeDim(bin, m_gridSizeY);
+    return Segmentation::computeDim(bin, _gridSizeY);
 }
 
 double GridXYZSegmentation::computeDimZ(int bin)
 {
-    return Segmentation::computeDim(bin, m_gridSizeZ);
+    return Segmentation::computeDim(bin, _gridSizeZ);
 }
 
+/*
 G4ThreeVector GridXYZSegmentation::getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint)
 {
     G4ThreeVector globalStepPos = aPreStepPoint->GetPosition();
@@ -123,20 +124,21 @@
 
     return globalCellPos;
 }
+*/
 
 G4ThreeVector GridXYZSegmentation::getLocalHitPos(const G4ThreeVector& localStepPos)
 {
     G4ThreeVector localHitPos;
 
-    if (m_gridSizeX > 0) {
+    if (_gridSizeX > 0) {
         localHitPos.setX(computeDimX(computeBinX(localStepPos)));
     }
 
-    if (m_gridSizeY > 0) {
+    if (_gridSizeY > 0) {
         localHitPos.setY(computeDimY(computeBinY(localStepPos)));
     }
 
-    if (m_gridSizeZ > 0) {
+    if (_gridSizeZ > 0) {
         localHitPos.setZ(computeDimZ(computeBinZ(localStepPos)));
     }
 

lcdd/src/lcdd/detectors
ProjectiveCylinderSegmentation.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ProjectiveCylinderSegmentation.cc	1 Jul 2013 21:00:45 -0000	1.1
+++ ProjectiveCylinderSegmentation.cc	2 Jul 2013 22:57:43 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveCylinderSegmentation.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveCylinderSegmentation.cc,v 1.2 2013/07/02 22:57:43 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/ProjectiveCylinderSegmentation.hh"
@@ -24,10 +24,14 @@
 {
     return ReadoutUtil::computeTubsMidRadius(ReadoutUtil::getTubs(aStep));
 }
+
+/*
 double ProjectiveCylinderSegmentation::getRadius(const G4StepPoint* aPreStepPoint)
 {
     return ReadoutUtil::computeTubsMidRadius(ReadoutUtil::getTubs(aPreStepPoint));
 }
+*/
+
 double ProjectiveCylinderSegmentation::getZ(const G4Step* aStep)
 {
     double rcyl = getRadius(aStep);
@@ -41,6 +45,7 @@
 
     return zcell;
 }
+/*
 double ProjectiveCylinderSegmentation::getZ(const G4StepPoint* aPreStepPoint)
 {
     double rcyl = getRadius(aPreStepPoint);
@@ -54,6 +59,7 @@
 
     return zcell;
 }
+*/
 bool ProjectiveCylinderSegmentation::isValidSolid(G4VSolid* s)
 {
     bool valid = Segmentation::isValidSolid(s);

lcdd/src/lcdd/detectors
ProjectiveSegmentation.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ProjectiveSegmentation.cc	1 Jul 2013 21:00:45 -0000	1.1
+++ ProjectiveSegmentation.cc	2 Jul 2013 22:57:43 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveSegmentation.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveSegmentation.cc,v 1.2 2013/07/02 22:57:43 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/ProjectiveSegmentation.hh"
@@ -68,6 +68,8 @@
 
     return pos;
 }
+
+/*
 G4ThreeVector ProjectiveSegmentation::getGlobalHitPos(const G4StepPoint* aPreStepPoint)
 {
     // DEBUG
@@ -110,6 +112,8 @@
 
     return pos;
 }
+*/
+
 void ProjectiveSegmentation::setBins(const G4Step* aStep)
 {
     G4ThreeVector globalMidPos = ReadoutUtil::computeMidPos(aStep);
@@ -118,6 +122,7 @@
     setBin(1, getPhiBin(globalMidPos));
 }
 
+/*
 void ProjectiveSegmentation::setBins(const G4StepPoint* aPreStepPoint)
 {
     G4ThreeVector globalPos = aPreStepPoint->GetPosition();
@@ -125,6 +130,7 @@
     setBin(0, getThetaBin(globalPos));
     setBin(1, getPhiBin(globalPos));
 }
+*/
 
 G4int ProjectiveSegmentation::getNtheta() const
 {
@@ -174,11 +180,12 @@
 
     return ReadoutUtil::computeMidPos(aStep).mag();
 }
-double ProjectiveSegmentation::getRadius(const G4StepPoint* aPreStepPoint)
-{
+
+//double ProjectiveSegmentation::getRadius(const G4StepPoint* aPreStepPoint)
+//{
     //G4cout << "G4ProjectiveSegmentation::getRadius()" << G4endl;
-    return aPreStepPoint->GetPosition().mag();
-}
+//    return aPreStepPoint->GetPosition().mag();
+//}
 
 // default impl. returns z of pos
 double ProjectiveSegmentation::getZ(const G4Step* aStep)
@@ -187,11 +194,11 @@
     return ReadoutUtil::computeMidPos(aStep).z();
 }
 
-double ProjectiveSegmentation::getZ(const G4StepPoint* aPreStepPoint)
-{
+//double ProjectiveSegmentation::getZ(const G4StepPoint* aPreStepPoint)
+//{
     //G4cout << "G4ProjectiveSegmentation::getZ()" << G4endl;
-    return aPreStepPoint->GetPosition().z();
-}
+//    return aPreStepPoint->GetPosition().z();
+//}
 
 double ProjectiveSegmentation::getThetaDim(const int &thetaBin) const
 {
@@ -211,13 +218,13 @@
     return ctheta;
 }
 
-double ProjectiveSegmentation::getThetaDim(const G4StepPoint* aPreStepPoint)
-{
+//double ProjectiveSegmentation::getThetaDim(const G4StepPoint* aPreStepPoint)
+//{
     //G4cout << "G4ProjectiveSegmentation::getThetaDim(G4Step*)" << G4endl;
-    G4ThreeVector globalStepPos = aPreStepPoint->GetPosition();
-    double ctheta = getThetaDim(getThetaBin(globalStepPos));
-    return ctheta;
-}
+//    G4ThreeVector globalStepPos = aPreStepPoint->GetPosition();
+//    double ctheta = getThetaDim(getThetaBin(globalStepPos));
+//    return ctheta;
+//}
 
 double ProjectiveSegmentation::getPhiDim(const G4Step* aStep)
 {
@@ -227,12 +234,12 @@
     double cphi = getPhiDim(getPhiBin(globalStepPos));
     return cphi;
 }
-double ProjectiveSegmentation::getPhiDim(const G4StepPoint* aPreStepPoint)
-{
+//double ProjectiveSegmentation::getPhiDim(const G4StepPoint* aPreStepPoint)
+//{
     //G4cout << "G4ProjectiveSegmentation::getPhiDim(G4Step*)" << G4endl;
 
-    G4ThreeVector globalStepPos = aPreStepPoint->GetPosition();
-    double cphi = getPhiDim(getPhiBin(globalStepPos));
-    return cphi;
-}
+//    G4ThreeVector globalStepPos = aPreStepPoint->GetPosition();
+//    double cphi = getPhiDim(getPhiBin(globalStepPos));
+//    return cphi;
+//}
 

lcdd/src/lcdd/detectors
ProjectiveZPlaneSegmentation.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ProjectiveZPlaneSegmentation.cc	1 Jul 2013 21:00:45 -0000	1.1
+++ ProjectiveZPlaneSegmentation.cc	2 Jul 2013 22:57:43 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveZPlaneSegmentation.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/ProjectiveZPlaneSegmentation.cc,v 1.2 2013/07/02 22:57:43 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/ProjectiveZPlaneSegmentation.hh"
@@ -20,6 +20,7 @@
     double rcyl = zcell * tan(ctheta);
     return rcyl;
 }
+/*
 double ProjectiveZPlaneSegmentation::getRadius(const G4StepPoint* aPreStepPoint)
 {
     double zcell = getZ(aPreStepPoint);
@@ -27,6 +28,7 @@
     double rcyl = zcell * tan(ctheta);
     return rcyl;
 }
+*/
 
 double ProjectiveZPlaneSegmentation::getZ(const G4Step* aStep)
 {
@@ -34,8 +36,10 @@
     return gpos.z();
 }
 
+/*
 double ProjectiveZPlaneSegmentation::getZ(const G4StepPoint* aPreStepPoint)
 {
     G4ThreeVector gpos = ReadoutUtil::getVolumeGlobalPosition(aPreStepPoint, G4ThreeVector());
     return gpos.z();
 }
+*/

lcdd/src/lcdd/detectors
Segmentation.cc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- Segmentation.cc	1 Jul 2013 21:00:45 -0000	1.1
+++ Segmentation.cc	2 Jul 2013 22:57:43 -0000	1.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/Segmentation.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/Segmentation.cc,v 1.2 2013/07/02 22:57:43 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/Segmentation.hh"
@@ -38,15 +38,20 @@
     return m_type;
 }
 
-G4ThreeVector Segmentation::getGlobalHitPos(const G4Step* aStep)
-{
-    return ReadoutUtil::computeMidPos(aStep);
-}
+//G4ThreeVector Segmentation::getGlobalHitPos(const G4Step* aStep)
+//{
+//    return ReadoutUtil::computeMidPos(aStep);
+//}
+
+//G4ThreeVector Segmentation::getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint)
+//{
+//    //G4Exception("Do not use this method!");
+//    return aPreStepPoint->GetPosition();
+//}
 
-G4ThreeVector Segmentation::getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint)
+G4ThreeVector Segmentation::getLocalHitPos(const G4ThreeVector& localStepPos)
 {
-    //G4Exception("Do not use this method!");
-    return aPreStepPoint->GetPosition();
+	return localStepPos;
 }
 
 void Segmentation::resetBins()

lcdd/src/lcdd/detectors
OpticalCalorimeter.cc removed after 1.1
diff -N OpticalCalorimeter.cc
--- OpticalCalorimeter.cc	1 Jul 2013 21:00:45 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,116 +0,0 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/Attic/OpticalCalorimeter.cc,v 1.1 2013/07/01 21:00:45 jeremy Exp $
-
-// LCDD
-#include "lcdd/detectors/OpticalCalorimeterSD.hh"
-#include "lcdd/detectors/Segmentation.hh"
-#include "lcdd/detectors/Cerenkov.hh"
-
-// Geant4
-#include "G4OpticalPhoton.hh"
-#include "G4TransportationManager.hh"
-#include "G4VProcess.hh"
-#include "G4Poisson.hh"
-
-using std::vector;
-
-/**
- * Constructor for the case only one Hit Collection is given.
- * In this case the only the energy deposited by aborbed Cerenkov 
- * photons is stored. Probably this will be dropped in the 
- * near future.
- */
-OpticalCalorimeterSD::OpticalCalorimeterSD(G4String sdName, G4String hcName, Segmentation* sdSeg, HitComparator* compare) :
-        CalorimeterSD(sdName, hcName, sdSeg, compare)
-{
-    CerenGenerator = 0;
-}
-
-/**
- * Constructor for multiple Hit Collections.
- *
- * The current implementation uses the first Hit Collection for the 
- * Cerenkov Photons and the second Collection to store the ionization losses. 
- * If more than 2 collections are given the additional Hit collections will 
- * be ignored.
- */
-OpticalCalorimeterSD::OpticalCalorimeterSD(G4String sdName, const vector<G4String>& hcNames, Segmentation* sdSeg, HitComparator* compare) :
-        CalorimeterSD(sdName, hcNames, sdSeg, compare)
-{
-    CerenGenerator = 0;
-}
-
-OpticalCalorimeterSD::~OpticalCalorimeterSD()
-{
-}
-
-G4bool OpticalCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory* tahis)
-{
-    if (!CerenGenerator)
-        CerenGenerator = new Cerenkov();
-    G4int NCerenPhotons = 0;
-    G4Track* theTrack = aStep->GetTrack();
-    const G4double charge = theTrack->GetDefinition()->GetPDGCharge();
-    G4StepPoint* pPreStepPoint = aStep->GetPreStepPoint();
-    G4StepPoint* pPostStepPoint = aStep->GetPostStepPoint();
-    G4double beta = 0.5 * (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta());
-    const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
-    G4String thematerial = touch->GetVolume()->GetLogicalVolume()->GetMaterial()->GetName();
-    G4double MeanNumberOfPhotons = CerenGenerator->GetAverageNumberOfPhotons(charge, beta, thematerial);
-    if (MeanNumberOfPhotons > 0.0) {
-        G4double step_length = aStep->GetStepLength();
-        MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
-        NCerenPhotons = (G4int) G4Poisson(MeanNumberOfPhotons);
-    } else {
-        NCerenPhotons = 0;
-    }
-
-    if (NCerenPhotons <= 0) {
-        return CalorimeterSD::ProcessHits(aStep, tahis);
-    } else {
-        SensitiveDetector::ProcessHits(aStep, 0);
-        G4ThreeVector myPoint = aStep->GetPreStepPoint()->GetPosition();
-        G4StepPoint* apreStepPoint = aStep->GetPreStepPoint();
-        G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
-        G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint);
-        if (getVerbose() > 2) {
-            G4cout << "Physical volume       = " << myVolume->GetName() << G4endl;
-            G4cout << "Point of interaction  = " << myPoint<< G4endl;
-            G4cout << "sdname " << GetName() << "  hcname " <<collectionName[0]<< G4endl;
-        }
-            // total photon energy
-            // G4double theEdep = aTrack->GetTotalEnergy();
-        G4double theEdep = double(NCerenPhotons);
-        // get global cell pos from seg
-        G4ThreeVector globalCellPos = m_segmentation->getGlobalHitPosPreStep(apreStepPoint);
-        // reset the seg bins
-        m_segmentation->resetBins();
-        // set the seg bins
-        m_segmentation->setBins(aStep);
-        // create id and pack into 64
-        Id64bit id64 = makeId();
-        // find hit by simple lkp of new hit with above info
-        CalorimeterHit* thisHit = new CalorimeterHit(theEdep, globalCellPos);
-        thisHit->setId64bit(id64.getId0(), id64.getId1());
-        CalorimeterHit* fndHit = 0;
-        // hit is not found?
-        if (!(fndHit = findHit(thisHit, eCerenkov))) {
-            // add it to lkp map    
-            hits_vector[eCerenkov].push_back(thisHit);
-            // add to the HC
-            m_hitsCollections[eCerenkov]->insert(thisHit);
-        } else {
-            // found a hit
-            // don't need to insert thisHit, so delete it
-            delete thisHit;
-            thisHit = 0;
-            // incr total edep of the hit
-            fndHit->incrEdep(theEdep);
-            // for setting contrib
-            thisHit = fndHit;
-        }
-        // add McpHitContrib to this hit, setting info from step info
-        thisHit->addMcpHitContrib(HitContribution(aStep));
-        //        aTrack->SetTrackStatus(fStopAndKill); // don't step photon any further
-        return true;
-    }  // end Cerenkov photon treatment 
-}
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1