LCOV - code coverage report
Current view: top level - PHOS/PHOSbase - AliPHOSTrackSegmentMakerv1.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 136 239 56.9 %
Date: 2016-06-14 17:26:59 Functions: 13 19 68.4 %

          Line data    Source code
       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             :  **************************************************************************/
      15             : /* $Id$ */
      16             : 
      17             : /* History of cvs commits:
      18             :  *
      19             :  * $Log$
      20             :  * Revision 1.93  2007/10/10 09:05:10  schutz
      21             :  * Changing name QualAss to QA
      22             :  *
      23             :  * Revision 1.92  2007/08/28 12:55:08  policheh
      24             :  * Loaders removed from the reconstruction code (C.Cheshkov)
      25             :  *
      26             :  * Revision 1.91  2007/08/07 14:12:03  kharlov
      27             :  * Quality assurance added (Yves Schutz)
      28             :  *
      29             :  * Revision 1.90  2007/07/11 13:43:30  hristov
      30             :  * New class AliESDEvent, backward compatibility with the old AliESD (Christian)
      31             :  *
      32             :  * Revision 1.89  2007/07/03 08:13:04  kharlov
      33             :  * Bug fix in CPV local coordinates
      34             :  *
      35             :  * Revision 1.88  2007/06/27 09:11:07  kharlov
      36             :  * Bug fix for CPV-EMC distance
      37             :  *
      38             :  * Revision 1.87  2007/05/04 14:49:29  policheh
      39             :  * AliPHOSRecPoint inheritance from AliCluster
      40             :  *
      41             :  * Revision 1.86  2007/04/02 15:00:16  cvetan
      42             :  * No more calls to gAlice in the reconstruction
      43             :  *
      44             :  * Revision 1.85  2007/03/28 19:18:15  kharlov
      45             :  * RecPoints recalculation in TSM removed
      46             :  *
      47             :  * Revision 1.84  2007/03/07 07:01:21  hristov
      48             :  * Fixing copy/paste erro. Additional protections
      49             :  *
      50             :  * Revision 1.83  2007/03/06 21:07:37  kharlov
      51             :  * DP: xz CPV-EMC distance filled to TS
      52             :  *
      53             :  * Revision 1.82  2007/03/06 06:54:48  kharlov
      54             :  * DP:Calculation of cluster properties dep. on vertex added
      55             :  *
      56             :  * Revision 1.81  2007/02/05 10:02:40  kharlov
      57             :  * Module numbering is corrected
      58             :  *
      59             :  * Revision 1.80  2006/08/28 10:01:56  kharlov
      60             :  * Effective C++ warnings fixed (Timur Pocheptsov)
      61             :  *
      62             :  * Revision 1.79  2006/04/25 12:41:15  hristov
      63             :  * Moving non-persistent data to AliESDfriend (Yu.Belikov)
      64             :  *
      65             :  * Revision 1.78  2005/11/18 13:04:51  hristov
      66             :  * Bug fix
      67             :  *
      68             :  * Revision 1.77  2005/11/17 23:34:36  hristov
      69             :  * Corrected logics
      70             :  *
      71             :  * Revision 1.76  2005/11/17 22:29:12  hristov
      72             :  * Faster version, no attempt to match tracks outside the PHOS acceptance
      73             :  *
      74             :  * Revision 1.75  2005/11/17 12:35:27  hristov
      75             :  * Use references instead of objects. Avoid to create objects when they are not really needed
      76             :  *
      77             :  * Revision 1.74  2005/07/08 14:01:36  hristov
      78             :  * Tracking in non-uniform nmagnetic field (Yu.Belikov)
      79             :  *
      80             :  * Revision 1.73  2005/05/28 14:19:05  schutz
      81             :  * Compilation warnings fixed by T.P.
      82             :  *
      83             :  */
      84             : 
      85             : //_________________________________________________________________________
      86             : // Implementation version 1 of algorithm class to construct PHOS track segments
      87             : // Track segment for PHOS is list of 
      88             : //        EMC RecPoint + (possibly) CPV RecPoint
      89             : // To find TrackSegments we do the following: 
      90             : //  for each EMC RecPoints we look at
      91             : //   CPV RecPoints in the radious fRcpv. 
      92             : //  If there is such a CPV RecPoint, 
      93             : //   we make "Link" it is just indexes of EMC and CPV RecPoint and distance
      94             : //   between them in the PHOS plane. 
      95             : //  Then we sort "Links" and starting from the 
      96             : //   least "Link" pointing to the unassined EMC and CPV RecPoints assing them to 
      97             : //   new TrackSegment. 
      98             : // If there is no CPV RecPoint we make TrackSegment 
      99             : // consisting from EMC alone. There is no TrackSegments without EMC RecPoint.
     100             : //// In principle this class should be called from AliPHOSReconstructor, but 
     101             : // one can use it as well in standalone mode.
     102             : // Use  case:
     103             : //  root [0] AliPHOSTrackSegmentMakerv1 * t = new AliPHOSTrackSegmentMaker("galice.root", "tracksegmentsname", "recpointsname")
     104             : //  Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
     105             : //               // reads gAlice from header file "galice.root", uses recpoints stored in the branch names "recpointsname" (default = "Default")
     106             : //               // and saves recpoints in branch named "tracksegmentsname" (default = "recpointsname")                       
     107             : //  root [1] t->ExecuteTask()
     108             : //  root [3] t->SetTrackSegmentsBranch("max distance 5 cm")
     109             : //  root [4] t->ExecuteTask("deb all time") 
     110             : //                 
     111             : //*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH) & Yves Schutz (SUBATECH) 
     112             : //
     113             : 
     114             : // --- ROOT system ---
     115             : #include "TVector3.h"
     116             : #include "TTree.h"
     117             : #include "TBenchmark.h"
     118             : 
     119             : // --- Standard library ---
     120             : #include "Riostream.h"
     121             : // --- AliRoot header files ---
     122             : #include "AliPHOSGeometry.h"
     123             : #include "AliPHOSTrackSegmentMakerv1.h"
     124             : #include "AliPHOSTrackSegment.h"
     125             : #include "AliPHOSLink.h"
     126             : #include "AliESDEvent.h"
     127             : #include "AliESDtrack.h"
     128             : #include "AliPHOSEmcRecPoint.h"
     129             : #include "AliPHOSCpvRecPoint.h"
     130             : #include "AliLog.h"
     131             : #include "AliMagF.h"
     132             : #include "AliMagF.h"
     133             : #include "AliTracker.h"
     134             : #include "AliGeomManager.h"
     135             : #include "AliCluster.h"
     136             : #include "AliKalmanTrack.h"
     137             : #include "AliGlobalQADataMaker.h"
     138             : #include "AliVParticle.h"
     139             : 
     140             : 
     141          22 : ClassImp( AliPHOSTrackSegmentMakerv1) 
     142             : 
     143             : 
     144             : //____________________________________________________________________________
     145             : AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() :
     146           0 :   AliPHOSTrackSegmentMaker(),
     147           0 :   fDefaultInit(kTRUE),
     148           0 :   fWrite(kFALSE),
     149           0 :   fNTrackSegments(0),
     150           0 :   fNCpvTrackSegments(0),
     151           0 :   fRcpv(0.f),
     152           0 :   fRtpc(0.f),
     153           0 :   fVtx(0.f,0.f,0.f), 
     154           0 :   fLinkUpArray(0),
     155           0 :   fEmcFirst(0),
     156           0 :   fEmcLast(0),
     157           0 :   fCpvFirst(0),
     158           0 :   fCpvLast(0),
     159           0 :   fModule(0),
     160           0 :   fTrackSegments(NULL)
     161           0 : {
     162             :   // default ctor (to be used mainly by Streamer)
     163           0 :   InitParameters() ; 
     164           0 : }
     165             : 
     166             : //____________________________________________________________________________
     167             : AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(AliPHOSGeometry *geom) :
     168           2 :   AliPHOSTrackSegmentMaker(geom),
     169           2 :   fDefaultInit(kFALSE),
     170           2 :   fWrite(kFALSE),
     171           2 :   fNTrackSegments(0),
     172           2 :   fNCpvTrackSegments(0),
     173           2 :   fRcpv(0.f),
     174           2 :   fRtpc(0.f),
     175           2 :   fVtx(0.f,0.f,0.f), 
     176           2 :   fLinkUpArray(0),
     177           2 :   fEmcFirst(0),
     178           2 :   fEmcLast(0),
     179           2 :   fCpvFirst(0),
     180           2 :   fCpvLast(0),
     181           2 :   fModule(0),
     182           2 :   fTrackSegments(NULL)
     183          10 : {
     184             :   // ctor
     185           2 :   InitParameters() ; 
     186           2 :   Init() ;
     187           2 :   fESD = 0;
     188           4 : }
     189             : 
     190             : 
     191             : AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegmentMakerv1 & tsm) :
     192           0 :   AliPHOSTrackSegmentMaker(tsm),
     193           0 :   fDefaultInit(kFALSE),
     194           0 :   fWrite(kFALSE),
     195           0 :   fNTrackSegments(0),
     196           0 :   fNCpvTrackSegments(0),
     197           0 :   fRcpv(0.f),
     198           0 :   fRtpc(0.f),
     199           0 :   fVtx(0.f,0.f,0.f), 
     200           0 :   fLinkUpArray(0),
     201           0 :   fEmcFirst(0),
     202           0 :   fEmcLast(0),
     203           0 :   fCpvFirst(0),
     204           0 :   fCpvLast(0),
     205           0 :   fModule(0),
     206           0 :   fTrackSegments(NULL)
     207           0 : {
     208             :   // cpy ctor: no implementation yet
     209             :   // requested by the Coding Convention
     210           0 :   Fatal("cpy ctor", "not implemented") ;
     211           0 : }
     212             : 
     213             : 
     214             : //____________________________________________________________________________
     215             :  AliPHOSTrackSegmentMakerv1::~AliPHOSTrackSegmentMakerv1()
     216          12 : { 
     217             :   // dtor
     218             :   // fDefaultInit = kTRUE if TrackSegmentMaker created by default ctor (to get just the parameters)
     219           2 :   if (!fDefaultInit)  
     220           4 :     delete fLinkUpArray ;
     221           2 :   if (fTrackSegments) {
     222           2 :     fTrackSegments->Delete();
     223           4 :     delete fTrackSegments;
     224             :   }
     225           6 : }
     226             : 
     227             : //____________________________________________________________________________
     228             : void  AliPHOSTrackSegmentMakerv1::FillOneModule()
     229             : {
     230             :   // Finds first and last indexes between which 
     231             :   // clusters from one PHOS module are
     232             : 
     233             :   //First EMC clusters
     234          80 :   Int_t totalEmc = fEMCRecPoints->GetEntriesFast() ;
     235         126 :   for(fEmcFirst = fEmcLast; (fEmcLast < totalEmc) &&  
     236          26 :         ((static_cast<AliPHOSRecPoint *>(fEMCRecPoints->At(fEmcLast)))->GetPHOSMod() == fModule ); 
     237          10 :       fEmcLast ++)  ;
     238             :   
     239             :   //Now CPV clusters
     240          40 :   Int_t totalCpv = fCPVRecPoints->GetEntriesFast() ;
     241             : 
     242          80 :     for(fCpvFirst = fCpvLast; (fCpvLast < totalCpv) && 
     243           0 :          ((static_cast<AliPHOSRecPoint *>(fCPVRecPoints->At(fCpvLast)))->GetPHOSMod() == fModule ); 
     244           0 :        fCpvLast ++) ;
     245             :       
     246          40 : }
     247             : 
     248             : //____________________________________________________________________________
     249             : void  AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcClu,
     250             :                                                          AliPHOSCpvRecPoint * cpvClu, 
     251             :                                                          Int_t &trackindex, 
     252             :                                                          Float_t &dx, Float_t &dz) const
     253             : {
     254             :   // Calculates the distance between the EMC RecPoint and the CPV RecPoint
     255             :   // If no CPV, calculates the distance between the EMC RecPoint and the track
     256             :   // prolongation to the PHOS module plane.
     257             :   // Clusters are sorted in "rows" and "columns" of width 1 cm
     258             : 
     259             : //  Float_t delta = 1 ;  // Width of the rows in sorting of RecPoints (in cm)
     260             : //                       // if you change this value, change it as well in xxxRecPoint::Compare()
     261             : 
     262          20 :   trackindex = -1;
     263          10 :   dx         = 999.;
     264          10 :   dz         = 999.;
     265             : 
     266          10 :   if(!cpvClu) {
     267             :     
     268          10 :     if(!emcClu) {
     269             :       return;
     270             :     }
     271             : 
     272             :     // *** Start the matching
     273          10 :     Int_t nt=fESD->GetNumberOfTracks();
     274          10 :     Int_t iPHOSMod = emcClu->GetPHOSMod()  ;
     275             :     //Calculate actual distance to PHOS module
     276          10 :     TVector3 globaPos ;
     277          10 :     fGeom->Local2Global(iPHOSMod, 0.,0., globaPos) ;
     278          10 :     const Double_t rPHOS = globaPos.Pt() ; //Distance to center of  PHOS module
     279             :     const Double_t kYmax = 72.+10. ; //Size of the module (with some reserve) in phi direction
     280             :     const Double_t kZmax = 64.+10. ; //Size of the module (with some reserve) in z direction
     281          10 :     const Double_t kAlpha0=330./180.*TMath::Pi() ; //First PHOS module angular direction
     282          10 :     const Double_t kAlpha= 20./180.*TMath::Pi() ; //PHOS module angular size
     283             :     Double_t minDistance = 1.e6;
     284             : 
     285          10 :     TVector3 vecEmc ;   // Local position of EMC recpoint
     286          10 :     emcClu->GetLocalPosition(vecEmc) ;
     287             : 
     288          10 :     Double_t gposTrack[3] ; 
     289          10 :     Double_t bz = AliTracker::GetBz() ; //B-Field for approximate matching
     290          10 :     Double_t b[3]; 
     291         432 :     for (Int_t i=0; i<nt; i++) {
     292         206 :       AliESDtrack *esdTrack=fESD->GetTrack(i);
     293             : 
     294             :       // Skip the tracks having "wrong" status (has to be checked/tuned)
     295         206 :       ULong_t status = esdTrack->GetStatus();
     296         226 :       if ((status & AliESDtrack::kTPCout)   == 0) continue;
     297             : //     if ((status & AliESDtrack::kTRDout)   == 0) continue;
     298             : //     if ((status & AliESDtrack::kTRDrefit) == 1) continue;
     299             : 
     300             :       //Continue extrapolation from TPC outer surface
     301         186 :       const AliExternalTrackParam *outerParam=esdTrack->GetOuterParam();
     302         186 :       if (!outerParam) continue;
     303             : 
     304             :       //RS: fast check of Z: does not depend on the alpha frame
     305         186 :       Double_t z; 
     306         432 :       if(!outerParam->GetZAt(rPHOS,bz,z)) continue ;
     307         168 :       if (TMath::Abs(z) > kZmax) continue; // Some tracks miss the PHOS in Z
     308             : 
     309          84 :       AliExternalTrackParam t(*outerParam);
     310             : 
     311             :       //Direction to the current PHOS module
     312          84 :       Double_t phiMod=kAlpha0-kAlpha*iPHOSMod ;
     313         228 :       if(!t.RotateParamOnly(phiMod)) continue ; //RS use faster rotation if errors are not needed
     314             :  
     315          24 :       Double_t y;                       // Some tracks do not reach the PHOS
     316          58 :       if (!t.GetYAt(rPHOS,bz,y)) continue; //    because of the bending
     317             : 
     318          14 :       if(TMath::Abs(y) < kYmax){
     319           8 :         t.GetBxByBz(b) ;
     320           8 :         t.PropagateParamOnlyBxByBzTo(rPHOS,b);        // Propagate to the matching module
     321             :       //t.CorrectForMaterial(...); // Correct for the TOF material, if needed
     322           8 :         t.GetXYZ(gposTrack) ;
     323           8 :         TVector3 globalPositionTr(gposTrack) ;
     324           8 :         TVector3 localPositionTr ;
     325           8 :         fGeom->Global2Local(localPositionTr,globalPositionTr,iPHOSMod) ;
     326           8 :         Double_t ddx = vecEmc.X()-localPositionTr.X();
     327           8 :         Double_t ddz = vecEmc.Z()-localPositionTr.Z();
     328           8 :         Double_t d2 = ddx*ddx + ddz*ddz;
     329           8 :         if(d2 < minDistance) {
     330           6 :           dx = ddx ;
     331           6 :           dz = ddz ;
     332           6 :           trackindex=i;
     333             :           minDistance=d2 ;
     334           6 :         }
     335           8 :       }
     336         308 :     } //Scanned all tracks
     337             :     return ;
     338          10 :   }
     339             : 
     340             :   //EMC-CPV
     341           0 :   if(emcClu->GetPHOSMod() != cpvClu->GetPHOSMod()){
     342             :     return ;
     343             :   }
     344             :   
     345           0 :   TVector3 emcGlobal;
     346           0 :   fGeom->GetGlobalPHOS((AliPHOSRecPoint*)emcClu,emcGlobal);
     347           0 :   TVector3 cpvGlobal;
     348           0 :   fGeom->GetGlobalPHOS((AliPHOSRecPoint*)cpvClu,cpvGlobal);
     349             : 
     350             :   //Extrapolate CPV vector to EMC
     351             :   Double_t scale=0.; 
     352           0 :   Double_t rCPV=cpvGlobal.Perp() ;
     353           0 :   if(rCPV>0.)scale=emcGlobal.Perp()/rCPV;
     354           0 :   cpvGlobal*=scale  ;
     355           0 :   TVector3 dist=emcGlobal - cpvGlobal;
     356             :  
     357             :   //phi direction
     358           0 :   dx=TMath::Sign(dist.Perp(), cpvGlobal.X() - emcGlobal.X()); //sign from phi angle
     359           0 :   dz=cpvGlobal.Z() - emcGlobal.Z() ;
     360             :   return ;
     361             :   
     362          10 : }
     363             : //____________________________________________________________________________
     364             : void  AliPHOSTrackSegmentMakerv1::Init()
     365             : {
     366             :   // Make all memory allocations that are not possible in default constructor
     367             :   
     368           6 :   fLinkUpArray  = new TClonesArray("AliPHOSLink", 1000); 
     369           4 :   fTrackSegments = new TClonesArray("AliPHOSTrackSegment",100);
     370           2 :   fTrackSegments->SetName("TRACKS");
     371           2 : }
     372             : 
     373             : //____________________________________________________________________________
     374             : void  AliPHOSTrackSegmentMakerv1::InitParameters()
     375             : {
     376             :   //Initializes parameters
     377           4 :   fRcpv      = 10. ;
     378           2 :   fRtpc      = 4. ;
     379           2 :   fEmcFirst  = 0 ;    
     380           2 :   fEmcLast   = 0 ;   
     381           2 :   fCpvFirst  = 0 ;   
     382           2 :   fCpvLast   = 0 ;   
     383           2 :   fLinkUpArray = 0 ;
     384           2 :   fWrite                   = kTRUE ;
     385           2 : }
     386             : 
     387             : 
     388             : //____________________________________________________________________________
     389             : void  AliPHOSTrackSegmentMakerv1::MakeLinks()const
     390             : { 
     391             :   // Finds distances (links) between all EMC and CPV clusters, 
     392             :   // which are not further apart from each other than fRcpv 
     393             :   // and sort them in accordance with this distance
     394             :   
     395          80 :   fLinkUpArray->Clear() ;    
     396             : 
     397             :   AliPHOSCpvRecPoint * cpv ;
     398             :   AliPHOSEmcRecPoint * emcclu ;
     399             : 
     400             :   Int_t iLinkUp  = 0 ;
     401             :   
     402             :   Int_t iEmcRP;
     403         100 :   for(iEmcRP = fEmcFirst; iEmcRP < fEmcLast; iEmcRP++ ) {
     404             :     //    emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP)) ;
     405          10 :     emcclu = static_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP)) ; //RS dynamyc_cast is very slow
     406             : 
     407             :     //Bool_t toofar ;        
     408             :     Int_t iCpv = 0 ;    
     409          20 :     for(iCpv = fCpvFirst; iCpv < fCpvLast;iCpv++ ) { 
     410             :       
     411             :       //      cpv = dynamic_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(iCpv)) ;
     412           0 :       cpv = static_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(iCpv)) ; //RS dynamyc_cast is very slow
     413           0 :       Int_t track = -1 ; 
     414           0 :       Float_t dx,dz ;
     415           0 :       GetDistanceInPHOSPlane(emcclu, cpv, track,dx,dz) ;     
     416             :       //if(TMath::Sqrt(dx*dx+dz*dz) < fRcpv ){ // RS sqrt is slow
     417           0 :       if(dx*dx+dz*dz < fRcpv*fRcpv ){ 
     418           0 :         new ((*fLinkUpArray)[iLinkUp++])  AliPHOSLink(dx, dz, iEmcRP, iCpv, track) ;
     419             :       }      
     420           0 :     }
     421             :   } 
     422             :   
     423          40 :   fLinkUpArray->Sort() ;  //first links with smallest distances
     424          40 : }
     425             : 
     426             : //____________________________________________________________________________
     427             : void  AliPHOSTrackSegmentMakerv1::MakePairs()
     428             : { 
     429             :   // Using the previously made list of "links", we found the smallest link - i.e. 
     430             :   // link with the least distance between EMC and CPV and pointing to still 
     431             :   // unassigned RecParticles. We assign these RecPoints to TrackSegment and 
     432             :   // remove them from the list of "unassigned". 
     433             : 
     434             :   //Make pairs EMC cluster + tracks
     435         140 :   for(Int_t iEmcRP = fEmcFirst; iEmcRP < fEmcLast  ; iEmcRP++ ){
     436          10 :      Int_t track = -1 ;
     437          10 :      Float_t dx=999.,dz=999. ;
     438             :      //     AliPHOSEmcRecPoint *emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP));
     439          10 :      AliPHOSEmcRecPoint *emcclu = static_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP)); //RS dynamyc_cast is very slow 
     440             :      //Scan all tracks
     441          10 :      GetDistanceInPHOSPlane(emcclu, 0, track,dx,dz);
     442          20 :      if(track<0)
     443          16 :         new ((*fTrackSegments)[fNTrackSegments]) AliPHOSTrackSegment(emcclu,0x0) ;
     444             :      else
     445           4 :         new ((*fTrackSegments)[fNTrackSegments]) AliPHOSTrackSegment(emcclu,0x0,track,dx,dz);
     446          10 :      (static_cast<AliPHOSTrackSegment *>(fTrackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
     447          10 :      fNTrackSegments++;    
     448          10 :   }
     449             :   
     450             : 
     451             :   //Now create TSs for CPV clusters 
     452          40 :   Int_t nEMCrp = fEMCRecPoints->GetEntriesFast();
     453          40 :   TIter nextUp(fLinkUpArray) ;
     454             :   AliPHOSLink * linkUp ;
     455          80 :   for(Int_t iCPV=fCpvFirst; iCPV<fCpvLast; iCPV++){
     456             :    
     457             :     // Finds the smallest links and makes pairs of CPV and EMC clusters with smallest distance 
     458             :     //But after ALL emc TSs (even from other modules)
     459             :     Bool_t found=kFALSE ;
     460           0 :     nextUp.Reset() ;
     461           0 :     while ( (linkUp =  static_cast<AliPHOSLink *>(nextUp()) ) ){  
     462           0 :       if(linkUp->GetCpv() == iCPV){ 
     463           0 :         Float_t dx=999.,dz=999. ;
     464           0 :         linkUp->GetXZ(dx,dz) ;
     465           0 :         new ((* fTrackSegments)[nEMCrp+fNCpvTrackSegments]) 
     466           0 :            AliPHOSTrackSegment(static_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(linkUp->GetEmc())) , 
     467           0 :                                static_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(iCPV)) , 
     468           0 :                                linkUp->GetTrack(),dx,dz) ; 
     469           0 :        (static_cast<AliPHOSTrackSegment *>(fTrackSegments->At(nEMCrp+fNCpvTrackSegments)))->SetIndexInList(nEMCrp+fNCpvTrackSegments);
     470           0 :        fNCpvTrackSegments++ ;
     471             :        found=kTRUE ;
     472             :        break ;
     473           0 :       }
     474             :     }
     475           0 :     if(!found){ //CPV TS without EMC
     476           0 :        new ((* fTrackSegments)[nEMCrp+fNCpvTrackSegments]) 
     477           0 :            AliPHOSTrackSegment(0x0 , 
     478           0 :                                static_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(iCPV)) , 
     479             :                                -1,999.,999.) ; 
     480           0 :       (static_cast<AliPHOSTrackSegment *>(fTrackSegments->At(nEMCrp+fNCpvTrackSegments)))->SetIndexInList(nEMCrp+fNCpvTrackSegments);
     481           0 :       fNCpvTrackSegments++ ;
     482             :      
     483             :      
     484           0 :     }
     485             :   }
     486          40 : }
     487             : 
     488             : //____________________________________________________________________________
     489             : void AliPHOSTrackSegmentMakerv1::Clusters2TrackSegments(Option_t *option)
     490             : {
     491             :   // Steering method to perform track segment construction for the current event
     492             :   // Returns an array with the found track-segments.
     493             :   
     494          16 :   if(strstr(option,"tim"))
     495           0 :     gBenchmark->Start("PHOSTSMaker");
     496             :  
     497           8 :   if(strstr(option,"print")) {
     498           0 :     Print() ; 
     499           0 :     return ; 
     500             :   }
     501             :   
     502             :   //Make some initializations 
     503           8 :   fNTrackSegments = 0 ;
     504           8 :   fNCpvTrackSegments = 0 ;
     505           8 :   fEmcFirst = 0 ;    
     506           8 :   fEmcLast  = 0 ;   
     507           8 :   fCpvFirst = 0 ;   
     508           8 :   fCpvLast  = 0 ;   
     509             : 
     510           8 :   fTrackSegments->Clear();
     511           8 :   if(fTrackSegments->GetSize()<fEMCRecPoints->GetEntriesFast()+fCPVRecPoints->GetEntriesFast())
     512           0 :     fTrackSegments->Expand(fEMCRecPoints->GetEntriesFast()+fCPVRecPoints->GetEntriesFast()) ;
     513             : 
     514             :   //   if(!ReadRecPoints(ievent))   continue; //reads RecPoints for event ievent
     515             : 
     516          96 :   for(fModule = 1; fModule <= fGeom->GetNModules() ; fModule++ ) {
     517          40 :     FillOneModule() ; 
     518          40 :     MakeLinks() ;
     519          40 :     MakePairs() ;
     520             :   }
     521             :     
     522           8 :   if(strstr(option,"deb"))
     523           0 :     PrintTrackSegments(option);
     524             : 
     525           8 :   if(strstr(option,"tim")){
     526           0 :     gBenchmark->Stop("PHOSTSMaker");
     527           0 :     Info("Exec", "took %f seconds for making TS", 
     528           0 :          gBenchmark->GetCpuTime("PHOSTSMaker")); 
     529           0 :   }
     530           8 : }
     531             : 
     532             : //____________________________________________________________________________
     533             : void AliPHOSTrackSegmentMakerv1::Print(const Option_t *)const
     534             : {
     535             :   //  Print TrackSegmentMaker parameters
     536             : 
     537           0 :   TString message("") ;
     538           0 :   if( strcmp(GetName(), "") != 0 ) {
     539           0 :     message = "\n======== AliPHOSTrackSegmentMakerv1 ========\n" ; 
     540           0 :     message += "Making Track segments\n" ;
     541           0 :     message += "with parameters:\n" ; 
     542           0 :     message += "     Maximal EMC - CPV distance (cm) %f\n" ;
     543           0 :     message += "============================================\n" ;
     544           0 :     Info("Print", message.Data(),fRcpv) ;
     545             :   }
     546             :   else
     547           0 :     Info("Print", "AliPHOSTrackSegmentMakerv1 not initialized ") ;
     548           0 : }
     549             : 
     550             : //____________________________________________________________________________
     551             : void AliPHOSTrackSegmentMakerv1::PrintTrackSegments(Option_t * option)
     552             : {
     553             :   // option deb - prints # of found TrackSegments
     554             :   // option deb all - prints as well indexed of found RecParticles assigned to the TS
     555             : 
     556           0 :   Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ; 
     557           0 :   printf("        Found %d TrackSegments\n", fTrackSegments->GetEntriesFast() ); 
     558             :   
     559           0 :   if(strstr(option,"all")) {  // printing found TS
     560           0 :     printf("TrackSegment #  EMC RP#  CPV RP#\n") ; 
     561             :     Int_t index;
     562           0 :     for (index = 0 ; index <fTrackSegments->GetEntriesFast() ; index++) {
     563           0 :       AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )fTrackSegments->At(index) ; 
     564           0 :       printf("   %d           %d        %d \n", ts->GetIndexInList(), ts->GetEmcIndex(), ts->GetCpvIndex() ) ; 
     565             :     }   
     566           0 :   }
     567           0 : }
     568             : 

Generated by: LCOV version 1.11