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