SND@LHC Software
Loading...
Searching...
No Matches
Target.cxx
Go to the documentation of this file.
1//
2// Target.cxx
3//
4//
5// Created by Annarita Buonaura on 17/01/15.
6//
7//
8
9#include "Target.h"
10
11#include "TargetPoint.h"
12
13#include "TGeoManager.h"
14#include "FairRun.h" // for FairRun
15#include "FairRuntimeDb.h" // for FairRuntimeDb
16#include <iosfwd> // for ostream
17#include "TList.h" // for TListIter, TList (ptr only)
18#include "TObjArray.h" // for TObjArray
19#include "TString.h" // for TString
20
21#include "TClonesArray.h"
22#include "TVirtualMC.h"
23
24#include "TGeoBBox.h"
25#include "TGeoTrd1.h"
26#include "TGeoCompositeShape.h"
27#include "TGeoTube.h"
28#include "TGeoMaterial.h"
29#include "TGeoMedium.h"
30#include "TGeoTrd1.h"
31#include "TGeoArb8.h"
32
33#include "TParticle.h"
34#include "TParticlePDG.h"
35#include "TParticleClassPDG.h"
36#include "TVirtualMCStack.h"
37
38#include "FairVolume.h"
39#include "FairGeoVolume.h"
40#include "FairGeoNode.h"
41#include "FairRootManager.h"
42#include "FairGeoLoader.h"
43#include "FairGeoInterface.h"
44#include "FairGeoTransform.h"
45#include "FairGeoMedia.h"
46#include "FairGeoMedium.h"
47#include "FairGeoBuilder.h"
48#include "FairRun.h"
49#include "FairRuntimeDb.h"
50
51#include "ShipDetectorList.h"
52#include "ShipUnit.h"
53#include "ShipStack.h"
54#include "EmulsionMagnet.h"
55
56#include "TGeoUniformMagField.h"
57#include "TVector3.h"
58
59#include <stddef.h> // for NULL
60#include <iostream> // for operator<<, basic_ostream,etc
61#include <string.h>
62
63using std::cout;
64using std::endl;
65
66using namespace ShipUnit;
67
69 : FairDetector("Target", "",kTRUE),
70 fTrackID(-1),
71 fVolumeID(-1),
72 fPos(),
73 fMom(),
74 fTime(-1.),
75 fLength(-1.),
76 fELoss(-1),
77 fTargetPointCollection(new TClonesArray("TargetPoint"))
78{
79}
80
81Target::Target(const char* name, const Double_t Ydist, Bool_t Active, const char* Title)
82 : FairDetector(name, true, ktauTarget),
83 fTrackID(-1),
84 fVolumeID(-1),
85 fPos(),
86 fMom(),
87 fTime(-1.),
88 fLength(-1.),
89 fELoss(-1),
90 fTargetPointCollection(new TClonesArray("TargetPoint"))
91{
92 Ydistance = Ydist;
93}
94
96{
98 fTargetPointCollection->Delete();
100 }
101}
102
104{
105 FairDetector::Initialize();
106}
107
108// ----- Private method InitMedium
109Int_t Target::InitMedium(const char* name)
110{
111 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
112 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
113 static FairGeoMedia *media=geoFace->getMedia();
114 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
115
116 FairGeoMedium *ShipMedium=media->getMedium(name);
117
118 if (!ShipMedium)
119 {
120 Fatal("InitMedium","Material %s not defined in media file.", name);
121 return -1111;
122 }
123 TGeoMedium* medium=gGeoManager->GetMedium(name);
124 if (medium!=NULL)
125 return ShipMedium->getMediumIndex();
126 return geoBuild->createMedium(ShipMedium);
127}
128
129//--------------Options for detector construction
131{
132 fDesign = Design;
133 Info("SetDetectorDesign"," to %i", fDesign);
134}
135
137{
138 fPassive=a;
139}
140
141void Target::MergeTopBot(Bool_t SingleEmFilm)
142{
143 fsingleemulsionfilm=SingleEmFilm;
144}
145
146//--------------------------
147
148void Target::SetNumberBricks(Double_t col, Double_t row, Double_t wall)
149{
150 fNCol = col;
151 fNRow = row;
152 fNWall = wall;
153}
154
155void Target::SetNumberTargets(Int_t target)
156{
157 fNTarget = target;
158}
159
160void Target::SetTargetWallDimension(Double_t WallXDim_, Double_t WallYDim_, Double_t WallZDim_)
161{
162 WallXDim = WallXDim_;
163 WallYDim = WallYDim_;
164 WallZDim = WallZDim_;
165}
166
167void Target::SetDetectorDimension(Double_t xdim, Double_t ydim, Double_t zdim)
168{
169 XDimension = xdim;
170 YDimension = ydim;
171 ZDimension = zdim;
172}
173
174void Target::SetEmulsionParam(Double_t EmTh, Double_t EmX, Double_t EmY, Double_t PBTh, Double_t EPlW,Double_t LeadTh, Double_t AllPW)
175{
176 EmulsionThickness = EmTh;
177 EmulsionX = EmX;
178 EmulsionY = EmY;
180 EmPlateWidth = EPlW;
181 LeadThickness = LeadTh;
182 AllPlateWidth = AllPW;
183}
184
185
186void Target::SetBrickParam(Double_t BrX, Double_t BrY, Double_t BrZ, Double_t BrPackX, Double_t BrPackY, Double_t BrPackZ, Int_t number_of_plates_)
187{
188 BrickPackageX = BrPackX;
189 BrickPackageY = BrPackY;
190 BrickPackageZ = BrPackZ;
191 BrickX = BrX;
192 BrickY = BrY;
193 BrickZ = BrZ;
194 number_of_plates = number_of_plates_;
195}
196
197void Target::SetCESParam(Double_t RohG, Double_t LayerCESW,Double_t CESW, Double_t CESPack)
198{
199 CESPackageZ = CESPack;
200 LayerCESWidth = LayerCESW;
201 RohacellGap = RohG;
202 CESWidth = CESW;
203}
204
205void Target::SetCellParam(Double_t CellW)
206{
207 CellWidth = CellW;
208}
209
210void Target::SetTTzdimension(Double_t TTZ)
211{
212 TTrackerZ = TTZ;
213}
214
216{
217 fMagnetY=Y;
218}
219
221{
222 fColumnY=Y;
223}
224
225void Target::SetBaseHeight(Double_t Y)
226{
227 fMagnetBaseY=Y;
228}
229
230void Target::SetCoilUpHeight(Double_t H1)
231{
232 fCoilH1=H1;
233}
234
236{
237 fCoilH2=H2;
238}
239
241{
242 fField = B;
243}
244
245void Target::SetCenterZ(Double_t z)
246{
247 fCenterZ = z;
248}
249
250void Target::SetBaseDimension(Double_t x, Double_t y, Double_t z)
251{
252 fBaseX=x;
253 fBaseY=y;
254 fBaseZ=z;
255}
256
257
258void Target::SetPillarDimension(Double_t x, Double_t y, Double_t z)
259{
260 fPillarX=x;
261 fPillarY=y;
262 fPillarZ=z;
263}
264
265void Target::SetHpTParam(Int_t n, Double_t dd, Double_t DZ) //need to know about HPT.cxx geometry to place additional targets
266{
267 fnHpT = n;
268 fHpTDistance = dd;
269 fHpTDZ = DZ;
270}
271
273{
274 // cout << "Design = " << fDesign << endl;
275 TGeoVolume *top=gGeoManager->GetTopVolume();
276
277 InitMedium("air");
278 TGeoMedium *air =gGeoManager->GetMedium("air");
279
280 InitMedium("iron");
281 TGeoMedium *Fe =gGeoManager->GetMedium("iron");
282
283 InitMedium("CoilAluminium");
284 TGeoMedium *Al = gGeoManager->GetMedium("CoilAluminium");
285
286 InitMedium("CoilCopper");
287 TGeoMedium *Cu = gGeoManager->GetMedium("CoilCopper");
288
289 InitMedium("PlasticBase");
290 TGeoMedium *PBase =gGeoManager->GetMedium("PlasticBase");
291
292 InitMedium("NuclearEmulsion");
293 TGeoMedium *NEmu =gGeoManager->GetMedium("NuclearEmulsion");
294
295 TGeoMaterial *NEmuMat = NEmu->GetMaterial(); //I need the materials to build the mixture
296 TGeoMaterial *PBaseMat = PBase->GetMaterial();
297
298 Double_t rho_film = (NEmuMat->GetDensity() * 2 * EmulsionThickness + PBaseMat->GetDensity() * PlasticBaseThickness)/(2* EmulsionThickness + PlasticBaseThickness);
299 Double_t frac_emu = NEmuMat->GetDensity() * 2 * EmulsionThickness /(NEmuMat->GetDensity() * 2 * EmulsionThickness + PBaseMat->GetDensity() * PlasticBaseThickness);
300
301 if (fsingleemulsionfilm) cout<<"TARGET PRINTOUT: Single volume for emulsion film chosen: average density: "<<rho_film<<" fraction in mass of emulsion "<<frac_emu<<endl;
302
303 TGeoMixture * emufilmmixture = new TGeoMixture("EmulsionFilmMixture", 2.00); // two nuclear emulsions separated by the plastic base
304
305 emufilmmixture->AddElement(NEmuMat,frac_emu);
306 emufilmmixture->AddElement(PBaseMat,1. - frac_emu);
307
308 TGeoMedium *Emufilm = new TGeoMedium("EmulsionFilm",100,emufilmmixture);
309
310 InitMedium("lead");
311 TGeoMedium *lead = gGeoManager->GetMedium("lead");
312
313 InitMedium("rohacell");
314 TGeoMedium *rohacell = gGeoManager->GetMedium("rohacell");
315
316 InitMedium("Concrete");
317 TGeoMedium *Conc =gGeoManager->GetMedium("Concrete");
318
319 InitMedium("steel");
320 TGeoMedium *Steel =gGeoManager->GetMedium("steel");
321
322 Int_t NPlates = number_of_plates; //Number of doublets emulsion + Pb
323 Int_t NRohacellGap = 2;
324
325 //Definition of the target box containing emulsion bricks + (CES if fDesign = 0 o 1) + target trackers (TT)
326 TGeoBBox *TargetBox = new TGeoBBox("TargetBox",XDimension/2, YDimension/2, ZDimension/2);
327 TGeoVolume *volTarget = new TGeoVolume("volTarget",TargetBox, air);
328
329 // In both fDesign=0 & fDesign=1 the emulsion target is inserted within a magnet
330 if(fDesign!=2)
331 {
332 TGeoVolume *MagnetVol;
333
334 //magnetic field in target
335 TGeoUniformMagField *magField2 = new TGeoUniformMagField();
336
337 if(fDesign==1) //TP
338 {
339 magField2->SetFieldValue(fField,0,0.);
340 MagnetVol=gGeoManager->GetVolume("Davide");
341 }
342 if(fDesign==0) //NEW
343 {
344 MagnetVol=gGeoManager->GetVolume("Goliath");
345 magField2->SetFieldValue(0.,fField,0.);
346 }
347 if(fDesign==3)
348 {
349 magField2->SetFieldValue(fField,0,0.);
350 MagnetVol=gGeoManager->GetVolume("NudetMagnet");
351 }
352
353 //Definition of the target box containing emulsion bricks + CES + target trackers (TT)
354 if (fDesign != 3) volTarget->SetField(magField2);
355 volTarget->SetVisibility(1);
356 volTarget->SetVisDaughters(1);
357 if(fDesign==0) //TP
358 MagnetVol->AddNode(volTarget,1,new TGeoTranslation(0,-fMagnetY/2+fColumnY+fCoilH2+YDimension/2,0));
359 if(fDesign==1) //NEW
360 MagnetVol->AddNode(volTarget,1,new TGeoTranslation(0,-fMagnetY/2+fColumnY+YDimension/2,0));
361 if(fDesign==3){
362 TGeoVolume *volMagRegion=gGeoManager->GetVolume("volMagRegion");
363 Double_t ZDimMagnetizedRegion = ((TGeoBBox*) volMagRegion->GetShape())->GetDZ() * 2.; //n.d.r. DZ is the semidimension
364 for (int i = 0; i < fNTarget; i++){
365 volMagRegion->AddNode(volTarget,i+1,new TGeoTranslation(0,0, -ZDimMagnetizedRegion/2 + ZDimension/2. + i*(ZDimension + 3 * fHpTDZ + 2* fHpTDistance)));
366 }
367 }
368 }
369
370
371
372
373
374
375
376 //
377 //Volumes definition
378 //
379
380 TGeoBBox *Cell = new TGeoBBox("cell", BrickX/2, BrickY/2, CellWidth/2);
381 TGeoVolume *volCell = new TGeoVolume("Cell",Cell,air);
382
383 //Brick
384 TGeoBBox *Brick = new TGeoBBox("brick", BrickX/2, BrickY/2, BrickZ/2);
385 TGeoVolume *volBrick = new TGeoVolume("Brick",Brick,air);
386 volBrick->SetLineColor(kCyan);
387 volBrick->SetTransparency(1);
388
389 TGeoBBox *Lead = new TGeoBBox("Pb", EmulsionX/2, EmulsionY/2, LeadThickness/2);
390 TGeoVolume *volLead = new TGeoVolume("Lead",Lead,lead);
391 volLead->SetTransparency(1);
392 volLead->SetLineColor(kGray);
393 //volLead->SetField(magField2);
394
395 for(Int_t n=0; n<NPlates; n++)
396 {
397 volBrick->AddNode(volLead, n, new TGeoTranslation(0,0,-BrickZ/2+BrickPackageZ/2+ EmPlateWidth + LeadThickness/2 + n*AllPlateWidth)); //LEAD
398 }
399 if (fsingleemulsionfilm){ //simplified configuration, unique sensitive layer for the whole emulsion plate
400 TGeoBBox *EmulsionFilm = new TGeoBBox("EmulsionFilm", EmulsionX/2, EmulsionY/2, EmPlateWidth/2);
401 TGeoVolume *volEmulsionFilm = new TGeoVolume("Emulsion",EmulsionFilm,Emufilm); //TOP
402 volEmulsionFilm->SetLineColor(kBlue);
403
404 if(fPassive==0)
405 {
406 AddSensitiveVolume(volEmulsionFilm);
407 }
408
409 for(Int_t n=0; n<NPlates+1; n++)
410 {
411 volBrick->AddNode(volEmulsionFilm, n, new TGeoTranslation(0,0,-BrickZ/2+BrickPackageZ/2+ EmPlateWidth/2 + n*AllPlateWidth));
412 }
413 }
414 else { //more accurate configuration, two emulsion films divided by a plastic base
415 TGeoBBox *EmulsionFilm = new TGeoBBox("EmulsionFilm", EmulsionX/2, EmulsionY/2, EmulsionThickness/2);
416 TGeoVolume *volEmulsionFilm = new TGeoVolume("Emulsion",EmulsionFilm,NEmu); //TOP
417 TGeoVolume *volEmulsionFilm2 = new TGeoVolume("Emulsion2",EmulsionFilm,NEmu); //BOTTOM
418 volEmulsionFilm->SetLineColor(kBlue);
419 volEmulsionFilm2->SetLineColor(kBlue);
420
421 if(fPassive==0)
422 {
423 AddSensitiveVolume(volEmulsionFilm);
424 AddSensitiveVolume(volEmulsionFilm2);
425 }
426 TGeoBBox *PlBase = new TGeoBBox("PlBase", EmulsionX/2, EmulsionY/2, PlasticBaseThickness/2);
427 TGeoVolume *volPlBase = new TGeoVolume("PlasticBase",PlBase,PBase);
428 volPlBase->SetLineColor(kYellow-4);
429 for(Int_t n=0; n<NPlates+1; n++)
430 {
431 volBrick->AddNode(volEmulsionFilm2, n, new TGeoTranslation(0,0,-BrickZ/2+BrickPackageZ/2+ EmulsionThickness/2 + n*AllPlateWidth)); //BOTTOM
432 volBrick->AddNode(volEmulsionFilm, n, new TGeoTranslation(0,0,-BrickZ/2+BrickPackageZ/2+3*EmulsionThickness/2+PlasticBaseThickness+n*AllPlateWidth)); //TOP
433 volBrick->AddNode(volPlBase, n, new TGeoTranslation(0,0,-BrickZ/2+BrickPackageZ/2+EmulsionThickness+PlasticBaseThickness/2+n*AllPlateWidth)); //PLASTIC BASE
434 }
435 }
436
437 volBrick->SetVisibility(kTRUE);
438
439 //The CES is required only in the option with magnet surrounding the emulsion target
440 if(fDesign!=2)
441 {
442 //CES
443
444 TGeoBBox *CES = new TGeoBBox("ces", EmulsionX/2, EmulsionY/2, CESWidth/2);
445 TGeoVolume *volCES = new TGeoVolume("CES", CES, air);
446 volCES->SetTransparency(5);
447 volCES->SetLineColor(kYellow-10);
448 volCES->SetVisibility(kTRUE);
449
450 TGeoBBox *RohGap = new TGeoBBox("RohGap", EmulsionX/2, EmulsionY/2, RohacellGap/2);
451 TGeoVolume *volRohGap = new TGeoVolume("RohacellGap",RohGap,air); //using AIR for CES, not rohacell
452 volRohGap->SetTransparency(1);
453 volRohGap->SetLineColor(kYellow);
454
455 for(Int_t n=0; n<NRohacellGap; n++)
456 {
457 volCES->AddNode(volRohGap, n, new TGeoTranslation(0,0,-CESWidth/2 +CESPackageZ/2+ EmPlateWidth + RohacellGap/2 + n*LayerCESWidth)); //ROHACELL
458 }
459 if(fsingleemulsionfilm){ //simplified configuration, unique sensitive layer for the whole emulsion plate
460 TGeoBBox *EmulsionFilmCES = new TGeoBBox("EmulsionFilmCES", EmulsionX/2, EmulsionY/2, EmPlateWidth/2);
461 TGeoVolume *volEmulsionFilmCES = new TGeoVolume("EmulsionCES",EmulsionFilmCES,Emufilm); //TOP
462 volEmulsionFilmCES->SetLineColor(kBlue);
463 if(fPassive==0)
464 {
465 AddSensitiveVolume(volEmulsionFilmCES);
466 }
467
468 for(Int_t n=0; n<NRohacellGap+1;n++)
469 {
470 volCES->AddNode(volEmulsionFilmCES,n, new TGeoTranslation(0,0,-CESWidth/2+CESPackageZ/2+EmPlateWidth/2+n*LayerCESWidth));
471 }
472
473 }
474 else{ //more accurate configuration, two emulsion films divided by a plastic base
475
476 TGeoBBox *EmulsionFilmCES = new TGeoBBox("EmulsionFilmCES", EmulsionX/2, EmulsionY/2, EmulsionThickness/2);
477 TGeoVolume *volEmulsionFilmCES = new TGeoVolume("EmulsionCES",EmulsionFilmCES,NEmu); //TOP
478 TGeoVolume *volEmulsionFilm2CES = new TGeoVolume("Emulsion2CES",EmulsionFilmCES,NEmu); //BOTTOM
479 volEmulsionFilmCES->SetLineColor(kBlue);
480 volEmulsionFilm2CES->SetLineColor(kBlue);
481 if(fPassive==0)
482 {
483 AddSensitiveVolume(volEmulsionFilmCES);
484 AddSensitiveVolume(volEmulsionFilm2CES);
485 }
486 //CES PLASTIC BASE
487 TGeoBBox *PlBaseCES = new TGeoBBox("PlBaseCES", EmulsionX/2, EmulsionY/2, PlasticBaseThickness/2);
488 TGeoVolume *volPlBaseCES = new TGeoVolume("PlasticBaseCES",PlBaseCES,PBase);
489 volPlBaseCES->SetLineColor(kYellow);
490 for(Int_t n=0; n<NRohacellGap+1;n++)
491 {
492 volCES->AddNode(volEmulsionFilm2CES,n, new TGeoTranslation(0,0,-CESWidth/2+CESPackageZ/2+EmulsionThickness/2+n*LayerCESWidth)); //BOTTOM
493 volCES->AddNode(volEmulsionFilmCES, n, new TGeoTranslation(0,0,-CESWidth/2+CESPackageZ/2+3*EmulsionThickness/2+PlasticBaseThickness+n*LayerCESWidth)); //TOP
494 volCES->AddNode(volPlBaseCES, n, new TGeoTranslation(0,0,-CESWidth/2+CESPackageZ/2+EmulsionThickness+PlasticBaseThickness/2+n*LayerCESWidth)); //PLASTIC BASE
495 // if(n == 2)
496 // cout << "-CESWidth/2+3*EmulsionThickness/2+PlasticBaseThickness+n*LayerCESWidth = " << -CESWidth/2+3*EmulsionThickness/2+PlasticBaseThickness+n*LayerCESWidth << endl;
497 }
498
499 }
500
501 volCell->AddNode(volBrick,1,new TGeoTranslation(0,0,-CellWidth/2 + BrickZ/2));
502 volCell->AddNode(volCES,1,new TGeoTranslation(0,0,-CellWidth/2 + BrickZ + CESWidth/2));
503
504 TGeoBBox *Row = new TGeoBBox("row",XDimension/2, BrickY/2, CellWidth/2);
505 TGeoVolume *volRow = new TGeoVolume("Row",Row,air);
506 volRow->SetLineColor(20);
507
508 Double_t d_cl_x = -WallXDim/2;
509 for(int j= 0; j < fNCol; j++)
510 {
511 volRow->AddNode(volCell,j,new TGeoTranslation(d_cl_x+BrickX/2, 0, 0));
512 d_cl_x += BrickX;
513 }
514
515 TGeoBBox *Wall = new TGeoBBox("wall",XDimension/2, YDimension/2, CellWidth/2);
516 TGeoVolume *volWall = new TGeoVolume("Wall",Wall,air);
517
518 Double_t d_cl_y = -WallYDim/2;
519 for(int k= 0; k< fNRow; k++)
520 {
521 volWall->AddNode(volRow,k,new TGeoTranslation(0, d_cl_y + BrickY/2, 0));
522
523 // 2mm is the distance for the structure that holds the brick
524 d_cl_y += BrickY + Ydistance;
525 }
526
527 //Columns
528
529 Double_t d_cl_z = - ZDimension/2 + TTrackerZ;
530 Double_t d_tt = -ZDimension/2 + TTrackerZ/2;
531
532 for(int l = 0; l < fNWall; l++)
533 {
534 volTarget->AddNode(volWall,l,new TGeoTranslation(0, 0, d_cl_z +CellWidth/2));
535
536 //6 cm is the distance between 2 columns of consecutive Target for TT placement
537 d_cl_z += CellWidth + TTrackerZ;
538 }
539 }
540
541
542 //in fDesign==2 the emulsion target is not surrounded by a magnet => no magnetic field inside
543 //In the no Magnetic field option, no CES is needed => only brick walls + TT
544 if(fDesign==2)
545 {
546 EmulsionMagnet emuMag;
547
548 TGeoVolume *tTauNuDet = gGeoManager->GetVolume("tTauNuDet");
549 cout<< "Tau Nu Detector fMagnetConfig: "<< fDesign<<endl;
550
551 tTauNuDet->AddNode(volTarget,1,new TGeoTranslation(0,0,fCenterZ));
552
553 TGeoBBox *Row = new TGeoBBox("row",XDimension/2, BrickY/2, CellWidth/2);
554 TGeoVolume *volRow = new TGeoVolume("Row",Row,air);
555 volRow->SetLineColor(20);
556
557 Double_t d_cl_x = -WallXDim/2;
558 for(int j= 0; j < fNCol; j++)
559 {
560 volRow->AddNode(volBrick,j,new TGeoTranslation(d_cl_x+BrickX/2, 0, 0));
561 d_cl_x += BrickX;
562 }
563 TGeoBBox *Wall = new TGeoBBox("wall",XDimension/2, YDimension/2, BrickZ/2);
564 TGeoVolume *volWall = new TGeoVolume("Wall",Wall,air);
565
566 Double_t d_cl_y = -WallYDim/2;
567 for(int k= 0; k< fNRow; k++)
568 {
569 volWall->AddNode(volRow,k,new TGeoTranslation(0, d_cl_y + BrickY/2, 0));
570
571 // 2mm is the distance for the structure that holds the brick
572 d_cl_y += BrickY + Ydistance;
573 }
574 //Columns
575
576 Double_t d_cl_z = - ZDimension/2 + TTrackerZ;
577 Double_t d_tt = -ZDimension/2 + TTrackerZ/2;
578
579 for(int l = 0; l < fNWall; l++)
580 {
581 volTarget->AddNode(volWall,l,new TGeoTranslation(0, 0, d_cl_z +BrickZ/2));
582
583 //6 cm is the distance between 2 columns of consecutive Target for TT placement
584 d_cl_z += BrickZ + TTrackerZ;
585 }
586
587 TGeoBBox *Base = new TGeoBBox("Base", fBaseX/2, fBaseY/2, fBaseZ/2);
588 TGeoVolume *volBase = new TGeoVolume("volBase",Base,Conc);
589 volBase->SetLineColor(kYellow-3);
590 tTauNuDet->AddNode(volBase,1, new TGeoTranslation(0,-WallYDim/2 - fBaseY/2,fCenterZ));
591
592 if(fDesign==2)
593 {
594 TGeoBBox *PillarBox = new TGeoBBox(fPillarX/2,fPillarY/2, fPillarZ/2);
595 TGeoVolume *PillarVol = new TGeoVolume("PillarVol",PillarBox,Steel);
596 PillarVol->SetLineColor(kGreen+3);
597 tTauNuDet->AddNode(PillarVol,1, new TGeoTranslation(-XDimension/2+fPillarX/2,-YDimension/2-fBaseY-fPillarY/2, fCenterZ-ZDimension/2+fPillarZ/2));
598 tTauNuDet->AddNode(PillarVol,2, new TGeoTranslation(XDimension/2-fPillarX/2,-YDimension/2-fBaseY-fPillarY/2, fCenterZ-ZDimension/2+fPillarZ/2));
599 tTauNuDet->AddNode(PillarVol,3, new TGeoTranslation(-XDimension/2+fPillarX/2,-YDimension/2-fBaseY-fPillarY/2, fCenterZ+ZDimension/2-fPillarZ/2));
600 tTauNuDet->AddNode(PillarVol,4, new TGeoTranslation(XDimension/2-fPillarX/2,-YDimension/2-fBaseY-fPillarY/2, fCenterZ+ZDimension/2-fPillarZ/2));
601 }
602 }
603}
604
605Bool_t Target::ProcessHits(FairVolume* vol)
606{
608 //Set parameters at entrance of volume. Reset ELoss.
609 if ( gMC->IsTrackEntering() ) {
610 fELoss = 0.;
611 fTime = gMC->TrackTime() * 1.0e09;
612 fLength = gMC->TrackLength();
613 gMC->TrackPosition(fPos);
614 gMC->TrackMomentum(fMom);
615 }
616 // Sum energy loss for all steps in the active volume
617 fELoss += gMC->Edep();
618
619 // Create muonPoint at exit of active volume
620 if ( gMC->IsTrackExiting() ||
621 gMC->IsTrackStop() ||
622 gMC->IsTrackDisappeared() ) {
623 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
624 //Int_t fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
625 gMC->CurrentVolID(fVolumeID);
626 Int_t detID = fVolumeID;
627 //gGeoManager->PrintOverlaps();
628
629 //cout<< "detID = " << detID << endl;
630 Int_t MaxLevel = gGeoManager->GetLevel();
631 const Int_t MaxL = MaxLevel;
632 //cout << "MaxLevel = " << MaxL << endl;
633 //cout << gMC->CurrentVolPath()<< endl;
634
635
636 Int_t motherV[MaxL];
637// Bool_t EmTop = 0, EmBot = 0, EmCESTop = 0, EmCESBot = 0;
638 Bool_t EmBrick = 0, EmCES = 0, EmTop;
639 Int_t NPlate =0;
640 const char *name;
641
642 name = gMC->CurrentVolName();
643 //cout << name << endl;
644
645 if(strcmp(name, "Emulsion") == 0)
646 {
647 EmBrick=1;
648 NPlate = detID;
649 EmTop=1;
650 }
651 if(strcmp(name, "Emulsion2") == 0)
652 {
653 EmBrick=1;
654 NPlate = detID;
655 EmTop=0;
656 }
657 if(strcmp(name, "EmulsionCES") == 0)
658 {
659 EmCES=1;
660 NPlate = detID;
661 EmTop=1;
662 }
663 if(strcmp(name, "Emulsion2CES") == 0)
664 {
665 EmCES=1;
666 NPlate = detID;
667 EmTop=0;
668 }
669
670 Int_t NWall = 0, NColumn =0, NRow =0;
671
672 for(Int_t i = 0; i < MaxL;i++)
673 {
674 motherV[i] = gGeoManager->GetMother(i)->GetNumber();
675 const char *mumname = gMC->CurrentVolOffName(i);
676 if(motherV[0]==1 && motherV[0]!=detID)
677 {
678 if(strcmp(mumname, "Brick") == 0 ||strcmp(mumname, "CES") == 0) NColumn = motherV[i];
679 if(strcmp(mumname, "Cell") == 0) NRow = motherV[i];
680 if(strcmp(mumname, "Row") == 0) NWall = motherV[i];
681 if((strcmp(mumname, "Wall") == 0)&& (motherV[i]==2)) NWall += fNWall;
682 }
683 else
684 {
685
686 if(strcmp(mumname, "Cell") == 0) NColumn = motherV[i];
687 if(strcmp(mumname, "Row") == 0) NRow = motherV[i];
688 if(strcmp(mumname, "Wall") == 0) NWall = motherV[i];
689 if((strcmp(mumname, "volTarget") == 0) && (motherV[i]==2)) NWall += fNWall;
690 }
691 //cout << i << " " << motherV[i] << " name = " << mumname << endl;
692 }
693
694 Bool_t BrickorCES = 0; //Brick = 1 / CES = 0;
695 if(EmBrick==1)
696 BrickorCES = 1;
697
698 Double_t zEnd = 0, zStart =0;
699
700
701 detID = (NWall+1) *1E7 + (NRow+1) * 1E6 + (NColumn+1)*1E4 + BrickorCES *1E3 + (NPlate+1)*1E1 + EmTop*1 ;
702
703
704 fVolumeID = detID;
705
706 if (fELoss == 0. ) { return kFALSE; }
707 TParticle* p=gMC->GetStack()->GetCurrentTrack();
708 //Int_t MotherID =gMC->GetStack()->GetCurrentParentTrackNumber();
709 Int_t fMotherID =p->GetFirstMother();
710 Int_t pdgCode = p->GetPdgCode();
711
712 // cout << "ID = "<< fTrackID << " pdg = " << pdgCode << "; M = " << fMotherID << " Npl = " << NPlate<<"; NCol = " << NColumn << "; NRow = " << NRow << "; NWall = " << NWall<< " P = " << fMom.Px() << ", "<< fMom.Py() << ", " << fMom.Pz() << endl;
713
714 TLorentzVector Pos;
715 gMC->TrackPosition(Pos);
716 Double_t xmean = (fPos.X()+Pos.X())/2. ;
717 Double_t ymean = (fPos.Y()+Pos.Y())/2. ;
718 Double_t zmean = (fPos.Z()+Pos.Z())/2. ;
719
720
721 AddHit(fTrackID,fVolumeID, TVector3(xmean, ymean, zmean),
722 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
723 fELoss, pdgCode);
724
725 // Increment number of muon det points in TParticle
726 ShipStack* stack = (ShipStack*) gMC->GetStack();
727 stack->AddPoint(ktauTarget);
728 }
729
730 return kTRUE;
731}
732
733
734void Target::DecodeBrickID(Int_t detID, Int_t &NWall, Int_t &NRow, Int_t &NColumn, Int_t &NPlate, Bool_t &EmCES, Bool_t &EmBrick, Bool_t &EmTop)
735{
736 Bool_t BrickorCES = 0, TopBot = 0;
737
738 NWall = detID/1E7;
739 NRow = (detID - NWall*1E7)/1E6;
740 NColumn = (detID - NWall*1E7 -NRow*1E6)/1E4;
741 Double_t b = (detID - NWall*1E7 -NRow*1E6 - NColumn*1E4)/1.E3;
742 if(b < 1)
743 {
744 BrickorCES = 0;
745 NPlate = (detID - NWall*1E7 -NRow*1E6 - NColumn*1E4 - BrickorCES*1E3)/1E1;
746// NPlate = detID - NWall*1E7 -NRow*1E6 - NColumn*1E4 - BrickorCES*1E3;
747 }
748 if(b >= 1)
749 {
750 BrickorCES = 1;
751 NPlate = (detID - NWall*1E7 -NRow*1E6 - NColumn*1E4 - BrickorCES*1E3)/1E1;
752// NPlate = detID - NWall*1E7 -NRow*1E6 - NColumn*1E4 - BrickorCES*1E3;
753 }
754 EmTop = (detID - NWall*1E7 -NRow*1E6 - NColumn*1E4- BrickorCES*1E3- NPlate*1E1)/1E0;
755 if(BrickorCES == 0)
756 {
757 EmCES = 1; EmBrick =0;
758 }
759 if(BrickorCES == 1)
760 {
761 EmBrick = 1; EmCES =0;
762 }
763
764 // cout << "NPlate = " << NPlate << "; NColumn = " << NColumn << "; NRow = " << NRow << "; NWall = " << NWall << endl;
765 // cout << "BrickorCES = " << BrickorCES <<endl;
766 // cout << "EmCES = " << EmCES << "; EmBrick = " << EmBick << endl;
767 // cout << endl;
768}
769
770
772{
773 fTargetPointCollection->Clear();
774}
775
776
778{
779
786 FairRootManager::Instance()->Register("TargetPoint", "Target",
788}
789
790TClonesArray* Target::GetCollection(Int_t iColl) const
791{
792 if (iColl == 0) { return fTargetPointCollection; }
793 else { return NULL; }
794}
795
797{
798 fTargetPointCollection->Clear();
799}
800
801
802TargetPoint* Target::AddHit(Int_t trackID,Int_t detID,
803 TVector3 pos, TVector3 mom,
804 Double_t time, Double_t length,
805 Double_t eLoss, Int_t pdgCode)
806{
807 TClonesArray& clref = *fTargetPointCollection;
808 Int_t size = clref.GetEntriesFast();
809 //cout << "brick hit called"<< pos.z()<<endl;
810 return new(clref[size]) TargetPoint(trackID,detID, pos, mom,
811 time, length, eLoss, pdgCode);
812}
813
815
@ ktauTarget
Double_t fCenterZ
Definition Target.h:153
void SetMagnetHeight(Double_t Y)
Definition Target.cxx:215
void DecodeBrickID(Int_t detID, Int_t &NWall, Int_t &NRow, Int_t &NColumn, Int_t &NPlate, Bool_t &EmCES, Bool_t &EmBrick, Bool_t &EmTop)
Definition Target.cxx:734
void SetHpTParam(Int_t n, Double_t dd, Double_t DZ)
Definition Target.cxx:265
Double_t Ydistance
Definition Target.h:194
Double_t CESWidth
Definition Target.h:202
Double_t BrickPackageY
Definition Target.h:190
Int_t fNRow
Definition Target.h:166
Double32_t fLength
time
Definition Target.h:137
Double_t BrickY
Definition Target.h:197
Double_t fHpTDistance
Definition Target.h:218
void SetCESParam(Double_t RohG, Double_t LayerCESW, Double_t CESW, Double_t CESPack)
Definition Target.cxx:197
ClassDef(Target, 4) private Int_t fVolumeID
track index
Definition Target.h:125
Double_t fBaseX
Definition Target.h:210
Double_t CESPackageZ
Definition Target.h:192
Int_t fnHpT
Definition Target.h:220
virtual ~Target()
Definition Target.cxx:95
virtual void Reset()
Definition Target.cxx:796
Double_t BrickX
Definition Target.h:198
virtual Bool_t ProcessHits(FairVolume *v=0)
Definition Target.cxx:605
void MergeTopBot(Bool_t SingleEmFilm)
Definition Target.cxx:141
Int_t fDesign
Definition Target.h:150
Double_t fBaseZ
Definition Target.h:212
Double_t LeadThickness
Definition Target.h:184
Double_t PlasticBaseThickness
Definition Target.h:183
void SetCoilDownHeight(Double_t H2)
Definition Target.cxx:235
virtual void Register()
Definition Target.cxx:777
TClonesArray * fTargetPointCollection
energy loss
Definition Target.h:141
virtual TClonesArray * GetCollection(Int_t iColl) const
Definition Target.cxx:790
virtual void Initialize()
Definition Target.cxx:103
void SetNumberBricks(Double_t col, Double_t row, Double_t wall)
Definition Target.cxx:148
Double_t fField
Definition Target.h:163
Double_t ZDimension
Definition Target.h:173
void SetNumberTargets(Int_t target)
Definition Target.cxx:155
Double_t CellWidth
Definition Target.h:204
Double_t LayerCESWidth
Definition Target.h:201
Double_t WallXDim
Definition Target.h:175
Double_t EmulsionY
Definition Target.h:181
void SetDetectorDesign(Int_t Design)
Definition Target.cxx:130
Double_t BrickPackageZ
Definition Target.h:191
void SetColumnHeight(Double_t Y)
Definition Target.cxx:220
Double_t RohacellGap
Definition Target.h:200
Target()
Definition Target.cxx:68
Int_t fNTarget
Definition Target.h:168
void SetBrickParam(Double_t BrX, Double_t BrY, Double_t BrZ, Double_t BrPackX, Double_t BrPackY, Double_t BrPackZ, Int_t number_of_plates_)
Definition Target.cxx:186
Double_t fHpTDZ
Definition Target.h:219
void SetTargetWallDimension(Double_t WallXDim, Double_t WallYDim, Double_t WallZDim)
Definition Target.cxx:160
void SetCenterZ(Double_t z)
Definition Target.cxx:245
Double_t BrickPackageX
Definition Target.h:189
Double_t WallYDim
Definition Target.h:176
virtual void EndOfEvent()
Definition Target.cxx:771
void SetDetectorDimension(Double_t xdim, Double_t ydim, Double_t zdim)
Definition Target.cxx:167
Double_t fPillarX
Definition Target.h:213
Int_t InitMedium(const char *name)
Definition Target.cxx:109
Double_t AllPlateWidth
Definition Target.h:186
Int_t number_of_plates
Definition Target.h:169
void SetEmulsionParam(Double_t EmTh, Double_t EmX, Double_t EmY, Double_t PBTh, Double_t EPlW, Double_t LeadTh, Double_t AllPW)
Definition Target.cxx:174
Double_t fBaseY
Definition Target.h:211
Double_t WallZDim
Definition Target.h:177
void SetPillarDimension(Double_t X, Double_t Y, Double_t Z)
Definition Target.cxx:258
Double_t YDimension
Definition Target.h:172
TLorentzVector fPos
volume id
Definition Target.h:134
Double_t fColumnY
Definition Target.h:157
Double32_t fTime
momentum at entrance
Definition Target.h:136
Double_t fMagnetBaseY
Definition Target.h:158
Double_t BrickZ
Definition Target.h:196
Double_t EmulsionThickness
Definition Target.h:179
Int_t fNWall
Definition Target.h:167
void SetCoilUpHeight(Double_t H1)
Definition Target.cxx:230
void SetTTzdimension(Double_t TTZ)
Definition Target.cxx:210
Double_t fPillarZ
Definition Target.h:215
Double32_t fELoss
length
Definition Target.h:138
TargetPoint * AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgCode)
Definition Target.cxx:802
Bool_t fPassive
Definition Target.h:148
void ConstructGeometry()
Definition Target.cxx:272
TLorentzVector fMom
position at entrance
Definition Target.h:135
void SetCellParam(Double_t CellW)
Definition Target.cxx:205
Double_t fCoilH1
Definition Target.h:159
Int_t fNCol
Definition Target.h:165
Bool_t fsingleemulsionfilm
Definition Target.h:149
void SetBaseHeight(Double_t Y)
Definition Target.cxx:225
Double_t TTrackerZ
Definition Target.h:207
Double_t fPillarY
Definition Target.h:214
Double_t EmPlateWidth
Definition Target.h:185
Double_t XDimension
Definition Target.h:171
void MakeNuTargetPassive(Bool_t a)
Definition Target.cxx:136
Double_t fCoilH2
Definition Target.h:160
void SetMagneticField(Double_t B)
Definition Target.cxx:240
Double_t EmulsionX
Definition Target.h:180
Double_t fMagnetY
Definition Target.h:156
void SetBaseDimension(Double_t X, Double_t Y, Double_t Z)
Definition Target.cxx:250
ClassImp(ecalContFact) ecalContFact