]>
Commit | Line | Data |
---|---|---|
56bb0e8e | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercialf purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | #include "TTreeStream.h" | |
17 | #include "TROOT.h" | |
18 | #include "TH1.h" | |
19 | #include "TH2.h" | |
20 | ||
21 | #include "AliTrackPointArray.h" | |
22 | #include "AliLog.h" | |
23 | ||
24 | #include "AliTRDgeometry.h" | |
25 | #include "AliTRDcluster.h" | |
26 | #include "AliTRDseedV1.h" | |
27 | #include "AliTRDtrackV1.h" | |
28 | ||
29 | #include "AliTRDalignmentTask.h" | |
30 | ||
31 | ClassImp(AliTRDalignmentTask) | |
32 | ||
33 | //________________________________________________________ | |
34 | AliTRDalignmentTask::AliTRDalignmentTask() | |
35 | :AliTRDrecoTask("Alignment", "TRD alignment") | |
36 | ,fTree(0x0) | |
37 | ,fArray(0x0) | |
38 | { | |
39 | InitFunctorList(); | |
40 | DefineOutput(1, TTree::Class()); | |
41 | ||
42 | } | |
43 | ||
44 | //________________________________________________________ | |
45 | AliTRDalignmentTask::~AliTRDalignmentTask() | |
46 | { | |
47 | if (fArray) delete fArray; | |
48 | } | |
49 | ||
50 | ||
51 | //________________________________________________________ | |
52 | void AliTRDalignmentTask::CreateOutputObjects() | |
53 | { | |
54 | // spatial resolution | |
55 | OpenFile(1, "RECREATE"); | |
56 | ||
57 | fTree = new TTree("spTree", "Tree with track space point arrays"); | |
58 | fTree->Branch("SP","AliTrackPointArray", &fArray); | |
59 | } | |
60 | ||
61 | ||
62 | //________________________________________________________ | |
63 | void AliTRDalignmentTask::Exec(Option_t *opt) | |
64 | { | |
65 | AliTRDrecoTask::Exec(opt); | |
66 | PostData(1, fTree); | |
67 | } | |
68 | ||
69 | ||
70 | //________________________________________________________ | |
71 | TH1* AliTRDalignmentTask::PlotTrackPoints(const AliTRDtrackV1 *track) | |
72 | { | |
73 | if(track) fTrack = track; | |
74 | if(!fTrack){ | |
75 | AliWarning("No Track defined."); | |
76 | return 0x0; | |
77 | } | |
78 | ||
79 | if (fArray) delete fArray; | |
80 | fArray = new AliTrackPointArray(fTrack->GetNumberOfTracklets()); | |
81 | ||
82 | // Filling the track points array | |
83 | Float_t x, y, z; | |
84 | AliTrackPoint p; Int_t ip = 0; | |
85 | AliTRDseedV1 *tracklet = 0x0; | |
86 | for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ | |
87 | if(!(tracklet = fTrack->GetTracklet(il))) continue; | |
88 | if(!tracklet->IsOK()) continue; | |
89 | tracklet->Fit(kTRUE); | |
90 | ||
91 | x = tracklet->GetX0(); | |
92 | y = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x); | |
93 | z = tracklet->GetZfit(0); | |
94 | p.SetXYZ(x,y,z); | |
95 | fArray->AddPoint(ip++, &p); | |
96 | } | |
97 | fTree->Fill(); | |
98 | ||
99 | /* if(fDebugLevel>=1){ | |
100 | Float_t yt = fRim.GetYat(x[il]); | |
101 | (*fDebugStream) << "TrkltResiduals" | |
102 | << "layer=" << il | |
103 | << "x=" <<x[il] | |
104 | << "y=" <<y[il] | |
105 | << "yt=" <<yt | |
106 | << "dydx=" << dydx[il] | |
107 | << "dy=" << dy | |
108 | << "\n"; | |
109 | }*/ | |
110 | return 0x0; | |
111 | } | |
112 | ||
113 | ||
56bb0e8e | 114 | //________________________________________________________ |
115 | void AliTRDalignmentTask::Terminate(Option_t *) | |
116 | { | |
117 | if(fDebugStream){ | |
118 | delete fDebugStream; | |
119 | fDebugStream = 0x0; | |
120 | fDebugLevel = 0; | |
121 | } | |
122 | if(HasPostProcess()) PostProcess(); | |
123 | } | |
124 | ||
125 | ||
126 | //________________________________________________________ | |
127 | TObjArray* AliTRDalignmentTask::Histos() | |
128 | { | |
129 | return 0x0; | |
130 | /* if(fContainer) return fContainer; | |
131 | ||
132 | fContainer = new TObjArray(3); | |
133 | ||
134 | TH1 *h = 0x0; | |
135 | ||
136 | if(!(h = (TH1D*)gROOT->FindObject("cuttra"))){ | |
137 | h = new TH1D("cuttra","cuttra",20,0.5,20.5); | |
138 | } else h->Reset(); | |
139 | ||
140 | if(!(h = (TH1D*)gROOT->FindObject("cutpoi"))){ | |
141 | h = new TH1D("cutpoi","cutpoi",20,0.5,20.5); | |
142 | } else h->Reset(); | |
143 | ||
144 | if(!(h = (TH2D*)gROOT->FindObject("modpop"))){ | |
145 | h = new TH2D("modpop","modpop",90,-0.5,89.5,30,-0.5,29.5); | |
146 | h->SetXTitle("module nr"); | |
147 | h->SetYTitle("layer nr"); | |
148 | } else h->Reset();*/ | |
149 | } | |
150 | ||
151 | ||
152 | //________________________________________________________ | |
153 | Bool_t AliTRDalignmentTask::IsIdenticalWithOneOf(AliTrackPoint *p, AliTrackPointArray *parray, int nmax) { | |
154 | ||
155 | // Is the point p identical with one of the points on the list parray? | |
156 | // This is a fix for aliroot 4-16-Rev-01 (and before) writing some | |
157 | // spurious unitialized points. | |
158 | ||
159 | for (int i=0; i<parray->GetNPoints() && i<nmax; i++) { | |
160 | AliTrackPoint pa; | |
161 | parray->GetPoint(pa,i); | |
162 | //printf("comparing %7.3f with %7.3f\n",p->GetY(),pa.GetY()); | |
163 | if (p->GetResidual(pa,0)<1e-8) return kTRUE; | |
164 | //printf("different\n"); | |
165 | } | |
166 | return kFALSE; | |
167 | } |