// ******** Implementation of class to build HypGe Double Cluster Geometry ************* // by steinen@kph.uni-mainz.de #include "PndGeoHypGeDoubleCluster.h" #include "PndGeoHypGeCrystal.h" #include ClassImp(PndGeoHypGeDoubleCluster) using namespace std; //double Pi = TMath::Pi(); // ----- Default constructor ------------------------------------------- PndGeoHypGeDoubleCluster::PndGeoHypGeDoubleCluster() { // Constructor } // ----- constructor to use ------------------------------------------- PndGeoHypGeDoubleCluster::PndGeoHypGeDoubleCluster(TGeoMedium *ExtGe, TGeoMedium *ExtAl,Int_t ExtClusterNumber) { Ge = ExtGe; Al = ExtAl; ClusterNumber= ExtClusterNumber; StartClusterNumber = ExtClusterNumber; //ClusterAssembly = new TGeoVolumeAssembly("ClusterAssembly"); } // ------- destructor -------------- PndGeoHypGeDoubleCluster::~PndGeoHypGeDoubleCluster() { cout << "Destrucor called" << endl; }; // --------------- build the crystals --------------------------- void PndGeoHypGeDoubleCluster::BuildCrystals(Int_t *CrystalNumber) { //create 2 crystals. The copy number of a crystal is composed of the number of the cluster and a running number for every placed crystal like e.g.: cluster 4, crystal 7: 407 ; cluster 11, crystal 21: 1121 Crystal1Number = *CrystalNumber; *CrystalNumber+=1; Crystal2Number = *CrystalNumber; *CrystalNumber+=1; cout << "Cluster:" << ClusterNumber << "\tCrystal1Number: "<< Crystal1Number<RegisterYourself(); Crystal2Rotation = new TGeoRotation("Crystal2Rotation", 0,4,0); Crystal2Rotation ->RegisterYourself(); //maybe some signs needs adaption Crystal1Position = new TGeoCombiTrans(0,-DoubleYOffset,-(0.45+0.2843),Crystal1Rotation); Crystal1Position->RegisterYourself(); Crystal2Position = new TGeoCombiTrans(0,+DoubleYOffset,-(0.45+0.2843),Crystal2Rotation); Crystal2Position->RegisterYourself(); Crystal1->PlaceCrystal(ClusterAssembly,Crystal1Position); Crystal2->PlaceCrystal(ClusterAssembly,Crystal2Position); }; // --------------- build the cryostat -------------------------- void PndGeoHypGeDoubleCluster::BuildCryostat() { // the cryostat is a combination of 18 TArb8 + 1 TGeoXtru. The coordinates are taken from CAD drawings. The lower part is build by CryostatOuter... - CryostatInner ... . The upper part is build of 10 single TArb8. The top is 1 TGeoXtru CryostatHeight = 12.95; CryostatFrontThickness = 0.15; CryostatUpperPartHeight = 5; // lets start with the outer part //Tarb8 needs one array of coordinates: {x1,y1 , x2,y2 , ... , x8,y8} CryostatOuterArb8XY_1 = new Double_t[16] { -2.0065,6.5042 , 2.0065,6.5042 , -2.2317,0 , -3.9982,3.0203 , -3.0594,8.2379 , 3.0594,8.3279 , -3.2774,0 , -5.5748,3.9280 }; CryostatOuterArb8XY_2 = new Double_t[16] { -2.2317,0 , 2.0065,-6.5042 , -2.0065,-6.5042 , -3.9982,-3.0203 , -3.2774,0 , 3.0594,-8.3279, -3.0594,-8.3279 , -5.5748,-3.9280 }; CryostatOuterArb8XY_3 = new Double_t[16] { 2.0065,-6.5042 , -2.2317,0 , 2.2317,0 , 3.9982,-3.0203 , 3.0594,-8.3279 , -3.2774,0 , 3.2774,0 , 5.5748,-3.9580 }; CryostatOuterArb8XY_4 = new Double_t[16] { 2.2317,0 , -2.2317,0 , 2.0065,6.5042 , 3.9982,3.0203 , 3.2774,0 , -3.2774,0, 3.0594,8.3279 , 5.5748,3.9250}; CryostatOuterArb8_1 = new TGeoArb8 ("CryostatDoubleOuterArb8_1",CryostatHeight/2,CryostatOuterArb8XY_1) ; CryostatOuterArb8_2= new TGeoArb8 ("CryostatDoubleOuterArb8_2",CryostatHeight/2,CryostatOuterArb8XY_2) ; CryostatOuterArb8_3= new TGeoArb8 ("CryostatDoubleOuterArb8_3",CryostatHeight/2,CryostatOuterArb8XY_3) ; CryostatOuterArb8_4= new TGeoArb8 ("CryostatDoubleOuterArb8_4",CryostatHeight/2,CryostatOuterArb8XY_4) ; // now the inner part CryostatInnerArb8XY_1 = new Double_t[16] { -1.9198,6.3539 , 1.9198,6.3539 , -2.0581,0 , -3.8251,3.0212 , -2.9726,8.1776 , 2.9726,8.1776 , -3.1037,0 , -5.4016,3.9289 }; CryostatInnerArb8XY_2 = new Double_t[16] { -2.0581,0 , 1.9198,-6.3539 , -1.9198,-6.3539 , -3.8251,-3.0212 , -3.1037,0 , 2.9726,-8.1776 , -2.9726,-8.1776 , -5.4016,-3.9289 }; CryostatInnerArb8XY_3 = new Double_t[16] { 1.9198,-6.3539 , -2.0581,0 , 2.0581,0 , 3.8251,-3.0212 , 2.9726,-8.1776 , -3.1057,0, 3.1037,0 , 5.4016,-3.9289 }; CryostatInnerArb8XY_4 = new Double_t[16] { 2.0581,0, -2.0581,0 , 1.9198,6.3539 , 3.8251,3.0212 , 3.1037,0 , -3.1037,0 , 2.9726,8.1776 , 5.4016,3.9289 }; CryostatInnerArb8_1 = new TGeoArb8 ("CryostatDoubleInnerArb8_1",(CryostatHeight-CryostatFrontThickness)/2,CryostatInnerArb8XY_1) ; CryostatInnerArb8_2= new TGeoArb8 ("CryostatDoubleInnerArb8_2",(CryostatHeight-CryostatFrontThickness)/2,CryostatInnerArb8XY_2) ; CryostatInnerArb8_3= new TGeoArb8 ("CryostatDoubleInnerArb8_3",(CryostatHeight-CryostatFrontThickness)/2,CryostatInnerArb8XY_3) ; CryostatInnerArb8_4= new TGeoArb8 ("CryostatDoubleInnerArb8_4",(CryostatHeight-CryostatFrontThickness)/2,CryostatInnerArb8XY_4) ; //now the upper part CryostatUpperArb8XY_1 = new Double_t[16] { -3.0594,8.3279 , -2.9726,8.1776 , -5.4016,3.9289 , -5.5748,3.9280 , -3.2618,8.6784 , -2.9726,8.1776, -5.4016,3.9289 , -5.9787,3.9260 }; CryostatUpperArb8XY_2 = new Double_t[16] { -5.5748,3.9280 , -5.4016,3.9289 , -3.1037,0 , -3.2774,0 , -5.9787,3.9260 , -5.4016,3.9289 , -3.1037,0 , -3.6824,0 }; CryostatUpperArb8XY_3 = new Double_t[16] { -3.2774,0 , -3.1037,0, -5.4016,-3.9289 , -5.5748,-3.9280 , -3.6824,0 , -3.1037,0 , -5.4016,-3.9289 , -5.9787,-3.9260 }; CryostatUpperArb8XY_4 = new Double_t[16] { -5.5748,-3.9280 , -5.4016,-3.9289 , -2.9726,-8.1776 , -3.0594,-8.3279 , -5.9789,-3.9260 , -5.4016,-3.9289 , -2.9726,-8.1776 , -3.2618,-8.6784 }; CryostatUpperArb8XY_5 = new Double_t[16] { -3.0594,-8.3279 , -2.9726,-8.1776 , 2.9726,-8.1776 , 3.0594,-8.3279 , -3.2618,-8.6784 , -2.9726,-8.1776 , 2.9726,-8.1776 , 3.2618,-8.6784 }; CryostatUpperArb8XY_6 = new Double_t[16] { 5.5748,-3.9280 , 3.0594,-8.3279 , 2.9726,-8.1776 , 5.4016,-3.9289 , 5.9789,-3.9260 , 3.2618,-8.6784 , 2.9726,-8.1776 , 5.4016,-3.9289}; CryostatUpperArb8XY_7 = new Double_t[16] { 3.2774,0 , 5.5748,-3.9280 , 5.4016,-3.9289 , 3.1037,0 , 3.6824,0 , 5.9787,-3.9260 , 5.4016,-3.9289 , 3.1037,0}; CryostatUpperArb8XY_8 = new Double_t[16] { 5.5748,3.9280 , 3.2774,0 , 3.1037,0 , 5.4016,3.9289 , 5.9787,3.9260 , 3.6824,0 , 3.1037,0 , 5.4016,3.9289}; CryostatUpperArb8XY_9 = new Double_t[16] { 3.0594,8.3279 , 5.5748,3.9280 , 5.4016,3.9289 , 2.9726,8.1776 , 3.2618,8.6784 , 5.9787,3.9260 , 5.4016,3.9289 , 2.9726,8.1776}; CryostatUpperArb8XY_10 = new Double_t[16] { -3.0594,8.3279 , 3.0594,8.3279 , 2.9726,8.1776 , -2.9726,8.1776 , -3.2618,8.6784 , 3.2618,8.6784 , 2.9726,8.1776 , -2.9726,8.1776}; CryostatUpperArb8_1 = new TGeoArb8("CryostatDoubleUpperArb8_1",CryostatUpperPartHeight/2, CryostatUpperArb8XY_1); CryostatUpperArb8_2 = new TGeoArb8("CryostatDoubleUpperArb8_2",CryostatUpperPartHeight/2, CryostatUpperArb8XY_2); CryostatUpperArb8_3 = new TGeoArb8("CryostatDoubleUpperArb8_3",CryostatUpperPartHeight/2, CryostatUpperArb8XY_3); CryostatUpperArb8_4 = new TGeoArb8("CryostatDoubleUpperArb8_4",CryostatUpperPartHeight/2, CryostatUpperArb8XY_4); CryostatUpperArb8_5 = new TGeoArb8("CryostatDoubleUpperArb8_5",CryostatUpperPartHeight/2, CryostatUpperArb8XY_5); CryostatUpperArb8_6= new TGeoArb8("CryostatDoubleUpperArb8_6",CryostatUpperPartHeight/2, CryostatUpperArb8XY_6); CryostatUpperArb8_7 = new TGeoArb8("CryostatDoubleUpperArb8_7",CryostatUpperPartHeight/2, CryostatUpperArb8XY_7); CryostatUpperArb8_8 = new TGeoArb8("CryostatDoubleUpperArb8_8",CryostatUpperPartHeight/2, CryostatUpperArb8XY_8); CryostatUpperArb8_9 = new TGeoArb8("CryostatDoubleUpperArb8_9",CryostatUpperPartHeight/2, CryostatUpperArb8XY_9); CryostatUpperArb8_10 = new TGeoArb8("CryostatDoubleUpperArb8_10",CryostatUpperPartHeight/2, CryostatUpperArb8XY_10); //combine the cryostat CryostatInnerZTranslation = new TGeoTranslation("CryostatDoubleInnerZTranslation",0,0,CryostatFrontThickness); CryostatInnerZTranslation->RegisterYourself(); CryostatUpperPartsZTranslation = new TGeoTranslation("CryostatDoubleUpperPartsZTranslation",0,0,(CryostatHeight+CryostatUpperPartHeight)/2); CryostatUpperPartsZTranslation->RegisterYourself(); CryostatShape = new TGeoCompositeShape("CryostatShape", "(CryostatDoubleOuterArb8_1+CryostatDoubleOuterArb8_2+CryostatDoubleOuterArb8_3+CryostatDoubleOuterArb8_4)-(CryostatDoubleInnerArb8_1:CryostatDoubleInnerZTranslation+CryostatDoubleInnerArb8_2:CryostatDoubleInnerZTranslation+CryostatDoubleInnerArb8_3:CryostatDoubleInnerZTranslation+CryostatDoubleInnerArb8_4:CryostatDoubleInnerZTranslation)+(CryostatDoubleUpperArb8_1:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_2:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_3:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_4:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_5:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_6:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_7:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_8:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_9:CryostatDoubleUpperPartsZTranslation+CryostatDoubleUpperArb8_10:CryostatDoubleUpperPartsZTranslation)"); //(CryostatDoubleOuter) -(CryostatDoubleInner)+(CryostatDoubleUpperParts) Cryostat = new TGeoVolume("Cryostat",CryostatShape,Al); //bring the Cryostat in the right position CryostatCombiTrans = new TGeoCombiTrans("CryostatCombiTrans",0,0,-CryostatHeight/2,new TGeoRotation("CryostatRotation",0,180,0)); CryostatCombiTrans->RegisterYourself(); //finally: the top of the Cryostat //TGeoXTrun needs 2 separate arrays of coordinate values (!= TArb8) CryostatTopXCoordinates = new Double_t[10] {-3.2618,-5.9787,-3.6824,-5.9787,-3.2618,3.2618,5.9787,3.6824,5.9787,3.2618}; CryostatTopYCoordinates = new Double_t[10] {8.6784,3.9260,0,-3.9260,-8.6784,-8.6784,-3.9260,0,3.9260,8.6784}; CryostatTopThickness = 0.5; CryostatTopShape = new TGeoXtru(2); CryostatTopShape->DefinePolygon(10,CryostatTopXCoordinates,CryostatTopYCoordinates); CryostatTopShape->DefineSection(0,-(CryostatHeight+CryostatUpperPartHeight+CryostatTopThickness),0,0,1); CryostatTopShape->DefineSection(1,-(CryostatHeight+CryostatUpperPartHeight),0,0,1); CryostatTop = new TGeoVolume("CryostatTop",CryostatTopShape,Al); CryostatTopCombiTrans = new TGeoCombiTrans("CryostatCombiTrans",0,0,0,new TGeoRotation("CryostatRotation",0,0,0)); CryostatTopCombiTrans->RegisterYourself(); ClusterAssembly->AddNode(Cryostat,ClusterNumber,CryostatCombiTrans); ClusterAssembly->AddNode(CryostatTop,ClusterNumber,CryostatTopCombiTrans); }; // --------------- Prints the nodes of a cluster ----------------- void PndGeoHypGeDoubleCluster::PrintNodes(Int_t nLevels ) { if (nLevels == 0) { cout << "Nothing to Print, use higher number to go deeper in the tree." << endl; } if (nLevels > 0) { cout << "Printing the content of the cluster assembly." << endl; cout <GetNdaughters() << endl; ClusterAssembly->PrintNodes(); } if (nLevels > 1) { cout << "Printing the content of the crystal assemblies." << endl; cout <GetNdaughters() << endl; Crystal1->PrintNodes(); cout <GetNdaughters() << endl; Crystal2->PrintNodes(); } }