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