R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeutronWindowAndSomeAir.cxx
Go to the documentation of this file.
2#include "FairGeoBuilder.h"
3#include "FairGeoInterface.h"
4#include "FairGeoLoader.h"
5#include "FairGeoMedia.h"
6#include "FairLogger.h"
7#include "TGeoManager.h"
8#include "TGeoMedium.h"
9
11 : FairModule("NeutronWindowAndSomeAir", "NeutronWindowAndSomeAir", false)
12 , fStart(xstart)
13 , fStop(xstop)
14{
15}
16
18{
19 if (gGeoManager == nullptr)
20 {
21 LOG(fatal) << __FUNCTION__ << ": No gGeoManager";
22 }
23
24 auto volSomeAir = gGeoManager->MakeBox("SomeAir", FindMaterial("Air"), 125, 125, (fStop - fStart) / 2.);
25 gGeoManager->GetTopVolume()->AddNode(volSomeAir, 1, new TGeoTranslation(0, 0, fStart + (fStop - fStart) / 2.));
26 auto volWindow = gGeoManager->MakeTube("NeutronWindow", FindMaterial("Steel"), 0, 70, 0.2);
27 gGeoManager->GetTopVolume()->AddNode(volWindow, 1, new TGeoTranslation(0, 0, fStart - 0.2));
28}
29
30// TODO: Simulation crashes without this. It should not be necessary to do this?!
31TGeoMedium* R3BNeutronWindowAndSomeAir::FindMaterial(const std::string& mat) const
32{
33 auto geoLoad = FairGeoLoader::Instance();
34 auto geoFace = geoLoad->getGeoInterface();
35 auto geoBuild = geoLoad->getGeoBuilder();
36 auto geoMedia = geoFace->getMedia();
37
38 auto fairMedium = geoMedia->getMedium(mat.c_str());
39 if (!fairMedium)
40 {
41 LOG(fatal) << __FUNCTION__ << ": FairGeoMedium " << mat << " not found";
42 }
43 geoBuild->createMedium(fairMedium);
44
45 auto med = gGeoManager->GetMedium(mat.c_str());
46 if (!med)
47 {
48 LOG(fatal) << __FUNCTION__ << ": TGeoMedium " << mat << " not found";
49 }
50 return med;
51}
52
ClassImp(R3B::Neuland::Cal2HitPar)
void ConstructRootGeometry(TGeoMatrix *_=nullptr) override
R3BNeutronWindowAndSomeAir(double start=700, double stop=1300)