// ******** Implementation of class to build HypGe Triple Cluster Geometry ************* // by steinen@kph.uni-mainz.de #include "PndGeoHypGeTripleCluster.h" //#include "PndGeoHypGeCrystal.h" #include using namespace std; ClassImp(PndGeoHypGeTripleCluster) // ----- Default constructor ------------------------------------------- PndGeoHypGeTripleCluster::PndGeoHypGeTripleCluster() { // Constructor } PndGeoHypGeTripleCluster::PndGeoHypGeTripleCluster(TGeoMedium *ExtGe, TGeoMedium *ExtAl,Int_t ExtClusterNumber) { MakeTop = true; Ge = ExtGe; Al = ExtAl; ClusterNumber= ExtClusterNumber; StartClusterNumber = ExtClusterNumber; NumberOfCryostatEdges =12; NumberOfDifferentZValues = 4; NumberOfXYInput = (NumberOfDifferentZValues*2-1)*2; NumberOfFrontArb8 = 5; NumberOfTopArb8 = NumberOfFrontArb8; //read coordinates from file char* InputTitleBuffer; ZValuesInputArray = new Double_t[NumberOfDifferentZValues]; CoordinatesInputArray = new Double_t[NumberOfCryostatEdges*NumberOfXYInput]; string Filename = getenv("VMCWORKDIR"); Filename +="/hypGe/geometry/PndGeoHypGeTripleClusterParfile.txt"; ParametersInputFile.open(Filename.data()); FillZValues(NumberOfDifferentZValues); FillInputArray(NumberOfCryostatEdges,NumberOfXYInput); ParametersInputFile.close(); CryostatFrontThickness= ZValuesInputArray[1]-ZValuesInputArray[0]; CryostatLowerArb8Heigt = ZValuesInputArray[2]-ZValuesInputArray[1]; CryostatMiddleArb8Heigt= ZValuesInputArray[3]-ZValuesInputArray[2]; //CryostatUpperArb8Heigt= ZValuesInputArray[4]-ZValuesInputArray[3]; CryostatTopThickness=0.5; } // ------- destructor -------------- PndGeoHypGeTripleCluster::~PndGeoHypGeTripleCluster() { cout << "Destrucor called" << endl; delete Crystal1; delete Crystal2; delete Crystal3; delete Crystal1Rotation; delete Crystal2Rotation; delete Crystal3Rotation; }; // --------------- build the crystals -------------------------- void PndGeoHypGeTripleCluster::BuildCrystals(Int_t *CrystalNumber) { //create 3 crystal objects. 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 9: 409 ; cluster 11, crystal 32: 1132 Crystal1Number = *CrystalNumber; *CrystalNumber+=1; Crystal2Number = *CrystalNumber; *CrystalNumber+=1; Crystal3Number = *CrystalNumber; *CrystalNumber+=1; Crystal1 = new PndGeoHypGeCrystal(Ge,Al,100*ClusterNumber+Crystal1Number); Crystal2 = new PndGeoHypGeCrystal(Ge,Al,100*ClusterNumber+Crystal2Number); Crystal3 = new PndGeoHypGeCrystal(Ge,Al,100*ClusterNumber+Crystal3Number); //set positions of the 3 crystals TripleCrystalXOffset = 3.5441; TripleCrystalYOffset = 3.0694; TripleCrystalZOffset = 0.7343; Crystal1Rotation = new TGeoRotation("Crystal1Rotation", -90,4.62,90); //angles measured in CAD drawing Crystal1Rotation ->RegisterYourself(); Crystal2Rotation = new TGeoRotation("Crystal2Rotation", 30,4.62,-30); Crystal2Rotation ->RegisterYourself(); Crystal3Rotation = new TGeoRotation("Crystal2Rotation", 150,+4.62,-30); Crystal3Rotation ->RegisterYourself(); Crystal1Position = new TGeoCombiTrans(TripleCrystalXOffset,0,-TripleCrystalZOffset,Crystal1Rotation); Crystal1Position->RegisterYourself(); Crystal2Position = new TGeoCombiTrans(-TripleCrystalXOffset/2,TripleCrystalYOffset,-TripleCrystalZOffset,Crystal2Rotation); Crystal2Position->RegisterYourself(); Crystal3Position = new TGeoCombiTrans(-TripleCrystalXOffset/2,-TripleCrystalYOffset,-TripleCrystalZOffset,Crystal3Rotation); Crystal3Position->RegisterYourself(); Crystal1->PlaceCrystal(ClusterAssembly,Crystal1Position); Crystal2->PlaceCrystal(ClusterAssembly,Crystal2Position); Crystal3->PlaceCrystal(ClusterAssembly,Crystal3Position); } // --------------- build the cryostat -------------------------- void PndGeoHypGeTripleCluster::BuildCryostat() { // the cryostat is a combination front, side and top parts. The front and the top is build of 5 TGeoArb8. The side parts are split into 12 lower and 12 middle. All are TGeoArb8. This parts are all combined to a TGeoCompositeShape string CompositeShapeExpression; //the front of the cryostat CryostatFrontArb8XY_1 = new Double_t[16]; BuildTArb8FrontArray(CryostatFrontArb8XY_1, 2,3,4,1, NumberOfXYInput); CryostatFrontArb8XY_2 = new Double_t[16]; BuildTArb8FrontArray(CryostatFrontArb8XY_2, 5,6,7,4, NumberOfXYInput); CryostatFrontArb8XY_3 = new Double_t[16]; BuildTArb8FrontArray(CryostatFrontArb8XY_3, 4,7,8,1, NumberOfXYInput); CryostatFrontArb8XY_4 = new Double_t[16]; BuildTArb8FrontArray(CryostatFrontArb8XY_4, 8,9,12,1, NumberOfXYInput); CryostatFrontArb8XY_5 = new Double_t[16]; BuildTArb8FrontArray(CryostatFrontArb8XY_5, 9,10,11,12, NumberOfXYInput); CryostatFrontArb8_1 = new TGeoArb8 ("CryostatTripleFrontArb8_1",CryostatFrontThickness/2,CryostatFrontArb8XY_1); CryostatFrontArb8_2 = new TGeoArb8 ("CryostatTripleFrontArb8_2",CryostatFrontThickness/2,CryostatFrontArb8XY_2); CryostatFrontArb8_3 = new TGeoArb8 ("CryostatTripleFrontArb8_3",CryostatFrontThickness/2,CryostatFrontArb8XY_3); CryostatFrontArb8_4 = new TGeoArb8 ("CryostatTripleFrontArb8_4",CryostatFrontThickness/2,CryostatFrontArb8XY_4); CryostatFrontArb8_5 = new TGeoArb8 ("CryostatTripleFrontArb8_5",CryostatFrontThickness/2,CryostatFrontArb8XY_5); CryostatFrontTranslation = new TGeoTranslation("CryostatTripleFrontTranslation",0,0,CryostatFrontThickness/2); CryostatFrontTranslation->RegisterYourself(); for (Int_t i = 1; i < NumberOfFrontArb8+1; i++) { char buffer[100]; sprintf(buffer, "CryostatTripleFrontArb8_%d : CryostatTripleFrontTranslation",i); CompositeShapeExpression += buffer; //if (iRegisterYourself(); for (Int_t i = 1; i < NumberOfCryostatEdges+1; i++) { char buffer[100]; sprintf(buffer, "CryostatTripleLowerArb8_%d : CryostatTripleLowerTranslation",i); CompositeShapeExpression += buffer; //if (iRegisterYourself(); for (Int_t i = 1; i < NumberOfCryostatEdges+1; i++) { char buffer[100]; sprintf(buffer, "CryostatTripleMiddleArb8_%d : CryostatTripleMiddleTranslation",i); CompositeShapeExpression += buffer; if (i< NumberOfCryostatEdges) { CompositeShapeExpression += "+"; } if (i==NumberOfCryostatEdges && MakeTop ) { CompositeShapeExpression += "+"; } } //the top of the cryostat CryostatTopArb8XY_1 = new Double_t[16]; BuildTArb8TopArray(CryostatTopArb8XY_1, 2,3,4,1, NumberOfDifferentZValues-1, NumberOfXYInput); CryostatTopArb8XY_2 = new Double_t[16]; BuildTArb8TopArray(CryostatTopArb8XY_2, 5,6,7,4, NumberOfDifferentZValues-1, NumberOfXYInput); CryostatTopArb8XY_3 = new Double_t[16]; BuildTArb8TopArray(CryostatTopArb8XY_3, 4,7,8,1, NumberOfDifferentZValues-1, NumberOfXYInput); CryostatTopArb8XY_4 = new Double_t[16]; BuildTArb8TopArray(CryostatTopArb8XY_4, 8,9,12,1, NumberOfDifferentZValues-1, NumberOfXYInput); CryostatTopArb8XY_5 = new Double_t[16]; BuildTArb8TopArray(CryostatTopArb8XY_5, 9,10,11,12, NumberOfDifferentZValues-1, NumberOfXYInput); CryostatTopArb8_1 = new TGeoArb8 ("CryostatTripleTopArb8_1",CryostatTopThickness/2,CryostatTopArb8XY_1); CryostatTopArb8_2 = new TGeoArb8 ("CryostatTripleTopArb8_2",CryostatTopThickness/2,CryostatTopArb8XY_2); CryostatTopArb8_3 = new TGeoArb8 ("CryostatTripleTopArb8_3",CryostatTopThickness/2,CryostatTopArb8XY_3); CryostatTopArb8_4 = new TGeoArb8 ("CryostatTripleTopArb8_4",CryostatTopThickness/2,CryostatTopArb8XY_4); CryostatTopArb8_5 = new TGeoArb8 ("CryostatTripleTopArb8_5",CryostatTopThickness/2,CryostatTopArb8XY_5); CryostatTopTranslation = new TGeoTranslation("CryostatTripleTopTranslation",0,0,CryostatFrontThickness +CryostatLowerArb8Heigt+CryostatMiddleArb8Heigt+CryostatUpperArb8Heigt+CryostatTopThickness/2); CryostatTopTranslation->RegisterYourself(); if (MakeTop) { for (Int_t i = 1; i < NumberOfTopArb8+1; i++) { char buffer[100]; sprintf(buffer, "CryostatTripleTopArb8_%d : CryostatTripleTopTranslation",i); CompositeShapeExpression += buffer; if (iSetLineColor(kGreen); Cryostat->SetFillColor(kGreen); //bring the Cryostat in the right position CryostatCombiTrans = new TGeoCombiTrans("CryostatCombiTrans",0,0,0,new TGeoRotation("CryostatRotation",0,180,0)); CryostatCombiTrans->RegisterYourself(); ClusterAssembly->AddNode(Cryostat,ClusterNumber,CryostatCombiTrans); }; // --------------- Prints the nodes of a cluster ----------------- void PndGeoHypGeTripleCluster::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(); cout <GetNdaughters() << endl; Crystal3->PrintNodes(); } }