211         gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
 
  214   gSystem->Load(
"libGeoBase");
 
  215   gSystem->Load(
"libParBase");
 
  216   gSystem->Load(
"libBase");
 
  217   gSystem->Load(
"libPndData");
 
  218   gSystem->Load(
"libPassive");
 
  219   gSystem->Load(
"libHypGe");
 
  221         cout << TargetThickness_Ext;
 
  222         TString outfileWithoutPath =
"hypGeGeoCOSY2014setupActives.root";
 
  232         outfile += outfileWithoutPath;
 
  234         cout << outfile << endl;
 
  236   TFile* 
fi = 
new TFile(outfile,
"RECREATE");
 
  238  FairGeoLoader* 
geoLoad = 
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
 
  239   FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
 
  240   geoFace->setMediaFile(
"../../../../geometry/media_pnd.geo");
 
  241   geoFace->readMedia();
 
  244   FairGeoMedia *
Media =  geoFace->getMedia();
 
  245   FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
 
  247   FairGeoMedium *medcarbon  = Media->getMedium(
"carbon");
 
  248   Int_t nmedcap=geobuild->createMedium(medcarbon);
 
  249         TGeoMedium *Carbon = 
gGeoManager->GetMedium(
"carbon");
 
  251         FairGeoMedium *medcap  = Media->getMedium(
"HYPaluminium");
 
  252   Int_t nmedcap=geobuild->createMedium(medcap);
 
  253   TGeoMedium *Al = 
gGeoManager->GetMedium(
"HYPaluminium");
 
  255         FairGeoMedium *medGe  = Media->getMedium(
"germanium");
 
  256   Int_t nmedGe=geobuild->createMedium(medGe);
 
  257   TGeoMedium *Ge = 
gGeoManager->GetMedium(
"germanium");
 
  259   FairGeoMedium *medsteel  = Media->getMedium(
"steel");
 
  260   Int_t nmedcap=geobuild->createMedium(medsteel);
 
  261         TGeoMedium *Steel = 
gGeoManager->GetMedium(
"steel");
 
  263         FairGeoMedium *medcu  = Media->getMedium(
"copper");
 
  264   Int_t nmedcap=geobuild->createMedium(medcu);
 
  267         FairGeoMedium *medpe_bor5  = Media->getMedium(
"pe_bor5");
 
  268   Int_t nmedcap=geobuild->createMedium(medcu);
 
  269         TGeoMedium *pe_bor5 = 
gGeoManager->GetMedium(
"pe_bor5");        
 
  271   TGeoManager *
geom = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
 
  272   TGeoVolume *
top = 
new TGeoVolumeAssembly(
"hpGe");
 
  273         TGeoVolume *Realtop = 
new TGeoVolumeAssembly(
"Realtop");
 
  276   geom->SetTopVolume(top);
 
  279         Double_t TargetThickness = TargetThickness_Ext;
 
  280         TGeoVolume* 
Target = geom->MakeBox(
"Target",Carbon,2.4,2.4,TargetThickness/2);
 
  281         Target->SetLineColor(kRed);
 
  282         Target->SetFillColor(kRed);
 
  283         TGeoRotation *TargetRot = 
new TGeoRotation(
"TargetRot",0,Angle,0);
 
  285         cout << TargetThickness/2/
TMath::Cos(Angle*
Pi/180) << endl;
 
  286         TGeoVolume* TargetAddition = geom->MakeBox(
"TargetAddition",Carbon,0.5,2.4,2.4);
 
  287         TargetAddition->SetLineColor(kRed);
 
  288         TargetAddition->SetFillColor(kRed);
 
  293         TGeoVolume *AlSupportAssembly = 
new TGeoVolumeAssembly(
"AlSupportAssembly"); 
 
  295         TGeoTube *AlPlateTube = 
new TGeoTube(
"AlPlateTube",0,6,0.2);
 
  296                 TGeoRotation *AlPlateTubeRotation = 
new TGeoRotation (
"AlPlateTubeRotation",90,90,0);
 
  297                 AlPlateTubeRotation->RegisterYourself();
 
  298         TGeoBBox *AlPlateBox = 
new TGeoBBox(
"AlPlateBox",0.2,6,11.6/2);
 
  299                 TGeoTranslation *AlPlateBoxTranslation = 
new TGeoTranslation (
"AlPlateBoxTranslation",0,0,+5.8);
 
  300                 AlPlateBoxTranslation->RegisterYourself();
 
  301         TGeoCompositeShape *AlPlateShape = 
new TGeoCompositeShape(
"AlPlateShape", 
"AlPlateTube : AlPlateTubeRotation +  AlPlateBox : AlPlateBoxTranslation");
 
  302         TGeoVolume *AlPlate = 
new TGeoVolume(
"AlPlate", AlPlateShape, Al);
 
  303         AlPlate->SetLineColor(14);
 
  304         AlPlate->SetFillColor(14);
 
  307         TGeoBBox *AlFrontAngleTop = 
new TGeoBBox(
"AlFrontAngleTop",0.5,2.5,0.1);
 
  308                 TGeoTranslation *AlFrontAngleTopTranslation = 
new TGeoTranslation (
"AlFrontAngleTopTranslation",+0.2+0.5,0,-0.1);
 
  309                 AlFrontAngleTopTranslation->RegisterYourself();
 
  310         TGeoBBox *AlFrontAngleBottom = 
new TGeoBBox(
"AlFrontAngleBottom",0.1,2.5,1.5);
 
  311                 TGeoTranslation *AlFrontAngleBottomTranslation = 
new TGeoTranslation (
"AlFrontAngleBottomTranslation",+0.3,0,-1.5);
 
  312                 AlFrontAngleBottomTranslation->RegisterYourself();
 
  313         TGeoBBox *AlFrontAngleBottomCutout = 
new TGeoBBox(
"AlFrontAngleBottomCutout",1,0.25,1.5);
 
  314                 TGeoTranslation *AlFrontAngleBottomCutoutTranslation = 
new TGeoTranslation (
"AlFrontAngleBottomCutoutTranslation",+0.3,0,-2.5);
 
  315                 AlFrontAngleBottomCutoutTranslation->RegisterYourself();
 
  316         TGeoCompositeShape *AlFrontAngleShape = 
new TGeoCompositeShape(
"AlFrontAngleShape", 
"(AlFrontAngleTop : AlFrontAngleTopTranslation +  AlFrontAngleBottom : AlFrontAngleBottomTranslation ) - ( AlFrontAngleBottomCutout : AlFrontAngleBottomCutoutTranslation)");
 
  317         TGeoVolume *AlFrontAngle = 
new TGeoVolume(
"AlFrontAngle", AlFrontAngleShape, Al);
 
  318         AlFrontAngle ->SetLineColor(14);
 
  319         AlFrontAngle ->SetFillColor(14);
 
  322         TGeoBBox *AlBackAngleTop = 
new TGeoBBox(
"AlBackAngleTop",0.5,2.5,0.1);
 
  323                 TGeoTranslation *AlBackAngleTopTranslation = 
new TGeoTranslation (
"AlBackAngleTopTranslation",+0.2+0.5,0,4.9);
 
  324                 AlBackAngleTopTranslation->RegisterYourself();
 
  325         TGeoBBox *AlBackAngleBottom = 
new TGeoBBox(
"AlBackAngleBottom",0.1,2.5,5);
 
  326                 TGeoTranslation *AlBackAngleBottomTranslation = 
new TGeoTranslation (
"AlBackAngleBottomTranslation",+0.3,0,4.8+5);
 
  327                 AlBackAngleBottomTranslation->RegisterYourself();
 
  328         TGeoBBox *AlBackAngleBottomCutout = 
new TGeoBBox(
"AlBackAngleBottomCutout",1,0.25,5);
 
  329                 TGeoTranslation *AlBackAngleBottomCutoutTranslation = 
new TGeoTranslation (
"AlBackAngleBottomCutoutTranslation",+0.3,0,4.8+7);
 
  330                 AlBackAngleBottomCutoutTranslation->RegisterYourself();
 
  331         TGeoCompositeShape *AlBackAngleShape = 
new TGeoCompositeShape(
"AlBackAngleShape", 
"(AlBackAngleTop : AlBackAngleTopTranslation +  AlBackAngleBottom : AlBackAngleBottomTranslation ) - ( AlBackAngleBottomCutout : AlBackAngleBottomCutoutTranslation)");
 
  332         TGeoVolume *AlBackAngle = 
new TGeoVolume(
"AlBackAngle", AlBackAngleShape, Al);
 
  333         AlBackAngle ->SetLineColor(14);
 
  334         AlBackAngle ->SetFillColor(14);
 
  337         TGeoTube *AlGoniometerTube = 
new TGeoTube(
"AlGoniometerTube",5,6,2);
 
  338                 TGeoCombiTrans *AlGoniometerTubeCombiTrans = 
new TGeoCombiTrans (
"AlGoniometerTubeCombiTrans",-2.2,0,0, 
new TGeoRotation(
"",90,90,0));
 
  339                 AlGoniometerTubeCombiTrans->RegisterYourself();
 
  340         TGeoVolume *AlGoniometer = 
new TGeoVolume(
"AlGoniometer",AlGoniometerTube,Al);
 
  341         AlGoniometer ->SetLineColor(14);
 
  342         AlGoniometer ->SetFillColor(14);
 
  346         TGeoTube *M5ScrewHeadOut = 
new TGeoTube(
"M5ScrewHeadOut",0.45/2,0.4,0.25);
 
  347         TGeoTube *M5ScrewHeadIn = 
new TGeoTube(
"M5ScrewHeadIn",0,0.45/2,0.25/2);
 
  348         TGeoTranslation *M5ScrewHeadInTrans = 
new TGeoTranslation(
"M5ScrewHeadInTrans",0,0,0.25/2);
 
  350         TGeoCompositeShape *M5ScrewHeadShape = 
new TGeoCompositeShape(
"M5SrewHeadShape",
"M5ScrewHeadOut + M5ScrewHeadIn : M5ScrewHeadInTrans");
 
  351         TGeoVolume *M5ScrewHead = 
new TGeoVolume(
"M5ScrewHead",M5ScrewHeadShape,Steel);
 
  352         TGeoCombiTrans *M5ScrewHeadCombiTrans = 
new TGeoCombiTrans (
"M5ScrewHeadCombiTrans",+0.4+0.25,0,8, 
new TGeoRotation(
"",90,270,0));
 
  353                 M5ScrewHeadCombiTrans->RegisterYourself();
 
  354         TGeoCombiTrans *M5ScrewHead2CombiTrans = 
new TGeoCombiTrans (
"M5ScrewHead2CombiTrans",+0.4+0.25,0,-2, 
new TGeoRotation(
"",90,270,0));
 
  355                 M5ScrewHead2CombiTrans->RegisterYourself();     
 
  356         M5ScrewHead->SetLineColor(36);
 
  357         M5ScrewHead->SetFillColor(36);
 
  359         AlSupportAssembly->AddNode(M5ScrewHead,1, M5ScrewHeadCombiTrans);
 
  360         AlSupportAssembly->AddNode(M5ScrewHead,2, M5ScrewHead2CombiTrans);
 
  364         TGeoBBox *AlBasePlateBox = 
new TGeoBBox(
"AlBasePlateBox",0.4,30,40);
 
  365                 TGeoCombiTrans *AlBasePlateCombiTrans = 
new TGeoCombiTrans (
"AlBasePlateCombiTrans",-4.6,25,-25, 
new TGeoRotation(
"",0,60,0));
 
  366                 AlBasePlateCombiTrans->RegisterYourself();
 
  367         TGeoVolume *AlBasePlate = 
new TGeoVolume(
"AlBasePlate",AlBasePlateBox,Al);
 
  368         AlBasePlate ->SetLineColor(14);
 
  369         AlBasePlate ->SetFillColor(14);
 
  372         AlSupportAssembly->AddNode(AlBasePlate,1, AlBasePlateCombiTrans);
 
  373         AlSupportAssembly->AddNode(AlGoniometer,1, AlGoniometerTubeCombiTrans);
 
  374         AlSupportAssembly->AddNode(AlFrontAngle,1);
 
  375         AlSupportAssembly->AddNode(AlBackAngle,1);
 
  376         AlSupportAssembly->AddNode(AlPlate,1);
 
  392         TGeoVolume *NeutronDetectorAssembly = 
new TGeoVolumeAssembly(
"NeutronDetectorAssembly");
 
  394         TGeoTube *KermitTube= 
new TGeoTube(
"KermitTube",0,23.5/2,26.4/2);
 
  395         TGeoVolume *KermitVolume = 
new TGeoVolume(
"KermitCrystal",KermitTube,pe_bor5);
 
  396         TGeoCombiTrans *KermitCombiTrans = 
new TGeoCombiTrans (
"KermitHeadCombiTrans",24.5+23.5/2,15+(26.4/2)*
TMath::Sin(
TMath::Pi()/180*60),-(15+26.4/2)*
TMath::Cos(
TMath::Pi()/180*60), 
new TGeoRotation(
"",0,60,0));
 
  397                 KermitCombiTrans->RegisterYourself();
 
  398         NeutronDetectorAssembly ->AddNode(KermitVolume,1, KermitCombiTrans);            
 
  401         TGeoSphere *NeutronBallSphere = 
new TGeoSphere(
"NeutronBallSphere",0,32/2,0,180,0,360);
 
  402         TGeoVolume *NeutronBall = 
new TGeoVolume (
"NeutronBallCrystal", NeutronBallSphere,pe_bor5);
 
  403         TGeoCombiTrans *NeutronBallCombiTrans = 
new TGeoCombiTrans (
"NeutronBallHeadCombiTrans",20,21.5+32/2,-54, 
new TGeoRotation(
"",0,0,0));
 
  404                 NeutronBallCombiTrans->RegisterYourself();
 
  405         NeutronDetectorAssembly ->AddNode(NeutronBall,1, NeutronBallCombiTrans);
 
  412         Int_t CrystalNumber = 1;
 
  418         TGeoVolume *GlueStackAssembly = 
new TGeoVolumeAssembly(
"GlueStackAssembly");
 
  421         GlueStackAssembly->AddNode(GlueStackFrame,1);
 
  423         TGeoVolume *GlueSamples[23];
 
  426         for (
int i= 0; 
i < 23; 
i++)
 
  430                 GlueStackAssembly->AddNode(GlueSamples[
i],i, 
new TGeoCombiTrans (0,0,-(0.4 + i*(0.203)), 
new TGeoRotation(
"",i*90,0,0)));
 
  432         Realtop->AddNode(GlueStackAssembly,1, 
new TGeoTranslation (0,0,-100));
 
  433         top->AddNode(Realtop,0);
 
  435         geom->CheckOverlaps();
 
  436         geom->CloseGeometry();  
 
  437         cout << 
"# of Nodes: " << Realtop->CountNodes(10,1) << endl;
 
  442         cout << 
"Wrote target geometry to file: " << outfileWithoutPath << endl;
 
  444         Realtop->Draw(
"ogl");
 
  451         return outfileWithoutPath; 
 
TGeoVolume * makeGlueStackFrame(TGeoMedium *Al_ext, TGeoMedium *Steel_ext)
TGeoManager * gGeoManager
TGeoVolume * makeGlueSample(TGeoMedium *Al_ext, TGeoMedium *Glue_ext, Int_t SampleNumber)
FairGeoBuilder * geobuild
TGeoVolume * makeMaytecFrame(TGeoMedium *Med_ext)
FairGeoInterface * geoFace