Commit in lcdd on MAIN
include/G4CalorimeterHit.hh+101-871.15 -> 1.16
       /McpHitContrib.hh+65-651.5 -> 1.6
src/G4CalorimeterHit.cc+43-461.12 -> 1.13
   /G4CalorimeterSD.cc+39-381.38 -> 1.39
   /McpHitContrib.cc+39-341.3 -> 1.4
+287-270
5 modified files
add support for writing step positions for calorimeter hit contributions

lcdd/include
G4CalorimeterHit.hh 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- G4CalorimeterHit.hh	18 Dec 2006 22:49:01 -0000	1.15
+++ G4CalorimeterHit.hh	23 Aug 2011 22:40:51 -0000	1.16
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/G4CalorimeterHit.hh,v 1.15 2006/12/18 22:49:01 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/G4CalorimeterHit.hh,v 1.16 2011/08/23 22:40:51 jeremy Exp $
 #ifndef LCDD_G4CALORIMETERHIT_HH
 #define LCDD_G4CALORIMETERHIT_HH 1
 
@@ -16,113 +16,127 @@
 #include <iostream>
 
 /**
-   @class G4CalorimeterHit
-   @brief Implementation of G4VHit for calorimeter-type hits.
-   @todo  Make cal and tracker type hits derive from common base class.
-*/
-class G4CalorimeterHit : public G4VHit
+ * @class G4CalorimeterHit
+ * @brief Implementation of G4VHit for calorimeter-type hits.
+ */
+class G4CalorimeterHit: public G4VHit
 {
 
-public:
+    public:
 
-  G4CalorimeterHit();
-
-  G4CalorimeterHit(G4double edep,
-		   G4ThreeVector globalCellPos);
-
-  virtual ~G4CalorimeterHit();
-
-  G4CalorimeterHit(const G4CalorimeterHit &right);
-  const G4CalorimeterHit& operator=(const G4CalorimeterHit &right);
-  bool operator==(const G4CalorimeterHit &right);
-
-  inline void *operator new(size_t);
-  inline void operator delete(void *aHit);
+        G4CalorimeterHit();
+        G4CalorimeterHit(const G4CalorimeterHit &right);
+        G4CalorimeterHit(G4double edep, G4ThreeVector globalCellPos);
+        virtual ~G4CalorimeterHit();
+
+        const G4CalorimeterHit& operator=(const G4CalorimeterHit &right);
+        bool operator==(const G4CalorimeterHit &right);
+        inline void *operator new(size_t);
+        inline void operator delete(void *aHit);
 
 #ifdef G4VIS_USE
-  void Draw();
+        void Draw();
 #endif
 
-  void printMcpHitContribs( std::ostream& );
-  void printMcpHitContribsHeader( std::ostream& );
-
-  void Print();
-
-public:
-
-  friend std::ostream& operator<<(std::ostream &os, const G4CalorimeterHit& hit);
-
-  void setPos(const G4ThreeVector& posXYZ) { m_pos=posXYZ; }
-  void setEdep(const G4double ed) { m_edep = ed; }
-  void incrEdep(const G4double edincr) { m_edep += edincr; }
+        void printMcpHitContribs(std::ostream&);
+        void printMcpHitContribsHeader(std::ostream&);
 
-  G4ThreeVector getPos() const { return m_pos; }
-  G4double getEdep() const { return m_edep; }
+        void Print();
 
-  void addMcpHitContrib( McpHitContrib contrib)
-  {
-    m_particleList.push_back( contrib );
-  }
+    public:
 
-  const McpHitContribList& getMcpHitContribList() const
-  {
-    return m_particleList;
-  }
+        friend std::ostream& operator<<(std::ostream &os, const G4CalorimeterHit& hit);
 
-  // set value of 64 bit id
-  void setId64bit( Id64bit::ElementType id0,
-		   Id64bit::ElementType id1 )
-  {
-    m_id64.setId0( id0 );
-    m_id64.setId1( id1 );
-  }
+        void setPos(const G4ThreeVector& posXYZ)
+        {
+            m_pos = posXYZ;
+        }
+
+        void setEdep(const G4double ed)
+        {
+            m_edep = ed;
+        }
+
+        void incrEdep(const G4double edincr)
+        {
+            m_edep += edincr;
+        }
+
+        G4ThreeVector getPos() const
+        {
+            return m_pos;
+        }
+
+        G4double getEdep() const
+        {
+            return m_edep;
+        }
+
+        void addMcpHitContrib(McpHitContrib contrib)
+        {
+            m_particleList.push_back(contrib);
+        }
+
+        const McpHitContribList& getMcpHitContribList() const
+        {
+            return m_particleList;
+        }
+
+        // set value of 64 bit id
+        void setId64bit(Id64bit::ElementType id0, Id64bit::ElementType id1)
+        {
+            m_id64.setId0(id0);
+            m_id64.setId1(id1);
+        }
+
+        // get 64 bit id
+        const Id64bit& getId64bit() const
+        {
+            return m_id64;
+        }
+
+        void setEndcapFlag(bool ec = true)
+        {
+            m_endcap = ec;
+        }
+
+        bool getEndcapFlag()
+        {
+            return m_endcap;
+        }
+
+    private:
+
+        // 64-bit id.
+        Id64bit m_id64;
+
+        // Energy deposition.
+        G4double m_edep;
 
-  // get 64 bit id
-  const Id64bit& getId64bit() const
-  {
-    return m_id64;
-  }
+        // Position.
+        G4ThreeVector m_pos;
 
-  void setEndcapFlag( bool ec = true )
-  {
-    m_endcap = ec;
-  }
+        // Endcap flag.
+        bool m_endcap;
 
-  bool getEndcapFlag()
-  {
-    return m_endcap;
-  }
-
-private:
-
-  // 64-bit id ( defaults to 0/0 )
-  Id64bit m_id64;
-
-  // energy deposition
-  G4double m_edep;
-
-  // position
-  G4ThreeVector m_pos;
-
-  // endcap flag
-  bool m_endcap;
-
-  // list of contributing Mcp info
-  McpHitContribList m_particleList;
+        // List of contributions by MCParticle.
+        McpHitContribList m_particleList;
 };
 
-typedef G4THitsCollection<G4CalorimeterHit> (G4CalorimeterHitsCollection);
+typedef G4THitsCollection<G4CalorimeterHit> ( G4CalorimeterHitsCollection);
 
 extern G4Allocator<G4CalorimeterHit> G4CalorimeterHitAllocator;
 
-inline void* G4CalorimeterHit::operator new(size_t) {
-  void* aHit;
-  aHit = (void *) G4CalorimeterHitAllocator.MallocSingle();
-  return aHit;
+inline void* G4CalorimeterHit::operator new(size_t)
+{
+    void* aHit;
+    aHit = (void *) G4CalorimeterHitAllocator.MallocSingle();
+    return aHit;
 }
 
-inline void G4CalorimeterHit::operator delete(void *aHit) {
-  G4CalorimeterHitAllocator.FreeSingle((G4CalorimeterHit*) aHit);
+inline void G4CalorimeterHit::operator delete(void *aHit)
+{
+    G4CalorimeterHitAllocator.FreeSingle((G4CalorimeterHit*) aHit);
 }
 
 #endif

lcdd/include
McpHitContrib.hh 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- McpHitContrib.hh	18 Dec 2006 22:49:02 -0000	1.5
+++ McpHitContrib.hh	23 Aug 2011 22:40:51 -0000	1.6
@@ -1,9 +1,10 @@
-// $Header: /cvs/lcd/lcdd/include/McpHitContrib.hh,v 1.5 2006/12/18 22:49:02 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/McpHitContrib.hh,v 1.6 2011/08/23 22:40:51 jeremy Exp $
 #ifndef LCDD_MCPHITCONTRIB_HH
 #define LCDD_MCPHITCONTRIB_HH 1
 
 // G4
 #include "globals.hh"
+#include "G4ThreeVector.hh"
 
 // std
 #include <vector>
@@ -16,75 +17,74 @@
 class G4Step;
 
 /**
-   @class McpHitContrib
-   @brief Represents contribution of a track to a hit.
-   @note  This class more properly belongs in the SLIC
-          package, but this would created an unwanted
-          circular dependency.  It is required by the
-          ProcessHits() methods of the G4CalorimeterSD
-          and G4TrackerSD classes.
-*/
+ * @class McpHitContrib
+ * @brief Contribution of an MCParticle to a hit.
+ */
 class McpHitContrib
 {
-public:
-  friend class G4CalorimeterHit;
+    public:
+        friend class G4CalorimeterHit;
 
-public:
+    public:
 
-  // no parameters
-  McpHitContrib();
+        // no parameters
+        McpHitContrib();
 
-  // all parameters
-  McpHitContrib(G4int trackID,
-		G4double edep,
-		G4int PDGID,
-		G4double globalTime);
-
-  // parameters from step
-  McpHitContrib(const G4Step* aStep);
-
-  virtual ~McpHitContrib();
-    
-  inline G4int getTrackID() const
-  {
-    return m_trackID;
-  }
-
-  inline G4double getEdep() const
-  {
-    return m_edep;
-  }
-
-  inline void incrEdep(G4double incr) 
-  {
-    m_edep += incr;
-  }
-
-  inline G4int getPDGID() const
-  {
-    return m_PdgId;
-  }
-
-  inline G4double getGlobalTime() const
-  {
-    return m_globalTime;
-  }
-
-  inline void setMinTime(G4double new_time) 
-  {
-    if ( new_time < m_globalTime ) {
-      m_globalTime = new_time;
-    }
-  }
-
-  void printOut(std::ostream&);
-
-private:
-
-  G4int m_trackID;
-  G4double m_edep;
-  G4int m_PdgId;
-  G4double m_globalTime;      
+        // all parameters
+        McpHitContrib(G4int trackID, G4double edep, G4int PDGID, G4double globalTime);
+
+        // parameters from step
+        McpHitContrib(const G4Step* aStep);
+
+        virtual ~McpHitContrib();
+
+        inline G4int getTrackID() const
+        {
+            return m_trackID;
+        }
+
+        inline G4double getEdep() const
+        {
+            return m_edep;
+        }
+
+        inline void incrEdep(G4double incr)
+        {
+            m_edep += incr;
+        }
+
+        inline G4int getPDGID() const
+        {
+            return m_PdgId;
+        }
+
+        inline G4double getGlobalTime() const
+        {
+            return m_globalTime;
+        }
+
+        inline void setMinTime(G4double new_time)
+        {
+            if (new_time < m_globalTime)
+            {
+                m_globalTime = new_time;
+            }
+        }
+
+        inline const float* getPosition() const
+        {
+            return m_position;
+        }
+
+        void printOut(std::ostream&);
+
+    private:
+
+        G4int m_trackID;
+        G4double m_edep;
+        G4int m_PdgId;
+        G4double m_globalTime;
+        float m_position[3];
 };
 
 typedef std::vector<McpHitContrib> McpHitContribList;

lcdd/src
G4CalorimeterHit.cc 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- G4CalorimeterHit.cc	31 Mar 2006 01:09:38 -0000	1.12
+++ G4CalorimeterHit.cc	23 Aug 2011 22:40:52 -0000	1.13
@@ -1,7 +1,9 @@
-// $Header: /cvs/lcd/lcdd/src/G4CalorimeterHit.cc,v 1.12 2006/03/31 01:09:38 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4CalorimeterHit.cc,v 1.13 2011/08/23 22:40:52 jeremy Exp $
+
+// LCDD
 #include "G4CalorimeterHit.hh"
 
-// for Draw() method
+// Geant4
 #ifdef G4VIS_USE
 #include "G4VVisManager.hh"
 #include "G4VisAttributes.hh"
@@ -12,86 +14,81 @@
 
 G4Allocator<G4CalorimeterHit> G4CalorimeterHitAllocator;
 
-G4CalorimeterHit::G4CalorimeterHit()
-  : G4VHit(),
-    m_edep(0)
-{}
-
-G4CalorimeterHit::G4CalorimeterHit(G4double edep,
-				   G4ThreeVector globalCellPos)
-  : G4VHit(),
-    m_edep(edep),
-    m_pos(globalCellPos)
-{}
+G4CalorimeterHit::G4CalorimeterHit() :
+    G4VHit(), m_edep(0)
+{;}
+
+G4CalorimeterHit::G4CalorimeterHit(G4double edep, G4ThreeVector globalCellPos) :
+    G4VHit(), m_edep(edep), m_pos(globalCellPos)
+{;}
 
 G4CalorimeterHit::~G4CalorimeterHit()
-{}
+{;}
 
-G4CalorimeterHit::G4CalorimeterHit(const G4CalorimeterHit &right) : G4VHit()
+G4CalorimeterHit::G4CalorimeterHit(const G4CalorimeterHit &right) :
+    G4VHit()
 {
-  m_edep = right.m_edep;
-  m_pos  = right.m_pos;
+    m_edep = right.m_edep;
+    m_pos = right.m_pos;
 }
 
 const G4CalorimeterHit& G4CalorimeterHit::operator=(const G4CalorimeterHit &right)
 {
-  m_edep = right.m_edep;
-  m_pos  = right.m_pos;
+    m_edep = right.m_edep;
+    m_pos = right.m_pos;
 
-  return *this;
+    return *this;
 }
 
 bool G4CalorimeterHit::operator==(const G4CalorimeterHit &right)
 {
-  return (m_pos == right.m_pos);
+    return (m_pos == right.m_pos);
 }
 
 #ifdef G4VIS_USE
 void G4CalorimeterHit::Draw()
 {
-  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
-
-  if(pVVisManager) {
-
-    G4Point3D p3D = G4Point3D( m_pos );
-    G4Circle chit(p3D);
-    chit.SetScreenDiameter(3.0);
-    chit.SetFillStyle(G4Circle::filled);
-
-    G4Colour col(1.0,0.,1.0);
+    G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
 
-    chit.SetVisAttributes(G4VisAttributes( col ) );
-    pVVisManager->Draw( chit );
-  }
+    if(pVVisManager)
+    {
+        G4Point3D p3D = G4Point3D( m_pos );
+        G4Circle chit(p3D);
+        chit.SetScreenDiameter(3.0);
+        chit.SetFillStyle(G4Circle::filled);
+
+        G4Colour col(1.0,0.,1.0);
+
+        chit.SetVisAttributes(G4VisAttributes( col ) );
+        pVVisManager->Draw( chit );
+    }
 }
 #endif
 
 void G4CalorimeterHit::printMcpHitContribs(std::ostream& os)
 {
-  printMcpHitContribsHeader( os );
+    printMcpHitContribsHeader(os);
 
-  for (McpHitContribList::iterator iter =
-	 m_particleList.begin();
-       iter != m_particleList.end();
-       iter++ ) {
-    (*iter).printOut( os );
-  }
+    for (McpHitContribList::iterator iter = m_particleList.begin(); iter != m_particleList.end(); iter++)
+    {
+        (*iter).printOut(os);
+    }
 }
 
 void G4CalorimeterHit::printMcpHitContribsHeader(std::ostream& os)
 {
-  os << "McpHitContribs" << std::endl;
-  os << "trackID" << '\t' << "edep" << '\t' << '\t' << "PdgId" << '\t' << "time" << std::endl;
+    os << "McpHitContribs" << std::endl;
+    os << "trackID" << '\t' << "edep" << '\t' << '\t' << "PdgId" << '\t' << "time" << std::endl;
 }
 
 void G4CalorimeterHit::Print()
 {
-  std::cout << *this << std::endl;
+    std::cout << *this << std::endl;
 }
 
 std::ostream& operator<<(std::ostream &os, const G4CalorimeterHit& hit)
 {
-  os << hit.getPos() << " " << G4BestUnit(hit.getEdep(), "Energy") << std::endl;
-  return os;
+    os << hit.getPos() << " " << G4BestUnit(hit.getEdep(), "Energy") << std::endl;
+    return os;
 }
 

lcdd/src
G4CalorimeterSD.cc 1.38 -> 1.39
diff -u -r1.38 -r1.39
--- G4CalorimeterSD.cc	7 Dec 2010 00:52:00 -0000	1.38
+++ G4CalorimeterSD.cc	23 Aug 2011 22:40:52 -0000	1.39
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4CalorimeterSD.cc,v 1.38 2010/12/07 00:52:00 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4CalorimeterSD.cc,v 1.39 2011/08/23 22:40:52 jeremy Exp $
 #include "G4CalorimeterSD.hh"
 
 // lcdd
@@ -35,7 +35,7 @@
     m_hits.clear();
     hits_vector.clear();
     hits_vector.push_back(m_hits);
-    if ( compare == 0 ) 
+    if (compare == 0) 
         m_hitCompare = new PositionComparator();
     else 
         m_hitCompare = compare;
@@ -44,7 +44,7 @@
 G4CalorimeterSD::G4CalorimeterSD(G4String sdName,
                                  const vector<G4String>& hcNames,
                                  G4Segmentation* sdSeg,
-                                 HitComparator* compare )
+                                 HitComparator* compare)
     : G4SensitiveDetector(sdName,
                           hcNames,
                           G4SensitiveDetector::eCalorimeter),
@@ -60,10 +60,12 @@
         m_hitsCollections.push_back(m_collection);
     }
   
-    if ( compare == 0 ) {
+    if (compare == 0)
+    {
         m_hitCompare = new PositionComparator();
     }
-    else {
+    else 
+    {
         m_hitCompare = compare;
     }
 }
@@ -76,9 +78,9 @@
 {
     bool valid = G4SensitiveDetector::isValidVolume(lv);
   
-    if ( valid && m_segmentation != 0 )
+    if (valid && m_segmentation != 0)
     {
-        valid = m_segmentation->isValidSolid( lv->GetSolid() );
+        valid = m_segmentation->isValidSolid(lv->GetSolid());
     }
   
     return valid;
@@ -89,17 +91,18 @@
     clearHits();
 
     // new cal hits collection
-    for(int i= 0; i < getNumberOfHitsCollections(); i++) 
+    for(int i=0; i<getNumberOfHitsCollections(); i++)
     {
-        m_hitsCollections[i] = new G4CalorimeterHitsCollection( GetName(), collectionName[i] );
+        m_hitsCollections[i] = new G4CalorimeterHitsCollection(GetName(), collectionName[i]);
 
         // set HCID
-        if ( getHCID(i) < 0) {
-            setHCID( GetCollectionID(i), i );
+        if (getHCID(i) < 0) 
+        {
+            setHCID(GetCollectionID(i), i);
         }
         
         // add collection to HC of event
-        HCE->AddHitsCollection( getHCID(i), m_hitsCollections[i] );
+        HCE->AddHitsCollection(getHCID(i), m_hitsCollections[i]);
     }
 }
 
@@ -111,11 +114,12 @@
 G4bool G4CalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) 
 {
 #ifdef G4VERBOSE
-    if ( getVerbose() > 0 ) {
+    if (getVerbose() > 0)
+    {
         std::cout << "G4CalorimeterSD::ProcessHits - " << this->GetName() << std::endl;
     }
 #endif
-    
+
     // set cached step
     G4SensitiveDetector::ProcessHits(aStep, 0);
     
@@ -123,26 +127,27 @@
     G4double theEdep = edep();
     
     // This needs to be a <= comparison for cutting on 0,
-    // but it allows geantinos, which always have 0 edep.
-    if ( theEdep <= getEcut() && !isGeantino() ) {
+    // Geantinos, which always have 0 edep, are allowed.
+    if (theEdep <= getEcut() && !isGeantino()) 
+    {
 #ifdef G4VERBOSE
-        if ( getVerbose() > 2 ) {
+        if (getVerbose() > 2) {
             std::cout << "G4CalorimeterSD::ProcessHits - cut on edep " << theEdep << std::endl;
         }
 #endif
         return false;
     }
     
-    // get global cell pos from seg
-    G4ThreeVector globalCellPos = m_segmentation->getGlobalHitPos( aStep );
+    // Get global cell pos from segmentation.
+    G4ThreeVector globalCellPos = m_segmentation->getGlobalHitPos(aStep);
     
-    // reset the seg bins
+    // Reset the segmentation bin values.
     m_segmentation->resetBins();
     
-    // set the seg bins
-    m_segmentation->setBins( aStep );
+    // Set the segmentation bin values from the step.
+    m_segmentation->setBins(aStep);
     
-    // create id and pack into 64
+    // Create a 64-bit ID.
     Id64bit id64 = makeId();
     
     // DEBUG: Compute step midpoint and compare to the cell pos
@@ -156,14 +161,16 @@
     
     // find hit by simple lkp of new hit with above info
     G4CalorimeterHit* thisHit = new G4CalorimeterHit(theEdep, globalCellPos);
-    thisHit->setId64bit( id64.getId0(), id64.getId1() );
+    thisHit->setId64bit(id64.getId0(), id64.getId1());
     G4CalorimeterHit* fndHit  = 0;
     
     // hit is not found?
-    if ( !( fndHit = findHit( thisHit ) ) ) {
+    if (!( fndHit = findHit(thisHit))) 
+    {
         
 #ifdef G4VERBOSE
-        if ( getVerbose() > 1 ) {
+        if (getVerbose() > 1)
+        {
             std::cout << "G4CalorimeterSD::ProcessHits - new hit" << std::endl;
         }
 #endif
@@ -171,7 +178,6 @@
         hits_vector[0].push_back(thisHit);
         
         // add to the HC
-        // add to the HC
         m_hitsCollections[0]->insert(thisHit);
     }
     // found a hit
@@ -195,7 +201,7 @@
     }
     
     // add McpHitContrib to this hit, setting info from step info
-    thisHit->addMcpHitContrib( McpHitContrib( aStep ) );
+    thisHit->addMcpHitContrib(McpHitContrib(aStep));
     
     return true;
 }
@@ -253,20 +259,15 @@
 
 std::ostream& G4CalorimeterSD::printBasicInfo(std::ostream& os) 
 {
-    G4SensitiveDetector::printBasicInfo( os );
-    
-    os << "segmentation type: " << m_segmentation->getTypeString() << std::endl;
-    
-    os << "segmentation bins:";
-    
+    G4SensitiveDetector::printBasicInfo( os );    
+    os << "segmentation type: " << m_segmentation->getTypeString() << std::endl;    
+    os << "segmentation bins:";    
     for ( std::vector<std::string>::const_iterator it = m_segmentation->getBinNames().begin();
           it != m_segmentation->getBinNames().end();
           it++ ) {
         os << " " << *it;
-    }
-    
-    os << std::endl;
-    
+    }    
+    os << std::endl;    
     return os;
 }
 

lcdd/src
McpHitContrib.cc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- McpHitContrib.cc	15 Jul 2007 23:38:07 -0000	1.3
+++ McpHitContrib.cc	23 Aug 2011 22:40:52 -0000	1.4
@@ -1,56 +1,61 @@
-// $Header: /cvs/lcd/lcdd/src/McpHitContrib.cc,v 1.3 2007/07/15 23:38:07 wenzel Exp $
+// $Header: /cvs/lcd/lcdd/src/McpHitContrib.cc,v 1.4 2011/08/23 22:40:52 jeremy Exp $
 
 #include "McpHitContrib.hh"
 #include "TrackInformation.hh"
 
+// Geant4
 #include "G4Track.hh"
 #include "G4Step.hh"
 #include "G4ParticleDefinition.hh"
 #include "G4ParticleTypes.hh"
-McpHitContrib::McpHitContrib()
-  : m_trackID(-1),
-    m_edep(0),
-    m_PdgId(9999999),
-    m_globalTime(0)
-{}
-
-McpHitContrib::McpHitContrib(G4int trackID,
-			     G4double edep,
-			     G4int PDGID,
-			     G4double globalTime)
-  : m_trackID(trackID),
-    m_edep(edep),
-    m_PdgId(PDGID),
-    m_globalTime(globalTime)
-{}
+
+McpHitContrib::McpHitContrib() :
+    m_trackID(-1), m_edep(0), m_PdgId(9999999), m_globalTime(0)
+{;}
+
+McpHitContrib::McpHitContrib(G4int trackID, G4double edep, G4int PDGID, G4double globalTime) :
+    m_trackID(trackID), m_edep(edep), m_PdgId(PDGID), m_globalTime(globalTime)
+{;}
 
 McpHitContrib::~McpHitContrib()
-{}
+{;}
 
 McpHitContrib::McpHitContrib(const G4Step* aStep)
 {
-  // get track
-  const G4Track* aTrack = aStep->GetTrack();
+    // Get the track.
+    const G4Track* aTrack = aStep->GetTrack();
+
+    // Get the track information.
+    TrackInformation* trkInfo = static_cast<TrackInformation*> (aTrack->GetUserInformation());
 
-  // get track information
-  TrackInformation* trkInfo = 
-    static_cast<TrackInformation*> ( aTrack->GetUserInformation() );
-
-  // setup this contrib using step, track and track info
-  m_trackID = trkInfo->getOriginalTrackID();
-  if(aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
+    // Get the track ID.
+    m_trackID = trkInfo->getOriginalTrackID();
+
+    // Set edep according to type of track.
+    if (aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
     {
-      m_edep = aTrack->GetTotalEnergy();
-	 }
-  else
+        m_edep = aTrack->GetTotalEnergy();
+    }
+    else
     {
-      m_edep = aStep->GetTotalEnergyDeposit();
+        m_edep = aStep->GetTotalEnergyDeposit();
     }
-  m_PdgId = aTrack->GetDefinition()->GetPDGEncoding();
-  m_globalTime = aTrack->GetGlobalTime();      
+
+    // PDG ID.
+    m_PdgId = aTrack->GetDefinition()->GetPDGEncoding();
+
+    // Global time.
+    m_globalTime = aTrack->GetGlobalTime();
+
+    // Compute the step midpoint.
+    G4ThreeVector posVec = (0.5 * (aStep->GetPreStepPoint()->GetPosition()
+            + aStep->GetPostStepPoint()->GetPosition()));
+    m_position[0] = posVec[0];
+    m_position[1] = posVec[1];
+    m_position[2] = posVec[2];
 }
 
 void McpHitContrib::printOut(std::ostream& os)
 {
-  os << m_trackID << '\t' << m_edep << '\t' << m_PdgId << '\t' << m_globalTime << std::endl;
+    os << m_trackID << '\t' << m_edep << '\t' << m_PdgId << '\t' << m_globalTime << std::endl;
 }
CVSspam 0.2.8