Commit in lcdd on MAIN | |||
include/G4UserRegionInformation.hh | +59 | -63 | 1.9 -> 1.10 |
/RegionType.hh | +100 | -105 | 1.9 -> 1.10 |
schemas/lcdd/1.0/lcdd_regions.xsd | +1 | 1.2 -> 1.3 | |
src/regionProcess.cc | +49 | -52 | 1.7 -> 1.8 |
/regionSubscriber.cc | +7 | -3 | 1.15 -> 1.16 |
+216 | -223 |
support for killing tracks in regions; work in progress
diff -u -r1.9 -r1.10 --- G4UserRegionInformation.hh 15 Oct 2009 00:08:24 -0000 1.9 +++ G4UserRegionInformation.hh 30 Apr 2013 23:04:44 -0000 1.10 @@ -1,4 +1,4 @@
-//$Header: /cvs/lcd/lcdd/include/G4UserRegionInformation.hh,v 1.9 2009/10/15 00:08:24 jeremy Exp $
+//$Header: /cvs/lcd/lcdd/include/G4UserRegionInformation.hh,v 1.10 2013/04/30 23:04:44 jeremy Exp $
#ifndef LCDD_G4USERREGIONINFORMATION_HH #define LCDD_G4USERREGIONINFORMATION_HH 1
@@ -11,71 +11,67 @@
#include <string> /**
- @class G4UserRegionInformation - @brief Implementation of G4VUserRegionInformation. -*/ -class G4UserRegionInformation : public G4VUserRegionInformation -{ - public: - G4UserRegionInformation() - {} - - virtual ~G4UserRegionInformation() - {} - - public: - - void setStoreSecondaries(bool b) - { - _storeSecondaries = b; - } - - bool getStoreSecondaries() const - { - return _storeSecondaries; - } - - void setThreshold(G4double t) - { - _threshold = t; - } - - G4double getThreshold() const - { - return _threshold; - } - - // region info from track - static inline G4UserRegionInformation* getRegionInformation(const G4Track* aTrack) - { - return static_cast<G4UserRegionInformation*> - (aTrack-> - GetLogicalVolumeAtVertex()-> - GetRegion()-> - GetUserInformation() ); - } - - // region info from step point - static G4UserRegionInformation* getRegionInformation(const G4StepPoint* aStepPoint) - { - return - static_cast<G4UserRegionInformation*> - ( aStepPoint-> - GetPhysicalVolume()-> - GetLogicalVolume()-> - GetRegion()-> - GetUserInformation() ); - } - - - void Print() const - {}
+ @class G4UserRegionInformation + @brief Implementation of G4VUserRegionInformation. + */ +class G4UserRegionInformation: public G4VUserRegionInformation {
- private:
+public:
- bool _storeSecondaries;
+ G4UserRegionInformation() : + _storeSecondaries(false), _killTracks(false) { + }
- G4double _threshold;
+ virtual ~G4UserRegionInformation() { + } + +public: + + void setStoreSecondaries(bool b) { + _storeSecondaries = b; + } + + bool getStoreSecondaries() const { + return _storeSecondaries; + } + + void setKillTracks(bool killTracks) { + _killTracks = killTracks; + } + + bool getKillTracks() const { + return _killTracks; + } + + void setThreshold(G4double t) { + _threshold = t; + } + + G4double getThreshold() const { + return _threshold; + } + + // region info from track + static inline G4UserRegionInformation* getRegionInformation( + const G4Track* aTrack) { + return static_cast<G4UserRegionInformation*>(aTrack->GetLogicalVolumeAtVertex()->GetRegion()->GetUserInformation()); + } + + // region info from step point + static G4UserRegionInformation* getRegionInformation( + const G4StepPoint* aStepPoint) { + return static_cast<G4UserRegionInformation*>(aStepPoint->GetPhysicalVolume()->GetLogicalVolume()->GetRegion()->GetUserInformation()); + } + + void Print() const { + } + +private: + + bool _storeSecondaries; + bool _killTracks; + + G4double _threshold;
}; #endif
diff -u -r1.9 -r1.10 --- RegionType.hh 18 Dec 2006 22:49:02 -0000 1.9 +++ RegionType.hh 30 Apr 2013 23:04:44 -0000 1.10 @@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/RegionType.hh,v 1.9 2006/12/18 22:49:02 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/RegionType.hh,v 1.10 2013/04/30 23:04:44 jeremy Exp $
#ifndef LCDD_REGIONTYPE_HH #define LCDD_REGIONTYPE_HH 1
@@ -10,122 +10,117 @@
#include "Schema/ReferenceType.h" /**
- @class RegionType - @brief RegionType from schema. -*/ -class RegionType -{
+ @class RegionType + @brief RegionType from schema. + */ +class RegionType { +
public:
- /** - * @class RegionType::regionref - * @brief Reference to a region element. - */ - class regionref : public SAXObject, public ReferenceType - { - public: - regionref() - {} - - virtual ~regionref() - {} - - virtual SAXObject::Type type() - { - return SAXObject::element; - } - };
+ + /** + * @class RegionType::regionref + * @brief Reference to a region element. + */ + class regionref: public SAXObject, public ReferenceType { + + public: + regionref() { + } + + virtual ~regionref() { + } + + virtual SAXObject::Type type() { + return SAXObject::element; + } + };
public:
- RegionType() - {}
+ RegionType() { + }
- virtual ~RegionType() - {}
+ virtual ~RegionType() { + }
- void set_name(const std::string& s) - { - m_name = s; - } - - void set_storeSecondaries(const std::string& s) - { - m_storeSecondaries = s; - } - - void set_cut(const std::string& s) - { - m_cut = s; - } - - void set_lunit(const std::string& s) - { - m_lunit = s; - } - - void set_threshold(const std::string& s) - { - m_threshold = s; - } - - void set_eunit(const std::string& s) - { - m_eunit = s; - } - - const std::string& get_name() const - { - return m_name; - } - - const std::string& get_storeSecondaries() const - { - return m_storeSecondaries; - } - - const std::string& get_cut() const - { - return m_cut; - } - - const std::string& get_lunit() const - { - return m_lunit; - } - - const std::string& get_threshold() const - { - return m_threshold; - } - - const std::string& get_eunit() const - { - return m_eunit; - } - - void add_content(const std::string& tag, SAXObject* so) - { - ContentGroup::ContentItem ci = {tag, so}; - m_sequence.add_content(ci); - } - - const ContentSequence* get_content() const - { - return &m_sequence; - }
+ void set_name(const std::string& s) { + m_name = s; + } + + void set_storeSecondaries(const std::string& s) { + m_storeSecondaries = s; + } + + void set_killTracks(const std::string& killTracks) { + m_killTracks = killTracks; + } + + void set_cut(const std::string& s) { + m_cut = s; + } + + void set_lunit(const std::string& s) { + m_lunit = s; + } + + void set_threshold(const std::string& s) { + m_threshold = s; + } + + void set_eunit(const std::string& s) { + m_eunit = s; + } + + const std::string& get_name() const { + return m_name; + } + + const std::string& get_storeSecondaries() const { + return m_storeSecondaries; + } + + const std::string& get_killTracks() const { + return m_killTracks; + } + + const std::string& get_cut() const { + return m_cut; + } + + const std::string& get_lunit() const { + return m_lunit; + } + + const std::string& get_threshold() const { + return m_threshold; + } + + const std::string& get_eunit() const { + return m_eunit; + } + + void add_content(const std::string& tag, SAXObject* so) { + ContentGroup::ContentItem ci = { tag, so }; + m_sequence.add_content(ci); + } + + const ContentSequence* get_content() const { + return &m_sequence; + }
private:
- ContentSequence m_sequence;
+ ContentSequence m_sequence;
- std::string m_name;
+ std::string m_name;
- std::string m_storeSecondaries;
+ std::string m_storeSecondaries;
+ std::string m_killTracks;
- std::string m_cut; - std::string m_lunit;
+ std::string m_cut; + std::string m_lunit;
- std::string m_threshold; - std::string m_eunit;
+ std::string m_threshold; + std::string m_eunit;
}; #endif
diff -u -r1.2 -r1.3 --- lcdd_regions.xsd 6 Sep 2005 18:57:45 -0000 1.2 +++ lcdd_regions.xsd 30 Apr 2013 23:04:44 -0000 1.3 @@ -27,6 +27,7 @@
</xs:sequence> <xs:attribute name="name" type="xs:ID" use="required"/> <xs:attribute name="store_secondaries" default="false" type="xs:boolean" />
+ <xs:attribute name="kill_tracks" default="false" type="xs:boolean" />
<xs:attribute name="cut" default="1.0" type="xs:double"/> <xs:attribute name="lunit" default="mm" type="xs:string"/> <xs:attribute name="threshold" default="1.0" type="xs:double" />
diff -u -r1.7 -r1.8 --- regionProcess.cc 6 Sep 2005 18:57:45 -0000 1.7 +++ regionProcess.cc 30 Apr 2013 23:04:44 -0000 1.8 @@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/regionProcess.cc,v 1.7 2005/09/06 18:57:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/regionProcess.cc,v 1.8 2013/04/30 23:04:44 jeremy Exp $
#include "Saxana/ProcessingConfigurator.h" #include "Saxana/ProcessingContext.h" #include "Saxana/SAXProcessor.h"
@@ -14,63 +14,60 @@
/** * @class regionProcess * @brief SAX process for region element.
-*/ -class regionProcess : public SAXStateProcess -{
+ */ +class regionProcess: public SAXStateProcess {
public:
- regionProcess(const ProcessingContext* context = 0) - : SAXStateProcess(context), - m_obj(0) - {} - - virtual ~regionProcess() - {} - - virtual const SAXComponentObject* Build() const - { - return this; - } - - virtual void StartElement(const std::string&, const ASCIIAttributeList& attrs) - { - SAXObject** obj = Context()->GetTopObject(); - - region* reg = new region; - - reg->set_name( attrs.getValue( "name" ) ); - reg->set_storeSecondaries( attrs.getValue( "store_secondaries" ) ); - reg->set_cut( attrs.getValue( "cut" ) ); - reg->set_lunit( attrs.getValue( "lunit" ) ); - reg->set_threshold( attrs.getValue( "threshold" ) ); - reg->set_eunit( attrs.getValue( "eunit" ) ); - - m_obj = reg; - *obj = reg; - } - - virtual void EndElement(const std::string&) - {} - - virtual void Characters(const std::string&) - {} - - virtual void StackPopNotify( const std::string& name ) { - SAXObject** so = Context()->GetTopObject(); - region* r = dynamic_cast<region*>( m_obj ); - r->add_content( name, *so ); - } - - virtual const std::string& State() const - { - static std::string tag = "region"; - return tag; - }
+ regionProcess(const ProcessingContext* context = 0) : + SAXStateProcess(context), m_obj(0) { + } + + virtual ~regionProcess() { + } + + virtual const SAXComponentObject* Build() const { + return this; + } + + virtual void StartElement(const std::string&, + const ASCIIAttributeList& attrs) { + SAXObject** obj = Context()->GetTopObject(); + + region* reg = new region; + + reg->set_name(attrs.getValue("name")); + reg->set_storeSecondaries(attrs.getValue("store_secondaries")); + reg->set_killTracks(attrs.getValue("kill_tracks")); + reg->set_cut(attrs.getValue("cut")); + reg->set_lunit(attrs.getValue("lunit")); + reg->set_threshold(attrs.getValue("threshold")); + reg->set_eunit(attrs.getValue("eunit")); + + m_obj = reg; + *obj = reg; + } + + virtual void EndElement(const std::string&) { + } + + virtual void Characters(const std::string&) { + } + + virtual void StackPopNotify(const std::string& name) { + SAXObject** so = Context()->GetTopObject(); + region* r = dynamic_cast<region*>(m_obj); + r->add_content(name, *so); + } + + virtual const std::string& State() const { + static std::string tag = "region"; + return tag; + }
private:
- SAXObject* m_obj;
+ SAXObject* m_obj;
}; DECLARE_PROCESS_FACTORY(regionProcess)
diff -u -r1.15 -r1.16 --- regionSubscriber.cc 1 Feb 2012 10:28:56 -0000 1.15 +++ regionSubscriber.cc 30 Apr 2013 23:04:44 -0000 1.16 @@ -1,9 +1,8 @@
-// $Header: /cvs/lcd/lcdd/src/regionSubscriber.cc,v 1.15 2012/02/01 10:28:56 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/regionSubscriber.cc,v 1.16 2013/04/30 23:04:44 jeremy Exp $
// GDML #include "Saxana/SAXSubscriber.h" #include "Saxana/SAXComponentFactory.h"
-
#include "G4Processor/GDMLProcessor.h" // LCDD
@@ -13,9 +12,9 @@
#include "G4UserRegionInformation.hh" #include "G4ProductionCuts.hh" #include "LimitSetType.hh"
-
#include "StringUtil.hh"
+// std
#include <iostream> #include <sstream>
@@ -75,6 +74,11 @@
// set storeSeco reg_info->setStoreSecondaries( StringUtil::toBool( store_seco ) );
+ std::string killTracks = robj->get_killTracks(); + std::cout << "regionSubscriber.killTracks: " << killTracks << std::endl; + reg_info->setKillTracks(StringUtil::toBool(killTracks)); + std::cout << "regInfo.killTracsk: " << reg_info << std::endl; +
// set threshold reg_info->setThreshold( threshold );
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