]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/ESD/AliESDfriend.cxx
Updates in event mixing code for low-pt code
[u/mrichter/AliRoot.git] / STEER / ESD / AliESDfriend.cxx
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
27 ClassImp(AliESDfriend)
28
29 AliESDfriend::AliESDfriend(): AliVfriendEvent(), fTracks("AliESDfriendTrack",1),
30   fESDVZEROfriend(NULL),
31   fESDTZEROfriend(NULL),
32   fNclustersTPC(),
33   fNclustersTPCused()
34 {
35  //
36  // Default constructor
37  //
38   for (Int_t i=0;i<72;i++)
39   {
40     fNclustersTPC[i]=0;
41     fNclustersTPCused[i]=0;
42   }
43 }
44
45 AliESDfriend::AliESDfriend(const AliESDfriend &f) :
46   AliVfriendEvent(f),
47   fTracks(f.fTracks),
48   fESDVZEROfriend(f.fESDVZEROfriend ? new AliESDVZEROfriend(*f.fESDVZEROfriend) : NULL),
49   fESDTZEROfriend(f.fESDTZEROfriend ? new AliESDTZEROfriend(*f.fESDTZEROfriend) : NULL),
50   fNclustersTPC(),
51   fNclustersTPCused()
52 {
53  //
54  // Copy constructor
55  //
56  memcpy(fNclustersTPC,f.fNclustersTPC,sizeof(fNclustersTPC));
57  memcpy(fNclustersTPCused,f.fNclustersTPCused,sizeof(fNclustersTPCused));
58
59 }
60
61 AliESDfriend& AliESDfriend::operator=(const AliESDfriend& esd)
62 {
63     
64     // Assignment operator
65     if(&esd == this) return *this;
66     TObject::operator=(esd);
67     fTracks = esd.fTracks;
68
69     delete fESDVZEROfriend;
70     fESDVZEROfriend = new AliESDVZEROfriend(*esd.fESDVZEROfriend);
71
72     delete fESDTZEROfriend;
73     fESDTZEROfriend = new AliESDTZEROfriend(*esd.fESDTZEROfriend);
74  
75     memcpy(fNclustersTPC,esd.fNclustersTPC,sizeof(fNclustersTPC));
76     memcpy(fNclustersTPCused,esd.fNclustersTPCused,sizeof(fNclustersTPCused));
77  
78  
79     return *this;
80 }
81
82
83
84 AliESDfriend::~AliESDfriend() {
85   //
86   // Destructor
87   //
88   fTracks.Delete();
89   delete fESDVZEROfriend;
90   delete fESDTZEROfriend;
91 }
92
93
94 void AliESDfriend::Reset()
95 {
96   //
97   // Reset friend information
98   //
99   fTracks.Delete();
100   for (Int_t i=0;i<72;i++)
101   {
102     fNclustersTPC[i]=0;
103     fNclustersTPCused[i]=0;
104   }
105   delete fESDVZEROfriend; fESDVZEROfriend=0;
106   delete fESDTZEROfriend; fESDTZEROfriend=0;
107 }  
108
109
110 void AliESDfriend::SetVZEROfriend(AliESDVZEROfriend * obj)
111 {
112   //
113   // Set the VZERO friend data object
114   // (complete raw data)
115   if (!fESDVZEROfriend) fESDVZEROfriend = new AliESDVZEROfriend();
116   if (obj) *fESDVZEROfriend = *obj;
117 }
118 void AliESDfriend::SetTZEROfriend(AliESDTZEROfriend * obj)
119 {
120   //
121   // Set the TZERO friend data object
122   // (complete raw data)
123   if (!fESDTZEROfriend) fESDTZEROfriend = new AliESDTZEROfriend();
124   if (obj) *fESDTZEROfriend = *obj;
125 }