本文整理汇总了C++中TGeoVolume::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoVolume::Write方法的具体用法?C++ TGeoVolume::Write怎么用?C++ TGeoVolume::Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGeoVolume
的用法示例。
在下文中一共展示了TGeoVolume::Write方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create_TOF_Geometry_v12a
void Create_TOF_Geometry_v12a() {
// Load the necessary FairRoot libraries
gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
basiclibs();
gSystem->Load("libGeoBase");
gSystem->Load("libParBase");
gSystem->Load("libBase");
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(7);
// Create the top volume
/*
TGeoBBox* topbox= new TGeoBBox("", 1000., 1000., 1000.);
TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air"));
gGeoMan->SetTopVolume(top);
*/
TGeoVolume* top = new TGeoVolumeAssembly("TOP");
gGeoMan->SetTopVolume(top);
TGeoVolume* tof = new TGeoVolumeAssembly(geoVersion);
top->AddNode(tof, 1);
for(Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; counterType++) {
gCounter = create_new_counter(counterType);
}
for(Int_t moduleType = 0; moduleType < NofModuleTypes; moduleType++) {
gModules[moduleType] = create_new_tof_module(moduleType);
}
gPole = create_tof_pole();
position_tof_poles();
position_inner_tof_modules();
position_outer_tof_modules();
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* outfile = new TFile(FileName,"RECREATE");
top->Write();
//gGeoMan->Write();
outfile->Close();
// top->Draw("ogl");
//top->Raytrace();
}
示例2: ATTPC_d2He
void ATTPC_d2He() {
// Load the necessary FairRoot libraries
//gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
//basiclibs();
//gSystem->Load("libGeoBase");
//gSystem->Load("libParBase");
//gSystem->Load("libBase");
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(7);
// Create the top volume
TGeoVolume* top = new TGeoVolumeAssembly("TOP");
gGeoMan->SetTopVolume(top);
TGeoMedium* gas = gGeoMan->GetMedium(MediumVacuum);
TGeoVolume* tpcvac = new TGeoVolumeAssembly(geoVersion);
tpcvac -> SetMedium(gas);
top->AddNode(tpcvac, 1);
gModules = create_detector();
//position_detector();
cout<<"Voxelizing."<<endl;
top->Voxelize("");
gGeoMan->CloseGeometry();
//add_alignable_volumes();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* outfile = new TFile(FileName,"RECREATE");
top->Write();
outfile->Close();
TFile* outfile1 = new TFile(FileName1,"RECREATE");
gGeoMan->Write();
outfile1->Close();
top->Draw("ogl");
//top->Raytrace();
}
示例3: create_actar_geo
//.........这里部分代码省略.........
// Defintion of the Mother Volume Actar
TGeoShape *pActarWorldOut = new TGeoBBox("Actar_boxOut",
worldLength/2.0,
worldLength/2.0,
worldLength/2.0);
TGeoVolume* pWorld = new TGeoVolume("ActarWorld", pActarWorldOut, pAirMedium);
TGeoCombiTrans *t0 = new TGeoCombiTrans();
TGeoCombiTrans *pGlobalc = GetGlobalPosition(t0);
t0->RegisterYourself();
//defining top volume
top->AddNode(pWorld, 0, pGlobalc);
//Colors in visualization
Color_t col_chamber = kBlue-6;
Color_t col_anode = kGray+3;
Color_t col_cathode = kGray+5;
Color_t col_grid = kGray;
Color_t col_rings = kOrange;
Color_t col_windows = kGray-1;
/*** Some definitions ***/
TGeoRotation *rotUni = new TGeoRotation(); //unitary rotation
//CHAMBER, BACKWARD FLANGE
TGeoVolume *Actar_chamber_1 = gGeoManager->MakeTube("Actar_chamber_1",pAlHousing,chamberInnerRadius, chamberInnerRadius+chamberThickness, chamberHalfLength);
Actar_chamber_1->SetLineColor(col_chamber);
TGeoVolume *Actar_chamber_2 = gGeoManager->MakeTube("Actar_chamber_2",pMedSteel,backwardsBeamWindowRadius, chamberPlateRadius, chamberPlateThickness/2);
Actar_chamber_2->SetLineColor(col_chamber);
TGeoCombiTrans *t_chamber_2 = new TGeoCombiTrans("t_chamber_2",0.,0.,-chamberHalfLength-chamberPlateThickness/2,rotUni);
t_chamber_2->RegisterYourself();
TGeoVolume *Actar_chamber_3 = gGeoManager->MakeTube("Actar_chamber_3",pAlHousing,forwardsBeamWindowRadius, chamberInnerRadius+chamberThickness, chamberThickness/2);
Actar_chamber_3->SetLineColor(col_chamber);
TGeoCombiTrans *t_chamber_3 = new TGeoCombiTrans("t_chamber_3",0.,0.,chamberHalfLength+chamberThickness/2,rotUni);
t_chamber_3->RegisterYourself();
TGeoVolume *Actar_chamber_4 = gGeoManager->MakeTube("Actar_chamber_4",pMedSteel,backwardsBeamWindowRadius, 5.0,3.5/2);
Actar_chamber_3->SetLineColor(col_chamber);
TGeoCombiTrans *t_chamber_4 = new TGeoCombiTrans("t_chamber_4",0.,0.,inletWindowCenter+3.5/2,rotUni);
t_chamber_4->RegisterYourself();
TGeoVolume *Actar_chamber_5 = gGeoManager->MakeTube("Actar_chamber_5",pMedSteel,forwardsBeamWindowRadius, 6.0,3.5/2);
Actar_chamber_3->SetLineColor(col_chamber);
TGeoCombiTrans *t_chamber_5 = new TGeoCombiTrans("t_chamber_5",0.,0.,outletWindowCenter-3.5/2+chamberThickness,rotUni);
t_chamber_5->RegisterYourself();
//BERYLIUM WINDOWS
TGeoVolume *Actar_BeInletWindow = gGeoManager->MakeSphere("Actar_BeInletWindow",pMedBe,inletWindowRadius,inletWindowRadius+inletWindowThickness, 0.,90.,0.,360.);
Actar_BeInletWindow->SetLineColor(col_windows);
TGeoVolume *Actar_BeOutletWindow = gGeoManager->MakeSphere("Actar_BeOutletWindow",pMedBe,outletWindowRadius,outletWindowRadius+outletWindowThickness, 90.,180.,0.,360.);
Actar_BeOutletWindow->SetLineColor(col_windows);
TGeoVolume *Actar_chamber_inner = gGeoManager->MakeTube("Actar_chamber_inner",pMed4,0, chamberInnerRadius, chamberHalfLength);
//ANODE, CATHODE, GRID, RINGS
TGeoVolume *Actar_anode = gGeoManager->MakeTube("Actar_anode",pMedSteel, 0., anodeRadius, anodeThickness/2);
Actar_anode->SetLineColor(col_anode);
TGeoVolume *Actar_cathode = gGeoManager->MakeTube("Actar_cathode",pMedSteel, 0., anodeRadius, cathodeThickness/2);
Actar_cathode->SetLineColor(col_cathode);
TGeoVolume *Actar_grid = gGeoManager->MakeTube("Actar_grid",pMedSteel, 0., anodeRadius, gridThickness/2);
Actar_grid->SetLineColor(col_grid);
TGeoVolume *Actar_rings = gGeoManager->MakeTorus("Actar_rings",pMedCu, ringRadius, 0., ringGauge/2, 0, 360);
Actar_rings->SetLineColor(col_rings);
for(Int_t ringNumber=0;ringNumber<11;ringNumber++)
Actar_chamber_inner->AddNode(Actar_rings,ringNumber,new TGeoCombiTrans(0.,0., positionAnode+ ringDistance*(ringNumber+1),rotUni));
Actar_chamber_inner->AddNode(Actar_anode,0,new TGeoCombiTrans(0.,0.,positionAnode,rotUni));
Actar_chamber_inner->AddNode(Actar_grid,0,new TGeoCombiTrans(0.,0.,positionGrid,rotUni));
Actar_chamber_inner->AddNode(Actar_cathode,0,new TGeoCombiTrans(0.,0.,positionCathode,rotUni));
pWorld->AddNode(Actar_chamber_1,0,t0);
pWorld->AddNode(Actar_chamber_2,0,t_chamber_2);
pWorld->AddNode(Actar_chamber_3,0,t_chamber_3);
pWorld->AddNode(Actar_chamber_4,0,t_chamber_4);
pWorld->AddNode(Actar_chamber_5,0,t_chamber_5);
pWorld->AddNode(Actar_BeInletWindow,0,new TGeoCombiTrans(0.,0.,inletWindowCenter,rotUni));
pWorld->AddNode(Actar_BeOutletWindow,0,new TGeoCombiTrans(0.,0.,outletWindowCenter,rotUni));
pWorld->AddNode(Actar_chamber_inner,0,t0);
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例4: rotSensor
//.........这里部分代码省略.........
pointsSmall[6] = -0.5529/2; pointsSmall[7] = -5.3358/2;
pointsSmall[8] = -1.9579/2; pointsSmall[9] = 5.3358/2;
pointsSmall[10] = 1.9579/2; pointsSmall[11] = 5.3358/2;
pointsSmall[12] = 0.5529/2; pointsSmall[13] = -5.3358/2;
pointsSmall[14] = -0.5529/2; pointsSmall[15] = -5.3358/2;
// TGeoShape* smallSensorShape = new TGeoTrd1("StripSensorActiveSmallShape", 1.9579/2, 0.5529/2, 0.03/2, 5.3358/2);
TGeoShape* smallSensorShape = new TGeoArb8("StripSensorActiveSmallShape", 0.03/2, pointsSmall);
TGeoVolume* smallSensorVolume = new TGeoVolume("StripSensorActiveSmallTrap", smallSensorShape, gGeoMan->GetMedium("HYPdiamond"));
TGeoTranslation transSmallSensor(0,5.3358/2+2.1,0);
TGeoCombiTrans combined2(transSmallSensor, rotSensor);
for (int i = 0; i < 12; i++){
TString rotName("rotSmallSens");
rotName.Append(i+1);
TGeoRotation rotSens(rotName.Data(), 0,0, i*2 * 360/24);
TGeoHMatrix sens = rotSens * combined2;
smallRing->AddNode(smallSensorVolume, i+12, new TGeoHMatrix(sens));
}
lambdaDisk->AddNode(largeRing, 0, new TGeoTranslation(0,0,-0.5));
lambdaDisk->AddNode(largeRing, 1, new TGeoRotation("largeRingRot",0,0,360/24));
TGeoCombiTrans combiSmallRing2(TGeoTranslation(0,0,-1.5), TGeoRotation("smallRingRot",0,0,360/24));
lambdaDisk->AddNode(smallRing, 0, new TGeoTranslation(0,0,-1.0));
lambdaDisk->AddNode(smallRing, 1, new TGeoHMatrix(combiSmallRing2));
TGeoVolumeAssembly* supportDisk = new TGeoVolumeAssembly("SupportDisk");
TGeoVolumeAssembly* supportLarge = new TGeoVolumeAssembly("SupportLarge");
TGeoShape* carbonFoamShape = new TGeoBBox(3.4/2, 0.2/2, 3.5/2);
TGeoVolume* carbonFoam = new TGeoVolume("CarbonFoam", carbonFoamShape, gGeoMan->GetMedium("carbonfoam"));
TGeoShape* carbonFiberShape = new TGeoBBox(3.4/2, 0.02/2, 3.5/2);
TGeoVolume* carbonFiber = new TGeoVolume("CarbonFiber", carbonFiberShape, gGeoMan->GetMedium("carbon"));
TGeoShape* HYPdiamondReadoutShape = new TGeoBBox(3.4/2, 0.02/2, 3.5/2);
TGeoVolume* HYPdiamondReadout = new TGeoVolume("HYPdiamondReadout", HYPdiamondReadoutShape, gGeoMan->GetMedium("HYPdiamond"));
TGeoShape* aluCablesShape = new TGeoBBox(3.4/2, 0.4/2, 3.5/2);
TGeoVolume* aluCables = new TGeoVolume("AluCables", aluCablesShape, gGeoMan->GetMedium("aluminium"));
supportLarge->AddNode(carbonFoam, 1);
supportLarge->AddNode(carbonFiber, 1, new TGeoTranslation(0,(0.2 + 0.02)/2, 0));
supportLarge->AddNode(carbonFiber, 2, new TGeoTranslation(0,-(0.2 + 0.02)/2, 0));
supportLarge->AddNode(HYPdiamondReadout, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02)/2, 0));
supportLarge->AddNode(HYPdiamondReadout, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02)/2, 0));
supportLarge->AddNode(aluCables, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
supportLarge->AddNode(aluCables, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
TGeoTranslation transSupportLarge(0,(14.8669)/2 + 5.5665 + 1,0);
for (int i = 0; i < 24; i++){
TString rotName("rotSupportLarge");
rotName.Append(i+1);
TGeoRotation rotSens(rotName.Data(), 0,0, i * 360/24);
TGeoHMatrix sens = rotSens * transSupportLarge;
supportDisk->AddNode(supportLarge, i+1, new TGeoHMatrix(sens));
}
TGeoVolumeAssembly* supportSmall = new TGeoVolumeAssembly("SupportSmall");
TGeoShape* carbonFoamShapeSmall = new TGeoBBox(1.8/2, 0.2/2, 3.5/2);
TGeoVolume* carbonFoamSmall = new TGeoVolume("CarbonFoamSmall", carbonFoamShapeSmall, gGeoMan->GetMedium("carbonfoam"));
TGeoShape* carbonFiberShapeSmall = new TGeoBBox(1.8/2, 0.02/2, 3.5/2);
TGeoVolume* carbonFiberSmall = new TGeoVolume("CarbonFiberSmall", carbonFiberShapeSmall, gGeoMan->GetMedium("carbon"));
TGeoShape* HYPdiamondReadoutShapeSmall = new TGeoBBox(1.8/2, 0.02/2, 3.5/2);
TGeoVolume* HYPdiamondReadoutSmall = new TGeoVolume("HYPdiamondReadoutSmall", HYPdiamondReadoutShapeSmall, gGeoMan->GetMedium("HYPdiamond"));
TGeoShape* aluCablesShapeSmall = new TGeoBBox(1.8/2, 0.4/2, 3.5/2);
TGeoVolume* aluCablesSmall = new TGeoVolume("AluCablesSmall", aluCablesShapeSmall, gGeoMan->GetMedium("aluminium"));
supportSmall->AddNode(carbonFoamSmall, 1);
supportSmall->AddNode(carbonFiberSmall, 1, new TGeoTranslation(0,(0.2 + 0.02)/2, 0));
supportSmall->AddNode(carbonFiberSmall, 2, new TGeoTranslation(0,-(0.2 + 0.02)/2, 0));
supportSmall->AddNode(HYPdiamondReadoutSmall, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02)/2, 0));
supportSmall->AddNode(HYPdiamondReadoutSmall, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02)/2, 0));
supportSmall->AddNode(aluCablesSmall, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
supportSmall->AddNode(aluCablesSmall, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
TGeoTranslation transSupportSmall(0,2.1 + 5.3358 + 0.5,0);
for (int i = 0; i < 24; i++){
TString rotName("rotSupportSmall");
rotName.Append(i+1);
TGeoRotation rotSens(rotName.Data(), 0,0, i * 360/24);
TGeoHMatrix sens = rotSens * transSupportSmall;
supportDisk->AddNode(supportSmall, i+1, new TGeoHMatrix(sens));
}
combinedLambdaDisks->AddNode(lambdaDisk,1,new TGeoTranslation(0,0,positionOfDisk1inZ));
//combinedLambdaDisks->AddNode(lambdaDisk,2,new TGeoTranslation(0,0,positionOfDisk2inZ));
//combinedLambdaDisks->AddNode(supportDisk,1, new TGeoTranslation(0,0,(positionOfDisk1inZ + positionOfDisk2inZ)/2));
top->AddNode(combinedLambdaDisks,0);
gGeoMan->CloseGeometry();
top->Write();
fi->Close();
// gGeoManager->Export(outfile);
gGeoManager->SetVisLevel(30);
top->Draw("ogl");
}
示例5: create_neuland_geo
//.........这里部分代码省略.........
//------------------ wrapping Alu------------------------------------------
TGeoShape* padle_h_box1 = new TGeoBBox("padle_h_box1",
neuLAND_paddle_dimx,
neuLAND_paddle_dimy + neuLAND_wrapping1_dim,
neuLAND_paddle_dimz + neuLAND_wrapping1_dim);
TGeoShape* padle_h_box2 = new TGeoBBox("padle_h_box2",
neuLAND_paddle_dimx,
neuLAND_paddle_dimy,
neuLAND_paddle_dimz);
// Create a composite shape
TGeoCompositeShape *wrapping1 = new TGeoCompositeShape("diffbox", "padle_h_box1 - padle_h_box2");
TGeoVolume *bvol1 = new TGeoVolume("wrapping1", wrapping1, pMedAl);
//------------------ wrapping Tape------------------------------------------
TGeoShape* padle_h_box3 = new TGeoBBox("padle_h_box3",
neuLAND_paddle_dimx,
neuLAND_paddle_dimy + neuLAND_wrapping1_dim + neuLAND_wrapping2_dim,
neuLAND_paddle_dimz + neuLAND_wrapping1_dim + neuLAND_wrapping2_dim);
TGeoShape* padle_h_box4 = new TGeoBBox("padle_h_box4",
neuLAND_paddle_dimx,
neuLAND_paddle_dimy + neuLAND_wrapping1_dim,
neuLAND_paddle_dimz + neuLAND_wrapping1_dim);
// Create a composite shape
TGeoCompositeShape *wrapping2 = new TGeoCompositeShape("diffbox", "padle_h_box3 - padle_h_box4");
TGeoVolume *bvol2 = new TGeoVolume("wrapping2", wrapping2, pMed38);
// Make the elementary assembly of the whole structure
TGeoVolume *aLand = new TGeoVolumeAssembly("ALAND");
Double_t total_dimx = neuLAND_paddle_dimx;
Double_t total_dimy = neuLAND_paddle_dimy +
neuLAND_wrapping1_dim +
neuLAND_wrapping2_dim +
neuLAND_gap_dim;
Double_t total_dimz = neuLAND_paddle_dimz +
neuLAND_wrapping1_dim +
neuLAND_wrapping2_dim +
neuLAND_gap_dim;
//paddles
TGeoRotation *zeroRotation = new TGeoRotation();
zeroRotation->RotateX(0.);
zeroRotation->RotateY(0.);
zeroRotation->RotateZ(0.);
TGeoRotation *rot1 = new TGeoRotation();
rot1->RotateX(0.);
rot1->RotateY(0.);
rot1->RotateZ(90.);
Double_t xx = 0.;
Double_t yy = 0.;
Double_t zz = 0.;
aLand->AddNode(padle_h_box5, 1, new TGeoCombiTrans(xx, yy, zz, zeroRotation));
aLand->AddNode(bvol1, 1, new TGeoCombiTrans(xx, yy, zz, zeroRotation));
aLand->AddNode(bvol2, 1, new TGeoCombiTrans(xx, yy, zz, zeroRotation));
TGeoVolume *cell = new TGeoVolumeAssembly("CELL");
Int_t nindex = 0, i = 0;
tx = 0.;
tz = -neuLAND_depth_dim + total_dimz;
for(tz = -neuLAND_depth_dim + total_dimz; tz < neuLAND_depth_dim; tz += total_dimz*2) {
i += 1;
for (ty = -total_dimx + total_dimy; ty < total_dimx; ty += total_dimy*2) {
nindex++;
if (i % 2 == 1) {
cell->AddNode(aLand, nindex, new TGeoCombiTrans(tx, ty, tz, zeroRotation));
} else {
cell->AddNode(aLand, nindex, new TGeoCombiTrans(ty, tx, tz, rot1));
}
}
}
tx = 0.0;
ty = 0.0;
tz = fZ;
TGeoCombiTrans *t0 = new TGeoCombiTrans(tx, ty, tz, zeroRotation);
top->AddNode(cell, 1, /*GetGlobalPosition(t0)*/t0);
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例6: create_gfi_geo
//.........这里部分代码省略.........
// World definition
TGeoVolume* pWorld = gGeoManager->GetTopVolume();
pWorld->SetVisLeaves(kTRUE);
// SHAPES, VOLUMES AND GEOMETRICAL HIERARCHY
// Shape: GFIBoxWorld type: TGeoBBox
dx = 29.00000;
dy = 29.00000;
dz = 0.050000;
TGeoShape *pGFIBoxWorld = new TGeoBBox("GFIBoxWorld", dx,dy,dz);
// Volume: GFILogWorld
TGeoVolume*
pGFILogWorld = new TGeoVolume("GFILogWorld",pGFIBoxWorld, pMed2);
pGFILogWorld->SetVisLeaves(kTRUE);
// Global positioning
TGeoCombiTrans *pGlobal1 = GetGlobalPosition(pMatrix2);
TGeoCombiTrans *pGlobal2 = GetGlobalPosition(pMatrix4);
TGeoVolumeAssembly *pw1 = new TGeoVolumeAssembly("GFI");
pWorld->AddNode(pw1, 0);
pw1->AddNode( pGFILogWorld, 0, pGlobal1 );
pw1->AddNode( pGFILogWorld, 1, pGlobal2 );
// Shape: GFIBox type: TGeoBBox
dx = 25.000000;
dy = 25.000000;
dz = 0.050000;
TGeoShape *pGFIBox = new TGeoBBox("GFIBox", dx,dy,dz);
// Volume: GFILog
TGeoVolume*
pGFILog = new TGeoVolume("GFILog",pGFIBox, pMed35);
pGFILog->SetVisLeaves(kTRUE);
pGFILogWorld->AddNode(pGFILog, 0, pMatrix6);
// Shape: UpFrame type: TGeoBBox
dx = 29.000000;
dy = 2.000000;
dz = 0.050000;
TGeoShape *pUpFrame = new TGeoBBox("UpFrame", dx,dy,dz);
// Volume: logicUpFrame
TGeoVolume*
plogicUpFrame = new TGeoVolume("logicUpFrame",pUpFrame, pMed21);
plogicUpFrame->SetVisLeaves(kTRUE);
pGFILogWorld->AddNode(plogicUpFrame, 0, pMatrix8);
// Shape: DownFrame type: TGeoBBox
dx = 29.000000;
dy = 2.000000;
dz = 0.050000;
TGeoShape *pDownFrame = new TGeoBBox("DownFrame", dx,dy,dz);
// Volume: logicDownFrame
TGeoVolume*
plogicDownFrame = new TGeoVolume("logicDownFrame",pDownFrame, pMed21);
plogicDownFrame->SetVisLeaves(kTRUE);
pGFILogWorld->AddNode(plogicDownFrame, 0, pMatrix10);
// Shape: RightFrame type: TGeoBBox
dx = 2.000000;
dy = 25.000000;
dz = 0.050000;
TGeoShape *pRightFrame = new TGeoBBox("RightFrame", dx,dy,dz);
// Volume: logicRightFrame
TGeoVolume*
plogicRightFrame = new TGeoVolume("logicRightFrame",pRightFrame, pMed21);
plogicRightFrame->SetVisLeaves(kTRUE);
pGFILogWorld->AddNode(plogicRightFrame, 0, pMatrix12);
// Shape: LeftFrame type: TGeoBBox
dx = 2.000000;
dy = 25.000000;
dz = 0.050000;
TGeoShape *pLeftFrame = new TGeoBBox("LeftFrame", dx,dy,dz);
// Volume: logicLeftFrame
TGeoVolume*
plogicLeftFrame = new TGeoVolume("logicLeftFrame",pLeftFrame, pMed21);
plogicLeftFrame->SetVisLeaves(kTRUE);
pGFILogWorld->AddNode(plogicLeftFrame, 0, pMatrix14);
// Add the sensitive part
// AddSensitiveVolume(pGFILog);
// fNbOfSensitiveVol+=1;
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例7: create_mtof_geo
//.........这里部分代码省略.........
dz = 761.870346;
// Rotation:
thx = -106.700000; phx = 0.000000;
thy = 90.000000; phy = 90.000000;
thz = -16.700000; phz = 0.000000;
/* dx = -171.1;
dy = 2.400000;
dz = 548.95;
// dz = 0.;
// Rotation:
thx = -121.000000; phx = 0.000000;
thy = 90.000000; phy = 90.000000;
thz = -31.000000; phz = 0.000000;*/
TGeoRotation *pMatrix3 = new TGeoRotation("",thx,phx,thy,phy,thz,phz);
TGeoCombiTrans*
pMatrix2 = new TGeoCombiTrans("", dx,dy,dz,pMatrix3);
/*
// TRANSFORMATION MATRICES
// Combi transformation:
dx = 151.000000;
dy = 0.000000;
dz = 758.000000;
// Rotation:
thx = 106.700000; phx = 0.000000;
thy = 90.000000; phy = 90.000000;
thz = 16.700000; phz = 0.000000;
TGeoRotation *pMatrix3 = new TGeoRotation("",thx,phx,thy,phy,thz,phz);
TGeoCombiTrans*
pMatrix2 = new TGeoCombiTrans("", dx,dy,dz,pMatrix3);
*/
// Shape: World type: TGeoBBox
TGeoVolume* pWorld = gGeoManager->GetTopVolume();
pWorld->SetVisLeaves(kTRUE);
// Create a global Mother Volume
/*
dx = 200.000000;
dy = 200.000000;
dz = 200.000000;
TGeoShape *pBoxWorld = new TGeoBBox("mTofBoxWorld", dx,dy,dz);
TGeoVolume*
pWorld = new TGeoVolume("mTofBoxLogWorld",pBoxWorld, pMed2);
pWorld->SetVisLeaves(kTRUE);
TGeoCombiTrans *pGlobalc = GetGlobalPosition();
// add the sphere as Mother Volume
pAWorld->AddNode(pWorld, 0, pGlobalc);
*/
// SHAPES, VOLUMES AND GEOMETRICAL HIERARCHY
// Shape: mTOFBox type: TGeoBBox
dx = 24.000000;
dy = 24.000000;
//dz = 0.250000; //wrong: should be 0.5->1cm total
dz = 0.500000;
/* dx = 94.450000; //TFW size
dy = 73.450000;
dz = 0.500000;*/
TGeoShape *pmTOFBox = new TGeoBBox("mTOFBox", dx,dy,dz);
// Volume: mTOFLog
TGeoVolume *
pmTOFLog = new TGeoVolume("mTOFLog",pmTOFBox, pMed34);
pmTOFLog->SetVisLeaves(kTRUE);
TGeoVolumeAssembly *pmTof = new TGeoVolumeAssembly("mTOF");
TGeoCombiTrans *t0 = new TGeoCombiTrans("t0");
pmTof->AddNode(pmTOFLog, 0, t0);
TGeoCombiTrans *pGlobal = GetGlobalPosition(pMatrix2);
if (pGlobal){
pWorld->AddNode(pmTof, 0, pGlobal);
}else{
pWorld->AddNode(pmTof, 0, pMatrix2);
}
// AddSensitiveVolume(pmTOFLog);
// fNbOfSensitiveVol+=1;
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例8: create_tof_geo
//.........这里部分代码省略.........
Int_t nel, numed;
// TRANSFORMATION MATRICES
// Combi transformation:
dx = -417.359574; //Justyna
dy = 2.400000; //Justyna
dz = 960.777114; //Justyna
// dx = -421.33683; //Christoph
// dy = 2.12; //Christoph
// dz = 958.387337; //Christoph
/* dx = -171.1; //position directrly (15cm) after DCH2
dy = 2.400000;
dz = 548.95;*/
// dz = 0.;
/* // Rotation:
thx = -121.000000; phx = 0.000000;
thy = 90.000000; phy = 90.000000;
thz = -31.000000; phz = 0.000000;*/ //this
// TGeoRotation *pMatrix3 = new TGeoRotation("",thx,phx,thy,phy,thz,phz); //this
TGeoRotation *gRot = new TGeoRotation();
gRot->RotateX(0.);
gRot->RotateY(-31.000000);
gRot->RotateZ(0.);
TGeoCombiTrans*
// pMatrix2 = new TGeoCombiTrans("", dx,dy,dz,pMatrix3); //this
pMatrix2 = new TGeoCombiTrans("", dx,dy,dz,gRot); //this
/* PREVIOUS!!!
// TRANSFORMATION MATRICES
// Combi transformation:
dx = 419.700000;
dy = 0.000000;
dz = 952.400000;
// dz = 0.;
// Rotation:
thx = 121.000000; phx = 0.000000;
thy = 90.000000; phy = 90.000000;
thz = 31.000000; phz = 0.000000;
TGeoRotation *pMatrix3 = new TGeoRotation("",thx,phx,thy,phy,thz,phz);
TGeoCombiTrans*
pMatrix2 = new TGeoCombiTrans("", dx,dy,dz,pMatrix3);
*/
//Top Volume
TGeoVolume* pWorld = gGeoManager->GetTopVolume();
pWorld->SetVisLeaves(kTRUE);
TGeoVolumeAssembly *ptof = new TGeoVolumeAssembly("TOF");
// SHAPES, VOLUMES AND GEOMETRICAL HIERARCHY
// Shape: TOFBox type: TGeoBBox
dx = 94.450000;
dy = 73.450000;
dz = 0.500000;
TGeoShape *pTOFBox = new TGeoBBox("TOFBox", dx,dy,dz);
// Volume: TOFLog
TGeoVolume*
pTOFLog = new TGeoVolume("TOFLog",pTOFBox, pMed34);
pTOFLog->SetVisLeaves(kTRUE);
TGeoCombiTrans *t0 = new TGeoCombiTrans("t0");
ptof->AddNode(pTOFLog, 0, t0);
TGeoCombiTrans *pGlobal = GetGlobalPosition(pMatrix2);
if (pGlobal) {
pWorld->AddNode(ptof, 0, pGlobal);
} else {
pWorld->AddNode(ptof, 0, pMatrix2);
}
// AddSensitiveVolume(pTOFLog);
// fNbOfSensitiveVol+=1;
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例9: create_dch_geo
//.........这里部分代码省略.........
pAlDchLog->AddNode(pGasDchLog,0,pTransfo2); //place gas in aluminum, shifted
pGasDchLog->AddNode(pActGasDchLog, 0,pTransfo1); //place active in gas, centrally
// Mylar Windows front+back
//dch1->AddNode(pMylDchLog,0,new TGeoCombiTrans("", tx,ty,-alDz-mylDz,rot));
//dch1->AddNode(pMylDchLog,1,new TGeoCombiTrans("", tx,ty, alDz+mylDz,rot));
dch1->AddNode(pMylDchLog,0,new TGeoCombiTrans("", 0.,0.,-alDz-mylDz,rot));
dch1->AddNode(pMylDchLog,1,new TGeoCombiTrans("", 0.,0., alDz+mylDz,rot));
// Global Positioning
//in agreement with the s318 tracker, those are supposed to be the centres of the active volumes!!!
//Double_t pDch1x = -123.22 ; //Justyna
//Double_t pDch1y = 3.6 ; //Justyna
//Double_t pDch1z = 444.13 ; //Justyna
//Double_t pDch2x = -167.0 ; //Justyna
//Double_t pDch2y = 1.02 ; //Justyna
//Double_t pDch2z = 535.1 ; //Justyna
//use identical values as for the tracker config and the digitizer. F. Wamers.
Double_t pDch1x = -123.219446 ; //Felix
Double_t pDch1y = 3.597104 ; //Felix
Double_t pDch1z = 444.126271 ; //Felix
Double_t pDch2x = -167.015888 ; //Felix
Double_t pDch2y = 1.016917 ; //Felix
Double_t pDch2z = 535.093884 ; //Felix
// Double_t pDch1x = -132.233355 ; //Christoph
// Double_t pDch1y = 1.037475 ; //Christoph
// Double_t pDch1z = 438.710168 ; //Christoph
// Double_t pDch2x = -170.8653 ; //Christoph
// Double_t pDch2y = 2.075139 ; //Christoph
// Double_t pDch2z = 538.614091 ; //Christoph
//The order of rotation matters!!! Rotate first z, and then y! Felix
Double_t aDch1 = -31.0 ;
Double_t aDch2 = -31.0 ;
TGeoRotation *gRot1 = new TGeoRotation();
gRot1->RotateX(0.);
gRot1->RotateZ(-8.880000); //Justyna
//gRot1->RotateZ(+8.880000); //Felix
// gRot1->RotateZ(-2.5); //Christoph
gRot1->RotateY(aDch1);
TGeoRotation *gRot2 = new TGeoRotation();
gRot2->RotateX(0.);
gRot2->RotateZ(9.350000); //Justyna
//gRot2->RotateZ(-9.350000); //Felix
// gRot2->RotateZ(8.4); //Christoph
gRot2->RotateY(aDch2);
// Helium Bag definition
Double_t heDx= alDx ; //[cm]
Double_t heDy= alDy ; //[cm]
Double_t heDz=(pDch2z-pDch1z)*0.953874/2.; //[cm]
alpha=0.; //[degre]
Double_t beta =0.; //[degre]
phi =15.20; //[degre]
TGeoShape* pHePara = new TGeoPara("HePara", heDx, heDy, heDz,
alpha,beta,phi);
TGeoVolume*
pHeDchLog = new TGeoVolume("HeParaLog",pHePara, pMed4);
pHeDchLog->SetVisLeaves(kTRUE);
topDCH->AddNode(dch1,0,new TGeoCombiTrans("",pDch1x,pDch1y,pDch1z,gRot1) );
topDCH->AddNode(dch1,1,new TGeoCombiTrans("",pDch2x,pDch2y,pDch2z,gRot2) );
topDCH->AddNode(pHeDchLog,0,new TGeoCombiTrans("",(pDch1x+pDch2x)/2.,
pDch2y,
(pDch1z+pDch2z)/2.,
gRot1) );
TGeoCombiTrans *temp1 = new TGeoCombiTrans();
top->AddNode(topDCH, 0, GetGlobalPosition(temp1));
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例10: create_tragaldabas_geo
//.........这里部分代码省略.........
// Defintion of the Mother Volume (cube of 2.0 meters side)
Double_t length = 200.;
TGeoShape *pTragaShape = new TGeoBBox("Traga_boxOut",
length/2.0,length/2.0,length/2.0);
TGeoVolume* pTragaWorld = new TGeoVolume("TragaWorld",pTragaShape, pAirMedium);
TGeoCombiTrans *t0 = new TGeoCombiTrans();
TGeoCombiTrans *pGlobalc = GetGlobalPosition(t0);
// add the cube (pTragaWorld) as Mother Volume
top->AddNode(pTragaWorld, 0, pGlobalc);
//TODO: Check the X-Y dimensions for all the objects defined below!!
//MODULE KeepIn Volume, 1 cm larger in each dimension than aluminum box
TGeoVolume *RPC_KeepInVolume=gGeoManager->MakeBox("RPC_KeepInVolume", pAirMedium,
166.0/2,129.5/2,3.6/2);
RPC_KeepInVolume->SetVisibility(kFALSE); //invisible KIV
TGeoRotation *rotUni = new TGeoRotation(); //unitary rotation
pTragaWorld->AddNode(RPC_KeepInVolume,0,new TGeoCombiTrans(0.,0.,-90.,rotUni));
pTragaWorld->AddNode(RPC_KeepInVolume,1,new TGeoCombiTrans(0.,0.,0.,rotUni));
pTragaWorld->AddNode(RPC_KeepInVolume,2,new TGeoCombiTrans(0.,0.,30.,rotUni));
pTragaWorld->AddNode(RPC_KeepInVolume,3,new TGeoCombiTrans(0.,0.,90.,rotUni));
//Aluminum box containing the whole chamber, 3mm thick, laterals 5mm thick
TGeoVolume *RPC_AluBox=gGeoManager->MakeBox("RPC_AluBox", pAluminiumMedium,
165.0/2,128.5/2,2.6/2);
RPC_KeepInVolume->AddNode(RPC_AluBox,0,new TGeoCombiTrans(0.,0.,0.,rotUni));
RPC_AluBox->SetVisibility(kTRUE); //invisible KIV
RPC_AluBox->SetLineColor(kRed);
TGeoVolume *RPC_AluInBox=gGeoManager->MakeBox("RPC_AluInBox", pAirMedium,
164.0/2,127.5/2,2.0/2);
RPC_AluBox->AddNode(RPC_AluInBox,0,new TGeoCombiTrans(0.,0.,0,rotUni));
RPC_AluInBox->SetVisibility(kFALSE); //invisible interior volume (air)
//Foam (box) between aluminium box and copper PCB
//TODO! Change to a proper Medium: needed the density and composition
TGeoVolume *RPC_FoamBox=gGeoManager->MakeBox("RPC_FoamBox", pAirMedium,
163.0/2,126.5/2,0.87/2);
RPC_AluInBox->AddNode(RPC_FoamBox,0,new TGeoCombiTrans(0.,0.,0.565,rotUni));
RPC_FoamBox->SetLineColor(kYellow);
//copper (box) between foam box and the PCB
//NOTE: It is not divided at this stage. It is also NOT the sensitive
//material, but signals are going to be taken from the gas, dividing it
//with the proper copper-pad segmentation.
TGeoVolume *RPC_CopperBox=gGeoManager->MakeBox("RPC_CopperBox", pCopperMedium,
163.0/2,126.5/2,0.003/2);
RPC_AluInBox->AddNode(RPC_CopperBox,0,new TGeoCombiTrans(0.,0.,0.1285,rotUni));
RPC_CopperBox->SetLineColor(kRed);
//PCB (box) between copper and the metacrilate
//NOTE (TODO?) Using Carbon Fibre material for the PCB. Ask for more info.
TGeoVolume *RPC_PCBBox=gGeoManager->MakeBox("RPC_PCBBox", pCarbonFibreMedium,
163.0/2,126.5/2,0.157/2);
RPC_AluInBox->AddNode(RPC_PCBBox,0,new TGeoCombiTrans(0.,0.,0.0485,rotUni));
RPC_PCBBox->SetLineColor(kGreen);
//Metacrilate box containing gas and glass
//TODO: change the medium to metacrilate
TGeoVolume *RPC_MetaBox=gGeoManager->MakeBox("RPC_MetaBox", pRPCGlassMedium,
163.0/2,126.5/2,0.97/2);
RPC_AluInBox->AddNode(RPC_MetaBox,0,new TGeoCombiTrans(0.,0.,-0.515,rotUni));
RPC_MetaBox->SetLineColor(kWhite);
TGeoVolume *RPC_MetaInBox=gGeoManager->MakeBox("RPC_MetaInBox", pRPCGasR134AMedium,
160.0/2,123.5/2,0.77/2);
RPC_MetaBox->AddNode(RPC_MetaInBox,0,new TGeoCombiTrans(0.,0.,0.,rotUni));
RPC_MetaInBox->SetVisibility(kFALSE); //invisible interior volume (gas)
//Glass planes in the gas (medium of RPC_MetaInBox volume)
TGeoVolume *RPC_GlassBox=gGeoManager->MakeBox("RPC_GlassBox", pRPCGlassMedium,
155.5/2,122.5/2,0.19/2);
RPC_MetaInBox->AddNode(RPC_GlassBox,0,new TGeoCombiTrans(0.,0.,-0.29,rotUni));
RPC_MetaInBox->AddNode(RPC_GlassBox,1,new TGeoCombiTrans(0.,0.,0.,rotUni));
RPC_MetaInBox->AddNode(RPC_GlassBox,2,new TGeoCombiTrans(0.,0.,0.29,rotUni));
RPC_GlassBox->SetLineColor(kBlue);
//Gas (planes) already in the gas (sensitive volumes where ionization takes place)
TGeoVolume *RPC_GasBox=gGeoManager->MakeBox("RPC_GasBox", pRPCGasR134AMedium,
151.2/2,121.0/2,0.1/2);
RPC_MetaInBox->AddNode(RPC_GasBox,0,new TGeoCombiTrans(0.,0.,-0.145,rotUni));
RPC_MetaInBox->AddNode(RPC_GasBox,1,new TGeoCombiTrans(0.,0.,0.145,rotUni));
RPC_GasBox->SetVisibility(kFALSE); //invisible interior volume (gas)
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例11: create_aladin_geo
//.........这里部分代码省略.........
cell->AddNode(pAladinFrontFlangeLog,1,pMatrix14);
/******************************************************/
/************* Aladin shape corrections ************************/
/*****************************************************/
// Combi transformation "up":
dx = 0.000000;
dy = 25.900000;
dz = 255.0;
TGeoRotation *gRot11 = new TGeoRotation();
gRot11->RotateX(180.);
gRot11->RotateY(-7.000000);
gRot11->RotateZ(0.);
TGeoCombiTrans *pMatrix67 = new TGeoCombiTrans("", dx,dy,dz,gRot11);
// shape "up":
Double_t cd[8][2];
cd[0][0] = 78.0; cd[0][1] = 0.0;
cd[1][0] = 78.0; cd[1][1] = 0.001;
cd[2][0] = -78.0; cd[2][1] = 0.001;
cd[3][0] = -78.0; cd[3][1] = 0.0;
cd[4][0] = 78.0; cd[4][1] = 0.0;
cd[5][0] = 78.0; cd[5][1] = 1.0;
cd[6][0] = -78.0; cd[6][1] = 1.0;
cd[7][0] = -78.0; cd[7][1] = 0.0;
TGeoShape *pAupBox = new TGeoArb8("AupBox", 88.0, &cd[0][0]);
TGeoVolume* pAupLog = new TGeoVolume("AupLog",pAupBox, pMedFe);
// Combi transformation "down":
dx = 0.000000;
dy = -25.900000;
dz = 255.0;
TGeoRotation *gRot12 = new TGeoRotation();
gRot12->RotateX(0.);
gRot12->RotateY(-7.000000);
gRot12->RotateZ(0.);
TGeoCombiTrans *pMatrix68 = new TGeoCombiTrans("", dx,dy,dz,gRot12);
// shape "down":
cd[0][0] = 78.0; cd[0][1] = 0.0;
cd[1][0] = 78.0; cd[1][1] = 1.0;
cd[2][0] = -78.0; cd[2][1] = 1.0;
cd[3][0] = -78.0; cd[3][1] = 0.0;
cd[4][0] = 78.0; cd[4][1] = 0.0;
cd[5][0] = 78.0; cd[5][1] = 0.001;
cd[6][0] = -78.0; cd[6][1] = 0.001;
cd[7][0] = -78.0; cd[7][1] = 0.0;
TGeoShape *pAdownBox = new TGeoArb8("AdownBox", 88.0, &cd[0][0]);
TGeoVolume* pAdownLog = new TGeoVolume("AdownLog",pAdownBox, pMedFe);
// pAWorld->AddNode(pHeliumAladinChamberLog1,1,pMatrix61);
// pAWorld->AddNode(pHeliumAladinChamberLog2,1,pMatrix62);
// pAWorld->AddNode(pHeliumAladinChamberLog3,1,pMatrix63);
pAladinChamberLog1->AddNode(pHeliumAladinChamberLog1,1,pMatrix0);
pAladinChamberLog2->AddNode(pHeliumAladinChamberLog2,1,pMatrix0);
pAladinChamberLog3->AddNode(pHeliumAladinChamberLog3,1,pMatrix0);
cell->AddNode(pAladinChamberLog1,1,pMatrix58);
cell->AddNode(pAladinChamberLog2,1,pMatrix59);
cell->AddNode(pAladinChamberLog3,1,pMatrix60);
cell->AddNode(pinWINLog,1,pMatrix64);
cell->AddNode(poutWINLog,1,pMatrix65);
cell->AddNode(pinHELLog,1,pMatrix66);
cell->AddNode(pAupLog,1,pMatrix67);
cell->AddNode(pAdownLog,1,pMatrix68);
TGeoVolumeAssembly* top_cell = new TGeoVolumeAssembly("ALADIN");
TGeoCombiTrans* inverse_matr = new TGeoCombiTrans("");
inverse_matr->SetTranslation(0., 0., -1. * DistanceFromtargetToAladinCenter);
inverse_matr->RotateY(-1. * Aladin_angle);
top_cell->AddNode(cell, 1, inverse_matr);
TGeoCombiTrans* aladin_matr = new TGeoCombiTrans(0., 0., DistanceFromtargetToAladinCenter, rot_aladin);
top->AddNode(top_cell, 1, aladin_matr);
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}
示例12: create_bpipe_geometry_v13e
//.........这里部分代码省略.........
pipe->AddNode(pipe3, 0);
TGeoVolume* pipevac2 = MakeVacuum(2, nSects02, z02, rin02, rout02, vacuum, &infoFile);
pipevac2->SetLineColor(kCyan);
pipe->AddNode(pipevac2, 0);
//*/
// define some rotation & translation for pipe4-pipe7 & pipevac3-pipevac5
// Initial phi (Euler rotation angle about Z)
// Initial theta (Euler rotation angle about new X)
// Initial psi (Euler rotation angle about new Z)
cout<<endl<<"Rotation angle (@[0;0;1800]mm)="<< rotangle <<"deg";
TGeoRotation *r1 = new TGeoRotation("r1", 90., rotangle, 0.); // deg - Euler angles
r1->RegisterYourself();
Double_t shift = rotangle/10.+0.1; // cm - volume boolean operation correction - TODO
Double_t dx=0., dy=0., dz=1800.-10.*shift; // mm
TGeoCombiTrans *c1 = new TGeoCombiTrans("c1", dx/10., dy/10., dz/10., r1); // mm->cm
c1->RegisterYourself();
TGeoTranslation *t1 = new TGeoTranslation("t1", 0., 0., 180.-shift); // cm
t1->RegisterYourself();
Double_t phi, theta, psi;
c1->GetRotation()->GetAngles(phi, theta, psi);
infoFile << endl << "Beam pipe section: " << pipe4name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
// create shape components for pipe4
TGeoPcon* p4 = MakeShape(nSects4, "p4", z4, rin4, rout4, &infoFile);
TGeoBBox* b = new TGeoBBox("b", 7., 7., shift); // cm 0.13
// create a composite for pipe4
//*
TGeoCompositeShape *cs1 = new TGeoCompositeShape("cs1", "p4:r1-b");
TGeoVolume *pipe4 = new TGeoVolume("pipe4",cs1, pipeMedium);
pipe4->SetLineColor(kGreen+2);
pipe->AddNode(pipe4, 0, t1);
//*/
// create shape components for pipevac3
TGeoPcon* p03 = MakeShape(nSects03, "p03", z03, rin03, rout03, &infoFileEmpty);
// create a composite for pipevac3
TGeoCompositeShape *cs2 = new TGeoCompositeShape("cs2", "p03:r1-b");
TGeoVolume *pipevac3 = new TGeoVolume("pipevac3",cs2, vacuum);
pipevac3->SetLineColor(kCyan);
pipe->AddNode(pipevac3, 0, t1);
//*
infoFile << endl << "Beam pipe section: " << pipe5name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
TGeoVolume* pipe5 = MakePipe (5, nSects5, z5, rin5, rout5, pipeMedium, &infoFile);
pipe5->SetLineColor(kGreen);
pipe->AddNode(pipe5, 0, c1);
TGeoVolume* pipevac4 = MakeVacuum(4, nSects04, z04, rin04, rout04, vacuum, &infoFile);
pipevac4->SetLineColor(kCyan);
pipe->AddNode(pipevac4, 0, c1);
infoFile << endl << "Beam pipe section: " << pipe6name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
TGeoVolume* pipe6 = MakePipe (6, nSects6, z6, rin6, rout6, pipeMedium, &infoFile);
pipe6->SetLineColor(kBlue);
pipe->AddNode(pipe6, 0, c1);
infoFile << endl << "Beam pipe section: " << pipe7name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
TGeoVolume* pipe7 = MakePipe (7, nSects7, z7, rin7, rout7, pipeMedium, &infoFile);
pipe7->SetLineColor(kGreen);
pipe->AddNode(pipe7, 0, c1);
TGeoVolume* pipevac5 = MakeVacuum(5, nSects05, z05, rin05, rout05, vacuum, &infoFile);
pipevac5->SetLineColor(kCyan);
pipe->AddNode(pipevac5, 0, c1);
//*/
// ----- End --------------------------------------------------
// --------------- Finish -----------------------------------------------
top->AddNode(pipe, 1);
cout << endl << endl;
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
// visualize it with ray tracing, OGL/X3D viewer
//top->Raytrace();
top->Draw("ogl");
//top->Draw("x3d");
TFile* rootFile = new TFile(rootFileName, "RECREATE");
top->Write();
cout << endl;
cout << "Geometry " << top->GetName() << " written to "
<< rootFileName << endl;
rootFile->Close();
infoFile.close();
}
示例13: create_sfi_geo
//.........这里部分代码省略.........
// -------------- Create geometry and top volume -------------------------
gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
gGeoMan->SetName("GFIgeom");
TGeoVolume* top = new TGeoVolumeAssembly("TOP");
gGeoMan->SetTopVolume(top);
// --------------------------------------------------------------------------
//LABPOS(GFI1,-73.274339,0.069976,513.649524)
Float_t dx = -73.274339; //dE tracker, correction due to wrong angle
Float_t dy = 0.069976;
Float_t dz = 513.649524;
TGeoRotation *pMatrix3 = new TGeoRotation();
//pMatrix3->RotateY(-16.7);
TGeoCombiTrans*
pMatrix2 = new TGeoCombiTrans("", dx,dy,dz,pMatrix3);
//LABPOS(GFI2,-147.135037,0.069976,729.680342)
dx = -147.135037; //dE tracker, correction due to wrong angle
dy = 0.069976;
dz = 729.680342;
TGeoRotation *pMatrix5 = new TGeoRotation();
//pMatrix5->RotateY(-16.7);
TGeoCombiTrans*
pMatrix4 = new TGeoCombiTrans("", dx,dy,dz,pMatrix5);
// World definition
TGeoVolume* pWorld = gGeoManager->GetTopVolume();
pWorld->SetVisLeaves(kTRUE);
// SHAPES, VOLUMES AND GEOMETRICAL HIERARCHY
// Volume: GFILogWorld
TGeoVolume* pGFILogWorld = new TGeoVolumeAssembly("GFILogWorld");
pGFILogWorld->SetVisLeaves(kTRUE);
// Global positioning
pWorld->AddNode( pGFILogWorld, 0, pMatrix2 );
Float_t detector_size = 5.120000;
Float_t fiber_thickness = 0.020000;
TGeoShape *pGFITube = new TGeoBBox("GFITube", fiber_thickness/2,detector_size/2,fiber_thickness/2);
TGeoVolume* pGFILog = new TGeoVolume("SFILog",pGFITube, pMed35);
TGeoShape *pGFITubeActive = new TGeoBBox("GFITubeActive", (fiber_thickness * .98)/2, detector_size/2-0.0001, (fiber_thickness * .98)/2);
TGeoVolume* pGFILogActive = new TGeoVolume("SFI1Log",pGFITubeActive,pMed35);
pGFILog->SetLineColor((Color_t) 1);
pGFILog->SetVisLeaves(kTRUE);
TGeoRotation *pMatrixTube = new TGeoRotation();
pMatrixTube->RotateZ(90);
pGFILog -> AddNode(pGFILogActive, 0, new TGeoCombiTrans());
for(int fiber_id = 0; fiber_id < detector_size / fiber_thickness; fiber_id++)
{
pGFILogWorld->AddNode(pGFILog, fiber_id,
new TGeoCombiTrans("",
-detector_size / 2 + (fiber_id + .5) * fiber_thickness,
0,
0,
new TGeoRotation()
)
);
pGFILogWorld->AddNode(pGFILog, fiber_id + detector_size / fiber_thickness,
new TGeoCombiTrans("",
0,
-detector_size / 2 + (fiber_id + .5) * fiber_thickness,
fiber_thickness,
pMatrixTube
)
);
}
// Add the sensitive part
// AddSensitiveVolume(pGFILog);
// fNbOfSensitiveVol+=1;
// --------------- Finish -----------------------------------------------
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
TFile* geoFile = new TFile(geoFileName, "RECREATE");
top->Write();
geoFile->Close();
// --------------------------------------------------------------------------
}