]>
Commit | Line | Data |
---|---|---|
04e92dc8 | 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-commercial 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 | /* $Id$ */ | |
16 | ||
17 | /* History of cvs commits: | |
18 | * | |
19 | * $Log$ | |
04236e67 | 20 | * Revision 1.9 2007/10/10 09:05:10 schutz |
21 | * Changing name QualAss to QA | |
22 | * | |
b8274834 | 23 | * Revision 1.8 2007/08/28 12:55:08 policheh |
24 | * Loaders removed from the reconstruction code (C.Cheshkov) | |
25 | * | |
9a2cdbdf | 26 | * Revision 1.7 2007/08/07 14:12:03 kharlov |
27 | * Quality assurance added (Yves Schutz) | |
28 | * | |
ddd1a39c | 29 | * Revision 1.6 2007/08/03 14:41:37 cvetan |
30 | * Missing header files | |
31 | * | |
1d0c181d | 32 | * Revision 1.5 2007/08/03 13:52:16 kharlov |
33 | * Working skeleton of matching the ESD tracks and ESD clusters (Iouri Belikov) | |
34 | * | |
04e92dc8 | 35 | */ |
36 | ||
37 | #include <TClonesArray.h> | |
1d0c181d | 38 | #include <TMath.h> |
04e92dc8 | 39 | |
40 | #include <AliLog.h> | |
23904d16 | 41 | #include "AliPHOSTracker.h" |
04e92dc8 | 42 | #include "AliPHOSEmcRecPoint.h" |
af885e0f | 43 | #include "AliESDEvent.h" |
1d0c181d | 44 | #include "AliESDtrack.h" |
ddd1a39c | 45 | #include "AliPHOSTrackSegmentMakerv1.h" |
46 | #include "AliPHOSPIDv1.h" | |
23904d16 | 47 | |
48 | //------------------------------------------------------------------------- | |
49 | // PHOS tracker. | |
50 | // Matches ESD tracks with the PHOS and makes the PID. | |
04e92dc8 | 51 | // |
23904d16 | 52 | //------------------------------------------------------------------------- |
53 | ||
54 | ClassImp(AliPHOSTracker) | |
55 | ||
04e92dc8 | 56 | Bool_t AliPHOSTracker::fgDebug = kFALSE ; |
57 | ||
58 | ||
59 | // ***** Some geometrical constants (used in PropagateBack) | |
60 | ||
61 | const Double_t kR=460.+ 9; // Radial coord. of the centre of EMC module (cm) | |
62 | ||
63 | const Double_t kAlpha=20.*TMath::Pi()/180.; // Segmentation angle (rad) | |
64 | const Double_t kYmax=kR*TMath::Tan(0.5*kAlpha); // Maximal possible y-coord.(cm) | |
65 | const Double_t kZmax=65.; // Approximately: the maximal possible z-coord.(cm) | |
66 | ||
67 | ||
68 | ||
ddd1a39c | 69 | //____________________________________________________________________________ |
70 | AliPHOSTracker::AliPHOSTracker(): | |
9a2cdbdf | 71 | AliTracker() |
ddd1a39c | 72 | { |
04e92dc8 | 73 | //-------------------------------------------------------------------- |
74 | // The default constructor | |
75 | //-------------------------------------------------------------------- | |
76 | for (Int_t i=0; i<5; i++) | |
77 | fModules[i]=new TClonesArray("AliPHOSEmcRecPoint",777); | |
d7737747 | 78 | |
04e92dc8 | 79 | } |
80 | ||
ddd1a39c | 81 | //____________________________________________________________________________ |
82 | AliPHOSTracker::~AliPHOSTracker() | |
83 | { | |
04e92dc8 | 84 | //-------------------------------------------------------------------- |
85 | // The destructor | |
86 | //-------------------------------------------------------------------- | |
87 | for (Int_t i=0; i<5; i++) { | |
88 | (fModules[i])->Delete(); | |
89 | delete fModules[i]; | |
90 | } | |
91 | } | |
92 | ||
ddd1a39c | 93 | //____________________________________________________________________________ |
c5a539a3 | 94 | Int_t AliPHOSTracker::LoadClusters(TTree *) { |
04e92dc8 | 95 | //-------------------------------------------------------------------- |
96 | // This function loads the PHOS clusters | |
97 | //-------------------------------------------------------------------- | |
d7737747 | 98 | return 0 ; //At this stage we can not strore result |
99 | // the closest track and distance to it | |
100 | //We perform same task later in AliPHOSTrackSegmentMakerv1 | |
101 | /* | |
04e92dc8 | 102 | TObjArray *arr=NULL; |
103 | TBranch *branch=cTree->GetBranch("PHOSEmcRP"); | |
104 | if (branch==0) { | |
105 | AliError("No branch with the EMC clusters found !"); | |
106 | return 1; | |
107 | } | |
108 | branch->SetAddress(&arr); | |
109 | ||
110 | Int_t nclusters=0; | |
111 | Int_t nentr=(Int_t)branch->GetEntries(); | |
112 | for (Int_t i=0; i<nentr; i++) { | |
113 | if (!branch->GetEvent(i)) continue; | |
114 | Int_t ncl=arr->GetEntriesFast(); | |
115 | while (ncl--) { | |
116 | AliPHOSEmcRecPoint *cl=(AliPHOSEmcRecPoint*)arr->UncheckedAt(ncl); | |
117 | ||
118 | Int_t m=cl->GetPHOSMod(); | |
119 | if ((m<1)||(m>5)) { | |
120 | AliError("Wrong module index !"); | |
121 | return 1; | |
122 | } | |
123 | ||
124 | // Here is how the alignment is treated | |
d7737747 | 125 | // Misalignment is already in cluster coordinates |
126 | // if (!cl->Misalign()) AliWarning("Can't misalign this cluster !"); | |
04e92dc8 | 127 | |
128 | cl->SetBit(14,kFALSE); // The clusters are not yet attached to any track | |
129 | ||
130 | TClonesArray &module=*fModules[m-1]; | |
131 | Int_t idx=module.GetEntriesFast(); | |
132 | new (module[idx]) AliPHOSEmcRecPoint(*cl); | |
133 | ||
134 | nclusters++; | |
135 | ||
136 | } | |
137 | } | |
89c531d7 | 138 | arr->Delete(); |
04e92dc8 | 139 | Info("LoadClusters","Number of loaded clusters: %d",nclusters); |
140 | ||
141 | return 0; | |
d7737747 | 142 | */ |
04e92dc8 | 143 | } |
144 | ||
ddd1a39c | 145 | //____________________________________________________________________________ |
c5a539a3 | 146 | Int_t AliPHOSTracker::PropagateBack(AliESDEvent *) { |
04e92dc8 | 147 | //-------------------------------------------------------------------- |
23904d16 | 148 | // Called by AliReconstruction |
04e92dc8 | 149 | // Performs the track matching with the PHOS modules |
150 | // Makes the PID | |
151 | //-------------------------------------------------------------------- | |
152 | ||
d7737747 | 153 | return 0 ; //At this stage we can not strore result |
154 | // the closest track and distance to it | |
155 | //We perform same task later in AliPHOSTrackSegmentMakerv1 | |
156 | /* | |
04e92dc8 | 157 | Int_t nt=esd->GetNumberOfTracks(); |
158 | ||
159 | // *** Select and sort the ESD track in accordance with their quality | |
160 | Double_t *quality=new Double_t[nt]; | |
161 | Int_t *index=new Int_t[nt]; | |
162 | for (Int_t i=0; i<nt; i++) { | |
163 | AliESDtrack *esdTrack=esd->GetTrack(i); | |
164 | quality[i] = esdTrack->GetSigmaY2() + esdTrack->GetSigmaZ2(); | |
165 | } | |
166 | TMath::Sort(nt,quality,index,kFALSE); | |
167 | ||
168 | ||
169 | // *** Start the matching | |
d7737747 | 170 | Double_t bz = GetGz() ; //For approximate matching |
171 | Double_t b[3]; GetBxByBz(b); //For final matching | |
04e92dc8 | 172 | Int_t matched=0; |
173 | for (Int_t i=0; i<nt; i++) { | |
174 | AliESDtrack *esdTrack=esd->GetTrack(index[i]); | |
175 | ||
d7737747 | 176 | // // Skip the tracks having "wrong" status (has to be checked/tuned) |
177 | // ULong_t status = esdTrack->GetStatus(); | |
178 | // if ((status & AliESDtrack::kTRDout) == 0) continue; | |
179 | // if ((status & AliESDtrack::kTRDrefit) == 1) continue; | |
04e92dc8 | 180 | |
181 | AliExternalTrackParam t(*esdTrack); | |
182 | ||
183 | Int_t isec=Int_t(t.GetAlpha()/kAlpha); | |
184 | Int_t imod=-isec-2; // PHOS module | |
185 | ||
186 | Double_t y; // Some tracks do not reach the PHOS | |
187 | if (!t.GetYAt(kR,bz,y)) continue; // because of the bending | |
188 | ||
189 | Double_t z; t.GetZAt(kR,bz,z); | |
190 | if (TMath::Abs(z) > kZmax) continue; // Some tracks miss the PHOS in Z | |
191 | ||
192 | Bool_t ok=kTRUE; | |
193 | while (TMath::Abs(y) > kYmax) { // Find the matching module | |
194 | Double_t alp=t.GetAlpha(); | |
195 | if (y > kYmax) { | |
196 | if (!t.Rotate(alp+kAlpha)) {ok=kFALSE; break;} | |
197 | imod--; | |
198 | } else if (y < -kYmax) { | |
199 | if (!t.Rotate(alp-kAlpha)) {ok=kFALSE; break;} | |
200 | imod++; | |
201 | } | |
202 | if (!t.GetYAt(kR,bz,y)) {ok=kFALSE; break;} | |
203 | } | |
204 | if (!ok) continue; // Track rotation failed | |
205 | ||
206 | ||
207 | if ((imod<0)||(imod>4)) continue; // Some tracks miss the PHOS in azimuth | |
208 | ||
209 | //t.CorrectForMaterial(...); // Correct for the TOF material, if needed | |
d7737747 | 210 | t.PropagateToBxByBz(kR,b); // Propagate to the matching module |
04e92dc8 | 211 | |
212 | ||
213 | // *** Search for the "best" cluster (can be improved) | |
214 | TClonesArray &cArray=*fModules[imod]; | |
215 | Int_t ncl=cArray.GetEntriesFast(); | |
216 | AliPHOSEmcRecPoint *bestCluster=0; // The "best" cluster | |
217 | Double_t maxd2=400; // (cm^2) | |
605cb8bb | 218 | for (Int_t j=0; j<ncl; j++) { |
219 | AliPHOSEmcRecPoint *c=(AliPHOSEmcRecPoint *)cArray.UncheckedAt(j); | |
04e92dc8 | 220 | |
d7737747 | 221 | //we looking at the closest track to the cluster, |
222 | //not closest cluster to the track. | |
223 | // if (c->TestBit(14)) continue; // This clusters is "used" | |
04e92dc8 | 224 | |
225 | Double_t dy = t.GetY() - c->GetY(), dz = t.GetZ() - c->GetZ(); | |
226 | Double_t d2 = dy*dy + dz*dz; | |
227 | if (d2 < maxd2) { | |
228 | maxd2=d2; | |
229 | bestCluster=c; | |
230 | } | |
231 | } | |
232 | ||
233 | if (!bestCluster) continue; // No reasonable matching found | |
234 | ||
d7737747 | 235 | // bestCluster->SetBit(14,kTRUE); // This clusters is now attached to a track |
04e92dc8 | 236 | |
237 | matched++; | |
238 | ||
239 | // *** Now, do the PID with the "bestCluster" | |
240 | // and add the corresponding info to the ESD track pointed by "esdTrack" | |
241 | ||
d7737747 | 242 | |
243 | // printf("%e %e %e %e\n",t.GetSign(), t.GetX() - bestCluster->GetX(), | |
244 | // t.GetY() - bestCluster->GetY(), | |
245 | // t.GetZ() - bestCluster->GetZ()); | |
246 | ||
04e92dc8 | 247 | } |
248 | ||
249 | Info("PropagateBack","Number of matched tracks: %d",matched); | |
250 | ||
251 | delete[] quality; | |
252 | delete[] index; | |
253 | ||
254 | return 0; | |
d7737747 | 255 | */ |
04e92dc8 | 256 | } |
257 | ||
ddd1a39c | 258 | //____________________________________________________________________________ |
04e92dc8 | 259 | AliCluster *AliPHOSTracker::GetCluster(Int_t index) const { |
260 | //-------------------------------------------------------------------- | |
261 | // Returns the pointer to a given cluster | |
262 | //-------------------------------------------------------------------- | |
263 | Int_t m=(index & 0xf0000000) >> 28; // Module number | |
264 | Int_t i=(index & 0x0fffffff) >> 00; // Index within the module | |
265 | ||
266 | return (AliCluster*)(fModules[m])->UncheckedAt(i); | |
267 | } | |
268 | ||
ddd1a39c | 269 | //____________________________________________________________________________ |
04e92dc8 | 270 | void AliPHOSTracker::UnloadClusters() { |
271 | //-------------------------------------------------------------------- | |
272 | // This function unloads the PHOS clusters | |
273 | //-------------------------------------------------------------------- | |
d7737747 | 274 | // for (Int_t i=0; i<5; i++) (fModules[i])->Delete(); |
04e92dc8 | 275 | } |