当前位置: 首页>>代码示例>>C++>>正文


C++ TGeoManager::SetVisOption方法代码示例

本文整理汇总了C++中TGeoManager::SetVisOption方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoManager::SetVisOption方法的具体用法?C++ TGeoManager::SetVisOption怎么用?C++ TGeoManager::SetVisOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TGeoManager的用法示例。


在下文中一共展示了TGeoManager::SetVisOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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();
}
开发者ID:Y--,项目名称:root,代码行数:88,代码来源:assembly.C

示例2: 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();
}
开发者ID:star-bnl,项目名称:star-emc,代码行数:95,代码来源:show.C

示例3: dump

void LCDDImp::dump() const {
  TGeoManager* mgr = m_manager;
  mgr->SetVisLevel(4);
  mgr->SetVisOption(1);
  m_worldVol->Draw("ogl");
}
开发者ID:vvolkl,项目名称:DD4hep,代码行数:6,代码来源:LCDDImp.cpp


注:本文中的TGeoManager::SetVisOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。