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