本文整理汇总了C++中TGeoManager::SetVisLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoManager::SetVisLevel方法的具体用法?C++ TGeoManager::SetVisLevel怎么用?C++ TGeoManager::SetVisLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGeoManager
的用法示例。
在下文中一共展示了TGeoManager::SetVisLevel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rootgeom
//.........这里部分代码省略.........
new TGeoRotation("rot2",90,180,90,90,180,0));
TGeoCombiTrans *combi3 = new TGeoCombiTrans(100,0,0,
new TGeoRotation("rot3",90,270,0,0,90,180));
TGeoCombiTrans *combi4 = new TGeoCombiTrans(-100,0,0,
new TGeoRotation("rot4",90,90,0,0,90,0));
TGeoCombiTrans *combi5 = new TGeoCombiTrans(0,100,0,
new TGeoRotation("rot5",0,0,90,180,90,270));
TGeoCombiTrans *combi6 = new TGeoCombiTrans(0,-100,0,
new TGeoRotation("rot6",180,0,90,180,90,90));
//--- make the top container volume
Double_t worldx = 110.;
Double_t worldy = 50.;
Double_t worldz = 5.;
TGeoVolume *top = geom->MakeBox("TOP", Vacuum, 270., 270., 120.);
geom->SetTopVolume(top);
TGeoVolume *replica = geom->MakeBox("REPLICA", Vacuum,120,120,120);
replica->SetVisibility(kFALSE);
TGeoVolume *rootbox = geom->MakeBox("ROOT", Vacuum, 110., 50., 5.);
rootbox->SetVisibility(kFALSE);
//--- make letter 'R'
TGeoVolume *R = geom->MakeBox("R", Vacuum, 25., 25., 5.);
R->SetVisibility(kFALSE);
TGeoVolume *bar1 = geom->MakeBox("bar1", Al, 5., 25, 5.);
bar1->SetLineColor(kRed);
R->AddNode(bar1, 1, tr1);
TGeoVolume *bar2 = geom->MakeBox("bar2", Al, 5., 5., 5.);
bar2->SetLineColor(kRed);
R->AddNode(bar2, 1, tr2);
R->AddNode(bar2, 2, tr3);
TGeoVolume *tub1 = geom->MakeTubs("tub1", Al, 5., 15., 5., 90., 270.);
tub1->SetLineColor(kRed);
R->AddNode(tub1, 1, tr4);
TGeoVolume *bar3 = geom->MakeArb8("bar3", Al, 5.);
bar3->SetLineColor(kRed);
TGeoArb8 *arb = (TGeoArb8*)bar3->GetShape();
arb->SetVertex(0, 15., -5.);
arb->SetVertex(1, 0., -25.);
arb->SetVertex(2, -10., -25.);
arb->SetVertex(3, 5., -5.);
arb->SetVertex(4, 15., -5.);
arb->SetVertex(5, 0., -25.);
arb->SetVertex(6, -10., -25.);
arb->SetVertex(7, 5., -5.);
R->AddNode(bar3, 1, gGeoIdentity);
//--- make letter 'O'
TGeoVolume *O = geom->MakeBox("O", Vacuum, 25., 25., 5.);
O->SetVisibility(kFALSE);
TGeoVolume *bar4 = geom->MakeBox("bar4", Al, 5., 7.5, 5.);
bar4->SetLineColor(kYellow);
O->AddNode(bar4, 1, tr5);
O->AddNode(bar4, 2, tr6);
TGeoVolume *tub2 = geom->MakeTubs("tub1", Al, 7.5, 17.5, 5., 0., 180.);
tub2->SetLineColor(kYellow);
O->AddNode(tub2, 1, tr7);
O->AddNode(tub2, 2, combi1);
//--- make letter 'T'
TGeoVolume *T = geom->MakeBox("T", Vacuum, 25., 25., 5.);
T->SetVisibility(kFALSE);
TGeoVolume *bar5 = geom->MakeBox("bar5", Al, 5., 20., 5.);
bar5->SetLineColor(kBlue);
T->AddNode(bar5, 1, tr8);
TGeoVolume *bar6 = geom->MakeBox("bar6", Al, 17.5, 5., 5.);
bar6->SetLineColor(kBlue);
T->AddNode(bar6, 1, tr9);
rootbox->AddNode(R, 1, tr10);
rootbox->AddNode(O, 1, tr11);
rootbox->AddNode(O, 2, tr12);
rootbox->AddNode(T, 1, tr13);
replica->AddNode(rootbox, 1, tr14);
replica->AddNode(rootbox, 2, combi2);
replica->AddNode(rootbox, 3, combi3);
replica->AddNode(rootbox, 4, combi4);
replica->AddNode(rootbox, 5, combi5);
replica->AddNode(rootbox, 6, combi6);
top->AddNode(replica, 1, new TGeoTranslation(-150, -150, 0));
top->AddNode(replica, 2, new TGeoTranslation(150, -150, 0));
top->AddNode(replica, 3, new TGeoTranslation(150, 150, 0));
top->AddNode(replica, 4, new TGeoTranslation(-150, 150, 0));
//--- close the geometry
geom->CloseGeometry();
//--- draw the ROOT box.
// by default the picture will appear in the standard ROOT TPad.
//if you have activated the following line in system.rootrc,
//it will appear in the GL viewer
//#Viewer3D.DefaultDrawOption: ogl
geom->SetVisLevel(4);
top->Draw("ogle");
}
示例2: visualizationTracker
int visualizationTracker(float minZ, float maxZ, float minX, float maxX, float theta, float phi){
gSystem->Load("libGeom");
//++++++++++++++++++++ Set up stuff ++++++++++++++++++++//
TGeoManager *geom = new TGeoManager("simple1", "Simple geometry");
//--- define some materials and media
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
//--- make the top container volume
TGeoVolume *top = geom->MakeBox("TOP", Vacuum, 500., 500., 500.);
//TGeoVolume *toptop = geom->MakeBox("TOPTOP", Vacuum, 1000., 1000., 500.);
geom->SetTopVolume(top);
int count = 0;
for (int i = 0; i < _nEntries; ++i){
_inTree->GetEntry(i);
if (isRightSubDet()&&(_zVal >= minZ && _zVal < maxZ)&&(_xVal >= minX && _xVal < maxX)/*&&(_rVal <= 12)&&(_rVal >=8)*/){
char modName[192];
sprintf(modName, "testModule%i", i);
TGeoVolume* testMod = geom->MakeBox( modName, Vacuum, 90., 90., 40. );
getModule( geom, top, testMod );
count++;
}
}
if(count == 0) return -1;
getBeamVisuals(geom, top, minZ, maxZ);
//--- close the geometry
geom->CloseGeometry();
// -- draw
geom->SetVisLevel(4);
TCanvas * c = new TCanvas();
c->SetTheta(theta);
c->SetPhi(phi);
top->Draw();
//--- putting words on canvas...
bool with0T = true;
//can play with these numbers
double widthofeach = 0.07;
double textsize = 0.05;
double xmax = 2*widthofeach;
if (with0T) xmax = widthofeach;
TPaveText* pt = new TPaveText(0,0,xmax,1,"brNDC");
pt->SetBorderSize(0);
pt->SetFillStyle(0);
pt->SetTextAlign(22);
pt->SetTextFont(42);
pt->SetTextSize(0.1);
TText *text = pt->AddText(0,0,TString("#font[42]{"+_line1+"}"));
text->SetTextSize(textsize);
text->SetTextAngle(90);
pt->Draw();
TPaveText *pt2 = new TPaveText(widthofeach, 0, 2*widthofeach, 1, "brNDC");
pt2->SetBorderSize(0);
pt2->SetFillStyle(0);
pt2->SetTextAlign(22);
pt2->SetTextFont(42);
pt2->SetTextSize(0.1);
TText *text2 = pt2->AddText(0,0,TString("#font[42]{"+_line2+"}"));
text2->SetTextSize(textsize);
text2->SetTextAngle(90);
pt2->Draw();
TPaveText *pt3 = new TPaveText(2*widthofeach, 0, 3*widthofeach, 1, "brNDC");
pt3->SetBorderSize(0);
pt3->SetFillStyle(0);
pt3->SetTextAlign(22);
pt3->SetTextFont(42);
pt3->SetTextSize(0.1);
TText *text3 = pt3->AddText(0,0,TString("#font[42]{"+_line3+"}"));
text3->SetTextSize(textsize);
text3->SetTextAngle(90);
pt3->Draw();
string str = string("i") + to_string(_i) + string(".gif");
c->SaveAs(TString(str));
gSystem->Exec(TString("mv "+str+" images/"+str));
delete c;
cout << "Created image " << str << endl;
return 0;
}
示例3: StEEmcDbMaker
void
show
(
char* inpDir = "", // MuDST directory
char* inpFile = "show.lis", // MuDST file(s);
char* outFile = "show.root",// output tree file
Int_t nFiles = 50, // # of MuDST file(s)
Int_t nEvents = 100 // # of events
)
// remeber to adjust dbase timestamp below !!!!
// what a ... design
{
//gErrorIgnoreLevel=1999;
// load root/root4star libraries
gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
loadSharedLibraries();
// load more libraries :)
gSystem->Load("libmysqlclient");
gSystem->Load("libGeom");
gSystem->Load("StDbLib");
gSystem->Load("StDbBroker");
gSystem->Load("St_db_Maker");
// load even more libraries (EEMC stuff)
gSystem->Load("StEEmcUtil");
gSystem->Load("StEEmcDbMaker");
gSystem->Load("StEEmcPoolTTM");
// create the chain
chain = new StChain("StChain");
//
now = new TDatime;
// for display
TCanvas *c1 = new TCanvas("eemc","eemc",10,10,1000,1000);
TPaveLabel *tlab = new TPaveLabel(-0.99,+0.99,+0.99,+0.90,
"EEMC TOWERS & TPC TRACKS Piotr A Zolnierczuk (IU)");
eventInfo = new TPaveText (-0.99,-0.99,+0.0 ,-0.75);
dateInfo = new TPaveLabel(+0.60,-0.99,+0.99,-0.95,now->AsString());
TGeoManager *gm = new TGeoManager("eemc", "eemc tower display");
TGeoVolume *top = gm->MakeBox("star",0, 200., 200., 350.);
TGeoVolume *smbox = gm->MakeBox("smbox1",0, 2., 2., 2.);
smbox->SetLineColor(kRed);
// eemc
eemc = new EEmcTTDisplay();
eemc->SetMagneticField(0.5); // in Tesla
eemc->SetShowExtrapolatedTracks(true);
TGeoTranslation *etra = new TGeoTranslation(0.0,0.0,0.5*(eemc->getZ1()+eemc->getZ2()));
top->AddNode(smbox, 1,NULL);
top->AddNode(eemc(),1,etra);
gm->SetTopVolume(top);
gm->CloseGeometry();
gm->SetVisLevel(4);
gm->SetVisOption(0);
c1->SetTheta(90);
c1->SetPhi(0);
top->Draw();
tlab->Draw();
gPad->Update();
// now we add Makers to the chain... some of that is black magic :)
muDstMk = new StMuDstMaker(0,0,inpDir,inpFile,"",nFiles); // muDST main chain
StMuDbReader *db = StMuDbReader::instance(); // need the database
St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb"); // need another db(?)
new StEEmcDbMaker("eemcDb"); // need EEMC database
// now comment in/out/change the below if you want it your way
dbMk->setTimeStampDay(20040331); // format: yyyymmdd
// finally after so many lines we arrive at the good stuff
ttm = new EEmcTTMMaker ("TTM",muDstMk,eemcDbMk);
ttm->Summary(cout); //
StMuDebug::setLevel(0);
chain->Init();
StEEmcDb *eemcDb = (StEEmcDb*)chain->GetDataSet("StEEmcDb");
eemcDb->setSectors(1,12); // request EEMC DB for sectors you need (dafault:1-12)
eemcDb->setPreferedFlavor("onlped","eemcPMTped"); // request alternative flavor
chain->ls(3);
//---------------------------------------------------
next();
}
示例4: assembly
void assembly()
{
//--- Definition of a simple geometry
gSystem->Load("libGeom");
TGeoManager *geom = new TGeoManager("Assemblies",
"Geometry using assemblies");
Int_t i;
//--- define some materials
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
// //--- define some media
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
TGeoMedium *Al = new TGeoMedium("Aluminium",2, matAl);
//--- make the top container volume
TGeoVolume *top = geom->MakeBox("TOP", Vacuum, 1000., 1000., 100.);
geom->SetTopVolume(top);
// Make the elementary assembly of the whole structure
TGeoVolume *tplate = new TGeoVolumeAssembly("TOOTHPLATE");
Int_t ntooth = 5;
Double_t xplate = 25;
Double_t yplate = 50;
Double_t xtooth = 10;
Double_t ytooth = 0.5*yplate/ntooth;
Double_t dshift = 2.*xplate + xtooth;
Double_t xt,yt;
TGeoVolume *plate = geom->MakeBox("PLATE", Al, xplate,yplate,1);
plate->SetLineColor(kBlue);
TGeoVolume *tooth = geom->MakeBox("TOOTH", Al, xtooth,ytooth,1);
tooth->SetLineColor(kBlue);
tplate->AddNode(plate,1);
for (i=0; i<ntooth; i++) {
xt = xplate+xtooth;
yt = -yplate + (4*i+1)*ytooth;
tplate->AddNode(tooth, i+1, new TGeoTranslation(xt,yt,0));
xt = -xplate-xtooth;
yt = -yplate + (4*i+3)*ytooth;
tplate->AddNode(tooth, ntooth+i+1, new TGeoTranslation(xt,yt,0));
}
TGeoRotation *rot1 = new TGeoRotation();
rot1->RotateX(90);
TGeoRotation *rot;
// Make a hexagone cell out of 6 tooth plates. These can zip together
// without generating overlaps (they are self-contained)
TGeoVolume *cell = new TGeoVolumeAssembly("CELL");
for (i=0; i<6; i++) {
Double_t phi = 60.*i;
Double_t phirad = phi*TMath::DegToRad();
Double_t xp = dshift*TMath::Sin(phirad);
Double_t yp = -dshift*TMath::Cos(phirad);
rot = new TGeoRotation(*rot1);
rot->RotateZ(phi);
cell->AddNode(tplate,i+1,new TGeoCombiTrans(xp,yp,0,rot));
}
// Make a row as an assembly of cells, then combine rows in a honeycomb
// structure. This again works without any need to define rows as
// "overlapping"
TGeoVolume *row = new TGeoVolumeAssembly("ROW");
Int_t ncells = 5;
for (i=0; i<ncells; i++) {
Double_t ycell = (2*i+1)*(dshift+10);
row->AddNode(cell, ncells+i+1, new TGeoTranslation(0,ycell,0));
row->AddNode(cell,ncells-i,new TGeoTranslation(0,-ycell,0));
}
Double_t dxrow = 3.*(dshift+10.)*TMath::Tan(30.*TMath::DegToRad());
Double_t dyrow = dshift+10.;
Int_t nrows = 5;
for (i=0; i<nrows; i++) {
Double_t xrow = 0.5*(2*i+1)*dxrow;
Double_t yrow = 0.5*dyrow;
if ((i%2)==0) yrow = -yrow;
top->AddNode(row, nrows+i+1, new TGeoTranslation(xrow,yrow,0));
top->AddNode(row, nrows-i, new TGeoTranslation(-xrow,-yrow,0));
}
//--- close the geometry
geom->CloseGeometry();
geom->SetVisLevel(4);
geom->SetVisOption(0);
top->Draw();
}
示例5: event3D
void event3D()
{
gSystem->Load("libGeom");
TGeoManager *geom = new TGeoManager("simple1", "Simple geometry");
//--- define some materials
TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
// //--- define some media
TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl);
//--- make the top container volume
Double_t worldx = 110.;
Double_t worldy = 50.;
Double_t worldz = 5.;
TGeoVolume *top = geom->MakeBox("TOP", Vacuum, 100., 100., 100.);
geom->SetTopVolume(top);
gGeoManager->GetVolume("TOP")->InvisibleAll();
//Measurements (in cm)
Double_t target_rad = 0.3;
Double_t target_len = 48.58;
Double_t RTPC_len = 41.;
Double_t foil1_R1 = 2.;
Double_t foil1_R2 = 2.0000018;
Double_t foil2_R1 = 3.;
Double_t foil2_R2 = 3.0000018;
Double_t GEM1_R1 = 7.;
Double_t GEM1_R2 = 7.0005;
Double_t GEM2_R1 = 7.3;
Double_t GEM2_R2 = 7.3005;
Double_t GEM3_R1 = 7.6;
Double_t GEM3_R2 = 7.6005;
Double_t Z_offset = 0;
Int_t trans_lvl = 70;
TGeoTube *target = new TGeoTube("target_tube",0, target_rad, target_len/2);
TGeoVolume *target_vol = new TGeoVolume("target_vol",target, Al); //(*)
top->AddNode(target_vol,1,new TGeoTranslation(0,0, Z_offset));
gGeoManager->GetVolume("target_vol")->SetTransparency(0);
TGeoTube *foil1 = new TGeoTube("foil1_tube", foil1_R1, foil1_R2, RTPC_len/2);
TGeoVolume *foil1_vol = new TGeoVolume("foil1_vol", foil1, Al); //(*)
top->AddNode(foil1_vol,1,new TGeoTranslation(0,0, Z_offset));
TGeoTube *foil2 = new TGeoTube("foil2_tube", foil2_R1, foil2_R2, RTPC_len/2);
TGeoVolume *foil2_vol = new TGeoVolume("foil2_vol", foil2, Al); //(*)
top->AddNode(foil2_vol,1,new TGeoTranslation(0,0, Z_offset));
TGeoTube *gem1 = new TGeoTube("gem1_tube", GEM1_R1, GEM1_R2, RTPC_len/2);
TGeoVolume *gem1_vol = new TGeoVolume("gem1_vol", gem1, Al); //(*)
gem1_vol->SetLineColor(kOrange);
top->AddNode(gem1_vol,1,new TGeoTranslation(0,0, Z_offset));
TGeoTube *gem2 = new TGeoTube("gem2_tube", GEM2_R1, GEM2_R2, RTPC_len/2);
TGeoVolume *gem2_vol = new TGeoVolume("gem2_vol", gem2, Al); //(*)
gem2_vol->SetLineColor(kGreen);
top->AddNode(gem2_vol,1,new TGeoTranslation(0,0, Z_offset));
TGeoTube *gem3 = new TGeoTube("gem3_tube", GEM3_R1, GEM3_R2, RTPC_len/2);
TGeoVolume *gem3_vol = new TGeoVolume("gem3_vol", gem3, Al); //(*)
top->AddNode(gem3_vol,1,new TGeoTranslation(0,0, Z_offset));
gem3_vol->SetLineColor(kRed);
gGeoManager->GetVolume("gem3_vol")->SetTransparency(trans_lvl);
//--- draw the ROOT box.
// by default the picture will appear in the standard ROOT TPad.
//if you have activated the following line in system.rootrc,
//it will appear in the GL viewer
//#Viewer3D.DefaultDrawOption: ogl
geom->CloseGeometry();
geom->SetVisLevel(4);
// top->SetVisibility(kFALSE);
top->Draw("ogl");
gWorld = top;
}
示例6: nucleus
void nucleus(Int_t nProtons = 40,Int_t nNeutrons = 60)
{
Double_t NeutronRadius = 60,
ProtonRadius = 60,
NucleusRadius,
distance = 60;
Double_t vol = nProtons + nNeutrons;
vol = 3 * vol / (4 * TMath::Pi());
NucleusRadius = distance * TMath::Power(vol, 1./3.);
// cout << "NucleusRadius: " << NucleusRadius << endl;
TGeoManager * geom = new TGeoManager("nucleus", "Model of a nucleus");
geom->SetNsegments(40);
TGeoMaterial *matEmptySpace = new TGeoMaterial("EmptySpace", 0, 0, 0);
TGeoMaterial *matProton = new TGeoMaterial("Proton" , .938, 1., 10000.);
TGeoMaterial *matNeutron = new TGeoMaterial("Neutron" , .935, 0., 10000.);
TGeoMedium *EmptySpace = new TGeoMedium("Empty", 1, matEmptySpace);
TGeoMedium *Proton = new TGeoMedium("Proton", 1, matProton);
TGeoMedium *Neutron = new TGeoMedium("Neutron",1, matNeutron);
// the space where the nucleus lives (top container volume)
Double_t worldx = 200.;
Double_t worldy = 200.;
Double_t worldz = 200.;
TGeoVolume *top = geom->MakeBox("WORLD", EmptySpace, worldx, worldy, worldz);
geom->SetTopVolume(top);
TGeoVolume * proton = geom->MakeSphere("proton", Proton, 0., ProtonRadius);
TGeoVolume * neutron = geom->MakeSphere("neutron", Neutron, 0., NeutronRadius);
proton->SetLineColor(kRed);
neutron->SetLineColor(kBlue);
Double_t x, y, z, dummy;
Int_t i = 0;
while ( i< nProtons) {
gRandom->Rannor(x, y);
gRandom->Rannor(z,dummy);
if ( TMath::Sqrt(x*x + y*y + z*z) < 1) {
x = (2 * x - 1) * NucleusRadius;
y = (2 * y - 1) * NucleusRadius;
z = (2 * z - 1) * NucleusRadius;
top->AddNode(proton, i, new TGeoTranslation(x, y, z));
i++;
}
}
i = 0;
while ( i < nNeutrons) {
gRandom->Rannor(x, y);
gRandom->Rannor(z,dummy);
if ( TMath::Sqrt(x*x + y*y + z*z) < 1) {
x = (2 * x - 1) * NucleusRadius;
y = (2 * y - 1) * NucleusRadius;
z = (2 * z - 1) * NucleusRadius;
top->AddNode(neutron, i + nProtons, new TGeoTranslation(x, y, z));
i++;
}
}
geom->CloseGeometry();
geom->SetVisLevel(4);
top->Draw("ogl");
}
示例7: dump
void LCDDImp::dump() const {
TGeoManager* mgr = m_manager;
mgr->SetVisLevel(4);
mgr->SetVisOption(1);
m_worldVol->Draw("ogl");
}