]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 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 | /////////////////////////////////////////////// | |
17 | // TRD alignment task | |
18 | // | |
19 | // Some documentation | |
20 | // | |
21 | // Authors : | |
22 | // | |
23 | //////////////////////////////////////////////// | |
24 | ||
25 | #include "TTreeStream.h" | |
26 | #include "TROOT.h" | |
27 | #include "TH1.h" | |
28 | #include "TH2.h" | |
29 | ||
30 | #include "AliTrackPointArray.h" | |
31 | #include "AliLog.h" | |
32 | ||
33 | #include "AliTRDgeometry.h" | |
34 | #include "AliTRDcluster.h" | |
35 | #include "AliTRDseedV1.h" | |
36 | #include "AliTRDtrackV1.h" | |
37 | ||
38 | #include "AliTRDalignmentTask.h" | |
39 | ||
40 | ClassImp(AliTRDalignmentTask) | |
41 | ||
42 | //________________________________________________________ | |
43 | AliTRDalignmentTask::AliTRDalignmentTask() | |
f8f46e4d | 44 | :AliTRDrecoTask() |
1ee39b3a | 45 | ,fTree(0x0) |
46 | ,fArray(0x0) | |
47 | { | |
48 | InitFunctorList(); | |
f8f46e4d | 49 | } |
1ee39b3a | 50 | |
f8f46e4d | 51 | AliTRDalignmentTask::AliTRDalignmentTask(char* name) |
52 | :AliTRDrecoTask(name, "TRD alignment") | |
53 | ,fTree(0x0) | |
54 | ,fArray(0x0) | |
55 | { | |
56 | InitFunctorList(); | |
57 | DefineOutput(2, TTree::Class()); | |
1ee39b3a | 58 | } |
59 | ||
60 | //________________________________________________________ | |
61 | AliTRDalignmentTask::~AliTRDalignmentTask() | |
62 | { | |
63 | if (fArray) delete fArray; | |
64 | } | |
65 | ||
66 | ||
67 | //________________________________________________________ | |
f8f46e4d | 68 | void AliTRDalignmentTask::UserCreateOutputObjects() |
1ee39b3a | 69 | { |
70 | // spatial resolution | |
f8f46e4d | 71 | OpenFile(2, "RECREATE"); |
1ee39b3a | 72 | |
73 | fTree = new TTree("spTree", "Tree with track space point arrays"); | |
74 | fTree->Branch("SP","AliTrackPointArray", &fArray); | |
75 | } | |
76 | ||
77 | ||
78 | //________________________________________________________ | |
f8f46e4d | 79 | void AliTRDalignmentTask::UserExec(Option_t *opt) |
1ee39b3a | 80 | { |
81 | // Documentation to come | |
82 | ||
b4414720 | 83 | AliTRDrecoTask::UserExec(opt); |
f8f46e4d | 84 | PostData(2, fTree); |
1ee39b3a | 85 | } |
86 | ||
87 | ||
88 | //________________________________________________________ | |
89 | TH1* AliTRDalignmentTask::PlotTrackPoints(const AliTRDtrackV1 *track) | |
90 | { | |
91 | // Documentation to come | |
92 | ||
93 | if(track) fkTrack = track; | |
94 | if(!fkTrack){ | |
95 | AliWarning("No Track defined."); | |
96 | return 0x0; | |
97 | } | |
98 | ||
99 | if (fArray) delete fArray; | |
100 | fArray = new AliTrackPointArray(fkTrack->GetNumberOfTracklets()); | |
101 | ||
102 | // Filling the track points array | |
103 | Float_t x, y, z; | |
104 | AliTrackPoint p; Int_t ip = 0; | |
105 | AliTRDseedV1 *tracklet = 0x0; | |
106 | for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ | |
107 | if(!(tracklet = fkTrack->GetTracklet(il))) continue; | |
108 | if(!tracklet->IsOK()) continue; | |
109 | tracklet->Fit(kTRUE); | |
110 | ||
111 | x = tracklet->GetX0(); | |
112 | y = tracklet->GetYfit(0)-tracklet->GetYfit(1)*(tracklet->GetX0()-x); | |
113 | z = tracklet->GetZfit(0); | |
114 | p.SetXYZ(x,y,z); | |
115 | fArray->AddPoint(ip++, &p); | |
116 | } | |
117 | fTree->Fill(); | |
118 | ||
119 | /* if(fDebugLevel>=1){ | |
120 | Float_t yt = fRim.GetYat(x[il]); | |
121 | (*fDebugStream) << "TrkltResiduals" | |
122 | << "layer=" << il | |
123 | << "x=" <<x[il] | |
124 | << "y=" <<y[il] | |
125 | << "yt=" <<yt | |
126 | << "dydx=" << dydx[il] | |
127 | << "dy=" << dy | |
128 | << "\n"; | |
129 | }*/ | |
130 | return 0x0; | |
131 | } | |
132 | ||
133 | ||
134 | ||
135 | //________________________________________________________ | |
136 | Bool_t AliTRDalignmentTask::IsIdenticalWithOneOf(AliTrackPoint * const p, AliTrackPointArray *parray, int nmax) { | |
137 | ||
138 | // Is the point p identical with one of the points on the list parray? | |
139 | // This is a fix for aliroot 4-16-Rev-01 (and before) writing some | |
140 | // spurious unitialized points. | |
141 | ||
142 | for (int i=0; i<parray->GetNPoints() && i<nmax; i++) { | |
143 | AliTrackPoint pa; | |
144 | parray->GetPoint(pa,i); | |
145 | //printf("comparing %7.3f with %7.3f\n",p->GetY(),pa.GetY()); | |
146 | if (p->GetResidual(pa,0)<1e-8) return kTRUE; | |
147 | //printf("different\n"); | |
148 | } | |
149 | return kFALSE; | |
150 | } |