SND@LHC Software
Loading...
Searching...
No Matches
ShipTargetStation.cxx
Go to the documentation of this file.
1#include "ShipTargetStation.h"
2
3#include "TGeoManager.h"
4#include "FairRun.h" // for FairRun
5#include "FairRuntimeDb.h" // for FairRuntimeDb
6#include <iosfwd> // for ostream
7#include "TList.h" // for TListIter, TList (ptr only)
8#include "TObjArray.h" // for TObjArray
9#include "TString.h" // for TString
10#include "TGeoBBox.h"
11#include "TGeoCompositeShape.h"
12#include "TGeoShapeAssembly.h"
13#include "TGeoTube.h"
14#include "TGeoMaterial.h"
15#include "FairGeoMedia.h"
16#include "FairGeoBuilder.h"
17#include "TGeoMedium.h"
18#include <stddef.h> // for NULL
19#include <iostream> // for operator<<, basic_ostream, etc
20
21using std::cout;
22using std::endl;
23
24
29 : FairModule("ShipTargetStation", "")
30{
31}
32
33ShipTargetStation::ShipTargetStation(const char* name, const Double_t tl,const Double_t al,const Double_t tz,
34 const Double_t az, const int nS, const Double_t sl, const char* Title )
35 : FairModule(name ,Title)
36{
37 fTargetLength = tl;
38 fAbsorberLength = al;
39 fAbsorberZ = az;
40 fTargetZ = tz;
41 fnS = nS;
42 fsl = sl;
43}
44
45ShipTargetStation::ShipTargetStation(const char* name, const Double_t tl,const Double_t tz,
46 const int nS, const Double_t sl, const char* Title )
47 : FairModule(name ,Title)
48{
49 fTargetLength = tl;
50 fAbsorberLength = 0;
51 fAbsorberZ = 0;
52 fTargetZ = tz;
53 fnS = nS;
54 fsl = sl;
55}
56
57// ----- Private method InitMedium
58Int_t ShipTargetStation::InitMedium(const char* name)
59{
60 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
61 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
62 static FairGeoMedia *media=geoFace->getMedia();
63 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
64
65 FairGeoMedium *ShipMedium=media->getMedium(name);
66
67 if (!ShipMedium)
68 {
69 Fatal("InitMedium","Material %s not defined in media file.", name);
70 return -1111;
71 }
72 TGeoMedium* medium=gGeoManager->GetMedium(name);
73 if (medium!=NULL)
74 return ShipMedium->getMediumIndex();
75 return geoBuild->createMedium(ShipMedium);
76}
77
79{
80 TGeoVolume *top=gGeoManager->GetTopVolume();
81 InitMedium("tungsten");
82 TGeoMedium *tungsten =gGeoManager->GetMedium("tungsten");
83
84 InitMedium("iron");
85 TGeoMedium *iron =gGeoManager->GetMedium("iron");
86 InitMedium("H2O");
87 TGeoMedium *water =gGeoManager->GetMedium("H2O");
88 InitMedium("molybdenum");
89 TGeoMedium *mo =gGeoManager->GetMedium("molybdenum");
90 TGeoVolume *tTarget = new TGeoVolumeAssembly("TargetArea");
91
92 Double_t zPos = 0.;
93 Int_t slots = fnS;
94 slots = slots-1;
95
96 if (fnS > 10){
97 TGeoVolume *target;
98 TGeoVolume *slit;
99 //Double_t zPos = fTargetZ - fTargetLength/2.;
100 for (Int_t i=0; i<fnS; i++) {
101 TString nmi = "Target_"; nmi += i+1;
102 TString sm = "Slit_"; sm += i+1;
103 TGeoMedium *material;
104 if (fM.at(i)=="molybdenum") {material = mo;};
105 if (fM.at(i)=="tungsten") {material = tungsten;};
106
107
108 if (fnS == 18) { // new target layout
109 target = gGeoManager->MakeTube(nmi, material, 0., fDiameter/2., fL.at(i)/2.);
110 }
111 else {
112 target = gGeoManager->MakeBox(nmi, material, fDiameter/2., fDiameter/2., fL.at(i)/2.);
113 }
114 if (fM.at(i)=="molybdenum") {
115 target->SetLineColor(28);
116 } else {target->SetLineColor(38);}; // silver/blue
117 tTarget->AddNode(target, 1, new TGeoTranslation(0, 0, zPos + fL.at(i)/2.) );
118 if (i < slots){
119 if(fnS == 18) {
120 slit = gGeoManager->MakeTube(sm, water, 0., fDiameter/2., fsl/2.);
121 }
122 else {
123 slit = gGeoManager->MakeBox(sm, water, fDiameter/2., fDiameter/2., fsl/2.);
124 }
125 slit->SetLineColor(7); // cyan
126 tTarget->AddNode(slit, 1, new TGeoTranslation(0, 0, zPos+fL.at(i)+fsl/2.) );
127 zPos+=fL.at(i)+fsl;
128 } else {
129 zPos+=fL.at(i);
130 }
131 }
132 }else if(fnS > 0){
133 Double_t dZ = (fTargetLength - (fnS-1)*fsl)/float(fnS);
134 // target made of tungsten and air slits
135 for (Int_t i=0; i<fnS-1; i++) {
136 TString nmi = "Target_"; nmi += i;
137 TString sm = "Slit_"; sm += i;
138 TGeoVolume *target = gGeoManager->MakeTube(nmi, tungsten, 0, 25, dZ/2.);
139 target->SetLineColor(38); // silver/blue
140 tTarget->AddNode(target, 1, new TGeoTranslation(0, 0, zPos+dZ/2.));
141 TGeoVolume *slit = gGeoManager->MakeTube(sm, water, 0, 25, fsl/2.);
142 slit->SetLineColor(7); // cyan
143 tTarget->AddNode(slit, 1, new TGeoTranslation(0, 0, zPos+dZ+fsl/2.));
144 zPos+=dZ+fsl;
145 }
146 TString nmi = "Target_"; nmi += fnS;
147 TGeoVolume *target = gGeoManager->MakeTube(nmi, tungsten, 0, 25, dZ/2.);
148 target->SetLineColor(38); // silver/blue
149 tTarget->AddNode(target, 1, new TGeoTranslation(0, 0, zPos+dZ/2.));
150 }
151 else{
152 // target made of solid tungsten
153 TGeoVolume *target = gGeoManager->MakeTube("Target", tungsten, 0, 25, fTargetLength/2.);
154 target->SetLineColor(38); // silver/blue
155 tTarget->AddNode(target, 1, new TGeoTranslation(0, 0, fTargetZ));
156 }
157
158 if (fAbsorberLength>0){ // otherwise, magnetized hadron absorber defined in ShipMuonShield.cxx
159 zPos = fTargetZ - fTargetLength/2.;
160 // Absorber made of iron
161 TGeoVolume *absorber;
162 absorber = gGeoManager->MakeTube("Absorber", iron, 0, 400, fAbsorberLength/2.); // 1890
163 absorber->SetLineColor(42); // brown / light red
164 tTarget->AddNode(absorber, 1, new TGeoTranslation(0, 0, fAbsorberZ-zPos));
165 }
166 // put iron shielding around target
167 if (fnS > 10){
168 Float_t xTot = 400./2.; // all in cm
169 Float_t yTot = 400./2.;
170 Float_t spaceTopBot = 10.;
171 Float_t spaceSide = 5.;
172 TGeoVolume *moreShieldingTopBot = gGeoManager->MakeBox("moreShieldingTopBot", iron, xTot, yTot/2., fTargetLength/2.);
173 moreShieldingTopBot->SetLineColor(33);
174 tTarget->AddNode(moreShieldingTopBot, 1, new TGeoTranslation(0., fDiameter/2. +spaceTopBot+yTot/2.,fTargetLength/2.));
175 tTarget->AddNode(moreShieldingTopBot, 2, new TGeoTranslation(0.,-fDiameter/2. -spaceTopBot-yTot/2.,fTargetLength/2.));
176 TGeoVolume *moreShieldingSide = gGeoManager->MakeBox("moreShieldingSide", iron, xTot/2., (fDiameter+1.9*spaceTopBot)/2., fTargetLength/2.);
177 moreShieldingSide->SetLineColor(33);
178 tTarget->AddNode(moreShieldingSide, 1, new TGeoTranslation(fDiameter/2.+spaceSide+xTot/2.,0.,fTargetLength/2.));
179 tTarget->AddNode(moreShieldingSide, 2, new TGeoTranslation(-fDiameter/2.-spaceSide-xTot/2.,0.,fTargetLength/2.));
180 }else{
181 TGeoVolume *moreShielding = gGeoManager->MakeTube("MoreShielding", iron, 30, 400, fTargetLength/2.);
182 moreShielding->SetLineColor(43); //
183 tTarget->AddNode(moreShielding, 1, new TGeoTranslation(0, 0, fTargetLength/2.));
184 }
185 top->AddNode(tTarget, 1, new TGeoTranslation(0, 0,fTargetZ - fTargetLength/2.));
186
187 if (fAbsorberLength>0){
188 cout << "target and absorber positioned at " << fTargetZ <<" "<< fAbsorberZ << " m"<< endl;
189 }else{
190 cout << "target at " << fTargetZ/100. <<"m "<< endl;
191 }
192}
193
Int_t InitMedium(const char *name)
std::vector< std::string > fM
std::vector< float > fL
ClassDef(ShipTargetStation, 4) protected Double_t fAbsorberLength
ClassImp(ecalContFact) ecalContFact