void getBeamVisuals(TGeoManager* geom, TGeoVolume* top, float minZ, float maxZ) { TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0); TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum); TGeoVolume *xyaxis = geom->MakeBox( "xyaxis", Vacuum, 90., 90., 40. ); TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); TGeoMedium *Al = new TGeoMedium("Root Material",1, matAl); //TGeoVolume *line = geom->MakeTube( "BeamLine", Al, 0, .3, (maxZ - minZ) / 2 + 5); TGeoVolume *xaxis = geom->MakeTube( "XAxis", Al, 0, .1, 30.); TGeoVolume *yaxis = geom->MakeTube( "YAxis", Al, 0, .1, 30.); //TGeoVolume *pipe = geom->MakeTube( "BeamPipe", Al, _piperadius-.05, _piperadius+.05, (maxZ - minZ) / 2 + 5); //line->SetLineColor(kRed); xaxis->SetLineColor(kBlue); yaxis->SetLineColor(kBlue); //pipe->SetLineColor(kBlack); xyaxis->AddNode(xaxis, 1, new TGeoRotation( "rtyz", 0, 90, 0)); xyaxis->AddNode(yaxis, 1, new TGeoRotation( "rtxz", 90, 90, 0)); TGeoCombiTrans * pipecenter = new TGeoCombiTrans( *new TGeoTranslation(_pipexcoord, _pipeycoord, 0), *new TGeoRotation()); //TGeoCombiTrans * linecenter = new TGeoCombiTrans( *new TGeoTranslation(_linexcoord, _lineycoord, 0), *new TGeoRotation()); //top->AddNode( pipe, 1, pipecenter); //top->AddNode( line, 1, linecenter); top->AddNode( xyaxis, 1, pipecenter); }
void Visualizer::Show(){ std::cout<<"=============================================="<<std::endl; std::cout<<"========= Inside Expected SHOW() ============="<<std::endl; std::cout<<"=============================================="<<std::endl; TGeoVolume *top = gGeoManager->MakeBox("Top", NULL, kInfinity, kInfinity, kInfinity); gGeoManager->SetTopVolume(top); for(int i = 0 ; i < fVolumes.size() ; i++){ top->AddNode(std::get<0>(fVolumes[i]), 1 , std::get<1>(fVolumes[i])); } top->SetLineColor(kGreen); gGeoManager->CloseGeometry(); #ifndef USE_OGL top->Draw(); #else top->Draw("ogl"); //to display the geometry using openGL #endif // //TPad::x3d("OPENGL"); gGeoManager->Export("plane.root"); //top->Export("planeTop.root"); //fApp->Run(); }
TGeoVolume* KVSpectroDetector::GetGeoVolume(const Char_t* name, const Char_t* material, const Char_t* shape_name, const Char_t* params){ // Construct a TGeoVolume shape which can be used to represent // a detector in the current geometry managed by gGeoManager. // If the argument material is empty, the name of the detector is used. // Input: name - name given to the volume. // material - material of the volume. The list of available // materials can be found with // det->GetRangeTable()->GetListOfMaterials()->ls() // where det is a KVSpectroDetector or another // object inheriting from KVMaterial. // shape_name - name of the shape associated to the volum // (Box, Arb8, Cone, Sphere, ...), given // by the short name of the shape used in // the methods XXX: // TGeoManger::MakeXXX(...) TGeoMedium *med = GetGeoMedium(material); if(!med) return NULL; TString method = Form("Make%s",shape_name); TString parameters = Form("%p,%p,%s",name,med,params); Info("GetGeoVolume","Trying to run the command gGeoManager->%s(%s)",method.Data(),parameters.Data()); gGeoManager->Execute(method.Data(),parameters.Data()); TGeoVolume* vol = (TGeoVolume*)gGeoManager->GetListOfVolumes()->Last(); if(vol) vol->SetLineColor(med->GetMaterial()->GetDefaultColor()); return vol; }
void set_volume_color_by_material(const char* material_re, Color_t color, Char_t transparency=-1) { // Note: material_re is a perl regexp! // If you want exact match, enclose in begin / end meta characters (^ / $): // set_volume_color_by_material("^materials:Silicon$", kRed); TPMERegexp re(material_re, "o"); TGeoMaterial *m; TIter it(gGeoManager->GetListOfMaterials()); while ((m = (TGeoMaterial*) it()) != 0) { if (re.Match(m->GetName())) { if (transparency != -1) { m->SetTransparency(transparency); } TGeoVolume *v; TIter it2(gGeoManager->GetListOfVolumes()); while ((v = (TGeoVolume*) it2()) != 0) { if (v->GetMaterial() == m) { v->SetLineColor(color); } } } } full_update(); }
void fw_simGeo_set_volume_color_by_material(const char* material_re, Bool_t use_names, Color_t color, Char_t transparency=-1) { // Note: material_re is a perl regexp! // If you want exact match, enclose in begin / end meta characters (^ / $): // set_volume_color_by_material("^materials:Silicon$", kRed); TPMERegexp re(material_re, "o"); TGeoMaterial *m; TIter it(FWGeometryTableViewManager_GetGeoManager()->GetListOfMaterials()); while ((m = (TGeoMaterial*) it()) != 0) { if (re.Match(use_names ? m->GetName() : m->GetTitle())) { if (transparency != -1) { m->SetTransparency(transparency); } TGeoVolume *v; TIter it2(FWGeometryTableViewManager_GetGeoManager()->GetListOfVolumes()); while ((v = (TGeoVolume*) it2()) != 0) { if (v->GetMaterial() == m) { v->SetLineColor(color); } } } } }
TGeoVolume* create_new_tof_module(Int_t modType) { Int_t cType = CounterTypeInModule[modType]; Float_t dx=Module_Size_X[modType]; Float_t dy=Module_Size_Y[modType]; Float_t dz=Module_Size_Z[modType]; Float_t width_aluxl=Module_Thick_Alu_X_left; Float_t width_aluxr=Module_Thick_Alu_X_right; Float_t width_aluy=Module_Thick_Alu_Y; Float_t width_aluz=Module_Thick_Alu_Z; Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left)/2; Float_t dxpos=CounterXDistance[modType]; Float_t startxpos=CounterXStartPosition[modType]; Float_t dzoff=CounterZDistance[modType]; Float_t rotangle=CounterRotationAngle[modType]; TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium); TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); TString moduleName = Form("module_%d", modType); TGeoBBox* module_box = new TGeoBBox("", dx/2., dy/2., dz/2.); TGeoVolume* module = new TGeoVolume(moduleName, module_box, boxVolMed); module->SetLineColor(kGreen); // set line color for the alu box module->SetTransparency(20); // set transparency for the TOF TGeoBBox* gas_box = new TGeoBBox("", (dx-(width_aluxl+width_aluxr))/2., (dy-2*width_aluy)/2., (dz-2*width_aluz)/2.); TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed); gas_box_vol->SetLineColor(kBlue); // set line color for the alu box gas_box_vol->SetTransparency(50); // set transparency for the TOF TGeoTranslation* gas_box_trans = new TGeoTranslation("", shift_gas_box, 0., 0.); module->AddNode(gas_box_vol, 0, gas_box_trans); for (Int_t j=0; j< NCounterInModule[modType]; j++){ //loop over counters (modules) Float_t zpos; if (0 == modType || 3 == modType || 4 == modType || 5 == modType) { zpos = dzoff *=-1; } else { zpos = 0.; } TGeoTranslation* counter_trans = new TGeoTranslation("", startxpos+ j*dxpos , 0.0 , zpos); TGeoRotation* counter_rot = new TGeoRotation(); counter_rot->RotateY(rotangle); TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot); gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans); } return module; }
void set_vis() { /// Macro for setting visualization for Example TR if ( TString(gMC->GetName()) == "TGeant3TGeo" ) { // Set drawing options TGeoVolume* vol; vol = gGeoManager->GetVolume("Radiator"); if (vol) vol->SetLineColor(kMagenta); vol = gGeoManager->GetVolume("Absorber"); if (vol) vol->SetLineColor(kYellow); gMC->SetCollectTracks(kTRUE); } if (TString(gMC->GetName()) == "TGeant4") { // Setting Geant4 visualization ((TGeant4*)gMC)->ProcessGeantMacro("g4vis.in"); } }
virtual TGeoVolume* MakeCopyVolume(TGeoShape *newshape) { // make a copy of this volume. build a volume with same name, shape and medium TGeoVolume *vol = _copyVol(newshape); vol->SetVisibility(IsVisible()); vol->SetLineColor(GetLineColor()); vol->SetLineStyle(GetLineStyle()); vol->SetLineWidth(GetLineWidth()); vol->SetFillColor(GetFillColor()); vol->SetFillStyle(GetFillStyle()); vol->SetField(fField); if (fFinder) vol->SetFinder(fFinder); CloneNodesAndConnect(vol); ((TObject*) vol)->SetBit(kVolumeClone); return vol; }
TGeoVolume* KVSpectroDetector::GetGeoVolume(const Char_t* name,const Char_t* material, TGeoShape* shape){ // Construct a TGeoVolume shape which can be used to represent // a detector in the current geometry managed by gGeoManager. // If the argument material is empty, the name of the detector is used. // Input: name - name given to the volume. // material - material of the volume. The list of available // materials can be found with // det->GetRangeTable()->GetListOfMaterials()->ls() // where det is a KVSpectroDetector or another // object inheriting from KVMaterial. // shape - shape of the volume. TGeoMedium *med = GetGeoMedium(material); if(!med) return NULL; TGeoVolume* vol = new TGeoVolume(name,shape,med); if(vol) vol->SetLineColor(med->GetMaterial()->GetDefaultColor()); return vol; }
virtual TGeoVolume* CloneVolume() const { TGeoVolume *vol = _copyVol(fShape); Int_t i; // copy volume attributes vol->SetLineColor(GetLineColor()); vol->SetLineStyle(GetLineStyle()); vol->SetLineWidth(GetLineWidth()); vol->SetFillColor(GetFillColor()); vol->SetFillStyle(GetFillStyle()); // copy other attributes Int_t nbits = 8 * sizeof(UInt_t); for (i = 0; i < nbits; i++) vol->SetAttBit(1 << i, TGeoAtt::TestAttBit(1 << i)); for (i = 14; i < 24; i++) vol->SetBit(1 << i, this->TGeoVolume::TestBit(1 << i)); // copy field vol->SetField(fField); // Set bits for (i = 0; i < nbits; i++) vol->SetBit(1 << i, this->TGeoVolume::TestBit(1 << i)); vol->SetBit(kVolumeClone); // copy nodes // CloneNodesAndConnect(vol); vol->MakeCopyNodes(this); // if volume is divided, copy finder vol->SetFinder(fFinder); // copy voxels if (fVoxels) { TGeoVoxelFinder *voxels = new TGeoVoxelFinder(vol); vol->SetVoxelFinder(voxels); } // copy option, uid vol->SetOption(fOption); vol->SetNumber(fNumber); vol->SetNtotal(fNtotal); return vol; }
void makeGeom() { //--- Definition of a simple geometry // gSystem->Load("libGeom"); new TGeoManager("genfitGeom", "GENFIT geometry"); gROOT->Macro("../../geometry/media.C"); TGeoMedium *vacuum = gGeoManager->GetMedium("vacuum"); assert(vacuum!=NULL); TGeoMedium *air = gGeoManager->GetMedium("air"); assert(air!=NULL); TGeoMedium *sil = gGeoManager->GetMedium("silicon"); assert(sil!=NULL); TGeoVolume *top = gGeoManager->MakeBox("TOPPER", vacuum, 500., 500., 500.); gGeoManager->SetTopVolume(top); // mandatory ! TGeoVolume *redBullCan = gGeoManager->MakeTube("redBullCan", sil, 3.-5.e-3, 3., 10.);//, 90., 270.); redBullCan->SetLineColor(kRed); //top->AddNode(redBullCan, 1, gGeoIdentity); TGeoVolume *redBullCan2 = gGeoManager->MakeTube("redBullCan2", sil, 4.-5.e-3, 4., 10.);//, 90., 270.); redBullCan2->SetLineColor(kRed); //top->AddNode(redBullCan2, 1, gGeoIdentity); //--- close the geometry gGeoManager->CloseGeometry(); //--- draw the ROOT box gGeoManager->SetVisLevel(10); //top->Draw("ogl"); TFile *outfile = TFile::Open("genfitGeom.root","RECREATE"); gGeoManager->Write(); outfile->Close(); }
void getModule(TGeoManager* geom, TGeoVolume* top, TGeoVolume* mod){ //--- define some materials TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); //--- define some media TGeoMedium *Al = new TGeoMedium("Root Material",1, matAl); TGeoVolume *refMod = geom->MakeBox( "refMod", Al, 0.5*_surWidth*_sclfmodulesizex, 0.5*_surLength*_sclfmodulesizey, 0.30*_sclfmodulesizez ); refMod->SetLineColor( 38 ); refMod->SetFillColor( 13 ); TGeoVolume *curMod = geom->MakeBox( "curMod", Al, 0.5*_surWidth*_sclfmodulesizex, 0.5*_surLength*_sclfmodulesizey, 0.30*_sclfmodulesizez ); if ((_yVal < 0)&&(_zVal>=0)) curMod->SetLineColor( kRed ); if ((_yVal < 0)&&(_zVal<0)) curMod->SetLineColor( kGreen ); if ((_yVal >= 0)&&(_zVal>=0)) curMod->SetLineColor( kBlue ); if ((_yVal >= 0)&&(_zVal<0)) curMod->SetLineColor( kMagenta ); refMod->SetLineColor( 14 ); //curMod->SetLineColor(kBlue); //refMod->SetLineColor(kRed); const Double_t radc = 180./TMath::Pi(); TGeoTranslation *tr1 = new TGeoTranslation( 0., 0., 0. ); TGeoRotation *rt1 = new TGeoRotation(); double rota[9]; rota[0] = _surRot[0]; rota[1] = _surRot[3]; rota[2] = _surRot[6]; rota[3] = _surRot[1]; rota[4] = _surRot[4]; rota[5] = _surRot[7]; rota[6] = _surRot[2]; rota[7] = _surRot[5]; rota[8] = _surRot[8]; rt1->SetMatrix( rota ); TGeoTranslation *tr2 = new TGeoTranslation( _sclftr*_dxVal, _sclftr*_dyVal, _sclftr*_dzVal ); TGeoRotation *rt2 = new TGeoRotation( "rt2", _sclfrt*_dalphaVal*radc, _sclfrt*_dbetaVal*radc, _sclfrt*_dgammaVal*radc ); rt2->MultiplyBy( rt1 ); TGeoCombiTrans *combi1 = new TGeoCombiTrans( *tr1, *rt1 ); TGeoCombiTrans *combi2 = new TGeoCombiTrans( *tr2, *rt2 ); mod->AddNode( curMod, 1, combi2 ); mod->AddNode( refMod, 1, combi1 ); TGeoTranslation *trG = new TGeoTranslation( _xVal - _dxVal, _yVal - _dyVal, _zVal - _dzVal); TGeoRotation *rtG = new TGeoRotation( "rtG", -1*_dalphaVal, -1*_dbetaVal, -1*_dgammaVal ); TGeoCombiTrans *combi = new TGeoCombiTrans( *trG, *rtG ); top->AddNode( mod, 1, combi ); }
TGeoVolume* create_new_counter(Int_t modType) { //glass Float_t gdx=Glass_X[modType]; Float_t gdy=Glass_Y[modType]; Float_t gdz=Glass_Z[modType]; //gas gap Int_t nstrips=NumberOfReadoutStrips[modType]; Int_t ngaps=NumberOfGaps[modType]; Float_t ggdx=GasGap_X[modType]; Float_t ggdy=GasGap_Y[modType]; Float_t ggdz=GasGap_Z[modType]; Float_t gsdx=ggdx/(Float_t)(nstrips); // electronics //pcb dimensions Float_t dxe=Electronics_X[modType]; Float_t dye=Electronics_Y[modType]; Float_t dze=Electronics_Z[modType]; Float_t yele=gdy/2.+dye/2.; // counter size (calculate from glas, gap and electronics sizes) Float_t cdx = TMath::Max(gdx, ggdx); cdx = TMath::Max(cdx, dxe)+ 0.2; Float_t cdy = TMath::Max(gdy, ggdy) + 2*dye + 0.2; Float_t cdz = ngaps * (gdz+ggdz) + gdz + 0.2; //calculate thickness and first position in coonter of single stack Float_t dzpos=gdz+ggdz; Float_t startzposglas=(-cdz+gdz)/2.; Float_t startzposgas=-cdz/2.+ gdz + ggdz/2.; // needed materials TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium); TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium); TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium); TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium); // define counter volume TGeoBBox* counter_box = new TGeoBBox("", cdx/2., cdy/2., cdz/2.); TGeoVolume* counter = new TGeoVolume("counter", counter_box, noActiveGasVolMed); counter->SetLineColor(kCyan); // set line color for the counter counter->SetTransparency(70); // set transparency for the TOF // define single glass plate volume TGeoBBox* glass_plate = new TGeoBBox("", gdx/2., gdy/2., gdz/2.); TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed); glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate glass_plate_vol->SetTransparency(20); // set transparency for the TOF // define single gas gap volume TGeoBBox* gas_gap = new TGeoBBox("", ggdx/2., ggdy/2., ggdz/2.); TGeoVolume* gas_gap_vol = new TGeoVolume("Gap", gas_gap, activeGasVolMed); gas_gap_vol->Divide("Cell",1,nstrips,-ggdx/2.,0); gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap gas_gap_vol->SetTransparency(99); // set transparency for the TOF // place 8 gas gaps and 9 glas plates in the counter for( Int_t igap = 0; igap < ngaps; igap++) { Float_t zpos_glas = startzposglas + igap*dzpos; Float_t zpos_gas = startzposgas + igap*dzpos; // cout <<"Zpos(Glas): "<< zpos_glas << endl; // cout <<"Zpos(Gas): "<< zpos_gas << endl; TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., zpos_glas); TGeoTranslation* gas_gap_trans = new TGeoTranslation("", 0., 0., zpos_gas); counter->AddNode(glass_plate_vol, igap, glass_plate_trans); counter->AddNode(gas_gap_vol, igap, gas_gap_trans); } Float_t zpos_glas = startzposglas + (ngaps+1)*dzpos; TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., zpos_glas); counter->AddNode(glass_plate_vol, ngaps, glass_plate_trans); // create and place the electronics above and below the glas stack TGeoBBox* pcb = new TGeoBBox("", dxe/2., dye/2., dze/2.); TGeoVolume* pcb_vol = new TGeoVolume("pcb", pcb, electronicsVolMed); pcb_vol->SetLineColor(kCyan); // set line color for electronics pcb_vol->SetTransparency(10); // set transparency for the TOF for (Int_t l=0; l<2; l++){ yele *= -1.; TGeoTranslation* pcb_trans = new TGeoTranslation("", 0., yele, 0.); counter->AddNode(pcb_vol, l, pcb_trans); } return counter; }
/** * Initialise ROOT geometry objects from GEAR objects * * @param geomName name of ROOT geometry object * @param dumpRoot dump automatically generated ROOT geometry file for further inspection */ void EUTelGeometryTelescopeGeoDescription::initializeTGeoDescription( std::string& geomName, bool dumpRoot = false ) { // #ifdef USE_TGEO // get access to ROOT's geometry manager if( _isGeoInitialized ) { streamlog_out( WARNING3 ) << "EUTelGeometryTelescopeGeoDescription: Geometry already initialized, using old initialization" << std::endl; return; } else { _geoManager = new TGeoManager("Telescope", "v0.1"); } if( !_geoManager ) { streamlog_out( ERROR3 ) << "Can't instantiate ROOT TGeoManager " << std::endl; return; } // Create top world volume containing telescope/DUT geometry // Create air mixture // see http://pdg.lbl.gov/2013/AtomicNuclearProperties/HTML_PAGES/104.html double air_density = 1.2e-3; // g/cm^3 double air_radlen = 36.62; // g/cm^2 TGeoMixture* pMatAir = new TGeoMixture("AIR",3,air_density); pMatAir->DefineElement(0, 14.007, 7., 0.755267 ); //Nitrogen pMatAir->DefineElement(1, 15.999, 8., 0.231781 ); //Oxygen pMatAir->DefineElement(2, 39.948, 18., 0.012827 ); //Argon pMatAir->DefineElement(3, 12.011, 6., 0.000124 ); //Carbon pMatAir->SetRadLen( air_radlen ); // Medium: medium_World_AIR TGeoMedium* pMedAir = new TGeoMedium("medium_World_AIR", 3, pMatAir ); // The World is the 10 x 10m x 10m box filled with air mixture Double_t dx,dy,dz; dx = 5000.000000; // [mm] dy = 5000.000000; // [mm] dz = 5000.000000; // [mm] TGeoShape *pBoxWorld = new TGeoBBox("Box_World", dx,dy,dz); // Volume: volume_World TGeoVolume* pvolumeWorld = new TGeoVolume("volume_World",pBoxWorld, pMedAir); pvolumeWorld->SetLineColor(4); pvolumeWorld->SetLineWidth(3); pvolumeWorld->SetVisLeaves(kTRUE); // Set top volume of geometry gGeoManager->SetTopVolume( pvolumeWorld ); // Iterate over registered GEAR objects and construct their TGeo representation const Double_t PI = 3.141592653589793; const Double_t DEG = 180./PI; double xc, yc, zc; // volume center position double alpha, beta, gamma; IntVec::const_iterator itrPlaneId; for ( itrPlaneId = _sensorIDVec.begin(); itrPlaneId != _sensorIDVec.end(); ++itrPlaneId ) { std::stringstream strId; strId << *itrPlaneId; // Get sensor center position xc = siPlaneXPosition( *itrPlaneId ); yc = siPlaneYPosition( *itrPlaneId ); zc = siPlaneZPosition( *itrPlaneId ); // Get sensor orientation alpha = siPlaneXRotation( *itrPlaneId ); // [rad] beta = siPlaneYRotation( *itrPlaneId ); // [rad] gamma = siPlaneZRotation( *itrPlaneId ); // [rad] // Spatial translations of the sensor center string stTranslationName = "matrixTranslationSensor"; stTranslationName.append( strId.str() ); TGeoTranslation* pMatrixTrans = new TGeoTranslation( stTranslationName.c_str(), xc, yc, zc ); //ALL clsses deriving from TGeoMatrix are not owned by the ROOT geometry manager, invoking RegisterYourself() transfers //ownership and thus ROOT will clean up pMatrixTrans->RegisterYourself(); // Spatial rotation around sensor center // TGeoRotation requires Euler angles in degrees string stRotationName = "matrixRotationSensorX"; stRotationName.append( strId.str() ); TGeoRotation* pMatrixRotX = new TGeoRotation( stRotationName.c_str(), 0., alpha*DEG, 0.); // around X axis stRotationName = "matrixRotationSensorY"; stRotationName.append( strId.str() ); TGeoRotation* pMatrixRotY = new TGeoRotation( stRotationName.c_str(), 90., beta*DEG, 0.); // around Y axis (combination of rotation around Z axis and new X axis) stRotationName = "matrixRotationSensorBackY"; stRotationName.append( strId.str() ); TGeoRotation* pMatrixRotY1 = new TGeoRotation( stRotationName.c_str(), -90., 0., 0.); // restoration of original orientation (valid in small angle approximataion ~< 15 deg) stRotationName = "matrixRotationSensorZ"; stRotationName.append( strId.str() ); TGeoRotation* pMatrixRotZ = new TGeoRotation( stRotationName.c_str(), 0. , 0., gamma*DEG); // around Z axis // Combined rotation in several steps TGeoRotation* pMatrixRot = new TGeoRotation( *pMatrixRotX ); pMatrixRot->MultiplyBy( pMatrixRotY ); pMatrixRot->MultiplyBy( pMatrixRotY1 ); pMatrixRot->MultiplyBy( pMatrixRotZ ); pMatrixRot->RegisterYourself(); pMatrixRotX->RegisterYourself(); pMatrixRotY->RegisterYourself(); pMatrixRotY1->RegisterYourself(); pMatrixRotZ->RegisterYourself(); // Combined translation and orientation TGeoCombiTrans* combi = new TGeoCombiTrans( *pMatrixTrans, *pMatrixRot ); combi->RegisterYourself(); // Construction of sensor objects // Construct object medium. Required for radiation length determination // assume SILICON, though all information except of radiation length is ignored double a = 28.085500; double z = 14.000000; double density = 2.330000; double radl = siPlaneMediumRadLen( *itrPlaneId ); double absl = 45.753206; string stMatName = "materialSensor"; stMatName.append( strId.str() ); TGeoMaterial* pMat = new TGeoMaterial( stMatName.c_str(), a, z, density, radl, absl ); pMat->SetIndex( 1 ); // Medium: medium_Sensor_SILICON int numed = 0; // medium number double par[8]; par[0] = 0.000000; // isvol par[1] = 0.000000; // ifield par[2] = 0.000000; // fieldm par[3] = 0.000000; // tmaxfd par[4] = 0.000000; // stemax par[5] = 0.000000; // deemax par[6] = 0.000000; // epsil par[7] = 0.000000; // stmin string stMedName = "mediumSensor"; stMedName.append( strId.str() ); TGeoMedium* pMed = new TGeoMedium( stMedName.c_str(), numed, pMat, par ); // Construct object shape // Shape: Box type: TGeoBBox // TGeo requires half-width of box side dx = siPlaneXSize( *itrPlaneId ) / 2.; dy = siPlaneYSize( *itrPlaneId ) / 2.; dz = siPlaneZSize( *itrPlaneId ) / 2.; TGeoShape *pBoxSensor = new TGeoBBox( "BoxSensor", dx, dy, dz ); // Volume: volume_Sensor1 // Geometry navigation package requires following names for objects that have an ID // name:ID string stVolName = "volume_SensorID:"; stVolName.append( strId.str() ); _planePath.insert( std::make_pair(*itrPlaneId, "/volume_World_1/"+stVolName+"_1") ); TGeoVolume* pvolumeSensor = new TGeoVolume( stVolName.c_str(), pBoxSensor, pMed ); pvolumeSensor->SetVisLeaves( kTRUE ); pvolumeWorld->AddNode(pvolumeSensor, 1/*(*itrPlaneId)*/, combi); //this line tells the pixel geometry manager to load the pixel geometry into the plane _pixGeoMgr->addPlane( *itrPlaneId, geoLibName( *itrPlaneId), stVolName); } // loop over sensorID _geoManager->CloseGeometry(); _isGeoInitialized = true; // Dump ROOT TGeo object into file if ( dumpRoot ) _geoManager->Export( geomName.c_str() ); // #endif //USE_TGEO return; }
void south_gate() { // Drawing a famous Korean gate, the South gate, called Namdeamoon in Korean, using ROOT geometry class. // Name: south_gate.C // Author: Lan Hee Yang([email protected]), Dept. of Physics, Univ. of Seoul // Reviewed by Sunman Kim ([email protected]) // Supervisor: Prof. Inkyu Park ([email protected]) // // How to run: .x south_gate.C in ROOT terminal, then use OpenGL // // This macro was created for the evaluation of Computational Physics course in 2006. // We thank to Prof. Inkyu Park for his special lecture on ROOT and to all of ROOT team // TGeoManager *geom=new TGeoManager("geom","My first 3D geometry"); TGeoMaterial *vacuum=new TGeoMaterial("vacuum",0,0,0);//a,z,rho TGeoMaterial *Fe=new TGeoMaterial("Fe",55.845,26,7.87); //Creat media TGeoMedium *Air = new TGeoMedium("Vacuum",0,vacuum); TGeoMedium *Iron = new TGeoMedium("Iron",1,Fe); //Creat volume TGeoVolume *top = geom->MakeBox("top",Air,1000,1000,1000); geom->SetTopVolume(top); geom->SetTopVisible(0); // If you want to see the boundary, please input the number, 1 instead of 0. // Like this, geom->SetTopVisible(1); //base char nBlocks[100]; int i=1; int N = 0; int f=0; int di[2]; di[0] = 0; di[1] = 30; TGeoVolume *mBlock; while (f<11){ while (i<14){ if (i==6 && f<8){ i = i+3; } sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 29,149,9); mBlock->SetLineColor(20); if (f<8){ if (i<=5 && f<8){ top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-120-((i-1)*60)-di[f%2],5,5+(20*f))); } else if (i>5 && f<8){ top->AddNodeOverlap(mBlock,1,new TGeoTranslation(120+((i-9)*60) +di[f%2],5,5+(20*f))); } } else { top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-420+(i*60)-di[f%2],5,5+(20*f))); } i++; if (i>=14 && f>=8 && f%2 == 1){ sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 29,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-420+(i*60)-di[f%2],5,5+(20*f))); i++; } if (f%2 ==0){ sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-405,5,5+(20*f))); sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(405,5,5+(20*f))); } else if (f<5){ sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-105,5,5+(20*f))); sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(105,5,5+(20*f))); } } sprintf(nBlocks,"f%d_bg%d",8,N++); mBlock = geom->MakeBox(nBlocks, Iron, 40,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-80,5,145)); sprintf(nBlocks,"f%d_bg%d",8,N++); mBlock = geom->MakeBox(nBlocks, Iron, 40,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(80,5,145)); sprintf(nBlocks,"f%d_bg%d",7,N++); mBlock = geom->MakeBox(nBlocks, Iron, 15,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-75,5,125)); sprintf(nBlocks,"f%d_bg%d",7,N++); mBlock = geom->MakeBox(nBlocks, Iron, 15,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(75,5,125)); sprintf(nBlocks,"f%d_bg%d",6,N++); mBlock = geom->MakeBox(nBlocks, Iron, 24,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-95,5,105)); sprintf(nBlocks,"f%d_bg%d",6,N++); mBlock = geom->MakeBox(nBlocks, Iron, 24,149,9); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(95,5,105)); i=1;f++; } //wall f=0; while (f<5){ i=0; while (i<65){ sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 5.8,3,3.8); mBlock->SetLineColor(25); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-384+(i*12),137,218+(f*8))); i++; } f++; } f=0; while (f<5){ i=0; while (i<65){ sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 5.8,3,3.8); mBlock->SetLineColor(25); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-384+(i*12),-137,218+(f*8))); i++; } f++; } f=0; while (f<7){ i=0; while (i<22){ sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 3,5.8,3.8); mBlock->SetLineColor(25); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-384,-126+(i*12),218+(f*8))); i++; } f++; } f=0; while (f<7){ i=0; while (i<22){ sprintf(nBlocks,"f%d_bg%d",f,N++); mBlock = geom->MakeBox(nBlocks, Iron, 3,5.8,3.8); mBlock->SetLineColor(25); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(384,-126+(i*12),218+(f*8))); i++; } f++; } // arch int k; k=0; i=0; while (i<5){ while(k<10){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 70,89,14, (i*36)+0.5, (i+1)*36-0.5); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,-130+(k*30),70, new TGeoRotation("r1",0,90,0))); k++; } i++; k=0; } sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 9,149,17); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(80,5,14)); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 9,149,18); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(80,5,51)); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 9,149,17); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-80,5,14)); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 9,149,18); mBlock->SetLineColor(20); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-80,5,51)); //wall's kiwa k=0; i=0; while (i<5){ while(k<52){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 1,3,7, 0, 180); mBlock->SetLineColor(12); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-382+(k*15),137,255, new TGeoRotation("r1",90,90,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<52){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 2.5,3,7, 0, 180); mBlock->SetLineColor(12); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-382+(k*15),-137,255, new TGeoRotation("r1",90,90,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<20){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 2.5,3,6, 0, 180); mBlock->SetLineColor(12); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-382,-123+(k*13),271, new TGeoRotation("r1",0,90,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<20){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 2.5,3,7, 0, 180); mBlock->SetLineColor(12); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(382,-123+(k*13),271, new TGeoRotation("r1",0,90,0))); k++; } i++; k=0; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 1 floor k=0; i=0; while (i<5){ while(k<7){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,56, 0, 360); mBlock->SetLineColor(50); if (k<=2){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,260, new TGeoRotation("r1",0,0,0))); }else if (k>=4){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,260, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<7){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,56, 0, 360); mBlock->SetLineColor(50); if (k<=2){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,260, new TGeoRotation("r1",0,0,0))); }else if (k>=4){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,260, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } // ||=====||======||=====||=====||=====||=====|| sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 298,78,8); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,300)); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 298,78,5); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,320)); //1 k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,8); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),70,300, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,8); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-70,300, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-290,0,300, new TGeoRotation("r1",90,0,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(290,0,300, new TGeoRotation("r1",90,0,0))); //2 k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,5); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),70,320, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,5); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-70,320, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-290,0,320, new TGeoRotation("r1",90,0,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(290,0,320, new TGeoRotation("r1",90,0,0))); //___||____||_____||____||____||____||____|| k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),78,345, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-78,345, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-78+(k*33),345, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-78+(k*33),345, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } // ||// ||// ||// ||// k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),90,342, new TGeoRotation("r1",0,-45,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-90,342, new TGeoRotation("r1",0,45,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-318,-78+(k*33),345, new TGeoRotation("r1",-90,45,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(318,-78+(k*33),345, new TGeoRotation("r1",90,45,0))); k++; } i++; k=0; } // /// || / / / / / / / || / / / / / / / / || / / / / / / / / / / / sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,-107,362, new TGeoRotation("r1",0,-45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,107,362, new TGeoRotation("r1",0,45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(330,0,362, new TGeoRotation("r1",90,-45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-330,0,362, new TGeoRotation("r1",90,45,0))); /////////////////////// add box k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,2); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),-108,362, new TGeoRotation("r1",0,-45,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,2); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),108,362, new TGeoRotation("r1",0,45,0))); } k++; } i++; k=0; } sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(331,0,362, new TGeoRotation("r1",90,-45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-331,0,362, new TGeoRotation("r1",90,45,0))); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 2nd floor k=0; i=0; while (i<5){ while(k<7){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,30, 0, 360); mBlock->SetLineColor(50); if (k<=2){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,465, new TGeoRotation("r1",0,0,0))); }else if (k>=4){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),80,465, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<7){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 0,5,30, 0, 360); mBlock->SetLineColor(50); if (k<=2){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,465, new TGeoRotation("r1",0,0,0))); }else if (k>=4){ top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*100),-80,465, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } // ||=====||======||=====||=====||=====||=====|| sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 302,80,8); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,480)); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 302,80,5); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,500)); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 305,80,2.5); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,465)); ///////////////////////add box //1 k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,8); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),71,480, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,8); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-71,480, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-293,0,480, new TGeoRotation("r1",90,0,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,8); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(293,0,480, new TGeoRotation("r1",90,0,0))); //2 k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,5); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),71,500, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,5); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-250+(k*100),-71,500, new TGeoRotation("r1",0,0,0))); } k++; } i++; k=0; } sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-293,0,500, new TGeoRotation("r1",90,0,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,5); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(293,0,500, new TGeoRotation("r1",90,0,0))); // 1 ___||____||_____||____||____||____||____|| k=0; i=0; while (i<5){ while(k<25){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 1.5,5,15); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*25),78,450, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<25){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 1.5,5,15); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*25),-78,450, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<7){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,1.5,15); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-78+(k*25),450, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while (k<7){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,1.5,15); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-78+(k*25),450, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } // 2 ___||____||_____||____||____||____||____|| k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),78,525, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-78,525, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-78+(k*33),525, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-78+(k*33),525, new TGeoRotation("r1",0,0,0))); k++; } i++; k=0; } // ||// ||// ||// ||// //down k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),90,522, new TGeoRotation("r1",0,-45,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<19){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300+(k*33.3),-90,522, new TGeoRotation("r1",0,45,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-318,-78+(k*33.3),525, new TGeoRotation("r1",-90,45,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<5){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 5,5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(318,-78+(k*33.3),525, new TGeoRotation("r1",90,45,0))); k++; } i++; k=0; } // up k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,562, new TGeoRotation("r1",0,-115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,562, new TGeoRotation("r1",0,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),565, new TGeoRotation("r1",-90,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),565, new TGeoRotation("r1",90,115,0))); k++; } i++; k=0; } //up2 k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,375, new TGeoRotation("r1",0,-115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,375, new TGeoRotation("r1",0,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),375, new TGeoRotation("r1",-90,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(50); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),375, new TGeoRotation("r1",90,115,0))); k++; } i++; k=0; } //up 3 k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,568, new TGeoRotation("r1",0,-115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,568, new TGeoRotation("r1",0,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),568, new TGeoRotation("r1",-90,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),568, new TGeoRotation("r1",90,115,0))); k++; } i++; k=0; } //up4 k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),115,385, new TGeoRotation("r1",0,-115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<50){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-320+(k*13),-115,385, new TGeoRotation("r1",0,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-340,-98+(k*13),385, new TGeoRotation("r1",-90,115,0))); k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<17){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 2.5,2.5,20); mBlock->SetLineColor(44); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(340,-98+(k*13),385, new TGeoRotation("r1",90,115,0))); k++; } i++; k=0; } // up kiwa //========= sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 270,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,0,620, new TGeoRotation("r1",0,0,0))); //===============//2 sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-50,600, new TGeoRotation("r1",0,20,-40))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,50,600, new TGeoRotation("r1",0,-20,40))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,50,600, new TGeoRotation("r1",0,-20,-40))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 75,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-50,600, new TGeoRotation("r1",0,20,40))); //===============//1 sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,-80,413, new TGeoRotation("r1",0,20,-40))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(300,80,413, new TGeoRotation("r1",0,-20,40))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,80,413, new TGeoRotation("r1",0,-20,-40))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron, 50,15,20); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-300,-80,413, new TGeoRotation("r1",0,20,40))); // _1_ //front k=0; i=0; while (i<7){ while(k<44){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-280+(k*13),70+(i*12.5),425-(i*5), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<7){ while(k<44){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-280+(k*13),-70-(i*12.5),425-(i*5), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } //_2_ k=0; i=0; while (i<11){ while(k<43){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*13),15+(i*12.5),620-(i*5), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<11){ while(k<43){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*13),-15-(i*12.5),620-(i*5), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } //////left k=0; i=0; while (i<6){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-335,81.25+(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<7){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-322,69.75+(i*12.5),595-(i*2), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<8){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-309,56.25+(i*12.5),605-(i*4), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<9){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-296,50+(i*12.5),610-(i*4), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<10){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-283,37.5+(i*12.5),615-(i*4), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<6){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-335,-81.25-(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<7){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-322,-69.75-(i*12.5),595-(i*2), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<8){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-309,-56.25-(i*12.5),605-(i*4), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<9){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-296,-50-(i*12.5),610-(i*4), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<10){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-283,-37.5-(i*12.5),615-(i*4), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } //////////right k=0; i=0; while (i<6){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(335,81.25+(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<7){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(322,69.75+(i*12.5),595-(i*2), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<8){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(309,56.25+(i*12.5),605-(i*4), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<9){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(296,50+(i*12.5),610-(i*4), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } k=0; i=0; while (i<10){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(283,37.5+(i*12.5),615-(i*4), new TGeoRotation("r1",0,60,0))); k++; } i++; k=0; } // k=0; i=0; while (i<6){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(335,-81.25-(i*12.5),592.5-(i*2), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<7){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(322,-69.75-(i*12.5),595-(i*2), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<8){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(309,-56.25-(i*12.5),605-(i*4), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<9){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(296,-50-(i*12.5),610-(i*4), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } k=0; i=0; while (i<10){ while(k<11){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeTubs(nBlocks,Iron, 3,6,6,10,170); mBlock->SetLineColor(13); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(283,-37.5-(i*12.5),615-(i*4), new TGeoRotation("r1",0,120,0))); k++; } i++; k=0; } // /// || / / / / / / / || / / / / / / / / || / / / / / / / / / / / sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,-110,550, new TGeoRotation("r1",0,-45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 330,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,110,550, new TGeoRotation("r1",0,45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(335,0,550, new TGeoRotation("r1",90,-45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 110,10,2); mBlock->SetLineColor(42); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-335,0,550, new TGeoRotation("r1",90,45,0))); ////////////////////////////////add box k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,2); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),-111,550, new TGeoRotation("r1",0,-45,0))); } k++; } i++; k=0; } k=0; i=0; while (i<5){ while(k<6){ sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks,Iron,18,10,2); mBlock->SetLineColor(8); { top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-270+(k*100),111,550, new TGeoRotation("r1",0,45,0))); } k++; } i++; k=0; } sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(336,0,550, new TGeoRotation("r1",90,-45,0))); sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 18,10,2); mBlock->SetLineColor(8); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(-336,0,550, new TGeoRotation("r1",90,45,0))); // | | | | | sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 300,75,40); mBlock->SetLineColor(45); top->AddNodeOverlap(mBlock,1,new TGeoCombiTrans(0,0,450, new TGeoRotation("r1",0,0,0))); //kiwa sprintf(nBlocks,"ab%d",N++); mBlock = geom->MakeBox(nBlocks, Iron, 305,80,2.5); mBlock->SetLineColor(10); top->AddNodeOverlap(mBlock,1,new TGeoTranslation(0,0,430)); top->SetVisibility(0); geom->CloseGeometry(); top->Draw("ogl"); }
void robot() { // Drawing a famous Korean robot, TaekwonV, using ROOT geometry class. // Name: robot.C // Author: Jin Hui Hwang, Dept. of Physics, Univ. of Seoul // Reviewed by Sunman Kim ([email protected]) // Supervisor: Prof. Inkyu Park ([email protected]) // // How to run: .x robot.C in ROOT terminal, then use OpenGL // // This macro was created for the evaluation of Computational Physics course in 2006. // We thank to Prof. Inkyu Park for his special lecture on ROOT and to all of ROOT team // TGeoManager *Robot = new TGeoManager("Robot", "This is Taegwon V"); TGeoMaterial *vacuum = new TGeoMaterial("vacuum", 0, 0, 0); TGeoMaterial *Fe = new TGeoMaterial("Fe", 55.845, 26, 7.87); TGeoMedium *Air = new TGeoMedium("Vacuum", 0, vacuum); TGeoMedium *Iron = new TGeoMedium("Iron", 1, Fe); // create volume TGeoVolume *top = Robot->MakeBox("top", Air, 1000, 1000, 1000); Robot->SetTopVolume(top); Robot->SetTopVisible(0); // If you want to see the boundary, please input the number, 1 instead of 0. // Like this, geom->SetTopVisible(1); // head TGeoVolume *Band = Robot->MakeEltu("Band", Iron, 20, 20, 2.5); Band->SetLineColor(12); Band->SetFillColor(12); TGeoVolume *Band_b = Robot->MakeSphere("Band_b", Iron, 0, 2, 0, 180, 180, 360); Band_b->SetLineColor(2); Band_b->SetFillColor(2); TGeoVolume *Head = Robot->MakeSphere("Head", Iron, 0, 19, 0, 180, 180, 360); Head->SetLineColor(17); Head->SetFillColor(17); TGeoVolume *Horn = Robot->MakeSphere("Horn", Iron, 0, 10, 60, 180, 240, 300); // drawing head top->AddNodeOverlap(Band, 1, new TGeoTranslation(0, 0, 90)); float Phi = 3.14; int N = 10; for (int i = 0; i <= N; i++) { top->AddNodeOverlap(Band_b, 1, new TGeoCombiTrans(sin(2 * Phi / N * i) * 19, -cos(2 * Phi / N * i) * 19, 90, new TGeoRotation("R1", -90 + (360 / N * i), -90, 90))); } top->AddNodeOverlap(Head, 1, new TGeoCombiTrans(0, 0, 87.5, new TGeoRotation("R2", 0, -90, 0))); char name[50]; float pcs = 30; for (int i = 1; i < pcs; i++) { sprintf(name, "Horn%d", i); Horn = Robot->MakeSphere(name, Iron, 10 - 10 / pcs * i, 10, 180 - (120 / pcs) * i, 180 - ((120 / pcs) * (i - 1)), 240, 300); Horn->SetLineColor(2); Horn->SetFillColor(2); top->AddNodeOverlap(Horn, 1, new TGeoCombiTrans(0, 8, 102, new TGeoRotation("R2", 0, 140, 0))); top->AddNodeOverlap(Horn, 1, new TGeoCombiTrans(0, -8, 102, new TGeoRotation("R2", 180, 140, 0))); } // face TGeoVolume *Migan = Robot->MakeGtra("Migan", Iron, 3, 0, 0, 0, 3, 2, 11, 0, 3, 3, 11, 0); Migan->SetLineColor(17); Migan->SetFillColor(17); TGeoVolume *Ko = Robot->MakeGtra("Ko", Iron, 7, 0, 0, 0, 3, 1, 5, 0, 3, 2, 5, 0); Ko->SetLineColor(17); Ko->SetFillColor(17); TGeoVolume *Ko_m = Robot->MakeBox("Ko_m", Iron, 2, 8, 4); Ko_m->SetLineColor(17); Ko_m->SetFillColor(17); TGeoVolume *Bol_1 = Robot->MakeBox("Bol_1", Iron, 7, 5.5, 7); Bol_1->SetLineColor(17); Bol_1->SetFillColor(17); TGeoVolume *Bol_2 = Robot->MakeGtra("Bol_2", Iron, 1, 0, 0, 0, 7, 0, 9, 0, 7, 0, 9, 0); Bol_2->SetLineColor(17); Bol_2->SetFillColor(17); TGeoVolume *Noon = Robot->MakeBox("Noon", Iron, 1, 10, 5); Noon->SetLineColor(12); Noon->SetFillColor(12); TGeoVolume *Tuck = Robot->MakeBox("Tuck", Iron, 2, 10, 5.5); Tuck->SetLineColor(2); Tuck->SetFillColor(2); TGeoVolume *Tuck_1 = Robot->MakeBox("Tuck_1", Iron, 2, 9, 1); Tuck_1->SetLineColor(2); Tuck_1->SetFillColor(2); TGeoVolume *Tuck_2 = Robot->MakeBox("Tuck_2", Iron, 3, 1, 14); Tuck_2->SetLineColor(2); Tuck_2->SetFillColor(2); TGeoVolume *Tuck_j = Robot->MakeSphere("Tuck_j", Iron, 0, 3.5, 0, 180, 0, 360); Tuck_j->SetLineColor(5); Tuck_j->SetFillColor(5); TGeoVolume *Ear = Robot->MakeCons("Ear", Iron, 1, 0, 3, 0, 3, 0, 360); Ear->SetLineColor(5); Ear->SetFillColor(5); TGeoVolume *Ear_2 = Robot->MakeCone("Ear_2", Iron, 5, 0, 0, 0, 3); Ear_2->SetLineColor(5); Ear_2->SetFillColor(5); // drawing face top->AddNodeOverlap(Migan, 1, new TGeoCombiTrans(-15, 0, 88, new TGeoRotation("R2", -90, 40, 0))); top->AddNodeOverlap(Ko, 1, new TGeoCombiTrans(-15, 0, 76.5, new TGeoRotation("R2", -90, -20, 0))); top->AddNodeOverlap(Ko_m, 1, new TGeoTranslation(-9, 0, 68)); top->AddNodeOverlap(Bol_1, 1, new TGeoCombiTrans(-7, 2, 76, new TGeoRotation("R2", -30, -10, 0))); top->AddNodeOverlap(Bol_1, 1, new TGeoCombiTrans(-7, -2, 76, new TGeoRotation("R2", 30, 10, 0))); top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-6.5, -10.5, 76, new TGeoRotation("R2", -15, -90, -30))); top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-4, -12.5, 82.5, new TGeoRotation("R2", -20, -90, -95))); top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-7.5, 10.5, 76, new TGeoRotation("R2", 20, -90, -30))); top->AddNodeOverlap(Bol_2, 1, new TGeoCombiTrans(-4, 12.5, 82.5, new TGeoRotation("R2", 20, -90, -95))); top->AddNodeOverlap(Noon, 1, new TGeoCombiTrans(-5, -7, 86, new TGeoRotation("R2", 60, 0, 0))); top->AddNodeOverlap(Noon, 1, new TGeoCombiTrans(-5, 7, 86, new TGeoRotation("R2", -60, 0, 0))); top->AddNodeOverlap(Tuck, 1, new TGeoTranslation(-12, 0, 62.5)); for (int i = 0; i < 10; i++) { top->AddNodeOverlap(Tuck_1, 1, new TGeoCombiTrans(-4.2, 11, 61 + i, new TGeoRotation("R2", 90, -20, 20))); top->AddNodeOverlap(Tuck_1, 1, new TGeoCombiTrans(-4.2, -11, 61 + i, new TGeoRotation("R2", 90, -20, -20))); } top->AddNodeOverlap(Tuck_2, 1, new TGeoTranslation(2, -15.1, 76)); top->AddNodeOverlap(Tuck_2, 1, new TGeoTranslation(2, 15.1, 76)); top->AddNodeOverlap(Tuck_j, 1, new TGeoTranslation(-13, 0, 62.5)); top->AddNodeOverlap(Ear, 1, new TGeoCombiTrans(2, -16.5, 80, new TGeoRotation("R2", 0, -90, 0))); top->AddNodeOverlap(Ear, 1, new TGeoCombiTrans(2, 16.5, 80, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Ear_2, 1, new TGeoCombiTrans(2, -20, 80, new TGeoRotation("R2", 0, -90, 0))); top->AddNodeOverlap(Ear_2, 1, new TGeoCombiTrans(2, 20, 80, new TGeoRotation("R2", 0, 90, 0))); for (int i = 1; i < 28; i += 1) { float a = i * 0.2; TGeoVolume *Hear = Robot->MakeCons("Hear", Iron, 3, 13 + a, 16 + a, 13 + a, 16 + a, -60 - a, 60 + a); if (i < 27) { Hear->SetLineColor(12); Hear->SetFillColor(12); } else { Hear->SetLineColor(2); Hear->SetFillColor(2); } top->AddNodeOverlap(Hear, 1, new TGeoTranslation(0, 0, 89 - i)); } for (int i = 1; i < 28; i += 1) { float a = i * 0.2; TGeoVolume *Hear = Robot->MakeCons("Hear", Iron, 3, 13 + a, 16 + a, 13 + a, 16 + a, -70 - a, -60 - a); Hear->SetLineColor(2); Hear->SetFillColor(2); top->AddNodeOverlap(Hear, 1, new TGeoTranslation(0, 0, 89 - i)); } for (int i = 1; i < 28; i += 1) { float a = i * 0.2; TGeoVolume *Hear = Robot->MakeCons("Hear", Iron, 3, 13 + a, 16 + a, 13 + a, 16 + a, 60 + a, 70 + a); Hear->SetLineColor(2); Hear->SetFillColor(2); top->AddNodeOverlap(Hear, 1, new TGeoTranslation(0, 0, 89 - i)); } // neck TGeoVolume *Mock = Robot->MakeTrd2("Mock", Iron, 1, 1, 7, 6.5, 20); Mock->SetLineColor(17); Mock->SetFillColor(17); TGeoVolume *Mock_1 = Robot->MakeTrd2("Mock_1", Iron, 1, 1, 6, 5, 20); Mock_1->SetLineColor(17); Mock_1->SetFillColor(17); TGeoVolume *Mock_s = Robot->MakeTrd2("Mock_s", Iron, 1, 1, 5, 4.5, 20); Mock_s->SetLineColor(17); Mock_s->SetFillColor(17); // drawing neck top->AddNodeOverlap(Mock, 1, new TGeoCombiTrans(-5, 4.7, 50, new TGeoRotation("R2", -30, 0, -10))); top->AddNodeOverlap(Mock, 1, new TGeoCombiTrans(-5, -4.7, 50, new TGeoRotation("R2", 30, 0, 10))); top->AddNodeOverlap(Mock_1, 1, new TGeoCombiTrans(11, -4, 50, new TGeoRotation("R2", 130, -8, 10))); top->AddNodeOverlap(Mock_1, 1, new TGeoCombiTrans(11, 4, 50, new TGeoRotation("R2", -130, 8, -10))); top->AddNodeOverlap(Mock_s, 1, new TGeoCombiTrans(2.5, 9, 50, new TGeoRotation("R2", 90, 0, 0))); top->AddNodeOverlap(Mock_s, 1, new TGeoCombiTrans(2.5, -9, 50, new TGeoRotation("R2", 90, 0, 0))); // chest TGeoVolume *Gasem = Robot->MakeBox("Gasem", Iron, 16, 50, 20); Gasem->SetLineColor(12); Gasem->SetFillColor(12); TGeoVolume *Gasem_b1 = Robot->MakeSphere("Gasem_b1", Iron, 0, 15, 0, 180, 0, 360); Gasem_b1->SetLineColor(12); Gasem_b1->SetFillColor(12); TGeoVolume *Gasem_b2 = Robot->MakeSphere("Gasem_b2", Iron, 0, 13, 0, 180, 0, 360); Gasem_b2->SetLineColor(12); Gasem_b2->SetFillColor(12); TGeoVolume *Gasem_1 = Robot->MakeEltu("Gasem_1", Iron, 13, 13, 20); Gasem_1->SetLineColor(12); Gasem_1->SetFillColor(12); TGeoVolume *Gasem_2 = Robot->MakeEltu("Gasem_2", Iron, 13, 13, 19); Gasem_2->SetLineColor(12); Gasem_2->SetFillColor(12); TGeoVolume *Gasem_3 = Robot->MakeCone("Gasem_3", Iron, 19, 0, 13, 0, 15); Gasem_3->SetLineColor(12); Gasem_3->SetFillColor(12); TGeoVolume *Gasem_4 = Robot->MakeEltu("Gasem_4", Iron, 15, 15, 16); Gasem_4->SetLineColor(12); Gasem_4->SetFillColor(12); TGeoVolume *Gasem_5 = Robot->MakeEltu("Gasem_5", Iron, 13, 13, 16); Gasem_5->SetLineColor(12); Gasem_5->SetFillColor(12); TGeoVolume *Gasem_m1 = Robot->MakeBox("Gasem_m1", Iron, 19, 19, 5); Gasem_m1->SetLineColor(12); Gasem_m1->SetFillColor(12); TGeoVolume *Gasem_m2 = Robot->MakeTrd2("Gasem_m2", Iron, 13, 15, 2, 2, 19); Gasem_m2->SetLineColor(12); Gasem_m2->SetFillColor(12); TGeoVolume *V = Robot->MakeTrd2("V", Iron, 2, 2, 22, 30, 4); V->SetLineColor(2); V->SetFillColor(2); TGeoVolume *V_m = Robot->MakeBox("V_m", Iron, 2, 7, 1); V_m->SetLineColor(2); V_m->SetFillColor(2); // drawing chest top->AddNodeOverlap(Gasem, 1, new TGeoTranslation(4, 0, 19)); top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(-12, 50, 35)); top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(-12, -50, 35)); top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(20, 50, 35)); top->AddNodeOverlap(Gasem_b1, 1, new TGeoTranslation(20, -50, 35)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, 50, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, -50, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, 50, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, -50, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, 10, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, -10, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, 10, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, -10, -5)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, 10, 35)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(20, -10, 35)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, 10, 35)); top->AddNodeOverlap(Gasem_b2, 1, new TGeoTranslation(-12, -10, 35)); top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(20, 31, -5, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(20, -31, -5, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(-12, 31, -5, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gasem_1, 1, new TGeoCombiTrans(-12, -31, -5, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(20, 10, 13, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(20, -10, 13, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(-12, 10, 13, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_2, 1, new TGeoCombiTrans(-12, -10, 13, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, 50, 16, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, -50, 16, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, 50, 16, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, -50, 16, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, 31, 35, new TGeoRotation("R2", 0, -90, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(-12, -31, 35, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, 31, 35, new TGeoRotation("R2", 0, -90, 0))); top->AddNodeOverlap(Gasem_3, 1, new TGeoCombiTrans(20, -31, 35, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gasem_4, 1, new TGeoCombiTrans(4, -50, 35, new TGeoRotation("R2", 90, 90, 0))); top->AddNodeOverlap(Gasem_4, 1, new TGeoCombiTrans(4, 50, 35, new TGeoRotation("R2", 90, 90, 0))); top->AddNodeOverlap(Gasem_5, 1, new TGeoCombiTrans(4, -50, -5, new TGeoRotation("R2", 90, 90, 0))); top->AddNodeOverlap(Gasem_5, 1, new TGeoCombiTrans(4, 50, -5, new TGeoRotation("R2", 90, 90, 0))); top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(-22, 30, 16, new TGeoRotation("R2", 90, 88, 0))); top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(-22, -30, 16, new TGeoRotation("R2", 90, 88, 0))); top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(29, 30, 16, new TGeoRotation("R2", 90, 92, 0))); top->AddNodeOverlap(Gasem_m1, 1, new TGeoCombiTrans(29, -30, 16, new TGeoRotation("R2", 90, 92, 0))); top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, -62, 16, new TGeoRotation("R2", 0, 3, 0))); top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, 62, 16, new TGeoRotation("R2", 0, -3, 0))); top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, -30, 47.5, new TGeoRotation("R2", 0, 87, 0))); top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, 30, 47.5, new TGeoRotation("R2", 0, -87, 0))); top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, -30, -16, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gasem_m2, 1, new TGeoCombiTrans(2, 30, -16, new TGeoRotation("R2", 0, -90, 0))); top->AddNodeOverlap(V, 1, new TGeoCombiTrans(-30, 18.3, 16, new TGeoRotation("R2", 0, -135, 0))); top->AddNodeOverlap(V, 1, new TGeoCombiTrans(-30, -18.3, 16, new TGeoRotation("R2", 0, 135, 0))); top->AddNodeOverlap(V_m, 1, new TGeoTranslation(-30, -37, 35)); top->AddNodeOverlap(V_m, 1, new TGeoTranslation(-30, 37, 35)); // abdomen TGeoVolume *Bea = Robot->MakeEltu("Bea", Iron, 20, 37, 25); Bea->SetLineColor(17); Bea->SetFillColor(17); TGeoVolume *Bea_d = Robot->MakeEltu("Bea_d", Iron, 21, 36, 5); Bea_d->SetLineColor(12); Bea_d->SetFillColor(12); TGeoVolume *Beakop = Robot->MakeEltu("Beakop", Iron, 15, 25, 5); Beakop->SetLineColor(10); Beakop->SetFillColor(10); // drawing abdomen top->AddNodeOverlap(Bea, 1, new TGeoTranslation(3, 0, -30)); top->AddNodeOverlap(Bea_d, 1, new TGeoTranslation(3, 0, -10)); top->AddNodeOverlap(Beakop, 1, new TGeoCombiTrans(-12.1, 0, -50, new TGeoRotation("R2", 90, 90, 0))); // Gungdi TGeoVolume *Gungdi = Robot->MakeEltu("Gungdi", Iron, 25, 50, 18); Gungdi->SetLineColor(12); Gungdi->SetFillColor(12); TGeoVolume *Gungdi_d = Robot->MakeEltu("Gungdi_d", Iron, 5, 5, 5); Gungdi_d->SetLineColor(2); Gungdi_d->SetFillColor(2); // drawing Gungdi top->AddNodeOverlap(Gungdi, 1, new TGeoTranslation(3, 0, -70)); for (int i = 0; i < 30; i++) { TGeoVolume *Gungdi_j = Robot->MakeEltu("Gungdi_j", Iron, 24 - 0.2 * i, 49 - 0.5 * i, 1); Gungdi_j->SetLineColor(12); Gungdi_j->SetFillColor(12); top->AddNodeOverlap(Gungdi_j, 1, new TGeoTranslation(3, 0, -51 + 0.5 * i)); } for (int i = 0; i < 40; i++) { if (i < 16) { TGeoVolume *Gungdi_h = Robot->MakeEltu("Gungdi_h", Iron, 24 - 0.1 * i, 49 - 0.3 * i, 1); Gungdi_h->SetLineColor(12); Gungdi_h->SetFillColor(12); top->AddNodeOverlap(Gungdi_h, 1, new TGeoTranslation(3, 0, -88 - 0.5 * i)); } else { TGeoVolume *Gungdi_h = Robot->MakeEltu("Gungdi_h", Iron, 27 - 0.3 * i, 52 - 0.5 * i, 1); Gungdi_h->SetLineColor(12); Gungdi_h->SetFillColor(12); top->AddNodeOverlap(Gungdi_h, 1, new TGeoTranslation(3, 0, -89 - 0.5 * i)); } } top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, -45, -62, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, -45, -78, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, 45, -62, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Gungdi_d, 1, new TGeoCombiTrans(3, 45, -78, new TGeoRotation("R2", 0, 90, 0))); // feet TGeoVolume *Jang = Robot->MakeEltu("Jang", Iron, 18, 18, 50); Jang->SetLineColor(17); Jang->SetFillColor(17); TGeoVolume *Jong = Robot->MakeEltu("Jong", Iron, 22, 22, 50); Jong->SetLineColor(12); Jong->SetFillColor(12); TGeoVolume *Bal = Robot->MakeSphere("Bal", Iron, 0, 22, 0, 180, 180, 360); Bal->SetLineColor(12); Bal->SetFillColor(12); // drawing Dary top->AddNodeOverlap(Jang, 1, new TGeoCombiTrans(3, -25, -120, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Jang, 1, new TGeoCombiTrans(3, 25, -120, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Jong, 1, new TGeoCombiTrans(3, -25, -220, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Jong, 1, new TGeoCombiTrans(3, 25, -220, new TGeoRotation("R2", 0, 0, 0))); for (int i = 0; i < 30; i++) { TGeoVolume *Mu = Robot->MakeCons("Mu", Iron, 1, 0, 22.1, 0, 22.1, 120 + 2 * i, -120 - 2 * i); Mu->SetLineColor(4); Mu->SetFillColor(4); top->AddNodeOverlap(Mu, 1, new TGeoTranslation(3, -25, -171 - i)); top->AddNodeOverlap(Mu, 1, new TGeoTranslation(3, 25, -171 - i)); } top->AddNodeOverlap(Bal, 1, new TGeoCombiTrans(-10, -25, -270, new TGeoRotation("R2", 270, -90, 0))); top->AddNodeOverlap(Bal, 1, new TGeoCombiTrans(-10, 25, -270, new TGeoRotation("R2", 270, -90, 0))); // arms TGeoVolume *S = Robot->MakeSphere("S", Iron, 0, 25, 0, 180, 180, 360); S->SetLineColor(17); S->SetFillColor(17); TGeoVolume *S_1 = Robot->MakeSphere("S_1", Iron, 0, 15, 0, 180, 0, 360); S_1->SetLineColor(17); S_1->SetFillColor(17); TGeoVolume *Pal = Robot->MakeEltu("Pal", Iron, 15, 15, 30); Pal->SetLineColor(17); Pal->SetFillColor(17); TGeoVolume *Fal = Robot->MakeEltu("Fal", Iron, 17, 17, 30); Fal->SetLineColor(4); Fal->SetFillColor(4); TGeoVolume *Bbul = Robot->MakeCone("Bbul", Iron, 8, 0, 0, 0, 5); Bbul->SetLineColor(17); Bbul->SetFillColor(17); // drawing arms top->AddNodeOverlap(S, 1, new TGeoCombiTrans(3, 73, 30, new TGeoRotation("R2", 0, -30, 0))); top->AddNodeOverlap(S, 1, new TGeoCombiTrans(3, -73, 30, new TGeoRotation("R2", 0, 210, 0))); top->AddNodeOverlap(S_1, 1, new TGeoCombiTrans(3, -73, 27, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(S_1, 1, new TGeoCombiTrans(3, 73, 27, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Pal, 1, new TGeoCombiTrans(3, -73, -5, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Pal, 1, new TGeoCombiTrans(3, 73, -5, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Fal, 1, new TGeoCombiTrans(3, -73, -60, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Fal, 1, new TGeoCombiTrans(3, 73, -60, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, -97, -72, new TGeoRotation("R2", 0, -90, 0))); top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, -97, -48, new TGeoRotation("R2", 0, -90, 0))); top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, 97, -72, new TGeoRotation("R2", 0, 90, 0))); top->AddNodeOverlap(Bbul, 1, new TGeoCombiTrans(3, 97, -48, new TGeoRotation("R2", 0, 90, 0))); // hands TGeoVolume *Son_d = Robot->MakeBox("Son_d", Iron, 15, 15, 7); Son_d->SetLineColor(4); Son_d->SetFillColor(4); TGeoVolume *Son_g = Robot->MakeBox("Son_g", Iron, 4, 10, 4); Son_g->SetLineColor(4); Son_g->SetFillColor(4); TGeoVolume *Son_g1 = Robot->MakeBox("Son_g1", Iron, 6, 6, 6); Son_g1->SetLineColor(4); Son_g1->SetFillColor(4); TGeoVolume *Son_g2 = Robot->MakeBox("Son_g2", Iron, 8, 3, 3); Son_g2->SetLineColor(4); Son_g2->SetFillColor(4); TGeoVolume *Last_b = Robot->MakeCone("Last_b", Iron, 10, 0, 0, 0, 4); Last_b->SetLineColor(17); Last_b->SetFillColor(17); TGeoVolume *Last = Robot->MakeSphere("Last", Iron, 0, 3, 0, 180, 0, 360); Last->SetLineColor(2); Last->SetFillColor(2); // drawing hands top->AddNodeOverlap(Son_d, 1, new TGeoCombiTrans(3, -80, -105, new TGeoRotation("R2", 0, 90, 0))); for (int i = 0; i < 4; i++) { top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, -72, -118, new TGeoRotation("R2", 0, -10, 0))); } for (int i = 0; i < 4; i++) { top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, -67, -113, new TGeoRotation("R2", 0, 110, 0))); } top->AddNodeOverlap(Son_g1, 1, new TGeoCombiTrans(-5, -70, -98, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Son_g2, 1, new TGeoCombiTrans(-5, -65, -102, new TGeoRotation("R2", 0, 60, 0))); top->AddNodeOverlap(Son_d, 1, new TGeoCombiTrans(3, 80, -105, new TGeoRotation("R2", 0, 90, 0))); for (int i = 0; i < 4; i++) { top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, 72, -118, new TGeoRotation("R2", 0, 10, 0))); } for (int i = 0; i < 4; i++) { top->AddNodeOverlap(Son_g, 1, new TGeoCombiTrans(-6 + 6 * i, 67, -113, new TGeoRotation("R2", 0, 70, 0))); } top->AddNodeOverlap(Son_g1, 1, new TGeoCombiTrans(-5, 70, -98, new TGeoRotation("R2", 0, 0, 0))); top->AddNodeOverlap(Son_g2, 1, new TGeoCombiTrans(-5, 65, -102, new TGeoRotation("R2", 0, 60, 0))); top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(3, -88, -103, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(12, -88, -103, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(-7, -88, -103, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(3, 88, -103, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(12, 88, -103, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last_b, 1, new TGeoCombiTrans(-7, 88, -103, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(3, -88, -112, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(12, -88, -112, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(-7, -88, -112, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(3, 88, -112, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(12, 88, -112, new TGeoRotation("R2", 0, 180, 0))); top->AddNodeOverlap(Last, 1, new TGeoCombiTrans(-7, 88, -112, new TGeoRotation("R2", 0, 180, 0))); for (int i = 1; i < 20; i += 1) { if (i < 7) { TGeoVolume *Effect = Robot->MakeCons("Effect", Iron, 3, 20 / sin(i), 21 / sin(i), 20 / sin(i), 21 / sin(i), 0, 70); Effect->SetLineColor(9); Effect->SetFillColor(9); top->AddNodeOverlap(Effect, 1, new TGeoTranslation(3, 0, -280)); } if (6 < i && i < 10) { TGeoVolume *Effect = Robot->MakeCons("Effect", Iron, 5, 20 / sin(i), 21 / sin(i), 20 / sin(i), 21 / sin(i), 50, 120); Effect->SetLineColor(38); Effect->SetFillColor(38); top->AddNodeOverlap(Effect, 1, new TGeoTranslation(3, 0, -280)); } if (9 < i && i < 20) { TGeoVolume *Effect = Robot->MakeCons("Effect", Iron, 4, 20 / sin(i), 21 / sin(i), 20 / sin(i), 21 / sin(i), 200, 330); Effect->SetLineColor(33); Effect->SetFillColor(33); top->AddNodeOverlap(Effect, 1, new TGeoTranslation(3, 0, -280)); } } // close geometry top->SetVisibility(0); Robot->CloseGeometry(); // in GL viewer top->Draw("ogl"); }
void show ( char* inpDir = "", // MuDST directory char* inpFile = "show.lis", // MuDST file(s); char* outFile = "show.root",// output tree file Int_t nFiles = 50, // # of MuDST file(s) Int_t nEvents = 100 // # of events ) // remeber to adjust dbase timestamp below !!!! // what a ... design { //gErrorIgnoreLevel=1999; // load root/root4star libraries gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); loadSharedLibraries(); // load more libraries :) gSystem->Load("libmysqlclient"); gSystem->Load("libGeom"); gSystem->Load("StDbLib"); gSystem->Load("StDbBroker"); gSystem->Load("St_db_Maker"); // load even more libraries (EEMC stuff) gSystem->Load("StEEmcUtil"); gSystem->Load("StEEmcDbMaker"); gSystem->Load("StEEmcPoolTTM"); // create the chain chain = new StChain("StChain"); // now = new TDatime; // for display TCanvas *c1 = new TCanvas("eemc","eemc",10,10,1000,1000); TPaveLabel *tlab = new TPaveLabel(-0.99,+0.99,+0.99,+0.90, "EEMC TOWERS & TPC TRACKS Piotr A Zolnierczuk (IU)"); eventInfo = new TPaveText (-0.99,-0.99,+0.0 ,-0.75); dateInfo = new TPaveLabel(+0.60,-0.99,+0.99,-0.95,now->AsString()); TGeoManager *gm = new TGeoManager("eemc", "eemc tower display"); TGeoVolume *top = gm->MakeBox("star",0, 200., 200., 350.); TGeoVolume *smbox = gm->MakeBox("smbox1",0, 2., 2., 2.); smbox->SetLineColor(kRed); // eemc eemc = new EEmcTTDisplay(); eemc->SetMagneticField(0.5); // in Tesla eemc->SetShowExtrapolatedTracks(true); TGeoTranslation *etra = new TGeoTranslation(0.0,0.0,0.5*(eemc->getZ1()+eemc->getZ2())); top->AddNode(smbox, 1,NULL); top->AddNode(eemc(),1,etra); gm->SetTopVolume(top); gm->CloseGeometry(); gm->SetVisLevel(4); gm->SetVisOption(0); c1->SetTheta(90); c1->SetPhi(0); top->Draw(); tlab->Draw(); gPad->Update(); // now we add Makers to the chain... some of that is black magic :) muDstMk = new StMuDstMaker(0,0,inpDir,inpFile,"",nFiles); // muDST main chain StMuDbReader *db = StMuDbReader::instance(); // need the database St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb"); // need another db(?) new StEEmcDbMaker("eemcDb"); // need EEMC database // now comment in/out/change the below if you want it your way dbMk->setTimeStampDay(20040331); // format: yyyymmdd // finally after so many lines we arrive at the good stuff ttm = new EEmcTTMMaker ("TTM",muDstMk,eemcDbMk); ttm->Summary(cout); // StMuDebug::setLevel(0); chain->Init(); StEEmcDb *eemcDb = (StEEmcDb*)chain->GetDataSet("StEEmcDb"); eemcDb->setSectors(1,12); // request EEMC DB for sectors you need (dafault:1-12) eemcDb->setPreferedFlavor("onlped","eemcPMTped"); // request alternative flavor chain->ls(3); //--------------------------------------------------- next(); }
/** * Initialise ROOT geometry objects from GEAR objects * * @param geomName name of ROOT geometry object * @param dumpRoot dump automatically generated ROOT geometry file for further inspection */ void EUTelGeometryTelescopeGeoDescription::initializeTGeoDescription( std::string const & geomName, bool dumpRoot = false ) { if( _isGeoInitialized ) { streamlog_out( WARNING3 ) << "EUTelGeometryTelescopeGeoDescription: Geometry already initialized, using old initialization" << std::endl; return; } else { _geoManager = std::make_unique<TGeoManager>("Telescope", "v0.1"); _geoManager->SetBit(kCanDelete); } if( !_geoManager ) { streamlog_out( ERROR3 ) << "Can't instantiate ROOT TGeoManager " << std::endl; return; } // Create top world volume containing telescope geometry // Create air mixture // see http://pdg.lbl.gov/2013/AtomicNuclearProperties/HTML_PAGES/104.html double air_density = 1.2e-3; // g/cm^3 double air_radlen = 36.62; // g/cm^2 //Must be -ve to use this value rather than internal one calculated. TGeoMixture* pMatAir = new TGeoMixture("AIR",3,air_density); pMatAir->DefineElement(0, 14.007, 7., 0.755267 ); //Nitrogen pMatAir->DefineElement(1, 15.999, 8., 0.231781 ); //Oxygen pMatAir->DefineElement(2, 39.948, 18., 0.012827 ); //Argon pMatAir->DefineElement(3, 12.011, 6., 0.000124 ); //Carbon pMatAir->SetRadLen( air_radlen ); // Medium: medium_World_AIR TGeoMedium* pMedAir = new TGeoMedium("medium_World_AIR", 3, pMatAir ); // The World is the 10 x 10m x 10m box filled with air mixture Double_t dx,dy,dz; dx = 5000.000000; // [mm] dy = 5000.000000; // [mm] dz = 5000.000000; // [mm] TGeoShape *pBoxWorld = new TGeoBBox("Box_World", dx,dy,dz); // Volume: volume_World TGeoVolume* pvolumeWorld = new TGeoVolume("volume_World",pBoxWorld, pMedAir); pvolumeWorld->SetLineColor(4); pvolumeWorld->SetLineWidth(3); pvolumeWorld->SetVisLeaves(kTRUE); // Set top volume of geometry gGeoManager->SetTopVolume( pvolumeWorld ); IntVec::const_iterator itrPlaneId; for ( itrPlaneId = _sensorIDVec.begin(); itrPlaneId != _sensorIDVec.end(); ++itrPlaneId ) { translateSiPlane2TGeo(pvolumeWorld, *itrPlaneId ); } _geoManager->CloseGeometry(); _isGeoInitialized = true; // Dump ROOT TGeo object into file if ( dumpRoot ) _geoManager->Export( geomName.c_str() ); for(auto& mapEntry: _planePath) { auto pathName = mapEntry.second; auto sensorID = mapEntry.first; _geoManager->cd( pathName.c_str() ); _TGeoMatrixMap[sensorID] = _geoManager->GetCurrentNode()->GetMatrix(); } return; }
drawFGT(TString volName="") { gSystem->Load("libGeom"); gSystem->Load("libGdml"); TGeoManager::Import("fgt.gdml"); gGeoManager->DefaultColors(); bool allSolid=true; char topVol[] ="volWorld"; //char topVol[] ="volDetEnclosure"; //char topVol[] ="volDetector"; //char topVol[] ="volMuIDDownstream"; //char topVol[] ="volMuIDBarrel"; //char topVol[] ="volRPCMod"; //char topVol[] ="volRPCTray_End"; //char topVol[] ="volECALDownstream"; //char topVol[] ="volECALUpstream"; //char topVol[] ="volBarrelECAL"; //char topVol[] ="volSBPlane"; //char topVol[] ="volSTT"; //char topVol[] ="volSTPlaneTarget"; //char topVol[] ="volSTPlaneRadiator"; //char topVol[] ="volTargetPlaneArgon"; gGeoManager->GetVolume("volDetEnclosure")->SetLineColor(kGray); gGeoManager->GetVolume("volDetEnclosure")->SetVisibility(1); gGeoManager->GetVolume("volDetEnclosure")->SetTransparency(20); gGeoManager->GetVolume("volDirtLayer")->SetTransparency(20); gGeoManager->GetVolume("volServiceBuilding")->SetLineColor(kGray); gGeoManager->GetVolume("volServiceBuilding")->SetVisibility(1); gGeoManager->GetVolume("volServiceBuilding")->SetTransparency(20); gGeoManager->GetVolume("volSky")->SetLineColor(kWhite); gGeoManager->GetVolume("volSky")->SetVisibility(1); gGeoManager->GetVolume("volSky")->SetTransparency(20); gGeoManager->GetVolume("volMagnet")->SetLineColor(kGreen-1); gGeoManager->GetVolume("volMagnet")->SetVisibility(1); if(!allSolid) gGeoManager->GetVolume("volMagnet")->SetTransparency(10); gGeoManager->GetVolume("volECALBarrelMod")->SetLineColor(kRed); gGeoManager->GetVolume("volECALBarrelMod")->SetVisibility(1); if(!allSolid) gGeoManager->GetVolume("volECALBarrelMod")->SetTransparency(75); gGeoManager->GetVolume("volSBPlane")->SetLineColor(kRed-3); gGeoManager->GetVolume("volSBPlane")->SetVisibility(1); if(!allSolid) gGeoManager->GetVolume("volSBPlane")->SetTransparency(80); /* gGeoManager->GetVolume("volECALUpstream")->SetLineColor(kYellow-3); gGeoManager->GetVolume("volECALUpstream")->SetVisibility(1); gGeoManager->GetVolume("volECALUpstream")->SetTransparency(20); gGeoManager->GetVolume("volECALDownstream")->SetLineColor(kYellow-3); gGeoManager->GetVolume("volECALDownstream")->SetVisibility(1); gGeoManager->GetVolume("volECALDownstream")->SetTransparency(20); */ TObjArray* va = gGeoManager->GetListOfVolumes(); int nv = va->GetEntries(); for (int i=0; i<nv; ++i) { TGeoVolume* v = (TGeoVolume*)va->At(i); std::string m(v->GetMaterial()->GetName()); //cout << v->GetMaterial()->GetName() << endl; int lc, vi, tr, vd; if (m == "Scintillator") { lc = kGreen-7 ; vi = 1; tr = 0; vd = 1; v->SetLineColor(lc); v->SetVisibility(vi); v->VisibleDaughters(vd); v->SetTransparency(tr); } //else { // continue; //std::cout << "'" << m << "' has no defaults" << std::endl; //lc = kOrange; vi = 0; tr = 50; vd = 1; //} } //gGeoManager->GetTopNode(); gGeoManager->CheckOverlaps(1e-5,"d"); gGeoManager->PrintOverlaps(); //gGeoManager->FindVolumeFast(topVol)->CheckOverlaps(1e-5,"d"); //gGeoManager->FindVolumeFast(topVol)->GetNode(0)->PrintOverlaps(); gGeoManager->SetMaxVisNodes(70000); gGeoManager->FindVolumeFast(topVol)->Draw("ogl"); TFile *tf = new TFile("drawFGT.root", "RECREATE"); gGeoManager->Write(); tf->Close(); }
int main(int argc, char * argv[]) { TApplication app("app", &argc, argv); plottingEngine.SetDefaultStyle(); const bool debug = true; // Load the field map. ComponentAnsys123* fm = new ComponentAnsys123(); const std::string efile = "ELIST.lis"; const std::string nfile = "NLIST.lis"; const std::string mfile = "MPLIST.lis"; const std::string sfile = "PRNSOL.lis"; fm->Initialise(efile, nfile, mfile, sfile, "mm"); fm->EnableMirrorPeriodicityX(); fm->EnableMirrorPeriodicityY(); fm->PrintRange(); // Dimensions of the GEM const double pitch = 0.014; const double kapton = 50.e-4; const double metal = 5.e-4; const double outdia = 70.e-4; const double middia = 50.e-4; const bool plotField = false; if (plotField) { ViewField* fieldView = new ViewField(); fieldView->SetComponent(fm); fieldView->SetPlane(0., -1., 0., 0., 0., 0.); fieldView->SetArea(-pitch / 2., -0.02, pitch / 2., 0.02); fieldView->SetVoltageRange(-160., 160.); TCanvas* cF = new TCanvas(); fieldView->SetCanvas(cF); fieldView->PlotContour(); } // Setup the gas. MediumMagboltz* gas = new MediumMagboltz(); gas->SetComposition("ar", 70., "co2", 30.); gas->SetTemperature(293.15); gas->SetPressure(760.); gas->EnableDebugging(); gas->Initialise(); gas->DisableDebugging(); // Set the Penning transfer efficiency. const double rPenning = 0.57; const double lambdaPenning = 0.; gas->EnablePenningTransfer(rPenning, lambdaPenning, "ar"); // Load the ion mobilities. gas->LoadIonMobility("IonMobility_Ar+_Ar.txt"); // Associate the gas with the corresponding field map material. const int nMaterials = fm->GetNumberOfMaterials(); for (int i = 0; i < nMaterials; ++i) { const double eps = fm->GetPermittivity(i); if (fabs(eps - 1.) < 1.e-3) fm->SetMedium(i, gas); } fm->PrintMaterials(); // Create the sensor. Sensor* sensor = new Sensor(); sensor->AddComponent(fm); sensor->SetArea(-5 * pitch, -5 * pitch, -0.03, 5 * pitch, 5 * pitch, 0.03); AvalancheMicroscopic* aval = new AvalancheMicroscopic(); aval->SetSensor(sensor); AvalancheMC* drift = new AvalancheMC(); drift->SetSensor(sensor); drift->SetDistanceSteps(2.e-4); const bool plotDrift = true; ViewDrift* driftView = new ViewDrift(); if (plotDrift) { driftView->SetArea(-2 * pitch, -2 * pitch, -0.02, 2 * pitch, 2 * pitch, 0.02); // Plot every 10 collisions (in microscopic tracking). aval->SetCollisionSteps(10); aval->EnablePlotting(driftView); drift->EnablePlotting(driftView); } // Histograms int nBinsGain = 100; double gmin = 0.; double gmax = 100.; TH1F* hElectrons = new TH1F("hElectrons", "Number of electrons", nBinsGain, gmin, gmax); TH1F* hIons = new TH1F("hIons", "Number of ions", nBinsGain, gmin, gmax); int nBinsChrg = 100; TH1F* hChrgE = new TH1F("hChrgE", "Electrons on plastic", nBinsChrg, -0.5e4 * kapton, 0.5e4 * kapton); TH1F* hChrgI = new TH1F("hChrgI", "Ions on plastic", nBinsChrg, -0.5e4 * kapton, 0.5e4 * kapton); double sumIonsTotal = 0.; double sumIonsDrift = 0.; double sumIonsPlastic = 0.; double sumElectronsTotal = 0.; double sumElectronsPlastic = 0.; double sumElectronsUpperMetal = 0.; double sumElectronsLowerMetal = 0.; double sumElectronsTransfer = 0.; double sumElectronsOther = 0.; const int nEvents = 10; for (int i = nEvents; i--;) { if (debug || i % 10 == 0) std::cout << i << "/" << nEvents << "\n"; // Randomize the initial position. const double smear = pitch / 2.; double x0 = -smear + RndmUniform() * smear; double y0 = -smear + RndmUniform() * smear; double z0 = 0.025; double t0 = 0.; double e0 = 0.1; aval->AvalancheElectron(x0, y0, z0, t0, e0, 0., 0., 0.); int ne = 0, ni = 0; aval->GetAvalancheSize(ne, ni); hElectrons->Fill(ne); hIons->Fill(ni); const int np = aval->GetNumberOfElectronEndpoints(); double xe1, ye1, ze1, te1, e1; double xe2, ye2, ze2, te2, e2; double xi1, yi1, zi1, ti1; double xi2, yi2, zi2, ti2; int status; for (int j = np; j--;) { aval->GetElectronEndpoint(j, xe1, ye1, ze1, te1, e1, xe2, ye2, ze2, te2, e2, status); sumElectronsTotal += 1.; if (ze2 > -kapton / 2. && ze2 < kapton / 2.) { hChrgE->Fill(ze2 * 1.e4); sumElectronsPlastic += 1.; } else if (ze2 >= kapton / 2. && ze2 <= kapton / 2. + metal) { sumElectronsUpperMetal += 1.; } else if (ze2 <= -kapton / 2. && ze2 >= -kapton / 2. - metal) { sumElectronsLowerMetal += 1.; } else if (ze2 < -kapton / 2. - metal) { sumElectronsTransfer += 1.; } else { sumElectronsOther += 1.; } drift->DriftIon(xe1, ye1, ze1, te1); drift->GetIonEndpoint(0, xi1, yi1, zi1, ti1, xi2, yi2, zi2, ti2, status); if (zi1 < 0.01) { sumIonsTotal += 1.; if (zi2 > 0.01) sumIonsDrift += 1.; } if (zi2 > -kapton / 2. && zi2 < kapton / 2.) { hChrgI->Fill(zi2 * 1.e4); sumIonsPlastic += 1.; } } } double fFeedback = 0.; if (sumIonsTotal > 0.) fFeedback = sumIonsDrift / sumIonsTotal; std::cout << "Fraction of ions drifting back: " << fFeedback << "\n"; const double neMean = hElectrons->GetMean(); std::cout << "Mean number of electrons: " << neMean << "\n"; const double niMean = hIons->GetMean(); std::cout << "Mean number of ions: " << niMean << "\n"; std::cout << "Mean number of electrons on plastic: " << sumElectronsPlastic / nEvents << "\n"; std::cout << "Mean number of ions on plastic: " << sumIonsPlastic / nEvents << "\n"; std::cout << "Electron endpoints:\n"; const double fUpperMetal = sumElectronsUpperMetal / sumElectronsTotal; const double fPlastic = sumElectronsPlastic / sumElectronsTotal; const double fLowerMetal = sumElectronsLowerMetal / sumElectronsTotal; const double fTransfer = sumElectronsTransfer / sumElectronsTotal; const double fOther = sumElectronsOther / sumElectronsTotal; std::cout << " upper metal: " << fUpperMetal * 100. << "%\n"; std::cout << " plastic: " << fPlastic * 100. << "%\n"; std::cout << " lower metal: " << fLowerMetal * 100. << "%\n"; std::cout << " transfer: " << fTransfer * 100. << "%\n"; std::cout << " other: " << fOther * 100. << "%\n"; TCanvas* cD = new TCanvas(); const bool plotGeo = true; if (plotGeo && plotDrift) { // Build the geometry in Root. TGeoManager* geoman = new TGeoManager("world", "geometry"); TGeoMaterial* matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0); TGeoMedium* medVacuum = new TGeoMedium("Vacuum", 1, matVacuum); TGeoMaterial* matKapton = new TGeoMaterial("Kapton", 12, 6, 1.42); TGeoMedium* medKapton = new TGeoMedium("Kapton", 2, matKapton); TGeoMaterial* matCopper = new TGeoMaterial("Copper", 63, 29, 8.94); TGeoMedium* medCopper = new TGeoMedium("Copper", 3, matCopper); TGeoVolume* volTop = geoman->MakeBox("TOP", medVacuum, pitch, pitch, 0.02); volTop->SetVisibility(0); TGeoBBox* shpKapton = new TGeoBBox("K", pitch / 2., pitch / 2., kapton / 2.); TGeoPcon* shpHole = new TGeoPcon("H", 0., 360., 3); shpHole->DefineSection(0, -kapton / 2., 0., outdia / 2.); shpHole->DefineSection(1, 0., 0., middia / 2.); shpHole->DefineSection(2, kapton / 2., 0., outdia / 2.); TGeoCompositeShape* shpGem = new TGeoCompositeShape("G", "K - H"); TGeoVolume* volKapton = new TGeoVolume("Kapton", shpGem, medKapton); volKapton->SetLineColor(kGreen); volKapton->SetTransparency(50); TGeoBBox* shpMetal = new TGeoBBox("M", pitch / 2., pitch / 2., metal / 2.); TGeoTube* shpTube = new TGeoTube("T", 0., outdia / 2., metal / 2.); TGeoCompositeShape* shpElectrode = new TGeoCompositeShape("E", "M - T"); TGeoVolume* volElectrode = new TGeoVolume("Electrode", shpElectrode, medCopper); volElectrode->SetLineColor(kBlue); volElectrode->SetTransparency(50); TGeoVolumeAssembly* volGem = new TGeoVolumeAssembly("Gem"); const double shift = 0.5 * (metal + kapton); volGem->AddNode(volKapton, 1); volGem->AddNode(volElectrode, 2, new TGeoTranslation(0., 0., shift)); volGem->AddNode(volElectrode, 3, new TGeoTranslation(0., 0., -shift)); volTop->AddNode(volGem, 1); volTop->AddNode(volGem, 2, new TGeoTranslation(-pitch, 0., 0.)); volTop->AddNode(volGem, 3, new TGeoTranslation(+pitch, 0., 0.)); volTop->AddNode(volGem, 4, new TGeoTranslation(-pitch / 2., sqrt(3) * pitch / 2., 0.)); volTop->AddNode(volGem, 5, new TGeoTranslation(+pitch / 2., sqrt(3) * pitch / 2., 0.)); volTop->AddNode(volGem, 6, new TGeoTranslation(-pitch / 2., -sqrt(3) * pitch / 2., 0.)); volTop->AddNode(volGem, 7, new TGeoTranslation(+pitch / 2., -sqrt(3) * pitch / 2., 0.)); geoman->SetVerboseLevel(0); geoman->SetTopVolume(volTop); geoman->CloseGeometry(); geoman->CheckOverlaps(0.1e-4); geoman->SetNmeshPoints(100000); cD->cd(); geoman->GetTopVolume()->Draw("ogl"); } if (plotDrift) { driftView->SetCanvas(cD); driftView->Plot(); } const bool plotHistogram = true; if (plotHistogram) { TCanvas* cH = new TCanvas("cH", "Histograms", 800, 700); cH->Divide(2, 2); cH->cd(1); hElectrons->Draw(); cH->cd(2); hIons->Draw(); cH->cd(3); hChrgE->Draw(); cH->cd(4); hChrgI->Draw(); } app.Run(kTRUE); }
void nucleus(Int_t nProtons = 40,Int_t nNeutrons = 60) { Double_t NeutronRadius = 60, ProtonRadius = 60, NucleusRadius, distance = 60; Double_t vol = nProtons + nNeutrons; vol = 3 * vol / (4 * TMath::Pi()); NucleusRadius = distance * TMath::Power(vol, 1./3.); // cout << "NucleusRadius: " << NucleusRadius << endl; TGeoManager * geom = new TGeoManager("nucleus", "Model of a nucleus"); geom->SetNsegments(40); TGeoMaterial *matEmptySpace = new TGeoMaterial("EmptySpace", 0, 0, 0); TGeoMaterial *matProton = new TGeoMaterial("Proton" , .938, 1., 10000.); TGeoMaterial *matNeutron = new TGeoMaterial("Neutron" , .935, 0., 10000.); TGeoMedium *EmptySpace = new TGeoMedium("Empty", 1, matEmptySpace); TGeoMedium *Proton = new TGeoMedium("Proton", 1, matProton); TGeoMedium *Neutron = new TGeoMedium("Neutron",1, matNeutron); // the space where the nucleus lives (top container volume) Double_t worldx = 200.; Double_t worldy = 200.; Double_t worldz = 200.; TGeoVolume *top = geom->MakeBox("WORLD", EmptySpace, worldx, worldy, worldz); geom->SetTopVolume(top); TGeoVolume * proton = geom->MakeSphere("proton", Proton, 0., ProtonRadius); TGeoVolume * neutron = geom->MakeSphere("neutron", Neutron, 0., NeutronRadius); proton->SetLineColor(kRed); neutron->SetLineColor(kBlue); Double_t x, y, z, dummy; Int_t i = 0; while ( i< nProtons) { gRandom->Rannor(x, y); gRandom->Rannor(z,dummy); if ( TMath::Sqrt(x*x + y*y + z*z) < 1) { x = (2 * x - 1) * NucleusRadius; y = (2 * y - 1) * NucleusRadius; z = (2 * z - 1) * NucleusRadius; top->AddNode(proton, i, new TGeoTranslation(x, y, z)); i++; } } i = 0; while ( i < nNeutrons) { gRandom->Rannor(x, y); gRandom->Rannor(z,dummy); if ( TMath::Sqrt(x*x + y*y + z*z) < 1) { x = (2 * x - 1) * NucleusRadius; y = (2 * y - 1) * NucleusRadius; z = (2 * z - 1) * NucleusRadius; top->AddNode(neutron, i + nProtons, new TGeoTranslation(x, y, z)); i++; } } geom->CloseGeometry(); geom->SetVisLevel(4); top->Draw("ogl"); }
TGeoVolume *VP_SimpleECal(int nphi = 4, int nz = 3, double density = 8.28) { const double world_x = 9000.; const double world_y = 9000.; const double world_z = 16000; TGeoManager *geom = new TGeoManager("SimpleECal", "Simplification of the CMS ECal"); TGeoMaterial *world_mat = new TGeoMaterial("world", 1, 2, 0); TGeoMedium *world_med = new TGeoMedium("world_medium", 0, world_mat); TGeoVolume *world = geom->MakeBox("top", world_med, world_x, world_y, world_z); geom->SetTopVolume(world); geom->SetTopVisible(1); int crystal_nphi = nphi; int crystal_nz = nz; double ecal_density = density; const int crystal_n = crystal_nphi * crystal_nz; const double ecal_zmin = -3000.; const double ecal_zmax = 3000.; const double ecal_rmin = 10.; const double ecal_rmax = 5000.; const double ecal_dz = 0.5 * (ecal_zmax - ecal_zmin) / crystal_nz; const double ecal_sphi = 0.; // const G4double ecal_dphi = 2.0*M_PI/crystal_nphi; // G4 seems to be in radian while TGeo seems to be in degree. // const double ecal_dphi = 2.0*TMath::Pi()/crystal_nphi; const double ecal_dphi = 2.0 * 180 / crystal_nphi; int iptr = 0; TGeoElementTable *table = gGeoManager->GetElementTable(); // TGeoElement* elPb = new TGeoElement( "Lead", "Pb", 82., 207.19*g/mole ); // TGeoElement* elW = new TGeoElement( "Tungstenm", "W",74., 183.85*g/mole); // TGeoElement* elO = new TGeoElement( "Oxygen", "O2", 8., 16.*g/mole ); TGeoElement *elPb = table->GetElement(82); TGeoElement *elW = table->GetElement(74); TGeoElement *elO = table->GetElement(8); // TGeoMaterial *ecal_mat = new TGeoMaterial("ecal",90,120,density); TGeoMixture *ecal_mat = new TGeoMixture("ecal_mat", 3, density); ecal_mat->AddElement(elPb, 1); ecal_mat->AddElement(elW, 1); ecal_mat->AddElement(elO, 4); TGeoMedium *ecal_med = new TGeoMedium("ecal_med", 0, ecal_mat); for (int j = 0; j < crystal_nz; ++j) { for (int i = 0; i < crystal_nphi; ++i) { iptr = i + j * crystal_nphi; TGeoVolume *ecal = geom->MakeTubs(TString::Format("ecal-%d-%d", j, i), ecal_med, ecal_rmin, ecal_rmax, ecal_dz, ecal_sphi + i * ecal_dphi, ecal_sphi + (i + 1) * ecal_dphi); ecal->SetLineColor(iptr); // top->AddNode(ecal,1,new TGeoCombiTrans(0,0,0,new TGeoRotation("ecal",0,0,0))); // GPThreeVector ecal_trans = GPThreeVector_create(0,0,ecal_zmin+(2.0*j+1.0)*ecal_dz); double dx = 0.0; double dy = 0.0; double dz = ecal_zmin + (2.0 * j + 1.0) * ecal_dz; TGeoTranslation *ecal_trans = new TGeoTranslation("", dx, dy, dz); // GPLogicalVolume_Constructor(ecal_log+iptr, (GPVSolid*)ecal, ecal_mat); // GPVPhysicalVolume_Constructor(ecal_phy+iptr, idRot, ecal_trans, ecal_log+iptr); world->AddNode(ecal, iptr, ecal_trans); // Set mother // GPVPhysicalVolume_SetMotherLogical(ecal_phy+iptr, world_log); // addLogicalVolumePointers( ecal_log+iptr); // addPhysicalVolumePointers( ecal_phy+iptr); } } // add daughter volume // for ( int j=0; j < crystal_nz ; ++j ) { // for ( int i=0; i < crystal_nphi ; ++i ) { // iptr = i+j*crystal_nphi; // addLogicalVolumeDaughter( world_log, ecal_phy+iptr); // } // } // Register world volume pointers for relocation // addLogicalVolumePointers( world_log ); // addPhysicalVolumePointers( world_phy ); geom->CloseGeometry(); return world; }
void assembly() { //--- Definition of a simple geometry gSystem->Load("libGeom"); TGeoManager *geom = new TGeoManager("Assemblies", "Geometry using assemblies"); Int_t i; //--- define some materials TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0); TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); // //--- define some media TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum); TGeoMedium *Al = new TGeoMedium("Aluminium",2, matAl); //--- make the top container volume TGeoVolume *top = geom->MakeBox("TOP", Vacuum, 1000., 1000., 100.); geom->SetTopVolume(top); // Make the elementary assembly of the whole structure TGeoVolume *tplate = new TGeoVolumeAssembly("TOOTHPLATE"); Int_t ntooth = 5; Double_t xplate = 25; Double_t yplate = 50; Double_t xtooth = 10; Double_t ytooth = 0.5*yplate/ntooth; Double_t dshift = 2.*xplate + xtooth; Double_t xt,yt; TGeoVolume *plate = geom->MakeBox("PLATE", Al, xplate,yplate,1); plate->SetLineColor(kBlue); TGeoVolume *tooth = geom->MakeBox("TOOTH", Al, xtooth,ytooth,1); tooth->SetLineColor(kBlue); tplate->AddNode(plate,1); for (i=0; i<ntooth; i++) { xt = xplate+xtooth; yt = -yplate + (4*i+1)*ytooth; tplate->AddNode(tooth, i+1, new TGeoTranslation(xt,yt,0)); xt = -xplate-xtooth; yt = -yplate + (4*i+3)*ytooth; tplate->AddNode(tooth, ntooth+i+1, new TGeoTranslation(xt,yt,0)); } TGeoRotation *rot1 = new TGeoRotation(); rot1->RotateX(90); TGeoRotation *rot; // Make a hexagone cell out of 6 tooth plates. These can zip together // without generating overlaps (they are self-contained) TGeoVolume *cell = new TGeoVolumeAssembly("CELL"); for (i=0; i<6; i++) { Double_t phi = 60.*i; Double_t phirad = phi*TMath::DegToRad(); Double_t xp = dshift*TMath::Sin(phirad); Double_t yp = -dshift*TMath::Cos(phirad); rot = new TGeoRotation(*rot1); rot->RotateZ(phi); cell->AddNode(tplate,i+1,new TGeoCombiTrans(xp,yp,0,rot)); } // Make a row as an assembly of cells, then combine rows in a honeycomb // structure. This again works without any need to define rows as // "overlapping" TGeoVolume *row = new TGeoVolumeAssembly("ROW"); Int_t ncells = 5; for (i=0; i<ncells; i++) { Double_t ycell = (2*i+1)*(dshift+10); row->AddNode(cell, ncells+i+1, new TGeoTranslation(0,ycell,0)); row->AddNode(cell,ncells-i,new TGeoTranslation(0,-ycell,0)); } Double_t dxrow = 3.*(dshift+10.)*TMath::Tan(30.*TMath::DegToRad()); Double_t dyrow = dshift+10.; Int_t nrows = 5; for (i=0; i<nrows; i++) { Double_t xrow = 0.5*(2*i+1)*dxrow; Double_t yrow = 0.5*dyrow; if ((i%2)==0) yrow = -yrow; top->AddNode(row, nrows+i+1, new TGeoTranslation(xrow,yrow,0)); top->AddNode(row, nrows-i, new TGeoTranslation(-xrow,-yrow,0)); } //--- close the geometry geom->CloseGeometry(); geom->SetVisLevel(4); geom->SetVisOption(0); top->Draw(); }
void snoopy() { TGeoManager *geom = new TGeoManager("snoopy", "Snoopy Detector"); // define some materials TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0); TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98, 13, 2.7); TGeoMaterial *matFe = new TGeoMaterial("Fe", 55.84, 26, 7.9); // define some media TGeoMedium *Vacuum = new TGeoMedium("Vacuum", 1, matVacuum); TGeoMedium *Al = new TGeoMedium("Al", 2, matAl); TGeoMedium *Fe = new TGeoMedium("Fe", 3, matFe); // create top volume TGeoVolume *top = geom->MakeBox("top", Vacuum, 600, 600, 2500); geom->SetTopVolume(top); geom->SetTopVisible(0); // first part of vacuum chamber up to veto station TGeoVolume *tub1 = geom->MakeTube("tub1", Al, 245, 250, 50); tub1->SetLineColor(18); // silver/gray top->AddNode(tub1, 1, new TGeoTranslation(0, 0, -2450)); // veto station TGeoBBox *detbox1 = new TGeoBBox("detbox1", 250, 250, 10); TGeoBBox *detbox2 = new TGeoBBox("detbox2", 245, 245, 10); TGeoCompositeShape *detcomp1 = new TGeoCompositeShape("detcomp1", "detbox1-detbox2"); TGeoVolume *det1 = new TGeoVolume("det1", detcomp1,Vacuum); det1->SetLineColor(kRed); top->AddNode(det1, 1, new TGeoTranslation(0, 0, -2390)); TGeoRotation r0; r0.SetAngles(15,0,0); TGeoTranslation t0(0, 0, -2370); TGeoCombiTrans c0(t0, r0); TGeoHMatrix *h0 = new TGeoHMatrix(c0); top->AddNode(det1, 11, h0); // second part of vacuum chamber up to first tracking station TGeoVolume *tub2 = geom->MakeTube("tub2", Al, 245, 250, 3880/2); // 1890 tub2->SetLineColor(18); top->AddNode(tub2, 1, new TGeoTranslation(0, 0, -440)); // tracking station 1 top->AddNode(det1, 2, new TGeoTranslation(0, 0, 1510)); TGeoRotation r1; r1.SetAngles(15,0,0); TGeoTranslation t1(0, 0, 1530); TGeoCombiTrans c1(t1, r1); TGeoHMatrix *h1 = new TGeoHMatrix(c1); top->AddNode(det1, 3, h1); // third part of vacuum chamber up to second tracking station TGeoVolume *tub3 = geom->MakeTube("tub3", Al, 245, 250, 80); tub3->SetLineColor(18); top->AddNode(tub3, 1, new TGeoTranslation(0, 0, 1620)); // tracking station 2 top->AddNode(det1, 4, new TGeoTranslation(0, 0, 1710)); TGeoRotation r2; r2.SetAngles(15,0,0); TGeoTranslation t2(0, 0, 1730); TGeoCombiTrans c2(t2, r2); TGeoHMatrix *h2 = new TGeoHMatrix(c2); top->AddNode(det1, 5, h2); // fourth part of vacuum chamber up to third tracking station and being covered by magnet TGeoVolume *tub4 = geom->MakeTube("tub4", Al, 245, 250, 200); tub4->SetLineColor(18); top->AddNode(tub4, 1, new TGeoTranslation(0, 0, 1940)); // magnet yoke TGeoBBox *magyoke1 = new TGeoBBox("magyoke1", 350, 350, 125); TGeoBBox *magyoke2 = new TGeoBBox("magyoke2", 250, 250, 126); TGeoCompositeShape *magyokec = new TGeoCompositeShape("magyokec", "magyoke1-magyoke2"); TGeoVolume *magyoke = new TGeoVolume("magyoke", magyokec, Fe); magyoke->SetLineColor(kBlue); //magyoke->SetTransparency(50); top->AddNode(magyoke, 1, new TGeoTranslation(0, 0, 1940)); // magnet TGeoTubeSeg *magnet1a = new TGeoTubeSeg("magnet1a", 250, 300, 35, 45, 135); TGeoTubeSeg *magnet1b = new TGeoTubeSeg("magnet1b", 250, 300, 35, 45, 135); TGeoTubeSeg *magnet1c = new TGeoTubeSeg("magnet1c", 250, 270, 125, 45, 60); TGeoTubeSeg *magnet1d = new TGeoTubeSeg("magnet1d", 250, 270, 125, 120, 135); // magnet composite shape matrices TGeoTranslation *m1 = new TGeoTranslation(0, 0, 160); m1->SetName("m1"); m1->RegisterYourself(); TGeoTranslation *m2 = new TGeoTranslation(0, 0, -160); m2->SetName("m2"); m2->RegisterYourself(); TGeoCompositeShape *magcomp1 = new TGeoCompositeShape("magcomp1", "magnet1a:m1+magnet1b:m2+magnet1c+magnet1d"); TGeoVolume *magnet1 = new TGeoVolume("magnet1", magcomp1, Fe); magnet1->SetLineColor(kYellow); top->AddNode(magnet1, 1, new TGeoTranslation(0, 0, 1940)); TGeoRotation m3; m3.SetAngles(180, 0, 0); TGeoTranslation m4(0, 0, 1940); TGeoCombiTrans m5(m4, m3); TGeoHMatrix *m6 = new TGeoHMatrix(m5); top->AddNode(magnet1, 2, m6); // tracking station 3 top->AddNode(det1, 6, new TGeoTranslation(0, 0, 2150)); TGeoRotation r3; r3.SetAngles(15,0,0); TGeoTranslation t3(0, 0, 2170); TGeoCombiTrans c3(t3, r3); TGeoHMatrix *h3 = new TGeoHMatrix(c3); top->AddNode(det1, 7, h3); // fifth part of vacuum chamber up to fourth tracking station TGeoVolume *tub5 = geom->MakeTube("tub5", Al, 245, 250, 90); tub5->SetLineColor(18); top->AddNode(tub5, 1, new TGeoTranslation(0, 0, 2270)); // tracking station 4 top->AddNode(det1, 8, new TGeoTranslation(0, 0, 2370)); TGeoRotation r4; r4.SetAngles(15,0,0); TGeoTranslation t4(0, 0, 2390); TGeoCombiTrans c4(t4, r4); TGeoHMatrix *h4 = new TGeoHMatrix(c4); top->AddNode(det1, 9, h4); // ecal TGeoVolume *ecal = geom->MakeBox("ecal", Al, 250, 250, 40); ecal->SetLineColor(6); // purple top->AddNode(ecal, 1, new TGeoTranslation(0, 0, 2440)); // muon filter TGeoVolume *muonfilter = geom->MakeBox("muonfilter", Al, 250, 250, 20); muonfilter->SetLineColor(kGreen); top->AddNode(muonfilter, 1, new TGeoTranslation(0, 0, 2500)); // sixth part of vacuum chamber up to muon detector TGeoVolume *tub6 = geom->MakeTube("tub6", Al, 245, 250, 20); tub6->SetLineColor(18); top->AddNode(tub6, 1, new TGeoTranslation(0, 0, 2540)); // muon detector top->AddNode(det1, 10, new TGeoTranslation(0, 0, 2570)); TGeoRotation r5; r5.SetAngles(15,0,0); TGeoTranslation t5(0, 0, 2590); TGeoCombiTrans c5(t5, r5); TGeoHMatrix *h5 = new TGeoHMatrix(c5); top->AddNode(det1, 12, h5); geom->CloseGeometry(); top->Draw("ogl"); geom->Export("snoopy.gdml"); }
//______________________________________________________________________________ AllPixDigitAnimation::AllPixDigitAnimation(int nx, int ny, double Lz, double pitchx, double pitchy,int nHits, int eventid) { // This class builds a geometry and tracks object to put simulated data // Lx,Ly,Lz are the dimensions of the box, inter, the interaction to be simulated, i and j ae ID for the // root file name f= new TFile(TString::Format("AllPixDigitAnimation_%d.root",eventid),"RECREATE"); Geo= new TGeoManager(TString::Format("Tracks_%d",eventid),"Digitization graphical representation"); emax = 2; shiftx=0; shifty=0; z_hit=Lz/2+2.5; Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0}; Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0}; Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0}; Double_t stop[] = {0., .25, .50, .75, 1.0}; Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 100); for (int i=0;i<100;i++) MyPalette[i] = FI+i; this->nx=nx; this->ny=ny; this->Lz=Lz; this->pitchx=pitchx; this->pitchy=pitchy; TGeoMedium *medium=0; top = Geo->MakeBox("TOP",medium,nx*pitchx/2,ny*pitchy/2,2*Lz/2); Geo->SetTopVolume(top); top->SetVisibility(false); TGeoVolume *Sensor = Geo->MakeBox("TOP",medium,nx*pitchx/2,ny*pitchy/2,Lz/2); Sensor->SetLineColor(kGray+1); top->AddNode(Sensor,1); Double_t ori[3]={0,0,0}; trackid=0; for(int i=0;i<nx;++i){ for(int j=0;j<ny;++j){ ori[0]=-(nx-1)*pitchx/2 + (i)*pitchx; ori[1]=-(ny-1)*pitchy/2 + (j)*pitchy; ori[2]=Lz/2 +0.5; PixBox= new TGeoBBox(TString::Format("Pix_%i_%i",i,j),(pitchx-0.1*pitchx)/2,(pitchy-0.1*pitchy)/2,1,ori); PixVolume =new TGeoVolume(TString::Format("Pix_%i_%i",i,j),PixBox); PixVolume->SetLineColor(kYellow -3); top->AddNode(PixVolume,1); };}; Geo->CloseGeometry(); top->SetLineColor(kMagenta); top->SetVisibility(kTRUE); top->Draw("ogle"); //Geo->SetTopVisible(); for(int i=0;i<nHits;i++){ Geo->AddTrack(i,100); //Geo->GetCurrentTrack()->SetLineWidth(1); //Geo->GetCurrentTrack()->SetMarkerSize(4); }; }
void create_sfi_geo(const char* geoTag) { //fGlobalTrans->SetTranslation(0.0,0.0,0.0); // ------- Load media from media file ----------------------------------- FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader"); FairGeoInterface* geoFace = geoLoad->getGeoInterface(); TString geoPath = gSystem->Getenv("VMCWORKDIR"); TString medFile = geoPath + "/geometry/media_r3b.geo"; geoFace->setMediaFile(medFile); geoFace->readMedia(); gGeoMan = gGeoManager; // -------------------------------------------------------------------------- // ------- Geometry file name (output) ---------------------------------- TString geoFileName = geoPath + "/geometry/sfi_"; geoFileName = geoFileName + geoTag + ".geo.root"; // -------------------------------------------------------------------------- // ----------------- Get and create the required media ----------------- FairGeoMedia* geoMedia = geoFace->getMedia(); FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder(); FairGeoMedium* mAir = geoMedia->getMedium("Air"); if ( ! mAir ) Fatal("Main", "FairMedium Air not found"); geoBuild->createMedium(mAir); TGeoMedium* pMed2 = gGeoMan->GetMedium("Air"); if ( ! pMed2 ) Fatal("Main", "Medium Air not found"); FairGeoMedium* mVac = geoMedia->getMedium("vacuum"); if ( ! mVac ) Fatal("Main", "FairMedium vacuum not found"); geoBuild->createMedium(mVac); TGeoMedium* pMed1 = gGeoMan->GetMedium("vacuum"); if ( ! pMed1 ) Fatal("Main", "Medium vacuum not found"); FairGeoMedium* mGfi = geoMedia->getMedium("plasticForGFI"); if ( ! mGfi ) Fatal("Main", "FairMedium plasticForGFI not found"); geoBuild->createMedium(mGfi); TGeoMedium* pMed35 = gGeoMan->GetMedium("plasticForGFI"); if ( ! pMed35 ) Fatal("Main", "Medium plasticForGFI not found"); FairGeoMedium* mAl = geoMedia->getMedium("aluminium"); if ( ! mAl ) Fatal("Main", "FairMedium aluminium not found"); geoBuild->createMedium(mAl); TGeoMedium* pMed21 = gGeoMan->GetMedium("aluminium"); if ( ! pMed21 ) Fatal("Main", "Medium aluminium not found"); // -------------------------------------------------------------------------- // -------------- Create geometry and top volume ------------------------- gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom"); gGeoMan->SetName("GFIgeom"); TGeoVolume* top = new TGeoVolumeAssembly("TOP"); gGeoMan->SetTopVolume(top); // -------------------------------------------------------------------------- //LABPOS(GFI1,-73.274339,0.069976,513.649524) Float_t dx = -73.274339; //dE tracker, correction due to wrong angle Float_t dy = 0.069976; Float_t dz = 513.649524; TGeoRotation *pMatrix3 = new TGeoRotation(); //pMatrix3->RotateY(-16.7); TGeoCombiTrans* pMatrix2 = new TGeoCombiTrans("", dx,dy,dz,pMatrix3); //LABPOS(GFI2,-147.135037,0.069976,729.680342) dx = -147.135037; //dE tracker, correction due to wrong angle dy = 0.069976; dz = 729.680342; TGeoRotation *pMatrix5 = new TGeoRotation(); //pMatrix5->RotateY(-16.7); TGeoCombiTrans* pMatrix4 = new TGeoCombiTrans("", dx,dy,dz,pMatrix5); // World definition TGeoVolume* pWorld = gGeoManager->GetTopVolume(); pWorld->SetVisLeaves(kTRUE); // SHAPES, VOLUMES AND GEOMETRICAL HIERARCHY // Volume: GFILogWorld TGeoVolume* pGFILogWorld = new TGeoVolumeAssembly("GFILogWorld"); pGFILogWorld->SetVisLeaves(kTRUE); // Global positioning pWorld->AddNode( pGFILogWorld, 0, pMatrix2 ); Float_t detector_size = 5.120000; Float_t fiber_thickness = 0.020000; TGeoShape *pGFITube = new TGeoBBox("GFITube", fiber_thickness/2,detector_size/2,fiber_thickness/2); TGeoVolume* pGFILog = new TGeoVolume("SFILog",pGFITube, pMed35); TGeoShape *pGFITubeActive = new TGeoBBox("GFITubeActive", (fiber_thickness * .98)/2, detector_size/2-0.0001, (fiber_thickness * .98)/2); TGeoVolume* pGFILogActive = new TGeoVolume("SFI1Log",pGFITubeActive,pMed35); pGFILog->SetLineColor((Color_t) 1); pGFILog->SetVisLeaves(kTRUE); TGeoRotation *pMatrixTube = new TGeoRotation(); pMatrixTube->RotateZ(90); pGFILog -> AddNode(pGFILogActive, 0, new TGeoCombiTrans()); for(int fiber_id = 0; fiber_id < detector_size / fiber_thickness; fiber_id++) { pGFILogWorld->AddNode(pGFILog, fiber_id, new TGeoCombiTrans("", -detector_size / 2 + (fiber_id + .5) * fiber_thickness, 0, 0, new TGeoRotation() ) ); pGFILogWorld->AddNode(pGFILog, fiber_id + detector_size / fiber_thickness, new TGeoCombiTrans("", 0, -detector_size / 2 + (fiber_id + .5) * fiber_thickness, fiber_thickness, pMatrixTube ) ); } // Add the sensitive part // AddSensitiveVolume(pGFILog); // fNbOfSensitiveVol+=1; // --------------- Finish ----------------------------------------------- gGeoMan->CloseGeometry(); gGeoMan->CheckOverlaps(0.001); gGeoMan->PrintOverlaps(); gGeoMan->Test(); TFile* geoFile = new TFile(geoFileName, "RECREATE"); top->Write(); geoFile->Close(); // -------------------------------------------------------------------------- }