SND@LHC Software
Loading...
Searching...
No Matches
HPT.cxx
Go to the documentation of this file.
1//
2// TargetTracker.cxx
3//
4//
5// Created by Annarita Buonaura.
6// Design3 added by Antonio Iuliano for HPT
7//
8
9#include "HPT.h"
10#include "NuTauMudet.h"
11#include "HptPoint.h"
12#include "TGeoManager.h"
13#include "FairRun.h" // for FairRun
14#include "FairRuntimeDb.h" // for FairRuntimeDb
15#include <iosfwd> // for ostream
16#include "TList.h" // for TListIter, TList (ptr only)
17#include "TObjArray.h" // for TObjArray
18#include "TString.h" // for TString
19#include "TClonesArray.h"
20#include "TVirtualMC.h"
21
22#include "TGeoBBox.h"
23#include "TGeoTrd1.h"
24#include "TGeoCompositeShape.h"
25#include "TGeoTube.h"
26#include "TGeoMaterial.h"
27#include "TGeoMedium.h"
28#include "TParticle.h"
29#include "TVector3.h"
30
31#include "FairVolume.h"
32#include "FairGeoVolume.h"
33#include "FairGeoNode.h"
34#include "FairRootManager.h"
35#include "FairGeoLoader.h"
36#include "FairGeoInterface.h"
37#include "FairGeoMedia.h"
38#include "FairGeoBuilder.h"
39#include "FairRun.h"
40#include "FairRuntimeDb.h"
41
42#include "ShipDetectorList.h"
43#include "ShipUnit.h"
44#include "ShipStack.h"
45
46#include "TGeoUniformMagField.h"
47#include <stddef.h> // for NULL
48#include <iostream> // for operator<<, basic_ostream, etc
49
50using std::cout;
51using std::endl;
52using namespace ShipUnit;
53
55 : FairDetector("HighPrecisionTrackers",kTRUE, ktauHpt),
56 fTrackID(-1),
57 fPdgCode(),
58 fVolumeID(-1),
59 fPos(),
60 fMom(),
61 fTime(-1.),
62 fLength(-1.),
63 fELoss(-1),
64 fHptPointCollection(new TClonesArray("HptPoint"))
65{
66}
67
68Hpt::Hpt(const char* name, const Double_t DX, const Double_t DY, const Double_t DZ, Bool_t Active,const char* Title)
69 : FairDetector(name, Active, ktauHpt),
70 fTrackID(-1),
71 fPdgCode(),
72 fVolumeID(-1),
73 fPos(),
74 fMom(),
75 fTime(-1.),
76 fLength(-1.),
77 fELoss(-1),
78 fHptPointCollection(new TClonesArray("HptPoint"))
79{
80 DimX = DX;
81 DimY = DY;
82 DimZ = DZ;
83}
84
86{
88 fHptPointCollection->Delete();
90 }
91}
92
94{
95 FairDetector::Initialize();
96}
97
98//Sets the dimension of the Magnetic Spectrometer volume in which the HPT are placed
99void Hpt::SetZsize(const Double_t Mudetsize)
100{
101 zSizeMudet = Mudetsize;
102}
103
104//Sets the dimension of the concrete base on which the external couples of HPTs are placed
105void Hpt::SetConcreteBaseDim(Double_t X, Double_t Y, Double_t Z)
106{
107 fConcreteX = X;
108 fConcreteY = Y;
109 fConcreteZ = Z;
110}
111
112void Hpt::SetDistanceHPTs(Double_t dd) //only for geometry 3
113{
114 fDistance = dd;
115}
116
117void Hpt::SetHPTNumber(Int_t nHPT)
118{
119 fnHPT = nHPT;
120}
121
122void Hpt::SetDesign(Int_t Design)
123{
124 fDesign = Design;
125}
126
127void Hpt::SetSurroundingDetHeight(Double_t height)
128{
129 fSRHeight = height;
130}
131
132void Hpt::GetMagnetGeometry(Double_t EmuzC, Double_t EmuY)
133{
134 fmagnetcenter = EmuzC;
135 fmagnety = EmuY;
136}
137
138void Hpt::GetNumberofTargets(Int_t ntarget) //in nutautargetdesign 3 more than one neutrino target are considered
139{
140 fntarget = ntarget;
141}
142
143// ----- Private method InitMedium
144Int_t Hpt::InitMedium(const char* name)
145{
146 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
147 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
148 static FairGeoMedia *media=geoFace->getMedia();
149 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
150
151 FairGeoMedium *ShipMedium=media->getMedium(name);
152
153 if (!ShipMedium)
154 {
155 Fatal("InitMedium","Material %s not defined in media file.", name);
156 return -1111;
157 }
158 TGeoMedium* medium=gGeoManager->GetMedium(name);
159 if (medium!=NULL)
160 return ShipMedium->getMediumIndex();
161 return geoBuild->createMedium(ShipMedium);
162}
163
164void Hpt::SetSciFiParam(Double_t scifimat_width_, Double_t scifimat_hor_, Double_t scifimat_vert_,
165 Double_t scifimat_z_, Double_t support_z_, Double_t honeycomb_z_)
166{
167 scifimat_width = scifimat_width_;
168 scifimat_hor = scifimat_hor_;
169 scifimat_vert = scifimat_vert_;
170 scifimat_z = scifimat_z_;
171 support_z = support_z_;
172 honeycomb_z = honeycomb_z_;
173}
174
175void Hpt::SetNumberSciFi(Int_t n_hor_planes_, Int_t n_vert_planes_)
176{
177 n_hor_planes = n_hor_planes_;
178 n_vert_planes = n_vert_planes_;
179}
180
181void Hpt::SetHPTrackerParam(Double_t HPTX, Double_t HPTY, Double_t HPTZ)
182{
183 HPTrackerX = HPTX;
184 HPTrackerY = HPTY;
185 HPTrackerZ = HPTZ;
186}
187
189{
190 InitMedium("HPTgas");
191 TGeoMedium *HPTmat =gGeoManager->GetMedium("HPTgas");
192
193 InitMedium("Concrete");
194 TGeoMedium *Conc =gGeoManager->GetMedium("Concrete");
195
196 // cout << "zSizeMudet = " << zSizeMudet << endl;
197 if (fDesign < 3){
198 TGeoVolume *volMudetBox = gGeoManager->GetVolume("volNuTauMudet");
199 TGeoBBox *HPT = new TGeoBBox("HPT", DimX/2, DimY/2, DimZ/2);
200 TGeoVolume *volHPT = new TGeoVolume("volHPT",HPT,HPTmat);
201 volHPT->SetLineColor(kBlue-5);
202 AddSensitiveVolume(volHPT);
203
204 TGeoBBox *Cbase = new TGeoBBox("Cbase", fConcreteX/2, fConcreteY/2, fConcreteZ/2);
205 TGeoVolume *volCbase = new TGeoVolume("volCbase",Cbase,Conc);
206 volCbase->SetLineColor(kOrange-7);
207
208 //1 closer to Goliath
209 volMudetBox->AddNode(volHPT,1,new TGeoTranslation(0,0,-zSizeMudet/2 + DimZ/2));
210 volMudetBox->AddNode(volCbase,1,new TGeoTranslation(0,-DimY/2-fConcreteY/2,-zSizeMudet/2 + DimZ/2));
211
212 //2 closer to Arm1
213 //NB: 55 cm is the distance between the borders of the last 2 drift tubes
214 volMudetBox->AddNode(volHPT,2,new TGeoTranslation(0,0,-zSizeMudet/2 + 3*DimZ/2 +55*cm));
215 volMudetBox->AddNode(volCbase,2,new TGeoTranslation(0,-DimY/2-fConcreteY/2,-zSizeMudet/2 + 3*DimZ/2 +55*cm));
216
217 //Central Drift tubes // 3 closer to Arm1, 4 closer to Arm2
218 volMudetBox->AddNode(volHPT,3,new TGeoTranslation(0,0,-72*cm/2 - DimZ/2));
219
220 //NB: 72cm is the distance between the borders of the central drift tubes
221 volMudetBox->AddNode(volHPT,4,new TGeoTranslation(0,0,72*cm/2 + DimZ/2));
222
223
224 //After spectro Drift Tubes 5 closer to Arm, 6 closer to decay vessel
225 volMudetBox->AddNode(volHPT,5,new TGeoTranslation(0,0,zSizeMudet/2 - 3*DimZ/2 - 55*cm));
226 volMudetBox->AddNode(volCbase,5,new TGeoTranslation(0,-DimY/2-fConcreteY/2,zSizeMudet/2 - 3*DimZ/2 - 55*cm));
227
228 volMudetBox->AddNode(volHPT,6,new TGeoTranslation(0,0,zSizeMudet/2 - DimZ/2));
229 volMudetBox->AddNode(volCbase,6,new TGeoTranslation(0,-DimY/2-fConcreteY/2,zSizeMudet/2 - DimZ/2));
230
231 }
232 if (fDesign == 3){
233 //Trackers that in design 3 follow the target --------------------------------------------------------------------------------------
234 TGeoVolume *volMagRegion=gGeoManager->GetVolume("volMagRegion");
235 TGeoVolume *volTarget =gGeoManager->GetVolume("volTarget");
236 TGeoVolume *tTauNuDet = gGeoManager->GetVolume("tTauNuDet");
237
238 Double_t DZMagnetizedRegion = ((TGeoBBox*) volMagRegion->GetShape())->GetDZ() *2;
239 Double_t DYMagnetizedRegion = ((TGeoBBox*) volMagRegion->GetShape())->GetDY() *2;
240 Double_t DXMagnetizedRegion = ((TGeoBBox*) volMagRegion->GetShape())->GetDX() *2;
241
242 Double_t DZTarget = ((TGeoBBox*) volTarget->GetShape())->GetDZ() *2;
243
244 //HPT is DownStreamTracker
245 TGeoBBox *DT = new TGeoBBox("DT", DimX/2, DimY/2, DimZ/2);
246 TGeoVolume *volDT = new TGeoVolume("volDT",DT,HPTmat);
247 volDT->SetLineColor(kBlue-5);
248
249 // Creating of SciFi modules in HPT
250 InitMedium("CarbonComposite");
251 TGeoMedium *CarbonComposite = gGeoManager->GetMedium("CarbonComposite");
252
253 InitMedium("SciFiMat");
254 TGeoMedium *SciFiMat = gGeoManager->GetMedium("SciFiMat");
255
256 InitMedium("Airex");
257 TGeoMedium *Airex = gGeoManager->GetMedium("Airex");
258
259 //Support Carbon Composite
260 TGeoBBox* HPT_support_box = new TGeoBBox("HPT_support_box", HPTrackerX / 2, HPTrackerY / 2, support_z / 2);
261 TGeoVolume* HPT_support_volume = new TGeoVolume("HPT_support", HPT_support_box, CarbonComposite);
262 HPT_support_volume->SetLineColor(kGray - 2);
263 HPT_support_volume->SetVisibility(1);
264
265 //Honeycomb Airex (or Nomex)
266 TGeoBBox* HPT_honeycomb_box = new TGeoBBox("HPT_honeycomb_box", HPTrackerX / 2, HPTrackerY / 2, honeycomb_z / 2);
267 TGeoVolume* HPT_honeycomb_volume = new TGeoVolume("HPT_honeycomb", HPT_honeycomb_box, Airex);
268 HPT_honeycomb_volume->SetLineColor(kYellow);
269 HPT_honeycomb_volume->SetVisibility(1);
270
271 //SciFi planes
272 TGeoBBox* HPT_scifi_plane_hor_box = new TGeoBBox("HPT_scifi_plane_hor_box", HPTrackerX / 2, HPTrackerY / 2, scifimat_z / 2);
273 TGeoVolume* HPT_scifi_plane_hor_volume = new TGeoVolume("HPT_scifi_plane_hor", HPT_scifi_plane_hor_box, SciFiMat);
274 HPT_scifi_plane_hor_volume->SetVisibility(1);
275
276 TGeoBBox* HPT_scifi_plane_vert_box = new TGeoBBox("HPT_scifi_plane_vert_box", HPTrackerX / 2, HPTrackerY / 2, scifimat_z / 2);
277 TGeoVolume* HPT_scifi_plane_vert_volume = new TGeoVolume("HPT_scifi_plane_vert", HPT_scifi_plane_vert_box, SciFiMat);
278 HPT_scifi_plane_vert_volume->SetVisibility(1);
279
280 //SciFi mats
281 TGeoBBox* HPT_scifimat_hor_box = new TGeoBBox("HPT_scifimat_hor_box", scifimat_hor / 2, scifimat_width / 2, scifimat_z / 2);
282 TGeoVolume* HPT_scifimat_hor_volume = new TGeoVolume("HPT_scifimat_hor", HPT_scifimat_hor_box, SciFiMat);
283 HPT_scifimat_hor_volume->SetLineColor(kCyan);
284
285 TGeoBBox* HPT_scifimat_vert_box = new TGeoBBox("HPT_scifimat_vert_box", scifimat_width / 2, scifimat_vert / 2, scifimat_z / 2);
286 TGeoVolume* HPT_scifimat_vert_volume = new TGeoVolume("HPT_scifimat_vert", HPT_scifimat_vert_box, SciFiMat);
287 HPT_scifimat_vert_volume->SetLineColor(kGreen);
288
289 AddSensitiveVolume(HPT_scifimat_hor_volume);
290 AddSensitiveVolume(HPT_scifimat_vert_volume);
291
292 // Creating physical volumes and multiply
293 for (int i = 0; i < n_hor_planes; i++){
294 HPT_scifi_plane_hor_volume->AddNode(HPT_scifimat_hor_volume, i+1, new TGeoTranslation(0, (-(n_hor_planes-1)/2.0 + i)*scifimat_width, 0));
295 }
296 for (int i = 0; i < n_vert_planes; i++){
297 HPT_scifi_plane_vert_volume->AddNode(HPT_scifimat_vert_volume, 100+i+1 , new TGeoTranslation((-(n_vert_planes-1)/2.0 + i)*scifimat_width, 0, 0));
298 }
299
300 volDT->AddNode(HPT_support_volume, 0, new TGeoTranslation(0, 0, - DimZ / 2 + support_z / 2));
301 volDT->AddNode(HPT_scifi_plane_hor_volume, 0, new TGeoTranslation(0, 0, - DimZ / 2 + support_z + scifimat_z / 2));
302 volDT->AddNode(HPT_scifi_plane_vert_volume, 0, new TGeoTranslation(0, 0, - DimZ / 2 + support_z + scifimat_z + scifimat_z / 2));
303 volDT->AddNode(HPT_honeycomb_volume, 0, new TGeoTranslation(0, 0, - DimZ / 2 + support_z + 2 * scifimat_z + honeycomb_z / 2));
304 volDT->AddNode(HPT_support_volume, 1, new TGeoTranslation(0, 0, - DimZ / 2 + support_z + 2 * scifimat_z + honeycomb_z + support_z / 2));
306
307 Double_t first_DT_position = -DZMagnetizedRegion/2 + DZTarget + DimZ/2;
308 for(int i=0;i<fnHPT;i++){
309 for (int j = 0; j < fntarget; j++){
310 volMagRegion->AddNode(volDT,(i+1)*1000+j*fnHPT,new TGeoTranslation(0,0, first_DT_position + i*(fDistance+DimZ) + j*(DZTarget+ fnHPT * DimZ + (fnHPT-1)*fDistance)));
311 }
312 }
313 }
314}
315
316Bool_t Hpt::ProcessHits(FairVolume* vol)
317{
319 //Set parameters at entrance of volume. Reset ELoss.
320 if ( gMC->IsTrackEntering() ) {
321 fELoss = 0.;
322 fTime = gMC->TrackTime() * 1.0e09;
323 fLength = gMC->TrackLength();
324 gMC->TrackPosition(fPos);
325 gMC->TrackMomentum(fMom);
326 }
327 // Sum energy loss for all steps in the active volume
328 fELoss += gMC->Edep();
329
330 // Create muonPoint at exit of active volume
331 if ( gMC->IsTrackExiting() ||
332 gMC->IsTrackStop() ||
333 gMC->IsTrackDisappeared() ){
334 if (fELoss == 0. ) { return kFALSE; }
335 TParticle* p=gMC->GetStack()->GetCurrentTrack();
336 Int_t pdgCode = p->GetPdgCode();
337 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
338
339 gMC->CurrentVolID(fVolumeID);
340 Int_t detID = fVolumeID;
341 Int_t TTstationID;
342 gMC->CurrentVolOffID(2, TTstationID);
343 fVolumeID = TTstationID + detID;
344
345 TLorentzVector Pos;
346 gMC->TrackPosition(Pos);
347 Double_t xmean = (fPos.X()+Pos.X())/2. ;
348 Double_t ymean = (fPos.Y()+Pos.Y())/2. ;
349 Double_t zmean = (fPos.Z()+Pos.Z())/2. ;
350
351 AddHit(fTrackID, fVolumeID, TVector3(xmean, ymean, zmean),
352 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()),
353 fTime, fLength,fELoss, pdgCode);
354
355 // Increment number of muon det points in TParticle
356 ShipStack* stack = (ShipStack*) gMC->GetStack();
357 stack->AddPoint(ktauRpc);
358 }
359
360 return kTRUE;
361}
362
364{
365 fHptPointCollection->Clear();
366}
367
368
370{
371
378 FairRootManager::Instance()->Register("HptPoint", "Hpt",
379 fHptPointCollection, kTRUE);
380}
381
382// ----- Public method to Decode volume info -------------------------------------------
383// ----- returns hpt, arm, rpc numbers -----------------------------------
384void Hpt::DecodeVolumeID(Int_t detID,int &nHPT, int &nplane, Bool_t &ishor)
385{
386 nHPT = detID/1000;
387 int idir = (detID - nHPT*1000)/100;
388
389 if (idir == 1) ishor = kFALSE;
390 else if (idir == 0) ishor = kTRUE;
391
392 nplane = (detID - nHPT*1000 - idir*100);
393
394
395}
396
397TClonesArray* Hpt::GetCollection(Int_t iColl) const
398{
399 if (iColl == 0) { return fHptPointCollection; }
400 else { return NULL; }
401}
402
404{
405 fHptPointCollection->Clear();
406}
407
408
409HptPoint* Hpt::AddHit(Int_t trackID, Int_t detID,
410 TVector3 pos, TVector3 mom,
411 Double_t time, Double_t length,
412 Double_t eLoss, Int_t pdgCode)
413
414{
415 TClonesArray& clref = *fHptPointCollection;
416 Int_t size = clref.GetEntriesFast();
417
418 return new(clref[size]) HptPoint(trackID, detID, pos, mom,time, length, eLoss, pdgCode);
419}
420
421
Double_t cm
@ ktauHpt
@ ktauRpc
Definition HPT.h:19
virtual void Initialize()
Definition HPT.cxx:93
Double_t scifimat_width
Definition HPT.h:124
virtual void EndOfEvent()
Definition HPT.cxx:363
void SetNumberSciFi(Int_t n_hor_planes_, Int_t n_vert_planes_)
Definition HPT.cxx:175
void SetHPTNumber(Int_t nHPT)
Definition HPT.cxx:117
TLorentzVector fPos
volume id
Definition HPT.h:92
void GetMagnetGeometry(Double_t EmuzC, Double_t EmuY)
Definition HPT.cxx:132
Int_t fVolumeID
pdg code
Definition HPT.h:91
virtual void Reset()
Definition HPT.cxx:403
void GetNumberofTargets(Int_t ntarget)
Definition HPT.cxx:138
Double_t HPTrackerY
Definition HPT.h:121
Int_t InitMedium(const char *name)
Definition HPT.cxx:144
Double_t fDistance
Definition HPT.h:117
Double32_t fLength
time
Definition HPT.h:95
Double_t DimY
Definition HPT.h:108
void DecodeVolumeID(Int_t detID, int &nHPT, int &nplane, Bool_t &ishor)
Definition HPT.cxx:384
Double_t fConcreteX
Definition HPT.h:111
Double_t fDesign
Definition HPT.h:116
Int_t fTrackID
Definition HPT.h:89
Double_t DimX
Definition HPT.h:107
Double_t fSRHeight
Definition HPT.h:115
Double32_t fELoss
length
Definition HPT.h:96
TLorentzVector fMom
position at entrance
Definition HPT.h:93
Int_t fntarget
Definition HPT.h:136
void SetZsize(const Double_t Mudetsize)
Definition HPT.cxx:99
void SetConcreteBaseDim(Double_t X, Double_t Y, Double_t Z)
Definition HPT.cxx:105
virtual ~Hpt()
Definition HPT.cxx:85
virtual void Register()
Definition HPT.cxx:369
HptPoint * AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgCode)
Definition HPT.cxx:409
void SetHPTrackerParam(Double_t HPTX, Double_t HPTY, Double_t HPTZ)
Definition HPT.cxx:181
Double_t scifimat_z
Definition HPT.h:127
void ConstructGeometry()
Definition HPT.cxx:188
Double_t fConcreteZ
Definition HPT.h:113
Int_t n_vert_planes
Definition HPT.h:131
Double_t support_z
Definition HPT.h:128
void SetDistanceHPTs(Double_t dd)
Definition HPT.cxx:112
void SetDesign(Int_t Design)
Definition HPT.cxx:122
Double_t HPTrackerZ
Definition HPT.h:122
Double_t scifimat_hor
Definition HPT.h:125
Double_t DimZ
Definition HPT.h:109
Double_t HPTrackerX
Definition HPT.h:120
Double32_t fTime
momentum at entrance
Definition HPT.h:94
Int_t fnHPT
Definition HPT.h:118
void SetSurroundingDetHeight(Double_t height)
Definition HPT.cxx:127
Double_t zSizeMudet
Definition HPT.h:110
Double_t fmagnety
Definition HPT.h:133
virtual TClonesArray * GetCollection(Int_t iColl) const
Definition HPT.cxx:397
void SetSciFiParam(Double_t scifimat_width, Double_t scifimat_hor, Double_t scifimat_vert, Double_t scifimat_z, Double_t support_z, Double_t honeycomb_z)
Definition HPT.cxx:164
TClonesArray * fHptPointCollection
energy loss
Definition HPT.h:99
Double_t honeycomb_z
Definition HPT.h:129
Double_t scifimat_vert
Definition HPT.h:126
Hpt()
Definition HPT.cxx:54
Double_t fConcreteY
Definition HPT.h:112
virtual Bool_t ProcessHits(FairVolume *v=0)
Definition HPT.cxx:316
Double_t fmagnetcenter
Definition HPT.h:134
Int_t n_hor_planes
Definition HPT.h:130
ClassImp(ecalContFact) ecalContFact