]>
Commit | Line | Data |
---|---|---|
173b3073 | 1 | #include <TGeoVolume.h> |
2 | #include <TGeoTube.h> | |
3 | #include <TGeoManager.h> | |
a11ef2e4 | 4 | #include "AliITSURecoDet.h" |
5 | #include "AliITSUGeomTGeo.h" | |
6 | #include "AliITSsegmentation.h" | |
7 | #include "AliITSUSegmentationPix.h" | |
173b3073 | 8 | #include "AliITSUReconstructor.h" |
9 | ||
a11ef2e4 | 10 | |
11 | ClassImp(AliITSURecoDet) | |
12 | ||
173b3073 | 13 | |
14 | const Char_t* AliITSURecoDet::fgkBeamPipeVolName = "IP_PIPE"; | |
15 | ||
16 | ||
a11ef2e4 | 17 | //______________________________________________________ |
32d38de2 | 18 | AliITSURecoDet::AliITSURecoDet(AliITSUGeomTGeo* geom, const char* name) |
a11ef2e4 | 19 | : fNLayers(0) |
20 | ,fNLayersActive(0) | |
21 | ,fRMax(-1) | |
22 | ,fRMin(-1) | |
23 | ,fLayers(0) | |
24 | ,fLayersActive(0) | |
32d38de2 | 25 | ,fGeom(geom) |
a11ef2e4 | 26 | { |
27 | // def. c-tor | |
28 | SetNameTitle(name,name); | |
29 | fLayers.SetOwner(kTRUE); // layers belong to this array | |
30 | fLayersActive.SetOwner(kFALSE); // this one just points on active layers in fLayers | |
32d38de2 | 31 | Build(); |
a11ef2e4 | 32 | } |
33 | ||
34 | //______________________________________________________ | |
35 | AliITSURecoDet::~AliITSURecoDet() | |
36 | { | |
37 | // def. d-tor | |
38 | fLayersActive.Clear(); | |
39 | fLayers.Clear(); // owned! | |
a11ef2e4 | 40 | } |
41 | ||
42 | //______________________________________________________ | |
43 | void AliITSURecoDet::Print(Option_t* opt) const | |
44 | { | |
45 | ||
46 | printf("Detector %s, %d layers, %d active layers\n",GetName(),GetNLayers(),GetNLayersActive()); | |
47 | TString opts = opt; opts.ToLower(); | |
48 | if (opts.Contains("lr")) for (int i=0;i<GetNLayers();i++) GetLayer(i)->Print(opt); | |
49 | } | |
50 | ||
51 | //______________________________________________________ | |
52 | void AliITSURecoDet::AddLayer(const AliITSURecoLayer* lr) | |
53 | { | |
54 | //add new layer | |
55 | fLayers.AddLast((TObject*)lr); | |
56 | fNLayers++; | |
57 | if (lr->IsActive()) { | |
58 | fLayersActive.AddLast((TObject*)lr); | |
59 | fNLayersActive++; | |
60 | } | |
61 | } | |
62 | ||
63 | //______________________________________________________ | |
64 | Bool_t AliITSURecoDet::Build() | |
65 | { | |
66 | // build detector from TGeo | |
67 | // | |
32d38de2 | 68 | if (!fGeom) AliFatal("Geometry interface is not set"); |
69 | int nlr = fGeom->GetNLayers(); | |
a11ef2e4 | 70 | if (!nlr) AliFatal("No geometry loaded"); |
a11ef2e4 | 71 | // |
72 | // build active ITS layers | |
73 | for (int ilr=0;ilr<nlr;ilr++) { | |
32d38de2 | 74 | int lrTyp = fGeom->GetLayerDetTypeID(ilr); |
a11ef2e4 | 75 | // name layer according its active id, detector type and segmentation tyoe |
32d38de2 | 76 | AliITSURecoLayer* lra = new AliITSURecoLayer(Form("Lr%d%s%d",ilr,fGeom->GetDetTypeName(lrTyp), |
77 | lrTyp%AliITSUGeomTGeo::kMaxSegmPerDetType), | |
78 | ilr,fGeom); | |
173b3073 | 79 | lra->SetPassive(kFALSE); |
a11ef2e4 | 80 | AddLayer(lra); |
81 | } | |
dde91d5d | 82 | // |
83 | // build passive ITS layers | |
84 | // | |
173b3073 | 85 | double rMin,rMax,zMin,zMax; |
86 | // beam pipe | |
87 | TGeoVolume *v = gGeoManager->GetVolume(fgkBeamPipeVolName); | |
88 | AliITSURecoLayer* lrp = 0; | |
89 | if (!v) AliWarning("No beam pipe found in geometry"); | |
90 | { | |
91 | TGeoTube *t=(TGeoTube*)v->GetShape(); | |
92 | rMin = t->GetRmin(); | |
93 | rMax = t->GetRmax(); | |
94 | zMin =-t->GetDz(); | |
95 | zMax = t->GetDz(); | |
96 | lrp = new AliITSURecoLayer("BeamPipe"); | |
97 | lrp->SetRMin(rMin); | |
98 | lrp->SetRMax(rMax); | |
99 | lrp->SetR(0.5*(rMin+rMax)); | |
100 | lrp->SetZMin(zMin); | |
101 | lrp->SetZMax(zMax); | |
102 | lrp->SetPassive(kTRUE); | |
103 | AddLayer(lrp); | |
104 | // | |
105 | } | |
106 | // | |
107 | // TPC-ITS wall | |
108 | lrp = new AliITSURecoLayer("TPC-ITSwall"); | |
109 | lrp->SetRMin(AliITSUReconstructor::GetRecoParam()->GetTPCITSWallRMin()); | |
110 | lrp->SetRMax(AliITSUReconstructor::GetRecoParam()->GetTPCITSWallRMax()); | |
111 | lrp->SetR(0.5*(lrp->GetRMin()+lrp->GetRMax())); | |
112 | lrp->SetZMin(-AliITSUReconstructor::GetRecoParam()->GetTPCITSWallZSpanH()); | |
113 | lrp->SetZMax( AliITSUReconstructor::GetRecoParam()->GetTPCITSWallZSpanH()); | |
114 | lrp->SetMaxStep( AliITSUReconstructor::GetRecoParam()->GetTPCITSWallMaxStep()); | |
115 | lrp->SetPassive(kTRUE); | |
116 | AddLayer(lrp); | |
117 | // | |
dde91d5d | 118 | IndexLayers(); |
119 | Print("lr"); | |
a11ef2e4 | 120 | return kTRUE; |
121 | } | |
32d38de2 | 122 | |
dde91d5d | 123 | //______________________________________________________ |
124 | void AliITSURecoDet::IndexLayers() | |
125 | { | |
c51c3124 | 126 | // sort and index layers |
127 | const Double_t kRMargin = 1e-2; // 100 micron margin | |
dde91d5d | 128 | fLayersActive.Sort(); |
129 | for (int i=0;i<fNLayersActive;i++) GetLayerActive(i)->SetActiveID(i); | |
130 | fLayers.Sort(); | |
131 | for (int i=0;i<fNLayers;i++) GetLayer(i)->SetID(i); | |
c51c3124 | 132 | if (fNLayers>0) { |
133 | SetRMin(GetLayer(0)->GetRMin()-kRMargin); | |
134 | SetRMax(GetLayer(fNLayers-1)->GetRMax()+kRMargin); | |
135 | } | |
dde91d5d | 136 | } |