]>
Commit | Line | Data |
---|---|---|
a11ef2e4 | 1 | #include "AliITSURecoDet.h" |
2 | #include "AliITSUGeomTGeo.h" | |
3 | #include "AliITSsegmentation.h" | |
4 | #include "AliITSUSegmentationPix.h" | |
5 | ||
6 | ClassImp(AliITSURecoDet) | |
7 | ||
8 | //______________________________________________________ | |
32d38de2 | 9 | AliITSURecoDet::AliITSURecoDet(AliITSUGeomTGeo* geom, const char* name) |
a11ef2e4 | 10 | : fNLayers(0) |
11 | ,fNLayersActive(0) | |
12 | ,fRMax(-1) | |
13 | ,fRMin(-1) | |
14 | ,fLayers(0) | |
15 | ,fLayersActive(0) | |
32d38de2 | 16 | ,fGeom(geom) |
a11ef2e4 | 17 | { |
18 | // def. c-tor | |
19 | SetNameTitle(name,name); | |
20 | fLayers.SetOwner(kTRUE); // layers belong to this array | |
21 | fLayersActive.SetOwner(kFALSE); // this one just points on active layers in fLayers | |
32d38de2 | 22 | Build(); |
a11ef2e4 | 23 | } |
24 | ||
25 | //______________________________________________________ | |
26 | AliITSURecoDet::~AliITSURecoDet() | |
27 | { | |
28 | // def. d-tor | |
29 | fLayersActive.Clear(); | |
30 | fLayers.Clear(); // owned! | |
a11ef2e4 | 31 | } |
32 | ||
33 | //______________________________________________________ | |
34 | void AliITSURecoDet::Print(Option_t* opt) const | |
35 | { | |
36 | ||
37 | printf("Detector %s, %d layers, %d active layers\n",GetName(),GetNLayers(),GetNLayersActive()); | |
38 | TString opts = opt; opts.ToLower(); | |
39 | if (opts.Contains("lr")) for (int i=0;i<GetNLayers();i++) GetLayer(i)->Print(opt); | |
40 | } | |
41 | ||
42 | //______________________________________________________ | |
43 | void AliITSURecoDet::AddLayer(const AliITSURecoLayer* lr) | |
44 | { | |
45 | //add new layer | |
46 | fLayers.AddLast((TObject*)lr); | |
47 | fNLayers++; | |
48 | if (lr->IsActive()) { | |
49 | fLayersActive.AddLast((TObject*)lr); | |
50 | fNLayersActive++; | |
51 | } | |
52 | } | |
53 | ||
54 | //______________________________________________________ | |
55 | Bool_t AliITSURecoDet::Build() | |
56 | { | |
57 | // build detector from TGeo | |
58 | // | |
32d38de2 | 59 | if (!fGeom) AliFatal("Geometry interface is not set"); |
60 | int nlr = fGeom->GetNLayers(); | |
a11ef2e4 | 61 | if (!nlr) AliFatal("No geometry loaded"); |
a11ef2e4 | 62 | // |
63 | // build active ITS layers | |
64 | for (int ilr=0;ilr<nlr;ilr++) { | |
32d38de2 | 65 | int lrTyp = fGeom->GetLayerDetTypeID(ilr); |
a11ef2e4 | 66 | // name layer according its active id, detector type and segmentation tyoe |
32d38de2 | 67 | AliITSURecoLayer* lra = new AliITSURecoLayer(Form("Lr%d%s%d",ilr,fGeom->GetDetTypeName(lrTyp), |
68 | lrTyp%AliITSUGeomTGeo::kMaxSegmPerDetType), | |
69 | ilr,fGeom); | |
a11ef2e4 | 70 | AddLayer(lra); |
71 | } | |
72 | return kTRUE; | |
73 | } | |
32d38de2 | 74 |