223 bool AddPassives = 1;
224 bool GlueStackOnly = 0;
225 bool ElectronicsStackOnly = 0;
229 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
232 gSystem->Load(
"libGeoBase");
233 gSystem->Load(
"libParBase");
234 gSystem->Load(
"libBase");
235 gSystem->Load(
"libPndData");
236 gSystem->Load(
"libPassive");
237 gSystem->Load(
"libHypGe");
242 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
243 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
244 geoFace->setMediaFile(
"../../../../geometry/media_pnd.geo");
245 geoFace->readMedia();
248 FairGeoMedia *
Media = geoFace->getMedia();
249 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
251 FairGeoMedium *medcarbon = Media->getMedium(
"carbon");
252 Int_t nmedcap=geobuild->createMedium(medcarbon);
253 TGeoMedium *Carbon =
gGeoManager->GetMedium(
"carbon");
255 FairGeoMedium *medcap = Media->getMedium(
"HYPaluminium");
256 Int_t nmedcap=geobuild->createMedium(medcap);
257 TGeoMedium *Al =
gGeoManager->GetMedium(
"HYPaluminium");
259 FairGeoMedium *medGe = Media->getMedium(
"germanium");
260 Int_t nmedGe=geobuild->createMedium(medGe);
261 TGeoMedium *Ge =
gGeoManager->GetMedium(
"germanium");
263 FairGeoMedium *medsteel = Media->getMedium(
"steel");
264 Int_t nmedcap=geobuild->createMedium(medsteel);
265 TGeoMedium *Steel =
gGeoManager->GetMedium(
"steel");
267 FairGeoMedium *medcu = Media->getMedium(
"copper");
268 Int_t nmedcap=geobuild->createMedium(medcu);
271 FairGeoMedium *medpe_bor5 = Media->getMedium(
"pe_bor5");
272 Int_t nmedcap=geobuild->createMedium(medpe_bor5);
273 TGeoMedium *pe_bor5 =
gGeoManager->GetMedium(
"pe_bor5");
275 FairGeoMedium *medacrylicGlass = Media->getMedium(
"acrylicGlass");
276 Int_t nmedcap=geobuild->createMedium(medacrylicGlass);
277 TGeoMedium *acrylicGlass =
gGeoManager->GetMedium(
"acrylicGlass");
280 TGeoManager *
geom = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
281 TGeoVolume *
top =
new TGeoVolumeAssembly(
"hpGe");
282 TGeoVolume *PassivesTop =
new TGeoVolumeAssembly(
"PassivesTop");
283 TGeoVolume *ActivesTop =
new TGeoVolumeAssembly(
"ActivesTop");
286 geom->SetTopVolume(top);
293 TGeoVolume *TargetAssembly =
new TGeoVolumeAssembly(
"TargetAssembly");
294 TGeoVolume*
Target = geom->MakeBox(
"Target",Carbon,2.4,2.4,TargetThickness/2);
295 Target->SetLineColor(kRed);
296 Target->SetFillColor(kRed);
297 TGeoRotation *TargetRot =
new TGeoRotation(
"TargetRot",0,Angle,0);
298 TargetRot->RegisterYourself();
299 TargetAssembly->AddNode(Target,0,
new TGeoCombiTrans(
"",0,0,TargetThickness/2/
TMath::Cos(Angle*
Pi/180),TargetRot));
301 TGeoVolume* TargetAddition = geom->MakeBox(
"TargetAddition",Carbon,0.5,2.4,2.4);
302 TargetAddition->SetLineColor(kRed);
303 TargetAddition->SetFillColor(kRed);
304 TargetAssembly->AddNode(TargetAddition,1,
new TGeoCombiTrans(-2.9,0,-0.1+TargetThickness/2/
TMath::Cos(Angle*
Pi/180),TargetRot));
305 TargetAssembly->AddNode(TargetAddition,2,
new TGeoCombiTrans(-3.9,0,-0.1+TargetThickness/2/
TMath::Cos(Angle*
Pi/180),TargetRot));
307 if (!GlueStackOnly && !ElectronicsStackOnly ) PassivesTop->AddNode(TargetAssembly,0);
311 TGeoVolume *AlSupportAssembly =
new TGeoVolumeAssembly(
"AlSupportAssembly");
314 TGeoTube *AlPlateTube =
new TGeoTube(
"AlPlateTube",0,6,0.2);
315 TGeoRotation *AlPlateTubeRotation =
new TGeoRotation (
"AlPlateTubeRotation",90,90,0);
316 AlPlateTubeRotation->RegisterYourself();
317 TGeoBBox *AlPlateBox =
new TGeoBBox(
"AlPlateBox",0.2,6,11.6/2);
318 TGeoTranslation *AlPlateBoxTranslation =
new TGeoTranslation (
"AlPlateBoxTranslation",0,0,+5.8);
319 AlPlateBoxTranslation->RegisterYourself();
320 TGeoCompositeShape *AlPlateShape =
new TGeoCompositeShape(
"AlPlateShape",
"AlPlateTube : AlPlateTubeRotation + AlPlateBox : AlPlateBoxTranslation");
321 TGeoVolume *AlPlate =
new TGeoVolume(
"AlPlate", AlPlateShape, Al);
322 AlPlate->SetLineColor(14);
323 AlPlate->SetFillColor(14);
326 TGeoBBox *AlFrontAngleTop =
new TGeoBBox(
"AlFrontAngleTop",0.5,2.5,0.1);
327 TGeoTranslation *AlFrontAngleTopTranslation =
new TGeoTranslation (
"AlFrontAngleTopTranslation",+0.2+0.5,0,-0.1);
328 AlFrontAngleTopTranslation->RegisterYourself();
329 TGeoBBox *AlFrontAngleBottom =
new TGeoBBox(
"AlFrontAngleBottom",0.1,2.5,1.5);
330 TGeoTranslation *AlFrontAngleBottomTranslation =
new TGeoTranslation (
"AlFrontAngleBottomTranslation",+0.3,0,-1.5);
331 AlFrontAngleBottomTranslation->RegisterYourself();
332 TGeoBBox *AlFrontAngleBottomCutout =
new TGeoBBox(
"AlFrontAngleBottomCutout",1,0.25,1.5);
333 TGeoTranslation *AlFrontAngleBottomCutoutTranslation =
new TGeoTranslation (
"AlFrontAngleBottomCutoutTranslation",+0.3,0,-2.5);
334 AlFrontAngleBottomCutoutTranslation->RegisterYourself();
335 TGeoCompositeShape *AlFrontAngleShape =
new TGeoCompositeShape(
"AlFrontAngleShape",
"(AlFrontAngleTop : AlFrontAngleTopTranslation + AlFrontAngleBottom : AlFrontAngleBottomTranslation ) - ( AlFrontAngleBottomCutout : AlFrontAngleBottomCutoutTranslation)");
336 TGeoVolume *AlFrontAngle =
new TGeoVolume(
"AlFrontAngle", AlFrontAngleShape, Al);
337 AlFrontAngle ->SetLineColor(14);
338 AlFrontAngle ->SetFillColor(14);
341 TGeoBBox *AlBackAngleTop =
new TGeoBBox(
"AlBackAngleTop",0.5,2.5,0.1);
342 TGeoTranslation *AlBackAngleTopTranslation =
new TGeoTranslation (
"AlBackAngleTopTranslation",+0.2+0.5,0,4.9);
343 AlBackAngleTopTranslation->RegisterYourself();
344 TGeoBBox *AlBackAngleBottom =
new TGeoBBox(
"AlBackAngleBottom",0.1,2.5,5);
345 TGeoTranslation *AlBackAngleBottomTranslation =
new TGeoTranslation (
"AlBackAngleBottomTranslation",+0.3,0,4.8+5);
346 AlBackAngleBottomTranslation->RegisterYourself();
347 TGeoBBox *AlBackAngleBottomCutout =
new TGeoBBox(
"AlBackAngleBottomCutout",1,0.25,5);
348 TGeoTranslation *AlBackAngleBottomCutoutTranslation =
new TGeoTranslation (
"AlBackAngleBottomCutoutTranslation",+0.3,0,4.8+7);
349 AlBackAngleBottomCutoutTranslation->RegisterYourself();
350 TGeoCompositeShape *AlBackAngleShape =
new TGeoCompositeShape(
"AlBackAngleShape",
"(AlBackAngleTop : AlBackAngleTopTranslation + AlBackAngleBottom : AlBackAngleBottomTranslation ) - ( AlBackAngleBottomCutout : AlBackAngleBottomCutoutTranslation)");
351 TGeoVolume *AlBackAngle =
new TGeoVolume(
"AlBackAngle", AlBackAngleShape, Al);
352 AlBackAngle ->SetLineColor(14);
353 AlBackAngle ->SetFillColor(14);
356 TGeoTube *AlGoniometerTube =
new TGeoTube(
"AlGoniometerTube",5,6,2);
357 TGeoCombiTrans *AlGoniometerTubeCombiTrans =
new TGeoCombiTrans (
"AlGoniometerTubeCombiTrans",-2.2,0,0,
new TGeoRotation(
"",90,90,0));
358 AlGoniometerTubeCombiTrans->RegisterYourself();
359 TGeoVolume *AlGoniometer =
new TGeoVolume(
"AlGoniometer",AlGoniometerTube,Al);
360 AlGoniometer ->SetLineColor(14);
361 AlGoniometer ->SetFillColor(14);
365 TGeoTube *M5ScrewHeadOut =
new TGeoTube(
"M5ScrewHeadOut",0.45/2,0.4,0.25);
366 TGeoTube *M5ScrewHeadIn =
new TGeoTube(
"M5ScrewHeadIn",0,0.45/2,0.25/2);
367 TGeoTranslation *M5ScrewHeadInTrans =
new TGeoTranslation(
"M5ScrewHeadInTrans",0,0,0.25/2);
369 TGeoCompositeShape *M5ScrewHeadShape =
new TGeoCompositeShape(
"M5SrewHeadShape",
"M5ScrewHeadOut + M5ScrewHeadIn : M5ScrewHeadInTrans");
370 TGeoVolume *M5ScrewHead =
new TGeoVolume(
"M5ScrewHead",M5ScrewHeadShape,Steel);
371 TGeoCombiTrans *M5ScrewHeadCombiTrans =
new TGeoCombiTrans (
"M5ScrewHeadCombiTrans",+0.4+0.25,0,8,
new TGeoRotation(
"",90,270,0));
372 M5ScrewHeadCombiTrans->RegisterYourself();
373 TGeoCombiTrans *M5ScrewHead2CombiTrans =
new TGeoCombiTrans (
"M5ScrewHead2CombiTrans",+0.4+0.25,0,-2,
new TGeoRotation(
"",90,270,0));
374 M5ScrewHead2CombiTrans->RegisterYourself();
375 M5ScrewHead->SetLineColor(36);
376 M5ScrewHead->SetFillColor(36);
378 AlSupportAssembly->AddNode(M5ScrewHead,1, M5ScrewHeadCombiTrans);
379 AlSupportAssembly->AddNode(M5ScrewHead,2, M5ScrewHead2CombiTrans);
383 TGeoBBox *AlBasePlateBox =
new TGeoBBox(
"AlBasePlateBox",0.4,30,40);
384 TGeoCombiTrans *AlBasePlateCombiTrans =
new TGeoCombiTrans (
"AlBasePlateCombiTrans",-4.6,25,-25,
new TGeoRotation(
"",0,60,0));
385 AlBasePlateCombiTrans->RegisterYourself();
386 TGeoVolume *AlBasePlate =
new TGeoVolume(
"AlBasePlate",AlBasePlateBox,Al);
387 AlBasePlate ->SetLineColor(14);
388 AlBasePlate ->SetFillColor(14);
391 AlSupportAssembly->AddNode(AlBasePlate,1, AlBasePlateCombiTrans);
392 AlSupportAssembly->AddNode(AlGoniometer,1, AlGoniometerTubeCombiTrans);
393 AlSupportAssembly->AddNode(AlFrontAngle,1);
394 AlSupportAssembly->AddNode(AlBackAngle,1);
395 AlSupportAssembly->AddNode(AlPlate,1);
400 if (!GlueStackOnly && !ElectronicsStackOnly ) PassivesTop->AddNode(AlSupportAssembly,1,
new TGeoTranslation (-4.6,0,0));
404 TGeoBBox *PlasticBlockBox =
new TGeoBBox(
"PlasticBlockBox",5,6,10);
405 TGeoVolume *PlasticBlock =
new TGeoVolume (
"PlasticBlock", PlasticBlockBox,acrylicGlass);
406 TGeoVolume *PlasticBlock2 =
new TGeoVolume (
"PlasticBlock2", PlasticBlockBox,acrylicGlass);
408 PlasticBlock->SetFillColor(kBlue+4);
409 PlasticBlock->SetLineColor(kBlue+4);
410 PlasticBlock2->SetFillColor(kBlue+4);
411 PlasticBlock2->SetLineColor(kBlue+4);
414 PlasticBlock1Trans->RegisterYourself();
416 PlasticBlock2Trans->RegisterYourself();
417 if (!GlueStackOnly && !ElectronicsStackOnly ) PassivesTop->AddNode (PlasticBlock,0,PlasticBlock1Trans);
418 if (!GlueStackOnly && !ElectronicsStackOnly ) PassivesTop->AddNode (PlasticBlock2,0,PlasticBlock2Trans);
424 TGeoVolume *NeutronDetectorAssembly =
new TGeoVolumeAssembly(
"NeutronDetectorAssembly");
426 TGeoTube *KermitTube=
new TGeoTube(
"KermitTube",0,23.5/2,26.4/2);
427 TGeoVolume *KermitVolume =
new TGeoVolume(
"KermitCrystal",KermitTube,pe_bor5);
428 KermitVolume->SetFillColor(kWhite);
429 TGeoCombiTrans *KermitCombiTrans =
new TGeoCombiTrans (
"KermitHeadCombiTrans",24.5+23.5/2+OffsetToAlPlate,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));
430 KermitCombiTrans->RegisterYourself();
431 NeutronDetectorAssembly ->AddNode(KermitVolume,1, KermitCombiTrans);
434 TGeoSphere *NeutronBallSphere =
new TGeoSphere(
"NeutronBallSphere",0,32/2,0,180,0,360);
435 TGeoVolume *NeutronBall =
new TGeoVolume (
"NeutronBallCrystal", NeutronBallSphere,pe_bor5);
436 NeutronBall->SetFillColor(kBlack);
437 TGeoCombiTrans *NeutronBallCombiTrans =
new TGeoCombiTrans (
"NeutronBallHeadCombiTrans",20+OffsetToAlPlate,21.5+32/2,-54,
new TGeoRotation(
"",0,0,0));
438 NeutronBallCombiTrans->RegisterYourself();
439 NeutronDetectorAssembly ->AddNode(NeutronBall,1, NeutronBallCombiTrans);
441 if (!GlueStackOnly && !ElectronicsStackOnly ) ActivesTop->AddNode(NeutronDetectorAssembly,1,
new TGeoTranslation (-4.6,0,0));
446 Int_t CrystalNumber = 1;
447 if (!GlueStackOnly && !ElectronicsStackOnly ) SingleCluster ->
PlaceCluster(ActivesTop, 0,15, 0,60,0,&CrystalNumber);
450 TGeoVolume* Piezo = geom->MakeBox(
"CrystalPiezo1",acrylicGlass,0.75,0.25,0.2);
451 TGeoVolume* Piezo2 = geom->MakeBox(
"CrystalPiezo2",acrylicGlass,0.75,0.25,0.2);
452 Piezo->SetLineColor(kBlue);
453 Piezo->SetFillColor(kBlue);
454 if (!GlueStackOnly && !ElectronicsStackOnly ) ActivesTop->AddNode(Piezo,0,
new TGeoCombiTrans(-1,0,5.2,
new TGeoRotation(
"",90,0,0)));
455 Piezo2->SetLineColor(kBlue);
456 Piezo2->SetFillColor(kBlue);
457 if (!GlueStackOnly && !ElectronicsStackOnly ) ActivesTop->AddNode(Piezo2,0,
new TGeoCombiTrans(1,0,5.2,
new TGeoRotation(
"",90,0,0)));
462 TGeoVolume *GlueStackAssemblyActive =
new TGeoVolumeAssembly(
"GlueStackAssemblyActive");
463 TGeoVolume *GlueStackAssemblyPassive =
new TGeoVolumeAssembly(
"GlueStackAssemblyPassive");
466 GlueStackAssemblyPassive->AddNode(GlueStackFrame,1);
468 TGeoVolume *GlueSamplesActive[23];
469 TGeoVolume *GlueSamplesPassive[23];
472 for (
int i= 0;
i < 23;
i++)
477 GlueStackAssemblyActive->AddNode(GlueSamplesActive[
i],i,
new TGeoCombiTrans (0,0,-(0.4 + i*(0.203)),
new TGeoRotation(
"",i*90,0,0)));
478 GlueStackAssemblyPassive->AddNode(GlueSamplesPassive[i],i,
new TGeoCombiTrans (0,0,-(0.4 + i*(0.203)),
new TGeoRotation(
"",i*90,0,0)));
480 if ( !ElectronicsStackOnly ) ActivesTop->AddNode(GlueStackAssemblyActive,1,
new TGeoCombiTrans (0,0,100,
new TGeoRotation(
"",0,180,0)));
481 if ( !ElectronicsStackOnly ) PassivesTop->AddNode(GlueStackAssemblyPassive,1,
new TGeoCombiTrans (0,0,100,
new TGeoRotation(
"",0,180,0)));
483 if (AddActives) top->AddNode(ActivesTop,0);
484 if (AddPassives) top->AddNode(PassivesTop,0);
486 geom->CheckOverlaps();
487 geom->CloseGeometry();
488 cout <<
"# of Nodes: " << PassivesTop->CountNodes(10,1) << endl;
493 TString outfileWithoutPath =
"hypGeGeoCOSY2014setupPassives.root";
495 outfile += outfileWithoutPath;
497 cout << outfile << endl;
498 PassivesTop->PrintNodes();
501 TFile*
fi =
new TFile(outfile,
"RECREATE");
502 TGeoVolume *PassivesTopWrap =
new TGeoVolumeAssembly(
"PassivesTopWrap");
503 PassivesTopWrap->AddNode(PassivesTop,0);
504 PassivesTopWrap->Write();
506 cout <<
"Wrote passives geometry to file: " << outfileWithoutPath << endl;
509 outfileWithoutPath =
"hypGeGeoCOSY2014setupActives.root";
510 outfile=
"../../../../geometry/";
511 outfile += outfileWithoutPath;
513 cout << outfile << endl;
514 fi->Open(outfile,
"RECREATE");
516 TGeoVolume *ActivesTopWrap =
new TGeoVolumeAssembly(
"ActivesTopWrap");
517 ActivesTopWrap->AddNode(ActivesTop,0);
518 ActivesTopWrap->Write();
529 return outfileWithoutPath;
TGeoVolume * makeMaytecFrame(TGeoMedium *Med_ext)
TGeoManager * gGeoManager
FairGeoBuilder * geobuild
TGeoVolume * makeGlueStackFrame(TGeoMedium *Al_ext, TGeoMedium *Steel_ext)
TGeoVolume * makeGlueSample(TGeoMedium *Al_ext, TGeoMedium *Glue_ext, Int_t SampleNumber, Bool_t PassivePart, Bool_t ActivePart)
void PlaceCluster(TGeoVolume *top, TGeoMatrix *ClusterPlaceAndDirectionTranslation, Int_t *CrystalNumber)
FairGeoInterface * geoFace