ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
RegionCreator Class Referencefinal

#include "G4AtlasTools/RegionCreator.h"

Inheritance diagram for RegionCreator:
Collaboration diagram for RegionCreator:

Public Member Functions

 RegionCreator (const std::string &type, const std::string &name, const IInterface *parent)
 
 ~RegionCreator ()
 
virtual StatusCode initialize () override
 
void Dump () override
 
void Construct () override
 

Private Attributes

Gaudi::Property< std::string > m_regionName {this, "RegionName", "", "Region name (same as the Tool name if not set)"}
 
Gaudi::Property< double > m_gammaCut {this, "GammaCut", 1.*Gaudi::Units::mm, "Cut to be applied for gammas"}
 
Gaudi::Property< double > m_electronCut {this, "ElectronCut", 1., "Cut to be applied for electrons"}
 
Gaudi::Property< double > m_positronCut {this, "PositronCut", 1., "Cut to be applied for positrons"}
 
Gaudi::Property< double > m_protonCut {this, "ProtonCut", 1., "Cut to be applied for gammas"}
 
Gaudi::Property< std::vector< std::string > > m_logicalVolumes {this, "VolumeList", {}, "List of volumes to be included in this region"}
 
BooleanProperty m_dumpRegion {this, "DumpRegion", false, ""}
 

Detailed Description

Concrete Tool to create G4 Physics Regions

Author
ADA
Date
2015-03-23

Definition at line 25 of file RegionCreator.h.

Constructor & Destructor Documentation

◆ RegionCreator()

RegionCreator::RegionCreator ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 15 of file RegionCreator.cxx.

16  : base_class(type,name,parent)
17 {
18 }

◆ ~RegionCreator()

RegionCreator::~RegionCreator ( )
inline

Definition at line 29 of file RegionCreator.h.

29 {}

Member Function Documentation

◆ Construct()

void RegionCreator::Construct ( )
override

Definition at line 38 of file RegionCreator.cxx.

39 {
40  //create a new G4Region
41  G4Region* theRegion=new G4Region(m_regionName.value());
42 
43  // loop over volumes and fish for those in the list
44  size_t nVolumes{0};
45  G4LogicalVolumeStore* logStore=G4LogicalVolumeStore::GetInstance();
46  for (const auto& vol: m_logicalVolumes) {
47  size_t nVolumesCurrent{0};
48  for (auto* it: *logStore)
49  {
50 
51  if (vol == static_cast<const std::string&>(it->GetName()))
52  {
53  nVolumesCurrent++;
54  it->SetRegion(theRegion);
55  theRegion->AddRootLogicalVolume(it);
56  }
57  }
58  if (nVolumesCurrent==0) {
59  ATH_MSG_WARNING("No volumes matching \"" << vol << "\" found in G4 LogicalVolumeStore. " << m_regionName.value() << " G4PhysicsRegion may not behave as intended.");
60  }
61  nVolumes += nVolumesCurrent;
62  }
63 
64  if (m_dumpRegion) { ATH_MSG_INFO("A total of "<<nVolumes<<" volumes was assigned to region "<<m_regionName.value() ); }
65 
66  // create a G4ProductionCuts object and set appropriate values
67  G4ProductionCuts* cuts=new G4ProductionCuts();
68  cuts->SetProductionCut(m_gammaCut,"gamma");
69  cuts->SetProductionCut(m_electronCut,"e-");
70  cuts->SetProductionCut(m_positronCut,"e+");
71  cuts->SetProductionCut(m_protonCut,"proton");
72 
73  // assign cuts to the region and return succesfully
74  theRegion->SetProductionCuts(cuts);
75 
76  if (m_dumpRegion) { Dump(); }
77 }

◆ Dump()

void RegionCreator::Dump ( )
override

Definition at line 79 of file RegionCreator.cxx.

80 {
81  ATH_MSG_INFO("+----------------------------------------------------+");
82  ATH_MSG_INFO(" ");
83  ATH_MSG_INFO(" Dump of region "<<m_regionName.value());
84  ATH_MSG_INFO(" Volumes being assigned to this region:");
85  for (const auto& vol: m_logicalVolumes)
86  {
87  ATH_MSG_INFO(" "<<vol);
88  }
89  ATH_MSG_INFO(" ");
90  ATH_MSG_INFO(" Cuts selected for this region:");
91  ATH_MSG_INFO(" Gamma ="<<m_gammaCut);
92  ATH_MSG_INFO(" Electron ="<<m_electronCut);
93  ATH_MSG_INFO(" Positron ="<<m_positronCut);
94  ATH_MSG_INFO(" Proton ="<<m_protonCut);
95  ATH_MSG_INFO(" ");
96  ATH_MSG_INFO("+----------------------------------------------------+");
97 }

◆ initialize()

StatusCode RegionCreator::initialize ( )
overridevirtual

Definition at line 21 of file RegionCreator.cxx.

22 {
23  ATH_MSG_VERBOSE(" initializing RegionCreator "<<name() );
24  if (m_regionName.empty()) {
25  m_regionName = this->name();
26  // re-initialize m_regionName in order to take the real tool name rather than the path to it
27  size_t ipos=m_regionName.value().find_last_of('.');
28  size_t length=m_regionName.value().size();
29  if (ipos<length) {
30  ATH_MSG_VERBOSE( "m_regionName: " << m_regionName.value() << " needs to be reset.");
31  m_regionName=m_regionName.value().substr(ipos+1,length-ipos-1);
32  }
33  ATH_MSG_VERBOSE( "m_regionName default value reset to "<<m_regionName.value());
34  }
35  return StatusCode::SUCCESS;
36 }

Member Data Documentation

◆ m_dumpRegion

BooleanProperty RegionCreator::m_dumpRegion {this, "DumpRegion", false, ""}
private

Definition at line 44 of file RegionCreator.h.

◆ m_electronCut

Gaudi::Property<double> RegionCreator::m_electronCut {this, "ElectronCut", 1., "Cut to be applied for electrons"}
private

Definition at line 40 of file RegionCreator.h.

◆ m_gammaCut

Gaudi::Property<double> RegionCreator::m_gammaCut {this, "GammaCut", 1.*Gaudi::Units::mm, "Cut to be applied for gammas"}
private

Definition at line 39 of file RegionCreator.h.

◆ m_logicalVolumes

Gaudi::Property<std::vector<std::string> > RegionCreator::m_logicalVolumes {this, "VolumeList", {}, "List of volumes to be included in this region"}
private

Definition at line 43 of file RegionCreator.h.

◆ m_positronCut

Gaudi::Property<double> RegionCreator::m_positronCut {this, "PositronCut", 1., "Cut to be applied for positrons"}
private

Definition at line 41 of file RegionCreator.h.

◆ m_protonCut

Gaudi::Property<double> RegionCreator::m_protonCut {this, "ProtonCut", 1., "Cut to be applied for gammas"}
private

Definition at line 42 of file RegionCreator.h.

◆ m_regionName

Gaudi::Property<std::string> RegionCreator::m_regionName {this, "RegionName", "", "Region name (same as the Tool name if not set)"}
private

Definition at line 38 of file RegionCreator.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
skel.it
it
Definition: skel.GENtoEVGEN.py:396
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
RegionCreator::m_positronCut
Gaudi::Property< double > m_positronCut
Definition: RegionCreator.h:41
RegionCreator::m_electronCut
Gaudi::Property< double > m_electronCut
Definition: RegionCreator.h:40
plotBeamSpotVert.cuts
string cuts
Definition: plotBeamSpotVert.py:93
test_pyathena.parent
parent
Definition: test_pyathena.py:15
RegionCreator::m_gammaCut
Gaudi::Property< double > m_gammaCut
Definition: RegionCreator.h:39
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
RegionCreator::m_logicalVolumes
Gaudi::Property< std::vector< std::string > > m_logicalVolumes
Definition: RegionCreator.h:43
RegionCreator::m_regionName
Gaudi::Property< std::string > m_regionName
Definition: RegionCreator.h:38
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RegionCreator::m_protonCut
Gaudi::Property< double > m_protonCut
Definition: RegionCreator.h:42
RegionCreator::Dump
void Dump() override
Definition: RegionCreator.cxx:79
RegionCreator::m_dumpRegion
BooleanProperty m_dumpRegion
Definition: RegionCreator.h:44
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26