]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/extra/AliXiStarEventCollection.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / extra / AliXiStarEventCollection.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 //
18 //  This class provides storage for event and track information which 
19 //  are used for same-event as well as mixed-event analyses in AliXiStar 
20 //
21 //  authors: Dhevan Gangadharan (dhevan.raja.gangadharan@cern.ch)
22 //
23 ////////////////////////////////////////////////////////////////////////////////
24
25
26 #include "AliXiStarEventCollection.h"
27
28 AliXiStarTrackStruct::AliXiStarTrackStruct():
29   fStatus(0),
30   fFilterMap(0),
31   fID(0),
32   fPhi(0),
33   fPt(0),
34   fMom(0),
35   fP(),
36   fCharge(0),
37   fEta(0),
38   fMass(0),
39   fDCAXY(0),
40   fDCAZ(0),
41   fDCA(0),
42   fX(),
43   fCov(),
44   fNSigmaPi(0),
45   fNSigmaK(0),
46   fNSigmaPr(0),
47   fLabel(0),
48   fNclusTPC(0)
49 {
50   //Default constructor
51 }
52 //_____________________________________________________________________________
53 AliXiStarTrackStruct::AliXiStarTrackStruct(const AliXiStarTrackStruct &obj) 
54   : fStatus(obj.fStatus),
55     fFilterMap(obj.fFilterMap),
56     fID(obj.fID),
57     fPhi(obj.fPhi),
58     fPt(obj.fPt),
59     fMom(obj.fMom),
60     fP(),
61     fCharge(obj.fCharge),
62     fEta(obj.fEta),
63     fMass(obj.fMass),
64     fDCAXY(obj.fDCAXY),
65     fDCAZ(obj.fDCAZ),
66     fDCA(obj.fDCA),
67     fX(),
68     fCov(),
69     fNSigmaPi(obj.fNSigmaPi),
70     fNSigmaK(obj.fNSigmaK),
71     fNSigmaPr(obj.fNSigmaPr),
72     fLabel(obj.fLabel),
73     fNclusTPC(obj.fNclusTPC)
74 {
75   // copy constructor
76 }
77
78 //_____________________________________________________________________________
79 AliXiStarTrackStruct &AliXiStarTrackStruct::operator=(const AliXiStarTrackStruct &obj) 
80 {
81   // Assignment operator  
82   if (this == &obj)
83     return *this;
84   
85   fStatus = obj.fStatus;
86   fFilterMap = obj.fFilterMap;
87   fID = obj.fID;
88   fPhi = obj.fPhi;
89   fPt = obj.fPt;
90   fMom = obj.fMom;
91   fP[0] = obj.fP[0];
92   fP[1] = obj.fP[1];
93   fP[2] = obj.fP[2];
94   fCharge = obj.fCharge;
95   fEta = obj.fEta;
96   fMass = obj.fMass;
97   fDCAXY = obj.fDCAXY;
98   fDCAZ = obj.fDCAZ;
99   fDCA = obj.fDCA;
100   fX[0] = obj.fX[0];
101   fX[1] = obj.fX[1];
102   fX[2] = obj.fX[2];
103   fCov[0] = obj.fCov[0]; fCov[1] = obj.fCov[1]; fCov[2] = obj.fCov[2];
104   fCov[3] = obj.fCov[3]; fCov[4] = obj.fCov[4]; fCov[5] = obj.fCov[5];
105   fCov[6] = obj.fCov[6]; fCov[7] = obj.fCov[7]; fCov[8] = obj.fCov[8];
106   fCov[9] = obj.fCov[9]; fCov[10] = obj.fCov[10]; fCov[11] = obj.fCov[11];
107   fCov[12] = obj.fCov[12]; fCov[13] = obj.fCov[13]; fCov[14] = obj.fCov[14];
108   fCov[15] = obj.fCov[15]; fCov[16] = obj.fCov[16]; fCov[17] = obj.fCov[17];
109   fCov[18] = obj.fCov[18]; fCov[19] = obj.fCov[19]; fCov[20] = obj.fCov[20];
110   fNSigmaPi = obj.fNSigmaPi;
111   fNSigmaK = obj.fNSigmaK;
112   fNSigmaPr = obj.fNSigmaPr;
113   fLabel = obj.fLabel;
114   fNclusTPC = obj.fNclusTPC;
115
116   return (*this);
117 }
118
119 //_____________________________________________________________________________
120 AliXiStarTrackStruct::~AliXiStarTrackStruct()
121 {
122   // Destructor
123 }
124 //_____________________________________________________________________________
125 AliXiStarEventStruct::AliXiStarEventStruct():
126   fNTracks(0),
127   fTracks(0)
128 {
129   //Default constructor
130 }
131 //_____________________________________________________________________________
132 AliXiStarEventStruct::AliXiStarEventStruct(const AliXiStarEventStruct &obj) 
133   :  fNTracks(obj.fNTracks),
134      fTracks(obj.fTracks)
135 {
136   // copy constructor
137 }
138 //_____________________________________________________________________________
139 AliXiStarEventStruct &AliXiStarEventStruct::operator=(const AliXiStarEventStruct &obj) 
140 {
141   // Assignment operator  
142   if (this == &obj)
143     return *this;
144   
145   fNTracks = obj.fNTracks;
146   fTracks = obj.fTracks;
147   
148   return (*this);
149 }
150 //_____________________________________________________________________________
151 AliXiStarEventStruct::~AliXiStarEventStruct()
152 {
153   // Destructor
154   if(fTracks) delete fTracks;
155 }
156 //_____________________________________________________________________________
157 AliXiStarEventCollection::AliXiStarEventCollection():
158   fFIFO(0),
159   fEvtStr(0)
160 {
161 //Default constructor
162 }
163 //_____________________________________________________________________________
164 AliXiStarEventCollection::AliXiStarEventCollection(short a):
165   fFIFO(0),
166   fEvtStr(0x0)
167 {
168   // main constructor
169   SetBuffSize(a);
170   
171   fEvtStr = new AliXiStarEventStruct[fFIFO];  //allocate pointer array
172   for(Int_t ii = 0; ii < fFIFO; ii++){   //Initialize to NULL
173     (fEvtStr + ii)->fTracks = NULL;
174     (fEvtStr + ii)->fNTracks = 0;
175      
176     (fEvtStr + ii)->fTracks = new AliXiStarTrackStruct[300];
177   }
178   
179 }
180 //_____________________________________________________________________________
181 AliXiStarEventCollection::AliXiStarEventCollection(const AliXiStarEventCollection &obj) 
182   :  fFIFO(obj.fFIFO),
183      fEvtStr(obj.fEvtStr)
184 {
185   // copy constructor
186 }
187 //_____________________________________________________________________________
188 AliXiStarEventCollection &AliXiStarEventCollection::operator=(const AliXiStarEventCollection &obj) 
189 {
190   // Assignment operator  
191   if (this == &obj)
192     return *this;
193   
194   fFIFO = obj.fFIFO;
195   fEvtStr = obj.fEvtStr;
196   
197   return (*this);
198 }
199
200 //_____________________________________________________________________________
201 AliXiStarEventCollection::~AliXiStarEventCollection(){
202
203     for(Int_t i = 0; i < fFIFO; i++){
204
205         if((fEvtStr + i)->fTracks != NULL){
206           delete [] (fEvtStr + i)->fTracks;
207         }       
208         
209     }
210     
211     delete [] fEvtStr;
212     //remove histos from heap
213
214 }
215 //_____________________________________________________________________________
216 void AliXiStarEventCollection::FIFOShift(){ //Shift elements in FIFO by one and clear last element in FIFO 
217   
218   for(UShort_t i=fFIFO-1 ; i > 0; i--){
219     for(Int_t j=0; j<(fEvtStr + i-1)->fNTracks; j++) (fEvtStr + i)->fTracks[j] = (fEvtStr + i-1)->fTracks[j];
220     (fEvtStr + i)->fNTracks = (fEvtStr + i-1)->fNTracks;
221   }
222   
223   (fEvtStr)->fNTracks=0;
224  
225 }