StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtSectoredAnalysis.cxx
1 /***************************************************************************
2  *
3  * $Id: StHbtSectoredAnalysis.cxx,v 1.3 2000/08/11 16:35:41 rcwells Exp $
4  *
5  * Author: Robert Willson, Ohio State, willson@bnl.gov
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package.
9  * This is a derived class for two-particle analysis objects.
10  * In this analysis, momentum space is sectored into a number of
11  * cubes, which are then mixed with nearest neighbors. Several
12  * initializations are needed to set up the sectoring, see
13  * StHbtSectoredExample.C in the /doc directory for use.
14  *
15  ***************************************************************************
16  *
17  * $Log: StHbtSectoredAnalysis.cxx,v $
18  * Revision 1.3 2000/08/11 16:35:41 rcwells
19  * Added number of events processed to each HBT analysis
20  *
21  * Revision 1.2 2000/07/16 21:38:23 laue
22  * StHbtCoulomb.cxx StHbtSectoredAnalysis.cxx : updated for standalone version
23  * StHbtV0.cc StHbtV0.hh : some cast to prevent compiling warnings
24  * StHbtParticle.cc StHbtParticle.hh : pointers mTrack,mV0 initialized to 0
25  * StHbtIOBinary.cc : some printouts in #ifdef STHBTDEBUG
26  * StHbtEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
27  * solution
28  *
29  * Revision 1.1 2000/04/12 01:46:18 willson
30  * Initial Installation
31  *
32  *
33  ***************************************************************************/
34 
35 #include "StHbtMaker/Infrastructure/StHbtSectoredAnalysis.h"
36 #include "StHbtMaker/Infrastructure/StHbtParticleCollection.hh"
37 #include "StHbtMaker/Base/StHbtTrackCut.h"
38 #include "StHbtMaker/Base/StHbtV0Cut.h"
39 
40 #ifdef __ROOT__
41 ClassImp(StHbtSectoredAnalysis)
42 #endif
43 
44 //This function gives the correct linear transformation from a 3-D coordinate to a 1-D array index.
45 
46 //____________________________
47 int StHbtSectoredAnalysis::Index(int binx, int biny, int binz)
48 {
49  return binx + biny*mNumBinsX + binz*mNumBinsX*mNumBinsY;
50 }
51 
52 
53 
54 //This function sorts the event into a number of sectors. The overflow is the last array element.
55 
56 //____________________________
57 void StHbtSectoredAnalysis::SortHbtParticleCollection(StHbtParticleCut* partCut,
58  StHbtEvent* hbtEvent,
59  StHbtParticleCollection** SectoredPicoEvent)
60 {
61  int i,j,k;
62  switch (partCut->Type()) {
63  case hbtTrack: // cut is cutting on Tracks
64  {
65  StHbtTrackCut* pCut = (StHbtTrackCut*) partCut;
66  StHbtTrack* pParticle;
67  StHbtTrackIterator pIter;
68  StHbtTrackIterator startLoop = hbtEvent->TrackCollection()->begin();
69  StHbtTrackIterator endLoop = hbtEvent->TrackCollection()->end();
70 
71  for (pIter=startLoop;pIter!=endLoop;pIter++){
72  pParticle = *pIter;
73  bool tmpPassParticle = pCut->Pass(pParticle);
74  pCut->FillCutMonitor(pParticle, tmpPassParticle);
75  if (tmpPassParticle){
76  StHbtParticle* particle = new StHbtParticle(pParticle,pCut->Mass());
77  if (particle->FourMomentum().px()<mPXmin || particle->FourMomentum().px()>mPXmax ||
78  particle->FourMomentum().py()<mPYmin || particle->FourMomentum().py()>mPYmax ||
79  particle->FourMomentum().pz()<mPZmin || particle->FourMomentum().pz()>mPZmax)
80  SectoredPicoEvent[mNumBinsX*mNumBinsY*mNumBinsZ]->push_back(particle);
81  else {
82  i = (int) floor((particle->FourMomentum().px()-mPXmin)/mDeltaP);
83  j = (int) floor((particle->FourMomentum().py()-mPYmin)/mDeltaP);
84  k = (int) floor((particle->FourMomentum().pz()-mPZmin)/mDeltaP);
85  SectoredPicoEvent[Index(i,j,k)]->push_back(particle);
86  }
87  }
88  }
89  break;
90  }
91 
92  case hbtV0: // cut is cutting on V0s
93  {
94  StHbtV0Cut* pCut = (StHbtV0Cut*) partCut;
95  StHbtV0* pParticle;
96  StHbtV0Iterator pIter;
97  StHbtV0Iterator startLoop = hbtEvent->V0Collection()->begin();
98  StHbtV0Iterator endLoop = hbtEvent->V0Collection()->end();
99  // this following "for" loop is identical to the one above, but because of scoping, I can's see how to avoid repetition...
100 
101  for (pIter=startLoop;pIter!=endLoop;pIter++){
102  pParticle = *pIter;
103  bool tmpPassV0 = pCut->Pass(pParticle);
104  pCut->FillCutMonitor(pParticle, tmpPassV0);
105  if (tmpPassV0){
106  StHbtParticle* particle = new StHbtParticle(pParticle,pCut->Mass());
107  if (particle->FourMomentum().px()<mPXmin || particle->FourMomentum().px()>mPXmax ||
108  particle->FourMomentum().py()<mPYmin || particle->FourMomentum().py()>mPYmax ||
109  particle->FourMomentum().pz()<mPZmin || particle->FourMomentum().pz()>mPZmax)
110  SectoredPicoEvent[mNumBinsX*mNumBinsY*mNumBinsZ]->push_back(particle);
111  else {
112  i = (int) floor((particle->FourMomentum().px()-mPXmin)/mDeltaP);
113  j = (int) floor((particle->FourMomentum().py()-mPYmin)/mDeltaP);
114  k = (int) floor((particle->FourMomentum().pz()-mPZmin)/mDeltaP);
115  SectoredPicoEvent[Index(i,j,k)]->push_back(particle);
116  }
117  }
118  }
119  break;
120  }
121  default:
122  cout << "FillHbtParticleCollection function (in StHbtSectoredAnalysis.cxx) - undefined Particle Cut type!!! \n";
123  }
124 }
125 
126 
127 //____________________________
128 StHbtSectoredAnalysis::StHbtSectoredAnalysis(){
129  // mControlSwitch = 0;
130  mEventCut = 0;
131  mFirstParticleCut = 0;
132  mSecondParticleCut = 0;
133  mPairCut = 0;
134  mCorrFctnCollection= 0;
135  mNeventsProcessed = 0;
136  // Defaults for sectoring
137  mPXmax = 5.0;
138  mPXmin = -5.0;
139  mPYmax = 5.0;
140  mPYmin = -5.0;
141  mPZmax = 5.0;
142  mPZmin = -5.0;
143  mDeltaP = 10.0;
144  mNumBinsX = 1;
145  mNumBinsY = 1;
146  mNumBinsZ = 1;
147  mCorrFctnCollection = new StHbtCorrFctnCollection;
148  mSectoredMixingBuffer = new StHbtSectoredPicoEventCollection;
149 }
150 
151 //____________________________
152 StHbtSectoredAnalysis::StHbtSectoredAnalysis(const StHbtSectoredAnalysis& a) : StHbtBaseAnalysis() {
153  // mControlSwitch = 0;
154  mEventCut = 0;
155  mFirstParticleCut = 0;
156  mSecondParticleCut = 0;
157  mPairCut = 0;
158  mCorrFctnCollection= 0;
159  mNeventsProcessed = 0;
160  mPXmax = 5.0;
161  mPXmin = -5.0;
162  mPYmax = 5.0;
163  mPYmin = -5.0;
164  mPZmax = 5.0;
165  mPZmin = -5.0;
166  mDeltaP = 10.0;
167  mNumBinsX = 1;
168  mNumBinsY = 1;
169  mNumBinsZ = 1;
170  mCorrFctnCollection = new StHbtCorrFctnCollection;
171  mSectoredMixingBuffer = new StHbtSectoredPicoEventCollection;
172 
173  // find the right event cut
174  mEventCut = a.mEventCut->Clone();
175  // find the right first particle cut
176  mFirstParticleCut = a.mFirstParticleCut->Clone();
177  // find the right second particle cut
178  if (a.mFirstParticleCut==a.mSecondParticleCut)
179  SetSecondParticleCut(mFirstParticleCut); // identical particle hbt
180  else
181  mSecondParticleCut = a.mSecondParticleCut->Clone();
182 
183  mPairCut = a.mPairCut->Clone();
184 
185  if ( mEventCut ) {
186  SetEventCut(mEventCut); // this will set the myAnalysis pointer inside the cut
187  cout << " StHbtAnalysis::StHbtAnalysis(const StHbtAnalysis& a) - event cut set " << endl;
188  }
189  if ( mFirstParticleCut ) {
190  SetFirstParticleCut(mFirstParticleCut); // this will set the myAnalysis pointer inside the cut
191  cout << " StHbtAnalysis::StHbtAnalysis(const StHbtAnalysis& a) - first particle cut set " << endl;
192  }
193  if ( mSecondParticleCut ) {
194  SetSecondParticleCut(mSecondParticleCut); // this will set the myAnalysis pointer inside the cut
195  cout << " StHbtAnalysis::StHbtAnalysis(const StHbtAnalysis& a) - second particle cut set " << endl;
196  } if ( mPairCut ) {
197  SetPairCut(mPairCut); // this will set the myAnalysis pointer inside the cut
198  cout << " StHbtAnalysis::StHbtAnalysis(const StHbtAnalysis& a) - pair cut set " << endl;
199  }
200 
201  StHbtCorrFctnIterator iter;
202  for (iter=a.mCorrFctnCollection->begin(); iter!=a.mCorrFctnCollection->end();iter++){
203  cout << " StHbtAnalysis::StHbtAnalysis(const StHbtAnalysis& a) - looking for correlation functions " << endl;
204  StHbtCorrFctn* fctn = (*iter)->Clone();
205  if (fctn) AddCorrFctn(fctn);
206  else cout << " StHbtAnalysis::StHbtAnalysis(const StHbtAnalysis& a) - correlation function not found " << endl;
207  }
208 
209  mNumEventsToMix = a.mNumEventsToMix;
210 
211  cout << " StHbtSectoredAnalysis::StHbtSectoredAnalysis(const StHbtSectoredAnalysis& a) - analysis copied " << endl;
212 
213 }
214 
215 //____________________________
216 StHbtSectoredAnalysis::~StHbtSectoredAnalysis(){
217  delete mEventCut ;
218  delete mFirstParticleCut ;
219  delete mSecondParticleCut ;
220  delete mPairCut ;
221  // now delete every CorrFunction in the Collection, and then the Collection itself
222  StHbtCorrFctnIterator iter;
223  for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
224  delete *iter;
225  }
226  delete mCorrFctnCollection;
227  // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
228  StHbtSectoredPicoEventIterator piter;
229  for (piter=mSectoredMixingBuffer->begin();piter!=mSectoredMixingBuffer->end();piter++){
230  delete *piter;
231  }
232  delete mSectoredMixingBuffer;
233 
234 }
235 //______________________
236 StHbtCorrFctn* StHbtSectoredAnalysis::CorrFctn(int n){ // return pointer to n-th correlation function
237  if ( n<0 || n > (int)mCorrFctnCollection->size() )
238  return NULL;
239  StHbtCorrFctnIterator iter=mCorrFctnCollection->begin();
240  for (int i=0; i<n ;i++){
241  iter++;
242  }
243  return *iter;
244 }
245 //____________________________
246 StHbtString StHbtSectoredAnalysis::Report()
247 {
248  char Sect[100];
249  sprintf(Sect, "Sector bounds: %4.2f<px<%4.2f %4.2f<py<%4.2f %4.2f<pz<%4.2f, DeltaP=%4.2f", mPXmin, mPXmax, mPYmin, mPYmax, mPZmin, mPZmax, mDeltaP);
250  cout << "StHbtSectoredAnalysis - constructing Report..."<<endl;
251  string temp = "-----------\nHbt Analysis Report:\n";
252  temp += "\nEvent Cuts:\n";
253  temp += mEventCut->Report();
254  temp += "\nParticle Cuts - First Particle:\n";
255  temp += mFirstParticleCut->Report();
256  temp += "\nParticle Cuts - Second Particle:\n";
257  temp += mSecondParticleCut->Report();
258  temp += "\nPair Cuts:\n";
259  temp += mPairCut->Report();
260  temp += "\nCorrelation Functions:\n";
261  StHbtCorrFctnIterator iter;
262  if ( mCorrFctnCollection->size()==0 ) {
263  cout << "StHbtSectoredAnalysis-Warning : no correlations functions in this analysis " << endl;
264  }
265  for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
266  temp += (*iter)->Report();
267  temp += "\n";
268  }
269  temp += "\nSectoring Information:\n";
270  temp += Sect;
271  temp += "\n-------------\n";
272  StHbtString returnThis=temp;
273  return returnThis;
274 }
275 //_________________________
277 
278  // Add event to processed events
279  AddEventProcessed();
280 
281  int i, j, k, i2, j2, k2; // used in loops over sectors
282  int size1=0, size2=0; // To get the total size of all sectors
283  bool DidOverflow; // To only count the overflow bin once per sector
284 
285  // startup for EbyE
286  EventBegin(hbtEvent);
287  // event cut and event cut monitor
288  bool tmpPassEvent = mEventCut->Pass(hbtEvent);
289  mEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
290  if (tmpPassEvent) {
291  cout << "StHbtSectoredAnalysis::ProcessEvent() - Event has passed cut - build sectoredpicoEvent from " <<
292  hbtEvent->TrackCollection()->size() << " tracks in TrackCollection" << endl;
293  // OK, analysis likes the event-- build a sectored pico event from it, using tracks the analysis likes...
294 
295  // this is what we will make Pairs from and put in Mixing Buffer
296  StHbtSectoredPicoEvent* picoEvent = new StHbtSectoredPicoEvent(mNumBinsX, mNumBinsY, mNumBinsZ);
297 
298  SortHbtParticleCollection(mFirstParticleCut,(StHbtEvent*)hbtEvent,picoEvent->FirstSectoredCollection());
299  if ( !(AnalyzeIdenticalParticles()) )
300  SortHbtParticleCollection(mSecondParticleCut,(StHbtEvent*)hbtEvent,picoEvent->SecondSectoredCollection());
301 
302  //Obtain combined size of all sectors
303 
304  for (i=0; i<mNumBinsX; i++)
305  for (j=0; j<mNumBinsY; j++)
306  for (k=0; k<mNumBinsZ; k++) {
307  size1 += picoEvent->FirstSectoredCollection()[Index(i,j,k)]->size();
308  if ( !(AnalyzeIdenticalParticles()) )
309  size2 += picoEvent->SecondSectoredCollection()[Index(i,j,k)]->size();
310  }
311 
312  cout <<"StHbtSectoredAnalysis::ProcessEvent - #particles in First, Second Collections: " <<
313  size1 << " " << size2 << endl;
314 
315  if (AnalyzeIdenticalParticles()) {
316  // Real Pairs--Identical Particles
317  for (i=0; i<mNumBinsX; i++)
318  for (j=0; j<mNumBinsY; j++)
319  for (k=0; k<mNumBinsZ; k++) {
320  DidOverflow=false;
321 
322  // A sector sweep of a single sectoredpicoevent - 9 terms with i+1, 3 term with i, j+1,
323  // and 1 term with i, j, k+1. Plus another term for mixing a sector with itself.
324 
325  //The 9 terms
326  for (j2=j-1; j2<=j+1; j2++)
327  for (k2=k-1; k2<=k+1; k2++) {
328  if (j2<mNumBinsY && k2<mNumBinsZ && j2!=-1 && k2!=-1 && i+1<mNumBinsX) {
329  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->FirstSectoredCollection()[Index(i+1,j2,k2)]);
330  }
331  else
332  if (!DidOverflow) {
333  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
334  DidOverflow=true;
335  }
336  }
337 
338  //The 3 terms
339  for (k2=k-1; k2<=k+1; k2++) {
340  if (k2<mNumBinsZ && k2!=-1 && j+1<mNumBinsY) {
341  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->FirstSectoredCollection()[Index(i,j+1,k2)]);
342  }
343  else
344  if (!DidOverflow) {
345  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
346  DidOverflow=true;
347  }
348  }
349 
350  //The 1 term
351  if (k+1<mNumBinsZ) {
352  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->FirstSectoredCollection()[Index(i,j,k+1)]);
353  }
354  else
355  if (!DidOverflow) {
356  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
357  DidOverflow=true;
358  }
359 
360  //Mix sector with itself
361  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)]);
362  }
363  //Mix overflow bin with itself
364  CreateRealPairs(picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
365 
366  }
367 
368  else {
369  // Real Pairs--Non-Identical Particles
370  for (i=0; i<mNumBinsX; i++)
371  for (j=0; j<mNumBinsY; j++)
372  for (k=0; k<mNumBinsZ; k++) {
373  DidOverflow=false;
374  for (i2=i-1; i2<=i+1; i2++)
375  for (j2=j-1; j2<=j+1; j2++)
376  for (k2=k-1; k2<=k+1; k2++)
377  if (i2<mNumBinsX && j2<mNumBinsY && k2<mNumBinsZ && i2!=-1 && j2!=-1 && k2!=-1)
378  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->SecondSectoredCollection()[Index(i2,j2,k2)]);
379  else
380  if (!DidOverflow) {
381  CreateRealPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], picoEvent->SecondSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
382  DidOverflow=true;
383  }
384  }
385  }
386  //Need to mix with the overflow bin of FirstSectoredCollection:
387  for (i=0; i<mNumBinsX; i++)
388  for (j=0; j<mNumBinsY; j++)
389  for (k=0; k<mNumBinsZ; k++)
390  if (i==0 || j==0 || k==0 || i==mNumBinsX-1 || j==mNumBinsY-1 || k==mNumBinsZ-1)
391  CreateRealPairs(picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ], picoEvent->SecondSectoredCollection()[Index(i,j,k)]);
392 
393  //Need to mix both overflow bins
394  CreateRealPairs(picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ], picoEvent->SecondSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
395 
396 
397  cout << "StHbtSectoredAnalysis::ProcessEvent() - reals done, " << endl;
398 
399  // ok, now make mixed Pairs, if the Mixing buffer is full
400 
401  if (SectoredMixingBufferFull()){
402  cout << "Mixing Buffer is full - lets rock and roll" << endl;
403  }
404  else {
405  cout << "Mixing Buffer not full -gotta wait " << SectoredMixingBuffer()->size() << endl;
406  }
407  if (SectoredMixingBufferFull()){
408  StHbtSectoredPicoEvent* storedEvent;
409  StHbtSectoredPicoEventIterator picoEventIter;
410  for (picoEventIter=SectoredMixingBuffer()->begin();picoEventIter!=SectoredMixingBuffer()->end();picoEventIter++){
411  storedEvent = *picoEventIter;
412  if (AnalyzeIdenticalParticles()){
413  // Mixed Pairs--Identical Particles
414  for (i=0; i<mNumBinsX; i++)
415  for (j=0; j<mNumBinsY; j++)
416  for (k=0; k<mNumBinsZ; k++) {
417  DidOverflow=false;
418  for (i2=i-1; i2<=i+1; i2++)
419  for (j2=j-1; j2<=j+1; j2++)
420  for (k2=k-1; k2<=k+1; k2++)
421  if (i2<mNumBinsX && j2<mNumBinsY && k2<mNumBinsZ && i2!=-1 && j2!=-1 && k2!=-1) {
422  CreateMixedPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], storedEvent->FirstSectoredCollection()[Index(i2,j2,k2)]);
423  }
424  else
425  if (!DidOverflow) {
426  CreateMixedPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], storedEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
427  DidOverflow=true;
428  }
429  }
430 
431  //Need to mix with the overflow bin of FirstSectoredCollection:
432  for (i=0; i<mNumBinsX; i++)
433  for (j=0; j<mNumBinsY; j++)
434  for (k=0; k<mNumBinsZ; k++)
435  if (i==0 || j==0 || k==0 || i==mNumBinsX-1 || j==mNumBinsY-1 || k==mNumBinsZ-1){
436  CreateMixedPairs(picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ], storedEvent->FirstSectoredCollection()[Index(i,j,k)]);
437  }
438 
439  //Need to mix the overflow bin of picoEvent with the overflow bin of storedEvent
440  CreateMixedPairs(picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ], storedEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
441 
442  }
443 
444  else{
445  // Mixed Pairs--Non-Identical Particles
446  for (i=0; i<mNumBinsX; i++)
447  for (j=0; j<mNumBinsY; j++)
448  for (k=0; k<mNumBinsZ; k++) {
449  DidOverflow=false;
450  for (i2=i-1; i2<=i+1; i2++)
451  for (j2=j-1; j2<=j+1; j2++)
452  for (k2=k-1; k2<=k+1; k2++)
453  if (i2<mNumBinsX && j2<mNumBinsY && k2<mNumBinsZ && i2!=-1 && j2!=-1 && k2!=-1)
454  CreateMixedPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], storedEvent->SecondSectoredCollection()[Index(i2,j2,k2)]);
455  else
456  if (!DidOverflow) {
457  CreateMixedPairs(picoEvent->FirstSectoredCollection()[Index(i,j,k)], storedEvent->SecondSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
458  DidOverflow=true;
459  }
460  }
461  //Need to mix with the overflow bin of FirstSectoredCollection:
462  for (i=0; i<mNumBinsX; i++)
463  for (j=0; j<mNumBinsY; j++)
464  for (k=0; k<mNumBinsZ; k++)
465  if (i==0 || j==0 || k==0 || i==mNumBinsX-1 || j==mNumBinsY-1 || k==mNumBinsZ-1)
466  CreateMixedPairs(picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ], storedEvent->SecondSectoredCollection()[Index(i,j,k)]);
467 
468  //Need to mix the overflow bin of picoEvent with the overflow bin of storedEvent
469  CreateMixedPairs(picoEvent->FirstSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ], storedEvent->SecondSectoredCollection()[mNumBinsX*mNumBinsY*mNumBinsZ]);
470 
471  }
472  }
473 
474  // Now get rid of oldest stored pico-event in buffer.
475  // This means (1) delete the event from memory, (2) "pop" the pointer to it from the MixingBuffer
476  picoEventIter = SectoredMixingBuffer()->end();
477  picoEventIter--; // bug fixed malisa 27jul99 - end() is one BEYOND the end! (besides crashing on linux, this was a memory leak)
478  delete *picoEventIter;
479 
480  SectoredMixingBuffer()->pop_back();
481  } // if mixing buffer is full
482  SectoredMixingBuffer()->push_front(picoEvent); // store the current pico-event in buffer
483  } // if currentEvent is accepted by currentAnalysis
484  EventEnd(hbtEvent); // cleanup for EbyE
485  cout << "StHbtSectoredAnalysis::ProcessEvent() - return to caller ... " << endl;
486 
487 }
488 
489 
490 //_________________________
491 void StHbtSectoredAnalysis::CreateRealPairs(StHbtParticleCollection *partColl1) {
492 
493  if (partColl1->size()<2) return;
494 
495  StHbtPair* ThePair = new StHbtPair;
496 
497  StHbtParticleIterator PartIter1;
498  StHbtParticleIterator PartIter2;
499  StHbtCorrFctnIterator CorrFctnIter;
500  StHbtParticleIterator StartOuterLoop = partColl1->begin(); // always
501  StHbtParticleIterator EndOuterLoop = partColl1->end(); // will be one less
502  StHbtParticleIterator StartInnerLoop;
503  StHbtParticleIterator EndInnerLoop;
504 
505  EndOuterLoop--; // outer loop goes to next-to-last particle in collection
506  EndInnerLoop = partColl1->end() ;
507 
508  for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
509  StartInnerLoop = PartIter1;
510  StartInnerLoop++;
511  ThePair->SetTrack1(*PartIter1);
512  for (PartIter2 = StartInnerLoop; PartIter2!=EndInnerLoop;PartIter2++){
513  ThePair->SetTrack2(*PartIter2);
514  // The following lines have to be uncommented if you want PairCutMonitors
515  // they are not in for speed reasons
516  // bool tmpPassPair = mPairCut->Pass(ThePair);
517  // mPairCut->FillCutMonitor(ThePair, tmpPassPair);
518  // if ( tmpPassPair ) {
519  if (mPairCut->Pass(ThePair)){
520  for (CorrFctnIter=mCorrFctnCollection->begin();
521  CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
522  StHbtCorrFctn* CorrFctn = *CorrFctnIter;
523  CorrFctn->AddRealPair(ThePair);
524  }
525  } // if passed Pair cut
526  } // loop over second particle
527  } // loop over first particle
528 
529  delete ThePair;
530 
531 }
532 
533 //_________________________
534 void StHbtSectoredAnalysis::CreateRealPairs(StHbtParticleCollection *partColl1, StHbtParticleCollection *partColl2) {
535 
536  if (partColl1->size()<1 || partColl2->size()<1) return;
537 
538  StHbtPair* ThePair = new StHbtPair;
539 
540  // We are taking one particle from each of the two collections
541 
542  StHbtParticleIterator PartIter1;
543  StHbtParticleIterator PartIter2;
544  StHbtCorrFctnIterator CorrFctnIter;
545  StHbtParticleIterator StartOuterLoop = partColl1->begin();
546  StHbtParticleIterator EndOuterLoop = partColl1->end();
547  StHbtParticleIterator StartInnerLoop = partColl2->begin();
548  StHbtParticleIterator EndInnerLoop = partColl2->end();
549 
550  for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
551  ThePair->SetTrack1(*PartIter1);
552  for (PartIter2 = StartInnerLoop; PartIter2!=EndInnerLoop;PartIter2++){
553  ThePair->SetTrack2(*PartIter2);
554  // The following lines have to be uncommented if you want PairCutMonitors
555  // they are not in for speed reasons
556  // bool tmpPassPair = mPairCut->Pass(ThePair);
557  // mPairCut->FillCutMonitor(ThePair, tmpPassPair);
558  // if ( tmpPassPair ) {
559  if (mPairCut->Pass(ThePair)){
560  for (CorrFctnIter=mCorrFctnCollection->begin();
561  CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
562  StHbtCorrFctn* CorrFctn = *CorrFctnIter;
563  CorrFctn->AddRealPair(ThePair);
564  }
565  } // if passed Pair cut
566  } // loop over second particle
567  } // loop over first particle
568 
569  delete ThePair;
570 
571 }
572 
573 //_________________________
574 void StHbtSectoredAnalysis::CreateMixedPairs(StHbtParticleCollection *partColl1, StHbtParticleCollection *partColl2) {
575 
576  if (partColl1->size()<1 || partColl2->size()<1) return;
577 
578  StHbtPair* ThePair = new StHbtPair;
579 
580  // We are taking one particle from each of the two collections
581 
582  StHbtParticleIterator PartIter1;
583  StHbtParticleIterator PartIter2;
584  StHbtCorrFctnIterator CorrFctnIter;
585  StHbtParticleIterator StartOuterLoop = partColl1->begin();
586  StHbtParticleIterator EndOuterLoop = partColl1->end();
587  StHbtParticleIterator StartInnerLoop = partColl2->begin();
588  StHbtParticleIterator EndInnerLoop = partColl2->end();
589 
590  for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
591  ThePair->SetTrack1(*PartIter1);
592  for (PartIter2 = StartInnerLoop; PartIter2!=EndInnerLoop;PartIter2++){
593  ThePair->SetTrack2(*PartIter2);
594  // The following lines have to be uncommented if you want PairCutMonitors
595  // they are not in for speed reasons
596  // bool tmpPassPair = mPairCut->Pass(ThePair);
597  // mPairCut->FillCutMonitor(ThePair, tmpPassPair);
598  // if ( tmpPassPair ) {
599  if (mPairCut->Pass(ThePair)){
600  for (CorrFctnIter=mCorrFctnCollection->begin();
601  CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
602  StHbtCorrFctn* CorrFctn = *CorrFctnIter;
603  CorrFctn->AddMixedPair(ThePair);
604  }
605  } // if passed Pair cut
606  } // loop over second particle
607  } // loop over first particle
608 
609  delete ThePair;
610 
611 }
612 
613 //_________________________
614 void StHbtSectoredAnalysis::EventBegin(const StHbtEvent* ev){
615  mFirstParticleCut->EventBegin(ev);
616  mSecondParticleCut->EventBegin(ev);
617  mPairCut->EventBegin(ev);
618  for (StHbtCorrFctnIterator iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
619  (*iter)->EventBegin(ev);
620  }
621 }
622 //_________________________
623 void StHbtSectoredAnalysis::EventEnd(const StHbtEvent* ev){
624  mFirstParticleCut->EventBegin(ev);
625  mSecondParticleCut->EventBegin(ev);
626  mPairCut->EventEnd(ev);
627  for (StHbtCorrFctnIterator iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
628  (*iter)->EventEnd(ev);
629  }
630 }
631 //_________________________
632 void StHbtSectoredAnalysis::Finish(){
633  StHbtCorrFctnIterator iter;
634  for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
635  (*iter)->Finish();
636  }
637 }
638 //_________________________
639 void StHbtSectoredAnalysis::AddEventProcessed() {
640  mNeventsProcessed++;
641 }
642 
643 
virtual void ProcessEvent(const StHbtEvent *)
returns reports of all cuts applied and correlation functions being done