46   for (Int_t 
i=0; 
i< 16; 
i++){
 
   50         vertBox[
i] = (-vert[3] - spaces);   
 
   52     else if (
i==8 || 
i==9) 
 
   54         vertBox[
i] = (-vert[11] - spaces);  
 
   56     else if (
i==7 || 
i==15)
 
   58         vertBox[
i] = (-vert[
i-1] - spaces); 
 
   60     else if (
i==2 || 
i==10)                
 
   62         vertBox[
i] = (-vert[
i+1] - spaces);
 
   66         vertBox[
i] = (vert[
i] + spaces);    
 
   71   for (Int_t 
i=0; 
i< 16; 
i++){
 
   75         vertSub[
i] = (vertBox[
i]*2 - spacesSub); 
 
   77     else if (
i==8 || 
i==9) 
 
   79         vertSub[
i] = (vertBox[
i]*2 - spacesSub); 
 
   81     else if (
i==7 || 
i==15)
 
   83         vertSub[
i] = (vertBox[
i]*2 - spacesSub);
 
   85     else if (
i==2 || 
i==10)
 
   87         vertSub[
i] = (vertBox[
i]*2 - spacesSub);
 
   91         vertSub[
i] = (vertBox[
i]*2 + spacesSub);
 
   97   for (Int_t 
i=0; 
i< 16; 
i++){
 
  102     else if (
i==8 || 
i==9) 
 
  106     else if (
i==7 || 
i==15)
 
  108         vertQuar[
i] = (vertSub[
i]*9 - spacesSub);
 
  110     else if (
i==2 || 
i==10)
 
  121   gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
 
  124   gSystem->Load(
"libGeoBase");
 
  125   gSystem->Load(
"libParBase");
 
  126   gSystem->Load(
"libBase");
 
  127   gSystem->Load(
"libPndData");
 
  128   gSystem->Load(
"libPassive");
 
  131    TFile* 
fi = 
new TFile(outfile,
"RECREATE");  
 
  133    FairGeoLoader* 
geoLoad = 
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
 
  134    FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
 
  135    geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
 
  136    geoFace->readMedia();
 
  139   FairGeoMedia *
Media =  geoFace->getMedia();
 
  147   Int_t 
nmed=geobuild->createMedium(CbmMediumAir);
 
  148   nmed=geobuild->createMedium(CbmMediumPWO);
 
  149   nmed=geobuild->createMedium(CbmMediumCarbon);
 
  150   nmed=geobuild->createMedium(CbmMediumAluminium);
 
  152   TGeoManager* 
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
 
  159   TGeoVolume *
top = 
new TGeoVolumeAssembly(
"Emc3");
 
  161   gGeoMan->SetTopVolume(top);
 
  186   cout<< 
"-----------------------------------------------> Quarter VOLUME " <<endl;
 
  187   name = 
"QuarterShape";
 
  188   QuarterShape = 
new TGeoArb8(name,dz,vertQuar); 
 
  194     QuarterVol = 
new TGeoVolumeAssembly(name); 
 
  196   cout << 
"Quarter Medium ==== "<< gGeoMan->GetMedium(medium)->GetName()<< endl;
 
  199   name = 
"SubunitShape";
 
  200   SubunitShape = 
new TGeoArb8(name,dz,vertSub); 
 
  206   SubunitVol = 
new TGeoVolumeAssembly(name);
 
  210   BoxShape = 
new TGeoArb8(name,dz,vertBox); 
 
  216   BoxVol = 
new TGeoVolumeAssembly(name);
 
  222     cout << 
"----------------> BOX number: " << 
b <<endl;
 
  224       trBox = 
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
 
  225       rotBox = 
new TGeoRotation();    
 
  226       rotBox.RotateX(0.465518);  
 
  227       rotBox.RotateY(-0.465518); 
 
  230       trBox = 
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
 
  231       rotBox = 
new TGeoRotation(); 
 
  232       rotBox.RotateX(-0.465518); 
 
  233       rotBox.RotateY(0.465518);  
 
  236       trBox = 
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
 
  237       rotBox = 
new TGeoRotation();
 
  238       rotBox.RotateX(-0.465518); 
 
  239       rotBox.RotateY(-0.465518); 
 
  242       trBox = 
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
 
  243       rotBox = 
new TGeoRotation();
 
  244       rotBox.RotateX(0.465518); 
 
  245       rotBox.RotateY(0.465518); 
 
  247     TGeoCombiTrans* trrotBox= 
new TGeoCombiTrans(trBox,rotBox); 
 
  251     trrotBox->SetName(name);
 
  252     trrotBox->RegisterYourself();
 
  254     SubunitVol->AddNode(BoxVol,
b,trrotBox);    
 
  258   name = 
"CrystalShape";
 
  259   CrystalShape = 
new TGeoArb8(name,dz,vert); 
 
  263   CrystalVol = 
new TGeoVolume(name,CrystalShape,gGeoMan->GetMedium(medium));
 
  268   CrystalVol->SetLineColor(5);
 
  271      cout << 
"         ----->  CRYSTAL number: "<< k << endl;
 
  273         trCrystal = 
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.);
 
  274         rotCrystal = 
new TGeoRotation() ; 
 
  276         trCrystal= 
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.); 
 
  277         rotCrystal = 
new TGeoRotation();  
 
  278         rotCrystal.RotateZ(180.);      
 
  280         trCrystal= 
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.); 
 
  281         rotCrystal = 
new TGeoRotation();  
 
  282         rotCrystal.RotateZ(90.);       
 
  284         trCrystal= 
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.); 
 
  285         rotCrystal = 
new TGeoRotation() ; 
 
  286         rotCrystal.RotateZ(270.);      
 
  288      TGeoCombiTrans* trrotCrystal= 
new TGeoCombiTrans(trCrystal,rotCrystal); 
 
  291     trrotCrystal->SetName(name);
 
  292     trrotCrystal->RegisterYourself();
 
  294     BoxVol->AddNode(CrystalVol,k,trrotCrystal);
 
  306       if (
row<3  && 
col <2) flag=0;
 
  307       if (
row==3 && 
col==0) flag=0;
 
  308       if (
col>1  && 
row >7) flag=0;
 
  309       if (
col>4  && 
row >6) flag=0;
 
  310       if (
col>5  && 
row >5) flag=0;
 
  311       if (
col>6  && 
row >4) flag=0;
 
  312       if (
col>7  && 
row >1) flag=0;
 
  317         cout<< 
"----------------------------> 16 CRYSTALS SUBUNIT  No: " << jj <<endl;
 
  319         rotSub = 
new TGeoRotation();
 
  326         rotSub.RotateX(RotToZeroSubX);
 
  327         rotSub.RotateY(RotToZeroSubY);
 
  330         Double_t addShiftX=FrontFaceToOffPoint*tan_alpha1;
 
  333         Double_t addShiftY=FrontFaceToOffPoint*tan_alpha2;
 
  338         trSub = 
new TGeoTranslation(ShiftX, ShiftY, 0.);
 
  340         TGeoCombiTrans* thAngle= 
new TGeoCombiTrans(trSub,rotSub); 
 
  344         thAngle->SetName(name);
 
  345         thAngle->RegisterYourself();                 
 
  347         QuarterVol->AddNode(SubunitVol,jj,thAngle); 
 
  352   trQuar  = 
new TGeoTranslation(0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
 
  353   rotQuar = 
new TGeoRotation();
 
  355   TGeoCombiTrans* 
trrotQuar= 
new TGeoCombiTrans(trQuar,rotQuar);    
 
  357   trrotQuar->SetName(name);
 
  358   trrotQuar->RegisterYourself();
 
  360    top->AddNode(QuarterVol,1,trrotQuar); 
 
  362    for (Int_t q=1; q<=3; q++){
 
  366       reflection.ReflectX(1); 
 
  367       ttt = 
new TGeoTranslation(-0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
 
  370       reflection.ReflectY(1); 
 
  371       ttt = 
new TGeoTranslation(0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
 
  374       reflection.ReflectY(1);
 
  375       reflection.ReflectX(1); 
 
  376       ttt = 
new TGeoTranslation(-0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
 
  379      top->AddNode(QuarterVol,q+1,
new TGeoCombiTrans(ttt,reflection)); 
 
  383    cout <<
"*************************************** "<< endl;
 
  384    TString nameBoxVol = BoxVol->GetName();
 
  385    cout << 
"Checking overlaps for --------->>>> "<< nameBoxVol <<endl ;
 
  386    gGeoManager->GetVolume(nameBoxVol)->CheckOverlaps(0.001);
 
  387    cout << 
"And printing..." <<
gGeoManager->PrintOverlaps()<<endl;
 
  390    cout <<
"*************************************** "<< endl;
 
  391    TString nameSubVol = SubunitVol->GetName();
 
  392    cout << 
"Checking overlaps for --------->>>> "<< nameSubVol <<endl ;
 
  393    gGeoManager->GetVolume(nameSubVol)->CheckOverlaps(0.001);
 
  394    cout << 
"And printing..." <<
gGeoManager->PrintOverlaps()<<endl;
 
  397    cout <<
"*************************************** "<< endl;
 
  398    TString nameQuarVol = QuarterVol->GetName();
 
  399    cout << 
"Checking overlaps for --------->>>> "<< nameQuarVol <<endl ;
 
  400    gGeoManager->GetVolume(nameQuarVol)->CheckOverlaps(0.001);
 
  401    cout << 
"And printing..." <<
gGeoManager->PrintOverlaps()<<endl ;
 
  404    cout <<
"*************************************** "<< endl;
 
  405    TString nameTopVol = top->GetName();
 
  406    cout << 
"Checking overlaps for --------->>>> "<< nameTopVol <<endl ;
 
  407    gGeoManager->GetVolume(nameTopVol)->CheckOverlaps(0.001);
 
  408    cout << 
"And printing..." <<
gGeoManager->PrintOverlaps()<<endl;
 
  411    cout <<
"*************************************** "<< endl;   
 
  412    Int_t NoOfNodesInTop = top->GetNdaughters();
 
  413    cout << 
"Number of GetNdaughters() == "<< NoOfNodesInTop <<endl ;
 
  418   gGeoMan->CloseGeometry();
 
const Double_t kAlveoleThickness
FairGeoInterface * geoFace
Double_t FrontFaceToOffPoint
FairGeoMedium * CbmMediumCarbon
const Int_t kNumOfQuarters
TGeoManager * gGeoManager
const Double_t kSpaceInSub
FairGeoBuilder * geobuild
FairGeoMedium * CbmMediumPWO
TGeoCombiTrans reflection
FairGeoMedium * CbmMediumAir
const Double_t kSpaceSubGlue
TGeoCombiTrans * trrotQuar
const Int_t kNumOfCrystals
TGeoTranslation trCrystal
FairGeoMedium * CbmMediumAluminium