Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExTGRCRegionCutsMgr Class Reference

#include <ExTGRCRegionCutsMgr.hh>

Public Member Functions

 ~ExTGRCRegionCutsMgr ()
 
void AddRegionData (const std::vector< G4String > &rd)
 
void AddRegionCuts (const std::vector< G4String > &rc)
 
std::vector< ExTGRCRegionData * > FindRegionData (const G4String &name)
 
void BuildRegions ()
 
void BuildProductionCuts ()
 

Static Public Member Functions

static ExTGRCRegionCutsMgrGetInstance ()
 

Detailed Description

Region cuts manager

Changes: creation May 2007

Author
P. Arce

Definition at line 44 of file ExTGRCRegionCutsMgr.hh.

Constructor & Destructor Documentation

ExTGRCRegionCutsMgr::~ExTGRCRegionCutsMgr ( )

Definition at line 60 of file ExTGRCRegionCutsMgr.cc.

61 {
62  delete fInstance;
63 }

Member Function Documentation

void ExTGRCRegionCutsMgr::AddRegionCuts ( const std::vector< G4String > &  rc)

Definition at line 80 of file ExTGRCRegionCutsMgr.cc.

81 {
82  if( rc.size() == 0 )
83  {
84  G4cerr << "ERROR - ExTGRCRegionCutsMgr::AddRegionCuts()" << G4endl
85  << " Must have 3 or 4 arguments : REGION_NAME, gamma_CUT,"
86  << " e-_CUT (e+_CUT)." << G4endl
87  << " It has only " << rc.size() << " !" << G4endl;
88  G4Exception("ExTGRCRegionCutsMgr::AddRegionCuts()", "InvalidArgument",
90  }
91 
92  // Find region
93  std::vector<ExTGRCRegionData*>::const_iterator iter;
94  std::vector<ExTGRCRegionData*> regs = FindRegionData(rc[0]);
95 
96  if( regs.size() == 0 )
97  {
98  G4Exception("ExTGRCRegionCutsMgr::AddRegionCuts()",
99  "InvalidArgument", FatalErrorInArgument,
100  G4String(" region does not exist: " + rc[0]).c_str());
101  }
102 
103  for( size_t ii = 0; ii < regs.size(); ii++)
104  {
105  regs[ii]->SetCutsData( rc );
106  }
107 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
int G4int
Definition: G4Types.hh:78
std::vector< ExTGRCRegionData * > FindRegionData(const G4String &name)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

void ExTGRCRegionCutsMgr::AddRegionData ( const std::vector< G4String > &  rd)

Definition at line 66 of file ExTGRCRegionCutsMgr.cc.

67 {
68 
69  if( (rd.size() > 1) && (FindRegionData( rd[0] ).size() != 0) )
70  {
71  G4Exception("ExTGRCRegionCutsMgr::AddRegionData", "InvalidArgument",
73  G4String("Region already exists: " + rd[0]).c_str() );
74  return;
75  }
76  fRegionDatae.push_back( new ExTGRCRegionData( rd ) );
77 }
std::vector< ExTGRCRegionData * > FindRegionData(const G4String &name)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

void ExTGRCRegionCutsMgr::BuildProductionCuts ( )

Definition at line 144 of file ExTGRCRegionCutsMgr.cc.

145 {
146  std::vector<ExTGRCRegionData*>::const_iterator iter;
148  //----- loop to region datae
149  for( iter = fRegionDatae.begin(); iter != fRegionDatae.end(); iter++ )
150  {
151  if( (*iter)->CutsAreSet() )
152  {
153  G4Region* reg = regions->GetRegion( (*iter)->GetRegionName() );
154  if( !reg )
155  {
156  G4Exception("ExTGRCRegionCutsMgr::BuildProductionCuts()",
157  "InvalidArgument", FatalErrorInArgument,
158  G4String("Region not found: " + (*iter)->GetRegionName()).c_str() );
159  }
160  G4ProductionCuts* cuts = new G4ProductionCuts ;
161 
162  cuts->SetProductionCut((*iter)->GetGammaCut(),"gamma");
163  cuts->SetProductionCut((*iter)->GetElectronCut(),"e-");
164  cuts->SetProductionCut((*iter)->GetPositronCut(),"e+");
165  reg->SetProductionCuts(cuts);
166  }
167  }
168 }
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
void SetProductionCut(G4double cut, G4int index=-1)
static const G4double reg
static G4RegionStore * GetInstance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetProductionCuts(G4ProductionCuts *cut)

Here is the call graph for this function:

Here is the caller graph for this function:

void ExTGRCRegionCutsMgr::BuildRegions ( )

Definition at line 125 of file ExTGRCRegionCutsMgr.cc.

126 {
127  std::vector<ExTGRCRegionData*>::const_iterator iter;
128  std::vector<G4String>::const_iterator ites;
129  std::vector<G4LogicalVolume*>::const_iterator itelv;
130  for( iter = fRegionDatae.begin(); iter != fRegionDatae.end(); iter++ )
131  {
132  G4Region* reg = new G4Region( (*iter)->GetRegionName() );
133  std::vector<G4String> lvs = (*iter)->GetLVNames();
134  for( ites = lvs.begin(); ites != lvs.end(); ites++ )
135  {
136  G4LogicalVolume* logVol =
137  G4tgbVolumeMgr::GetInstance()->FindG4LogVol(*ites, true );
138  reg->AddRootLogicalVolume( logVol );
139  }
140  }
141 }
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:290
static const G4double reg
static G4tgbVolumeMgr * GetInstance()
G4LogicalVolume * FindG4LogVol(const G4String &theName, const G4bool bExists=0)

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< ExTGRCRegionData * > ExTGRCRegionCutsMgr::FindRegionData ( const G4String name)

Definition at line 110 of file ExTGRCRegionCutsMgr.cc.

111 {
112  std::vector<ExTGRCRegionData*> regs;
113  std::vector<ExTGRCRegionData*>::const_iterator iter;
114  for( iter = fRegionDatae.begin(); iter != fRegionDatae.end(); iter++ )
115  {
116  if( G4tgrUtils::AreWordsEquivalent( name , (*iter)->GetRegionName()) )
117  {
118  regs.push_back(*iter);
119  }
120  }
121  return regs;
122 }
static G4bool AreWordsEquivalent(const G4String &word1, const G4String &word2)
Definition: G4tgrUtils.cc:672

Here is the call graph for this function:

Here is the caller graph for this function:

ExTGRCRegionCutsMgr * ExTGRCRegionCutsMgr::GetInstance ( void  )
static

Definition at line 45 of file ExTGRCRegionCutsMgr.cc.

46 {
47  if( !fInstance )
48  {
49  fInstance = new ExTGRCRegionCutsMgr;
50  }
51  return fInstance;
52 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files: