From 152766595fe51c6168ebbac33caec6614551143c Mon Sep 17 00:00:00 2001
From: matthiasholl <mholl@chalmers.se>
Date: Thu, 19 Sep 2024 18:06:11 +0200
Subject: [PATCH 1/2] Added model of CCB test setup.

---
 geobuilder.cxx        |  8 +++++-
 include/components.hh |  1 +
 include/krakow.hh     | 66 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 include/krakow.hh

diff --git a/geobuilder.cxx b/geobuilder.cxx
index 39f93bd..c67eb66 100755
--- a/geobuilder.cxx
+++ b/geobuilder.cxx
@@ -32,6 +32,7 @@ int main(int argc, char **argv)
 	bool mdc=false;
 	bool hibeam=false;
 	bool sterile=false;
+	bool krakow=false;
 	bool yoke=false;
 	bool viewer=false;
 	
@@ -74,6 +75,10 @@ int main(int argc, char **argv)
 				sterile=true;
 				std::cout << "HIBEAM sterile neutron setup selected." << std::endl;
 			}
+			else if(strncmp(argv[i],"--krakow",8)==0){
+				krakow=true;
+				std::cout << "Krakow test setup selected." << std::endl;
+			}
 			else if(strncmp(argv[i],"--save_as=",10)==0){
 				outname = argv[i]+10;
 			}
@@ -109,7 +114,7 @@ int main(int argc, char **argv)
 	std::map<std::string,TGeoMedium*> matList=material_list();
 
 	TGeoVolume* MOTHER = gGeoManager->MakeTube("MOTHER", matList["Vacuum"], 0, 250, 600);
-	if (!(hibeam || sterile)) build_pipes(MOTHER, matList);
+	if (!(hibeam || sterile || krakow)) build_pipes(MOTHER, matList);
 
 	TGeoVolume* Inner = nullptr;
 	if(inner_det==true){
@@ -128,6 +133,7 @@ int main(int argc, char **argv)
 		yoke=true;
 		build_sterile(MOTHER, matList);
 	}
+	if(krakow==true) build_krakow(MOTHER, matList);
 	if(solenoid==true) build_solenoid(MOTHER, matList);
 	if(psr==true) build_plastic_rings(MOTHER, matList);
 	if(barrel==true) build_sec_barrel(MOTHER, matList);
diff --git a/include/components.hh b/include/components.hh
index 11ff428..34762d4 100644
--- a/include/components.hh
+++ b/include/components.hh
@@ -8,3 +8,4 @@
 #include "solenoid.hh"
 #include "hibeam.hh"
 #include "sterile.hh"
+#include "krakow.hh"
diff --git a/include/krakow.hh b/include/krakow.hh
new file mode 100644
index 0000000..9ad2fa2
--- /dev/null
+++ b/include/krakow.hh
@@ -0,0 +1,66 @@
+#include "TGeoManager.h"
+#include "TGeoPcon.h"
+#include "TGeoVolume.h"
+#include "TGeoMedium.h"
+#include "TGeoTube.h"
+#include "TGeoCompositeShape.h"
+#include <map>
+
+void build_krakow(TGeoVolume* MOTHER, std::map<std::string,TGeoMedium*> matList)
+{
+	const Double_t d2r = M_PI/180.;
+	std::cout << "Building Krakow test experiment components." << std::endl;
+	// Vacuum pipe
+	TGeoVolume* PIPE = gGeoManager->MakeTube("PIPE", matList["Al"], 4.5, 5.0, 24.99); // 5 mm thick Al pipe
+	TGeoVolume* Window = gGeoManager->MakeTube("Window", matList["Mylar"], 0., 5.0, 0.01); // Mylar window
+	PIPE->SetLineColor(kBlue-10);
+	Window->SetLineColor(kBlue-9);
+	
+	MOTHER->AddNode(PIPE, 1, new TGeoTranslation(0, 0, -30));
+	MOTHER->AddNode(Window, 1, new TGeoTranslation(0, 0, -5));
+
+	// Target foil, 100 um carbon foil
+	TGeoVolume* TARGET = gGeoManager->MakeTube("TARGET", matList["C"], 0, 2.93, 0.23/2.); 
+    MOTHER->AddNode(TARGET, 1, new TGeoTranslation(0, 0, 0));
+    TARGET->SetLineColor(kGreen+4);
+  	
+	// Scintillator bar paramteres
+	Double_t bar_l = 50;
+	Double_t bar_w = 5;
+	Double_t bar_t = 2;
+
+	Int_t num_bars1=7;
+	Int_t num_bars2=3;
+
+	Double_t distance = 100.;
+	Double_t dist1 = distance + num_bars1*bar_t/2.;
+	Double_t dist2 = distance + num_bars2*bar_t/2.;
+	Double_t distTPC = distance - 5.;
+	Double_t ang1 = 33.5;
+	Double_t ang2 = -71.5;
+    
+	TGeoVolume* Sci_stack1 = gGeoManager->MakeBox("Sci_stack1", matList["Vacuum"],bar_l/2., bar_w/2., num_bars1*bar_t/2.); 
+	TGeoVolume* Sci_stack2 = gGeoManager->MakeBox("Sci_stack2", matList["Vacuum"],bar_l/2., bar_w/2., num_bars2*bar_t/2.); 
+
+    TGeoVolume* Sci_bar = gGeoManager->MakeBox("Sci_bar", matList["PSci"],bar_l/2., bar_w/2., bar_t/2.); 
+	Sci_bar->SetLineColor(kYellow+1);
+	for(int i=0; i<num_bars1; i++){
+		Double_t bar_posz = (i+0.5)*bar_t;
+		Sci_stack1->AddNode(Sci_bar, i, new TGeoTranslation(0.,0.,bar_posz));
+	}
+	for(int i=0; i<num_bars2; i++){
+		Double_t bar_posz = (i+0.5)*bar_t;
+		Sci_stack2->AddNode(Sci_bar, i, new TGeoTranslation(0.,0.,bar_posz));
+	}
+	TGeoRotation* rot_stack1 = new TGeoRotation("rot_stack1",90,ang1,-90);
+	TGeoRotation* rot_stack2 = new TGeoRotation("rot_stack2",90,ang2,-90);
+	MOTHER->AddNode(Sci_stack1, 1, new TGeoCombiTrans(dist1*sin(ang1*d2r),0,dist1*cos(ang1*d2r),rot_stack1));
+	MOTHER->AddNode(Sci_stack2, 1, new TGeoCombiTrans(dist2*sin(ang2*d2r),0,dist2*cos(ang2*d2r),rot_stack2));
+	
+    // TPC with 80% Ar/20% CO2 (walls assumed thin)
+    TGeoVolume* TPC = gGeoManager->MakeBox("TPC", matList["Ar80CO2"], 15., 5., 5.); 
+    MOTHER->AddNode(TPC, 1, new TGeoCombiTrans(distTPC*sin(ang2*d2r),0,distTPC*cos(ang2*d2r),rot_stack2));
+
+	std::cout << "Done." << std::endl;
+
+}
-- 
GitLab


From 077f65b765bf520275a355727623d9691969f9da Mon Sep 17 00:00:00 2001
From: matthiasholl <mholl@chalmers.se>
Date: Thu, 10 Oct 2024 16:34:23 +0200
Subject: [PATCH 2/2] Added CD2 material. Fixed Sci_bar placement.

---
 include/krakow.hh    | 15 +++++++++------
 include/materials.hh |  7 +++++++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/include/krakow.hh b/include/krakow.hh
index 9ad2fa2..2f8c50b 100644
--- a/include/krakow.hh
+++ b/include/krakow.hh
@@ -20,7 +20,7 @@ void build_krakow(TGeoVolume* MOTHER, std::map<std::string,TGeoMedium*> matList)
 	MOTHER->AddNode(Window, 1, new TGeoTranslation(0, 0, -5));
 
 	// Target foil, 100 um carbon foil
-	TGeoVolume* TARGET = gGeoManager->MakeTube("TARGET", matList["C"], 0, 2.93, 0.23/2.); 
+	TGeoVolume* TARGET = gGeoManager->MakeTube("TARGET", matList["CD2"], 0, 2.93, 0.23/2.); 
     MOTHER->AddNode(TARGET, 1, new TGeoTranslation(0, 0, 0));
     TARGET->SetLineColor(kGreen+4);
   	
@@ -31,6 +31,9 @@ void build_krakow(TGeoVolume* MOTHER, std::map<std::string,TGeoMedium*> matList)
 
 	Int_t num_bars1=7;
 	Int_t num_bars2=3;
+	
+	Double_t stack_t1 = num_bars1*bar_t/2.;
+	Double_t stack_t2 = num_bars2*bar_t/2.;
 
 	Double_t distance = 100.;
 	Double_t dist1 = distance + num_bars1*bar_t/2.;
@@ -39,23 +42,23 @@ void build_krakow(TGeoVolume* MOTHER, std::map<std::string,TGeoMedium*> matList)
 	Double_t ang1 = 33.5;
 	Double_t ang2 = -71.5;
     
-	TGeoVolume* Sci_stack1 = gGeoManager->MakeBox("Sci_stack1", matList["Vacuum"],bar_l/2., bar_w/2., num_bars1*bar_t/2.); 
-	TGeoVolume* Sci_stack2 = gGeoManager->MakeBox("Sci_stack2", matList["Vacuum"],bar_l/2., bar_w/2., num_bars2*bar_t/2.); 
+	TGeoVolume* Sci_stack1 = gGeoManager->MakeBox("Sci_stack1", matList["Vacuum"],bar_l/2., bar_w/2., stack_t1); 
+	TGeoVolume* Sci_stack2 = gGeoManager->MakeBox("Sci_stack2", matList["Vacuum"],bar_l/2., bar_w/2., stack_t2); 
 
     TGeoVolume* Sci_bar = gGeoManager->MakeBox("Sci_bar", matList["PSci"],bar_l/2., bar_w/2., bar_t/2.); 
 	Sci_bar->SetLineColor(kYellow+1);
 	for(int i=0; i<num_bars1; i++){
-		Double_t bar_posz = (i+0.5)*bar_t;
+		Double_t bar_posz = (i+0.5)*bar_t-stack_t1;
 		Sci_stack1->AddNode(Sci_bar, i, new TGeoTranslation(0.,0.,bar_posz));
 	}
 	for(int i=0; i<num_bars2; i++){
-		Double_t bar_posz = (i+0.5)*bar_t;
+		Double_t bar_posz = (i+0.5)*bar_t-stack_t2;
 		Sci_stack2->AddNode(Sci_bar, i, new TGeoTranslation(0.,0.,bar_posz));
 	}
 	TGeoRotation* rot_stack1 = new TGeoRotation("rot_stack1",90,ang1,-90);
 	TGeoRotation* rot_stack2 = new TGeoRotation("rot_stack2",90,ang2,-90);
 	MOTHER->AddNode(Sci_stack1, 1, new TGeoCombiTrans(dist1*sin(ang1*d2r),0,dist1*cos(ang1*d2r),rot_stack1));
-	MOTHER->AddNode(Sci_stack2, 1, new TGeoCombiTrans(dist2*sin(ang2*d2r),0,dist2*cos(ang2*d2r),rot_stack2));
+	MOTHER->AddNode(Sci_stack2, 2, new TGeoCombiTrans(dist2*sin(ang2*d2r),0,dist2*cos(ang2*d2r),rot_stack2));
 	
     // TPC with 80% Ar/20% CO2 (walls assumed thin)
     TGeoVolume* TPC = gGeoManager->MakeBox("TPC", matList["Ar80CO2"], 15., 5., 5.); 
diff --git a/include/materials.hh b/include/materials.hh
index a430964..80d8736 100644
--- a/include/materials.hh
+++ b/include/materials.hh
@@ -165,6 +165,13 @@ std::map<std::string,TGeoMedium*> material_list()
 	TGeoMedium*	medB4C  = new TGeoMedium("B4C", 115 , matB4C);
 	mat["B4C"] = medB4C;
 
+	TGeoMixture* matCD2 = new TGeoMixture("CD2", 2, 1.01);
+	matCD2->SetIndex(116);
+	matCD2->DefineElement(0, 12.01, 6, 0.7492);
+	matCD2->DefineElement(1, 2.01, 1, 0.2508);
+	TGeoMedium*	medCD2  = new TGeoMedium("CD2", 116 , matCD2);
+	mat["CD2"] = medCD2;
+
 	std::cout << "--------------------------" << std::endl;
 	std::cout << "List of included materials" << std::endl;
 	std::cout << "--------------------------" << std::endl;
-- 
GitLab