本文整理汇总了C++中PlacedVolume::ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ PlacedVolume::ptr方法的具体用法?C++ PlacedVolume::ptr怎么用?C++ PlacedVolume::ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlacedVolume
的用法示例。
在下文中一共展示了PlacedVolume::ptr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump
static long dump(DetElement de,int level, bool sensitive_only) {
const DetElement::Children& c = de.children();
if ( !sensitive_only || 0 != de.volumeID() ) {
PlacedVolume place = de.placement();
const TGeoNode* node = place.ptr();
char sens = place.volume().isSensitive() ? 'S' : ' ';
int value = flag;
char fmt[128];
switch(value) {
case 0:
::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s #Dau:%%d VolID:%%08X Place:%%p %%c",level+1,2*level+1);
printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(c.size()),
(unsigned long)de.volumeID(), (void*)node, sens);
break;
case 1:
::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Detector: %%s #Dau:%%d VolID:%%p",level+1,2*level+1);
printout(INFO,"DetectorDump", fmt, "", de.path().c_str(),
int(c.size()), (void*)de.volumeID());
::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Placement: %%s %%c",level+1,2*level+3);
printout(INFO,"DetectorDump",fmt,"", de.placementPath().c_str(), sens);
break;
default:
break;
}
}
for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i)
dump((*i).second,level+1,sensitive_only);
return 1;
}
示例2: dump_volume_tree
/** Basic entry point to print out the volume hierarchy
*
* @author M.Frank
* @version 1.0
* @date 01/04/2014
*/
static long dump_volume_tree(LCDD& lcdd, int argc, char** argv) {
struct Actor {
typedef PlacedVolume::VolID VID;
typedef PlacedVolume::VolIDs VIDs;
bool m_printVolIDs;
bool m_printPositions;
bool m_printSensitivesOnly;
Actor(int ac, char** av)
: m_printVolIDs(false), m_printPositions(false), m_printSensitivesOnly(false)
{
for(int i=0; i<ac; ++i) {
char c = ::tolower(av[i][0]);
if ( c == 'v' ) m_printVolIDs = true;
else if ( c == 'p' ) m_printPositions = true;
else if ( c == 's' ) m_printSensitivesOnly = true;
}
}
long dump(TGeoNode* ideal, TGeoNode* aligned,int level, VIDs volids) const {
char fmt[128];
string opt_info;
PlacedVolume pv(ideal);
bool sensitive = false;
if ( m_printPositions || m_printVolIDs ) {
stringstream log;
if ( m_printPositions ) {
const double* trans = ideal->GetMatrix()->GetTranslation();
::snprintf(fmt, sizeof(fmt), "Pos: (%f,%f,%f) ",trans[0],trans[1],trans[2]);
log << fmt;
}
// Top level volume! have no volume ids
if ( m_printVolIDs && ideal && ideal->GetMotherVolume() ) {
VIDs vid = pv.volIDs();
if ( !vid.empty() ) {
sensitive = true;
log << " VolID: ";
volids.std::vector<VID>::insert(volids.end(),vid.begin(),vid.end());
for(VIDs::const_iterator i=volids.begin(); i!=volids.end(); ++i) {
::snprintf(fmt, sizeof(fmt), "%s:%2d ",(*i).first.c_str(), (*i).second);
log << fmt;
}
}
}
opt_info = log.str();
}
TGeoVolume* volume = ideal->GetVolume();
if ( !m_printSensitivesOnly || (m_printSensitivesOnly && sensitive) ) {
char sens = pv.volume().isSensitive() ? 'S' : ' ';
if ( ideal == aligned ) {
::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s (%%s: %%s) \t[%p] %c %%s",
level+1,2*level+1,(void*)ideal, sens);
}
else {
::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s (%%s: %%s) Ideal:%p Aligned:%p %c %%s",
level+1,2*level+1,(void*)ideal,(void*)aligned, sens);
}
printout(INFO,"+++",fmt,"",
aligned->GetName(),
volume->GetTitle(),
volume->GetShape()->IsA()->GetName(),
opt_info.c_str());
}
for (Int_t idau = 0, ndau = aligned->GetNdaughters(); idau < ndau; ++idau) {
TGeoNode* ideal_daughter = ideal->GetDaughter(idau);
const char* daughter_name = ideal_daughter->GetName();
TGeoNode* aligned_daughter = volume->GetNode(daughter_name);
dump(ideal_daughter, aligned_daughter, level+1, volids);
}
return 1;
}
};
string place = lcdd.world().placementPath();
DetectorTools::PlacementPath path;
DetectorTools::placementPath(lcdd.world(), path);
PlacedVolume pv = DetectorTools::findNode(lcdd.world().placement(),place);
Actor actor(argc,argv);
return actor.dump(lcdd.world().placement().ptr(),pv.ptr(),0,PlacedVolume::VolIDs());
}