SND@LHC Software
Loading...
Searching...
No Matches
MagneticSpectrometer.cxx
Go to the documentation of this file.
2#include "ShipRpcPoint.h"
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 "TClonesArray.h"
11#include "TVirtualMC.h"
12
13#include "TGeoBBox.h"
14#include "TGeoTrd1.h"
15#include "TGeoCompositeShape.h"
16#include "TGeoTube.h"
17#include "TGeoMaterial.h"
18#include "TGeoMedium.h"
19#include "TParticle.h"
20#include "TVector3.h"
21
22#include "FairVolume.h"
23#include "FairGeoVolume.h"
24#include "FairGeoNode.h"
25#include "FairRootManager.h"
26#include "FairGeoLoader.h"
27#include "FairGeoInterface.h"
28#include "FairGeoMedia.h"
29#include "FairGeoBuilder.h"
30#include "FairRun.h"
31#include "FairRuntimeDb.h"
32
33#include "ShipDetectorList.h"
34#include "ShipUnit.h"
35#include "ShipStack.h"
36
37#include "TGeoUniformMagField.h"
38#include <stddef.h> // for NULL
39#include <iostream> // for operator<<, basic_ostream, etc
40
41using std::cout;
42using std::endl;
43using namespace ShipUnit;
44
46 : FairDetector("MagneticSpectrometer",kTRUE, ktauRpc),
47 fTrackID(-1),
48 fPdgCode(),
49 fVolumeID(-1),
50 fPos(),
51 fMom(),
52 fTime(-1.),
53 fLength(-1.),
54 fELoss(-1),
55 fShipRpcPointCollection(new TClonesArray("ShipRpcPoint"))
56{
57}
58
59MagneticSpectrometer::MagneticSpectrometer(const char* name, const Double_t Zcenter,Bool_t Active,const char* Title)
60 : FairDetector(name, Active, ktauRpc),
61 fTrackID(-1),
62 fPdgCode(),
63 fVolumeID(-1),
64 fPos(),
65 fMom(),
66 fTime(-1.),
67 fLength(-1.),
68 fELoss(-1),
69 fShipRpcPointCollection(new TClonesArray("ShipRpcPoint"))
70{
71 fZcenter = Zcenter;
72}
73
75{
76 fDesign = Design;
77 cout <<" Mag Spectro Design "<< fDesign<<endl;
78}
79
80void MagneticSpectrometer::SetTotDimensions(Double_t X, Double_t Y, Double_t Z)
81{
82 fXtot = X;
83 fYtot = Y;
84 fZtot = Z;
85}
86
87void MagneticSpectrometer::SetFeDimensions(Double_t X, Double_t Y, Double_t Z)
88{
89 fXFe = X;
90 fYFe = Y;
91 fZFe = Z;
92}
93
94void MagneticSpectrometer::SetRpcDimensions(Double_t X, Double_t Y, Double_t Z)
95{
96 fXRpc = X;
97 fYRpc = Y;
98 fZRpc = Z;
99}
100
101void MagneticSpectrometer::SetRpcGasDimensions(Double_t X, Double_t Y, Double_t Z)
102{
103 fXGas = X;
104 fYGas = Y;
105 fZGas = Z;
106}
107
108void MagneticSpectrometer::SetRpcPETDimensions(Double_t X, Double_t Y, Double_t Z)
109{
110 fXPet = X;
111 fYPet = Y;
112 fZPet = Z;
113}
114
115void MagneticSpectrometer::SetRpcElectrodeDimensions(Double_t X, Double_t Y, Double_t Z)
116{
117 fXEle = X;
118 fYEle = Y;
119 fZEle = Z;
120}
121
122void MagneticSpectrometer::SetRpcStripDimensions(Double_t X, Double_t Y, Double_t Z)
123{
124 fXStrip = X;
125 fYStrip = Y;
126 fZStrip = Z;
127}
128
129void MagneticSpectrometer::SetReturnYokeDimensions(Double_t X, Double_t Y, Double_t Z)
130{
131 fXRyoke = X;
132 fYRyoke = Y;
133 fZRyoke = Z;
134}
135
136void MagneticSpectrometer::SetSmallerYokeDimensions(Double_t X, Double_t Y, Double_t Z)
137{
138 fXRyoke_s = X;
139 fYRyoke_s = Y;
140 fZRyoke_s = Z;
141}
142
144{
145 fField =B;
146}
147
149{
150 fGapDown = Gap;
151}
152
154{
155 fGapMiddle = Gap;
156}
157
159{
160 fZArm = Z;
161}
162
164{
165 fNFe = N;
166}
167
169{
170 fNRpc = N;
171}
172
173void MagneticSpectrometer::SetCoilParameters(Double_t CoilH, Double_t CoilW, Int_t N, Double_t CoilG)
174{
175 fCoilH = CoilH;
176 fCoilW = CoilW;
177 fCoilGap = CoilG;
178 fNCoil = N;
179}
180
181
182void MagneticSpectrometer::SetPillarDimensions(Double_t X, Double_t Y, Double_t Z)
183{
184 fPillarX = X;
185 fPillarY = Y;
186 fPillarZ = Z;
187}
188
189
197
199{
200 FairDetector::Initialize();
201}
202
203// ----- Private method InitMedium
204Int_t MagneticSpectrometer::InitMedium(const char* name)
205{
206 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
207 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
208 static FairGeoMedia *media=geoFace->getMedia();
209 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
210
211 FairGeoMedium *ShipMedium=media->getMedium(name);
212
213 if (!ShipMedium)
214 {
215 Fatal("InitMedium","Material %s not defined in media file.", name);
216 return -1111;
217 }
218 TGeoMedium* medium=gGeoManager->GetMedium(name);
219 if (medium!=NULL)
220 return ShipMedium->getMediumIndex();
221 return geoBuild->createMedium(ShipMedium);
222}
223
225{
226 TGeoVolume *top = gGeoManager->GetTopVolume();
227 TGeoVolumeAssembly *tTauNuDet = new TGeoVolumeAssembly("tTauNuDet");
228 top->AddNode(tTauNuDet, 1, new TGeoTranslation(0, 0, 0));
229
230 InitMedium("RPCgas");
231 TGeoMedium *RPCmat =gGeoManager->GetMedium("RPCgas");
232
233 InitMedium("vacuum");
234 TGeoMedium *vacuum =gGeoManager->GetMedium("vacuum");
235
236 InitMedium("Bakelite");
237 TGeoMedium *bakelite =gGeoManager->GetMedium("Bakelite");
238
239 InitMedium("iron");
240 TGeoMedium *Iron =gGeoManager->GetMedium("iron");
241
242 InitMedium("steel");
243 TGeoMedium *Steel =gGeoManager->GetMedium("steel");
244
245 InitMedium("copper");
246 TGeoMedium *Cu =gGeoManager->GetMedium("copper");
247
248 InitMedium("Concrete");
249 TGeoMedium *Conc =gGeoManager->GetMedium("Concrete");
250
251 TGeoUniformMagField *retFieldU = new TGeoUniformMagField(0.,0.,-fField); //magnetic field up return yoke
252 TGeoUniformMagField *retFieldL = new TGeoUniformMagField(0.,0.,fField); //magnetic field low return yoke
253
254 Double_t d = 0;
255
256 if(fDesign!=3)
257 {
258 TGeoBBox *MSBox = new TGeoBBox("MagneticSpectrometerBox", fXRyoke/2, fYtot/2, fZtot/2);
259 TGeoVolume *volMSBox = new TGeoVolume("volMagneticSpectrometer", MSBox, vacuum);
260 tTauNuDet->AddNode(volMSBox, 1, new TGeoTranslation(0,10*cm,fZcenter));
261
262
263 TGeoBBox *UpYokeBox = new TGeoBBox("UpYokeBox", fXRyoke/2, fYRyoke/2, fZRyoke/2);
264 TGeoVolume *volUpYoke = new TGeoVolume("volUpYoke",UpYokeBox,vacuum);
265 volMSBox->AddNode(volUpYoke,1,new TGeoTranslation(0,fYtot/2 - fYRyoke/2,0));
266 volUpYoke->SetField(retFieldU);
267
268
269 TGeoBBox *FeYoke = new TGeoBBox("FeYoke",fXtot/2, fYRyoke/2, fZArm/2);
270 TGeoVolume *volFeYoke = new TGeoVolume("volFeYoke",FeYoke,Iron);
271 volFeYoke->SetLineColor(kGray+1);
272
273 TGeoBBox *FeYoke1 = new TGeoBBox("FeYoke1",fXtot/2, fYRyoke_s/2, fZRyoke_s/2);
274 TGeoVolume *volFeYoke1 = new TGeoVolume("volFeYoke1",FeYoke1,Iron);
275 volFeYoke1->SetLineColor(kGray+1);
276
277 TGeoBBox *CoilContainer = new TGeoBBox("CoilContainer",fXtot/2, fCoilH/2, 40*cm);
278 TGeoVolume *volCoilContainer = new TGeoVolume("volCoilContainer",CoilContainer,vacuum);
279
280 TGeoBBox *Coil = new TGeoBBox("Coil",fXtot/2, fCoilH/2, fCoilW/2);
281 TGeoVolume *volCoil = new TGeoVolume("volCoil",Coil,Cu);
282 volCoil->SetLineColor(kOrange -5);
283 for(int i = 0; i < fNCoil; i++)
284 {
285 volCoilContainer->AddNode(volCoil, i, new TGeoTranslation(0,0, -40*cm + fCoilW/2 + i*(fCoilGap + fCoilW)));
286 }
287
288 //vertical coils
289 TGeoBBox *CoilV = new TGeoBBox("CoilV",fCoilH/2, fYRyoke/2 , fCoilW/2);
290 TGeoVolume *volCoilV = new TGeoVolume("volCoilV",CoilV,Cu);
291 volCoilV->SetLineColor(kOrange -5);
292 for(int i = 0; i < fNCoil; i++)
293 {
294 volUpYoke->AddNode(volCoilV, i, new TGeoTranslation(fXRyoke/2 - fCoilH/2,0, -40*cm + fCoilW/2 + i*(fCoilGap + fCoilW)));
295 }
296 for(int i = 0; i < fNCoil; i++)
297 {
298 volUpYoke->AddNode(volCoilV, i, new TGeoTranslation(-fXRyoke/2 + fCoilH/2,0, -40*cm + fCoilW/2 + i*(fCoilGap + fCoilW)));
299 }
300
301 //cout <<"fZArm: " << fZArm<< endl;
302
303 volUpYoke->AddNode(volFeYoke,1, new TGeoTranslation(0,0,- (fZArm + fGapMiddle)/2));
304 volUpYoke->AddNode(volFeYoke,2, new TGeoTranslation(0,0,(fZArm + fGapMiddle)/2));
305 volUpYoke->AddNode(volFeYoke1,1,new TGeoTranslation(0,0,0));
306 volUpYoke->AddNode(volCoilContainer,1,new TGeoTranslation(0,fYRyoke/2 - fCoilH/2,0)); //up
307 volUpYoke->AddNode(volCoilContainer,2,new TGeoTranslation(0,-fYRyoke/2 + fCoilH/2,0)); //low
308
309 TGeoBBox *LowYokeBox = new TGeoBBox("LowYokeBox", fXRyoke/2, fYRyoke/2, fZRyoke/2);
310 TGeoVolume *volLowYoke = new TGeoVolume("volLowYoke",LowYokeBox,vacuum);
311 volMSBox->AddNode(volLowYoke,1,new TGeoTranslation(0,-fYtot/2 + fYRyoke/2,0));
312 volLowYoke->SetField(retFieldL);
313
314 //vertical coils
315 for(int i = 0; i < fNCoil; i++)
316 {
317 volLowYoke->AddNode(volCoilV, i, new TGeoTranslation(fXRyoke/2 - fCoilH/2,0, -40*cm + fCoilW/2 + i*(fCoilGap + fCoilW)));
318 }
319 for(int i = 0; i < fNCoil; i++)
320 {
321 volLowYoke->AddNode(volCoilV, i, new TGeoTranslation(-fXRyoke/2 + fCoilH/2,0, -40*cm + fCoilW/2 + i*(fCoilGap + fCoilW)));
322 }
323
324 volLowYoke->AddNode(volFeYoke,3, new TGeoTranslation(0,0,- (fZArm + fGapMiddle)/2));
325 volLowYoke->AddNode(volFeYoke,4, new TGeoTranslation(0,0,(fZArm + fGapMiddle)/2));
326 volLowYoke->AddNode(volFeYoke1,1,new TGeoTranslation(0,0,0));
327 volLowYoke->AddNode(volCoilContainer,3,new TGeoTranslation(0,fYRyoke/2- fCoilH/2,0)); //up
328 volLowYoke->AddNode(volCoilContainer,4,new TGeoTranslation(0,-fYRyoke/2 + fCoilH/2,0)); //low
329
330 Int_t ArmNumber = 1;
331 TGeoBBox *Arm1Box = new TGeoBBox("Arm1MSBox", fXFe/2, fYFe/2, fZArm/2);
332 TGeoVolume *volArm1 = new TGeoVolume("volArm1MS", Arm1Box,vacuum);
333 TGeoUniformMagField *magField1 = new TGeoUniformMagField(0.,-fField,0.); //magnetic field arm1
334 volArm1->SetField(magField1);
335 volMSBox ->AddNode(volArm1,ArmNumber,new TGeoTranslation(0,0,-(fGapMiddle+fZArm)/2));
336
337 Int_t nr = ArmNumber*1E4;
338
339 TGeoBBox *IronLayer = new TGeoBBox("Iron",fXFe/2, fYFe/2, fZFe/2);
340 TGeoVolume *volIron = new TGeoVolume("volIron",IronLayer,Iron);
341 //volIron->SetField(magField1);
342
343 for(Int_t i = 0; i < fNFe; i++)
344 {
345 volArm1->AddNode(volIron,nr + 100 + i, new TGeoTranslation(0, 0, -fZArm/2+i*(fZFe +fZRpc) +fZFe/2));
346 }
347
348 TGeoBBox *RpcContainer = new TGeoBBox("RpcContainer", fXRpc/2, fYRpc/2, fZRpc/2);
349 TGeoVolume *volRpcContainer = new TGeoVolume("volRpcContainer",RpcContainer,vacuum);
350
351 TGeoBBox *Strip = new TGeoBBox("Strip",fXStrip/2, fYStrip/2, fZStrip/2);
352 TGeoVolume *volStrip = new TGeoVolume("volStrip",Strip,Cu);
353 volStrip->SetLineColor(kRed);
354 volRpcContainer->AddNode(volStrip,1,new TGeoTranslation (0,0,-3.25*mm));
355 volRpcContainer->AddNode(volStrip,2,new TGeoTranslation (0,0,3.25*mm));
356 TGeoBBox *PETinsulator = new TGeoBBox("PETinsulator", fXPet/2, fYPet/2, fZPet/2);
357 TGeoVolume *volPETinsulator = new TGeoVolume("volPETinsulator", PETinsulator, bakelite);
358 volPETinsulator->SetLineColor(kYellow);
359 volRpcContainer->AddNode(volPETinsulator,1,new TGeoTranslation(0,0,-3.1*mm));
360 volRpcContainer->AddNode(volPETinsulator,2,new TGeoTranslation(0,0, 3.1*mm));
361 TGeoBBox *Electrode = new TGeoBBox("Electrode",fXEle/2, fYEle/2, fZEle/2);
362 TGeoVolume *volElectrode = new TGeoVolume("volElectrode",Electrode,bakelite);
363 volElectrode->SetLineColor(kGreen);
364 volRpcContainer->AddNode(volElectrode,1,new TGeoTranslation(0,0,-2*mm));
365 volRpcContainer->AddNode(volElectrode,2,new TGeoTranslation(0,0, 2*mm));
366 TGeoBBox *RpcGas = new TGeoBBox("RpcGas", fXGas/2, fYGas/2, fZGas/2);
367 TGeoVolume *volRpc = new TGeoVolume("volRpc",RpcGas,RPCmat);
368 volRpc->SetLineColor(kCyan);
369 volRpcContainer->AddNode(volRpc,1,new TGeoTranslation(0,0,0));
370
371 AddSensitiveVolume(volRpc);
372
373 for(Int_t i = 0; i < fNRpc; i++)
374 {
375 volArm1->AddNode(volRpcContainer,nr + i,new TGeoTranslation(0, -fYFe/2 + fYRpc/2, -fZArm/2+(i+1)*fZFe + i*fZRpc +fZRpc/2));
376 }
377
378 ArmNumber = 2;
379 nr = ArmNumber*1E4;
380
381 TGeoBBox *Arm2Box = new TGeoBBox("Arm2MSBox",fXFe/2, fYFe/2, fZArm/2);
382 TGeoVolume *volArm2 = new TGeoVolume("volArm2MS", Arm2Box,vacuum);
383 TGeoUniformMagField *magField2 = new TGeoUniformMagField(0.,fField,0.); //magnetic field arm2
384 volArm2->SetField(magField2);
385 volMSBox ->AddNode(volArm2,1,new TGeoTranslation(0,0,(fGapMiddle+fZArm)/2));
386 TGeoVolume *volIron2 = new TGeoVolume("volIron2",IronLayer,Iron);
387
388 //different volumes for second arm
389
390 TGeoVolume *volRpcContainer2 = new TGeoVolume("volRpcContainer2",RpcContainer,vacuum);
391 TGeoVolume *volStrip2 = new TGeoVolume("volStrip2",Strip,Cu);
392
393 volStrip2->SetLineColor(kRed);
394 volRpcContainer2->AddNode(volStrip2,1,new TGeoTranslation (0,0,-3.25*mm));
395 volRpcContainer2->AddNode(volStrip2,2,new TGeoTranslation (0,0,3.25*mm));
396
397 TGeoVolume *volPETinsulator2 = new TGeoVolume("volPETinsulator2", PETinsulator, bakelite);
398 volPETinsulator2->SetLineColor(kYellow);
399 volRpcContainer2->AddNode(volPETinsulator2,1,new TGeoTranslation(0,0,-3.1*mm));
400 volRpcContainer2->AddNode(volPETinsulator2,2,new TGeoTranslation(0,0, 3.1*mm));
401
402 TGeoVolume *volElectrode2 = new TGeoVolume("volElectrode2",Electrode,bakelite);
403 volElectrode2->SetLineColor(kGreen);
404 volRpcContainer2->AddNode(volElectrode2,1,new TGeoTranslation(0,0,-2*mm));
405 volRpcContainer2->AddNode(volElectrode2,2,new TGeoTranslation(0,0, 2*mm));
406
407 TGeoVolume *volRpc2 = new TGeoVolume("volRpc2",RpcGas,RPCmat);
408 volRpc2->SetLineColor(kCyan);
409 volRpcContainer2->AddNode(volRpc2,1,new TGeoTranslation(0,0,0));
410 AddSensitiveVolume(volRpc2);
411
412 for(Int_t i = 0; i < fNFe; i++)
413 {
414 volArm2->AddNode(volIron2,nr + 100 + i,new TGeoTranslation(0, 0, -fZArm/2+i*(fZFe +fZRpc) +fZFe/2));
415 }
416
417 for(Int_t i = 0; i < fNRpc; i++)
418 {
419 volArm2->AddNode(volRpcContainer2, nr + i,new TGeoTranslation(0, -fYFe/2 + fYRpc/2, -fZArm/2+(i+1)*fZFe + i*fZRpc +fZRpc/2));
420 }
421
422 //10 cm of Concrete on which the whole Magnetic Spectrometer volume (HPT included) will be placed
423 TGeoBBox *Base = new TGeoBBox("Base", fXtot/2, 10*cm/2, fZtot/2);
424 TGeoVolume *volBase = new TGeoVolume("volBase",Base,Conc);
425 volBase->SetLineColor(kYellow-3);
426
427 tTauNuDet->AddNode(volBase,1, new TGeoTranslation(0,-fYtot/2 + 10*cm/2,fZcenter));
428
429
430 TGeoBBox *Pillar1Box = new TGeoBBox(fPillarX/2,fPillarY/2, fPillarZ/2);
431 TGeoVolume *Pillar1Vol = new TGeoVolume("Pillar1Vol",Pillar1Box,Steel);
432 Pillar1Vol->SetLineColor(kGreen+3);
433
434 tTauNuDet->AddNode(Pillar1Vol,1, new TGeoTranslation(-fXtot/2+fPillarX/2,-fYtot/2-fPillarY/2,fZcenter-fZArm/2 - fGapMiddle/2 +fPillarZ/2));
435 tTauNuDet->AddNode(Pillar1Vol,2, new TGeoTranslation(fXtot/2-fPillarX/2,-fYtot/2-fPillarY/2,fZcenter-fZArm/2 - fGapMiddle/2 +fPillarZ/2));
436 tTauNuDet->AddNode(Pillar1Vol,3, new TGeoTranslation(-fXtot/2+fPillarX/2,-fYtot/2-fPillarY/2,fZcenter+fZArm/2+fGapMiddle/2-fPillarZ/2));
437 tTauNuDet->AddNode(Pillar1Vol,4, new TGeoTranslation(fXtot/2-fPillarX/2,-fYtot/2-fPillarY/2,fZcenter+fZArm/2+fGapMiddle/2-fPillarZ/2));
438 }
439 if(fDesign==3)
440 {
441 Int_t nr = 1E4;
442
443 TGeoBBox *MSBox = new TGeoBBox("MagneticSpectrometerBox", fXtot/2, fYtot/2, fZtot/2);
444 TGeoVolume *volMSBox = new TGeoVolume("volMagneticSpectrometer", MSBox, vacuum);
445 tTauNuDet->AddNode(volMSBox, 1, new TGeoTranslation(0,0,fZcenter));
446
447 TGeoBBox *IronLayer = new TGeoBBox("Iron",fXFe/2, fYFe/2, fZFe/2);
448 TGeoVolume *volIron = new TGeoVolume("volIron",IronLayer,Iron);
449 //volIron->SetField(magField1);
450
451 for(Int_t i = 0; i < fNFe; i++)
452 {
453 volMSBox->AddNode(volIron,nr + 100 + i, new TGeoTranslation(0, 0,-fZtot/2+i*fZFe+fZFe/2+i*fZRpc));
454 }
455
456 TGeoBBox *RpcContainer = new TGeoBBox("RpcContainer", fXRpc/2, fYRpc/2, fZRpc/2);
457 TGeoVolume *volRpcContainer = new TGeoVolume("volRpcContainer",RpcContainer,vacuum);
458
459 TGeoBBox *Strip = new TGeoBBox("Strip",fXStrip/2, fYStrip/2, fZStrip/2);
460 TGeoVolume *volStrip = new TGeoVolume("volStrip",Strip,Cu);
461 volStrip->SetLineColor(kRed);
462 volRpcContainer->AddNode(volStrip,1,new TGeoTranslation (0,0,-3.25*mm));
463 volRpcContainer->AddNode(volStrip,2,new TGeoTranslation (0,0,3.25*mm));
464 TGeoBBox *PETinsulator = new TGeoBBox("PETinsulator", fXPet/2, fYPet/2, fZPet/2);
465 TGeoVolume *volPETinsulator = new TGeoVolume("volPETinsulator", PETinsulator, bakelite);
466 volPETinsulator->SetLineColor(kYellow);
467 volRpcContainer->AddNode(volPETinsulator,1,new TGeoTranslation(0,0,-3.1*mm));
468 volRpcContainer->AddNode(volPETinsulator,2,new TGeoTranslation(0,0, 3.1*mm));
469 TGeoBBox *Electrode = new TGeoBBox("Electrode",fXEle/2, fYEle/2, fZEle/2);
470 TGeoVolume *volElectrode = new TGeoVolume("volElectrode",Electrode,bakelite);
471 volElectrode->SetLineColor(kGreen);
472 volRpcContainer->AddNode(volElectrode,1,new TGeoTranslation(0,0,-2*mm));
473 volRpcContainer->AddNode(volElectrode,2,new TGeoTranslation(0,0, 2*mm));
474 TGeoBBox *RpcGas = new TGeoBBox("RpcGas", fXGas/2, fYGas/2, fZGas/2);
475 TGeoVolume *volRpc = new TGeoVolume("volRpc",RpcGas,RPCmat);
476 volRpc->SetLineColor(kCyan);
477 volRpcContainer->AddNode(volRpc,1,new TGeoTranslation(0,0,0));
478
479 AddSensitiveVolume(volRpc);
480
481 for(Int_t i = 0; i < fNRpc; i++)
482 {
483 volMSBox->AddNode(volRpcContainer,nr + i,new TGeoTranslation(0, 0, -fZtot/2+(i+1)*fZFe + i*fZRpc +fZRpc/2));
484 }
485
486 TGeoBBox *Pillar1Box = new TGeoBBox(fPillarX/2,fPillarY/2, fPillarZ/2);
487 TGeoVolume *Pillar1Vol = new TGeoVolume("Pillar1Vol",Pillar1Box,Steel);
488 Pillar1Vol->SetLineColor(kGreen+3);
489
490 tTauNuDet->AddNode(Pillar1Vol,1, new TGeoTranslation(-fXtot/2+fPillarX/2,-fYtot/2-fPillarY/2,fZcenter-fZtot/2+fPillarZ/2));
491 tTauNuDet->AddNode(Pillar1Vol,2, new TGeoTranslation(fXtot/2-fPillarX/2,-fYtot/2-fPillarY/2,fZcenter-fZtot/2 +fPillarZ/2));
492 // tTauNuDet->AddNode(Pillar1Vol,3, new TGeoTranslation(-fXtot/2+fPillarX/2,-fYtot/2-fPillarY/2,fZcenter+fZtot/2-fPillarZ/2));
493 //tTauNuDet->AddNode(Pillar1Vol,4, new TGeoTranslation(fXtot/2-fPillarX/2,-fYtot/2-fPillarY/2,fZcenter+fZtot/2-fPillarZ/2));
494 }
495
496}
497
498
500{
502 //Set parameters at entrance of volume. Reset ELoss.
503 if ( gMC->IsTrackEntering() ) {
504 fELoss = 0.;
505 fTime = gMC->TrackTime() * 1.0e09;
506 fLength = gMC->TrackLength();
507 gMC->TrackPosition(fPos);
508 gMC->TrackMomentum(fMom);
509 }
510 // Sum energy loss for all steps in the active volume
511 fELoss += gMC->Edep();
512
513 // Create muonPoint at exit of active volume
514 if ( gMC->IsTrackExiting() ||
515 gMC->IsTrackStop() ||
516 gMC->IsTrackDisappeared() ) {
517 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
518 fVolumeID = vol->getMCid();
519 if (fELoss == 0. ) { return kFALSE; }
520 TParticle* p=gMC->GetStack()->GetCurrentTrack();
521 Int_t pdgCode = p->GetPdgCode();
522 Int_t detID=0;
523 gMC->CurrentVolID(detID);
524
525 // cout<< "detID = " << detID << endl;
526 Int_t MaxLevel = gGeoManager->GetLevel();
527 const Int_t MaxL = MaxLevel;
528 //cout << "MaxLevel = " << MaxL << endl;
529 //cout << gMC->CurrentVolPath()<< endl;
530 Int_t NRpc =0;
531 const char *name;
532 name = gMC->CurrentVolName();
533 //cout << name << endl;
534 Int_t motherID = gGeoManager->GetMother(0)->GetNumber();
535 const char *mumname = gMC->CurrentVolOffName(0);
536 //cout<<mumname<<" "<< motherID<<endl;
537 detID = motherID;
538 //cout<< "detID = " << detID << endl;
539 //cout<<endl;
540 fVolumeID = detID;
541
542 TLorentzVector Pos;
543 gMC->TrackPosition(Pos);
544 Double_t xmean = (fPos.X()+Pos.X())/2. ;
545 Double_t ymean = (fPos.Y()+Pos.Y())/2. ;
546 Double_t zmean = (fPos.Z()+Pos.Z())/2. ;
547
548 AddHit(fTrackID, fVolumeID, TVector3(xmean, ymean, zmean), TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,fELoss, pdgCode);
549
550 // Increment number of muon det points in TParticle
551 ShipStack* stack = (ShipStack*) gMC->GetStack();
552 stack->AddPoint(ktauRpc);
553 }
554
555 return kTRUE;
556}
557
562
563
565{
566
573 FairRootManager::Instance()->Register("ShipRpcPoint", "MagneticSpectrometer",
575}
576
577// ----- Public method to Decode volume info -------------------------------------------
578// ----- returns hpt, arm, rpc numbers -----------------------------------
579void MagneticSpectrometer::DecodeVolumeID(Int_t detID,int &nARM,int &nRPC)
580{
581 nARM = detID/1E4;
582 nRPC = detID - nARM*1E4;
583}
584
585TClonesArray* MagneticSpectrometer::GetCollection(Int_t iColl) const
586{
587 if (iColl == 0) { return fShipRpcPointCollection; }
588 else { return NULL; }
589}
590
595
596
597ShipRpcPoint* MagneticSpectrometer::AddHit(Int_t trackID, Int_t detID,
598 TVector3 pos, TVector3 mom,
599 Double_t time, Double_t length,
600 Double_t eLoss, Int_t pdgCode)
601
602{
603 TClonesArray& clref = *fShipRpcPointCollection;
604 Int_t size = clref.GetEntriesFast();
605 //cout << "ShipRpctau hit called"<< pos.z()<<endl;
606 // return new(clref[size]) ShipRpcPoint(trackID, detID, pos, mom,time, length, eLoss, pdgCode,NArm, NRpc, NHpt);
607 return new(clref[size]) ShipRpcPoint(trackID, detID, pos, mom,time, length, eLoss, pdgCode);
608}
609
610
Double_t cm
Double_t mm
@ ktauRpc
void SetReturnYokeDimensions(Double_t X, Double_t Y, Double_t Z)
ShipRpcPoint * AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgCode)
void SetGapDownstream(Double_t Gap)
void SetMagneticField(Double_t B)
Int_t InitMedium(const char *name)
TClonesArray * fShipRpcPointCollection
energy loss
void SetSmallerYokeDimensions(Double_t X, Double_t Y, Double_t Z)
void SetRpcGasDimensions(Double_t X, Double_t Y, Double_t Z)
virtual Bool_t ProcessHits(FairVolume *v=0)
virtual TClonesArray * GetCollection(Int_t iColl) const
TLorentzVector fMom
position at entrance
TLorentzVector fPos
volume id
void DecodeVolumeID(Int_t detID, int &nARM, int &nRPC)
void SetRpcDimensions(Double_t X, Double_t Y, Double_t Z)
void SetGapMiddle(Double_t Gap)
void SetPillarDimensions(Double_t X, Double_t Y, Double_t Z)
void SetFeDimensions(Double_t X, Double_t Y, Double_t Z)
void SetRpcStripDimensions(Double_t X, Double_t Y, Double_t Z)
void SetDesign(Int_t Design)
void SetTotDimensions(Double_t X, Double_t Y, Double_t Z)
Double32_t fTime
momentum at entrance
void SetRpcPETDimensions(Double_t X, Double_t Y, Double_t Z)
void SetZDimensionArm(Double_t Z)
void SetCoilParameters(Double_t CoilH, Double_t CoilW, Int_t N, Double_t CoilG)
void SetRpcElectrodeDimensions(Double_t X, Double_t Y, Double_t Z)
ClassImp(ecalContFact) ecalContFact