本文整理汇总了C++中Segmentation::segmentation方法的典型用法代码示例。如果您正苦于以下问题:C++ Segmentation::segmentation方法的具体用法?C++ Segmentation::segmentation怎么用?C++ Segmentation::segmentation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Segmentation
的用法示例。
在下文中一共展示了Segmentation::segmentation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_detector
static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDetector sens) {
static double tolerance = 0e0;
xml_det_t x_det = element;
string det_name = x_det.nameStr();
Layering layering (element);
Material air = theDetector.air();
//unused: Material vacuum = theDetector.vacuum();
int det_id = x_det.id();
xml_comp_t x_staves = x_det.staves();
DetElement sdet (det_name,det_id);
xml_comp_t x_dim = x_det.dimensions();
int nsides = x_dim.numsides();
double dphi = (2*M_PI/nsides);
double hphi = dphi/2;
// --- create an envelope volume and position it into the world ---------------------
Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, element , sdet ) ;
dd4hep::xml::setDetectorTypeFlag( element, sdet ) ;
if( theDetector.buildType() == BUILD_ENVELOPE ) return sdet ;
//-----------------------------------------------------------------------------------
sens.setType("calorimeter");
Material stave_material = theDetector.material(x_staves.materialStr());
DetElement stave_det("module0stave0",det_id);
Readout readout = sens.readout();
Segmentation seg = readout.segmentation();
// check if we have a WaferGridXY segmentation :
WaferGridXY* waferSeg =
dynamic_cast< WaferGridXY*>( seg.segmentation() ) ;
std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); //Assume uniform cell sizes, provide dummy cellID
double cell_sizeX = cellSizeVector[0];
double cell_sizeY = cellSizeVector[1];
//====================================================================
//
// Read all the constant from ILD_o1_v05.xml
// Use them to build HcalBarrel
//
//====================================================================
int N_FIBERS_W_STRUCTURE = 2;
int N_FIBERS_ALVOULUS = 3;
// read parametere from compact.xml file
double Ecal_Alveolus_Air_Gap = theDetector.constant<double>("Ecal_Alveolus_Air_Gap");
double Ecal_Slab_shielding = theDetector.constant<double>("Ecal_Slab_shielding");
double Ecal_Slab_copper_thickness = theDetector.constant<double>("Ecal_Slab_copper_thickness");
double Ecal_Slab_PCB_thickness = theDetector.constant<double>("Ecal_Slab_PCB_thickness");
double Ecal_Slab_glue_gap = theDetector.constant<double>("Ecal_Slab_glue_gap");
double Ecal_Slab_ground_thickness = theDetector.constant<double>("Ecal_Slab_ground_thickness");
double Ecal_fiber_thickness = theDetector.constant<double>("Ecal_fiber_thickness");
double Ecal_Si_thickness = theDetector.constant<double>("Ecal_Si_thickness");
double Ecal_inner_radius = theDetector.constant<double>("TPC_outer_radius") +theDetector.constant<double>("Ecal_Tpc_gap");
double Ecal_radiator_thickness1 = theDetector.constant<double>("Ecal_radiator_layers_set1_thickness");
double Ecal_radiator_thickness2 = theDetector.constant<double>("Ecal_radiator_layers_set2_thickness");
double Ecal_radiator_thickness3 = theDetector.constant<double>("Ecal_radiator_layers_set3_thickness");
double Ecal_Barrel_halfZ = theDetector.constant<double>("Ecal_Barrel_halfZ");
double Ecal_support_thickness = theDetector.constant<double>("Ecal_support_thickness");
double Ecal_front_face_thickness = theDetector.constant<double>("Ecal_front_face_thickness");
double Ecal_lateral_face_thickness = theDetector.constant<double>("Ecal_lateral_face_thickness");
double Ecal_Slab_H_fiber_thickness = theDetector.constant<double>("Ecal_Slab_H_fiber_thickness");
double Ecal_Slab_Sc_PCB_thickness = theDetector.constant<double>("Ecal_Slab_Sc_PCB_thickness");
double Ecal_Sc_thickness = theDetector.constant<double>("Ecal_Sc_thickness");
double Ecal_Sc_reflector_thickness = theDetector.constant<double>("Ecal_Sc_reflector_thickness");
int Ecal_nlayers1 = theDetector.constant<int>("Ecal_nlayers1");
int Ecal_nlayers2 = theDetector.constant<int>("Ecal_nlayers2");
int Ecal_nlayers3 = theDetector.constant<int>("Ecal_nlayers3");
int Ecal_barrel_number_of_towers = theDetector.constant<int>("Ecal_barrel_number_of_towers");
//double Ecal_cells_size = theDetector.constant<double>("Ecal_cells_size");
double Ecal_guard_ring_size = theDetector.constant<double>("Ecal_guard_ring_size");
//====================================================================
//
// general calculated parameters
//
//====================================================================
double Ecal_total_SiSlab_thickness =
Ecal_Slab_shielding +
Ecal_Slab_copper_thickness +
//.........这里部分代码省略.........
示例2: create_detector
static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector sens) {
xml_det_t x_det = e;
int det_id = x_det.id();
string det_name = x_det.nameStr();
DetElement sdet (det_name,det_id);
// --- create an envelope volume and position it into the world ---------------------
Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, e , sdet ) ;
dd4hep::xml::setDetectorTypeFlag( e, sdet ) ;
if( theDetector.buildType() == BUILD_ENVELOPE ) return sdet ;
//-----------------------------------------------------------------------------------
xml_dim_t dim = x_det.dimensions();
Material air = theDetector.air();
int nsides_inner = dim.nsides_inner();
int nsides_outer = dim.nsides_outer();
double rmin = dim.rmin();
double rmax = dim.rmax(); /// FIXME: IS THIS RIGHT?
double zmin = dim.zmin();
double rcutout = dim.hasAttr(_U(rmin2)) ? dim.rmin2() : 0.;
double zcutout = dim.hasAttr(_U(z2)) ? dim.z2() : 0.;
Layering layering(x_det);
double totalThickness = layering.totalThickness();
Readout readout = sens.readout();
Segmentation seg = readout.segmentation();
std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); //Assume uniform cell sizes, provide dummy cellID
double cell_sizeX = cellSizeVector[0];
double cell_sizeY = cellSizeVector[1];
PolyhedraRegular polyVolume(nsides_outer,rmin,rmax,totalThickness);
Volume endcapVol("endcap",polyVolume,air);
if(zcutout >0. || rcutout > 0.){
PolyhedraRegular cutoutPolyVolume(nsides_inner,0,rmin+rcutout,zcutout);
Position cutoutPos(0,0,(zcutout-totalThickness)/2.0);
std::cout<<"Cutout z width will be "<<zcutout<<std::endl;
endcapVol=Volume("endcap",SubtractionSolid(polyVolume,cutoutPolyVolume,cutoutPos),air);
}
DetElement endcapA(sdet,"endcap",det_id);
Ref_t(endcapA)->SetName((det_name+"_A").c_str());
int layer_num = 0;
int layerType = 0;
double layerZ = -totalThickness/2;
//Create caloData object to extend driver with data required for reconstruction
LayeredCalorimeterData* caloData = new LayeredCalorimeterData ;
caloData->layoutType = LayeredCalorimeterData::EndcapLayout ;
caloData->inner_symmetry = nsides_inner;
caloData->outer_symmetry = nsides_outer;
/** NOTE: phi0=0 means lower face flat parallel to experimental floor
* This is achieved by rotating the modules with respect to the envelope
* which is assumed to be a Polyhedron and has its axes rotated with respect
* to the world by 180/nsides. In any other case (e.g. if you want to have
* a tip of the calorimeter touching the ground) this value needs to be computed
*/
caloData->inner_phi0 = 0.;
caloData->outer_phi0 = 0.;
caloData->gap0 = 0.; //FIXME
caloData->gap1 = 0.; //FIXME
caloData->gap2 = 0.; //FIXME
/// extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in mm.
caloData->extent[0] = rmin ;
caloData->extent[1] = rmax ; ///FIXME: CHECK WHAT IS NEEDED (EXSCRIBED?)
caloData->extent[2] = zmin ;
caloData->extent[3] = zmin + totalThickness;
endcapVol.setAttributes(theDetector,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
for(xml_coll_t c(x_det,_U(layer)); c; ++c) {
xml_comp_t x_layer = c;
double layer_thick = layering.layer(layer_num)->thickness();
string layer_type_name = _toString(layerType,"layerType%d");
int layer_repeat = x_layer.repeat();
double layer_rcutout = x_layer.hasAttr(_U(gap)) ? x_layer.gap() : 0;
std::cout<<"Number of layers in group "<<layerType<<" : "<<layer_repeat<<std::endl;
Volume layer_vol(layer_type_name,PolyhedraRegular(nsides_outer,rmin+layer_rcutout,rmax,layer_thick),air);
int slice_num = 0;
double sliceZ = -layer_thick/2;
//Create a caloLayer struct for thiss layer type to store copies of in the parent struct
LayeredCalorimeterData::Layer caloLayer ;
//.........这里部分代码省略.........
示例3: create_detector
static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDetector sens) {
xml_det_t x_det = element;
Layering layering(x_det);
xml_dim_t dim = x_det.dimensions();
string det_name = x_det.nameStr();
//unused: string det_type = x_det.typeStr();
Material air = theDetector.air();
Material stavesMaterial = theDetector.material(x_det.materialStr());
int numSides = dim.numsides();
int det_id = x_det.id();
DetElement sdet(det_name,det_id);
PlacedVolume pVol;
// --- create an envelope volume and position it into the world ---------------------
Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, element , sdet ) ;
sdet.setTypeFlag( DetType::CALORIMETER | DetType::ENDCAP | DetType::HADRONIC ) ;
if( theDetector.buildType() == BUILD_ENVELOPE ) return sdet ;
//-----------------------------------------------------------------------------------
sens.setType("calorimeter");
DetElement stave_det("module0stave0",det_id);
// The way to reaad constant from XML/Detector file.
double Hcal_radiator_thickness = theDetector.constant<double>("Hcal_radiator_thickness");
double Hcal_endcap_lateral_structure_thickness = theDetector.constant<double>("Hcal_endcap_lateral_structure_thickness");
double Hcal_endcap_layer_air_gap = theDetector.constant<double>("Hcal_endcap_layer_air_gap");
//double Hcal_cells_size = theDetector.constant<double>("Hcal_cells_size");
double HcalEndcap_inner_radius = theDetector.constant<double>("HcalEndcap_inner_radius");
double HcalEndcap_outer_radius = theDetector.constant<double>("HcalEndcap_outer_radius");
double HcalEndcap_min_z = theDetector.constant<double>("HcalEndcap_min_z");
double HcalEndcap_max_z = theDetector.constant<double>("HcalEndcap_max_z");
double Hcal_steel_cassette_thickness = theDetector.constant<double>("Hcal_steel_cassette_thickness");
double HcalServices_outer_FR4_thickness = theDetector.constant<double>("HcalServices_outer_FR4_thickness");
double HcalServices_outer_Cu_thickness = theDetector.constant<double>("HcalServices_outer_Cu_thickness");
double Hcal_endcap_services_module_width = theDetector.constant<double>("Hcal_endcap_services_module_width");
Material stainless_steel = theDetector.material("stainless_steel");
Material PCB = theDetector.material("PCB");
Material copper = theDetector.material("Cu");
std::cout <<"\n HcalEndcap_inner_radius = "
<<HcalEndcap_inner_radius/dd4hep::mm <<" mm"
<<"\n HcalEndcap_outer_radius = "
<<HcalEndcap_outer_radius/dd4hep::mm <<" mm"
<<"\n HcalEndcap_min_z = "
<<HcalEndcap_min_z/dd4hep::mm <<" mm"
<<"\n HcalEndcap_max_z = "
<<HcalEndcap_max_z/dd4hep::mm <<" mm"
<<std::endl;
Readout readout = sens.readout();
Segmentation seg = readout.segmentation();
std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); //Assume uniform cell sizes, provide dummy cellID
double cell_sizeX = cellSizeVector[0];
double cell_sizeY = cellSizeVector[1];
//========== fill data for reconstruction ============================
LayeredCalorimeterData* caloData = new LayeredCalorimeterData ;
caloData->layoutType = LayeredCalorimeterData::EndcapLayout ;
caloData->inner_symmetry = 4 ; // hard code cernter box hole
caloData->outer_symmetry = 0 ; // outer tube, or 8 for Octagun
caloData->phi0 = 0 ;
/// extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in mm.
caloData->extent[0] = HcalEndcap_inner_radius ;
caloData->extent[1] = HcalEndcap_outer_radius ;
caloData->extent[2] = HcalEndcap_min_z ;
caloData->extent[3] = HcalEndcap_max_z ;
int endcapID = 0;
for(xml_coll_t c(x_det.child(_U(dimensions)),_U(dimensions)); c; ++c)
{
xml_comp_t l(c);
double dim_x = l.attr<double>(_Unicode(dim_x));
double dim_y = l.attr<double>(_Unicode(dim_y));
double dim_z = l.attr<double>(_Unicode(dim_z));
double pos_y = l.attr<double>(_Unicode(y_offset));
// Hcal Endcap module shape
double box_half_x= dim_x/2.0; // module width, all are same
double box_half_y= dim_y/2.0; // total thickness, all are same
double box_half_z= dim_z/2.0; // module length, changed,
double x_offset = box_half_x*numSides-box_half_x*endcapID*2.0-box_half_x;
double y_offset = pos_y;
Box EndcapModule(box_half_x,box_half_y,box_half_z);
//.........这里部分代码省略.........