Beispiel #1
0
void visibility_all_volumes(Bool_t vis_state)
{
   TGeoVolume *v;
   TIter it(gGeoManager->GetListOfVolumes());
   while ((v = (TGeoVolume*) it()) != 0)
   {
      v->SetVisibility(vis_state);
   }
   full_update();
}
Beispiel #2
0
 virtual TGeoVolume* MakeCopyVolume(TGeoShape *newshape) {
   // make a copy of this volume. build a volume with same name, shape and medium
   TGeoVolume *vol = _copyVol(newshape);
   vol->SetVisibility(IsVisible());
   vol->SetLineColor(GetLineColor());
   vol->SetLineStyle(GetLineStyle());
   vol->SetLineWidth(GetLineWidth());
   vol->SetFillColor(GetFillColor());
   vol->SetFillStyle(GetFillStyle());
   vol->SetField(fField);
   if (fFinder)
     vol->SetFinder(fFinder);
   CloneNodesAndConnect(vol);
   ((TObject*) vol)->SetBit(kVolumeClone);
   return vol;
 }
Beispiel #3
0
void visibility_volume_by_material(const char* material_re, Bool_t vis_state)
{
   TPMERegexp re(material_re, "o");
   TGeoMaterial *m;
   TIter it(gGeoManager->GetListOfMaterials());
   while ((m = (TGeoMaterial*) it()) != 0)
   {
      if (re.Match(m->GetName()))
      {
         TGeoVolume *v;
         TIter it2(gGeoManager->GetListOfVolumes());
         while ((v = (TGeoVolume*) it2()) != 0)
         {
            if (v->GetMaterial() == m)
            {
               v->SetVisibility(vis_state);
            }
         }
      }
   }
   full_update();
}
Beispiel #4
0
void rootgeom()
{
//Definition of a simple geometry (the 4 ROOT characters)
//Author: Andrei Gheata
   
   // gStyle->SetCanvasPreferGL(true);
   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);

   //--- define the transformations
   TGeoTranslation *tr1 = new TGeoTranslation(20., 0, 0.);
   TGeoTranslation *tr2 = new TGeoTranslation(10., 0., 0.);
   TGeoTranslation *tr3 = new TGeoTranslation(10., 20., 0.);
   TGeoTranslation *tr4 = new TGeoTranslation(5., 10., 0.);
   TGeoTranslation *tr5 = new TGeoTranslation(20., 0., 0.);
   TGeoTranslation *tr6 = new TGeoTranslation(-5., 0., 0.);
   TGeoTranslation *tr7 = new TGeoTranslation(7.5, 7.5, 0.);
   TGeoRotation   *rot1 = new TGeoRotation("rot1", 90., 0., 90., 270., 0., 0.);
   TGeoCombiTrans *combi1 = new TGeoCombiTrans(7.5, -7.5, 0., rot1);
   TGeoTranslation *tr8 = new TGeoTranslation(7.5, -5., 0.);
   TGeoTranslation *tr9 = new TGeoTranslation(7.5, 20., 0.);
   TGeoTranslation *tr10 = new TGeoTranslation(85., 0., 0.);
   TGeoTranslation *tr11 = new TGeoTranslation(35., 0., 0.);
   TGeoTranslation *tr12 = new TGeoTranslation(-15., 0., 0.);
   TGeoTranslation *tr13 = new TGeoTranslation(-65., 0., 0.);
   
   TGeoTranslation  *tr14 = new TGeoTranslation(0,0,-100);
   TGeoCombiTrans *combi2 = new TGeoCombiTrans(0,0,100, 
                                   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");
}   
Beispiel #5
0
void robot()
{
  // Drawing a famous Korean robot, TaekwonV, using ROOT geometry class.
  // Name: robot.C
  // Author: Jin Hui Hwang, Dept. of Physics, Univ. of Seoul
  // Reviewed by Sunman Kim ([email protected])
  // Supervisor: Prof. Inkyu Park ([email protected])
  //
  // How to run: .x robot.C in ROOT terminal, then use OpenGL
  //
  // This macro was created for the evaluation of Computational Physics course in 2006.
  // We thank to Prof. Inkyu Park for his special lecture on ROOT and to all of ROOT team
  //

  TGeoManager *Robot = new TGeoManager("Robot", "This is Taegwon V");

  TGeoMaterial *vacuum = new TGeoMaterial("vacuum", 0, 0, 0);
  TGeoMaterial *Fe     = new TGeoMaterial("Fe", 55.845, 26, 7.87);

  TGeoMedium *Air  = new TGeoMedium("Vacuum", 0, vacuum);
  TGeoMedium *Iron = new TGeoMedium("Iron", 1, Fe);

  // create volume

  TGeoVolume *top = Robot->MakeBox("top", Air, 1000, 1000, 1000);
  Robot->SetTopVolume(top);
  Robot->SetTopVisible(0);
  // If you want to see the boundary, please input the number, 1 instead of 0.
  // Like this, geom->SetTopVisible(1);

  // head
  TGeoVolume *Band = Robot->MakeEltu("Band", Iron, 20, 20, 2.5);
  Band->SetLineColor(12);
  Band->SetFillColor(12);
  TGeoVolume *Band_b = Robot->MakeSphere("Band_b", Iron, 0, 2, 0, 180, 180, 360);
  Band_b->SetLineColor(2);
  Band_b->SetFillColor(2);
  TGeoVolume *Head = Robot->MakeSphere("Head", Iron, 0, 19, 0, 180, 180, 360);
  Head->SetLineColor(17);
  Head->SetFillColor(17);
  TGeoVolume *Horn = Robot->MakeSphere("Horn", Iron, 0, 10, 60, 180, 240, 300);

  // drawing head
  top->AddNodeOverlap(Band, 1, new TGeoTranslation(0, 0, 90));
  float Phi = 3.14;
  int N     = 10;

  for (int i = 0; i <= N; i++) {
    top->AddNodeOverlap(Band_b, 1, new TGeoCombiTrans(sin(2 * Phi / N * i) * 19, -cos(2 * Phi / N * i) * 19, 90,
                                                      new TGeoRotation("R1", -90 + (360 / N * i), -90, 90)));
  }
  top->AddNodeOverlap(Head, 1, new TGeoCombiTrans(0, 0, 87.5, new TGeoRotation("R2", 0, -90, 0)));

  char name[50];
  float pcs = 30;
  for (int i = 1; i < pcs; i++) {
    sprintf(name, "Horn%d", i);
    Horn = Robot->MakeSphere(name, Iron, 10 - 10 / pcs * i, 10, 180 - (120 / pcs) * i, 180 - ((120 / pcs) * (i - 1)),
                             240, 300);
    Horn->SetLineColor(2);
    Horn->SetFillColor(2);
    top->AddNodeOverlap(Horn, 1, new TGeoCombiTrans(0, 8, 102, new TGeoRotation("R2", 0, 140, 0)));
    top->AddNodeOverlap(Horn, 1, new TGeoCombiTrans(0, -8, 102, new TGeoRotation("R2", 180, 140, 0)));
  }

  // face
  TGeoVolume *Migan = Robot->MakeGtra("Migan", Iron, 3, 0, 0, 0, 3, 2, 11, 0, 3, 3, 11, 0);
  Migan->SetLineColor(17);
  Migan->SetFillColor(17);
  TGeoVolume *Ko = Robot->MakeGtra("Ko", Iron, 7, 0, 0, 0, 3, 1, 5, 0, 3, 2, 5, 0);
  Ko->SetLineColor(17);
  Ko->SetFillColor(17);
  TGeoVolume *Ko_m = Robot->MakeBox("Ko_m", Iron, 2, 8, 4);
  Ko_m->SetLineColor(17);
  Ko_m->SetFillColor(17);
  TGeoVolume *Bol_1 = Robot->MakeBox("Bol_1", Iron, 7, 5.5, 7);
  Bol_1->SetLineColor(17);
  Bol_1->SetFillColor(17);
  TGeoVolume *Bol_2 = Robot->MakeGtra("Bol_2", Iron, 1, 0, 0, 0, 7, 0, 9, 0, 7, 0, 9, 0);
  Bol_2->SetLineColor(17);
  Bol_2->SetFillColor(17);
  TGeoVolume *Noon = Robot->MakeBox("Noon", Iron, 1, 10, 5);
  Noon->SetLineColor(12);
  Noon->SetFillColor(12);
  TGeoVolume *Tuck = Robot->MakeBox("Tuck", Iron, 2, 10, 5.5);
  Tuck->SetLineColor(2);
  Tuck->SetFillColor(2);
  TGeoVolume *Tuck_1 = Robot->MakeBox("Tuck_1", Iron, 2, 9, 1);
  Tuck_1->SetLineColor(2);
  Tuck_1->SetFillColor(2);
  TGeoVolume *Tuck_2 = Robot->MakeBox("Tuck_2", Iron, 3, 1, 14);
  Tuck_2->SetLineColor(2);
  Tuck_2->SetFillColor(2);
  TGeoVolume *Tuck_j = Robot->MakeSphere("Tuck_j", Iron, 0, 3.5, 0, 180, 0, 360);
  Tuck_j->SetLineColor(5);
  Tuck_j->SetFillColor(5);
  TGeoVolume *Ear = Robot->MakeCons("Ear", Iron, 1, 0, 3, 0, 3, 0, 360);
  Ear->SetLineColor(5);
  Ear->SetFillColor(5);
  TGeoVolume *Ear_2 = Robot->MakeCone("Ear_2", Iron, 5, 0, 0, 0, 3);
  Ear_2->SetLineColor(5);
  Ear_2->SetFillColor(5);

  // drawing face
  top->AddNodeOverlap(Migan, 1, new TGeoCombiTrans(-15, 0, 88, new TGeoRotation("R2", -90, 40, 0)));
  top->AddNodeOverlap(Ko, 1, new TGeoCombiTrans(-15, 0, 76.5, new TGeoRotation("R2", -90, -20, 0)));
  top->AddNodeOverlap(Ko_m, 1, new TGeoTranslation(-9, 0, 68));
  top->AddNodeOverlap(Bol_1, 1, new TGeoCombiTrans(-7, 2, 76, new TGeoRotation("R2", -30, -10, 0)));
  top->AddNodeOverlap(Bol_1, 1, new TGeoCombiTrans(-7, -2, 76, new TGeoRotation("R2", 30, 10, 0)));
  top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-6.5, -10.5, 76, new TGeoRotation("R2", -15, -90, -30)));
  top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-4, -12.5, 82.5, new TGeoRotation("R2", -20, -90, -95)));
  top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-7.5, 10.5, 76, new TGeoRotation("R2", 20, -90, -30)));
  top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-4, 12.5, 82.5, new TGeoRotation("R2", 20, -90, -95)));
  top->AddNodeOverlap(Noon, 1, new TGeoCombiTrans(-5, -7, 86, new TGeoRotation("R2", 60, 0, 0)));
  top->AddNodeOverlap(Noon, 1, new TGeoCombiTrans(-5, 7, 86, new TGeoRotation("R2", -60, 0, 0)));
  top->AddNodeOverlap(Tuck, 1, new TGeoTranslation(-12, 0, 62.5));
  for (int i = 0; i < 10; i++) {
    top->AddNodeOverlap(Tuck_1, 1, new TGeoCombiTrans(-4.2, 11, 61 + i, new TGeoRotation("R2", 90, -20, 20)));
    top->AddNodeOverlap(Tuck_1, 1, new TGeoCombiTrans(-4.2, -11, 61 + i, new TGeoRotation("R2", 90, -20, -20)));
  }
  top->AddNodeOverlap(Tuck_2, 1, new TGeoTranslation(2, -15.1, 76));
  top->AddNodeOverlap(Tuck_2, 1, new TGeoTranslation(2, 15.1, 76));
  top->AddNodeOverlap(Tuck_j, 1, new TGeoTranslation(-13, 0, 62.5));
  top->AddNodeOverlap(Ear, 1, new TGeoCombiTrans(2, -16.5, 80, new TGeoRotation("R2", 0, -90, 0)));
  top->AddNodeOverlap(Ear, 1, new TGeoCombiTrans(2, 16.5, 80, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Ear_2, 1, new TGeoCombiTrans(2, -20, 80, new TGeoRotation("R2", 0, -90, 0)));
  top->AddNodeOverlap(Ear_2, 1, new TGeoCombiTrans(2, 20, 80, new TGeoRotation("R2", 0, 90, 0)));

  for (int i = 1; i < 28; i += 1) {
    float a          = i * 0.2;
    TGeoVolume *Hear = Robot->MakeCons("Hear", Iron, 3, 13 + a, 16 + a, 13 + a, 16 + a, -60 - a, 60 + a);
    if (i < 27) {
      Hear->SetLineColor(12);
      Hear->SetFillColor(12);
    } else {
      Hear->SetLineColor(2);
      Hear->SetFillColor(2);
    }
    top->AddNodeOverlap(Hear, 1, new TGeoTranslation(0, 0, 89 - i));
  }
  for (int i = 1; i < 28; i += 1) {
    float a          = i * 0.2;
    TGeoVolume *Hear = Robot->MakeCons("Hear", Iron, 3, 13 + a, 16 + a, 13 + a, 16 + a, -70 - a, -60 - a);
    Hear->SetLineColor(2);
    Hear->SetFillColor(2);
    top->AddNodeOverlap(Hear, 1, new TGeoTranslation(0, 0, 89 - i));
  }
  for (int i = 1; i < 28; i += 1) {
    float a          = i * 0.2;
    TGeoVolume *Hear = Robot->MakeCons("Hear", Iron, 3, 13 + a, 16 + a, 13 + a, 16 + a, 60 + a, 70 + a);
    Hear->SetLineColor(2);
    Hear->SetFillColor(2);
    top->AddNodeOverlap(Hear, 1, new TGeoTranslation(0, 0, 89 - i));
  }

  // neck
  TGeoVolume *Mock = Robot->MakeTrd2("Mock", Iron, 1, 1, 7, 6.5, 20);
  Mock->SetLineColor(17);
  Mock->SetFillColor(17);
  TGeoVolume *Mock_1 = Robot->MakeTrd2("Mock_1", Iron, 1, 1, 6, 5, 20);
  Mock_1->SetLineColor(17);
  Mock_1->SetFillColor(17);
  TGeoVolume *Mock_s = Robot->MakeTrd2("Mock_s", Iron, 1, 1, 5, 4.5, 20);
  Mock_s->SetLineColor(17);
  Mock_s->SetFillColor(17);

  // drawing neck
  top->AddNodeOverlap(Mock, 1, new TGeoCombiTrans(-5, 4.7, 50, new TGeoRotation("R2", -30, 0, -10)));
  top->AddNodeOverlap(Mock, 1, new TGeoCombiTrans(-5, -4.7, 50, new TGeoRotation("R2", 30, 0, 10)));
  top->AddNodeOverlap(Mock_1, 1, new TGeoCombiTrans(11, -4, 50, new TGeoRotation("R2", 130, -8, 10)));
  top->AddNodeOverlap(Mock_1, 1, new TGeoCombiTrans(11, 4, 50, new TGeoRotation("R2", -130, 8, -10)));
  top->AddNodeOverlap(Mock_s, 1, new TGeoCombiTrans(2.5, 9, 50, new TGeoRotation("R2", 90, 0, 0)));
  top->AddNodeOverlap(Mock_s, 1, new TGeoCombiTrans(2.5, -9, 50, new TGeoRotation("R2", 90, 0, 0)));

  // chest
  TGeoVolume *Gasem = Robot->MakeBox("Gasem", Iron, 16, 50, 20);
  Gasem->SetLineColor(12);
  Gasem->SetFillColor(12);
  TGeoVolume *Gasem_b1 = Robot->MakeSphere("Gasem_b1", Iron, 0, 15, 0, 180, 0, 360);
  Gasem_b1->SetLineColor(12);
  Gasem_b1->SetFillColor(12);
  TGeoVolume *Gasem_b2 = Robot->MakeSphere("Gasem_b2", Iron, 0, 13, 0, 180, 0, 360);
  Gasem_b2->SetLineColor(12);
  Gasem_b2->SetFillColor(12);
  TGeoVolume *Gasem_1 = Robot->MakeEltu("Gasem_1", Iron, 13, 13, 20);
  Gasem_1->SetLineColor(12);
  Gasem_1->SetFillColor(12);
  TGeoVolume *Gasem_2 = Robot->MakeEltu("Gasem_2", Iron, 13, 13, 19);
  Gasem_2->SetLineColor(12);
  Gasem_2->SetFillColor(12);
  TGeoVolume *Gasem_3 = Robot->MakeCone("Gasem_3", Iron, 19, 0, 13, 0, 15);
  Gasem_3->SetLineColor(12);
  Gasem_3->SetFillColor(12);
  TGeoVolume *Gasem_4 = Robot->MakeEltu("Gasem_4", Iron, 15, 15, 16);
  Gasem_4->SetLineColor(12);
  Gasem_4->SetFillColor(12);
  TGeoVolume *Gasem_5 = Robot->MakeEltu("Gasem_5", Iron, 13, 13, 16);
  Gasem_5->SetLineColor(12);
  Gasem_5->SetFillColor(12);
  TGeoVolume *Gasem_m1 = Robot->MakeBox("Gasem_m1", Iron, 19, 19, 5);
  Gasem_m1->SetLineColor(12);
  Gasem_m1->SetFillColor(12);
  TGeoVolume *Gasem_m2 = Robot->MakeTrd2("Gasem_m2", Iron, 13, 15, 2, 2, 19);
  Gasem_m2->SetLineColor(12);
  Gasem_m2->SetFillColor(12);
  TGeoVolume *V = Robot->MakeTrd2("V", Iron, 2, 2, 22, 30, 4);
  V->SetLineColor(2);
  V->SetFillColor(2);
  TGeoVolume *V_m = Robot->MakeBox("V_m", Iron, 2, 7, 1);
  V_m->SetLineColor(2);
  V_m->SetFillColor(2);

  // drawing chest
  top->AddNodeOverlap(Gasem, 1, new TGeoTranslation(4, 0, 19));
  top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(-12, 50, 35));
  top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(-12, -50, 35));
  top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(20, 50, 35));
  top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(20, -50, 35));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, 50, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, -50, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, 50, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, -50, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, 10, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, -10, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, 10, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, -10, -5));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, 10, 35));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, -10, 35));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, 10, 35));
  top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, -10, 35));
  top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(20, 31, -5, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(20, -31, -5, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(-12, 31, -5, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(-12, -31, -5, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(20, 10, 13, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(20, -10, 13, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(-12, 10, 13, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(-12, -10, 13, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, 50, 16, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, -50, 16, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, 50, 16, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, -50, 16, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, 31, 35, new TGeoRotation("R2", 0, -90, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, -31, 35, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, 31, 35, new TGeoRotation("R2", 0, -90, 0)));
  top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, -31, 35, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gasem_4, 1, new TGeoCombiTrans(4, -50, 35, new TGeoRotation("R2", 90, 90, 0)));
  top->AddNodeOverlap(Gasem_4, 1, new TGeoCombiTrans(4, 50, 35, new TGeoRotation("R2", 90, 90, 0)));
  top->AddNodeOverlap(Gasem_5, 1, new TGeoCombiTrans(4, -50, -5, new TGeoRotation("R2", 90, 90, 0)));
  top->AddNodeOverlap(Gasem_5, 1, new TGeoCombiTrans(4, 50, -5, new TGeoRotation("R2", 90, 90, 0)));
  top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(-22, 30, 16, new TGeoRotation("R2", 90, 88, 0)));
  top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(-22, -30, 16, new TGeoRotation("R2", 90, 88, 0)));
  top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(29, 30, 16, new TGeoRotation("R2", 90, 92, 0)));
  top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(29, -30, 16, new TGeoRotation("R2", 90, 92, 0)));
  top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, -62, 16, new TGeoRotation("R2", 0, 3, 0)));
  top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, 62, 16, new TGeoRotation("R2", 0, -3, 0)));
  top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, -30, 47.5, new TGeoRotation("R2", 0, 87, 0)));
  top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, 30, 47.5, new TGeoRotation("R2", 0, -87, 0)));
  top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, -30, -16, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, 30, -16, new TGeoRotation("R2", 0, -90, 0)));
  top->AddNodeOverlap(V, 1, new TGeoCombiTrans(-30, 18.3, 16, new TGeoRotation("R2", 0, -135, 0)));
  top->AddNodeOverlap(V, 1, new TGeoCombiTrans(-30, -18.3, 16, new TGeoRotation("R2", 0, 135, 0)));
  top->AddNodeOverlap(V_m, 1, new TGeoTranslation(-30, -37, 35));
  top->AddNodeOverlap(V_m, 1, new TGeoTranslation(-30, 37, 35));

  // abdomen
  TGeoVolume *Bea = Robot->MakeEltu("Bea", Iron, 20, 37, 25);
  Bea->SetLineColor(17);
  Bea->SetFillColor(17);
  TGeoVolume *Bea_d = Robot->MakeEltu("Bea_d", Iron, 21, 36, 5);
  Bea_d->SetLineColor(12);
  Bea_d->SetFillColor(12);
  TGeoVolume *Beakop = Robot->MakeEltu("Beakop", Iron, 15, 25, 5);
  Beakop->SetLineColor(10);
  Beakop->SetFillColor(10);

  // drawing abdomen
  top->AddNodeOverlap(Bea, 1, new TGeoTranslation(3, 0, -30));
  top->AddNodeOverlap(Bea_d, 1, new TGeoTranslation(3, 0, -10));
  top->AddNodeOverlap(Beakop, 1, new TGeoCombiTrans(-12.1, 0, -50, new TGeoRotation("R2", 90, 90, 0)));

  // Gungdi
  TGeoVolume *Gungdi = Robot->MakeEltu("Gungdi", Iron, 25, 50, 18);
  Gungdi->SetLineColor(12);
  Gungdi->SetFillColor(12);
  TGeoVolume *Gungdi_d = Robot->MakeEltu("Gungdi_d", Iron, 5, 5, 5);
  Gungdi_d->SetLineColor(2);
  Gungdi_d->SetFillColor(2);

  // drawing Gungdi
  top->AddNodeOverlap(Gungdi, 1, new TGeoTranslation(3, 0, -70));
  for (int i = 0; i < 30; i++) {
    TGeoVolume *Gungdi_j = Robot->MakeEltu("Gungdi_j", Iron, 24 - 0.2 * i, 49 - 0.5 * i, 1);
    Gungdi_j->SetLineColor(12);
    Gungdi_j->SetFillColor(12);
    top->AddNodeOverlap(Gungdi_j, 1, new TGeoTranslation(3, 0, -51 + 0.5 * i));
  }
  for (int i = 0; i < 40; i++) {
    if (i < 16) {
      TGeoVolume *Gungdi_h = Robot->MakeEltu("Gungdi_h", Iron, 24 - 0.1 * i, 49 - 0.3 * i, 1);
      Gungdi_h->SetLineColor(12);
      Gungdi_h->SetFillColor(12);
      top->AddNodeOverlap(Gungdi_h, 1, new TGeoTranslation(3, 0, -88 - 0.5 * i));
    } else {
      TGeoVolume *Gungdi_h = Robot->MakeEltu("Gungdi_h", Iron, 27 - 0.3 * i, 52 - 0.5 * i, 1);
      Gungdi_h->SetLineColor(12);
      Gungdi_h->SetFillColor(12);
      top->AddNodeOverlap(Gungdi_h, 1, new TGeoTranslation(3, 0, -89 - 0.5 * i));
    }
  }
  top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, -45, -62, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, -45, -78, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, 45, -62, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, 45, -78, new TGeoRotation("R2", 0, 90, 0)));

  // feet
  TGeoVolume *Jang = Robot->MakeEltu("Jang", Iron, 18, 18, 50);
  Jang->SetLineColor(17);
  Jang->SetFillColor(17);
  TGeoVolume *Jong = Robot->MakeEltu("Jong", Iron, 22, 22, 50);
  Jong->SetLineColor(12);
  Jong->SetFillColor(12);
  TGeoVolume *Bal = Robot->MakeSphere("Bal", Iron, 0, 22, 0, 180, 180, 360);
  Bal->SetLineColor(12);
  Bal->SetFillColor(12);

  // drawing Dary
  top->AddNodeOverlap(Jang, 1, new TGeoCombiTrans(3, -25, -120, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Jang, 1, new TGeoCombiTrans(3, 25, -120, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Jong, 1, new TGeoCombiTrans(3, -25, -220, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Jong, 1, new TGeoCombiTrans(3, 25, -220, new TGeoRotation("R2", 0, 0, 0)));
  for (int i = 0; i < 30; i++) {
    TGeoVolume *Mu = Robot->MakeCons("Mu", Iron, 1, 0, 22.1, 0, 22.1, 120 + 2 * i, -120 - 2 * i);
    Mu->SetLineColor(4);
    Mu->SetFillColor(4);
    top->AddNodeOverlap(Mu, 1, new TGeoTranslation(3, -25, -171 - i));
    top->AddNodeOverlap(Mu, 1, new TGeoTranslation(3, 25, -171 - i));
  }
  top->AddNodeOverlap(Bal, 1, new TGeoCombiTrans(-10, -25, -270, new TGeoRotation("R2", 270, -90, 0)));
  top->AddNodeOverlap(Bal, 1, new TGeoCombiTrans(-10, 25, -270, new TGeoRotation("R2", 270, -90, 0)));

  // arms
  TGeoVolume *S = Robot->MakeSphere("S", Iron, 0, 25, 0, 180, 180, 360);
  S->SetLineColor(17);
  S->SetFillColor(17);
  TGeoVolume *S_1 = Robot->MakeSphere("S_1", Iron, 0, 15, 0, 180, 0, 360);
  S_1->SetLineColor(17);
  S_1->SetFillColor(17);
  TGeoVolume *Pal = Robot->MakeEltu("Pal", Iron, 15, 15, 30);
  Pal->SetLineColor(17);
  Pal->SetFillColor(17);
  TGeoVolume *Fal = Robot->MakeEltu("Fal", Iron, 17, 17, 30);
  Fal->SetLineColor(4);
  Fal->SetFillColor(4);
  TGeoVolume *Bbul = Robot->MakeCone("Bbul", Iron, 8, 0, 0, 0, 5);
  Bbul->SetLineColor(17);
  Bbul->SetFillColor(17);

  // drawing arms
  top->AddNodeOverlap(S, 1, new TGeoCombiTrans(3, 73, 30, new TGeoRotation("R2", 0, -30, 0)));
  top->AddNodeOverlap(S, 1, new TGeoCombiTrans(3, -73, 30, new TGeoRotation("R2", 0, 210, 0)));
  top->AddNodeOverlap(S_1, 1, new TGeoCombiTrans(3, -73, 27, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(S_1, 1, new TGeoCombiTrans(3, 73, 27, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Pal, 1, new TGeoCombiTrans(3, -73, -5, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Pal, 1, new TGeoCombiTrans(3, 73, -5, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Fal, 1, new TGeoCombiTrans(3, -73, -60, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Fal, 1, new TGeoCombiTrans(3, 73, -60, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, -97, -72, new TGeoRotation("R2", 0, -90, 0)));
  top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, -97, -48, new TGeoRotation("R2", 0, -90, 0)));
  top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, 97, -72, new TGeoRotation("R2", 0, 90, 0)));
  top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, 97, -48, new TGeoRotation("R2", 0, 90, 0)));

  // hands
  TGeoVolume *Son_d = Robot->MakeBox("Son_d", Iron, 15, 15, 7);
  Son_d->SetLineColor(4);
  Son_d->SetFillColor(4);
  TGeoVolume *Son_g = Robot->MakeBox("Son_g", Iron, 4, 10, 4);
  Son_g->SetLineColor(4);
  Son_g->SetFillColor(4);
  TGeoVolume *Son_g1 = Robot->MakeBox("Son_g1", Iron, 6, 6, 6);
  Son_g1->SetLineColor(4);
  Son_g1->SetFillColor(4);
  TGeoVolume *Son_g2 = Robot->MakeBox("Son_g2", Iron, 8, 3, 3);
  Son_g2->SetLineColor(4);
  Son_g2->SetFillColor(4);
  TGeoVolume *Last_b = Robot->MakeCone("Last_b", Iron, 10, 0, 0, 0, 4);
  Last_b->SetLineColor(17);
  Last_b->SetFillColor(17);
  TGeoVolume *Last = Robot->MakeSphere("Last", Iron, 0, 3, 0, 180, 0, 360);
  Last->SetLineColor(2);
  Last->SetFillColor(2);

  // drawing hands
  top->AddNodeOverlap(Son_d, 1, new TGeoCombiTrans(3, -80, -105, new TGeoRotation("R2", 0, 90, 0)));
  for (int i = 0; i < 4; i++) {
    top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, -72, -118, new TGeoRotation("R2", 0, -10, 0)));
  }
  for (int i = 0; i < 4; i++) {
    top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, -67, -113, new TGeoRotation("R2", 0, 110, 0)));
  }
  top->AddNodeOverlap(Son_g1, 1, new TGeoCombiTrans(-5, -70, -98, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Son_g2, 1, new TGeoCombiTrans(-5, -65, -102, new TGeoRotation("R2", 0, 60, 0)));
  top->AddNodeOverlap(Son_d, 1, new TGeoCombiTrans(3, 80, -105, new TGeoRotation("R2", 0, 90, 0)));
  for (int i = 0; i < 4; i++) {
    top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, 72, -118, new TGeoRotation("R2", 0, 10, 0)));
  }
  for (int i = 0; i < 4; i++) {
    top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, 67, -113, new TGeoRotation("R2", 0, 70, 0)));
  }
  top->AddNodeOverlap(Son_g1, 1, new TGeoCombiTrans(-5, 70, -98, new TGeoRotation("R2", 0, 0, 0)));
  top->AddNodeOverlap(Son_g2, 1, new TGeoCombiTrans(-5, 65, -102, new TGeoRotation("R2", 0, 60, 0)));
  top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(3, -88, -103, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(12, -88, -103, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(-7, -88, -103, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(3, 88, -103, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(12, 88, -103, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(-7, 88, -103, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(3, -88, -112, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(12, -88, -112, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(-7, -88, -112, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(3, 88, -112, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(12, 88, -112, new TGeoRotation("R2", 0, 180, 0)));
  top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(-7, 88, -112, new TGeoRotation("R2", 0, 180, 0)));

  for (int i = 1; i < 20; i += 1) {
    if (i < 7) {
      TGeoVolume *Effect =
          Robot->MakeCons("Effect", Iron, 3, 20 / sin(i), 21 / sin(i), 20 / sin(i), 21 / sin(i), 0, 70);
      Effect->SetLineColor(9);
      Effect->SetFillColor(9);
      top->AddNodeOverlap(Effect, 1, new TGeoTranslation(3, 0, -280));
    }
    if (6 < i && i < 10) {
      TGeoVolume *Effect =
          Robot->MakeCons("Effect", Iron, 5, 20 / sin(i), 21 / sin(i), 20 / sin(i), 21 / sin(i), 50, 120);
      Effect->SetLineColor(38);
      Effect->SetFillColor(38);
      top->AddNodeOverlap(Effect, 1, new TGeoTranslation(3, 0, -280));
    }
    if (9 < i && i < 20) {
      TGeoVolume *Effect =
          Robot->MakeCons("Effect", Iron, 4, 20 / sin(i), 21 / sin(i), 20 / sin(i), 21 / sin(i), 200, 330);
      Effect->SetLineColor(33);
      Effect->SetFillColor(33);
      top->AddNodeOverlap(Effect, 1, new TGeoTranslation(3, 0, -280));
    }
  }

  // close geometry
  top->SetVisibility(0);
  Robot->CloseGeometry();

  // in GL viewer
  top->Draw("ogl");
}
Beispiel #6
0
drawFGT(TString volName="")
{
  gSystem->Load("libGeom");
  gSystem->Load("libGdml");

  TGeoManager::Import("fgt.gdml");
  gGeoManager->DefaultColors();

  bool allSolid=true;
  
  char topVol[] ="volWorld";
  //char topVol[] ="volDetEnclosure";
  //char topVol[] ="volDetector";

  //char topVol[] ="volMuIDDownstream";
  //char topVol[] ="volMuIDBarrel";
  //char topVol[] ="volRPCMod";
  //char topVol[] ="volRPCTray_End";

  //char topVol[] ="volECALDownstream";
  //char topVol[] ="volECALUpstream";
  //char topVol[] ="volBarrelECAL";
  //char topVol[] ="volSBPlane";

  //char topVol[] ="volSTT";
  //char topVol[] ="volSTPlaneTarget";
  //char topVol[] ="volSTPlaneRadiator";
  //char topVol[] ="volTargetPlaneArgon";


  gGeoManager->GetVolume("volDetEnclosure")->SetLineColor(kGray);
  gGeoManager->GetVolume("volDetEnclosure")->SetVisibility(1);
  gGeoManager->GetVolume("volDetEnclosure")->SetTransparency(20);

  gGeoManager->GetVolume("volDirtLayer")->SetTransparency(20);

  gGeoManager->GetVolume("volServiceBuilding")->SetLineColor(kGray);
  gGeoManager->GetVolume("volServiceBuilding")->SetVisibility(1);
  gGeoManager->GetVolume("volServiceBuilding")->SetTransparency(20);


  gGeoManager->GetVolume("volSky")->SetLineColor(kWhite);
  gGeoManager->GetVolume("volSky")->SetVisibility(1);
  gGeoManager->GetVolume("volSky")->SetTransparency(20);


  gGeoManager->GetVolume("volMagnet")->SetLineColor(kGreen-1);
  gGeoManager->GetVolume("volMagnet")->SetVisibility(1);
  if(!allSolid) gGeoManager->GetVolume("volMagnet")->SetTransparency(10);


  gGeoManager->GetVolume("volECALBarrelMod")->SetLineColor(kRed);
  gGeoManager->GetVolume("volECALBarrelMod")->SetVisibility(1);
  if(!allSolid) gGeoManager->GetVolume("volECALBarrelMod")->SetTransparency(75);
  
  gGeoManager->GetVolume("volSBPlane")->SetLineColor(kRed-3);
  gGeoManager->GetVolume("volSBPlane")->SetVisibility(1);
  if(!allSolid) gGeoManager->GetVolume("volSBPlane")->SetTransparency(80);
  /*
  gGeoManager->GetVolume("volECALUpstream")->SetLineColor(kYellow-3);
  gGeoManager->GetVolume("volECALUpstream")->SetVisibility(1);
  gGeoManager->GetVolume("volECALUpstream")->SetTransparency(20);
  gGeoManager->GetVolume("volECALDownstream")->SetLineColor(kYellow-3);
  gGeoManager->GetVolume("volECALDownstream")->SetVisibility(1);
  gGeoManager->GetVolume("volECALDownstream")->SetTransparency(20);
  */
  
  TObjArray* va = gGeoManager->GetListOfVolumes();
  int nv = va->GetEntries();
  for (int i=0; i<nv; ++i) {
    TGeoVolume* v = (TGeoVolume*)va->At(i);
    std::string m(v->GetMaterial()->GetName());
    //cout << v->GetMaterial()->GetName() << endl;
    int lc, vi, tr, vd;
    if           (m == "Scintillator")             { 
      lc = kGreen-7 ; vi = 1; tr = 0; vd = 1; 
      v->SetLineColor(lc);
      v->SetVisibility(vi);
      v->VisibleDaughters(vd);
      v->SetTransparency(tr);
    }
    //else {
    //  continue;
      //std::cout << "'" << m << "' has no defaults" << std::endl;
      //lc = kOrange; vi = 0; tr = 50; vd = 1; 
    //}

  }
  

 //gGeoManager->GetTopNode();
 gGeoManager->CheckOverlaps(1e-5,"d");
 gGeoManager->PrintOverlaps();
 //gGeoManager->FindVolumeFast(topVol)->CheckOverlaps(1e-5,"d");
 //gGeoManager->FindVolumeFast(topVol)->GetNode(0)->PrintOverlaps();
 gGeoManager->SetMaxVisNodes(70000);


 gGeoManager->FindVolumeFast(topVol)->Draw("ogl");


  TFile *tf = new TFile("drawFGT.root", "RECREATE");
 
  gGeoManager->Write();

  tf->Close();
}
Beispiel #7
0
void south_gate() 
{ 
  // Drawing a famous Korean gate, the South gate, called Namdeamoon in Korean, using ROOT geometry class.
  // Name: south_gate.C
  // Author: Lan Hee Yang([email protected]), Dept. of Physics, Univ. of Seoul
  // Reviewed by Sunman Kim ([email protected])
  // Supervisor: Prof. Inkyu Park ([email protected])
  // 
  // How to run: .x south_gate.C in ROOT terminal, then use OpenGL
  //
  // This macro was created for the evaluation of Computational Physics course in 2006.
  // We thank to Prof. Inkyu Park for his special lecture on ROOT and to all of ROOT team
  //

  TGeoManager *geom=new TGeoManager("geom","My first 3D geometry");


  TGeoMaterial *vacuum=new TGeoMaterial("vacuum",0,0,0);//a,z,rho
  TGeoMaterial *Fe=new TGeoMaterial("Fe",55.845,26,7.87);

  //Creat media

  TGeoMedium *Air  = new TGeoMedium("Vacuum",0,vacuum);
  TGeoMedium *Iron = new TGeoMedium("Iron",1,Fe);

  //Creat volume

  TGeoVolume *top = geom->MakeBox("top",Air,1000,1000,1000);
  geom->SetTopVolume(top);
  geom->SetTopVisible(0);
  // If you want to see the boundary, please input the number, 1 instead of 0.
  // Like this, geom->SetTopVisible(1); 


//base

char nBlocks[100];
int i=1;
int N = 0;
int f=0;
int di[2]; di[0] = 0; di[1] = 30;
TGeoVolume *mBlock;

while (f<11){
while (i<14){
   if (i==6 && f<8){
      i = i+3;
   }

   sprintf(nBlocks,"f%d_bg%d",f,N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 29,149,9);
   mBlock->SetLineColor(20);
   if (f<8){
   if (i<=5 && f<8){
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-120-((i-1)*60)-di[f%2],5,5+(20*f)));
   } else if (i>5 && f<8){
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(120+((i-9)*60)  +di[f%2],5,5+(20*f)));
   }
   } else {
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-420+(i*60)-di[f%2],5,5+(20*f)));
   }
   i++;
   if (i>=14 && f>=8 && f%2 == 1){
      sprintf(nBlocks,"f%d_bg%d",f,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 29,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-420+(i*60)-di[f%2],5,5+(20*f)));
   i++;
   }
   if (f%2 ==0){
      sprintf(nBlocks,"f%d_bg%d",f,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-405,5,5+(20*f)));
      sprintf(nBlocks,"f%d_bg%d",f,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(405,5,5+(20*f)));
   } else if (f<5){
      sprintf(nBlocks,"f%d_bg%d",f,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-105,5,5+(20*f)));
      sprintf(nBlocks,"f%d_bg%d",f,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(105,5,5+(20*f)));

   } 
}
      sprintf(nBlocks,"f%d_bg%d",8,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 40,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-80,5,145));
      sprintf(nBlocks,"f%d_bg%d",8,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 40,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(80,5,145));

      sprintf(nBlocks,"f%d_bg%d",7,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 15,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-75,5,125));
      sprintf(nBlocks,"f%d_bg%d",7,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 15,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(75,5,125));

      sprintf(nBlocks,"f%d_bg%d",6,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 24,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-95,5,105));
      sprintf(nBlocks,"f%d_bg%d",6,N++);
      mBlock = geom->MakeBox(nBlocks, Iron, 24,149,9);
      mBlock->SetLineColor(20);
      top->AddNodeOverlap(mBlock,1,new TGeoTranslation(95,5,105));



i=1;f++;
   
}
   



//wall

f=0;
while (f<5){
i=0;
while (i<65){
   sprintf(nBlocks,"f%d_bg%d",f,N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 5.8,3,3.8);
   mBlock->SetLineColor(25);
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-384+(i*12),137,218+(f*8)));
i++;

}
f++;
}



f=0;
while (f<5){
i=0;
while (i<65){
   sprintf(nBlocks,"f%d_bg%d",f,N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 5.8,3,3.8);
   mBlock->SetLineColor(25);
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-384+(i*12),-137,218+(f*8)));
i++;

}
f++;
}





f=0;
while (f<7){
i=0;
while (i<22){
   sprintf(nBlocks,"f%d_bg%d",f,N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 3,5.8,3.8);
   mBlock->SetLineColor(25);
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-384,-126+(i*12),218+(f*8)));
i++;

}
f++;
}



f=0;
while (f<7){
i=0;
while (i<22){
   sprintf(nBlocks,"f%d_bg%d",f,N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 3,5.8,3.8);
   mBlock->SetLineColor(25);
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(384,-126+(i*12),218+(f*8)));
i++;

}
f++;
}


// arch


int k;
k=0; i=0;

while (i<5){      
while(k<10){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeTubs(nBlocks,Iron, 70,89,14, (i*36)+0.5, (i+1)*36-0.5);
   mBlock->SetLineColor(20);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,-130+(k*30),70, new TGeoRotation("r1",0,90,0)));
   k++;
}
   i++; k=0;
}

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 9,149,17);
   mBlock->SetLineColor(20);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(80,5,14));
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 9,149,18);
   mBlock->SetLineColor(20);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(80,5,51));

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 9,149,17);
   mBlock->SetLineColor(20);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-80,5,14));
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 9,149,18);
   mBlock->SetLineColor(20);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-80,5,51));





//wall's kiwa

k=0; i=0;

while (i<5){   
while(k<52){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeTubs(nBlocks,Iron, 1,3,7, 0, 180);
   mBlock->SetLineColor(12);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-382+(k*15),137,255, new TGeoRotation("r1",90,90,0)));
   k++;
}
   i++; k=0;
}





k=0; i=0;

while (i<5){   
while(k<52){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeTubs(nBlocks,Iron, 2.5,3,7, 0, 180);
   mBlock->SetLineColor(12);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-382+(k*15),-137,255, new TGeoRotation("r1",90,90,0)));
   k++;
}
   i++; k=0;
}



k=0; i=0;

while (i<5){   
while(k<20){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeTubs(nBlocks,Iron, 2.5,3,6, 0, 180);
   mBlock->SetLineColor(12);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-382,-123+(k*13),271, new TGeoRotation("r1",0,90,0)));
   k++;
}
   i++; k=0;
}




k=0; i=0;

while (i<5){   
while(k<20){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeTubs(nBlocks,Iron, 2.5,3,7, 0, 180);
   mBlock->SetLineColor(12);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(382,-123+(k*13),271, new TGeoRotation("r1",0,90,0)));
   k++;
}
   i++; k=0;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


// 1 floor


k=0; i=0;

while (i<5){   
while(k<7){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,56, 0, 360);
   mBlock->SetLineColor(50);   
   
   if (k<=2){

   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,260, new TGeoRotation("r1",0,0,0)));
   }else if (k>=4){
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,260, new TGeoRotation("r1",0,0,0)));
   }   


k++;
}
   i++; k=0;
}



k=0; i=0;

while (i<5){   
while(k<7){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,56, 0, 360);
   mBlock->SetLineColor(50);   
   
   if (k<=2){

   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,260, new TGeoRotation("r1",0,0,0)));
   }else if (k>=4){
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,260, new TGeoRotation("r1",0,0,0)));
   }   


k++;
}
   i++; k=0;
}

// ||=====||======||=====||=====||=====||=====||


   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 298,78,8);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,300));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 298,78,5);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,320));



//1
k=0; i=0;

while (i<5){   
while(k<6){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron,18,10,8);
   mBlock->SetLineColor(8);   
   {
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),70,300, new TGeoRotation("r1",0,0,0)));

   }
   k++;
}
   i++; k=0;
}





k=0; i=0;

while (i<5){   
while(k<6){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron,18,10,8);
   mBlock->SetLineColor(8);   
   {
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-70,300, new TGeoRotation("r1",0,0,0)));

   }
   k++;
}
   i++; k=0;
}




   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-290,0,300, new TGeoRotation("r1",90,0,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(290,0,300, new TGeoRotation("r1",90,0,0)));






//2
k=0; i=0;

while (i<5){   
while(k<6){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron,18,10,5);
   mBlock->SetLineColor(8);   
   {
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),70,320, new TGeoRotation("r1",0,0,0)));

   }
   k++;
}
   i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<6){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron,18,10,5);
      mBlock->SetLineColor(8);   
      {
         top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-70,320, new TGeoRotation("r1",0,0,0)));

      }
      k++;
   }
      i++; k=0;
}



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-290,0,320, new TGeoRotation("r1",90,0,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(290,0,320, new TGeoRotation("r1",90,0,0)));











//___||____||_____||____||____||____||____||


k=0; i=0;

while (i<5){   
   while(k<19){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),78,345, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<19){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-78,345, new TGeoRotation("r1",0,0,0)));
      k++;
   }
   i++; k=0;
}



k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-78+(k*33),345, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-78+(k*33),345, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}

//        ||//  ||//  ||//  ||//



k=0; i=0;

while (i<5){   
   while(k<19){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),90,342, new TGeoRotation("r1",0,-45,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<19){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-90,342, new TGeoRotation("r1",0,45,0)));
      k++;
   }
      i++; k=0;
}



k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-318,-78+(k*33),345, new TGeoRotation("r1",-90,45,0)));
      k++;
   }
   i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(318,-78+(k*33),345, new TGeoRotation("r1",90,45,0)));
      k++;
   }
   i++; k=0;
}


//   /// || / / / / / / / || / / / / / / / / || / / / / / / / / / / / 



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,-107,362, new TGeoRotation("r1",0,-45,0)));




   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,107,362, new TGeoRotation("r1",0,45,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(330,0,362, new TGeoRotation("r1",90,-45,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-330,0,362, new TGeoRotation("r1",90,45,0)));




/////////////////////// add box




k=0; i=0;

while (i<5){   
   while(k<6){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron,18,10,2);
      mBlock->SetLineColor(8);   
      {
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),-108,362, new TGeoRotation("r1",0,-45,0)));

      }
      k++;
   }
   i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<6){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron,18,10,2);
      mBlock->SetLineColor(8);   
      {
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),108,362, new TGeoRotation("r1",0,45,0)));

      }
      k++;
   }
   i++; k=0;
}


   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(331,0,362, new TGeoRotation("r1",90,-45,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-331,0,362, new TGeoRotation("r1",90,45,0)));





/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// 2nd floor 


k=0; i=0;

while (i<5){   
   while(k<7){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,30, 0, 360);
      mBlock->SetLineColor(50);   
      
      if (k<=2){

      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,465, new TGeoRotation("r1",0,0,0)));
      }else if (k>=4){
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,465, new TGeoRotation("r1",0,0,0)));
      }   


   k++;
   }
      i++; k=0;
}



k=0; i=0;

while (i<5){   
   while(k<7){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,30, 0, 360);
      mBlock->SetLineColor(50);   
      
      if (k<=2){

      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,465, new TGeoRotation("r1",0,0,0)));
      }else if (k>=4){
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,465, new TGeoRotation("r1",0,0,0)));
      }   


   k++;
   }
   i++; k=0;
}




// ||=====||======||=====||=====||=====||=====||


   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 302,80,8);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,480));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 302,80,5);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,500));


   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 305,80,2.5);
   mBlock->SetLineColor(50);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,465));


///////////////////////add box






//1
k=0; i=0;

while (i<5){   
   while(k<6){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron,18,10,8);
      mBlock->SetLineColor(8);   
      {
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),71,480, new TGeoRotation("r1",0,0,0)));

      }
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<6){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron,18,10,8);
      mBlock->SetLineColor(8);   
      {
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-71,480, new TGeoRotation("r1",0,0,0)));

      }
      k++;
   }
      i++; k=0;
}




   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-293,0,480, new TGeoRotation("r1",90,0,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(293,0,480, new TGeoRotation("r1",90,0,0)));






//2
k=0; i=0;

while (i<5){   
   while(k<6){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron,18,10,5);
      mBlock->SetLineColor(8);   
      {
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),71,500, new TGeoRotation("r1",0,0,0)));

      }
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<6){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron,18,10,5);
      mBlock->SetLineColor(8);   
      {
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-71,500, new TGeoRotation("r1",0,0,0)));

      }
      k++;
   }
      i++; k=0;
}



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-293,0,500, new TGeoRotation("r1",90,0,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(293,0,500, new TGeoRotation("r1",90,0,0)));











//  1 ___||____||_____||____||____||____||____||


k=0; i=0;

while (i<5){   
   while(k<25){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 1.5,5,15);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*25),78,450, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<25){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 1.5,5,15);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*25),-78,450, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}



k=0; i=0;

while (i<5){   
   while(k<7){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,1.5,15);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-78+(k*25),450, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while (k<7){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,1.5,15);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-78+(k*25),450, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}




//  2 ___||____||_____||____||____||____||____||


k=0; i=0;

while (i<5){   
while(k<19){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
   mBlock->SetLineColor(50);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),78,525, new TGeoRotation("r1",0,0,0)));
   k++;
}
   i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<19){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-78,525, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}



k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-78+(k*33),525, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-78+(k*33),525, new TGeoRotation("r1",0,0,0)));
      k++;
   }
      i++; k=0;
}




//        ||//  ||//  ||//  ||//

//down

k=0; i=0;

while (i<5){   
   while(k<19){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),90,522, new TGeoRotation("r1",0,-45,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<19){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-90,522, new TGeoRotation("r1",0,45,0)));
      k++;
   }
      i++; k=0;
}


k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-318,-78+(k*33.3),525, new TGeoRotation("r1",-90,45,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<5){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(318,-78+(k*33.3),525, new TGeoRotation("r1",90,45,0)));
      k++;
   }
      i++; k=0;
}


// up


k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,562, new TGeoRotation("r1",0,-115,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,562, new TGeoRotation("r1",0,115,0)));
      k++;
   }
      i++; k=0;
}



k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),565, new TGeoRotation("r1",-90,115,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),565, new TGeoRotation("r1",90,115,0)));
      k++;
   }
      i++; k=0;
}


//up2



k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,375, new TGeoRotation("r1",0,-115,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,375, new TGeoRotation("r1",0,115,0)));
      k++;
   }
      i++; k=0;
}



k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),375, new TGeoRotation("r1",-90,115,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(50);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),375, new TGeoRotation("r1",90,115,0)));
      k++;
   }
      i++; k=0;
}


//up 3

k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,568, new TGeoRotation("r1",0,-115,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,568, new TGeoRotation("r1",0,115,0)));
      k++;
   }
      i++; k=0;
}


k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),568, new TGeoRotation("r1",-90,115,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),568, new TGeoRotation("r1",90,115,0)));
      k++;
   }
      i++; k=0;
}





//up4


k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,385, new TGeoRotation("r1",0,-115,0)));
      k++;
   }
      i++; k=0;
}




k=0; i=0;

while (i<5){   
   while(k<50){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,385, new TGeoRotation("r1",0,115,0)));
      k++;
   }
      i++; k=0;
}


k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),385, new TGeoRotation("r1",-90,115,0)));
      k++;
   }
      i++; k=0;
}





k=0; i=0;

while (i<5){   
   while(k<17){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20);
      mBlock->SetLineColor(44);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),385, new TGeoRotation("r1",90,115,0)));
      k++;
   }
      i++; k=0;
}


// up kiwa
   //=========
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 270,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,0,620, new TGeoRotation("r1",0,0,0)));
   //===============//2
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-50,600, new TGeoRotation("r1",0,20,-40)));

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,50,600, new TGeoRotation("r1",0,-20,40)));

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,50,600, new TGeoRotation("r1",0,-20,-40)));

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-50,600, new TGeoRotation("r1",0,20,40)));




   //===============//1
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-80,413, new TGeoRotation("r1",0,20,-40)));

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,80,413, new TGeoRotation("r1",0,-20,40)));

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,80,413, new TGeoRotation("r1",0,-20,-40)));

   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-80,413, new TGeoRotation("r1",0,20,40)));




// _1_

//front

k=0; i=0;
while (i<7){   
   while(k<44){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-280+(k*13),70+(i*12.5),425-(i*5), new TGeoRotation("r1",0,60,0)));
      k++;
   }
      i++; k=0;
}
   


k=0; i=0;

while (i<7){   
   while(k<44){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-280+(k*13),-70-(i*12.5),425-(i*5), new TGeoRotation("r1",0,120,0)));
      k++;
   }
      i++; k=0;
}

//_2_




k=0; i=0;
while (i<11){   
   while(k<43){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   

      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*13),15+(i*12.5),620-(i*5), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}
   


k=0; i=0;

while (i<11){   
   while(k<43){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*13),-15-(i*12.5),620-(i*5), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}




//////left
k=0; i=0;

while (i<6){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-335,81.25+(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<7){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-322,69.75+(i*12.5),595-(i*2), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<8){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-309,56.25+(i*12.5),605-(i*4), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<9){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-296,50+(i*12.5),610-(i*4), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<10){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-283,37.5+(i*12.5),615-(i*4), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}



k=0; i=0;

while (i<6){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-335,-81.25-(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<7){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-322,-69.75-(i*12.5),595-(i*2), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<8){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-309,-56.25-(i*12.5),605-(i*4), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<9){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-296,-50-(i*12.5),610-(i*4), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<10){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-283,-37.5-(i*12.5),615-(i*4), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}



//////////right



k=0; i=0;

while (i<6){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(335,81.25+(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<7){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(322,69.75+(i*12.5),595-(i*2), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<8){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(309,56.25+(i*12.5),605-(i*4), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<9){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(296,50+(i*12.5),610-(i*4), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<10){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(283,37.5+(i*12.5),615-(i*4), new TGeoRotation("r1",0,60,0)));
      k++;
   }
   i++; k=0;
}


//





k=0; i=0;

while (i<6){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(335,-81.25-(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<7){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(322,-69.75-(i*12.5),595-(i*2), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<8){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(309,-56.25-(i*12.5),605-(i*4), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}

k=0; i=0;

while (i<9){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(296,-50-(i*12.5),610-(i*4), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}


k=0; i=0;

while (i<10){   
   while(k<11){
      sprintf(nBlocks,"ab%d",N++);
      mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170);
      mBlock->SetLineColor(13);   
      top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(283,-37.5-(i*12.5),615-(i*4), new TGeoRotation("r1",0,120,0)));
      k++;
   }
   i++; k=0;
}


//   /// || / / / / / / / || / / / / / / / / || / / / / / / / / / / / 


   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,-110,550, new TGeoRotation("r1",0,-45,0)));




   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,110,550, new TGeoRotation("r1",0,45,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(335,0,550, new TGeoRotation("r1",90,-45,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2);
   mBlock->SetLineColor(42);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-335,0,550, new TGeoRotation("r1",90,45,0)));



////////////////////////////////add box





k=0; i=0;

while (i<5){   
while(k<6){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron,18,10,2);
   mBlock->SetLineColor(8);   
   {
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),-111,550, new TGeoRotation("r1",0,-45,0)));

   }
   k++;
}
   i++; k=0;
}




k=0; i=0;

while (i<5){   
while(k<6){
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks,Iron,18,10,2);
   mBlock->SetLineColor(8);   
   {
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),111,550, new TGeoRotation("r1",0,45,0)));

   }
   k++;
}
   i++; k=0;
}


   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(336,0,550, new TGeoRotation("r1",90,-45,0)));



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2);
   mBlock->SetLineColor(8);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-336,0,550, new TGeoRotation("r1",90,45,0)));




//                  |           |           |            |           |



   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 300,75,40);
   mBlock->SetLineColor(45);   
   top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,0,450, new TGeoRotation("r1",0,0,0)));



//kiwa
   sprintf(nBlocks,"ab%d",N++);
   mBlock = geom->MakeBox(nBlocks, Iron, 305,80,2.5);
   mBlock->SetLineColor(10);   
   top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,430));




  top->SetVisibility(0);
  geom->CloseGeometry();

  top->Draw("ogl");
}
Beispiel #8
0
int main(int argc, char * argv[]) {

  TApplication app("app", &argc, argv);
  plottingEngine.SetDefaultStyle();

  const bool debug = true;

  // Load the field map.
  ComponentAnsys123* fm = new ComponentAnsys123();
  const std::string efile = "ELIST.lis";
  const std::string nfile = "NLIST.lis";
  const std::string mfile = "MPLIST.lis";
  const std::string sfile = "PRNSOL.lis";
  fm->Initialise(efile, nfile, mfile, sfile, "mm");
  fm->EnableMirrorPeriodicityX();
  fm->EnableMirrorPeriodicityY();
  fm->PrintRange();

  // Dimensions of the GEM
  const double pitch = 0.014;
  const double kapton = 50.e-4;
  const double metal = 5.e-4;
  const double outdia = 70.e-4;
  const double middia = 50.e-4;

  const bool plotField = false;
  if (plotField) {
    ViewField* fieldView = new ViewField();
    fieldView->SetComponent(fm);
    fieldView->SetPlane(0., -1., 0., 0., 0., 0.);
    fieldView->SetArea(-pitch / 2., -0.02, pitch / 2., 0.02);
    fieldView->SetVoltageRange(-160., 160.);
    TCanvas* cF = new TCanvas();
    fieldView->SetCanvas(cF);
    fieldView->PlotContour();
  }

  // Setup the gas.
  MediumMagboltz* gas = new MediumMagboltz();
  gas->SetComposition("ar", 70., "co2", 30.);
  gas->SetTemperature(293.15);
  gas->SetPressure(760.);
  gas->EnableDebugging();
  gas->Initialise();  
  gas->DisableDebugging();
  // Set the Penning transfer efficiency.
  const double rPenning = 0.57;
  const double lambdaPenning = 0.;
  gas->EnablePenningTransfer(rPenning, lambdaPenning, "ar");
  // Load the ion mobilities.
  gas->LoadIonMobility("IonMobility_Ar+_Ar.txt");
  
  // Associate the gas with the corresponding field map material. 
  const int nMaterials = fm->GetNumberOfMaterials();
  for (int i = 0; i < nMaterials; ++i) {
    const double eps = fm->GetPermittivity(i);
    if (fabs(eps - 1.) < 1.e-3) fm->SetMedium(i, gas);
  }
  fm->PrintMaterials();

  // Create the sensor.
  Sensor* sensor = new Sensor();
  sensor->AddComponent(fm);
  sensor->SetArea(-5 * pitch, -5 * pitch, -0.03,
                   5 * pitch,  5 * pitch,  0.03);

  AvalancheMicroscopic* aval = new AvalancheMicroscopic();
  aval->SetSensor(sensor);

  AvalancheMC* drift = new AvalancheMC();
  drift->SetSensor(sensor);
  drift->SetDistanceSteps(2.e-4);

  const bool plotDrift = true;
  ViewDrift* driftView = new ViewDrift();
  if (plotDrift) {
    driftView->SetArea(-2 * pitch, -2 * pitch, -0.02,
                        2 * pitch,  2 * pitch,  0.02);
    // Plot every 10 collisions (in microscopic tracking).
    aval->SetCollisionSteps(10); 
    aval->EnablePlotting(driftView);
    drift->EnablePlotting(driftView);
  }

  // Histograms
  int nBinsGain = 100;
  double gmin =   0.;
  double gmax = 100.;
  TH1F* hElectrons = new TH1F("hElectrons", "Number of electrons",
                              nBinsGain, gmin, gmax);
  TH1F* hIons = new TH1F("hIons", "Number of ions",
                         nBinsGain, gmin, gmax);

  int nBinsChrg = 100;
  TH1F* hChrgE = new TH1F("hChrgE", "Electrons on plastic",
                          nBinsChrg, -0.5e4 * kapton, 0.5e4 * kapton);
  TH1F* hChrgI = new TH1F("hChrgI", "Ions on plastic", 
                          nBinsChrg, -0.5e4 * kapton, 0.5e4 * kapton);

  double sumIonsTotal = 0.;
  double sumIonsDrift = 0.;
  double sumIonsPlastic = 0.;

  double sumElectronsTotal = 0.;
  double sumElectronsPlastic = 0.;
  double sumElectronsUpperMetal = 0.;
  double sumElectronsLowerMetal = 0.;
  double sumElectronsTransfer = 0.;
  double sumElectronsOther = 0.;

  const int nEvents = 10;
  for (int i = nEvents; i--;) { 
    if (debug || i % 10 == 0) std::cout << i << "/" << nEvents << "\n";
    // Randomize the initial position.
    const double smear = pitch / 2.; 
    double x0 = -smear + RndmUniform() * smear;
    double y0 = -smear + RndmUniform() * smear;
    double z0 = 0.025; 
    double t0 = 0.;
    double e0 = 0.1;
    aval->AvalancheElectron(x0, y0, z0, t0, e0, 0., 0., 0.);
    int ne = 0, ni = 0;
    aval->GetAvalancheSize(ne, ni);
    hElectrons->Fill(ne);
    hIons->Fill(ni); 
    const int np = aval->GetNumberOfElectronEndpoints();
    double xe1, ye1, ze1, te1, e1;
    double xe2, ye2, ze2, te2, e2;
    double xi1, yi1, zi1, ti1;
    double xi2, yi2, zi2, ti2;
    int status;
    for (int j = np; j--;) {
      aval->GetElectronEndpoint(j, xe1, ye1, ze1, te1, e1, 
                                   xe2, ye2, ze2, te2, e2, status);
      sumElectronsTotal += 1.;
      if (ze2 > -kapton / 2. && ze2 < kapton / 2.) {
        hChrgE->Fill(ze2 * 1.e4);
        sumElectronsPlastic += 1.;
      } else if (ze2 >= kapton / 2. && ze2 <= kapton  / 2. + metal) {
        sumElectronsUpperMetal += 1.;
      } else if (ze2 <= -kapton / 2. && ze2 >= -kapton / 2. - metal) {
        sumElectronsLowerMetal += 1.;
      } else if (ze2 < -kapton / 2. - metal) {
        sumElectronsTransfer += 1.;
      } else {
        sumElectronsOther += 1.;
      }
      drift->DriftIon(xe1, ye1, ze1, te1);
      drift->GetIonEndpoint(0, xi1, yi1, zi1, ti1, 
                               xi2, yi2, zi2, ti2, status);
      if (zi1 < 0.01) {
        sumIonsTotal += 1.;
        if (zi2 > 0.01) sumIonsDrift += 1.;
      }
      if (zi2 > -kapton / 2. && zi2 < kapton / 2.) {
        hChrgI->Fill(zi2 * 1.e4);
        sumIonsPlastic += 1.;
      }
    }
  }

  double fFeedback = 0.;
  if (sumIonsTotal > 0.) fFeedback = sumIonsDrift / sumIonsTotal;
  std::cout << "Fraction of ions drifting back: " << fFeedback << "\n"; 

  const double neMean = hElectrons->GetMean();
  std::cout << "Mean number of electrons: " << neMean << "\n";
  const double niMean = hIons->GetMean();
  std::cout << "Mean number of ions: " << niMean << "\n";

  std::cout << "Mean number of electrons on plastic: "
            << sumElectronsPlastic / nEvents << "\n";
  std::cout << "Mean number of ions on plastic: "
            << sumIonsPlastic / nEvents << "\n";
 
  std::cout << "Electron endpoints:\n";
  const double fUpperMetal = sumElectronsUpperMetal / sumElectronsTotal;
  const double fPlastic = sumElectronsPlastic / sumElectronsTotal;
  const double fLowerMetal = sumElectronsLowerMetal / sumElectronsTotal;
  const double fTransfer = sumElectronsTransfer / sumElectronsTotal;
  const double fOther = sumElectronsOther / sumElectronsTotal;
  std::cout << "    upper metal: " << fUpperMetal * 100. << "%\n";
  std::cout << "    plastic:     " << fPlastic * 100. << "%\n";
  std::cout << "    lower metal: " << fLowerMetal * 100. << "%\n";
  std::cout << "    transfer:    " << fTransfer * 100. << "%\n";
  std::cout << "    other:       " << fOther * 100. << "%\n";

  TCanvas* cD = new TCanvas();
  const bool plotGeo = true;
  if (plotGeo && plotDrift) {
    // Build the geometry in Root.
    TGeoManager* geoman = new TGeoManager("world", "geometry");
    TGeoMaterial* matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0);
    TGeoMedium* medVacuum = new TGeoMedium("Vacuum", 1, matVacuum);
    TGeoMaterial* matKapton = new TGeoMaterial("Kapton", 12, 6, 1.42);
    TGeoMedium* medKapton = new TGeoMedium("Kapton", 2, matKapton);
    TGeoMaterial* matCopper = new TGeoMaterial("Copper", 63, 29, 8.94);
    TGeoMedium* medCopper = new TGeoMedium("Copper", 3, matCopper);
    TGeoVolume* volTop = geoman->MakeBox("TOP", 
                                         medVacuum, pitch, pitch, 0.02);
    volTop->SetVisibility(0);
    TGeoBBox* shpKapton = new TGeoBBox("K", pitch / 2., 
                                            pitch / 2., 
                                            kapton / 2.);
    TGeoPcon* shpHole = new TGeoPcon("H", 0., 360., 3);
    shpHole->DefineSection(0, -kapton / 2., 0., outdia / 2.);
    shpHole->DefineSection(1,           0., 0., middia / 2.);
    shpHole->DefineSection(2,  kapton / 2., 0., outdia / 2.);

    TGeoCompositeShape* shpGem = new TGeoCompositeShape("G", "K - H");
    TGeoVolume* volKapton = new TGeoVolume("Kapton", shpGem, medKapton);
    volKapton->SetLineColor(kGreen);
    volKapton->SetTransparency(50);

    TGeoBBox* shpMetal = new TGeoBBox("M", pitch / 2., 
                                           pitch / 2., 
                                           metal / 2.);
    TGeoTube* shpTube = new TGeoTube("T", 0., outdia / 2., metal / 2.);
    TGeoCompositeShape* shpElectrode = new TGeoCompositeShape("E", "M - T");
    TGeoVolume* volElectrode = new TGeoVolume("Electrode", 
                                              shpElectrode, medCopper);
    volElectrode->SetLineColor(kBlue);
    volElectrode->SetTransparency(50);

    TGeoVolumeAssembly* volGem = new TGeoVolumeAssembly("Gem");
    const double shift =  0.5 * (metal + kapton);
    volGem->AddNode(volKapton, 1);
    volGem->AddNode(volElectrode, 2, new TGeoTranslation(0., 0.,  shift));
    volGem->AddNode(volElectrode, 3, new TGeoTranslation(0., 0., -shift));

    volTop->AddNode(volGem, 1);
    volTop->AddNode(volGem, 2, new TGeoTranslation(-pitch, 0., 0.));
    volTop->AddNode(volGem, 3, new TGeoTranslation(+pitch, 0., 0.));
    volTop->AddNode(volGem, 4, 
               new TGeoTranslation(-pitch / 2., sqrt(3) * pitch / 2., 0.));
    volTop->AddNode(volGem, 5, 
               new TGeoTranslation(+pitch / 2., sqrt(3) * pitch / 2., 0.));
    volTop->AddNode(volGem, 6,
               new TGeoTranslation(-pitch / 2., -sqrt(3) * pitch / 2., 0.));
    volTop->AddNode(volGem, 7,
               new TGeoTranslation(+pitch / 2., -sqrt(3) * pitch / 2., 0.));
    geoman->SetVerboseLevel(0);
    geoman->SetTopVolume(volTop);
    geoman->CloseGeometry();
    geoman->CheckOverlaps(0.1e-4);
    geoman->SetNmeshPoints(100000);
    cD->cd();
    geoman->GetTopVolume()->Draw("ogl");
  }

  if (plotDrift) {
    driftView->SetCanvas(cD);
    driftView->Plot();
  }

  const bool plotHistogram = true;
  if (plotHistogram) {
    TCanvas* cH = new TCanvas("cH", "Histograms", 800, 700);
    cH->Divide(2, 2);
    cH->cd(1);
    hElectrons->Draw();
    cH->cd(2);
    hIons->Draw();
    cH->cd(3);
    hChrgE->Draw();
    cH->cd(4);
    hChrgI->Draw();
  }

  app.Run(kTRUE);

}