]>
Commit | Line | Data |
---|---|---|
f553869e | 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 | AliStarEvent: Event container for star data | |
18 | ||
19 | origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch) | |
20 | *****************************************************************/ | |
21 | ||
22 | #include <string.h> | |
23 | #include <TObjArray.h> | |
24 | #include "AliStarTrack.h" | |
25 | #include "AliStarEvent.h" | |
26 | ||
27 | ClassImp(AliStarEvent) | |
28 | ||
29 | //______________________________________________________________________________ | |
30 | AliStarEvent::AliStarEvent(): | |
31 | TObject(), | |
32 | fParams(), | |
33 | fTracks(NULL) | |
34 | { | |
35 | //ctor | |
36 | } | |
37 | ||
38 | //______________________________________________________________________________ | |
39 | AliStarEvent::AliStarEvent( Int_t n ): | |
40 | TObject(), | |
41 | fParams(), | |
42 | fTracks(new TObjArray(n) ) | |
43 | { | |
44 | //ctor | |
45 | } | |
46 | ||
47 | //______________________________________________________________________________ | |
48 | AliStarEvent::AliStarEvent( const AliStarEvent& event ): | |
49 | TObject(event), | |
50 | fParams(), | |
51 | fTracks((TObjArray*)(event.fTracks)->Clone()) | |
52 | { | |
53 | //copy ctor | |
54 | memcpy(fParams,event.fParams,fgkNparams*sizeof(Float_t)); | |
55 | } | |
56 | ||
57 | //______________________________________________________________________________ | |
58 | AliStarEvent& AliStarEvent::operator=( const AliStarEvent& event ) | |
59 | { | |
60 | //assignment | |
61 | if (this == &event) return *this; | |
62 | TObject::operator=(event); | |
63 | memcpy(fParams,event.fParams,fgkNparams*sizeof(Float_t)); | |
64 | if (fTracks) fTracks->Delete(); | |
65 | delete fTracks; | |
66 | if (event.fTracks) | |
67 | fTracks = (TObjArray*)(event.fTracks)->Clone(); //deep copy | |
68 | return *this; | |
69 | } | |
70 | ||
71 | //______________________________________________________________________________ | |
72 | void AliStarEvent::SetParams( const Float_t* params ) | |
73 | { | |
74 | //set params | |
75 | memcpy(fParams,params,fgkNparams*sizeof(Float_t)); | |
76 | } | |
77 | ||
78 | //______________________________________________________________________________ | |
79 | AliStarEvent::~AliStarEvent() | |
80 | { | |
81 | //dtor | |
82 | if (fTracks) fTracks->Delete(); | |
83 | delete fTracks; | |
84 | } | |
85 | ||
86 | //______________________________________________________________________________ | |
87 | const AliStarTrack* AliStarEvent::GetTrack( const Int_t i ) const | |
88 | { | |
89 | //get track i | |
90 | if (!fTracks) return NULL; | |
91 | return static_cast<AliStarTrack*>(fTracks->At(i)); | |
92 | } | |
93 | ||
94 | //______________________________________________________________________________ | |
95 | void AliStarEvent::AddTrack( AliStarTrack* track ) | |
96 | { | |
97 | //add a new track to collection | |
98 | if (!fTracks) return; | |
99 | fTracks->Add(track); | |
100 | } | |
101 | ||
102 | //______________________________________________________________________________ | |
103 | void AliStarEvent::Reset() | |
104 | { | |
105 | //remove all tracks if any and zero the event information | |
106 | if (!fTracks) | |
107 | { | |
108 | fTracks=new TObjArray(1024); | |
109 | return; | |
110 | } | |
111 | fTracks->Delete(); | |
112 | for (Int_t i=0;i<fgkNparams; i++){fParams[i]=0;} | |
113 | } | |
114 | ||
115 | //______________________________________________________________________________ | |
116 | void AliStarEvent::Print( Option_t* option ) const | |
117 | { | |
118 | //print info | |
119 | // TNtuple* event: names are documented in the next 2 lines | |
120 | // event = new TNtuple("event","event", | |
121 | // "runId:eventNumber:VtxX:VtxY:VtxZ:BField:refMult:centralityId:numberOfPrimaryTracks:numberOfParticles:h0:h1:h2:h3:h4" ) ; | |
122 | // | |
f553869e | 123 | |
124 | Int_t runId = (Int_t) fParams[0] ; | |
125 | Int_t eventNumber = (Int_t) fParams[1] ; | |
c855d803 | 126 | Float_t primaryVertexPosition[3]={ (Float_t) fParams[2], |
127 | (Float_t) fParams[3], | |
128 | (Float_t) fParams[4] }; | |
f553869e | 129 | Float_t magneticField = (Float_t) fParams[5] ; // kilogauss |
130 | Int_t refMult = (Int_t) fParams[6] ; // Raw Mult into 0.5 unit: a relative number, not total Mult. | |
131 | Int_t centralityId = (Int_t) fParams[7] ; // STAR centrality bin # based on refMult | |
132 | Int_t numberOfPrimaryTracks = (Int_t) fParams[8] ; // # of primaries, including FTPC tracks which are not in ntuple | |
133 | Int_t numberOfParticles = (Int_t) fParams[9] ; // # of particles passing track cuts, thus in ntuple | |
134 | ||
135 | printf("\n runId eventNo VtxX VtxY VtxZ MagFld refMult CentBin #PrimeTrak #Tracks \n") ; | |
136 | printf("%7d %6d %7.4f %7.4f %7.3f %6.3f %6d %6d %6d %6d \n\n", | |
137 | runId, eventNumber, primaryVertexPosition[0], primaryVertexPosition[1], primaryVertexPosition[2], | |
138 | magneticField, refMult, centralityId, numberOfPrimaryTracks, numberOfParticles ) ; | |
139 | ||
140 | //Int_t newCentralityID ; | |
141 | //newCentralityID = Centrality( refMult) ; // Should be the same as "centralityID" from tape | |
142 | //cout << "Test: should be the same " << newCentralityID << " " << centralityId << endl ; // JT test | |
143 | ||
144 | TString optionstr(option); | |
145 | if (!optionstr.Contains("all")) return; | |
146 | if (!fTracks) return; | |
147 | AliStarTrack* track = static_cast<AliStarTrack*>( fTracks->First() ); | |
148 | if (!track) return; | |
149 | track->Print("legend"); | |
150 | fTracks->Print(); | |
151 | } | |
16a790e0 | 152 | |
153 | //______________________________________________________________________________ | |
154 | Int_t AliStarEvent::CalculateCentrality( Int_t referenceMultiplicity ) const | |
155 | { | |
156 | // Note Carefully: Centrality is based on refMult. This is the 'reference' multiplicity that is measured | |
157 | // independpently from the TPC. Selecting the centrality bins according to the refMult is something that | |
158 | // is calibrated for each year and each run. You can get the basic information off the web: | |
159 | // For Example .... http://www.star.bnl.gov/protected/common/common2004/trigger2004/200gev/200gevFaq.html | |
160 | // An index pointing to FAQs, Trigger and Centrality data, for all years, is available at: | |
161 | // http://www.star.bnl.gov/public/all | |
162 | // | |
163 | // Note: Add 0.5 to the (int) that is returned by centrality() when using it as an argument for a histogram | |
164 | // that expects (float) or (double) as input parameters. This will place the data point in the center of | |
165 | // the bin, avoids ambiguities, and is best for plotting scatter plots and contour plots. | |
166 | // For example histogram2D[1] -> Fill ( (float)CentralityID + 0.5 , SumData ) ; | |
167 | // | |
168 | // The refMult quoted in the Centrality bins array is the lower limit on refMult | |
169 | ||
170 | ||
cc0afcfc | 171 | Int_t centralityBins [] = { 14 , 31 , 57 , 96 , 150 , 222 , 319 , 441 , 520 , 1000 } ; // Run4 200 GeV |
172 | Int_t middleBinID [] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; // ID Number | |
173 | //Info middleBinPercent[] = { 85., 75., 65., 55., 45., 35., 25., 15., 7.5 , 2.5 } ; // Percent | |
16a790e0 | 174 | Int_t myCentrality ; |
175 | ||
cc0afcfc | 176 | if ( referenceMultiplicity < centralityBins[0] ) |
16a790e0 | 177 | { |
cc0afcfc | 178 | myCentrality = middleBinID[0] ; |
16a790e0 | 179 | } |
cc0afcfc | 180 | else if ( referenceMultiplicity < centralityBins[1] ) |
16a790e0 | 181 | { |
cc0afcfc | 182 | myCentrality = middleBinID[1] ; |
16a790e0 | 183 | } |
cc0afcfc | 184 | else if ( referenceMultiplicity < centralityBins[2] ) |
16a790e0 | 185 | { |
cc0afcfc | 186 | myCentrality = middleBinID[2] ; |
16a790e0 | 187 | } |
cc0afcfc | 188 | else if ( referenceMultiplicity < centralityBins[3] ) |
16a790e0 | 189 | { |
cc0afcfc | 190 | myCentrality = middleBinID[3] ; |
16a790e0 | 191 | } |
cc0afcfc | 192 | else if ( referenceMultiplicity < centralityBins[4] ) |
16a790e0 | 193 | { |
cc0afcfc | 194 | myCentrality = middleBinID[4] ; |
16a790e0 | 195 | } |
cc0afcfc | 196 | else if ( referenceMultiplicity < centralityBins[5] ) |
16a790e0 | 197 | { |
cc0afcfc | 198 | myCentrality = middleBinID[5] ; |
16a790e0 | 199 | } |
cc0afcfc | 200 | else if ( referenceMultiplicity < centralityBins[6] ) |
16a790e0 | 201 | { |
cc0afcfc | 202 | myCentrality = middleBinID[6] ; |
16a790e0 | 203 | } |
cc0afcfc | 204 | else if ( referenceMultiplicity < centralityBins[7] ) |
16a790e0 | 205 | { |
cc0afcfc | 206 | myCentrality = middleBinID[7] ; |
16a790e0 | 207 | } |
cc0afcfc | 208 | else if ( referenceMultiplicity < centralityBins[8] ) |
16a790e0 | 209 | { |
cc0afcfc | 210 | myCentrality = middleBinID[8] ; |
16a790e0 | 211 | } |
212 | else | |
213 | { | |
cc0afcfc | 214 | myCentrality = middleBinID[9] ; |
16a790e0 | 215 | } |
216 | ||
217 | return myCentrality ; | |
218 | } | |
219 | ||
220 |