Print

Print


Commit in lcdd on MAIN
include/G4ScorerSD.hh+23added 1.1
       /ScorerType.hh+37added 1.1
       /scorer.hh+28added 1.1
       /G4TrackerSD.hh+2-21.9 -> 1.10
       /SensitiveDetectorFactory.hh+8-41.5 -> 1.6
       /SensitiveDetectorTypeProcess.hh+5-111.8 -> 1.9
       /TrackerType.hh-21.3 -> 1.4
schemas/lcdd/1.0/sensitive_detectors.xsd+6-21.4 -> 1.5
src/G4ScorerSD.cc+106added 1.1
   /scorerProcess.cc+66added 1.1
   /scorerSubscriber.cc+40added 1.1
   /G4TrackerSD.cc+15-151.25 -> 1.26
   /LCDDLibLoad.cc+6-41.17 -> 1.18
   /SensitiveDetectorFactory.cc+50-231.10 -> 1.11
+392-63
6 added + 8 modified, total 14 files
Added scoring plane as element 'scorer' to LCDD schema and code.  Stores preStep of track and ignores subsequent hits on same track ID.

lcdd/include
G4ScorerSD.hh added at 1.1
diff -N G4ScorerSD.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ G4ScorerSD.hh	5 Jul 2005 20:35:52 -0000	1.1
@@ -0,0 +1,23 @@
+#ifndef G4ScorerSD_hh
+#define G4ScorerSD_hh 1
+
+#include "G4TrackerSD.hh"
+
+class G4ScorerSD : public G4TrackerSD
+{
+public:
+  G4ScorerSD(G4String sdName,
+	     G4String hcName
+	     //,
+	     //	     bool killTracks
+	     );
+
+protected:
+  virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
+
+protected:
+  bool m_killTracks;
+  int m_currentTrackID;
+};
+
+#endif

lcdd/include
ScorerType.hh added at 1.1
diff -N ScorerType.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ScorerType.hh	5 Jul 2005 20:35:53 -0000	1.1
@@ -0,0 +1,37 @@
+#ifndef ScorerType_hh
+#define ScorerType_hh 1
+
+#include "SensitiveDetectorType.hh"
+
+/**
+ * @class ScorerType
+ * @brief ScorerType from schema.
+ */
+class ScorerType : public SensitiveDetectorType
+{
+
+public:
+  ScorerType()
+  {}
+
+  virtual ~ScorerType()
+  {}
+
+  /*
+    void set_kill_tracks(const std::string& k)
+    {
+    m_kill_tracks = k;
+    }
+
+    const std::string& get_kill_tracks()
+    {
+    return m_kill_tracks;
+    }
+
+    private:
+    std::string m_kill_tracks;
+  */
+
+};
+
+#endif

lcdd/include
scorer.hh added at 1.1
diff -N scorer.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ scorer.hh	5 Jul 2005 20:35:53 -0000	1.1
@@ -0,0 +1,28 @@
+#ifndef scorer_hh
+#define scorer_hh
+
+#include "ScorerType.hh"
+
+#include "Saxana/SAXObject.h"
+#include "SensitiveDetectorType.hh"
+
+/**
+ * @class scorer
+ * @brief scorer element from schema.
+ */
+class scorer : public SAXObject, public ScorerType
+{
+public:
+  scorer()
+  {}
+
+  virtual ~scorer()
+  {}
+
+  virtual SAXObject::Type type()
+  {
+    return SAXObject::element;
+  }
+};
+
+#endif

lcdd/include
G4TrackerSD.hh 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- G4TrackerSD.hh	19 Apr 2005 17:42:36 -0000	1.9
+++ G4TrackerSD.hh	5 Jul 2005 20:35:52 -0000	1.10
@@ -1,5 +1,5 @@
 #ifndef G4TrackerSD_hh
-#define G4TrackerSD_hh
+#define G4TrackerSD_hh 1
 
 #include "G4SensitiveDetector.hh"
 #include "G4TrackerHit.hh"
@@ -19,7 +19,7 @@
 
 public:
   virtual void Initialize(G4HCofThisEvent *);
-  virtual void EndOfEvent(G4HCofThisEvent *);		      
+  virtual void EndOfEvent(G4HCofThisEvent *);
 
 protected:
   virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);

lcdd/include
SensitiveDetectorFactory.hh 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- SensitiveDetectorFactory.hh	5 May 2005 02:40:34 -0000	1.5
+++ SensitiveDetectorFactory.hh	5 Jul 2005 20:35:53 -0000	1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/SensitiveDetectorFactory.hh,v 1.5 2005/05/05 02:40:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/SensitiveDetectorFactory.hh,v 1.6 2005/07/05 20:35:53 jeremy Exp $
 
 // LCDD
 #include "LCDDProcessor.hh"
@@ -7,11 +7,9 @@
 #include "G4SensitiveDetector.hh"
 #include "G4SegmentationFactory.hh"
 
-#include "G4TrackerSD.hh"
-#include "G4CalorimeterSD.hh"
-
 #include "calorimeter.hh"
 #include "tracker.hh"
+#include "scorer.hh"
 
 #include "IdManager.hh"
 #include "IdSpec.hh"
@@ -23,6 +21,10 @@
 
 #include "Saxana/SAXObject.h"
 
+class G4TrackerSD;
+class G4ScorerSD;
+class G4CalorimeterSD;
+
 /**
    @class SensitiveDetectorFactory
    @brief Creates SDs based on XML tag data.
@@ -48,6 +50,8 @@
 
   static G4TrackerSD* createTrackerSD(const SAXObject* object);
 
+  static G4ScorerSD* createScorerSD(const SAXObject* object);
+
   static IdSpec* findIdSpec(const SensitiveDetectorType* sdt);
 
   static void setBaseSensitiveDetectorAttributes(G4SensitiveDetector* sd, const SensitiveDetectorType* sdt);

lcdd/include
SensitiveDetectorTypeProcess.hh 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- SensitiveDetectorTypeProcess.hh	12 Mar 2005 02:15:34 -0000	1.8
+++ SensitiveDetectorTypeProcess.hh	5 Jul 2005 20:35:53 -0000	1.9
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/SensitiveDetectorTypeProcess.hh,v 1.8 2005/03/12 02:15:34 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/SensitiveDetectorTypeProcess.hh,v 1.9 2005/07/05 20:35:53 jeremy Exp $
 
 #ifndef SensitiveDetectorTypeProcess_hh
 #define SensitiveDetectorTypeProcess_hh 1
@@ -29,7 +29,7 @@
 {
 public:
   SensitiveDetectorTypeProcess( const ProcessingContext* context = 0)
-    : SAXStateProcess(context), 
+    : SAXStateProcess(context),
       m_obj(0)
   {}
 
@@ -56,13 +56,7 @@
       sdt->set_endcap_flag( attrs.getValue( "endcap_flag" ) );
 
       // set the type str for factory build
-      if ( name == "calorimeter" || name == "tracker" ) {
-	sdt->set_type( name );
-      }
-      else {
-	std::cerr << "Invalid tag for SD type - " << name << std::endl;
-	G4Exception( "Unknown SD tag." );
-      }
+      sdt->set_type( name );
     }
     else {
       std::cerr << "SensitiveDetectorTypeProcess::StartElement - cast to SensitiveDetectorType failed!" << std::endl;
@@ -76,7 +70,7 @@
   {}
 
   virtual void StackPopNotify(const std::string& name)
-  {      
+  {
     SAXObject** so = Context()->GetTopObject();
     SensitiveDetectorType* sdt = dynamic_cast<SensitiveDetectorType*>( m_obj );
 
@@ -86,7 +80,7 @@
 
 protected:
   SAXObject* m_obj;
- 
+
 };
 
 #endif

lcdd/include
TrackerType.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- TrackerType.hh	7 Apr 2005 21:52:45 -0000	1.3
+++ TrackerType.hh	5 Jul 2005 20:35:53 -0000	1.4
@@ -1,8 +1,6 @@
 #ifndef TrackerType_hh
 #define TrackerType_hh 1
 
-#include "Schema/ContentGroup.h"
-
 #include "SensitiveDetectorType.hh"
 
 #include <iostream>

lcdd/schemas/lcdd/1.0
sensitive_detectors.xsd 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- sensitive_detectors.xsd	5 Jul 2005 19:03:45 -0000	1.4
+++ sensitive_detectors.xsd	5 Jul 2005 20:35:54 -0000	1.5
@@ -21,7 +21,7 @@
     <xs:attribute name="name"               type="xs:ID" use="required" />
     <xs:attribute name="hits_collection"    type="xs:string" use="required" />
     <xs:attribute name="endcap_flag"        type="xs:boolean" default="false" />
-    <xs:attribute name="ecut"               type="xs:double" default="0" />
+    <xs:attribute name="ecut"               type="xs:double" default="0.0" />
     <xs:attribute name="eunit"              type="xs:string" default="MeV" />
     <xs:attribute name="verbose"            type="xs:int" default="0" />
 
@@ -101,12 +101,16 @@
   <xs:complexType name="ScorerType">
     <xs:annotation>
       <xs:documentation>
-	Scoring plane sensitive detector type
+	Scoring plane sensitive detector type.
+	Assigned LV should be thin and close to Vacuum.
       </xs:documentation>
     </xs:annotation>
 
     <xs:complexContent>
       <xs:extension base="SensitiveDetectorType">
+	<xs:annotation>
+	  This type of SD ignore the ecut attribute, because this will often be 0 in a vacuum.
+	</xs:annotation>
 <!--
 	<xs:attribute name="kill_tracks" type="xs:boolean" default="false" />
 -->

lcdd/src
G4ScorerSD.cc added at 1.1
diff -N G4ScorerSD.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ G4ScorerSD.cc	5 Jul 2005 20:35:54 -0000	1.1
@@ -0,0 +1,106 @@
+#include "G4ScorerSD.hh"
+
+#include "TrackInformation.hh"
+
+G4ScorerSD::G4ScorerSD(G4String sdName,
+		       G4String hcName
+		       //,
+		       //		       bool killTracks
+		       )
+  : G4TrackerSD(sdName, hcName),
+    m_currentTrackID(-1)
+{
+  //  m_killTracks = killTracks;
+}
+
+G4bool G4ScorerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
+{
+#ifdef G4VERBOSE
+  if ( m_verbose > 1 ) {
+    std::cout << "G4ScorerSD::ProcessHits() - " << this->GetName() << std::endl;
+  }
+#endif
+
+  G4SensitiveDetector::ProcessHits( aStep, 0 );
+
+  bool sameTrack = false;
+
+#ifdef G4VERBOSE
+  if ( m_verbose > 3 ) {
+    std::cout << "current trackID <" << m_currentTrackID << ">" << std::endl;
+  }
+#endif
+
+  if ( (m_currentTrackID == -1) || (m_currentTrackID != trackID() ) ) {
+
+#ifdef G4VERBOSE
+    if ( m_verbose > 2 ) {
+      std::cout << "new track <" << trackID() << ">" << std::endl;
+    }
+#endif
+
+    m_currentTrackID = trackID();
+  }
+  else {
+#ifdef G4VERBOSE
+    if ( m_verbose > 2 ) {
+      std::cout << "old track <" << trackID() << ">" << std::endl;
+    }
+#endif
+
+    sameTrack = true;
+  }
+
+  if ( !sameTrack ) {
+
+#ifdef G4VERBOSE
+    if ( m_verbose > 2 ) {
+      std::cout << "writing hit" << std::endl;
+    }
+#endif
+
+    // edep
+    G4double e = edep();
+
+    // get track information
+    TrackInformation* trkInfo = trackInformation();
+
+    // set hit flag in trk info
+    trkInfo->setHasTrackerHit( true );
+
+    // hit data
+    G4int trkID = trackID();
+    G4double tdep = globalTime();
+    G4ThreeVector prepos = prePosition();
+    G4ThreeVector meanmom = meanMomentum();
+
+    // create hit
+    G4TrackerHit* trkHit = new G4TrackerHit();
+
+    // create id vector
+    Id64bit id64 = makeId();
+
+    // set track hit info
+    trkHit->setTrackID(trkID);
+    trkHit->setEdep(e);
+    trkHit->setPos(prepos);
+    trkHit->setMomentum(meanmom);
+    trkHit->setTdep(tdep);
+    trkHit->setId( id64.getId0() );
+
+    // add to HC
+    m_HC->insert(trkHit);
+
+    //    if ( m_killTracks ) {
+    //
+    //    }
+  }
+  else {
+#ifdef G4VERBOSE
+    if ( m_verbose > 0 ) {
+      std::cout << "Skipping hit from track <" << m_currentTrackID << ">." << std::endl;
+    }
+#endif
+  }
+  return true;
+}

lcdd/src
scorerProcess.cc added at 1.1
diff -N scorerProcess.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ scorerProcess.cc	5 Jul 2005 20:35:54 -0000	1.1
@@ -0,0 +1,66 @@
+#include "Saxana/ProcessingConfigurator.h"
+#include "Saxana/ProcessingContext.h"
+#include "Saxana/SAXProcessor.h"
+#include "Saxana/StateStack.h"
+#include "Saxana/SAXProcessingState.h"
+#include "Saxana/SAXStateProcess.h"
+#include "Saxana/SAXComponentFactory.h"
+
+#include "scorer.hh"
+#include "SensitiveDetectorTypeProcess.hh"
+
+#include <iostream>
+
+/**
+   @class scorerProcess
+   @brief SAX process for scorer element.
+*/
+class scorerProcess : public SensitiveDetectorTypeProcess
+{
+
+public:
+  scorerProcess( const ProcessingContext* context = 0)
+    : SensitiveDetectorTypeProcess(context)
+  {}
+
+  virtual ~scorerProcess()
+  {}
+
+  virtual void StartElement( const std::string& name, const ASCIIAttributeList& attrs)
+  {
+    //std::cout << "PROCESS::START OF TAG  : " << name << std::endl;
+
+    SAXObject** obj = Context()->GetTopObject();
+
+
+    scorer* scr = new scorer;
+    /*
+    scr->set_kill_tracks(attrs.getValue("kill_tracks") );
+    */
+
+    m_obj = scr;
+    *obj = scr;
+
+    SensitiveDetectorTypeProcess::StartElement(name, attrs);
+  }
+
+  virtual void EndElement(const std::string&)
+  {
+    //std::cout << "PROCESS::END OF TAG  : " << name << " " << std::endl;
+
+    //SensitiveDetectorTypeProcess::EndElement( name );
+  }
+
+  virtual void StackPopNotify(const std::string& name)
+  {
+    SensitiveDetectorTypeProcess::StackPopNotify( name );
+  }
+
+  virtual const std::string& State() const
+  {
+    static std::string tag = "scorer";
+    return tag;
+  }
+};
+
+DECLARE_PROCESS_FACTORY(scorerProcess)

lcdd/src
scorerSubscriber.cc added at 1.1
diff -N scorerSubscriber.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ scorerSubscriber.cc	5 Jul 2005 20:35:54 -0000	1.1
@@ -0,0 +1,40 @@
+#include "Saxana/SAXSubscriber.h"
+#include "Saxana/SAXComponentFactory.h"
+
+#include "LCDDProcessor.hh"
+#include "scorer.hh"
+#include "G4SensitiveDetector.hh"
+#include "G4ScorerSD.hh"
+#include "SensitiveDetectorFactory.hh"
+
+#include <iostream>
+
+/**
+   @class scorerSubscriber
+   @brief SAX subscriber for scorer element.
+   @note  Delegates to SensitiveDetectorFactory to create G4ScorerSD.
+*/
+class scorerSubscriber : virtual public SAXSubscriber
+{
+public:
+  virtual const SAXComponentObject* Build() const
+  {
+    return this;
+  }
+
+public:
+  scorerSubscriber()
+  {
+    Subscribe("scorer");
+  }
+
+  virtual ~scorerSubscriber()
+  {}
+
+  virtual void Activate(const SAXObject* object)
+  {
+    SensitiveDetectorFactory::createSensitiveDetector( object );
+  }
+};
+
+DECLARE_SUBSCRIBER_FACTORY(scorerSubscriber)

lcdd/src
G4TrackerSD.cc 1.25 -> 1.26
diff -u -r1.25 -r1.26
--- G4TrackerSD.cc	6 May 2005 20:40:28 -0000	1.25
+++ G4TrackerSD.cc	5 Jul 2005 20:35:54 -0000	1.26
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4TrackerSD.cc,v 1.25 2005/05/06 20:40:28 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4TrackerSD.cc,v 1.26 2005/07/05 20:35:54 jeremy Exp $
 
 // LCDD
 #include "IdManager.hh"
@@ -41,15 +41,15 @@
 {
 #ifdef G4VERBOSE
   if ( m_verbose > 0 ) {
-    std::cout << "Tracker <" << GetName() 
-	      << "> has nhits <" << m_HC->GetSize() 
+    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 );
 
@@ -60,13 +60,13 @@
 #endif
 
   // edep
-  G4double edep = aStep->GetTotalEnergyDeposit();
-  
-  if ( edep <= getEcut() ) {   
+  G4double e = edep();
+
+  if ( e <= getEcut() ) {
 
 #ifdef G4VERBOSE
     if ( m_verbose > 1 ) {
-      std::cout << "cut this edep = " << edep << std::endl;
+      std::cout << "cut this edep = " << e << std::endl;
     }
 #endif
 
@@ -78,14 +78,14 @@
 
   // 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();
@@ -94,7 +94,7 @@
 
 #ifdef G4VERBOSE
   if ( m_verbose > 1 ) {
-    std::cout << "edep = " << edep << std::endl;
+    std::cout << "edep = " << e << std::endl;
     std::cout << "trkID = " << trkID << std::endl;
     std::cout << "tdep = " << tdep << std::endl;
     std::cout << "midpos = " << midpos << std::endl;
@@ -107,17 +107,17 @@
 
   // create id vector
   Id64bit id64 = makeId();
-  
+
   // set track hit info
   trkHit->setTrackID(trkID);
-  trkHit->setEdep(edep);
-  trkHit->setPos(midpos);			   
+  trkHit->setEdep(e);
+  trkHit->setPos(midpos);
   trkHit->setMomentum(meanmom);
   trkHit->setTdep(tdep);
   trkHit->setId( id64.getId0() );
 
   // add to HC
   m_HC->insert(trkHit);
- 
+
   return true;
 }

lcdd/src
LCDDLibLoad.cc 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- LCDDLibLoad.cc	25 Mar 2005 01:20:07 -0000	1.17
+++ LCDDLibLoad.cc	5 Jul 2005 20:35:54 -0000	1.18
@@ -16,12 +16,13 @@
     // volume extended and related refs
     LOAD_COMPONENT(volumeExtendedProcess);
     LOAD_COMPONENT(sdrefProcess);
-    LOAD_COMPONENT(regionrefProcess);    
+    LOAD_COMPONENT(regionrefProcess);
     LOAD_COMPONENT(physvolidProcess);
 
     // SDs
     LOAD_COMPONENT(calorimeterProcess);
     LOAD_COMPONENT(trackerProcess);
+    LOAD_COMPONENT(scorerProcess);
 
     // segmentations
     LOAD_COMPONENT(grid_xyzProcess);
@@ -45,7 +46,7 @@
     // display
     LOAD_COMPONENT(visProcess);
     LOAD_COMPONENT(visrefProcess);
-    LOAD_COMPONENT(colorProcess);    
+    LOAD_COMPONENT(colorProcess);
 
     // limit
     LOAD_COMPONENT(limitProcess);
@@ -58,11 +59,12 @@
     LOAD_COMPONENT(headerSubscriber);
 
     // volume extended
-    LOAD_COMPONENT(volumeExtendedSubscriber);    
+    LOAD_COMPONENT(volumeExtendedSubscriber);
 
     // SDs
     LOAD_COMPONENT(calorimeterSubscriber);
     LOAD_COMPONENT(trackerSubscriber);
+    LOAD_COMPONENT(scorerSubscriber);
 
     // Ids
     LOAD_COMPONENT(idspecSubscriber);
@@ -81,7 +83,7 @@
     LOAD_COMPONENT(limitSubscriber);
   }
 
-  void LCDDLibLoad() {   
+  void LCDDLibLoad() {
     LCDDLoadProcesses();
     LCDDLoadSubscribers();
   }

lcdd/src
SensitiveDetectorFactory.cc 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- SensitiveDetectorFactory.cc	6 May 2005 18:24:43 -0000	1.10
+++ SensitiveDetectorFactory.cc	5 Jul 2005 20:35:54 -0000	1.11
@@ -1,7 +1,11 @@
-// $Header: /cvs/lcd/lcdd/src/SensitiveDetectorFactory.cc,v 1.10 2005/05/06 18:24:43 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/SensitiveDetectorFactory.cc,v 1.11 2005/07/05 20:35:54 jeremy Exp $
 #include "SensitiveDetectorFactory.hh"
 
+/* LCDD */
 #include "G4TrackerCombineSD.hh"
+#include "G4ScorerSD.hh"
+#include "G4TrackerSD.hh"
+#include "G4CalorimeterSD.hh"
 
 #include "StringUtil.hh"
 
@@ -14,16 +18,22 @@
   if ( sdt ) {
     std::string sd_type = sdt->get_type();
 
-    // create specific type of SD 
+    /* create calorimeter */
     if ( sd_type == "calorimeter" ) {
       sd = createCalorimeterSD( object );
     }
+    /* create tracker */
     else if ( sd_type == "tracker" ) {
       sd = createTrackerSD( object );
     }
+    /* create scorer */
+    else if ( sd_type == "scorer" ) {
+      sd = createScorerSD( object );
+    }
+    /* invalid type */
     else {
-      G4cerr << "sd_type is not known <" << sd_type << ">." << G4endl;
-      G4Exception( "Unknown SD tag." );
+      G4cerr << "Invalid sd_type <" << sd_type << ">." << G4endl;
+      G4Exception( "Unknown SD type.  Check the LCDD file." );
     }
 
     // set ecut and verbose
@@ -32,12 +42,12 @@
     // find idspec
     IdSpec* idspec = findIdSpec( sdt );
 
-    // set idspec, if exists (null is ok here)
+    // set idspec, if exists (null is ok)
     if ( idspec != 0 ) {
       sd->setIdSpec( idspec );
     }
 
-    // register
+    // register the SD
     std::string sdName = sd->GetName();
     LCDDProcessor::instance()->addSensitiveDetector(sdName,
 						    sd);
@@ -50,7 +60,7 @@
 }
 
 G4CalorimeterSD* SensitiveDetectorFactory::createCalorimeterSD(const SAXObject* object)
-{	
+{
   G4CalorimeterSD* sd = 0;
   G4Segmentation* seg = 0;
 
@@ -64,10 +74,10 @@
   // child tag loop for segmentation
   bool fnd_seg = false;
   for( size_t i = 0; i < count; i++) {
-           
+
     std::string child_tag = seq->content(i).tag;
-    const ContentGroup::ContentItem& segitem = seq->content(i);	  
-      
+    const ContentGroup::ContentItem& segitem = seq->content(i);
+
     // create segmentation using factory
     if ( isSegmentationTag( child_tag ) ) {
 
@@ -76,7 +86,7 @@
       seg = G4SegmentationFactory::createSegmentation( segitem.object, segitem.tag );
       fnd_seg = true;
       break;
-    }      
+    }
   }
 
   if ( !fnd_seg ) {
@@ -97,7 +107,6 @@
   return sd;
 }
 
-/** @todo different type if combining hits */
 G4TrackerSD* SensitiveDetectorFactory::createTrackerSD(const SAXObject* object)
 {
   const tracker* trk = dynamic_cast<const tracker*>( object );
@@ -113,12 +122,12 @@
     G4Exception("SensitiveDetectorFactory - There was a problem with the name of the hits collection.");
   }
 
-  // create tracker that aggregates hits
+  /* tracker that aggregates hits */
   if ( combineHits ) {
     sd = new G4TrackerCombineSD(nm,
 				hc);
   }
-  // create regular tracker
+  /* regular tracker */
   else {
     sd = new G4TrackerSD(nm,
 			 hc);
@@ -127,30 +136,48 @@
   return sd;
 }
 
+G4ScorerSD* SensitiveDetectorFactory::createScorerSD(const SAXObject* object)
+{
+  const scorer * scr = dynamic_cast<const scorer*>( object );
+
+  G4ScorerSD* sd = 0;
+
+  std::string nm = scr->get_name();
+  std::string hc = scr->get_hitsCollectionName();
+
+  if ( checkHCName(hc) ) {
+    G4Exception("SensitiveDetectorFactory - There was a problem with the name of the hits collection.");
+  }
+
+  sd = new G4ScorerSD(nm,
+		      hc);
+  return sd;
+}
+
 IdSpec* SensitiveDetectorFactory::findIdSpec(const SensitiveDetectorType* sdt)
 {
   IdSpec* idspec = 0;
   ContentSequence* seq = const_cast<ContentSequence*> ( sdt->get_content() );
-  size_t count = seq->size();		 
+  size_t count = seq->size();
   for( size_t i = 0; i < count; i++) {
 
     std::string child_tag = seq->content(i).tag;
 
     // find idspec
-    if ( child_tag == "idspecref" ) {	    	    	
+    if ( child_tag == "idspecref" ) {
 
-      IdSpecType::idspecref* id_ref = 
+      IdSpecType::idspecref* id_ref =
 	dynamic_cast<IdSpecType::idspecref*> ( seq->content(i).object );
 
       idspec = IdManager::instance()->getIdSpec( id_ref->get_ref() );
-      
+
       break;
     }
   }
   return idspec;
 }
 
-void SensitiveDetectorFactory::setBaseSensitiveDetectorAttributes(G4SensitiveDetector* sd, const SensitiveDetectorType* sdt) 
+void SensitiveDetectorFactory::setBaseSensitiveDetectorAttributes(G4SensitiveDetector* sd, const SensitiveDetectorType* sdt)
 {
   sd->setEcut( SensitiveDetectorFactory::computeEcut( sdt ) );
   sd->setVerbose( SensitiveDetectorFactory::convertVerbose( sdt ) );
@@ -174,13 +201,13 @@
   return verbose;
 }
 
-bool SensitiveDetectorFactory::isSegmentationTag(const std::string& s) 
+bool SensitiveDetectorFactory::isSegmentationTag(const std::string& s)
 {
   // new segmentations must appear here!
   // @todo Fix this to know all segmentation types somehow.
-  return ( s == "projective_cylinder" || 
-	   s == "grid_xyz" || 
-	   s == "nonprojective_cylinder" || 
+  return ( s == "projective_cylinder" ||
+	   s == "grid_xyz" ||
+	   s == "nonprojective_cylinder" ||
 	   s == "projective_zplane" );
 }
 
CVSspam 0.2.8