1 ////////////////////////////////////////////////////////////////////////////////
3 // This class provides storage for event and track information which
4 // are used for same-event as well as mixed-event analyses in AliFourPion
6 // authors: Dhevan Gangadharan (dhevan.raja.gangadharan@cern.ch)
8 ////////////////////////////////////////////////////////////////////////////////
10 #include "AliFourPionEventCollection.h"
12 AliFourPionTrackStruct::AliFourPionTrackStruct():
41 AliFourPionTrackStruct::AliFourPionTrackStruct(const AliFourPionTrackStruct &obj)
42 : fStatus(obj.fStatus),
43 fFiltermap(obj.fFiltermap),
55 fEaccepted(obj.fEaccepted),
57 fClusterMap(obj.fClusterMap),
58 fSharedMap(obj.fSharedMap),
61 fElectron(obj.fElectron),
66 fLabel(obj.fLabel)// MC
70 AliFourPionTrackStruct &AliFourPionTrackStruct::operator=(const AliFourPionTrackStruct &obj)
72 // Assignment operator
76 fStatus = obj.fStatus;
77 fFiltermap = obj.fFiltermap;
85 fCharge = obj.fCharge;
91 fEaccepted = obj.fEaccepted;
93 fClusterMap = obj.fClusterMap;
94 fSharedMap = obj.fSharedMap;
98 fTOFhit = obj.fTOFhit;
99 fElectron = obj.fElectron;
103 fProton = obj.fProton;
104 fLabel = obj.fLabel;// MC
108 AliFourPionTrackStruct::~AliFourPionTrackStruct()
113 //_____________________________________________________________________________
114 AliFourPionMCStruct::AliFourPionMCStruct():
122 // Default constructor
124 AliFourPionMCStruct::AliFourPionMCStruct(const AliFourPionMCStruct &obj)
129 fPdgCode(obj.fPdgCode),
130 fMotherLabel(obj.fMotherLabel)
134 AliFourPionMCStruct &AliFourPionMCStruct::operator=(const AliFourPionMCStruct &obj)
136 // Assignment operator
144 fPdgCode = obj.fPdgCode;
145 fMotherLabel = obj.fMotherLabel;
149 AliFourPionMCStruct::~AliFourPionMCStruct()
154 //_____________________________________________________________________________
155 AliFourPionEventStruct::AliFourPionEventStruct():
162 // Default constructor
164 AliFourPionEventStruct::AliFourPionEventStruct(const AliFourPionEventStruct &obj)
165 : fFillStatus(obj.fFillStatus),
166 fNtracks(obj.fNtracks),
167 fMCarraySize(obj.fMCarraySize),
168 fTracks(obj.fTracks),
169 fMCtracks(obj.fMCtracks)
173 AliFourPionEventStruct &AliFourPionEventStruct::operator=(const AliFourPionEventStruct &obj)
175 // Assignment operator
179 fFillStatus = obj.fFillStatus;
180 fNtracks = obj.fNtracks;
181 fMCarraySize = obj.fMCarraySize;
182 fTracks = obj.fTracks;
183 fMCtracks = obj.fMCtracks;
187 AliFourPionEventStruct::~AliFourPionEventStruct()
190 if(fTracks) delete fTracks;
191 if(fMCtracks) delete fMCtracks;
194 //_____________________________________________________________________________
195 AliFourPionEventCollection::AliFourPionEventCollection():
201 // Default constructor
203 AliFourPionEventCollection::AliFourPionEventCollection(Short_t a, Int_t lim, Int_t mcarraylimit, Bool_t MCcase):
213 fEvtStr = new AliFourPionEventStruct[fFIFO]; //allocate pointer array of type particle_event
215 fMCLimit = mcarraylimit;
217 for(Int_t ii = 0; ii < fFIFO; ii++){ //Initialize particle table pointers to NULL
218 (fEvtStr + ii)->fNtracks = 0;
219 (fEvtStr + ii)->fFillStatus = 0;
220 (fEvtStr + ii)->fMCarraySize = 0;
222 (fEvtStr + ii)->fTracks = NULL;
223 (fEvtStr + ii)->fTracks = new AliFourPionTrackStruct[fLimit];
224 if(MCcase) (fEvtStr + ii)->fMCtracks = new AliFourPionMCStruct[fMCLimit];
228 AliFourPionEventCollection::AliFourPionEventCollection(const AliFourPionEventCollection &obj)
231 fMCLimit(obj.fMCLimit),
236 AliFourPionEventCollection &AliFourPionEventCollection::operator=(const AliFourPionEventCollection &obj)
238 // Assignment operator
244 fMCLimit = obj.fMCLimit;
245 fEvtStr = obj.fEvtStr;
249 AliFourPionEventCollection::~AliFourPionEventCollection(){
251 for(Int_t i = 0; i < fFIFO; i++){
253 if((fEvtStr + i)->fTracks != NULL){
254 delete [] (fEvtStr + i)->fTracks;
255 delete [] (fEvtStr + i)->fMCtracks;
261 //remove histos from heap
266 //_____________________________________________________________________________
267 void AliFourPionEventCollection::FIFOShift(){ //Shift elements in FIFO by one and clear last element in FIFO
270 for(UShort_t i=fFIFO-1 ; i > 0; i--){
271 for(Int_t j=0; j<(fEvtStr + i-1)->fNtracks; j++) (fEvtStr + i)->fTracks[j] = (fEvtStr + i-1)->fTracks[j];
272 for(Int_t j=0; j<(fEvtStr + i-1)->fMCarraySize; j++) (fEvtStr + i)->fMCtracks[j] = (fEvtStr + i-1)->fMCtracks[j];
274 (fEvtStr + i)->fFillStatus = (fEvtStr + i-1)->fFillStatus;
275 (fEvtStr + i)->fNtracks = (fEvtStr + i-1)->fNtracks;
276 (fEvtStr + i)->fMCarraySize = (fEvtStr + i-1)->fMCarraySize;
281 (fEvtStr)->fNtracks=0;
282 (fEvtStr)->fFillStatus=0;
283 (fEvtStr)->fMCarraySize=0;