]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/JCORRAN/AliPhJMCTrackList.cxx
add method to get centrality of the event for a given centrality class, use it in...
[u/mrichter/AliRoot.git] / PWG4 / JCORRAN / AliPhJMCTrackList.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 notifce   *
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: AliPhJMCTrackList.cxx,v 1.4 2008/05/08 13:44:46 djkim Exp $
17
18 ////////////////////////////////////////////////////
19 //
20 //  \file AliPhJMCTrackList.cxx
21 //  \brief
22 //  \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla)
23 //  \email: djkim@jyu.fi
24 //  \version $Revision: 1.4 $
25 //  \date $Date: 2008/05/08 13:44:46 $
26 //
27 //  Class containing a list (TClonesArray) of MC tracks
28 ////////////////////////////////////////////////////
29
30 #include "AliPhJMCTrackList.h"
31
32 using namespace std;
33
34 ClassImp(AliPhJMCTrackList)
35
36 #define kNumTracks 1500
37
38 //______________________________________________________________________________
39
40 AliPhJMCTrackList::AliPhJMCTrackList(expName exp):fMcTrackList(0x0),fTracks(0){
41   //constructor
42   switch (exp){
43    case kPHENIX:
44        break;
45    case kALICE:
46        fMcTrackList = new TClonesArray("AliJMCTrack",kNumTracks);
47        break;
48    }
49 }
50
51 //______________________________________________________________________________
52
53 AliPhJMCTrackList::AliPhJMCTrackList():fMcTrackList(0x0),fTracks(0){
54   //constructor
55   fMcTrackList = new TClonesArray("AliJMCTrack",kNumTracks);
56 }
57
58 //______________________________________________________________________________
59
60 AliPhJMCTrackList::AliPhJMCTrackList(const AliPhJMCTrackList& a):
61   TObject(a),
62   fMcTrackList(new TClonesArray(*a.fMcTrackList)),
63   fTracks(a.fTracks)
64 {
65 //copy constructor
66 }
67
68 //______________________________________________________________________________
69
70 AliPhJMCTrackList::~AliPhJMCTrackList(){
71   //destructor
72   fMcTrackList->Clear();
73   delete fMcTrackList;
74 }
75
76 //______________________________________________________________________________
77
78 void AliPhJMCTrackList::Reset(){
79   //reset list
80   fMcTrackList->Clear();
81   if(fTracks>kNumTracks){
82     fMcTrackList->Expand(kNumTracks);
83   }
84   fTracks = 0;
85 }
86
87 //______________________________________________________________________________
88
89 int AliPhJMCTrackList::SetTClonesArraySize(const unsigned int ntrk){
90   //set size of the list
91   if(ntrk>kNumTracks){
92     fMcTrackList->Expand(kNumTracks);
93   }
94   return ntrk;
95 }
96
97 //______________________________________________________________________________
98
99 void AliPhJMCTrackList::AddJMCTrack(const unsigned int itrk){
100   //add Mc track to the list
101   new((*fMcTrackList)[itrk]) AliJMCTrack();
102 }
103
104 //______________________________________________________________________________
105
106
107 AliJMCTrack* AliPhJMCTrackList::GetTrack(const unsigned int itrk){
108   //get track from the list
109   return (AliJMCTrack*)fMcTrackList->UncheckedAt(itrk);
110 }
111
112 //______________________________________________________________________________
113
114 AliPhJMCTrackList& AliPhJMCTrackList::operator=(const AliPhJMCTrackList&  list){
115   //operator=
116   if(this != &list){
117     TObject::operator=(list);
118     fMcTrackList=list.fMcTrackList;
119     fTracks=list.fTracks;
120   }
121
122   return *this;
123 }
124
125
126