]>
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$ */ |
d15a28e7 | 16 | //_________________________________________________________________________ |
b2a60966 | 17 | // Implementation version 1 of algorithm class to construct PHOS track segments |
f035f6ce | 18 | // Track segment for PHOS is list of |
19 | // EMC RecPoint + (possibly) CPV RecPoint + (possibly) PPSD RecPoint | |
a4e98857 | 20 | // To find TrackSegments we do the following: |
21 | // for each EMC RecPoints we look at | |
22 | // CPV/PPSD RecPoints in the radious fR0. | |
23 | // If there is such a CPV RecPoint, | |
24 | // we make "Link" it is just indexes of EMC and CPV/PPSD RecPoint and distance | |
25 | // between them in the PHOS plane. | |
26 | // Then we sort "Links" and starting from the | |
27 | // least "Link" pointing to the unassined EMC and CPV RecPoints assing them to | |
28 | // new TrackSegment. | |
29 | // If there is no CPV/PPSD RecPoint we make TrackSegment | |
30 | // consisting from EMC alone. There is no TrackSegments without EMC RecPoint. | |
f035f6ce | 31 | // |
32 | // In principle this class should be called from AliPHOSReconstructioner, but | |
a4e98857 | 33 | // one can use it as well in standalone mode. |
34 | // Use case: | |
fc12304f | 35 | // root [0] AliPHOSTrackSegmentMakerv1 * t = new AliPHOSTrackSegmentMaker("galice.root", "tracksegmentsname", "recpointsname") |
a4e98857 | 36 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated |
fc12304f | 37 | // // reads gAlice from header file "galice.root", uses recpoints stored in the branch names "recpointsname" (default = "Default") |
38 | // // and saves recpoints in branch named "tracksegmentsname" (default = "recpointsname") | |
a4e98857 | 39 | // root [1] t->ExecuteTask() |
40 | // root [2] t->SetMaxEmcPpsdDistance(5) | |
41 | // root [3] t->SetTrackSegmentsBranch("max distance 5 cm") | |
42 | // root [4] t->ExecuteTask("deb all time") | |
f035f6ce | 43 | // |
fc12304f | 44 | //*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH) & Yves Schutz (SUBATECH) |
b2a60966 | 45 | // |
d15a28e7 | 46 | |
47 | // --- ROOT system --- | |
2731cd1e | 48 | #include "TROOT.h" |
49 | #include "TFile.h" | |
7b7c1533 | 50 | #include "TFolder.h" |
2731cd1e | 51 | #include "TTree.h" |
52 | #include "TSystem.h" | |
53 | #include "TBenchmark.h" | |
d15a28e7 | 54 | // --- Standard library --- |
55 | ||
de9ec31b | 56 | #include <iostream.h> |
2731cd1e | 57 | #include <iomanip.h> |
d15a28e7 | 58 | |
59 | // --- AliRoot header files --- | |
60 | ||
61 | #include "AliPHOSTrackSegmentMakerv1.h" | |
2731cd1e | 62 | #include "AliPHOSClusterizerv1.h" |
d15a28e7 | 63 | #include "AliPHOSTrackSegment.h" |
2aca7d46 | 64 | #include "AliPHOSCpvRecPoint.h" |
d15a28e7 | 65 | #include "AliPHOSLink.h" |
7b7c1533 | 66 | #include "AliPHOSGetter.h" |
baef0810 | 67 | #include "AliPHOS.h" |
d15a28e7 | 68 | #include "AliRun.h" |
69 | ||
70 | ClassImp( AliPHOSTrackSegmentMakerv1) | |
71 | ||
72 | ||
73 | //____________________________________________________________________________ | |
2bd5457f | 74 | AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() : AliPHOSTrackSegmentMaker() |
d15a28e7 | 75 | { |
7b7c1533 | 76 | // default ctor (to be used mainly by Streamer) |
77 | ||
8d0f3f77 | 78 | InitParameters() ; |
7b7c1533 | 79 | fHeaderFileName = "" ; |
80 | fRecPointsBranchTitle = "" ; | |
81 | fTrackSegmentsBranchTitle = "" ; | |
fc12304f | 82 | fFrom = "" ; |
83 | ||
2b60655b | 84 | fTrackSegmentsInRun = 0 ; |
d15a28e7 | 85 | } |
7b7c1533 | 86 | |
9f616d61 | 87 | //____________________________________________________________________________ |
fc12304f | 88 | AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const char * headerFile, const char * name, const char * from) : AliPHOSTrackSegmentMaker(headerFile, name) |
2731cd1e | 89 | { |
90 | // ctor | |
2731cd1e | 91 | |
8d0f3f77 | 92 | InitParameters() ; |
7b7c1533 | 93 | fHeaderFileName = GetTitle() ; |
94 | fRecPointsBranchTitle = GetName() ; | |
95 | fTrackSegmentsBranchTitle = GetName() ; | |
2b60655b | 96 | fTrackSegmentsInRun = 0 ; |
97 | ||
fc12304f | 98 | if ( from == 0 ) |
99 | fFrom = name ; | |
100 | else | |
101 | fFrom = from ; | |
7b7c1533 | 102 | Init() ; |
fc12304f | 103 | |
2731cd1e | 104 | } |
98cbd830 | 105 | |
2731cd1e | 106 | //____________________________________________________________________________ |
107 | AliPHOSTrackSegmentMakerv1::~AliPHOSTrackSegmentMakerv1() | |
108 | { | |
109 | // dtor | |
79bf6a2f | 110 | delete fLinkUpArray ; |
8d0f3f77 | 111 | |
112 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; | |
113 | ||
114 | // remove the task from the folder list | |
115 | gime->RemoveTask("T",GetName()) ; | |
116 | TString name(GetName()) ; | |
117 | name.ReplaceAll("tsm", "clu") ; | |
118 | gime->RemoveTask("C",name) ; | |
119 | ||
120 | // remove the data from the folder list | |
121 | name = GetName() ; | |
122 | name.Remove(name.Index(":")) ; | |
123 | gime->RemoveObjects("RE", name) ; // EMCARecPoints | |
124 | gime->RemoveObjects("RC", name) ; // CPVRecPoints | |
125 | gime->RemoveObjects("T", name) ; // TrackSegments | |
126 | ||
127 | // Delete gAlice | |
128 | gime->CloseFile() ; | |
129 | ||
d15a28e7 | 130 | } |
9f616d61 | 131 | |
8d0f3f77 | 132 | |
fc12304f | 133 | //____________________________________________________________________________ |
134 | const TString AliPHOSTrackSegmentMakerv1::BranchName() const | |
135 | { | |
136 | TString branchName(GetName() ) ; | |
137 | branchName.Remove(branchName.Index(Version())-1) ; | |
138 | return branchName ; | |
139 | } | |
140 | ||
d15a28e7 | 141 | //____________________________________________________________________________ |
2731cd1e | 142 | void AliPHOSTrackSegmentMakerv1::FillOneModule() |
9f616d61 | 143 | { |
f035f6ce | 144 | // Finds first and last indexes between which |
145 | // clusters from one PHOS module are | |
fc12304f | 146 | |
7b7c1533 | 147 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
fc12304f | 148 | TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ; |
149 | TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ; | |
9688c1dd | 150 | |
2731cd1e | 151 | //First EMC clusters |
7b7c1533 | 152 | Int_t totalEmc = emcRecPoints->GetEntriesFast() ; |
2731cd1e | 153 | for(fEmcFirst = fEmcLast; (fEmcLast < totalEmc) && |
29b077b5 | 154 | ((dynamic_cast<AliPHOSRecPoint *>(emcRecPoints->At(fEmcLast)))->GetPHOSMod() == fModule ); |
2731cd1e | 155 | fEmcLast ++) ; |
156 | ||
2731cd1e | 157 | //Now CPV clusters |
7b7c1533 | 158 | Int_t totalCpv = cpvRecPoints->GetEntriesFast() ; |
6ad0bfa0 | 159 | |
2731cd1e | 160 | for(fCpvFirst = fCpvLast; (fCpvLast < totalCpv) && |
29b077b5 | 161 | ((dynamic_cast<AliPHOSRecPoint *>(cpvRecPoints->At(fCpvLast)))->GetPHOSMod() == fModule ); |
2731cd1e | 162 | fCpvLast ++) ; |
9688c1dd | 163 | |
d15a28e7 | 164 | } |
7b7c1533 | 165 | |
d15a28e7 | 166 | //____________________________________________________________________________ |
baef0810 | 167 | Float_t AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcClu,AliPHOSRecPoint * cpvClu, Bool_t &toofar)const |
d15a28e7 | 168 | { |
b2a60966 | 169 | // Calculates the distance between the EMC RecPoint and the PPSD RecPoint |
a4e98857 | 170 | // Clusters are sorted in "rows" and "columns" of width 1 cm |
f035f6ce | 171 | |
2731cd1e | 172 | Float_t delta = 1 ; // Width of the rows in sorting of RecPoints (in cm) |
173 | // if you change this value, change it as well in xxxRecPoint::Compare() | |
92862013 | 174 | Float_t r = fR0 ; |
d15a28e7 | 175 | |
176 | TVector3 vecEmc ; | |
2731cd1e | 177 | TVector3 vecCpv ; |
178 | ||
179 | emcClu->GetLocalPosition(vecEmc) ; | |
180 | cpvClu->GetLocalPosition(vecCpv) ; | |
181 | ||
182 | if(emcClu->GetPHOSMod() == cpvClu->GetPHOSMod()){ | |
183 | if(vecCpv.X() <= vecEmc.X() + fR0 + 2*delta ){ | |
184 | ||
185 | vecCpv = vecCpv - vecEmc ; | |
186 | r = vecCpv.Mag() ; | |
92862013 | 187 | toofar = kFALSE ; |
2731cd1e | 188 | |
189 | } // if xPpsd >= xEmc + ... | |
190 | else | |
191 | toofar = kTRUE ; | |
d15a28e7 | 192 | } |
193 | else | |
92862013 | 194 | toofar = kTRUE ; |
7956ec10 | 195 | |
196 | //toofar = kFALSE ; | |
197 | ||
d15a28e7 | 198 | |
92862013 | 199 | return r ; |
d15a28e7 | 200 | } |
201 | ||
7b7c1533 | 202 | //____________________________________________________________________________ |
203 | void AliPHOSTrackSegmentMakerv1::Init() | |
204 | { | |
205 | // Make all memory allocations that are not possible in default constructor | |
206 | ||
207 | if ( strcmp(GetTitle(), "") == 0 ) | |
208 | SetTitle("galice.root") ; | |
9688c1dd | 209 | |
fc12304f | 210 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), fFrom.Data()) ; |
7b7c1533 | 211 | if ( gime == 0 ) { |
212 | cerr << "ERROR: AliPHOSTrackSegmentMakerv1::Init -> Could not obtain the Getter object !" << endl ; | |
213 | return ; | |
214 | } | |
215 | ||
7b7c1533 | 216 | fLinkUpArray = new TClonesArray("AliPHOSLink", 1000); |
217 | ||
218 | //add Task to //YSAlice/tasks/Reconstructioner/PHOS | |
55ea5766 | 219 | gime->PostTrackSegmentMaker(this) ; |
7b7c1533 | 220 | |
55ea5766 | 221 | // create a folder on the white board //YSAlice/WhiteBoard/RecPoints/PHOS/trackSegmentsName |
fc12304f | 222 | gime->PostTrackSegments(BranchName()) ; |
7b7c1533 | 223 | |
224 | } | |
225 | ||
8d0f3f77 | 226 | //____________________________________________________________________________ |
227 | void AliPHOSTrackSegmentMakerv1::InitParameters() | |
228 | { | |
229 | fR0 = 10. ; | |
230 | fEmcFirst = 0 ; | |
231 | fEmcLast = 0 ; | |
232 | fCpvFirst = 0 ; | |
233 | fCpvLast = 0 ; | |
234 | fLinkUpArray = 0 ; | |
235 | TString tsmName( GetName()) ; | |
236 | if (tsmName.IsNull() ) | |
237 | tsmName = "Default" ; | |
238 | tsmName.Append(":") ; | |
239 | tsmName.Append(Version()) ; | |
240 | SetName(tsmName) ; | |
241 | } | |
242 | ||
243 | ||
d15a28e7 | 244 | //____________________________________________________________________________ |
baef0810 | 245 | void AliPHOSTrackSegmentMakerv1::MakeLinks()const |
d15a28e7 | 246 | { |
f035f6ce | 247 | // Finds distances (links) between all EMC and PPSD clusters, |
248 | // which are not further apart from each other than fR0 | |
249 | // and sort them in accordance with this distance | |
9688c1dd | 250 | |
7b7c1533 | 251 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
fc12304f | 252 | TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ; |
253 | TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ; | |
7b7c1533 | 254 | |
2731cd1e | 255 | fLinkUpArray->Clear() ; |
2731cd1e | 256 | |
2731cd1e | 257 | AliPHOSRecPoint * cpv ; |
92862013 | 258 | AliPHOSEmcRecPoint * emcclu ; |
28c3a259 | 259 | |
d15a28e7 | 260 | Int_t iLinkUp = 0 ; |
261 | ||
28c3a259 | 262 | Int_t iEmcRP; |
2731cd1e | 263 | for(iEmcRP = fEmcFirst; iEmcRP < fEmcLast; iEmcRP++ ) { |
29b077b5 | 264 | emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(iEmcRP)) ; |
2731cd1e | 265 | |
9688c1dd | 266 | Bool_t toofar ; |
2731cd1e | 267 | Int_t iCpv = 0 ; |
268 | for(iCpv = fCpvFirst; iCpv < fCpvLast;iCpv++ ) { | |
28c3a259 | 269 | |
29b077b5 | 270 | cpv = dynamic_cast<AliPHOSRecPoint *>(cpvRecPoints->At(iCpv)) ; |
2731cd1e | 271 | Float_t r = GetDistanceInPHOSPlane(emcclu, cpv, toofar) ; |
d15a28e7 | 272 | |
92862013 | 273 | if(toofar) |
d15a28e7 | 274 | break ; |
83974468 | 275 | if(r < fR0) { |
2731cd1e | 276 | new ((*fLinkUpArray)[iLinkUp++]) AliPHOSLink(r, iEmcRP, iCpv) ; |
28c3a259 | 277 | } |
d15a28e7 | 278 | } |
28c3a259 | 279 | } |
d15a28e7 | 280 | |
9688c1dd | 281 | fLinkUpArray->Sort() ; //first links with smallest distances |
d15a28e7 | 282 | } |
28c3a259 | 283 | |
d15a28e7 | 284 | //____________________________________________________________________________ |
2731cd1e | 285 | void AliPHOSTrackSegmentMakerv1::MakePairs() |
6ad0bfa0 | 286 | { |
f035f6ce | 287 | // Using the previously made list of "links", we found the smallest link - i.e. |
a4e98857 | 288 | // link with the least distance between EMC and CPV and pointing to still |
f035f6ce | 289 | // unassigned RecParticles. We assign these RecPoints to TrackSegment and |
290 | // remove them from the list of "unassigned". | |
6ad0bfa0 | 291 | |
7b7c1533 | 292 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
fc12304f | 293 | TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ; |
294 | TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ; | |
295 | TClonesArray * trackSegments = gime->TrackSegments(BranchName()) ; | |
9688c1dd | 296 | |
01a599c9 | 297 | //Make arrays to mark clusters already chosen |
2731cd1e | 298 | Int_t * emcExist = 0; |
299 | if(fEmcLast > fEmcFirst) | |
300 | emcExist = new Int_t[fEmcLast-fEmcFirst] ; | |
301 | ||
302 | Int_t index; | |
303 | for(index = 0; index <fEmcLast-fEmcFirst; index ++) | |
304 | emcExist[index] = 1 ; | |
305 | ||
306 | Bool_t * cpvExist = 0; | |
307 | if(fCpvLast > fCpvFirst) | |
308 | cpvExist = new Bool_t[fCpvLast-fCpvFirst] ; | |
309 | for(index = 0; index <fCpvLast-fCpvFirst; index ++) | |
310 | cpvExist[index] = kTRUE ; | |
311 | ||
2731cd1e | 312 | |
313 | // Finds the smallest links and makes pairs of CPV and EMC clusters with smallest distance | |
2731cd1e | 314 | TIter nextUp(fLinkUpArray) ; |
d15a28e7 | 315 | |
d15a28e7 | 316 | AliPHOSLink * linkUp ; |
9688c1dd | 317 | |
2731cd1e | 318 | AliPHOSRecPoint * nullpointer = 0 ; |
9688c1dd | 319 | |
29b077b5 | 320 | while ( (linkUp = static_cast<AliPHOSLink *>(nextUp()) ) ){ |
9688c1dd | 321 | |
2731cd1e | 322 | if(emcExist[linkUp->GetEmc()-fEmcFirst] != -1){ //without ppsd Up yet |
d15a28e7 | 323 | |
2731cd1e | 324 | if(cpvExist[linkUp->GetPpsd()-fCpvFirst]){ //CPV still exist |
7956ec10 | 325 | |
9688c1dd | 326 | new ((* trackSegments)[fNTrackSegments]) |
29b077b5 | 327 | AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(linkUp->GetEmc())) , |
328 | dynamic_cast<AliPHOSRecPoint *>(cpvRecPoints->At(linkUp->GetPpsd()))) ; | |
329 | (dynamic_cast<AliPHOSTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); | |
9688c1dd | 330 | fNTrackSegments++ ; |
331 | ||
2731cd1e | 332 | emcExist[linkUp->GetEmc()-fEmcFirst] = -1 ; //Mark emc that Cpv was found |
333 | //mark CPV recpoint as already used | |
9688c1dd | 334 | cpvExist[linkUp->GetPpsd()-fCpvFirst] = kFALSE ; |
7956ec10 | 335 | } //if ppsdUp still exist |
28c3a259 | 336 | } |
337 | } | |
338 | ||
2731cd1e | 339 | //look through emc recPoints left without CPV/PPSD |
340 | if(emcExist){ //if there is emc rec point | |
341 | Int_t iEmcRP ; | |
342 | for(iEmcRP = 0; iEmcRP < fEmcLast-fEmcFirst ; iEmcRP++ ){ | |
343 | if(emcExist[iEmcRP] > 0 ){ | |
9688c1dd | 344 | new ((*trackSegments)[fNTrackSegments]) |
29b077b5 | 345 | AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(iEmcRP+fEmcFirst)), |
9688c1dd | 346 | nullpointer) ; |
29b077b5 | 347 | (dynamic_cast<AliPHOSTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments); |
2731cd1e | 348 | fNTrackSegments++; |
349 | } | |
d15a28e7 | 350 | } |
d15a28e7 | 351 | } |
780a31c1 | 352 | delete [] emcExist ; |
353 | delete [] cpvExist ; | |
d15a28e7 | 354 | } |
355 | ||
356 | //____________________________________________________________________________ | |
2731cd1e | 357 | void AliPHOSTrackSegmentMakerv1::Exec(Option_t * option) |
d15a28e7 | 358 | { |
a4e98857 | 359 | // STEERing method |
28c3a259 | 360 | |
7b7c1533 | 361 | if( strcmp(GetName(), "")== 0 ) |
362 | Init() ; | |
6ad0bfa0 | 363 | |
2731cd1e | 364 | if(strstr(option,"tim")) |
b3f97575 | 365 | gBenchmark->Start("PHOSTSMaker"); |
7b7c1533 | 366 | |
367 | if(strstr(option,"print")) { | |
368 | Print("") ; | |
369 | return ; | |
370 | } | |
d15a28e7 | 371 | |
55ea5766 | 372 | gAlice->GetEvent(0) ; |
9688c1dd | 373 | //check, if the branch with name of this" already exits? |
8d0f3f77 | 374 | if (gAlice->TreeR()) { |
375 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ; | |
376 | TIter next(lob) ; | |
377 | TBranch * branch = 0 ; | |
378 | Bool_t phostsfound = kFALSE, tracksegmentmakerfound = kFALSE ; | |
379 | ||
380 | TString branchname = GetName() ; | |
381 | branchname.Remove(branchname.Index(Version())-1) ; | |
382 | ||
383 | while ( (branch = static_cast<TBranch*>(next())) && (!phostsfound || !tracksegmentmakerfound) ) { | |
384 | if ( (strcmp(branch->GetName(), "PHOSTS")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) ) | |
385 | phostsfound = kTRUE ; | |
386 | ||
387 | else if ( (strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) && (strcmp(branch->GetTitle(), GetName())==0) ) | |
388 | tracksegmentmakerfound = kTRUE ; | |
389 | } | |
7b7c1533 | 390 | |
8d0f3f77 | 391 | if ( phostsfound || tracksegmentmakerfound ) { |
392 | cerr << "WARNING: AliPHOSTrackSegmentMakerv1::Exec -> TrackSegments and/or TrackSegmentMaker branch with name " | |
393 | << branchname.Data() << " already exits" << endl ; | |
394 | return ; | |
395 | } | |
7b7c1533 | 396 | } |
397 | ||
9688c1dd | 398 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; |
55ea5766 | 399 | const AliPHOSGeometry * geom = gime->PHOSGeometry() ; |
7b7c1533 | 400 | Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ; |
401 | Int_t ievent ; | |
402 | ||
403 | for(ievent = 0; ievent < nevents; ievent++){ | |
01a599c9 | 404 | |
55ea5766 | 405 | gime->Event(ievent,"R") ; |
55ea5766 | 406 | //Make some initializations |
407 | fNTrackSegments = 0 ; | |
408 | fEmcFirst = 0 ; | |
409 | fEmcLast = 0 ; | |
410 | fCpvFirst = 0 ; | |
411 | fCpvLast = 0 ; | |
fc12304f | 412 | gime->TrackSegments(BranchName())->Clear() ; |
55ea5766 | 413 | |
9688c1dd | 414 | // if(!ReadRecPoints(ievent)) continue; //reads RecPoints for event ievent |
415 | ||
7b7c1533 | 416 | for(fModule = 1; fModule <= geom->GetNModules() ; fModule++ ){ |
2731cd1e | 417 | |
418 | FillOneModule() ; | |
419 | ||
420 | MakeLinks() ; | |
421 | ||
422 | MakePairs() ; | |
423 | ||
424 | } | |
28c3a259 | 425 | |
7b7c1533 | 426 | WriteTrackSegments(ievent) ; |
427 | ||
2731cd1e | 428 | if(strstr(option,"deb")) |
429 | PrintTrackSegments(option) ; | |
94de8339 | 430 | |
431 | //increment the total number of track segments per run | |
fc12304f | 432 | fTrackSegmentsInRun += gime->TrackSegments(BranchName())->GetEntriesFast() ; |
7b7c1533 | 433 | |
2731cd1e | 434 | } |
9f616d61 | 435 | |
2731cd1e | 436 | if(strstr(option,"tim")){ |
437 | gBenchmark->Stop("PHOSTSMaker"); | |
438 | cout << "AliPHOSTSMaker:" << endl ; | |
439 | cout << " took " << gBenchmark->GetCpuTime("PHOSTSMaker") << " seconds for making TS " | |
7b7c1533 | 440 | << gBenchmark->GetCpuTime("PHOSTSMaker")/nevents << " seconds per event " << endl ; |
2731cd1e | 441 | cout << endl ; |
442 | } | |
7b7c1533 | 443 | |
d15a28e7 | 444 | } |
7b7c1533 | 445 | |
d15a28e7 | 446 | //____________________________________________________________________________ |
baef0810 | 447 | void AliPHOSTrackSegmentMakerv1::Print(Option_t * option)const |
a4e98857 | 448 | { |
baef0810 | 449 | // Print TrackSegmentMaker parameters |
450 | ||
7b7c1533 | 451 | if( strcmp(GetName(), "") != 0 ) { |
2731cd1e | 452 | cout << "======== AliPHOSTrackSegmentMakerv1 ========" << endl ; |
453 | cout << "Making Track segments "<< endl ; | |
f035f6ce | 454 | cout << " Headers file: " << fHeaderFileName.Data() << endl ; |
455 | cout << " RecPoints branch file name: " << fRecPointsBranchTitle.Data() << endl ; | |
7b7c1533 | 456 | cout << " TrackSegments Branch file name: " << fTrackSegmentsBranchTitle.Data() << endl ; |
2731cd1e | 457 | cout << "with parameters: " << endl ; |
f035f6ce | 458 | cout << " Maximal EMC - CPV (PPSD) distance (cm)" << fR0 << endl ; |
2731cd1e | 459 | cout << "============================================" << endl ; |
460 | } | |
461 | else | |
462 | cout << "AliPHOSTrackSegmentMakerv1 not initialized " << endl ; | |
d15a28e7 | 463 | } |
7b7c1533 | 464 | |
d15a28e7 | 465 | //____________________________________________________________________________ |
7b7c1533 | 466 | void AliPHOSTrackSegmentMakerv1::WriteTrackSegments(Int_t event) |
a4e98857 | 467 | { |
f035f6ce | 468 | // Writes found TrackSegments to TreeR. Creates branches |
469 | // "PHOSTS" and "AliPHOSTrackSegmentMaker" with the same title. | |
470 | // In the former branch found TrackSegments are stored, while | |
471 | // in the latter all parameters, with which TS were made. | |
472 | // ROOT does not allow overwriting existing branches, therefore | |
a4e98857 | 473 | // first we check, if branches with the same title already exist. |
f035f6ce | 474 | // If yes - exits without writing. |
2731cd1e | 475 | |
7b7c1533 | 476 | AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ; |
55ea5766 | 477 | |
fc12304f | 478 | TClonesArray * trackSegments = gime->TrackSegments(BranchName()) ; |
55ea5766 | 479 | trackSegments->Expand(trackSegments->GetEntriesFast()) ; |
8d0f3f77 | 480 | TTree * treeR = gAlice->TreeR(); |
9f616d61 | 481 | |
8d0f3f77 | 482 | if (!treeR) |
483 | gAlice->MakeTree("R", fSplitFile); | |
484 | treeR = gAlice->TreeR(); | |
d15a28e7 | 485 | |
2731cd1e | 486 | //First TS |
487 | Int_t bufferSize = 32000 ; | |
8d0f3f77 | 488 | TBranch * tsBranch = treeR->Branch("PHOSTS",&trackSegments,bufferSize); |
fc12304f | 489 | tsBranch->SetTitle(BranchName()); |
8d0f3f77 | 490 | |
2731cd1e | 491 | //Second -TSMaker |
492 | Int_t splitlevel = 0 ; | |
493 | AliPHOSTrackSegmentMakerv1 * ts = this ; | |
8d0f3f77 | 494 | TBranch * tsMakerBranch = treeR->Branch("AliPHOSTrackSegmentMaker","AliPHOSTrackSegmentMakerv1", |
2731cd1e | 495 | &ts,bufferSize,splitlevel); |
fc12304f | 496 | tsMakerBranch->SetTitle(BranchName()); |
8d0f3f77 | 497 | |
761e34c0 | 498 | tsBranch->Fill() ; |
499 | tsMakerBranch->Fill() ; | |
eec3ac52 | 500 | |
8d0f3f77 | 501 | treeR->AutoSave() ; //Write(0,kOverwrite) ; |
2731cd1e | 502 | |
503 | } | |
98cbd830 | 504 | |
98cbd830 | 505 | |
2731cd1e | 506 | //____________________________________________________________________________ |
a4e98857 | 507 | void AliPHOSTrackSegmentMakerv1::PrintTrackSegments(Option_t * option) |
508 | { | |
f035f6ce | 509 | // option deb - prints # of found TrackSegments |
510 | // option deb all - prints as well indexed of found RecParticles assigned to the TS | |
55ea5766 | 511 | TString taskName(GetName()) ; |
512 | taskName.Remove(taskName.Index(Version())-1) ; | |
513 | ||
514 | TClonesArray * trackSegments = AliPHOSGetter::GetInstance()->TrackSegments(taskName) ; | |
9688c1dd | 515 | |
2731cd1e | 516 | |
01a599c9 | 517 | cout << "AliPHOSTrackSegmentMakerv1: event "<<gAlice->GetEvNumber() << endl ; |
7b7c1533 | 518 | cout << " Found " << trackSegments->GetEntriesFast() << " trackSegments " << endl ; |
2731cd1e | 519 | |
520 | if(strstr(option,"all")) { // printing found TS | |
9688c1dd | 521 | cout << "TrackSegment # " << " EMC RP# " << " CPV RP# " << endl ; |
2731cd1e | 522 | |
523 | Int_t index; | |
7b7c1533 | 524 | for (index = 0 ; index <trackSegments->GetEntriesFast() ; index++) { |
525 | AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )trackSegments->At(index) ; | |
2731cd1e | 526 | cout<<" "<< setw(4) << ts->GetIndexInList() << " " |
527 | <<setw(4) << ts->GetEmcIndex()<< " " | |
9688c1dd | 528 | <<setw(4) << ts->GetCpvIndex()<< " " << endl ; |
2731cd1e | 529 | } |
530 | ||
531 | cout << "-------------------------------------------------------"<< endl ; | |
d15a28e7 | 532 | } |
2731cd1e | 533 | } |