本文整理汇总了C++中PlacedVolume::volume方法的典型用法代码示例。如果您正苦于以下问题:C++ PlacedVolume::volume方法的具体用法?C++ PlacedVolume::volume怎么用?C++ PlacedVolume::volume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlacedVolume
的用法示例。
在下文中一共展示了PlacedVolume::volume方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
/// Callback to output PlacedVolume information of an single Placement
int VisDensityProcessor::operator()(PlacedVolume pv, int /* level */) {
Volume vol = pv.volume();
Material mat = vol.material();
if ( vol.visAttributes().ptr() != minVis.ptr() ) {
if ( mat.density() <= minDensity ) {
vol.setVisAttributes(minVis);
}
++numInactive;
}
return 1;
}
示例2: operator
/// Callback to output PlacedVolume information of an single Placement
int VisMaterialProcessor::operator()(PlacedVolume pv, int /* level */) {
Volume vol = pv.volume();
double frac_active = 0.0;
VisAttr attr;
for ( Atom atom : activeElements ) {
frac_active += vol.material().fraction(atom);
}
//if ( frac_active >= fraction )
printout(DEBUG,name,
"++ Volume:%s [%s] active:%s fraction:%.3f active-vis:%s inactive-vis:%s",
pv.name(), vol.name(), yes_no(frac_active >= fraction), frac_active,
yes_no(activeVis.isValid()), yes_no(inactiveVis.isValid()));
if ( activeVis.isValid() ) {
if ( frac_active >= fraction ) {
attr = activeVis;
++numActive;
}
if ( !attr.isValid() ) {
for ( Material mat : activeMaterials ) {
if ( mat.ptr() == vol.material().ptr() ) {
attr = activeVis;
++numActive;
break;
}
}
}
}
// If we get here, the material is definitely inactive
if ( inactiveVis.isValid() ) {
if ( !attr.isValid() && setAllInactive ) {
attr = inactiveVis;
++numInactive;
}
else if ( frac_active<fraction ) {
attr = inactiveVis;
++numInactive;
}
if ( !attr.isValid() && inactiveVis.isValid() ) {
for ( Material imat : inactiveMaterials ) {
if ( imat.ptr() == vol.material().ptr() ) {
attr = inactiveVis;
++numInactive;
break;
}
}
}
}
if ( attr.isValid() ) {
set_attr(vol,attr);
}
return 1;
}
示例3: operator
/// Dump method.
virtual int operator()(DetElement de,int level) const {
const DetElement::Children& children = de.children();
PlacedVolume place = de.placement();
char sens = place.volume().isSensitive() ? 'S' : ' ';
char fmt[128], tmp[32];
::snprintf(tmp,sizeof(tmp),"%03d/",level+1);
::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s #Dau:%%d VolID:%%08X %%c",level+1,2*level+1);
printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(children.size()),
(unsigned long)de.volumeID(), sens);
printer.prefix = string(tmp)+de.name();
(printer)(de, level);
return 1;
}
示例4: if
/// Accessfully decoded volume fields by placement path
void Geant4VolumeManager::volumeDescriptor(const vector<const G4VPhysicalVolume*>& path,
VolIDDescriptor& vol_desc) const
{
vol_desc.second.clear();
vol_desc.first = NonExisting;
if (!path.empty() && checkValidity()) {
const auto& m = ptr()->g4Paths;
auto i = m.find(path);
if (i != m.end()) {
VolumeID vid = (*i).second;
G4LogicalVolume* lvol = path[0]->GetLogicalVolume();
if (lvol->GetSensitiveDetector()) {
const G4VPhysicalVolume* node = path[0];
const PlacementMap& pm = ptr()->g4Placements;
for (PlacementMap::const_iterator ipm = pm.begin(); ipm != pm.end(); ++ipm) {
if ((*ipm).second == node) {
PlacedVolume pv = (*ipm).first;
SensitiveDetector sd = pv.volume().sensitiveDetector();
IDDescriptor dsc = sd.readout().idSpec();
vol_desc.first = vid;
dsc.decodeFields(vid, vol_desc.second);
return;
}
}
}
vol_desc.first = Insensitive;
return;
}
if (!path[0])
vol_desc.first = InvalidPath;
else if (!path[0]->GetLogicalVolume()->GetSensitiveDetector())
vol_desc.first = Insensitive;
else
vol_desc.first = NonExisting;
}
}
示例5: BoxTrafos
int BoxTrafos() {
string xml = "file:";
xml += gSystem->Getenv("DD4hepINSTALL");
xml += "/examples/ClientTests/compact/BoxTrafos.xml";
const char* argv[] = {xml.c_str(), "BUILD_DEFAULT", 0};
gSystem->Load("libDDCore");
LCDD& lcdd = LCDD::getInstance();
lcdd.apply("DD4hepCompactLoader",2,(char**)argv);
lcdd.apply("DD4hepGeometryDisplay",0,0);
DetElement de = lcdd.detector("B3");
PlacedVolume pv = de.placement();
Volume vol = pv.volume();
Solid solid = vol.solid();
TGeoBBox* box = (TGeoBBox*)(solid.ptr());
Position glob,loc, pos(-10,30,10);
printf("\n++++ local->world:\n\n");
loc = Position(-pos.x(),-pos.y(),-pos.z());
local_to_world("origine",de,pos,loc);
loc = Position();
local_to_world("center",de,pos,loc);
loc = Position(box->GetDX(),box->GetDY(),box->GetDZ());
local_to_world("top edge",de,pos,loc);
loc = Position(box->GetDX(),box->GetDY(),-box->GetDZ());
local_to_world("top edge",de,pos,loc);
loc = Position(-box->GetDX(),box->GetDY(),box->GetDZ());
local_to_world("top edge",de,pos,loc);
loc = Position(-box->GetDX(),box->GetDY(),-box->GetDZ());
local_to_world("top edge",de,pos,loc);
loc = Position(box->GetDX(),-box->GetDY(),box->GetDZ());
local_to_world("bottom edge",de,pos,loc);
loc = Position(box->GetDX(),-box->GetDY(),-box->GetDZ());
local_to_world("bottom edge",de,pos,loc);
loc = Position(-box->GetDX(),-box->GetDY(),box->GetDZ());
local_to_world("bottom edge",de,pos,loc);
loc = Position(-box->GetDX(),-box->GetDY(),-box->GetDZ());
local_to_world("bottom edge",de,pos,loc);
printf("\n++++ world->local:\n\n");
glob = Position(0,0,0);
world_to_local("world center",de,pos,glob);
glob = Position(pos.x(),pos.y(),pos.z());
world_to_local("position",de,pos,glob);
glob = Position( box->GetDX()+pos.x(), box->GetDY()+pos.y(), box->GetDZ()+pos.z());
world_to_local("top edge",de,pos,glob);
glob = Position( box->GetDX()+pos.x(), box->GetDY()+pos.y(), -box->GetDZ()+pos.z());
world_to_local("top edge",de,pos,glob);
glob = Position(-box->GetDX()+pos.x(), box->GetDY()+pos.y(), box->GetDZ()+pos.z());
world_to_local("top edge",de,pos,glob);
glob = Position(-box->GetDX()+pos.x(), box->GetDY()+pos.y(), -box->GetDZ()+pos.z());
world_to_local("top edge",de,pos,glob);
glob = Position( box->GetDX()+pos.x(), -box->GetDY()+pos.y(), box->GetDZ()+pos.z());
world_to_local("bottom edge",de,pos,glob);
glob = Position( box->GetDX()+pos.x(), -box->GetDY()+pos.y(), -box->GetDZ()+pos.z());
world_to_local("bottom edge",de,pos,glob);
glob = Position(-box->GetDX()+pos.x(), -box->GetDY()+pos.y(), box->GetDZ()+pos.z());
world_to_local("bottom edge",de,pos,glob);
glob = Position(-box->GetDX()+pos.x(), -box->GetDY()+pos.y(), -box->GetDZ()+pos.z());
world_to_local("bottom edge",de,pos,glob);
return 1;
}