39   for (Int_t 
i=0; 
i< 16; 
i++){
 
   43         vertBox[
i] = (-vert[3] - spaces);   
 
   45     else if (
i==8 || 
i==9) 
 
   47         vertBox[
i] = (-vert[11] - spaces);  
 
   49     else if (
i==7 || 
i==15)
 
   51         vertBox[
i] = (-vert[
i-1] - spaces); 
 
   53     else if (
i==2 || 
i==10)                
 
   55         vertBox[
i] = (-vert[
i+1] - spaces);
 
   59         vertBox[
i] = (vert[
i] + spaces);    
 
   64   for (Int_t 
i=0; 
i< 16; 
i++){
 
   68         vertSub[
i] = (vertBox[
i]*2 - spacesSub); 
 
   70     else if (
i==8 || 
i==9) 
 
   72         vertSub[
i] = (vertBox[
i]*2 - spacesSub); 
 
   74     else if (
i==7 || 
i==15)
 
   76         vertSub[
i] = (vertBox[
i]*2 - spacesSub);
 
   78     else if (
i==2 || 
i==10)
 
   80         vertSub[
i] = (vertBox[
i]*2 - spacesSub);
 
   84         vertSub[
i] = (vertBox[
i]*2 + spacesSub);
 
   90   for (Int_t 
i=0; 
i< 16; 
i++){
 
   95     else if (
i==8 || 
i==9) 
 
   99     else if (
i==7 || 
i==15)
 
  101         vertQuar[
i] = (vertSub[
i]*9 - spacesSub);
 
  103     else if (
i==2 || 
i==10)
 
  114   gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/basiclibs.C");
 
  118   gSystem->Load(
"libGeoBase");
 
  119   gSystem->Load(
"libParBase");
 
  120   gSystem->Load(
"libBase");
 
  121   gSystem->Load(
"libPndData");
 
  122   gSystem->Load(
"libPassive");
 
  125   TFile* 
fi = 
new TFile(outfile,
"RECREATE");  
 
  127   FairGeoLoader* 
geoLoad = 
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
 
  128   FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
 
  129   geoFace->setMediaFile(
"../../../pandaroot/geometry/media_pnd.geo");
 
  130   geoFace->readMedia();
 
  133   FairGeoMedia *
Media =  geoFace->getMedia();
 
  141   Int_t 
nmed=geobuild->createMedium(CbmMediumAir);
 
  142   nmed=geobuild->createMedium(CbmMediumPWO);
 
  143   nmed=geobuild->createMedium(CbmMediumCarbon);
 
  144   nmed=geobuild->createMedium(CbmMediumAluminium);
 
  146   TGeoManager* 
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
 
  151   TGeoVolume *
top = gGeoMan->MakeTube(
"top",gGeoMan->GetMedium(
"air"),0,98,22.5);
 
  153   gGeoMan->SetTopVolume(top);
 
  178   cout<< 
"-----------------------------------------------> Quarter VOLUME " <<endl;
 
  179   name = 
"QuarterShape";
 
  180   QuarterShape = 
new TGeoArb8(name,dz,vertQuar); 
 
  185   QuarterVol = 
new TGeoVolume(name,QuarterShape,gGeoMan->GetMedium(medium));
 
  187   cout << 
"Quarter Medium ==== "<< gGeoMan->GetMedium(medium)->GetName()<< endl;
 
  190   name = 
"SubunitShape";
 
  191   SubunitShape = 
new TGeoArb8(name,dz,vertSub); 
 
  196   SubunitVol = 
new TGeoVolume(name,SubunitShape,gGeoMan->GetMedium(medium));
 
  200   BoxShape = 
new TGeoArb8(name,dz,vertBox); 
 
  205   BoxVol = 
new TGeoVolume(name,BoxShape,gGeoMan->GetMedium(medium));
 
  212     cout << 
"----------------> BOX number: " << 
b <<endl;
 
  214       trBox = 
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
 
  215       rotBox = 
new TGeoRotation();    
 
  216       rotBox.RotateX(0.465518);  
 
  217       rotBox.RotateY(-0.465518); 
 
  220       trBox = 
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
 
  221       rotBox = 
new TGeoRotation(); 
 
  222       rotBox.RotateX(-0.465518); 
 
  223       rotBox.RotateY(0.465518);  
 
  226       trBox = 
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
 
  227       rotBox = 
new TGeoRotation();
 
  228       rotBox.RotateX(-0.465518); 
 
  229       rotBox.RotateY(-0.465518); 
 
  232       trBox = 
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
 
  233       rotBox = 
new TGeoRotation();
 
  234       rotBox.RotateX(0.465518); 
 
  235       rotBox.RotateY(0.465518); 
 
  237     TGeoCombiTrans* trrotBox= 
new TGeoCombiTrans(trBox,rotBox); 
 
  241     trrotBox->SetName(name);
 
  242     trrotBox->RegisterYourself();
 
  244     SubunitVol->AddNode(BoxVol,
b,trrotBox);
 
  248   name = 
"CrystalShape";
 
  249   CrystalShape = 
new TGeoArb8(name,dz,vert); 
 
  253   CrystalVol = 
new TGeoVolume(name,CrystalShape,gGeoMan->GetMedium(medium));
 
  258   CrystalVol->SetLineColor(5);
 
  261     cout << 
"         ----->  CRYSTAL number: "<< k << endl;
 
  263       trCrystal = 
new TGeoTranslation(0.5*kSpaceInBox,0.5*kSpaceInBox,0.);
 
  264       rotCrystal = 
new TGeoRotation() ; 
 
  266       trCrystal= 
new TGeoTranslation(-0.5*kSpaceInBox,-0.5*kSpaceInBox,0.); 
 
  267       rotCrystal = 
new TGeoRotation();  
 
  268       rotCrystal.RotateZ(180.);      
 
  270       trCrystal= 
new TGeoTranslation(-0.5*kSpaceInBox,0.5*kSpaceInBox,0.); 
 
  271       rotCrystal = 
new TGeoRotation();  
 
  272       rotCrystal.RotateZ(90.);       
 
  274       trCrystal= 
new TGeoTranslation(0.5*kSpaceInBox,-0.5*kSpaceInBox,0.); 
 
  275       rotCrystal = 
new TGeoRotation() ; 
 
  276       rotCrystal.RotateZ(270.);      
 
  278     TGeoCombiTrans* trrotCrystal= 
new TGeoCombiTrans(trCrystal,rotCrystal); 
 
  282     trrotCrystal->SetName(name);
 
  283     trrotCrystal->RegisterYourself();
 
  285     BoxVol->AddNode(CrystalVol,k,trrotCrystal);
 
  297       if (
row<3  && 
col <2) flag=0;
 
  298       if (
row==3 && 
col==0) flag=0;
 
  299       if (
col>1  && 
row >7) flag=0;
 
  300       if (
col>4  && 
row >6) flag=0;
 
  301       if (
col>5  && 
row >5) flag=0;
 
  302       if (
col>6  && 
row >4) flag=0;
 
  303       if (
col>7  && 
row >1) flag=0;
 
  308         cout<< 
"----------------------------> 16 CRYSTALS SUBUNIT  No: " << jj <<endl;
 
  310         rotSub = 
new TGeoRotation();
 
  317         rotSub.RotateX(RotToZeroSubX);
 
  318         rotSub.RotateY(RotToZeroSubY);
 
  321         Double_t addShiftX=FrontFaceToOffPoint*tan_alpha1;
 
  324         Double_t addShiftY=FrontFaceToOffPoint*tan_alpha2;
 
  335         trSub = 
new TGeoTranslation(ShiftX, ShiftY, 0.);
 
  337         TGeoCombiTrans* thAngle= 
new TGeoCombiTrans(trSub,rotSub); 
 
  341         thAngle->SetName(name);
 
  342         thAngle->RegisterYourself();                 
 
  344         QuarterVol->AddNode(SubunitVol,jj,thAngle);
 
  349   trQuar  = 
new TGeoTranslation(0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
 
  350   rotQuar = 
new TGeoRotation();
 
  352   TGeoCombiTrans* 
trrotQuar= 
new TGeoCombiTrans(trQuar,rotQuar);    
 
  354   trrotQuar->SetName(name);
 
  355   trrotQuar->RegisterYourself();
 
  357   top->AddNode(QuarterVol,1,trrotQuar); 
 
  359   for (Int_t q=1; q<=3; q++){
 
  363       reflection.ReflectX(1);
 
  364       ttt = 
new TGeoTranslation(-0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
 
  367       reflection.ReflectY(1); 
 
  368       ttt = 
new TGeoTranslation(0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
 
  371       reflection.ReflectY(1);
 
  372       reflection.ReflectX(1);
 
  373       ttt = 
new TGeoTranslation(-0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
 
  376     top->AddNode(QuarterVol,q+1,
new TGeoCombiTrans(ttt,reflection)); 
 
  379   gGeoMan->CloseGeometry();
 
FairGeoMedium * CbmMediumCarbon
FairGeoMedium * CbmMediumAir
const Double_t kSpaceInSub
FairGeoMedium * CbmMediumPWO
FairGeoMedium * CbmMediumAluminium
Double_t FrontFaceToOffPoint
FairGeoInterface * geoFace
TGeoCombiTrans reflection
FairGeoBuilder * geobuild
TGeoTranslation trCrystal
const Int_t kNumOfCrystals
TGeoCombiTrans * trrotQuar
const Double_t kAlveoleThickness
const Double_t kSpaceSubGlue
const Int_t kNumOfQuarters