本文整理汇总了C++中KVDetector::GetEntranceWindowMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ KVDetector::GetEntranceWindowMatrix方法的具体用法?C++ KVDetector::GetEntranceWindowMatrix怎么用?C++ KVDetector::GetEntranceWindowMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KVDetector
的用法示例。
在下文中一共展示了KVDetector::GetEntranceWindowMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCurrentDetector
KVDetector* KVGeoImport::GetCurrentDetector()
{
// Returns pointer to KVDetector corresponding to current location
// in geometry. Detector is created and added to array if needed.
// We also set up any geometry structure elements (from nodes beginning with "STRUCT_")
KVString detector_name;
Bool_t multilay;
TGeoVolume* detector_volume = GetCurrentDetectorNameAndVolume(detector_name,multilay);
// failed to identify current volume as part of a detector
if(!detector_volume) return 0;
// has detector already been built ? if not, do it now
KVDetector* det = fArray->GetDetector(detector_name);
if(!fCreateArray){
if(det){
// set matrix & shape for entrance window if not done yet
if(!det->GetEntranceWindowMatrix()){
det->SetEntranceWindowMatrix(GetCurrentMatrix());
det->SetEntranceWindowShape((TGeoBBox*)GetCurrentVolume()->GetShape());
}
TString vol_name(GetCurrentVolume()->GetName());
if(!multilay || vol_name.BeginsWith("ACTIVE_")){
// set matrix & shape for active layer
det->SetActiveLayerMatrix(GetCurrentMatrix());
det->SetActiveLayerShape((TGeoBBox*)GetCurrentVolume()->GetShape());
}
}
}
else
{
if(!det) {
det = BuildDetector(detector_name, detector_volume);
if(det) {
// Setting the entrance window shape and matrix
// ============================================
// for consistency, the matrix and shape MUST correspond
// i.e. we cannot have the matrix corresponding to the entrance window
// of a multilayer detector and the shape corresponding to the
// whole detector (all layers) - otherwise, calculation of points
// on detector entrance window will be false!
// Info("GetCurrentDetector","Setting EW matrix to current matrix:");
// GetCurrentMatrix()->Print();
det->SetEntranceWindowMatrix(GetCurrentMatrix());
det->SetEntranceWindowShape((TGeoBBox*)GetCurrentVolume()->GetShape());
TString vol_name(GetCurrentVolume()->GetName());
if(!multilay || vol_name.BeginsWith("ACTIVE_")){
// first layer of detector (or only layer) is also active layer
// Info("GetCurrentDetector","and also setting active layer matrix to current matrix:");
// GetCurrentMatrix()->Print();
det->SetActiveLayerMatrix(GetCurrentMatrix());
det->SetActiveLayerShape((TGeoBBox*)GetCurrentVolume()->GetShape());
}
fArray->Add(det);
Int_t nstruc = CurrentStructures().GetEntries();
if(nstruc){
// Build and add geometry structure elements
KVGeoStrucElement* ELEM = fArray;
for(register int i=0;i<nstruc;i++){
KVGeoStrucElement* elem = (KVGeoStrucElement*)CurrentStructures()[i];
KVGeoStrucElement* nextELEM = ELEM->GetStructure(elem->GetName());
if(!nextELEM){
// make new structure
nextELEM = new KVGeoStrucElement(elem->GetName(), elem->GetType());
nextELEM->SetNumber(elem->GetNumber());
ELEM->Add(nextELEM);
}
ELEM=nextELEM;
}
// add detector to last structure
ELEM->Add(det);
}
}
}
else
{
// Detector already built, are we now in its active layer ?
TString vol_name(GetCurrentVolume()->GetName());
if(!multilay || vol_name.BeginsWith("ACTIVE_")){
// Info("GetCurrentDetector","Setting active layer matrix to current matrix:");
// GetCurrentMatrix()->Print();
det->SetActiveLayerMatrix(GetCurrentMatrix());
det->SetActiveLayerShape((TGeoBBox*)GetCurrentVolume()->GetShape());
}
}
}
return det;
}