LCOV - code coverage report
Current view: top level - STEER/ESD - AliESDfriend.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 45 90 50.0 %
Date: 2016-06-14 17:26:59 Functions: 10 15 66.7 %

          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             : 
      16             : //-------------------------------------------------------------------------
      17             : //               Implementation of the AliESDfriend class
      18             : //  This class contains some additional to the ESD information like
      19             : //  the clusters associated to tracks.
      20             : //      Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
      21             : //-------------------------------------------------------------------------
      22             : 
      23             : #include "AliESDfriend.h"
      24             : #include "AliESDVZEROfriend.h"
      25             : #include "AliESDTZEROfriend.h"
      26             : #include "AliESDADfriend.h"
      27             : 
      28         172 : ClassImp(AliESDfriend)
      29             : 
      30          32 : AliESDfriend::AliESDfriend(): AliVfriendEvent(), 
      31          32 :   fESDIndicesStored(kFALSE),
      32          32 :   fTracks("AliESDfriendTrack",1),
      33          32 :   fESDVZEROfriend(NULL),
      34          32 :   fESDTZEROfriend(NULL),
      35          32 :   fESDADfriend(NULL)
      36         160 : {
      37             :  //
      38             :  // Default constructor
      39             :  //
      40          32 :   fTracks.SetOwner(kTRUE);
      41          32 :   memset(fNclustersTPC,0,sizeof(fNclustersTPC));
      42          32 :   memset(fNclustersTPCused,0,sizeof(fNclustersTPCused));
      43          64 : }
      44             : 
      45             : AliESDfriend::AliESDfriend(const AliESDfriend &f) :
      46           0 :   AliVfriendEvent(f),
      47           0 :   fESDIndicesStored(f.fESDIndicesStored),
      48           0 :   fTracks(f.fTracks),
      49           0 :   fESDVZEROfriend(f.fESDVZEROfriend ? new AliESDVZEROfriend(*f.fESDVZEROfriend) : NULL),
      50           0 :   fESDTZEROfriend(f.fESDTZEROfriend ? new AliESDTZEROfriend(*f.fESDTZEROfriend) : NULL),
      51           0 :   fESDADfriend(f.fESDADfriend ? new AliESDADfriend(*f.fESDADfriend) : NULL)
      52           0 : {
      53             :  //
      54             :  // Copy constructor
      55             :  //
      56           0 :  memcpy(fNclustersTPC,f.fNclustersTPC,sizeof(fNclustersTPC));
      57           0 :  memcpy(fNclustersTPCused,f.fNclustersTPCused,sizeof(fNclustersTPCused));
      58             : 
      59           0 : }
      60             : 
      61             : AliESDfriend& AliESDfriend::operator=(const AliESDfriend& esd)
      62             : {
      63             :     
      64             :     // Assignment operator
      65           0 :     if(&esd == this) return *this;
      66           0 :     TObject::operator=(esd);
      67           0 :     fESDIndicesStored = esd.fESDIndicesStored;
      68             :     // Clean up the old TClonesArray
      69           0 :     DeleteTracksSafe();
      70             :     //    fTracks.Delete();
      71             :     // Assign the new one
      72           0 :     fTracks = esd.fTracks;
      73             : 
      74           0 :     if(fESDVZEROfriend)
      75           0 :       delete fESDVZEROfriend;
      76           0 :     fESDVZEROfriend=0;
      77           0 :     if(esd.fESDVZEROfriend)
      78           0 :       fESDVZEROfriend = new AliESDVZEROfriend(*esd.fESDVZEROfriend);
      79             :     
      80           0 :     if(fESDTZEROfriend)
      81           0 :       delete fESDTZEROfriend;
      82           0 :     fESDTZEROfriend=0;
      83           0 :     if(esd.fESDTZEROfriend)
      84           0 :       fESDTZEROfriend = new AliESDTZEROfriend(*esd.fESDTZEROfriend);
      85             : 
      86           0 :     if(fESDADfriend)
      87           0 :       delete fESDADfriend;
      88           0 :     fESDADfriend=0;
      89           0 :     if(esd.fESDADfriend)
      90           0 :       fESDADfriend = new AliESDADfriend(*esd.fESDADfriend);
      91             :  
      92           0 :     memcpy(fNclustersTPC,esd.fNclustersTPC,sizeof(fNclustersTPC));
      93           0 :     memcpy(fNclustersTPCused,esd.fNclustersTPCused,sizeof(fNclustersTPCused));
      94             :  
      95             :  
      96           0 :     return *this;
      97           0 : }
      98             : 
      99             : 
     100             : 
     101         132 : AliESDfriend::~AliESDfriend() {
     102             :   //
     103             :   // Destructor
     104             :   //
     105          22 :   DeleteTracksSafe();
     106             :   //fTracks.Delete();
     107          22 :   if(fESDVZEROfriend)
     108           0 :     delete fESDVZEROfriend;
     109          22 :   fESDVZEROfriend=0;
     110          22 :   if(fESDTZEROfriend)
     111           0 :     delete fESDTZEROfriend;
     112          22 :   fESDTZEROfriend=0;
     113          22 :   if(fESDADfriend)
     114           0 :     delete fESDADfriend;
     115          22 :   fESDADfriend=0;
     116          66 : }
     117             : 
     118             : void AliESDfriend::DeleteTracksSafe()
     119             : {
     120             :   // delete tracks taking care of eventual shared objects in the tracks (e.g. TPCclusters)
     121          60 :   int ntr=fTracks.GetEntriesFast();
     122          60 :   for (int i=0;i<ntr;i++) {
     123           0 :     AliESDfriendTrack* trc = (AliESDfriendTrack*)fTracks[i];
     124           0 :     trc->TagSuppressSharedObjectsBeforeDeletion();
     125             :   }
     126          30 :   fTracks.Delete();
     127          30 : }
     128             : 
     129             : void AliESDfriend::ResetSoft()
     130             : {
     131             :   // Reset friend information, used for the shalow copy
     132         166 :   for (int i=fTracks.GetEntriesFast();i--;) fTracks[i]->Clear();
     133           8 :   fTracks.Clear();    
     134        1168 :   for (Int_t i=0;i<72;i++)
     135             :   {
     136         576 :     fNclustersTPC[i]=0;
     137         576 :     fNclustersTPCused[i]=0;
     138             :   }
     139          24 :   delete fESDVZEROfriend; fESDVZEROfriend=0;
     140          16 :   delete fESDTZEROfriend; fESDTZEROfriend=0;
     141          16 :   delete fESDADfriend; fESDADfriend=0;
     142           8 : }
     143             : 
     144             : 
     145             : void AliESDfriend::Reset()
     146             : {
     147             :   //
     148             :   // Reset friend information
     149             :   //
     150          16 :   DeleteTracksSafe();
     151             :   //  fTracks.Delete();
     152        1168 :   for (Int_t i=0;i<72;i++)
     153             :   {
     154         576 :     fNclustersTPC[i]=0;
     155         576 :     fNclustersTPCused[i]=0;
     156             :   }
     157          16 :   delete fESDVZEROfriend; fESDVZEROfriend=0;
     158          16 :   delete fESDTZEROfriend; fESDTZEROfriend=0;
     159          16 :   delete fESDADfriend; fESDADfriend=0;
     160           8 : }  
     161             : 
     162             : void AliESDfriend::SetVZEROfriend(const AliESDVZEROfriend * obj)
     163             : {
     164             :   //
     165             :   // Set the VZERO friend data object
     166             :   // (complete raw data)
     167          40 :   if (!fESDVZEROfriend) fESDVZEROfriend = new AliESDVZEROfriend();
     168          24 :   if (obj) *fESDVZEROfriend = *obj;
     169          12 : }
     170             : void AliESDfriend::SetTZEROfriend(AliESDTZEROfriend * obj)
     171             : {
     172             :   //
     173             :   // Set the TZERO friend data object
     174             :   // (complete raw data)
     175           0 :   if (!fESDTZEROfriend) fESDTZEROfriend = new AliESDTZEROfriend();
     176           0 :   if (obj) *fESDTZEROfriend = *obj;
     177           0 : }
     178             : void AliESDfriend::SetADfriend(AliESDADfriend * obj)
     179             : {
     180             :   //
     181             :   // Set the AD friend data object
     182             :   // (complete raw data)
     183           0 :   if (!fESDADfriend) fESDADfriend = new AliESDADfriend();
     184           0 :   if (obj) *fESDADfriend = *obj;
     185           0 : }

Generated by: LCOV version 1.11