Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:19:02

0001 void makeGeom()
0002 {
0003   //--- Definition of a simple geometry
0004   //   gSystem->Load("libGeom");
0005    new TGeoManager("genfitGeom", "GENFIT geometry");
0006 
0007 
0008    unsigned int medInd(0);
0009    Double_t mPar[10];
0010    //TAG sollte wieder 0 werden sens flag
0011    mPar[0]=0.;//sensitive volume flag
0012    mPar[1]=1.;//magnetic field flag
0013    mPar[2]=30.;//max fiel in kGauss
0014    mPar[3]=0.1;//maximal angular dev. due to field
0015    mPar[4]=0.01;//max step allowed (in cm)
0016    mPar[5]=1.e-5;//max fractional energy loss
0017    mPar[6]=1.e-3;//boundary crossing accuracy
0018    mPar[7]=1.e-5;//minimum step
0019    mPar[8]=0.;//not defined
0020    mPar[9]=0.;//not defined
0021 
0022    TGeoMaterial *_siliconMat = new TGeoMaterial("siliconMat",28.0855,14.,2.329);
0023    _siliconMat->SetRadLen(1.);//calc automatically, need this for elemental mats.
0024    // cppcheck-suppress unreadVariable
0025    TGeoMedium *_silicon = new TGeoMedium("silicon",medInd++,_siliconMat,mPar);
0026 
0027    TGeoMixture *_airMat = new TGeoMixture("airMat",3);
0028    _airMat->AddElement(14.01,7.,.78);
0029    _airMat->AddElement(16.00,8.,.21);
0030    _airMat->AddElement(39.95,18.,.01);
0031    _airMat->SetDensity(1.2e-3);
0032    // cppcheck-suppress unreadVariable
0033    TGeoMedium *_air = new TGeoMedium("air",medInd++,_airMat,mPar);
0034 
0035    TGeoMixture *_vacuumMat = new TGeoMixture("vacuumMat",3);
0036    _vacuumMat->AddElement(14.01,7.,.78);
0037    _vacuumMat->AddElement(16.00,8.,.21);
0038    _vacuumMat->AddElement(39.95,18.,.01);
0039    _vacuumMat->SetDensity(1.2e-15);
0040    // cppcheck-suppress unreadVariable
0041    TGeoMedium *_vacuum = new TGeoMedium("vacuum",medInd++,_vacuumMat,mPar);
0042 
0043 
0044 
0045 
0046    TGeoMedium *vacuum = gGeoManager->GetMedium("vacuum");
0047    assert(vacuum!=NULL);
0048    TGeoMedium *air = gGeoManager->GetMedium("air");
0049    assert(air!=NULL);
0050    TGeoMedium *sil = gGeoManager->GetMedium("silicon");
0051    assert(sil!=NULL);
0052 
0053    TGeoVolume *top = gGeoManager->MakeBox("TOPPER", air, 1000., 1000., 1000.);
0054    gGeoManager->SetTopVolume(top); // mandatory !
0055 
0056    double thickness(0.05);
0057    double distance = 1;
0058 
0059    for (unsigned int i=1; i<5; ++i){
0060      TGeoVolume *redBullCan = gGeoManager->MakeTube("redBullCan", sil, i*distance, i*distance+thickness, 20.);//, 90., 270.);
0061      redBullCan->SetLineColor(kRed);
0062      top->AddNode(redBullCan, 1, gGeoIdentity);
0063    }
0064 
0065 
0066    //--- close the geometry
0067    gGeoManager->CloseGeometry();
0068 
0069    //--- draw the ROOT box
0070    gGeoManager->SetVisLevel(10);
0071    //top->Draw("ogl");
0072    TFile *outfile = TFile::Open("genfitGeom.root","RECREATE");
0073    gGeoManager->Write();
0074    outfile->Close();
0075 }