lcdd/include
diff -u -r1.8 -r1.9
--- G4UserRegionInformation.hh 18 Dec 2006 22:49:01 -0000 1.8
+++ G4UserRegionInformation.hh 15 Oct 2009 00:08:24 -0000 1.9
@@ -1,4 +1,4 @@
-//$Header: /cvs/lcd/lcdd/include/G4UserRegionInformation.hh,v 1.8 2006/12/18 22:49:01 jeremy Exp $
+//$Header: /cvs/lcd/lcdd/include/G4UserRegionInformation.hh,v 1.9 2009/10/15 00:08:24 jeremy Exp $
#ifndef LCDD_G4USERREGIONINFORMATION_HH
#define LCDD_G4USERREGIONINFORMATION_HH 1
@@ -16,66 +16,66 @@
*/
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() );
- }
+ 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
- {}
+ void Print() const
+ {}
-private:
+ private:
- bool _storeSecondaries;
+ bool _storeSecondaries;
- G4double _threshold;
+ G4double _threshold;
};
#endif
lcdd/src
diff -u -r1.13 -r1.14
--- regionSubscriber.cc 12 Jul 2007 18:09:01 -0000 1.13
+++ regionSubscriber.cc 15 Oct 2009 00:08:24 -0000 1.14
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/regionSubscriber.cc,v 1.13 2007/07/12 18:09:01 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/regionSubscriber.cc,v 1.14 2009/10/15 00:08:24 jeremy Exp $
// GDML
#include "Saxana/SAXSubscriber.h"
@@ -26,104 +26,105 @@
*/
class regionSubscriber : virtual public SAXSubscriber
{
-public:
- virtual const SAXComponentObject* Build() const
- {
- return this;
- }
+ public:
+ virtual const SAXComponentObject* Build() const
+ {
+ return this;
+ }
-public:
- regionSubscriber()
- {
- Subscribe("region");
- }
+ public:
+ regionSubscriber()
+ {
+ Subscribe("region");
+ }
- virtual void Activate(const SAXObject* object)
- {
- if (object !=0 ) {
+ virtual void Activate(const SAXObject* object)
+ {
+ if (object !=0 ) {
- LCDDProcessor* proc = LCDDProcessor::instance();
+ LCDDProcessor* proc = LCDDProcessor::instance();
- const region* robj = dynamic_cast<const region*>( object );
+ const region* robj = dynamic_cast<const region*>( object );
- GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
- G4Region* reg = 0;
- if ( robj ) {
- std::string name = robj->get_name();
- reg = new G4Region( name );
+ GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
+ G4Region* reg = 0;
+ if ( robj ) {
+ std::string name = robj->get_name();
+ reg = new G4Region( name );
- // compute prod cut
- std::string lunit = robj->get_lunit();
- std::string sval = robj->get_cut();
- sval += "*" + lunit;
- double cut = calc->Eval( sval );
+ // compute prod cut
+ std::string lunit = robj->get_lunit();
+ std::string sval = robj->get_cut();
+ sval += "*" + lunit;
+ double cut = calc->Eval( sval );
- std::string eunit = robj->get_eunit();
- sval = robj->get_threshold();
- sval += "*" + eunit;
- double threshold = calc->Eval( sval );
+ std::string eunit = robj->get_eunit();
+ sval = robj->get_threshold();
+ sval += "*" + eunit;
+ double threshold = calc->Eval( sval );
- // set production cut
- std::string store_seco = robj->get_storeSecondaries();
- G4ProductionCuts* prod_cuts = new G4ProductionCuts();
- prod_cuts->SetProductionCut( cut );
- reg->SetProductionCuts( prod_cuts );
+ // set production cut
+ std::string store_seco = robj->get_storeSecondaries();
+ G4ProductionCuts* prod_cuts = new G4ProductionCuts();
+ prod_cuts->SetProductionCut( cut );
+ reg->SetProductionCuts( prod_cuts );
- // create region info with storeSecondaries flag
- G4UserRegionInformation* reg_info = new G4UserRegionInformation();
+ // create region info with storeSecondaries flag
+ G4UserRegionInformation* reg_info = new G4UserRegionInformation();
- // set storeSeco
- reg_info->setStoreSecondaries( StringUtil::toBool( store_seco ) );
+ // set storeSeco
+ reg_info->setStoreSecondaries( StringUtil::toBool( store_seco ) );
- // set threshold
- reg_info->setThreshold( threshold );
+ // set threshold
+ reg_info->setThreshold( threshold );
- // set info in region
- reg->SetUserInformation( reg_info );
+ // set info in region
+ reg->SetUserInformation( reg_info );
- // get content
- const ContentSequence* seq = robj->get_content();
+ // get content
+ const ContentSequence* seq = robj->get_content();
- // get size of content
- size_t count = seq->size();
+ // get size of content
+ size_t count = seq->size();
- // iterate over and process content
- for ( size_t i =0; i < count; i++ ) {
+ // iterate over and process content
+ for ( size_t i =0; i < count; i++ ) {
- if ( seq->content(i).tag == "limitsetref" ) {
+ if ( seq->content(i).tag == "limitsetref" ) {
- LimitSetType::limitsetref* limitsetref =
- dynamic_cast<LimitSetType::limitsetref*> ( seq->content(i).object );
+ LimitSetType::limitsetref* limitsetref =
+ dynamic_cast<LimitSetType::limitsetref*> ( seq->content(i).object );
- G4UserLimits* ulim =
- dynamic_cast<G4LimitSet*> ( proc->getLimitSet( limitsetref->get_ref() ) );
+ G4UserLimits* ulim =
+ dynamic_cast<G4LimitSet*> ( proc->getLimitSet( limitsetref->get_ref() ) );
- if ( ulim ) {
+ if ( ulim ) {
#ifdef HAVE_G4REGION_SETUSERLIMITS
- reg->SetUserLimits( ulim );
- std::cout << "Set user limits <" << limitsetref->get_ref() << "> on region <" << name << ">" << std::endl;
+ reg->SetUserLimits( ulim );
+ std::cout << "Set user limits <" << limitsetref->get_ref() << "> on region <" << name << ">" << std::endl;
#else
- std::cerr << "WARNING: Ignoring limitsetref on region. The method G4Region::SetUserLimits is not supported by your Geant4 version." << std::endl;
+ std::cerr << "WARNING: Ignoring limitsetref on region. The method G4Region::SetUserLimits is not supported by your Geant4 version." << std::endl;
#endif
- }
- 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
- LCDDProcessor::instance()->addRegion( name, reg );
- }
- else {
- std::cerr << "Failed cast to region!" << 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
+ LCDDProcessor::instance()->addRegion( name, reg );
+ }
+ else
+ {
+ std::cerr << "Failed cast to region!" << std::endl;
+ }
+ }
+ }
};
DECLARE_SUBSCRIBER_FACTORY(regionSubscriber)