]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESD.cxx
Record changes.
[u/mrichter/AliRoot.git] / STEER / AliESD.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 /* $Id$ */
17
18 //-----------------------------------------------------------------
19 //           Implementation of the ESD class
20 //   This is the class to deal with during the phisical analysis of data
21 //   This class is generated directly by the reconstruction methods
22 //      Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
23 //-----------------------------------------------------------------
24
25 #include "AliESD.h"
26 #include "AliESDfriend.h"
27
28 ClassImp(AliESD)
29
30 //______________________________________________________________________________
31 AliESD::AliESD():
32   fEventNumber(0),
33   fRunNumber(0),
34   fTriggerMask(0),
35   fTriggerCluster(0),
36   fRecoVersion(0),
37   fMagneticField(0),
38   fZDCN1Energy(0),
39   fZDCP1Energy(0),
40   fZDCN2Energy(0),
41   fZDCP2Energy(0),
42   fZDCEMEnergy(0),
43   fZDCParticipants(0),
44   fT0zVertex(0),
45   fSPDVertex(),
46   fPrimaryVertex(),
47   fT0timeStart(0),
48   fTracks("AliESDtrack",15000),
49   fHLTConfMapTracks("AliESDHLTtrack",25000),
50   fHLTHoughTracks("AliESDHLTtrack",15000),
51   fMuonTracks("AliESDMuonTrack",30),
52   fPmdTracks("AliESDPmdTrack",3000),
53   fTrdTracks("AliESDTrdTrack",300),
54   fV0s("AliESDv0",200),  
55   fCascades("AliESDcascade",20),
56   fKinks("AliESDkink",4000),
57   fV0MIs("AliESDV0MI",4000),
58   fCaloClusters("AliESDCaloCluster",10000),
59   fEMCALClusters(0), 
60   fFirstEMCALCluster(-1),
61   fPHOSClusters(0), 
62   fFirstPHOSCluster(-1),
63   fESDFMD(0x0)
64 {
65   for (Int_t i=0; i<24; i++) {
66     fT0time[i] = 0;
67     fT0amplitude[i] = 0;
68   }
69 }
70
71 //______________________________________________________________________________
72 AliESD::~AliESD()
73 {
74   //
75   // Standard destructor
76   //
77   fTracks.Delete();
78   fHLTConfMapTracks.Delete();
79   fHLTHoughTracks.Delete();
80   fMuonTracks.Delete();
81   fPmdTracks.Delete();
82   fTrdTracks.Delete();
83   fV0s.Delete();
84   fCascades.Delete();
85   fKinks.Delete();
86   fV0MIs.Delete();
87   fCaloClusters.Delete();
88   delete fESDFMD;
89 }
90
91 void AliESD::UpdateV0PIDs()
92 {
93   //
94   //
95   //
96   Int_t nV0 = GetNumberOfV0MIs();
97   for (Int_t i=0;i<nV0;i++){
98     AliESDV0MI * v0 = GetV0MI(i);
99     AliESDtrack* tp = GetTrack(v0->GetIndex(0));
100     AliESDtrack* tm = GetTrack(v0->GetIndex(1));
101     if (!tm || !tp){
102       printf("BBBUUUUUUUGGGG\n");
103     }
104     Double_t pp[5],pm[5];
105     tp->GetESDpid(pp);
106     tm->GetESDpid(pm);
107     v0->UpdatePID(pp,pm);    
108   }
109 }
110
111 //______________________________________________________________________________
112 void AliESD::Reset()
113 {
114   fEventNumber=0;
115   fRunNumber=0;
116   fTriggerMask=0;
117   fTriggerCluster=0;
118   fRecoVersion=0;
119   fMagneticField=0;
120   fZDCN1Energy=0;
121   fZDCP1Energy=0;
122   fZDCN2Energy=0;
123   fZDCP2Energy=0;
124   fZDCEMEnergy=0;
125   fZDCParticipants=0;
126   fT0zVertex=0;
127   fT0timeStart = 0;
128   new (&fSPDVertex) AliESDVertex();
129   new (&fPrimaryVertex) AliESDVertex();
130   fTracks.Clear();
131   fHLTConfMapTracks.Clear();
132   fHLTHoughTracks.Clear();
133   fMuonTracks.Clear();
134   fPmdTracks.Clear();
135   fTrdTracks.Clear();
136   fV0s.Clear();
137   fCascades.Clear();
138   fCaloClusters.Clear();
139   fEMCALClusters=0; 
140   fFirstEMCALCluster=-1; 
141   fPHOSClusters=0; 
142   fFirstPHOSCluster=-1; 
143   if (fESDFMD) fESDFMD->Clear();
144 }
145
146 //______________________________________________________________________________
147 void AliESD::Print(Option_t *) const 
148 {
149   //
150   // Print header information of the event
151   //
152   printf("ESD run information\n");
153   printf("Event # %d Run # %d Trigger %lld Magnetic field %f \n",
154          GetEventNumber(),
155          GetRunNumber(),
156          GetTriggerMask(),
157          GetMagneticField() );
158     printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n",
159            fPrimaryVertex.GetXv(), fPrimaryVertex.GetXRes(),
160            fPrimaryVertex.GetYv(), fPrimaryVertex.GetYRes(),
161            fPrimaryVertex.GetZv(), fPrimaryVertex.GetZRes());
162   printf("Event from reconstruction version %d \n",fRecoVersion);
163   printf("Number of tracks: \n");
164   printf("                 charged   %d\n", GetNumberOfTracks());
165   printf("                 hlt CF    %d\n", GetNumberOfHLTConfMapTracks());
166   printf("                 hlt HT    %d\n", GetNumberOfHLTHoughTracks());
167   printf("                 muon      %d\n", GetNumberOfMuonTracks());
168   printf("                 pmd       %d\n", GetNumberOfPmdTracks());
169   printf("                 trd       %d\n", GetNumberOfTrdTracks());
170   printf("                 v0        %d\n", GetNumberOfV0s());
171   printf("                 cascades  %d\n", GetNumberOfCascades());
172   printf("                 kinks     %d\n", GetNumberOfKinks());
173   printf("                 V0MIs     %d\n", GetNumberOfV0MIs());
174   printf("                 CaloClusters %d\n", GetNumberOfCaloClusters());
175   printf("                 phos      %d\n", GetNumberOfPHOSClusters());
176   printf("                 emcal     %d\n", GetNumberOfEMCALClusters());
177   printf("                 FMD       %s\n", (fESDFMD ? "yes" : "no"));
178 }
179
180 void AliESD::SetESDfriend(const AliESDfriend *ev) {
181   //
182   // Attaches the complementary info to the ESD
183   //
184   if (!ev) return;
185
186   Int_t ntrk=ev->GetNumberOfTracks();
187
188   for (Int_t i=0; i<ntrk; i++) {
189     const AliESDfriendTrack *f=ev->GetTrack(i);
190     GetTrack(i)->SetFriendTrack(f);
191   }
192 }
193
194 void AliESD::GetESDfriend(AliESDfriend *ev) const {
195   //
196   // Extracts the complementary info from the ESD
197   //
198   if (!ev) return;
199
200   Int_t ntrk=GetNumberOfTracks();
201
202   for (Int_t i=0; i<ntrk; i++) {
203     const AliESDtrack *t=GetTrack(i);
204     const AliESDfriendTrack *f=t->GetFriendTrack();
205     ev->AddTrack(f);
206   }
207 }