10 modified files
lcdd/include
diff -u -r1.12 -r1.13
--- G4CalorimeterHit.hh 27 Sep 2005 00:12:24 -0000 1.12
+++ G4CalorimeterHit.hh 31 Mar 2006 01:09:36 -0000 1.13
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/G4CalorimeterHit.hh,v 1.12 2005/09/27 00:12:24 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/G4CalorimeterHit.hh,v 1.13 2006/03/31 01:09:36 jeremy Exp $
#ifndef G4CalorimeterHit_hh
#define G4CalorimeterHit_hh 1
@@ -11,6 +11,7 @@
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
+#include "G4UnitsTable.hh"
#include <iostream>
@@ -42,8 +43,6 @@
void Draw();
#endif
- void printOut(std::ostream&);
-
void printMcpHitContribs( std::ostream& );
void printMcpHitContribsHeader( std::ostream& );
@@ -51,6 +50,8 @@
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; }
lcdd/include
diff -u -r1.3 -r1.4
--- G4ScorerSD.hh 1 Sep 2005 18:24:36 -0000 1.3
+++ G4ScorerSD.hh 31 Mar 2006 01:09:36 -0000 1.4
@@ -10,9 +10,7 @@
class G4ScorerSD : public G4TrackerSD
{
public:
- G4ScorerSD(G4String sdName,
- G4String hcName
- );
+ G4ScorerSD(G4String sdName,G4String hcName);
protected:
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
lcdd/include
diff -u -r1.9 -r1.10
--- G4TrackerHit.hh 10 Mar 2006 07:40:34 -0000 1.9
+++ G4TrackerHit.hh 31 Mar 2006 01:09:36 -0000 1.10
@@ -7,6 +7,7 @@
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
+#include "G4UnitsTable.hh"
/**
@class G4TrackerHit
@@ -30,21 +31,23 @@
public:
- inline void setTdep(const G4double tdep) { m_tdep = tdep; }
- inline void setEdep(const G4double edep) { m_edep = edep; }
- inline void setPos(const G4ThreeVector& posXYZ) { m_pos = posXYZ; }
- inline void setMomentum(const G4ThreeVector& mom) { m_mom = mom; }
- inline void setTrackID(const G4int trkID) { m_trkID = trkID; }
- inline void setPDG(const G4int pdg) { m_PDG = pdg; }
- inline void setLength(const G4double l) { m_length = l; }
-
- inline G4double getTdep() { return m_tdep; }
- inline G4double getEdep() { return m_edep; }
- inline G4ThreeVector getPos() { return m_pos; }
- inline G4ThreeVector getMomentum() { return m_mom; }
- inline G4int getTrackID() { return m_trkID; }
- inline G4int getPDG() { return m_PDG; }
- inline G4double getLength() { return m_length; }
+ friend std::ostream& operator<<(std::ostream &os, const G4TrackerHit& hit);
+
+ void setTdep(const G4double tdep) { m_tdep = tdep; }
+ void setEdep(const G4double edep) { m_edep = edep; }
+ void setPos(const G4ThreeVector& posXYZ) { m_pos = posXYZ; }
+ void setMomentum(const G4ThreeVector& mom) { m_mom = mom; }
+ void setTrackID(const G4int trkID) { m_trkID = trkID; }
+ void setPDG(const G4int pdg) { m_PDG = pdg; }
+ void setLength(const G4double l) { m_length = l; }
+
+ G4double getTdep() const { return m_tdep; }
+ G4double getEdep() const { return m_edep; }
+ G4ThreeVector getPos() const { return m_pos; }
+ G4ThreeVector getMomentum() const { return m_mom; }
+ G4int getTrackID() const { return m_trkID; }
+ G4int getPDG() const { return m_PDG; }
+ G4double getLength() const { return m_length; }
void setId( Id64bit::ElementType id1 )
{
lcdd/include
diff -u -r1.11 -r1.12
--- G4TrackerSD.hh 10 Mar 2006 07:40:34 -0000 1.11
+++ G4TrackerSD.hh 31 Mar 2006 01:09:36 -0000 1.12
@@ -13,6 +13,10 @@
{
public:
+
+ typedef std::vector<G4TrackerHit*> G4TrackerHitList;
+
+public:
G4TrackerSD(G4String sdName,
G4String hcName);
@@ -21,6 +25,7 @@
public:
virtual void Initialize(G4HCofThisEvent *);
virtual void EndOfEvent(G4HCofThisEvent *);
+ void printHits(std::ostream&);
protected:
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
lcdd/src
diff -u -r1.11 -r1.12
--- G4CalorimeterHit.cc 4 Mar 2005 22:51:12 -0000 1.11
+++ G4CalorimeterHit.cc 31 Mar 2006 01:09:38 -0000 1.12
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4CalorimeterHit.cc,v 1.11 2005/03/04 22:51:12 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4CalorimeterHit.cc,v 1.12 2006/03/31 01:09:38 jeremy Exp $
#include "G4CalorimeterHit.hh"
// for Draw() method
@@ -59,28 +59,18 @@
chit.SetFillStyle(G4Circle::filled);
G4Colour col(1.0,0.,1.0);
-
+
chit.SetVisAttributes(G4VisAttributes( col ) );
pVVisManager->Draw( chit );
}
}
#endif
-void G4CalorimeterHit::printOut(std::ostream& os)
-{
- os << "pos " << m_pos << std::endl;
- os << "edep <" << m_edep << ">" << std::endl;
-
- printMcpHitContribs( os );
-
- os << std::endl;
-}
-
-void G4CalorimeterHit::printMcpHitContribs(std::ostream& os)
+void G4CalorimeterHit::printMcpHitContribs(std::ostream& os)
{
printMcpHitContribsHeader( os );
- for (McpHitContribList::iterator iter =
+ for (McpHitContribList::iterator iter =
m_particleList.begin();
iter != m_particleList.end();
iter++ ) {
@@ -91,12 +81,17 @@
void G4CalorimeterHit::printMcpHitContribsHeader(std::ostream& os)
{
os << "McpHitContribs" << std::endl;
- os << "trackID" << '\t' << "edep" << '\t' << '\t' << "PdgId" << '\t' << "time" << std::endl;
+ os << "trackID" << '\t' << "edep" << '\t' << '\t' << "PdgId" << '\t' << "time" << std::endl;
}
void G4CalorimeterHit::Print()
{
- printOut( G4cout );
+ 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;
+}
lcdd/src
diff -u -r1.25 -r1.26
--- G4CalorimeterSD.cc 27 Sep 2005 00:12:25 -0000 1.25
+++ G4CalorimeterSD.cc 31 Mar 2006 01:09:38 -0000 1.26
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4CalorimeterSD.cc,v 1.25 2005/09/27 00:12:25 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4CalorimeterSD.cc,v 1.26 2006/03/31 01:09:38 jeremy Exp $
#include "G4CalorimeterSD.hh"
// LCDD
@@ -62,14 +62,6 @@
// add collection to HC of event
HCE->AddHitsCollection( getHCID(), m_HC );
-
-#ifdef G4VERBOSE
- if ( getVerbose() > 1 ) {
- std::cout << "HCID <" << getHCID() << ">" << std::endl;
- std::cout << "HC ptr <" << m_HC << ">" << std::endl;
- std::cout << "HC size <" << m_HC->GetSize() << ">" << std::endl;
- }
-#endif
}
G4Segmentation* G4CalorimeterSD::getSegmentation() const
@@ -82,32 +74,14 @@
// set cached step
G4SensitiveDetector::ProcessHits(aStep, 0);
-#ifdef G4VERBOSE
- unsigned int verbose = getVerbose();
-
- if ( verbose > 1 ) {
- std::cout << "G4CalorimeterSD::ProcessHits() - " << this->GetName() << std::endl;
- }
-#endif
-
+ // get the edep
G4double theEdep = edep();
- // needs to be <= for cut on 0
+ // This needs to be a <= comparison for cutting on 0.
if ( theEdep <= getEcut() ) {
-
- if ( verbose > 1 ) {
- std::cout << "cut on edep <" << theEdep << ">" << std::endl;
- }
-
return false;
}
-#ifdef G4VERBOSE
- if ( verbose > 1 ) {
- std::cout << "cal hit: " << this->GetName() << std::endl;
- }
-#endif
-
// get global cell pos from seg
G4ThreeVector globalCellPos = m_segmentation->getGlobalHitPos( aStep );
@@ -120,7 +94,7 @@
// create id and pack into 64
Id64bit id64 = makeId();
- // compute step midpoint and compare to cell pos for debugging
+ // DEBUG: Compute step midpoint and compare to the cell pos
#ifdef G4DEBUG
#ifdef G4VERBOSE
if ( verbose > 1 ) {
@@ -139,12 +113,6 @@
// hit is not found?
if ( !( fndHit = findHit( thisHit ) ) ) {
-#ifdef G4VERBOSE
- if ( verbose > 2 ) {
- std::cout << "adding new hit" << std::endl;
- }
-#endif
-
// add it to lkp map
m_hits.push_back(thisHit);
@@ -161,12 +129,6 @@
// incr total edep of the hit
fndHit->incrEdep(theEdep);
-#ifdef G4VERBOSE
- if ( verbose > 2 ) {
- std::cout << "new edep <" << fndHit->getEdep() << ">" << std::endl;
- }
-#endif
-
// for setting contrib
thisHit = fndHit;
}
@@ -196,19 +158,19 @@
for (G4CalorimeterHitList::iterator iter = m_hits.begin();
iter != m_hits.end();
iter++ ) {
- (*iter)->printOut( os );
+ os << **iter;
}
+ os << std::endl;
}
void G4CalorimeterSD::EndOfEvent(G4HCofThisEvent *)
{
#ifdef G4VERBOSE
if ( getVerbose() > 0 ) {
- std::cout << "Calorimeter <" << GetName() << "> has nhits <"
- << m_HC->GetSize() << ">." << std::endl;
+ std::cout << GetName() << " has " << m_HC->GetSize() << " hits." << std::endl;
}
- if ( getVerbose() > 2 ) {
+ if ( getVerbose() > 1 ) {
printHits ( std::cout );
}
#endif
lcdd/src
diff -u -r1.9 -r1.10
--- G4SensitiveDetector.cc 9 Dec 2005 01:57:15 -0000 1.9
+++ G4SensitiveDetector.cc 31 Mar 2006 01:09:38 -0000 1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4SensitiveDetector.cc,v 1.9 2005/12/09 01:57:15 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4SensitiveDetector.cc,v 1.10 2006/03/31 01:09:38 jeremy Exp $
#include "G4SensitiveDetector.hh"
// LCDD
@@ -58,12 +58,6 @@
G4bool G4SensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
-#ifdef G4VERBOSE
- if ( getVerbose() > 2 ) {
- std::cout << "G4SensitiveDetector::ProcessHits - sdName <" << GetName() << ">" << std::endl;
- }
-#endif
-
// set cached step
setStep(aStep);
lcdd/src
diff -u -r1.5 -r1.6
--- G4TrackerCombineSD.cc 10 Mar 2006 07:40:34 -0000 1.5
+++ G4TrackerCombineSD.cc 31 Mar 2006 01:09:38 -0000 1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4TrackerCombineSD.cc,v 1.5 2006/03/10 07:40:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4TrackerCombineSD.cc,v 1.6 2006/03/31 01:09:38 jeremy Exp $
#include "G4TrackerCombineSD.hh"
// LCDD
@@ -55,7 +55,7 @@
}
#ifdef G4DEBUG
else {
- std::cout << "WARNING: current TrackID == -1" << std::endl;
+ std::cout << GetName() << "::WARNING : current TrackID == -1" << std::endl;
}
#endif
@@ -116,6 +116,11 @@
// total energy below cut
if ( m_edepTotal <= getEcut() ) {
+#ifdef G4VERBOSE
+ if ( m_verbose > 2 ) {
+ std::cout << GetName() << " : cut this edep " << m_edepTotal << std::endl;
+ }
+#endif
return false;
}
@@ -130,20 +135,6 @@
// compute distance from start to entry
G4double pathlength = ReadoutUtil::computeDistance(m_entryPoint, m_exitPoint);
-#ifdef G4VERBOSE
- if ( m_verbose > 1 ) {
- std::cout << "inserting hit..." << std::endl;
- std::cout << "entryPoint " << m_entryPoint << std::endl;
- std::cout << "entryPoint radius = " << m_entryPoint.mag() << std::endl;
- std::cout << "exitPoint " << m_exitPoint << std::endl;
- std::cout << "exitPoint radius = " << m_exitPoint.mag() << std::endl;
- std::cout << "midPoint " << midPoint << std::endl;
- std::cout << "midPoint radius = " << midPoint.mag() << std::endl;
- std::cout << "meanMom " << meanMom << std::endl;
- std::cout << "length " << pathlength << std::endl;
- }
-#endif
-
// hit data
G4TrackerHit* trkhit = new G4TrackerHit();
trkhit->setTdep(m_minTime);
@@ -157,34 +148,45 @@
Id64bit id64 = makeId();
trkhit->setId(id64.getId0());
- m_HC->insert(trkhit);
-
- // clear cached data
- clear();
-
#ifdef G4VERBOSE
- if ( m_verbose ) {
+ if ( m_verbose > 1 ) {
+ std::cout << GetName() << " : inserting new hit" << std::endl;
+ std::cout << *trkhit << std::endl;
+ std::cout << "entryPoint = " << m_entryPoint << std::endl;
+ std::cout << "entryPoint radius = " << m_entryPoint.mag() << std::endl;
+ std::cout << "exitPoint = " << m_exitPoint << std::endl;
+ std::cout << "exitPoint radius = " << m_exitPoint.mag() << std::endl;
+ std::cout << "midPoint = " << midPoint << std::endl;
+ std::cout << "midPoint radius = " << midPoint.mag() << std::endl;
std::cout << std::endl;
}
#endif
+ m_HC->insert(trkhit);
+
+ // clear cached data
+ clear();
+
return true;
}
void G4TrackerCombineSD::startHit(G4StepPoint* aStepPoint)
{
-#ifdef G4VERBOSE
- if ( m_verbose > 2 ) {
- std::cout << "startHit" << std::endl;
- }
-#endif
-
m_currentPV = aStepPoint->GetPhysicalVolume();
m_entryPoint = m_exitPoint = aStepPoint->GetPosition();
m_entryMomentum = m_exitMomentum = aStepPoint->GetMomentum();
m_currentTrackID = trackID();
m_startedHit = true;
+#ifdef G4VERBOSE
+ if ( getVerbose() > 2 ) {
+ std::cout << GetName() << " : starting new hit" << std::endl;
+ std::cout << "volume = " << m_currentPV->GetName() << std::endl;
+ std::cout << "trackID = " << m_currentTrackID << std::endl;
+ std::cout << "entry point = " << m_entryPoint << std::endl;
+ }
+#endif
+
// get track information
TrackInformation* trkInfo = trackInformation();
lcdd/src
diff -u -r1.7 -r1.8
--- G4TrackerHit.cc 10 Mar 2006 07:40:34 -0000 1.7
+++ G4TrackerHit.cc 31 Mar 2006 01:09:38 -0000 1.8
@@ -43,4 +43,19 @@
#endif
void G4TrackerHit::Print()
-{}
+{
+ std::cout << *this << std::endl;
+}
+
+std::ostream& operator<<(std::ostream &os, const G4TrackerHit& hit)
+{
+ std::cout << hit.getTrackID() << " "
+ << hit.getPos() << " "
+ << G4BestUnit(hit.getEdep(), "Energy") << " "
+ << hit.getMomentum() << " "
+ << G4BestUnit(hit.getLength(), "Length") << " "
+ << G4BestUnit(hit.getTdep(), "Time") << " "
+ << hit.getPDG() << " "
+ << std::endl;
+ return os;
+}
lcdd/src
diff -u -r1.27 -r1.28
--- G4TrackerSD.cc 10 Mar 2006 07:40:34 -0000 1.27
+++ G4TrackerSD.cc 31 Mar 2006 01:09:38 -0000 1.28
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4TrackerSD.cc,v 1.27 2006/03/10 07:40:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4TrackerSD.cc,v 1.28 2006/03/31 01:09:38 jeremy Exp $
// LCDD
#include "IdManager.hh"
@@ -37,39 +37,16 @@
HCE->AddHitsCollection( getHCID(), m_HC );
}
-void G4TrackerSD::EndOfEvent(G4HCofThisEvent *)
-{
-#ifdef G4VERBOSE
- if ( m_verbose > 0 ) {
- std::cout << "Tracker <" << GetName()
- << "> has nhits <" << m_HC->GetSize()
- << ">." << std::endl;
- }
-#endif
-}
-
G4bool G4TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
// set cached step
G4SensitiveDetector::ProcessHits( aStep, 0 );
-#ifdef G4VERBOSE
- if ( m_verbose > 1 ) {
- std::cout << "G4TrackerSD::ProcessHits() - " << this->GetName() << std::endl;
- }
-#endif
-
// edep
G4double e = edep();
+ // check edep < cut
if ( e <= getEcut() ) {
-
-#ifdef G4VERBOSE
- if ( m_verbose > 1 ) {
- std::cout << "cut this edep = " << e << std::endl;
- }
-#endif
-
return false;
}
@@ -79,28 +56,12 @@
// set hit flag in trk info
trkInfo->setHasTrackerHit( true );
-#ifdef G4VERBOSE
- if ( m_verbose > 2 ) {
- std::cout << "tracker hit: " << GetName() << std::endl;
- std::cout << "trackID <" << trackID() << ">" << std::endl;
- }
-#endif
-
// hit data
G4int trkID = trackID();
G4double tdep = globalTime();
G4ThreeVector midpos = midPosition();
G4ThreeVector meanmom = meanMomentum();
-
-#ifdef G4VERBOSE
- if ( m_verbose > 1 ) {
- std::cout << "edep = " << e << std::endl;
- std::cout << "trkID = " << trkID << std::endl;
- std::cout << "tdep = " << tdep << std::endl;
- std::cout << "midpos = " << midpos << std::endl;
- std::cout << "meanmom = " << meanmom << std::endl;
- }
-#endif
+ G4double pathLength = ReadoutUtil::computeDistance(aStep);
// create hit
G4TrackerHit* trkHit = new G4TrackerHit();
@@ -115,10 +76,31 @@
trkHit->setMomentum(meanmom);
trkHit->setTdep(tdep);
trkHit->setId( id64.getId0() );
- trkHit->setLength(ReadoutUtil::computeDistance(aStep));
+ trkHit->setLength(pathLength);
// add to HC
m_HC->insert(trkHit);
return true;
}
+
+void G4TrackerSD::printHits(std::ostream& os)
+{
+ for (size_t i = 0; i < m_HC->GetSize(); i++) {
+ os << const_cast<const G4TrackerHit&>(*(dynamic_cast<G4TrackerHit*>(m_HC->GetHit(i))));
+ }
+ os << std::endl;
+}
+
+void G4TrackerSD::EndOfEvent(G4HCofThisEvent *)
+{
+#ifdef G4VERBOSE
+ if ( getVerbose() > 0 ) {
+ std::cout << GetName() << " has " << m_HC->GetSize() << " hits." << std::endl;
+ }
+
+ if ( getVerbose() > 1 ) {
+ printHits ( std::cout );
+ }
+#endif
+}
CVSspam 0.2.8