7 modified files
lcdd/include
diff -u -r1.6 -r1.7
--- RegionType.hh 20 Apr 2005 21:01:49 -0000 1.6
+++ RegionType.hh 6 Sep 2005 18:57:45 -0000 1.7
@@ -1,10 +1,13 @@
-// $Header: /cvs/lcd/lcdd/include/RegionType.hh,v 1.6 2005/04/20 21:01:49 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/RegionType.hh,v 1.7 2005/09/06 18:57:45 jeremy Exp $
#ifndef RegionType_hh
#define RegionType_hh 1
+// GDML
#include "Saxana/SAXObject.h"
#include "Schema/ReferenceType.h"
+#include "Schema/ContentGroup.h"
+#include "Schema/ReferenceType.h"
/**
@class RegionType
@@ -17,7 +20,7 @@
* @class RegionType::regionref
* @brief Reference to a region element.
*/
- class regionref : public SAXObject, public ReferenceType
+ class regionref : public SAXObject, public ReferenceType
{
public:
regionref()
@@ -41,75 +44,88 @@
void set_name(const std::string& s)
{
- _name = s;
+ m_name = s;
}
void set_storeSecondaries(const std::string& s)
{
- _storeSecondaries = s;
+ m_storeSecondaries = s;
}
void set_cut(const std::string& s)
{
- _cut = s;
+ m_cut = s;
}
void set_lunit(const std::string& s)
{
- _lunit = s;
+ m_lunit = s;
}
void set_threshold(const std::string& s)
{
- _threshold = s;
+ m_threshold = s;
}
void set_eunit(const std::string& s)
{
- _eunit = s;
+ m_eunit = s;
}
const std::string& get_name() const
{
- return _name;
+ return m_name;
}
const std::string& get_storeSecondaries() const
{
- return _storeSecondaries;
+ return m_storeSecondaries;
}
const std::string& get_cut() const
{
- return _cut;
+ return m_cut;
}
const std::string& get_lunit() const
{
- return _lunit;
+ return m_lunit;
}
const std::string& get_threshold() const
{
- return _threshold;
+ return m_threshold;
}
const std::string& get_eunit() const
{
- return _eunit;
+ 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:
- std::string _name;
+ ContentSequence m_sequence;
+
+ std::string m_name;
- std::string _storeSecondaries;
+ std::string m_storeSecondaries;
- std::string _cut;
- std::string _lunit;
+ std::string m_cut;
+ std::string m_lunit;
- std::string _threshold;
- std::string _eunit;
+ std::string m_threshold;
+ std::string m_eunit;
};
#endif
lcdd/schemas/lcdd/1.0
diff -u -r1.5 -r1.6
--- lcdd.xsd 31 Aug 2005 20:32:46 -0000 1.5
+++ lcdd.xsd 6 Sep 2005 18:57:45 -0000 1.6
@@ -30,7 +30,6 @@
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="sdref" type="ReferenceType"/>
<xs:element minOccurs="0" maxOccurs="1" name="regionref" type="ReferenceType"/>
-<!-- <xs:element minOccurs="0" maxOccurs="1" name="limitref" type="ReferenceType"/> -->
<xs:element minOccurs="0" maxOccurs="1" name="limitsetref" type="ReferenceType"/>
<xs:element minOccurs="0" maxOccurs="1" name="visref" type="ReferenceType" />
</xs:sequence>
lcdd/schemas/lcdd/1.0
diff -u -r1.1 -r1.2
--- lcdd_regions.xsd 29 Aug 2005 17:26:14 -0000 1.1
+++ lcdd_regions.xsd 6 Sep 2005 18:57:45 -0000 1.2
@@ -6,6 +6,8 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0/">
+ <xs:include schemaLocation="lcdd_limits.xsd" />
+
<xs:complexType name="RegionsType">
<xs:annotation>
<xs:documentation>
@@ -20,6 +22,9 @@
</xs:element>
<xs:complexType name="RegionType">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="limitsetref" type="ReferenceType" />
+ </xs:sequence>
<xs:attribute name="name" type="xs:ID" use="required"/>
<xs:attribute name="store_secondaries" default="false" type="xs:boolean" />
<xs:attribute name="cut" default="1.0" type="xs:double"/>
lcdd/src
diff -u -r1.6 -r1.7
--- regionProcess.cc 26 Apr 2005 18:33:17 -0000 1.6
+++ regionProcess.cc 6 Sep 2005 18:57:45 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/regionProcess.cc,v 1.6 2005/04/26 18:33:17 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/regionProcess.cc,v 1.7 2005/09/06 18:57:45 jeremy Exp $
#include "Saxana/ProcessingConfigurator.h"
#include "Saxana/ProcessingContext.h"
#include "Saxana/SAXProcessor.h"
@@ -38,7 +38,7 @@
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" ) );
@@ -56,8 +56,11 @@
virtual void Characters(const std::string&)
{}
- virtual void StackPopNotify(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
{
lcdd/src
diff -u -r1.10 -r1.11
--- regionSubscriber.cc 22 Apr 2005 18:39:07 -0000 1.10
+++ regionSubscriber.cc 6 Sep 2005 18:57:45 -0000 1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/regionSubscriber.cc,v 1.10 2005/04/22 18:39:07 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/regionSubscriber.cc,v 1.11 2005/09/06 18:57:45 jeremy Exp $
// GDML
#include "Saxana/SAXSubscriber.h"
@@ -9,12 +9,11 @@
// LCDD
#include "region.hh"
-
#include "LCDDProcessor.hh"
-
#include "G4Region.hh"
#include "G4UserRegionInformation.hh"
#include "G4ProductionCuts.hh"
+#include "LimitSetType.hh"
#include "StringUtil.hh"
@@ -42,9 +41,10 @@
virtual void Activate(const SAXObject* object)
{
- //std::cout << "regionSubscriber" << std::endl;
-
if (object !=0 ) {
+
+ LCDDProcessor* proc = LCDDProcessor::instance();
+
const region* robj = dynamic_cast<const region*>( object );
GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
@@ -65,7 +65,7 @@
double threshold = calc->Eval( sval );
// set production cut
- std::string store_seco = robj->get_storeSecondaries();
+ std::string store_seco = robj->get_storeSecondaries();
G4ProductionCuts* prod_cuts = new G4ProductionCuts();
prod_cuts->SetProductionCut( cut );
reg->SetProductionCuts( prod_cuts );
@@ -82,16 +82,44 @@
// set info in region
reg->SetUserInformation( reg_info );
+ // get content
+ const ContentSequence* seq = robj->get_content();
+
+ // get size of content
+ size_t count = seq->size();
+
+ // iterate over and process content
+ for ( size_t i =0; i < count; i++ ) {
+
+ if ( seq->content(i).tag == "limitsetref" ) {
+
+ LimitSetType::limitsetref* limitsetref =
+ dynamic_cast<LimitSetType::limitsetref*> ( seq->content(i).object );
+
+ G4UserLimits* ulim =
+ dynamic_cast<G4LimitSet*> ( proc->getLimitSet( limitsetref->get_ref() ) );
+
+ if ( ulim ) {
+ reg->SetUserLimits( ulim );
+ std::cout << "Set user limits <" << limitsetref->get_ref() << "> on region <" << name << ">" << std::endl;
+ }
+ else {
+ std::cerr << "FATAL ERROR: limit element not found - " << limitsetref->get_ref() << std::endl;
+ G4Exception( "limitsetref not found." );
+ }
+ }
+ else {
+ std::cerr << "Bad content to region tag: " << seq->content(i).tag << std::endl;
+ }
+ }
+
// register with processor
- //std::cout << "adding region: " << name << std::endl;
LCDDProcessor::instance()->addRegion( name, reg );
}
else {
std::cerr << "Failed cast to region!" << std::endl;
- }
+ }
}
-
- //delete object;
}
};
lcdd/src
diff -u -r1.6 -r1.7
--- volumeExtendedProcess.cc 20 Apr 2005 19:04:41 -0000 1.6
+++ volumeExtendedProcess.cc 6 Sep 2005 18:57:46 -0000 1.7
@@ -1,5 +1,5 @@
-// $Header: /cvs/lcd/lcdd/src/volumeExtendedProcess.cc,v 1.6 2005/04/20 19:04:41 jeremy Exp $
-#ifndef VolumeExtendedProcess_hh
+// $Header: /cvs/lcd/lcdd/src/volumeExtendedProcess.cc,v 1.7 2005/09/06 18:57:46 jeremy Exp $
+#ifndef VolumeExtendedProcess_hh
#define VolumeExtendedProcess_hh 1
#include "Saxana/ProcessingConfigurator.h"
@@ -15,8 +15,8 @@
/**
@class volumeExtendedProcess
@brief SAX process for the volume element, as extended by LCDD.
- @note This is mostly a cut and paste job of volumeProcess,
- as this class does not appear to be extendable. It is
+ @note This is mostly a cut and paste job of volumeProcess,
+ as this class does not appear to be extendable. It is
only defined in a cpp file with no include guards!
*/
class volumeExtendedProcess : public SAXStateProcess
@@ -25,10 +25,10 @@
volumeExtendedProcess( const ProcessingContext* context = 0 )
: SAXStateProcess( context ), m_obj( 0 ) {
}
-
+
virtual ~volumeExtendedProcess() {
}
-
+
virtual const SAXComponentObject* Build() const {
return this;
}
@@ -39,30 +39,28 @@
{
//std::cout << "VOLUME EXTENDED PROCESS::START OF TAG : " << name << std::endl;
SAXObject** obj = Context()->GetTopObject();
-
+
volume* vo = new volume;
-
+
vo->set_name( attrs.getValue( "name" ) );
m_obj = vo;
*obj = vo;
-
- //std::cout << "object ptr: " << m_obj << std::endl;
}
virtual void EndElement( const std::string& ) {
//std::cout << "PROCESS::END OF TAG : " << name << " " << std::endl;
}
-
+
virtual void Characters( const std::string& ) {
}
-
+
virtual void StackPopNotify( const std::string& name ) {
SAXObject** so = Context()->GetTopObject();
volume* vobj = dynamic_cast<volume*>( m_obj );
vobj->add_content( name, *so );
}
-
+
// The name of the state this object will process
virtual const std::string& State() const
{
@@ -76,11 +74,11 @@
public:
static SAXObject* m_volumeSaved;
-
+
};
DECLARE_PROCESS_FACTORY(volumeExtendedProcess)
#endif
-
-
+
+
lcdd/src
diff -u -r1.26 -r1.27
--- volumeExtendedSubscriber.cc 9 Jul 2005 00:25:58 -0000 1.26
+++ volumeExtendedSubscriber.cc 6 Sep 2005 18:57:46 -0000 1.27
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/volumeExtendedSubscriber.cc,v 1.26 2005/07/09 00:25:58 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/volumeExtendedSubscriber.cc,v 1.27 2005/09/06 18:57:46 jeremy Exp $
// GDML
#include "Saxana/SAXSubscriber.h"
@@ -26,7 +26,6 @@
#include "G4LogicalVolume.hh"
#include "G4Region.hh"
#include "G4VisAttributes.hh"
-//#include "G4UserLimits.hh"
// std
#include <iostream>
@@ -134,6 +133,7 @@
if ( ulim ) {
lv->SetUserLimits( ulim );
+ std::cout << "Set user limits <" << limitsetref->get_ref() << "> on logical volume <" << lv->GetName() << ">" << std::endl;
}
else {
std::cerr << "FATAL ERROR: limit element not found - " << limitsetref->get_ref() << std::endl;
CVSspam 0.2.8