54   for (Int_t 
i=0; 
i< 16; 
i++){
 
   58         vertBox[
i] = (-vert[3] - spaces);   
 
   60     else if (
i==8 || 
i==9) 
 
   62         vertBox[
i] = (-vert[11] - spaces);  
 
   64     else if (
i==7 || 
i==15)
 
   66         vertBox[
i] = (-vert[
i-1] - spaces); 
 
   68     else if (
i==2 || 
i==10)                
 
   70         vertBox[
i] = (-vert[
i+1] - spaces);
 
   74         vertBox[
i] = (vert[
i] + spaces);    
 
   79   for (Int_t 
i=0; 
i< 16; 
i++){
 
   83         vertSub[
i] = (vertBox[
i]*2 - spacesSub); 
 
   85     else if (
i==8 || 
i==9) 
 
   87         vertSub[
i] = (vertBox[
i]*2 - spacesSub); 
 
   89     else if (
i==7 || 
i==15)
 
   91         vertSub[
i] = (vertBox[
i]*2 - spacesSub);
 
   93     else if (
i==2 || 
i==10)
 
   95         vertSub[
i] = (vertBox[
i]*2 - spacesSub);
 
   99         vertSub[
i] = (vertBox[
i]*2 + spacesSub);
 
  105   for (Int_t 
i=0; 
i< 16; 
i++){
 
  110     else if (
i==8 || 
i==9) 
 
  114     else if (
i==7 || 
i==15)
 
  116         vertQuar[
i] = (vertSub[
i]*9 - spacesSub);
 
  118     else if (
i==2 || 
i==10)
 
  129   gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
 
  132   gSystem->Load(
"libGeoBase");
 
  133   gSystem->Load(
"libParBase");
 
  134   gSystem->Load(
"libBase");
 
  135   gSystem->Load(
"libPndData");
 
  136   gSystem->Load(
"libPassive");
 
  140   TFile* 
fi = 
new TFile(outfile,
"RECREATE");  
 
  142   FairGeoLoader* 
geoLoad = 
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
 
  143   FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
 
  144   geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
 
  145   geoFace->readMedia();
 
  148   FairGeoMedia *
Media =  geoFace->getMedia();
 
  156   Int_t 
nmed=geobuild->createMedium(CbmMediumAir);
 
  157   nmed=geobuild->createMedium(CbmMediumPWO);
 
  158   nmed=geobuild->createMedium(CbmMediumCarbon);
 
  159   nmed=geobuild->createMedium(CbmMediumAluminium);
 
  161   TGeoManager* 
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
 
  168   TGeoVolume *
top = 
new TGeoVolumeAssembly(
"Emc3");
 
  170   gGeoMan->SetTopVolume(top);
 
  195   for(Int_t q=0; q<4; q++){   
 
  198     name = 
"SubunitShape";
 
  199     SubunitShape = 
new TGeoArb8(name,dz,vertSub); 
 
  205     SubunitVol[q] = 
new TGeoVolumeAssembly(name);
 
  211     BoxShape = 
new TGeoArb8(name,dz,vertBox); 
 
  218     BoxVol[q] = 
new TGeoVolumeAssembly(name);
 
  245     cout <<
"bx[0]= "<<bx[0]
 
  249          <<
", kNumOfBoxes = "<<kNumOfBoxes
 
  256       cout << 
"----------------> BOX number: " << 
b <<endl;
 
  258         trBox = 
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
 
  259         rotBox = 
new TGeoRotation();    
 
  260         rotBox.RotateX(0.465518);  
 
  261         rotBox.RotateY(-0.465518); 
 
  264         trBox = 
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
 
  265         rotBox = 
new TGeoRotation(); 
 
  266         rotBox.RotateX(-0.465518); 
 
  267         rotBox.RotateY(0.465518);  
 
  270         trBox = 
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
 
  271         rotBox = 
new TGeoRotation();
 
  272         rotBox.RotateX(-0.465518); 
 
  273         rotBox.RotateY(-0.465518); 
 
  276         trBox = 
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
 
  277         rotBox = 
new TGeoRotation();
 
  278         rotBox.RotateX(0.465518); 
 
  279         rotBox.RotateY(0.465518); 
 
  281       TGeoCombiTrans* trrotBox= 
new TGeoCombiTrans(trBox,rotBox); 
 
  285       trrotBox->SetName(name);
 
  286       trrotBox->RegisterYourself();
 
  288       SubunitVol[q]->AddNode(BoxVol[q],
b,trrotBox);    
 
  293     name = 
"CrystalShape";
 
  294     CrystalShape = 
new TGeoArb8(name,dz,vert); 
 
  299     CrystalVol = 
new TGeoVolume(name,CrystalShape,gGeoMan->GetMedium(medium));
 
  301     CrystalVol->SetLineColor(5);
 
  337         trCrystal = 
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.);
 
  338         rotCrystal = 
new TGeoRotation() ; 
 
  340         trCrystal= 
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.); 
 
  341         rotCrystal = 
new TGeoRotation();  
 
  342         rotCrystal.RotateZ(180.);      
 
  344         trCrystal= 
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.); 
 
  345         rotCrystal = 
new TGeoRotation();  
 
  346         rotCrystal.RotateZ(90.);       
 
  348         trCrystal= 
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.); 
 
  349         rotCrystal = 
new TGeoRotation() ; 
 
  350         rotCrystal.RotateZ(270.);      
 
  353       TGeoCombiTrans* trrotCrystal= 
new TGeoCombiTrans(trCrystal,rotCrystal); 
 
  356       trrotCrystal->SetName(name);
 
  357       trrotCrystal->RegisterYourself();
 
  359       BoxVol[q]->AddNode(CrystalVol,k,trrotCrystal);
 
  373     cout<< 
"------------------------> Quarter VOLUME ** " <<q+1<<
" ** is created."<<endl;
 
  376     QuarterVol[q] = 
new TGeoVolumeAssembly(name); 
 
  379     cout << 
"Quarter Medium ==== "<< gGeoMan->GetMedium(medium)->GetName()<< endl;
 
  387         if (
row<3  && 
col <2) flag=0;
 
  388         if (
row==3 && 
col==0) flag=0;
 
  389         if (
col>1  && 
row >7) flag=0;
 
  390         if (
col>4  && 
row >6) flag=0;
 
  391         if (
col>5  && 
row >5) flag=0;
 
  392         if (
col>6  && 
row >4) flag=0;
 
  393         if (
col>7  && 
row >1) flag=0;
 
  398           cout<< 
"----------------------------> 16 CRYSTALS SUBUNIT  No: " << jj <<endl;
 
  400           rotSub = 
new TGeoRotation();
 
  426           Double_t RotToZeroSubX=  0.931*cp_col[q]; 
 
  427           Double_t RotToZeroSubY= -0.931*cp_row[q]; 
 
  429           rotSub.RotateX(RotToZeroSubX);
 
  430           rotSub.RotateY(RotToZeroSubY);
 
  433           Double_t addShiftX=FrontFaceToOffPoint*tan_alpha1;
 
  436           Double_t addShiftY=FrontFaceToOffPoint*tan_alpha2;
 
  441           trSub = 
new TGeoTranslation(ShiftX, ShiftY, 0.);
 
  443           TGeoCombiTrans* thAngle= 
new TGeoCombiTrans(trSub,rotSub); 
 
  447           thAngle->SetName(name);
 
  448           thAngle->RegisterYourself();                 
 
  450           QuarterVol[q]->AddNode(SubunitVol[q],jj,thAngle); 
 
  455     trQuar  = 
new TGeoTranslation(0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
 
  456     rotQuar = 
new TGeoRotation();
 
  458     TGeoCombiTrans* 
trrotQuar= 
new TGeoCombiTrans(trQuar,rotQuar);    
 
  461     trrotQuar->SetName(name);
 
  462     trrotQuar->RegisterYourself();
 
  464     top->AddNode(QuarterVol[q],q+1,trrotQuar); 
 
  559   gGeoMan->CloseGeometry();
 
const Double_t kSpaceInSub
TGeoTranslation trCrystal
const Double_t kSpaceSubGlue
FairGeoMedium * CbmMediumCarbon
Double_t FrontFaceToOffPoint
FairGeoMedium * CbmMediumAluminium
FairGeoBuilder * geobuild
FairGeoMedium * CbmMediumAir
const Double_t kAlveoleThickness
TGeoCombiTrans * trrotQuar
FairGeoMedium * CbmMediumPWO
FairGeoInterface * geoFace
const Int_t kNumOfCrystals
const Int_t kNumOfQuarters