StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDcaAnalysis.cxx
1 /***************************************************************************
2  *
3  * $Id: StDcaAnalysis.cxx,v 1.3 2002/05/31 21:58:29 jklay Exp $
4  *
5  * Author: Bum Choi, UT Austin, Apr 2002
6  *
7  ***************************************************************************
8  *
9  * Description: Class to look at DCA information from highpt uDSTs
10  *
11  *
12  ***************************************************************************
13  *
14  * $Log: StDcaAnalysis.cxx,v $
15  * Revision 1.3 2002/05/31 21:58:29 jklay
16  * Updated analysis code to use new cut class
17  *
18  * Revision 1.2 2002/04/03 00:23:27 jklay
19  * Fixed private member access bugs in analysis code
20  *
21  * Revision 1.1 2002/04/02 20:05:18 jklay
22  * Bums analysis tools for highpt uDSTs
23  *
24  *
25  **************************************************************************/
26 #include "StDcaAnalysis.h"
27 
28 enum TYPE { MEAN=0,RMS,NUM,SKEW};
29 
30 //__________________
31 
32 StDcaAnalysis::StDcaAnalysis(const char* inputDir,
33  const char* outRootName)
34  : StHiBaseAnalysis(inputDir,outRootName)
35 
36 {
37 
38 
39 }
40 
41 //__________________
42 
43 StDcaAnalysis::~StDcaAnalysis()
44 {
45 }
46 
47 
48 //_____________________________
49 
50 void
51 StDcaAnalysis::initHistograms()
52 {
53  cout << "StDcaAnalysis::initHistograms()" << endl;
54 
55  char name[100];
56 
57  //***********************
58 
59  using namespace Bin;
60 
61  //***********************
62 
63  /*
64  Double_t sectorMin, sectorMax;
65 
66  if(CutRc::Half() == 'w'){
67  sectorMin = sectorWestMin;
68  sectorMax = sectorWestMax;
69  }
70  else{
71  sectorMin = sectorEastMin;
72  sectorMax = sectorEastMax;
73  }
74  */
75  // int netabin=6; double etamin=-.5,etamax=.5;
76 
77  const char* type[] = {"Mean","Rms","Num" };
78 
79  for(int i=0; i<3; i++){
80  // global pt
81  sprintf(name,"h%sPosDcaXYGlPtZFD",type[i]);
82  dca[i].hPosGlPtZFD =
83  new TH3D(name,name,
84  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
85  nPhiBin,phiDegMin,phiDegMax,
86  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
87 
88  sprintf(name,"h%sNegDcaXYGlPtZFD",type[i]);
89  dca[i].hNegGlPtZFD =
90  new TH3D(name,name,
91  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
92  nPhiBin,phiDegMin,phiDegMax,
93  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
94 
95  sprintf(name,"h%sPosPlusNegDcaXYGlPtZFD",type[i]);
96  dca[i].hPosPlusNegGlPtZFD =
97  new TH3D(name,name,
98  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
99  nPhiBin,phiDegMin,phiDegMax,
100  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
101 
102  sprintf(name,"h%sPosMinusNegDcaXYGlPtZFD",type[i]);
103  dca[i].hPosMinusNegGlPtZFD =
104  new TH3D(name,name,
105  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
106  nPhiBin,phiDegMin,phiDegMax,
107  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
108  // primary pt
109  sprintf(name,"h%sPosDcaXYPrPtZFD",type[i]);
110  dca[i].hPosPrPtZFD =
111  new TH3D(name,name,
112  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
113  nPhiBin,phiDegMin,phiDegMax,
114  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
115 
116  sprintf(name,"h%sNegDcaXYPrPtZFD",type[i]);
117  dca[i].hNegPrPtZFD =
118  new TH3D(name,name,
119  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
120  nPhiBin,phiDegMin,phiDegMax,
121  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
122 
123  sprintf(name,"h%sPosPlusNegDcaXYPrPtZFD",type[i]);
124  dca[i].hPosPlusNegPrPtZFD =
125  new TH3D(name,name,
126  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
127  nPhiBin,phiDegMin,phiDegMax,
128  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
129 
130  sprintf(name,"h%sPosMinusNegDcaXYPrPtZFD",type[i]);
131  dca[i].hPosMinusNegPrPtZFD =
132  new TH3D(name,name,
133  nVertexZWideBin,vertexZWideMin,vertexZWideMax,
134  nPhiBin,phiDegMin,phiDegMax,
135  nDcaXYGlBin,dcaXYGlMin,dcaXYGlMax);
136  }
137 
138 }
139 
140 //_____________________
141 
142 void
143 StDcaAnalysis::trackLoop()
144 {
145  if(mDebug)
146  cout << "StDcaAnalysis::trackLoop()" << endl;
147 
148  //
149  // event stuff
150  //
151  /*
152  Float_t zdcSum = mHiMicroEvent->ZDCe() + mHiMicroEvent->ZDCw();
153  Float_t ctb = mHiMicroEvent->CTB();
154  Float_t flowCent = mHiMicroEvent->Centrality();
155  NchCentrality zdcCent = centrality(zdcSum,ctb);
156  */
157 
158  Int_t nTrack = mHiMicroEvent->NTrack();
160 
161  for(Int_t i=0; i<nTrack; i++){
162  track =(StHiMicroTrack*) mHiMicroEvent->tracks()->At(i);
163 
164  Float_t vertexZ = mHiMicroEvent->VertexZ();
165  Float_t dcaXYGl = track->DcaXYGl();
166  Int_t charge = track->Charge();
167  Float_t phiGlDeg = track->PhiGl()*180./M_PI;
168  phiGlDeg = (phiGlDeg<-165) ? (phiGlDeg += 360) : phiGlDeg;
169  Float_t eta = track->EtaPr();
170 
171  Float_t z = vertexZ;
172 
173  //Float_t exitZ = vtxZ+200*TMath::Tan(track->DipAnglePr());
174 
175  if(!CutRc::AcceptTrackVtxZHalf(track,vertexZ)) continue;
176 
177  if(!CutRc::AcceptFitPts(track)) continue;
178  if(fabs(eta)>.1) continue;
179 
180  mNHiPtTrack++;
181 
182  if(track->PtGl() >1.7 && track->PtGl()<6){ // glpt
183  if(charge>0){ //pos
184  dca[MEAN].hPosGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl);
185  dca[RMS].hPosGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
186  dca[NUM].hPosGlPtZFD->Fill(z,phiGlDeg,dcaXYGl);
187  }
188  else{ //neg
189  dca[MEAN].hNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl);
190  dca[RMS].hNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
191  dca[NUM].hNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl);
192  }
193 
194  // both
195  dca[MEAN].hPosPlusNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl);
196  dca[RMS].hPosPlusNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
197  dca[NUM].hPosPlusNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl);
198 
199  dca[MEAN].hPosMinusNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*charge);
200  dca[RMS].hPosMinusNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
201  dca[NUM].hPosMinusNegGlPtZFD->Fill(z,phiGlDeg,dcaXYGl);
202  }
203  if(track->PtPr()>1.7 && track->PtPr()<6){
204  if(charge>0){ //pos
205  dca[MEAN].hPosPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl);
206  dca[RMS].hPosPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
207  dca[NUM].hPosPrPtZFD->Fill(z,phiGlDeg,dcaXYGl);
208  }
209  else{ //neg
210  dca[MEAN].hNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl);
211  dca[RMS].hNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
212  dca[NUM].hNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl);
213  }
214 
215  // both
216  dca[MEAN].hPosPlusNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl);
217  dca[RMS].hPosPlusNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
218  dca[NUM].hPosPlusNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl);
219 
220  dca[MEAN].hPosMinusNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*charge);
221  dca[RMS].hPosMinusNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl,dcaXYGl*dcaXYGl);
222  dca[NUM].hPosMinusNegPrPtZFD->Fill(z,phiGlDeg,dcaXYGl);
223 
224  }
225 
226 
227  } // tracks
228 
229  if(mDebug)
230  cout << "\ttracks : " << nTrack << endl;
231 
232 }
233 
234 
235 //_______________________
236 
237 Bool_t
238 StDcaAnalysis::acceptEvent(StHiMicroEvent* event)
239 {
240  return CutRc::Accept(event);
241 
242 }
243 
244 
245 
246 //_______________________
247 
248 // ew: east is 0, west is 1
249 
250 Int_t
251 StDcaAnalysis::findSector(Float_t phi, Char_t ew)
252 {
253  Int_t sector=0;
254  Float_t pi = (Float_t) TMath::Pi();
255  Float_t sectorWidth = pi/6.;
256 
257  Int_t sectorWest[] = {8,7,6,5,4,3,2,1,12,11,10};
258  Int_t sectorEast[] = {16,17,18,19,20,21,22,23,24,13,14};
259 
260  if(phi>=(pi-sectorWidth/2.) || phi < (-pi+sectorWidth/2.)){
261  if(ew=='w'){
262  sector = 9;
263  }
264  else if(ew=='e'){
265  sector = 15;
266  }
267  else{
268  cerr << "wrong CutRc::Half " << ew << endl;
269  exit(1);
270  }
271  }
272  else{
273  for(int i=0; i<11; i++){
274  if(phi>=(-pi +sectorWidth*(i+1) - sectorWidth/2.) &&
275  phi<(-pi +sectorWidth*(i+1) + sectorWidth/2.)){
276 
277  if(ew=='w') sector = sectorWest[i];
278  else if(ew=='e') sector = sectorEast[i];
279 
280  break;
281  }
282  }
283  }
284  // if(gRandom->Rndm()<.1)
285  // cout << "phi : " << phi*180./pi << " sector : " << sector << endl;
286 
287 
288  if(!sector){
289  cerr << "Huh? phi = " << phi << endl; exit(1);
290  }
291 
292  return sector;
293 }
294 
295 //_____________________________________
296 
297 ClassImp(StDcaAnalysis)