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