]>
Commit | Line | Data |
---|---|---|
d15a28e7 | 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 | **************************************************************************/ | |
b2a60966 | 15 | /* $Id$ */ |
702ab87e | 16 | |
17 | /* History of cvs commits: | |
18 | * | |
19 | * $Log$ | |
04236e67 | 20 | * Revision 1.93 2007/10/10 09:05:10 schutz |
21 | * Changing name QualAss to QA | |
22 | * | |
b8274834 | 23 | * Revision 1.92 2007/08/28 12:55:08 policheh |
24 | * Loaders removed from the reconstruction code (C.Cheshkov) | |
25 | * | |
9a2cdbdf | 26 | * Revision 1.91 2007/08/07 14:12:03 kharlov |
27 | * Quality assurance added (Yves Schutz) | |
28 | * | |
ddd1a39c | 29 | * Revision 1.90 2007/07/11 13:43:30 hristov |
30 | * New class AliESDEvent, backward compatibility with the old AliESD (Christian) | |
31 | * | |
af885e0f | 32 | * Revision 1.89 2007/07/03 08:13:04 kharlov |
33 | * Bug fix in CPV local coordinates | |
34 | * | |
b22f5347 | 35 | * Revision 1.88 2007/06/27 09:11:07 kharlov |
36 | * Bug fix for CPV-EMC distance | |
37 | * | |
78881c42 | 38 | * Revision 1.87 2007/05/04 14:49:29 policheh |
39 | * AliPHOSRecPoint inheritance from AliCluster | |
40 | * | |
9ee9f78d | 41 | * Revision 1.86 2007/04/02 15:00:16 cvetan |
42 | * No more calls to gAlice in the reconstruction | |
43 | * | |
999f9a8f | 44 | * Revision 1.85 2007/03/28 19:18:15 kharlov |
45 | * RecPoints recalculation in TSM removed | |
46 | * | |
8c1fb709 | 47 | * Revision 1.84 2007/03/07 07:01:21 hristov |
48 | * Fixing copy/paste erro. Additional protections | |
49 | * | |
b89c16b2 | 50 | * Revision 1.83 2007/03/06 21:07:37 kharlov |
51 | * DP: xz CPV-EMC distance filled to TS | |
52 | * | |
d7ddbb70 | 53 | * Revision 1.82 2007/03/06 06:54:48 kharlov |
54 | * DP:Calculation of cluster properties dep. on vertex added | |
55 | * | |
e84d3def | 56 | * Revision 1.81 2007/02/05 10:02:40 kharlov |
57 | * Module numbering is corrected | |
58 | * | |
a2ee5b34 | 59 | * Revision 1.80 2006/08/28 10:01:56 kharlov |
60 | * Effective C++ warnings fixed (Timur Pocheptsov) | |
61 | * | |
3663622c | 62 | * Revision 1.79 2006/04/25 12:41:15 hristov |
63 | * Moving non-persistent data to AliESDfriend (Yu.Belikov) | |
64 | * | |
15e85efa | 65 | * Revision 1.78 2005/11/18 13:04:51 hristov |
66 | * Bug fix | |
67 | * | |
a494460a | 68 | * Revision 1.77 2005/11/17 23:34:36 hristov |
69 | * Corrected logics | |
70 | * | |
f74a631d | 71 | * Revision 1.76 2005/11/17 22:29:12 hristov |
72 | * Faster version, no attempt to match tracks outside the PHOS acceptance | |
73 | * | |
0d9aa319 | 74 | * Revision 1.75 2005/11/17 12:35:27 hristov |
75 | * Use references instead of objects. Avoid to create objects when they are not really needed | |
76 | * | |
7b51037f | 77 | * Revision 1.74 2005/07/08 14:01:36 hristov |
78 | * Tracking in non-uniform nmagnetic field (Yu.Belikov) | |
79 | * | |
c84a5e9e | 80 | * Revision 1.73 2005/05/28 14:19:05 schutz |
81 | * Compilation warnings fixed by T.P. | |
82 | * | |
702ab87e | 83 | */ |
84 | ||
d15a28e7 | 85 | //_________________________________________________________________________ |
b2a60966 | 86 | // Implementation version 1 of algorithm class to construct PHOS track segments |
f035f6ce | 87 | // Track segment for PHOS is list of |
194f9939 | 88 | // EMC RecPoint + (possibly) CPV RecPoint |
a4e98857 | 89 | // To find TrackSegments we do the following: |
90 | // for each EMC RecPoints we look at | |
194f9939 | 91 | // CPV RecPoints in the radious fRcpv. |
a4e98857 | 92 | // If there is such a CPV RecPoint, |
194f9939 | 93 | // we make "Link" it is just indexes of EMC and CPV RecPoint and distance |
a4e98857 | 94 | // between them in the PHOS plane. |
95 | // Then we sort "Links" and starting from the | |
96 | // least "Link" pointing to the unassined EMC and CPV RecPoints assing them to | |
97 | // new TrackSegment. | |
194f9939 | 98 | // If there is no CPV RecPoint we make TrackSegment |
a4e98857 | 99 | // consisting from EMC alone. There is no TrackSegments without EMC RecPoint. |
f444a19f | 100 | //// In principle this class should be called from AliPHOSReconstructor, but |
a4e98857 | 101 | // one can use it as well in standalone mode. |
102 | // Use case: | |
fc12304f | 103 | // root [0] AliPHOSTrackSegmentMakerv1 * t = new AliPHOSTrackSegmentMaker("galice.root", "tracksegmentsname", "recpointsname") |
a4e98857 | 104 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated |
fc12304f | 105 | // // reads gAlice from header file "galice.root", uses recpoints stored in the branch names "recpointsname" (default = "Default") |
106 | // // and saves recpoints in branch named "tracksegmentsname" (default = "recpointsname") | |
a4e98857 | 107 | // root [1] t->ExecuteTask() |
a4e98857 | 108 | // root [3] t->SetTrackSegmentsBranch("max distance 5 cm") |
109 | // root [4] t->ExecuteTask("deb all time") | |
f035f6ce | 110 | // |
fc12304f | 111 | //*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH) & Yves Schutz (SUBATECH) |
b2a60966 | 112 | // |
d15a28e7 | 113 | |
114 | // --- ROOT system --- | |
2731cd1e | 115 | #include "TTree.h" |
2731cd1e | 116 | #include "TBenchmark.h" |
d15a28e7 | 117 | |
21cd0c07 | 118 | // --- Standard library --- |
194f9939 | 119 | #include "Riostream.h" |
d15a28e7 | 120 | // --- AliRoot header files --- |
e957fea8 | 121 | #include "AliPHOSGeometry.h" |
d15a28e7 | 122 | #include "AliPHOSTrackSegmentMakerv1.h" |
123 | #include "AliPHOSTrackSegment.h" | |
124 | #include "AliPHOSLink.h" | |
af885e0f | 125 | #include "AliESDEvent.h" |
aa0b9641 | 126 | #include "AliESDtrack.h" |
9a2cdbdf | 127 | #include "AliPHOSEmcRecPoint.h" |
128 | #include "AliPHOSCpvRecPoint.h" | |
d15a28e7 | 129 | |
130 | ClassImp( AliPHOSTrackSegmentMakerv1) | |
131 | ||
132 | ||
133 | //____________________________________________________________________________ | |
3663622c | 134 | AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() : |
135 | AliPHOSTrackSegmentMaker(), | |
136 | fDefaultInit(kTRUE), | |
137 | fWrite(kFALSE), | |
138 | fNTrackSegments(0), | |
139 | fRcpv(0.f), | |
140 | fRtpc(0.f), | |
ddd1a39c | 141 | fVtx(0.f), |
3663622c | 142 | fLinkUpArray(0), |
143 | fEmcFirst(0), | |
144 | fEmcLast(0), | |
145 | fCpvFirst(0), | |
146 | fCpvLast(0), | |
147 | fModule(0), | |
9a2cdbdf | 148 | fTrackSegments(NULL) |
d15a28e7 | 149 | { |
7b7c1533 | 150 | // default ctor (to be used mainly by Streamer) |
8d0f3f77 | 151 | InitParameters() ; |
d15a28e7 | 152 | } |
7b7c1533 | 153 | |
9f616d61 | 154 | //____________________________________________________________________________ |
9a2cdbdf | 155 | AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(AliPHOSGeometry *geom) : |
156 | AliPHOSTrackSegmentMaker(geom), | |
3663622c | 157 | fDefaultInit(kFALSE), |
158 | fWrite(kFALSE), | |
159 | fNTrackSegments(0), | |
160 | fRcpv(0.f), | |
161 | fRtpc(0.f), | |
ddd1a39c | 162 | fVtx(0.f), |
3663622c | 163 | fLinkUpArray(0), |
164 | fEmcFirst(0), | |
165 | fEmcLast(0), | |
166 | fCpvFirst(0), | |
167 | fCpvLast(0), | |
168 | fModule(0), | |
9a2cdbdf | 169 | fTrackSegments(NULL) |
2731cd1e | 170 | { |
171 | // ctor | |
8d0f3f77 | 172 | InitParameters() ; |
7b7c1533 | 173 | Init() ; |
aa0b9641 | 174 | fESD = 0; |
2731cd1e | 175 | } |
98cbd830 | 176 | |
3663622c | 177 | |
178 | AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegmentMakerv1 & tsm) : | |
179 | AliPHOSTrackSegmentMaker(tsm), | |
180 | fDefaultInit(kFALSE), | |
181 | fWrite(kFALSE), | |
182 | fNTrackSegments(0), | |
183 | fRcpv(0.f), | |
184 | fRtpc(0.f), | |
ddd1a39c | 185 | fVtx(0.f), |
3663622c | 186 | fLinkUpArray(0), |
187 | fEmcFirst(0), | |
188 | fEmcLast(0), | |
189 | fCpvFirst(0), | |
190 | fCpvLast(0), | |
191 | fModule(0), | |
9a2cdbdf | 192 | fTrackSegments(NULL) |
3663622c | 193 | { |
194 | // cpy ctor: no implementation yet | |
195 | // requested by the Coding Convention | |
196 | Fatal("cpy ctor", "not implemented") ; | |
197 | } | |
198 | ||
199 | ||
2731cd1e | 200 | //____________________________________________________________________________ |
201 | AliPHOSTrackSegmentMakerv1::~AliPHOSTrackSegmentMakerv1() | |
202 | { | |
203 | // dtor | |
92f521a9 | 204 | // fDefaultInit = kTRUE if TrackSegmentMaker created by default ctor (to get just the parameters) |
88cb7938 | 205 | if (!fDefaultInit) |
206 | delete fLinkUpArray ; | |
9a2cdbdf | 207 | if (fTrackSegments) { |
208 | fTrackSegments->Delete(); | |
209 | delete fTrackSegments; | |
210 | } | |
fc12304f | 211 | } |
212 | ||
d15a28e7 | 213 | //____________________________________________________________________________ |
2731cd1e | 214 | void AliPHOSTrackSegmentMakerv1::FillOneModule() |
9f616d61 | 215 | { |
f035f6ce | 216 | // Finds first and last indexes between which |
217 | // clusters from one PHOS module are | |
88cb7938 | 218 | |
2731cd1e | 219 | //First EMC clusters |
9a2cdbdf | 220 | Int_t totalEmc = fEMCRecPoints->GetEntriesFast() ; |
2731cd1e | 221 | for(fEmcFirst = fEmcLast; (fEmcLast < totalEmc) && |
9a2cdbdf | 222 | ((dynamic_cast<AliPHOSRecPoint *>(fEMCRecPoints->At(fEmcLast)))->GetPHOSMod() == fModule ); |
2731cd1e | 223 | fEmcLast ++) ; |
224 | ||
2731cd1e | 225 | //Now CPV clusters |
9a2cdbdf | 226 | Int_t totalCpv = fCPVRecPoints->GetEntriesFast() ; |
6ad0bfa0 | 227 | |
2731cd1e | 228 | for(fCpvFirst = fCpvLast; (fCpvLast < totalCpv) && |
9a2cdbdf | 229 | ((dynamic_cast<AliPHOSRecPoint *>(fCPVRecPoints->At(fCpvLast)))->GetPHOSMod() == fModule ); |
88cb7938 | 230 | fCpvLast ++) ; |
9688c1dd | 231 | |
d15a28e7 | 232 | } |
7b7c1533 | 233 | |
d15a28e7 | 234 | //____________________________________________________________________________ |
e84d3def | 235 | void AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcClu, |
236 | AliPHOSCpvRecPoint * cpvClu, | |
237 | Int_t &trackindex, | |
238 | Float_t &dx, Float_t &dz) const | |
d15a28e7 | 239 | { |
194f9939 | 240 | // Calculates the distance between the EMC RecPoint and the CPV RecPoint |
a4e98857 | 241 | // Clusters are sorted in "rows" and "columns" of width 1 cm |
f035f6ce | 242 | |
e84d3def | 243 | // Float_t delta = 1 ; // Width of the rows in sorting of RecPoints (in cm) |
244 | // // if you change this value, change it as well in xxxRecPoint::Compare() | |
743cb288 | 245 | Float_t distance2Track = fRtpc ; |
194f9939 | 246 | |
247 | trackindex = -1 ; // closest track within fRCpv | |
248 | ||
aa0b9641 | 249 | TVector3 vecEmc ; // Local position of EMC recpoint |
e84d3def | 250 | TVector3 vecP ; // Momentum direction at CPV plain |
251 | TVector3 vecPloc ; // Momentum direction at CPV plain | |
2731cd1e | 252 | |
194f9939 | 253 | //toofar = kTRUE ; |
e84d3def | 254 | if(emcClu->GetPHOSMod() != cpvClu->GetPHOSMod()){ |
255 | dx=999. ; | |
256 | dz=999. ; | |
257 | return ; | |
258 | } | |
259 | ||
260 | emcClu->GetLocalPosition(vecEmc) ; | |
2731cd1e | 261 | |
e84d3def | 262 | Double_t xCPV,zCPV ; //EMC-projected coordinates of CPV cluster |
263 | TVector3 cpvGlobal; // Global position of the CPV recpoint | |
9a2cdbdf | 264 | fGeom->GetGlobalPHOS((AliPHOSRecPoint*)cpvClu,cpvGlobal); |
e84d3def | 265 | Double_t vtxCPV[3]={cpvGlobal.X(),cpvGlobal.Y(),cpvGlobal.Z()} ; |
78881c42 | 266 | Int_t dummyMod ; |
e84d3def | 267 | |
268 | if (fESD == 0x0) { | |
269 | //if no track information available, assume straight line from IP to emcal | |
9a2cdbdf | 270 | fGeom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ; |
e84d3def | 271 | dx=xCPV - vecEmc.X() ; |
272 | dz=zCPV - vecEmc.Z() ; | |
273 | return ; | |
274 | } | |
275 | ||
276 | //if there is ESD try to correct distance using TPC information on particle direct in CPV | |
277 | if (fESD != 0x0) { | |
0d9aa319 | 278 | |
e84d3def | 279 | Double_t rCPV = cpvGlobal.Pt() ;// Radius from IP to current point |
280 | ||
281 | // Extrapolate the global track direction if any to CPV and find the closest track | |
282 | Int_t nTracks = fESD->GetNumberOfTracks(); | |
283 | Int_t iClosestTrack = -1; | |
284 | Double_t minDistance = 1.e6; | |
285 | TVector3 inPHOS ; | |
286 | ||
287 | AliESDtrack *track; | |
288 | Double_t xyz[3] ; | |
289 | Double_t pxyz[3]; | |
290 | for (Int_t iTrack=0; iTrack<nTracks; iTrack++) { | |
291 | track = fESD->GetTrack(iTrack); | |
292 | if (!track->GetXYZAt(rCPV, fESD->GetMagneticField(), xyz)) | |
23904d16 | 293 | continue; //track coord on the cylinder of PHOS radius |
e84d3def | 294 | if ((TMath::Abs(xyz[0])+TMath::Abs(xyz[1])+TMath::Abs(xyz[2]))<=0) |
23904d16 | 295 | continue; |
e84d3def | 296 | //Check if this track hits PHOS |
297 | inPHOS.SetXYZ(xyz[0],xyz[1],xyz[2]); | |
298 | distance2Track = inPHOS.Angle(cpvGlobal) ; | |
299 | // Find the closest track to the CPV recpoint | |
300 | if (distance2Track < minDistance) { | |
301 | minDistance = distance2Track; | |
302 | iClosestTrack = iTrack; | |
aa0b9641 | 303 | } |
e84d3def | 304 | } |
aa0b9641 | 305 | |
e84d3def | 306 | if (iClosestTrack != -1) { |
307 | track = fESD->GetTrack(iClosestTrack); | |
308 | if (track->GetPxPyPzAt(rCPV, fESD->GetMagneticField(), pxyz)) { // track momentum ibid. | |
309 | vecP.SetXYZ(pxyz[0],pxyz[1],pxyz[2]); | |
9a2cdbdf | 310 | fGeom->ImpactOnEmc(vtxCPV,vecP.Theta(),vecP.Phi(),dummyMod,zCPV,xCPV) ; |
aa0b9641 | 311 | } |
e84d3def | 312 | } |
194f9939 | 313 | |
e84d3def | 314 | if(minDistance < fRtpc ){ |
315 | trackindex = iClosestTrack ; | |
aa0b9641 | 316 | } |
bfc17d18 | 317 | } |
e84d3def | 318 | if(trackindex!=-1){ |
78881c42 | 319 | // If the closest global track is found, calculate EMC-CPV distance from it |
e84d3def | 320 | dx=xCPV - vecEmc.X() ; |
321 | dz=zCPV - vecEmc.Z() ; | |
322 | } | |
323 | else{ | |
78881c42 | 324 | // If no global track was found, just take the nearest CPV point |
9a2cdbdf | 325 | fGeom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ; |
78881c42 | 326 | dx=xCPV - vecEmc.X() ; |
327 | dz=zCPV - vecEmc.Z() ; | |
e84d3def | 328 | } |
329 | return ; | |
d15a28e7 | 330 | } |
7b7c1533 | 331 | //____________________________________________________________________________ |
332 | void AliPHOSTrackSegmentMakerv1::Init() | |
333 | { | |
334 | // Make all memory allocations that are not possible in default constructor | |
335 | ||
7b7c1533 | 336 | fLinkUpArray = new TClonesArray("AliPHOSLink", 1000); |
9a2cdbdf | 337 | fTrackSegments = new TClonesArray("AliPHOSTrackSegment",100); |
338 | fTrackSegments->SetName("TRACKS"); | |
7b7c1533 | 339 | } |
340 | ||
8d0f3f77 | 341 | //____________________________________________________________________________ |
342 | void AliPHOSTrackSegmentMakerv1::InitParameters() | |
343 | { | |
e957fea8 | 344 | //Initializes parameters |
743cb288 | 345 | fRcpv = 10. ; |
346 | fRtpc = 4. ; | |
8d0f3f77 | 347 | fEmcFirst = 0 ; |
348 | fEmcLast = 0 ; | |
349 | fCpvFirst = 0 ; | |
350 | fCpvLast = 0 ; | |
351 | fLinkUpArray = 0 ; | |
adcca1e6 | 352 | fWrite = kTRUE ; |
8d0f3f77 | 353 | } |
354 | ||
355 | ||
d15a28e7 | 356 | //____________________________________________________________________________ |
baef0810 | 357 | void AliPHOSTrackSegmentMakerv1::MakeLinks()const |
d15a28e7 | 358 | { |
194f9939 | 359 | // Finds distances (links) between all EMC and CPV clusters, |
fbf811ec | 360 | // which are not further apart from each other than fRcpv |
f035f6ce | 361 | // and sort them in accordance with this distance |
9688c1dd | 362 | |
2731cd1e | 363 | fLinkUpArray->Clear() ; |
2731cd1e | 364 | |
2bb500e5 | 365 | AliPHOSCpvRecPoint * cpv ; |
92862013 | 366 | AliPHOSEmcRecPoint * emcclu ; |
28c3a259 | 367 | |
d15a28e7 | 368 | Int_t iLinkUp = 0 ; |
369 | ||
28c3a259 | 370 | Int_t iEmcRP; |
2731cd1e | 371 | for(iEmcRP = fEmcFirst; iEmcRP < fEmcLast; iEmcRP++ ) { |
9a2cdbdf | 372 | emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP)) ; |
2731cd1e | 373 | |
194f9939 | 374 | //Bool_t toofar ; |
2731cd1e | 375 | Int_t iCpv = 0 ; |
376 | for(iCpv = fCpvFirst; iCpv < fCpvLast;iCpv++ ) { | |
28c3a259 | 377 | |
9a2cdbdf | 378 | cpv = dynamic_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(iCpv)) ; |
194f9939 | 379 | Int_t track = -1 ; |
e84d3def | 380 | Float_t dx,dz ; |
381 | GetDistanceInPHOSPlane(emcclu, cpv, track,dx,dz) ; | |
382 | if(TMath::Sqrt(dx*dx+dz*dz) < fRcpv ){ | |
383 | new ((*fLinkUpArray)[iLinkUp++]) AliPHOSLink(dx, dz, iEmcRP, iCpv, track) ; | |
28c3a259 | 384 | } |
d15a28e7 | 385 | } |
28c3a259 | 386 | } |
d15a28e7 | 387 | |
9688c1dd | 388 | fLinkUpArray->Sort() ; //first links with smallest distances |
d15a28e7 | 389 | } |
28c3a259 | 390 | |
d15a28e7 | 391 | //____________________________________________________________________________ |
2731cd1e | 392 | void AliPHOSTrackSegmentMakerv1::MakePairs() |
6ad0bfa0 | 393 | { |
f035f6ce | 394 | // Using the previously made list of "links", we found the smallest link - i.e. |
a4e98857 | 395 | // link with the least distance between EMC and CPV and pointing to still |
f035f6ce | 396 | // unassigned RecParticles. We assign these RecPoints to TrackSegment and |
397 | // remove them from the list of "unassigned". | |
88cb7938 | 398 | |
01a599c9 | 399 | //Make arrays to mark clusters already chosen |
2731cd1e | 400 | Int_t * emcExist = 0; |
401 | if(fEmcLast > fEmcFirst) | |
402 | emcExist = new Int_t[fEmcLast-fEmcFirst] ; | |
403 | ||
404 | Int_t index; | |
405 | for(index = 0; index <fEmcLast-fEmcFirst; index ++) | |
406 | emcExist[index] = 1 ; | |
407 | ||
408 | Bool_t * cpvExist = 0; | |
409 | if(fCpvLast > fCpvFirst) | |
410 | cpvExist = new Bool_t[fCpvLast-fCpvFirst] ; | |
411 | for(index = 0; index <fCpvLast-fCpvFirst; index ++) | |
412 | cpvExist[index] = kTRUE ; | |
413 | ||
2731cd1e | 414 | |
415 | // Finds the smallest links and makes pairs of CPV and EMC clusters with smallest distance | |
2731cd1e | 416 | TIter nextUp(fLinkUpArray) ; |
d15a28e7 | 417 | |
d15a28e7 | 418 | AliPHOSLink * linkUp ; |
9688c1dd | 419 | |
2bb500e5 | 420 | AliPHOSCpvRecPoint * nullpointer = 0 ; |
9688c1dd | 421 | |
29b077b5 | 422 | while ( (linkUp = static_cast<AliPHOSLink *>(nextUp()) ) ){ |
9688c1dd | 423 | |
194f9939 | 424 | if(emcExist[linkUp->GetEmc()-fEmcFirst] != -1){ |
d15a28e7 | 425 | |
194f9939 | 426 | if(cpvExist[linkUp->GetCpv()-fCpvFirst]){ //CPV still exist |
d7ddbb70 | 427 | Float_t dx,dz ; |
428 | linkUp->GetXZ(dx,dz) ; | |
9a2cdbdf | 429 | new ((* fTrackSegments)[fNTrackSegments]) |
430 | AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(linkUp->GetEmc())) , | |
431 | dynamic_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(linkUp->GetCpv())) , | |
d7ddbb70 | 432 | linkUp->GetTrack(),dx,dz) ; |
194f9939 | 433 | |
9a2cdbdf | 434 | (dynamic_cast<AliPHOSTrackSegment *>(fTrackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); |
88cb7938 | 435 | fNTrackSegments++ ; |
88cb7938 | 436 | emcExist[linkUp->GetEmc()-fEmcFirst] = -1 ; //Mark emc that Cpv was found |
437 | //mark CPV recpoint as already used | |
194f9939 | 438 | cpvExist[linkUp->GetCpv()-fCpvFirst] = kFALSE ; |
439 | } //if CpvUp still exist | |
28c3a259 | 440 | } |
88cb7938 | 441 | } |
28c3a259 | 442 | |
194f9939 | 443 | //look through emc recPoints left without CPV |
2731cd1e | 444 | if(emcExist){ //if there is emc rec point |
445 | Int_t iEmcRP ; | |
446 | for(iEmcRP = 0; iEmcRP < fEmcLast-fEmcFirst ; iEmcRP++ ){ | |
447 | if(emcExist[iEmcRP] > 0 ){ | |
9a2cdbdf | 448 | new ((*fTrackSegments)[fNTrackSegments]) |
449 | AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP+fEmcFirst)), | |
88cb7938 | 450 | nullpointer) ; |
9a2cdbdf | 451 | (dynamic_cast<AliPHOSTrackSegment *>(fTrackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); |
88cb7938 | 452 | fNTrackSegments++; |
2731cd1e | 453 | } |
d15a28e7 | 454 | } |
d15a28e7 | 455 | } |
780a31c1 | 456 | delete [] emcExist ; |
457 | delete [] cpvExist ; | |
d15a28e7 | 458 | } |
459 | ||
460 | //____________________________________________________________________________ | |
9a2cdbdf | 461 | void AliPHOSTrackSegmentMakerv1::Clusters2TrackSegments(Option_t *option) |
d15a28e7 | 462 | { |
9a2cdbdf | 463 | // Steering method to perform track segment construction for the current event |
464 | // Returns an array with the found track-segments. | |
88cb7938 | 465 | |
2731cd1e | 466 | if(strstr(option,"tim")) |
b3f97575 | 467 | gBenchmark->Start("PHOSTSMaker"); |
7b7c1533 | 468 | |
469 | if(strstr(option,"print")) { | |
88cb7938 | 470 | Print() ; |
7b7c1533 | 471 | return ; |
472 | } | |
88cb7938 | 473 | |
9a2cdbdf | 474 | //Make some initializations |
475 | fNTrackSegments = 0 ; | |
476 | fEmcFirst = 0 ; | |
477 | fEmcLast = 0 ; | |
478 | fCpvFirst = 0 ; | |
479 | fCpvLast = 0 ; | |
55ea5766 | 480 | |
9a2cdbdf | 481 | fTrackSegments->Clear(); |
7b7c1533 | 482 | |
9a2cdbdf | 483 | // if(!ReadRecPoints(ievent)) continue; //reads RecPoints for event ievent |
94de8339 | 484 | |
9a2cdbdf | 485 | for(fModule = 1; fModule <= fGeom->GetNModules() ; fModule++ ) { |
486 | FillOneModule() ; | |
487 | MakeLinks() ; | |
488 | MakePairs() ; | |
2731cd1e | 489 | } |
9a2cdbdf | 490 | |
491 | if(strstr(option,"deb")) | |
492 | PrintTrackSegments(option); | |
493 | ||
2731cd1e | 494 | if(strstr(option,"tim")){ |
495 | gBenchmark->Stop("PHOSTSMaker"); | |
9a2cdbdf | 496 | Info("Exec", "took %f seconds for making TS", |
497 | gBenchmark->GetCpuTime("PHOSTSMaker")); | |
498 | } | |
d15a28e7 | 499 | } |
7b7c1533 | 500 | |
d15a28e7 | 501 | //____________________________________________________________________________ |
702ab87e | 502 | void AliPHOSTrackSegmentMakerv1::Print(const Option_t *)const |
a4e98857 | 503 | { |
baef0810 | 504 | // Print TrackSegmentMaker parameters |
505 | ||
21cd0c07 | 506 | TString message("") ; |
7b7c1533 | 507 | if( strcmp(GetName(), "") != 0 ) { |
21cd0c07 | 508 | message = "\n======== AliPHOSTrackSegmentMakerv1 ========\n" ; |
509 | message += "Making Track segments\n" ; | |
510 | message += "with parameters:\n" ; | |
194f9939 | 511 | message += " Maximal EMC - CPV distance (cm) %f\n" ; |
21cd0c07 | 512 | message += "============================================\n" ; |
513 | Info("Print", message.Data(),fRcpv) ; | |
2731cd1e | 514 | } |
515 | else | |
21cd0c07 | 516 | Info("Print", "AliPHOSTrackSegmentMakerv1 not initialized ") ; |
d15a28e7 | 517 | } |
7b7c1533 | 518 | |
2731cd1e | 519 | //____________________________________________________________________________ |
a4e98857 | 520 | void AliPHOSTrackSegmentMakerv1::PrintTrackSegments(Option_t * option) |
521 | { | |
f035f6ce | 522 | // option deb - prints # of found TrackSegments |
523 | // option deb all - prints as well indexed of found RecParticles assigned to the TS | |
9688c1dd | 524 | |
88cb7938 | 525 | Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ; |
9a2cdbdf | 526 | printf(" Found %d TrackSegments\n", fTrackSegments->GetEntriesFast() ); |
88cb7938 | 527 | |
2731cd1e | 528 | if(strstr(option,"all")) { // printing found TS |
88cb7938 | 529 | printf("TrackSegment # EMC RP# CPV RP#\n") ; |
2731cd1e | 530 | Int_t index; |
9a2cdbdf | 531 | for (index = 0 ; index <fTrackSegments->GetEntriesFast() ; index++) { |
532 | AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )fTrackSegments->At(index) ; | |
88cb7938 | 533 | printf(" %d %d %d \n", ts->GetIndexInList(), ts->GetEmcIndex(), ts->GetCpvIndex() ) ; |
2731cd1e | 534 | } |
d15a28e7 | 535 | } |
2731cd1e | 536 | } |