42 #include "StHbtMaker/Infrastructure/StHbtThreeParticleAnalysis.h"
43 #include "StHbtMaker/Infrastructure/StHbtParticleCollection.hh"
44 #include "StHbtMaker/Base/StHbtTrackCut.h"
45 #include "StHbtMaker/Base/StHbtV0Cut.h"
53 int Factorial(
int arg) {
55 for (
int i=arg; i>0; i--) fact*=i;
60 int StHbtThreeParticleAnalysis::Index(
int binx,
int biny,
int binz)
62 if (binx==-1 || binx==mNumBinsX || biny==-1 || biny==mNumBinsY || binz==-1 || binz==mNumBinsZ)
64 return binx + biny*mNumBinsX + binz*mNumBinsX*mNumBinsY;
72 void StHbtThreeParticleAnalysis::SortHbtParticleCollection(
StHbtParticleCut* partCut,
74 StHbtParticleCollection** SectoredPicoEvent)
77 switch (partCut->Type()) {
82 StHbtTrackIterator pIter;
83 StHbtTrackIterator startLoop = hbtEvent->TrackCollection()->begin();
84 StHbtTrackIterator endLoop = hbtEvent->TrackCollection()->end();
85 float pxave=0.0, pyave=0.0, pzave=0.0, pxhigh=0.0, pxlow=0.0, pyhigh=0.0, pylow=0.0, pzhigh=0.0, pzlow=0.0;
88 for (pIter=startLoop;pIter!=endLoop;pIter++){
90 bool tmpPassParticle = pCut->Pass(pParticle);
91 pCut->FillCutMonitor(pParticle, tmpPassParticle);
94 i = (int) floor((particle->FourMomentum().px()-mPXmin)/mDeltaP);
95 j = (int) floor((particle->FourMomentum().py()-mPYmin)/mDeltaP);
96 k = (int) floor((particle->FourMomentum().pz()-mPZmin)/mDeltaP);
97 if (particle->FourMomentum().px() > pxhigh) pxhigh = particle->FourMomentum().px();
98 if (particle->FourMomentum().px() < pxlow) pxlow = particle->FourMomentum().px();
99 if (particle->FourMomentum().py() > pyhigh) pyhigh = particle->FourMomentum().py();
100 if (particle->FourMomentum().py() < pylow) pylow = particle->FourMomentum().py();
101 if (particle->FourMomentum().pz() > pzhigh) pzhigh = particle->FourMomentum().pz();
102 if (particle->FourMomentum().pz() < pzlow) pzlow = particle->FourMomentum().pz();
103 if (i<mNumBinsX && j<mNumBinsY && k<mNumBinsZ && i>=0 && j>=0 && k>=0) {
104 SectoredPicoEvent[Index(i,j,k)]->push_back(particle);
105 pxave+=particle->FourMomentum().px();
106 pyave+=particle->FourMomentum().py();
107 pzave+=particle->FourMomentum().pz();
116 cout <<
"AVE px=" << pxave <<
" AVE py="<<pyave<<
" AVE pz="<<pzave<< endl;
117 cout <<
"HIGH px=" << pxhigh <<
" LOW px="<<pxlow<<
" HIGH py=" << pyhigh <<
" LOW py="<<pylow<<
" HIGH pz=" << pzhigh <<
" LOW pz="<<pzlow<<endl;
126 StHbtV0Iterator pIter;
127 StHbtV0Iterator startLoop = hbtEvent->V0Collection()->begin();
128 StHbtV0Iterator endLoop = hbtEvent->V0Collection()->end();
131 for (pIter=startLoop;pIter!=endLoop;pIter++){
133 bool tmpPassV0 = pCut->Pass(pParticle);
134 pCut->FillCutMonitor(pParticle, tmpPassV0);
137 i = (int) floor((particle->FourMomentum().px()-mPXmin)/mDeltaP);
138 j = (int) floor((particle->FourMomentum().py()-mPYmin)/mDeltaP);
139 k = (int) floor((particle->FourMomentum().pz()-mPZmin)/mDeltaP);
140 SectoredPicoEvent[Index(i,j,k)]->push_back(particle);
146 cout <<
"FillHbtParticleCollection function (in StHbtThreeParticleAnalysis.cxx) - undefined Particle Cut type!!! \n";
155 StHbtParticleCollection* partCollection);
159 StHbtThreeParticleAnalysis::StHbtThreeParticleAnalysis(){
162 mFirstParticleCut = 0;
163 mSecondParticleCut = 0;
164 mThirdParticleCut = 0;
166 mCorrFctnCollection= 0;
167 mNeventsProcessed = 0;
180 mCorrFctnCollection =
new StHbtCorrFctnCollection;
181 mMixingBuffer =
new StHbtPicoEventCollection;
182 mSectoredMixingBuffer =
new StHbtSectoredPicoEventCollection;
187 StHbtThreeParticleAnalysis::~StHbtThreeParticleAnalysis(){
190 delete mFirstParticleCut ;
191 delete mSecondParticleCut ;
192 delete mThirdParticleCut ;
195 StHbtCorrFctnIterator iter;
196 for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
199 delete mCorrFctnCollection;
201 StHbtPicoEventIterator piter;
202 for (piter=mMixingBuffer->begin();piter!=mMixingBuffer->end();piter++){
205 delete mMixingBuffer;
207 StHbtSectoredPicoEventIterator spiter;
208 for (spiter=mSectoredMixingBuffer->begin();spiter!=mSectoredMixingBuffer->end();spiter++){
211 delete mSectoredMixingBuffer;
213 mNeventsProcessed = 0;
215 if (mCalcCosPhi)
delete mCosPhiE;
219 if ( n<0 || n > (
int)mCorrFctnCollection->size() )
221 StHbtCorrFctnIterator iter=mCorrFctnCollection->begin();
222 for (
int i=0; i<n ;i++){
228 StHbtString StHbtThreeParticleAnalysis::Report()
231 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);
233 cout <<
"CosPhiAnalysis - constructing Report..."<<endl;
235 cout <<
"StHbtThreeParticleAnalysis - constructing Report..."<<endl;
236 string temp =
"-----------\nHbt Analysis Report:\n";
237 temp +=
"\nEvent Cuts:\n";
238 temp += mEventCut->Report();
239 temp +=
"\nParticle Cuts - First Particle:\n";
240 temp += mFirstParticleCut->Report();
241 temp +=
"\nParticle Cuts - Second Particle:\n";
242 temp += mSecondParticleCut->Report();
243 temp +=
"\nParticle Cuts - Third Particle:\n";
244 temp += mThirdParticleCut->Report();
245 temp +=
"\nTriplet Cuts:\n";
246 temp += mTripletCut->Report();
247 temp +=
"\nCorrelation Functions:\n";
248 StHbtCorrFctnIterator iter;
249 if ( mCorrFctnCollection->size()==0 ) {
250 cout <<
"StHbtThreeParticleAnalysis-Warning : no correlations functions in this analysis " << endl;
252 for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
253 temp += (*iter)->Report();
258 temp +=
"\nSectoring Information:\n";
261 temp +=
"-------------\n";
262 StHbtString returnThis=temp;
274 int NumTriplets=0, NumParticles, NumMixedParticles1, NumMixedParticles2;
275 double TotalRealTriplets, TotalMixedTriplets=0.0, Rate;
276 time_t TotalTime, StartTime;
278 EventBegin(hbtEvent);
280 bool tmpPassEvent = mEventCut->Pass(hbtEvent);
281 mEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
283 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent() - Event has passed cut - build picoEvent from " <<
284 hbtEvent->TrackCollection()->size() <<
" tracks in TrackCollection" << endl;
287 FillHbtParticleCollection(mFirstParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->FirstParticleCollection());
288 if ( !(AnalyzeIdenticalParticles()) ) {
289 FillHbtParticleCollection(mSecondParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->SecondParticleCollection());
290 FillHbtParticleCollection(mThirdParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->ThirdParticleCollection());}
291 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent - #particles in First, Second, Third Collections: " <<
292 picoEvent->FirstParticleCollection()->size() <<
" " <<
293 picoEvent->SecondParticleCollection()->size() <<
" " <<
294 picoEvent->ThirdParticleCollection()->size() << endl;
296 NumParticles = picoEvent->FirstParticleCollection()->size();
297 TotalRealTriplets = (NumParticles)*(NumParticles-1.0)*(NumParticles-2.0)/6.0;
307 StHbtParticleIterator PartIter1;
308 StHbtParticleIterator PartIter2;
309 StHbtParticleIterator PartIter3;
310 StHbtCorrFctnIterator CorrFctnIter;
311 StHbtParticleIterator StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
312 StHbtParticleIterator EndOuterLoop = picoEvent->FirstParticleCollection()->end();
313 StHbtParticleIterator StartMiddleLoop;
314 StHbtParticleIterator EndMiddleLoop;
315 StHbtParticleIterator StartInnerLoop;
316 StHbtParticleIterator EndInnerLoop;
318 if (NumParticles>2) {
319 if (AnalyzeIdenticalParticles()) {
322 EndMiddleLoop = picoEvent->FirstParticleCollection()->end() ;
324 EndInnerLoop = picoEvent->FirstParticleCollection()->end() ;
327 StartMiddleLoop = picoEvent->SecondParticleCollection()->begin();
328 EndMiddleLoop = picoEvent->SecondParticleCollection()->end() ;
329 StartInnerLoop = picoEvent->ThirdParticleCollection()->begin();
330 EndInnerLoop = picoEvent->ThirdParticleCollection()->end() ;
333 StartTime = time(NULL);
334 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
335 if (AnalyzeIdenticalParticles()){
336 StartMiddleLoop = PartIter1;
339 TheTriplet->SetTrack1(*PartIter1);
340 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
341 if (AnalyzeIdenticalParticles()){
342 StartInnerLoop = PartIter2;
345 TheTriplet->SetTrack2(*PartIter2);
346 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
347 TheTriplet->SetTrack3(*PartIter3);
353 if (mTripletCut->Pass(TheTriplet)){
355 for (CorrFctnIter=mCorrFctnCollection->begin();
356 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
358 CorrFctn->AddRealTriplet(TheTriplet);
368 TotalTime = time(NULL) - StartTime;
369 Rate = (double)NumTriplets/(
double)TotalTime;
371 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent() - reals done, " << NumTriplets <<
" triplets entered out of " << TotalRealTriplets <<
"." << endl;
372 cout <<
"Total time: " << TotalTime <<
"seconds. This is " << Rate <<
" triplets per second." << endl;
373 if (MixingBufferFull()){
374 cout <<
"Mixing Buffer is full - lets rock and roll" << endl;
377 cout <<
"Mixing Buffer not full -gotta wait " << MixingBuffer()->size() << endl;
380 if (MixingBufferFull()){
381 StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
382 EndOuterLoop = picoEvent->FirstParticleCollection()->end();
384 StHbtPicoEventIterator picoEventIter1;
385 StHbtPicoEventIterator BeginPicoEvent1;
386 StHbtPicoEventIterator EndPicoEvent1;
388 StHbtPicoEventIterator picoEventIter2;
389 StHbtPicoEventIterator BeginPicoEvent2;
390 StHbtPicoEventIterator EndPicoEvent2;
393 BeginPicoEvent1 = MixingBuffer()->begin();
394 EndPicoEvent1 = MixingBuffer()->end();
396 EndPicoEvent2 = MixingBuffer()->end();
398 StartTime = time(NULL);
399 for (picoEventIter1=BeginPicoEvent1;picoEventIter1!=EndPicoEvent1;picoEventIter1++){
400 cout <<
"Outer Event Done" << endl;
401 BeginPicoEvent2 = picoEventIter1;
403 for (picoEventIter2=BeginPicoEvent2;picoEventIter2!=EndPicoEvent2;picoEventIter2++){
404 storedEvent1 = *picoEventIter1;
405 storedEvent2 = *picoEventIter2;
406 if (AnalyzeIdenticalParticles()){
407 StartMiddleLoop = storedEvent1->FirstParticleCollection()->begin();
408 EndMiddleLoop = storedEvent1->FirstParticleCollection()->end();
409 StartInnerLoop = storedEvent2->FirstParticleCollection()->begin();
410 EndInnerLoop = storedEvent2->FirstParticleCollection()->end();
414 StartMiddleLoop = storedEvent1->SecondParticleCollection()->begin();
415 EndMiddleLoop = storedEvent1->SecondParticleCollection()->end();
416 StartInnerLoop = storedEvent2->ThirdParticleCollection()->begin();
417 EndInnerLoop = storedEvent2->ThirdParticleCollection()->end();
420 NumMixedParticles1 = storedEvent1->FirstParticleCollection()->size();
421 NumMixedParticles2 = storedEvent2->FirstParticleCollection()->size();
422 TotalMixedTriplets += NumParticles*NumMixedParticles1*NumMixedParticles2;
424 if (NumMixedParticles1>0 && NumMixedParticles2>0) {
425 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
426 TheTriplet->SetTrack1(*PartIter1);
427 for (PartIter2=StartMiddleLoop;PartIter2!=EndMiddleLoop;PartIter2++){
428 TheTriplet->SetTrack2(*PartIter2);
429 for (PartIter3=StartInnerLoop;PartIter3!=EndInnerLoop;PartIter3++){
430 TheTriplet->SetTrack3(*PartIter3);
431 if (mTripletCut->Pass(TheTriplet)){
434 for (CorrFctnIter=mCorrFctnCollection->begin();
435 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
437 CorrFctn->AddMixedTriplet(TheTriplet);
448 TotalTime = time(NULL) - StartTime;
449 Rate = NumTriplets/(double)TotalTime;
452 picoEventIter1 = MixingBuffer()->end();
454 delete *picoEventIter1;
455 MixingBuffer()->pop_back();
458 MixingBuffer()->push_front(picoEvent);
461 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent() - return to caller ... " << NumTriplets <<
" triplets out of " << TotalMixedTriplets <<
" in mixing buffer." << endl;
462 cout <<
"Total time: " << TotalTime <<
"seconds. This is " << Rate <<
" triplets per second." << endl;
466 double C2Q12,C2Q23,C2Q31,C3,arg1,arg2,arg3,arg4,cosphi,cosphiError,termt;
467 int bin1,bin2,bin3,bin4;
469 bool tmpPassEvent = mEventCut->Pass(hbtEvent);
470 mEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
472 cout <<
"StHbtThreeParticleAnalysis::ProcessCosPhi() - Event has passed cut - build picoEvent from " <<
473 hbtEvent->TrackCollection()->size() <<
" tracks in TrackCollection" << endl;
476 FillHbtParticleCollection(mFirstParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->FirstParticleCollection());
477 if ( !(AnalyzeIdenticalParticles()) ) {
478 FillHbtParticleCollection(mSecondParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->SecondParticleCollection());
479 FillHbtParticleCollection(mThirdParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->ThirdParticleCollection());}
480 cout <<
"StHbtThreeParticleAnalysis::ProcessCosPhi - #particles in First, Second, Third Collections: " <<
481 picoEvent->FirstParticleCollection()->size() <<
" " <<
482 picoEvent->SecondParticleCollection()->size() <<
" " <<
483 picoEvent->ThirdParticleCollection()->size() << endl;
493 if (picoEvent->FirstParticleCollection()->size()>2) {
495 StHbtParticleIterator PartIter1;
496 StHbtParticleIterator PartIter2;
497 StHbtParticleIterator PartIter3;
498 StHbtParticleIterator StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
499 StHbtParticleIterator EndOuterLoop = picoEvent->FirstParticleCollection()->end();
500 StHbtParticleIterator StartMiddleLoop;
501 StHbtParticleIterator EndMiddleLoop;
502 StHbtParticleIterator StartInnerLoop;
503 StHbtParticleIterator EndInnerLoop;
504 if (AnalyzeIdenticalParticles()) {
507 EndMiddleLoop = picoEvent->FirstParticleCollection()->end() ;
509 EndInnerLoop = picoEvent->FirstParticleCollection()->end() ;
512 StartMiddleLoop = picoEvent->SecondParticleCollection()->begin();
513 EndMiddleLoop = picoEvent->SecondParticleCollection()->end() ;
514 StartInnerLoop = picoEvent->ThirdParticleCollection()->begin();
515 EndInnerLoop = picoEvent->ThirdParticleCollection()->end() ;
517 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
518 if (AnalyzeIdenticalParticles()){
519 StartMiddleLoop = PartIter1;
522 TheTriplet->SetTrack1(*PartIter1);
523 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
524 if (AnalyzeIdenticalParticles()){
525 StartInnerLoop = PartIter2;
528 TheTriplet->SetTrack2(*PartIter2);
529 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
530 TheTriplet->SetTrack3(*PartIter3);
531 if (mTripletCut->Pass(TheTriplet)){
532 bin1 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv12());
533 bin2 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv23());
534 bin3 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv31());
535 bin4 = mQ3CF->GetXaxis()->FindBin(TheTriplet->qInv());
537 C2Q12 = mQ2CF->GetBinContent(bin1);
538 C2Q23 = mQ2CF->GetBinContent(bin2);
539 C2Q31 = mQ2CF->GetBinContent(bin3);
540 C3 = mNormFactor*(mQ3CF->GetBinContent(bin4));
542 termt = ::sqrt(fabs((C2Q12-1.0)*(C2Q23-1.0)*(C2Q31-1.0)));
544 cosphi = ((C3-1.0) - (C2Q12-1.0) - (C2Q23-1.0) - (C2Q31-1.0))/(2.0*termt);
546 arg1 = mQ3CF->GetBinError(bin4);
547 arg2 = mQ2CF->GetBinError(bin1)*(1.0 + (C2Q23-1.0)*(C2Q31-1.0)*cosphi/termt);
548 arg3 = mQ2CF->GetBinError(bin2)*(1.0 + (C2Q31-1.0)*(C2Q12-1.0)*cosphi/termt);
549 arg4 = mQ2CF->GetBinError(bin3)*(1.0 + (C2Q12-1.0)*(C2Q23-1.0)*cosphi/termt);
550 cosphiError = (1.0/(2.0*termt))*::sqrt(arg1*arg1+arg2*arg2+arg3*arg3+arg4*arg4);
558 mCosPhi->AddBinContent(bin4, cosphi);
559 mCosPhiE->AddBinContent(bin4, cosphiError);
560 mCosPhiN->AddBinContent(bin4);
566 cout <<
"StHbtThreeParticleAnalysis::ProcessCosPhi() - done" << endl;
573 cout <<
"StHbtThreeParticleAnalysis::ProcessCosPhi() - return to caller ... " << endl;
582 int NumTriplets=0, NumParticles, i, j, k, i2, j2, k2, i3, j3, k3;
583 int size1=0, size2=0, size3=0;
584 double TotalRealTriplets, Rate;
585 time_t TotalTime, StartTime;
588 EventBegin(hbtEvent);
590 bool tmpPassEvent = mEventCut->Pass(hbtEvent);
591 mEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
593 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent() - Event has passed cut - build sectoredpicoEvent from " <<
594 hbtEvent->TrackCollection()->size() <<
" tracks in TrackCollection" << endl;
600 SortHbtParticleCollection(mFirstParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->FirstSectoredCollection());
601 if ( !(AnalyzeIdenticalParticles()) ) {
602 SortHbtParticleCollection(mSecondParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->SecondSectoredCollection());
603 SortHbtParticleCollection(mThirdParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->ThirdSectoredCollection());
606 for (k=0; k<mNumBinsZ; k++)
607 for (j=0; j<mNumBinsY; j++)
608 for (i=0; i<mNumBinsX; i++) {
609 size1 += picoEvent->FirstSectoredCollection()[Index(i,j,k)]->size();
611 if ( !(AnalyzeIdenticalParticles()) ) {
612 size2 += picoEvent->SecondSectoredCollection()[Index(i,j,k)]->size();
613 size3 += picoEvent->ThirdSectoredCollection()[Index(i,j,k)]->size();
617 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent (Sect) - #particles in First, Second, Third Collections: " <<
618 size1 <<
" " << size2 <<
" " << size3 << endl;
620 NumParticles = size1;
621 TotalRealTriplets = (NumParticles)*(NumParticles-1.0)*(NumParticles-2.0)/6.0;
623 StartTime = time(NULL);
625 if (AnalyzeIdenticalParticles()) {
627 for (k=0; k<mNumBinsZ; k++)
628 for (j=0; j<mNumBinsY; j++)
629 for (i=0; i<mNumBinsX; i++) {
633 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1));
634 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1), Index(i-1,j,k+1));
635 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1), Index(i,j-1,k+1));
636 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1), Index(i,j,k+1));
638 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j-1,k+1));
639 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i-1,j,k+1));
640 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i+1,j-1,k+1));
641 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i,j,k+1));
642 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i+1,j,k));
643 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i+1,j,k+1));
645 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1));
646 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1), Index(i,j,k+1));
647 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1), Index(i+1,j,k));
648 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1), Index(i+1,j,k+1));
650 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j,k+1));
651 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i-1,j+1,k));
652 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i-1,j+1,k+1));
653 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i,j,k+1));
654 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i,j+1,k));
655 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i,j+1,k+1));
657 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1));
658 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i-1,j+1,k));
659 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i-1,j+1,k+1));
660 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i,j+1,k));
661 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i,j+1,k+1));
662 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j,k));
663 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j,k+1));
664 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j+1,k));
665 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j+1,k+1));
667 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j,k+1));
668 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i,j+1,k));
669 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i,j+1,k+1));
670 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i+1,j,k));
671 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i+1,j+1,k));
672 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i+1,j+1,k+1));
674 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1));
675 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1), Index(i-1,j+1,k));
676 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1), Index(i,j+1,k));
677 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1), Index(i,j+1,k+1));
679 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k+1));
680 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i-1,j+1,k));
681 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i,j+1,k));
682 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i+1,j,k));
683 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i+1,j+1,k));
684 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i+1,j+1,k+1));
686 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1));
687 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1), Index(i,j+1,k));
688 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1), Index(i+1,j,k));
689 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1), Index(i+1,j+1,k));
692 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j+1,k));
693 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i-1,j+1,k), Index(i,j+1,k));
695 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k));
696 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k), Index(i+1,j,k));
697 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i,j+1,k), Index(i+1,j+1,k));
699 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j+1,k));
700 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j+1,k), Index(i+1,j,k));
703 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k), Index(i+1,j,k));
706 NumTriplets+=CreateRealTriplets(picoEvent, Index(i,j,k));
708 cout <<
"done" << endl;
712 for (i=0; i<mNumBinsX; i++)
713 for (j=0; j<mNumBinsY; j++)
714 for (k=0; k<mNumBinsZ; k++)
715 for (i2=i-1; i2<i+1; i2++)
716 for (j2=j-1; j2<j+1; j2++)
717 for (k2=k-1; k2<k+1; k2++)
718 if (i2<mNumBinsX && j2<mNumBinsY && k2<mNumBinsZ && i2!=-1 && j2!=-1 && k2!=-1)
719 for (i3=i-1; i3<i+1; i3++)
720 for (j3=j-1; j3<j+1; j3++)
721 for (k3=k-1; k3<k+1; k3++)
722 if (i3<mNumBinsX && j3<mNumBinsY && k3<mNumBinsZ && i3!=-1 && j3!=-1 && k3!=-1)
723 CreateRealTriplets(picoEvent, Index(i,j,k), Index(i2,j2,k2), Index(i3,j3,k3));
726 TotalTime = time(NULL) - StartTime;
727 Rate = (double)NumTriplets/(
double)TotalTime;
729 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent() (Sect) - reals done, " << NumTriplets <<
" triplets entered out of " << (int)TotalRealTriplets <<
"." << endl;
730 cout <<
"Total time: " << TotalTime <<
"seconds. This is " << Rate <<
" triplets per second." << endl;
734 if (SectoredMixingBufferFull()){
735 cout <<
"Mixing Buffer is full - lets rock and roll" << endl;
738 cout <<
"Mixing Buffer not full -gotta wait " << SectoredMixingBuffer()->size() << endl;
741 if (SectoredMixingBufferFull()){
743 StHbtSectoredPicoEventIterator picoEventIter1;
744 StHbtSectoredPicoEventIterator BeginPicoEvent1;
745 StHbtSectoredPicoEventIterator EndPicoEvent1;
747 StHbtSectoredPicoEventIterator picoEventIter2;
748 StHbtSectoredPicoEventIterator BeginPicoEvent2;
749 StHbtSectoredPicoEventIterator EndPicoEvent2;
751 BeginPicoEvent1 = SectoredMixingBuffer()->begin();
752 EndPicoEvent1 = SectoredMixingBuffer()->end();
754 EndPicoEvent2 = SectoredMixingBuffer()->end();
756 StartTime = time(NULL);
757 for (picoEventIter1=BeginPicoEvent1;picoEventIter1!=EndPicoEvent1;picoEventIter1++){
758 BeginPicoEvent2 = picoEventIter1;
760 for (picoEventIter2=BeginPicoEvent2;picoEventIter2!=EndPicoEvent2;picoEventIter2++){
761 storedEvent1 = *picoEventIter1;
762 storedEvent2 = *picoEventIter2;
763 if (AnalyzeIdenticalParticles()){
765 for (i=0; i<mNumBinsX; i++)
766 for (j=0; j<mNumBinsY; j++)
767 for (k=0; k<mNumBinsZ; k++)
768 for (i2=i-1; i2<=i+1; i2++)
769 for (j2=j-1; j2<=j+1; j2++)
770 for (k2=k-1; k2<=k+1; k2++)
771 if (i2<mNumBinsX && j2<mNumBinsY && k2<mNumBinsZ && i2!=-1 && j2!=-1 && k2!=-1)
772 for (i3=i-1; i3<=i+1; i3++)
773 for (j3=j-1; j3<=j+1; j3++)
774 for (k3=k-1; k3<=k+1; k3++)
775 if (i3<mNumBinsX && j3<mNumBinsY && k3<mNumBinsZ && i3!=-1 && j3!=-1 && k3!=-1 && i3!=i2-2 && i3!=i2+2 && j3!=j2-2 && j3!=j2+2 && k3!=k2-2 && k3!=k2+2)
776 NumTriplets+=CreateMixedTriplets(picoEvent->FirstSectoredCollection()[Index(i,j,k)], storedEvent1->FirstSectoredCollection()[Index(i2,j2,k2)], storedEvent2->FirstSectoredCollection()[Index(i3,j3,k3)]);
781 for (i=0; i<mNumBinsX; i++)
782 for (j=0; j<mNumBinsY; j++)
783 for (k=0; k<mNumBinsZ; k++)
784 for (i2=i-1; i2<i+1; i2++)
785 for (j2=j-1; j2<j+1; j2++)
786 for (k2=k-1; k2<k+1; k2++)
787 if (i2<mNumBinsX && j2<mNumBinsY && k2<mNumBinsZ && i2!=-1 && j2!=-1 && k2!=-1)
788 for (i3=i-1; i3<i+1; i3++)
789 for (j3=j-1; j3<j+1; j3++)
790 for (k3=k-1; k3<k+1; k3++)
791 if (i3<mNumBinsX && j3<mNumBinsY && k3<mNumBinsZ && i3!=-1 && j3!=-1 && k3!=-1)
792 CreateMixedTriplets(picoEvent->FirstSectoredCollection()[Index(i,j,k)], storedEvent1->SecondSectoredCollection()[Index(i2,j2,k2)], storedEvent2->ThirdSectoredCollection()[Index(i3,j3,k3)]);
797 TotalTime = time(NULL) - StartTime;
798 Rate = NumTriplets/(double)TotalTime;
802 picoEventIter1 = SectoredMixingBuffer()->end();
804 delete *picoEventIter1;
806 SectoredMixingBuffer()->pop_back();
808 SectoredMixingBuffer()->push_front(picoEvent);
811 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent() (Sect) - return to caller ... " << NumTriplets <<
" triplets out of about " << size1*size1*size1 <<
" in mixing buffer." << endl;
812 cout <<
"Total time: " << TotalTime <<
"seconds. This is " << Rate <<
" triplets per second." << endl;
817 int NumTriplets=0, NumParticles, i, j, k, i2, j2, k2, i3, j3, k3;
818 int size1=0, size2=0, size3=0;
819 double TotalRealTriplets, Rate;
820 time_t TotalTime, StartTime;
823 bool tmpPassEvent = mEventCut->Pass(hbtEvent);
824 mEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
826 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent() - Event has passed cut - build sectoredpicoEvent from " <<
827 hbtEvent->TrackCollection()->size() <<
" tracks in TrackCollection" << endl;
833 SortHbtParticleCollection(mFirstParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->FirstSectoredCollection());
834 if ( !(AnalyzeIdenticalParticles()) ) {
835 SortHbtParticleCollection(mSecondParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->SecondSectoredCollection());
836 SortHbtParticleCollection(mThirdParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->ThirdSectoredCollection());
839 for (k=0; k<mNumBinsZ; k++)
840 for (j=0; j<mNumBinsY; j++)
841 for (i=0; i<mNumBinsX; i++) {
842 size1 += picoEvent->FirstSectoredCollection()[Index(i,j,k)]->size();
844 if ( !(AnalyzeIdenticalParticles()) ) {
845 size2 += picoEvent->SecondSectoredCollection()[Index(i,j,k)]->size();
846 size3 += picoEvent->ThirdSectoredCollection()[Index(i,j,k)]->size();
850 cout <<
"StHbtThreeParticleAnalysis::ProcessEvent (Sect) - #particles in First, Second, Third Collections: " <<
851 size1 <<
" " << size2 <<
" " << size3 << endl;
853 NumParticles = size1;
854 TotalRealTriplets = (NumParticles)*(NumParticles-1.0)*(NumParticles-2.0)/6.0;
856 StartTime = time(NULL);
858 if (AnalyzeIdenticalParticles()) {
860 for (k=0; k<mNumBinsZ; k++)
861 for (j=0; j<mNumBinsY; j++)
862 for (i=0; i<mNumBinsX; i++) {
866 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1));
867 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1), Index(i-1,j,k+1));
868 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1), Index(i,j-1,k+1));
869 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j-1,k+1), Index(i,j,k+1));
871 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j-1,k+1));
872 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i-1,j,k+1));
873 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i+1,j-1,k+1));
874 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i,j,k+1));
875 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i+1,j,k));
876 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j-1,k+1), Index(i+1,j,k+1));
878 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1));
879 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1), Index(i,j,k+1));
880 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1), Index(i+1,j,k));
881 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j-1,k+1), Index(i+1,j,k+1));
883 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j,k+1));
884 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i-1,j+1,k));
885 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i-1,j+1,k+1));
886 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i,j,k+1));
887 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i,j+1,k));
888 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j,k+1), Index(i,j+1,k+1));
890 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1));
891 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i-1,j+1,k));
892 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i-1,j+1,k+1));
893 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i,j+1,k));
894 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i,j+1,k+1));
895 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j,k));
896 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j,k+1));
897 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j+1,k));
898 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j,k+1), Index(i+1,j+1,k+1));
900 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j,k+1));
901 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i,j+1,k));
902 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i,j+1,k+1));
903 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i+1,j,k));
904 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i+1,j+1,k));
905 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j,k+1), Index(i+1,j+1,k+1));
907 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1));
908 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1), Index(i-1,j+1,k));
909 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1), Index(i,j+1,k));
910 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j+1,k+1), Index(i,j+1,k+1));
912 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k+1));
913 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i-1,j+1,k));
914 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i,j+1,k));
915 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i+1,j,k));
916 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i+1,j+1,k));
917 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k+1), Index(i+1,j+1,k+1));
919 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1));
920 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1), Index(i,j+1,k));
921 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1), Index(i+1,j,k));
922 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j+1,k+1), Index(i+1,j+1,k));
925 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j+1,k));
926 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i-1,j+1,k), Index(i,j+1,k));
928 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k));
929 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k), Index(i+1,j,k));
930 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i,j+1,k), Index(i+1,j+1,k));
932 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j+1,k));
933 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j+1,k), Index(i+1,j,k));
936 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k), Index(i+1,j,k));
939 NumTriplets+=CalculateCosPhi(picoEvent, Index(i,j,k));
941 cout <<
"done" << endl;
945 for (i=0; i<mNumBinsX; i++)
946 for (j=0; j<mNumBinsY; j++)
947 for (k=0; k<mNumBinsZ; k++)
948 for (i2=i-1; i2<i+1; i2++)
949 for (j2=j-1; j2<j+1; j2++)
950 for (k2=k-1; k2<k+1; k2++)
951 if (i2<mNumBinsX && j2<mNumBinsY && k2<mNumBinsZ && i2!=-1 && j2!=-1 && k2!=-1)
952 for (i3=i-1; i3<i+1; i3++)
953 for (j3=j-1; j3<j+1; j3++)
954 for (k3=k-1; k3<k+1; k3++)
955 if (i3<mNumBinsX && j3<mNumBinsY && k3<mNumBinsZ && i3!=-1 && j3!=-1 && k3!=-1)
956 CalculateCosPhi(picoEvent, Index(i,j,k), Index(i2,j2,k2), Index(i3,j3,k3));
959 TotalTime = time(NULL) - StartTime;
960 Rate = (double)NumTriplets/(
double)TotalTime;
962 cout <<
"StHbtThreeParticleAnalysis::ProcessCosPhi() (Sect) - done, " << NumTriplets <<
" triplets entered out of " << (int)TotalRealTriplets <<
"." << endl;
963 cout <<
"Total time: " << TotalTime <<
"seconds. This is " << Rate <<
" triplets per second." << endl;
968 cout <<
"StHbtThreeParticleAnalysis::ProcessCosPhi() (Sect) - return to caller ... " << endl;
980 StHbtParticleCollection *partColl1 = picoEvent->FirstSectoredCollection()[Index1];
982 if (partColl1->size()<3)
return 0;
986 StHbtParticleIterator PartIter1;
987 StHbtParticleIterator PartIter2;
988 StHbtParticleIterator PartIter3;
989 StHbtCorrFctnIterator CorrFctnIter;
990 StHbtParticleIterator StartOuterLoop = partColl1->begin();
991 StHbtParticleIterator EndOuterLoop = partColl1->end();
992 StHbtParticleIterator StartMiddleLoop;
993 StHbtParticleIterator EndMiddleLoop;
994 StHbtParticleIterator StartInnerLoop;
995 StHbtParticleIterator EndInnerLoop;
999 EndMiddleLoop = partColl1->end() ;
1001 EndInnerLoop = partColl1->end() ;
1003 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1004 StartMiddleLoop = PartIter1;
1006 TheTriplet->SetTrack1(*PartIter1);
1007 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1008 StartInnerLoop = PartIter2;
1010 TheTriplet->SetTrack2(*PartIter2);
1011 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1012 TheTriplet->SetTrack3(*PartIter3);
1018 if (mTripletCut->Pass(TheTriplet)){
1020 for (CorrFctnIter=mCorrFctnCollection->begin();
1021 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
1023 CorrFctn->AddRealTriplet(TheTriplet);
1039 int StHbtThreeParticleAnalysis::CreateRealTriplets(
StHbtSectoredPicoEvent *picoEvent,
int Index1,
int Index2) {
1043 if (Index1==-1 || Index2==-1)
return 0;
1045 StHbtParticleCollection *partColl1 = picoEvent->FirstSectoredCollection()[Index1];
1046 StHbtParticleCollection *partColl2 = picoEvent->FirstSectoredCollection()[Index2];
1052 if (partColl1->size()>=2 && partColl2->size()>=1) {
1054 StHbtParticleIterator PartIter1;
1055 StHbtParticleIterator PartIter2;
1056 StHbtParticleIterator PartIter3;
1057 StHbtCorrFctnIterator CorrFctnIter;
1058 StHbtParticleIterator StartOuterLoop = partColl1->begin();
1059 StHbtParticleIterator EndOuterLoop = partColl1->end();
1060 StHbtParticleIterator StartMiddleLoop;
1061 StHbtParticleIterator EndMiddleLoop = partColl1->end();
1062 StHbtParticleIterator StartInnerLoop = partColl2->begin();
1063 StHbtParticleIterator EndInnerLoop = partColl2->end();
1067 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1068 StartMiddleLoop = PartIter1;
1070 TheTriplet->SetTrack1(*PartIter1);
1071 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1072 TheTriplet->SetTrack2(*PartIter2);
1073 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1074 TheTriplet->SetTrack3(*PartIter3);
1080 if (mTripletCut->Pass(TheTriplet)){
1082 for (CorrFctnIter=mCorrFctnCollection->begin();
1083 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
1085 CorrFctn->AddRealTriplet(TheTriplet);
1097 if (partColl1->size()>=1 && partColl2->size()>=2) {
1099 StHbtParticleIterator PartIter1;
1100 StHbtParticleIterator PartIter2;
1101 StHbtParticleIterator PartIter3;
1102 StHbtCorrFctnIterator CorrFctnIter;
1103 StHbtParticleIterator StartOuterLoop = partColl2->begin();
1104 StHbtParticleIterator EndOuterLoop = partColl2->end();
1105 StHbtParticleIterator StartMiddleLoop;
1106 StHbtParticleIterator EndMiddleLoop = partColl2->end();
1107 StHbtParticleIterator StartInnerLoop = partColl1->begin();
1108 StHbtParticleIterator EndInnerLoop = partColl1->end();
1112 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1113 StartMiddleLoop = PartIter1;
1115 TheTriplet->SetTrack1(*PartIter1);
1116 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1117 TheTriplet->SetTrack2(*PartIter2);
1118 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1119 TheTriplet->SetTrack3(*PartIter3);
1125 if (mTripletCut->Pass(TheTriplet)){
1127 for (CorrFctnIter=mCorrFctnCollection->begin();
1128 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
1130 CorrFctn->AddRealTriplet(TheTriplet);
1147 int StHbtThreeParticleAnalysis::CreateRealTriplets(
StHbtSectoredPicoEvent *picoEvent,
int Index1,
int Index2,
int Index3) {
1151 if (Index1==-1 || Index2==-1 || Index3==-1)
return 0;
1153 StHbtParticleCollection *partColl1 = picoEvent->FirstSectoredCollection()[Index1];
1154 StHbtParticleCollection *partColl2 = picoEvent->FirstSectoredCollection()[Index2];
1155 StHbtParticleCollection *partColl3 = picoEvent->FirstSectoredCollection()[Index3];
1157 if (!partColl1->size() || !partColl2->size() || !partColl2->size())
return 0;
1161 StHbtParticleIterator PartIter1;
1162 StHbtParticleIterator PartIter2;
1163 StHbtParticleIterator PartIter3;
1164 StHbtCorrFctnIterator CorrFctnIter;
1165 StHbtParticleIterator StartOuterLoop = partColl1->begin();
1166 StHbtParticleIterator EndOuterLoop = partColl1->end();
1167 StHbtParticleIterator StartMiddleLoop = partColl2->begin();
1168 StHbtParticleIterator EndMiddleLoop = partColl2->end();
1169 StHbtParticleIterator StartInnerLoop = partColl3->begin();
1170 StHbtParticleIterator EndInnerLoop = partColl3->end();
1172 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1173 TheTriplet->SetTrack1(*PartIter1);
1174 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1175 TheTriplet->SetTrack2(*PartIter2);
1176 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1177 TheTriplet->SetTrack3(*PartIter3);
1183 if (mTripletCut->Pass(TheTriplet)){
1185 for (CorrFctnIter=mCorrFctnCollection->begin();
1186 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
1188 CorrFctn->AddRealTriplet(TheTriplet);
1205 double C2Q12,C2Q23,C2Q31,C3,arg1,arg2,arg3,arg4,cosphi,cosphiError,termt;
1206 int bin1,bin2,bin3,bin4,NumTriplets=0;
1208 StHbtParticleCollection *partColl1 = picoEvent->FirstSectoredCollection()[Index1];
1210 if (partColl1->size()<3)
return 0;
1214 StHbtParticleIterator PartIter1;
1215 StHbtParticleIterator PartIter2;
1216 StHbtParticleIterator PartIter3;
1217 StHbtParticleIterator StartOuterLoop = partColl1->begin();
1218 StHbtParticleIterator EndOuterLoop = partColl1->end();
1219 StHbtParticleIterator StartMiddleLoop;
1220 StHbtParticleIterator EndMiddleLoop;
1221 StHbtParticleIterator StartInnerLoop;
1222 StHbtParticleIterator EndInnerLoop;
1226 EndMiddleLoop = partColl1->end() ;
1228 EndInnerLoop = partColl1->end() ;
1230 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1231 StartMiddleLoop = PartIter1;
1233 TheTriplet->SetTrack1(*PartIter1);
1234 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1235 StartInnerLoop = PartIter2;
1237 TheTriplet->SetTrack2(*PartIter2);
1238 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1239 TheTriplet->SetTrack3(*PartIter3);
1245 if (mTripletCut->Pass(TheTriplet)){
1247 bin1 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv12());
1248 bin2 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv23());
1249 bin3 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv31());
1250 bin4 = mQ3CF->GetXaxis()->FindBin(TheTriplet->qInv());
1252 C2Q12 = mQ2CF->GetBinContent(bin1);
1253 C2Q23 = mQ2CF->GetBinContent(bin2);
1254 C2Q31 = mQ2CF->GetBinContent(bin3);
1255 C3 = mNormFactor*(mQ3CF->GetBinContent(bin4));
1257 termt = ::sqrt(fabs((C2Q12-1.0)*(C2Q23-1.0)*(C2Q31-1.0)));
1259 cosphi = ((C3-1.0) - (C2Q12-1.0) - (C2Q23-1.0) - (C2Q31-1.0))/(2.0*termt);
1260 arg1 = mQ3CF->GetBinError(bin4);
1261 arg2 = mQ2CF->GetBinError(bin1)*(1.0 + (C2Q23-1.0)*(C2Q31-1.0)*cosphi/termt);
1262 arg3 = mQ2CF->GetBinError(bin2)*(1.0 + (C2Q31-1.0)*(C2Q12-1.0)*cosphi/termt);
1263 arg4 = mQ2CF->GetBinError(bin3)*(1.0 + (C2Q12-1.0)*(C2Q23-1.0)*cosphi/termt);
1264 cosphiError = (1.0/(2.0*termt))*::sqrt(arg1*arg1+arg2*arg2+arg3*arg3+arg4*arg4);
1271 mCosPhi->AddBinContent(bin4, cosphi);
1272 mCosPhiE->AddBinContent(bin4, cosphiError);
1273 mCosPhiN->AddBinContent(bin4);
1289 int StHbtThreeParticleAnalysis::CalculateCosPhi(
StHbtSectoredPicoEvent *picoEvent,
int Index1,
int Index2) {
1291 double C2Q12,C2Q23,C2Q31,C3,arg1,arg2,arg3,arg4,cosphi,cosphiError,termt;
1292 int bin1,bin2,bin3,bin4,NumTriplets=0;
1294 if (Index1==-1 || Index2==-1)
return 0;
1296 StHbtParticleCollection *partColl1 = picoEvent->FirstSectoredCollection()[Index1];
1297 StHbtParticleCollection *partColl2 = picoEvent->FirstSectoredCollection()[Index2];
1303 if (partColl1->size()>=2 && partColl2->size()>=1) {
1305 StHbtParticleIterator PartIter1;
1306 StHbtParticleIterator PartIter2;
1307 StHbtParticleIterator PartIter3;
1308 StHbtParticleIterator StartOuterLoop = partColl1->begin();
1309 StHbtParticleIterator EndOuterLoop = partColl1->end();
1310 StHbtParticleIterator StartMiddleLoop;
1311 StHbtParticleIterator EndMiddleLoop = partColl1->end();
1312 StHbtParticleIterator StartInnerLoop = partColl2->begin();
1313 StHbtParticleIterator EndInnerLoop = partColl2->end();
1317 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1318 StartMiddleLoop = PartIter1;
1320 TheTriplet->SetTrack1(*PartIter1);
1321 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1322 TheTriplet->SetTrack2(*PartIter2);
1323 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1324 TheTriplet->SetTrack3(*PartIter3);
1330 if (mTripletCut->Pass(TheTriplet)){
1332 bin1 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv12());
1333 bin2 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv23());
1334 bin3 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv31());
1335 bin4 = mQ3CF->GetXaxis()->FindBin(TheTriplet->qInv());
1337 C2Q12 = mQ2CF->GetBinContent(bin1);
1338 C2Q23 = mQ2CF->GetBinContent(bin2);
1339 C2Q31 = mQ2CF->GetBinContent(bin3);
1340 C3 = mNormFactor*(mQ3CF->GetBinContent(bin4));
1342 termt = ::sqrt(fabs((C2Q12-1.0)*(C2Q23-1.0)*(C2Q31-1.0)));
1344 cosphi = ((C3-1.0) - (C2Q12-1.0) - (C2Q23-1.0) - (C2Q31-1.0))/(2.0*termt);
1345 arg1 = mQ3CF->GetBinError(bin4);
1346 arg2 = mQ2CF->GetBinError(bin1)*(1.0 + (C2Q23-1.0)*(C2Q31-1.0)*cosphi/termt);
1347 arg3 = mQ2CF->GetBinError(bin2)*(1.0 + (C2Q31-1.0)*(C2Q12-1.0)*cosphi/termt);
1348 arg4 = mQ2CF->GetBinError(bin3)*(1.0 + (C2Q12-1.0)*(C2Q23-1.0)*cosphi/termt);
1349 cosphiError = (1.0/(2.0*termt))*::sqrt(arg1*arg1+arg2*arg2+arg3*arg3+arg4*arg4);
1356 mCosPhi->AddBinContent(bin4, cosphi);
1357 mCosPhiE->AddBinContent(bin4, cosphiError);
1358 mCosPhiN->AddBinContent(bin4);
1370 if (partColl1->size()>=1 && partColl2->size()>=2) {
1372 StHbtParticleIterator PartIter1;
1373 StHbtParticleIterator PartIter2;
1374 StHbtParticleIterator PartIter3;
1375 StHbtParticleIterator StartOuterLoop = partColl2->begin();
1376 StHbtParticleIterator EndOuterLoop = partColl2->end();
1377 StHbtParticleIterator StartMiddleLoop;
1378 StHbtParticleIterator EndMiddleLoop = partColl2->end();
1379 StHbtParticleIterator StartInnerLoop = partColl1->begin();
1380 StHbtParticleIterator EndInnerLoop = partColl1->end();
1384 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1385 StartMiddleLoop = PartIter1;
1387 TheTriplet->SetTrack1(*PartIter1);
1388 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1389 TheTriplet->SetTrack2(*PartIter2);
1390 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1391 TheTriplet->SetTrack3(*PartIter3);
1397 if (mTripletCut->Pass(TheTriplet)){
1399 bin1 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv12());
1400 bin2 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv23());
1401 bin3 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv31());
1402 bin4 = mQ3CF->GetXaxis()->FindBin(TheTriplet->qInv());
1404 C2Q12 = mQ2CF->GetBinContent(bin1);
1405 C2Q23 = mQ2CF->GetBinContent(bin2);
1406 C2Q31 = mQ2CF->GetBinContent(bin3);
1407 C3 = mNormFactor*(mQ3CF->GetBinContent(bin4));
1409 termt = ::sqrt(fabs((C2Q12-1.0)*(C2Q23-1.0)*(C2Q31-1.0)));
1411 cosphi = ((C3-1.0) - (C2Q12-1.0) - (C2Q23-1.0) - (C2Q31-1.0))/(2.0*termt);
1412 arg1 = mQ3CF->GetBinError(bin4);
1413 arg2 = mQ2CF->GetBinError(bin1)*(1.0 + (C2Q23-1.0)*(C2Q31-1.0)*cosphi/termt);
1414 arg3 = mQ2CF->GetBinError(bin2)*(1.0 + (C2Q31-1.0)*(C2Q12-1.0)*cosphi/termt);
1415 arg4 = mQ2CF->GetBinError(bin3)*(1.0 + (C2Q12-1.0)*(C2Q23-1.0)*cosphi/termt);
1416 cosphiError = (1.0/(2.0*termt))*::sqrt(arg1*arg1+arg2*arg2+arg3*arg3+arg4*arg4);
1423 mCosPhi->AddBinContent(bin4, cosphi);
1424 mCosPhiE->AddBinContent(bin4, cosphiError);
1425 mCosPhiN->AddBinContent(bin4);
1442 int StHbtThreeParticleAnalysis::CalculateCosPhi(
StHbtSectoredPicoEvent *picoEvent,
int Index1,
int Index2,
int Index3) {
1444 double C2Q12,C2Q23,C2Q31,C3,arg1,arg2,arg3,arg4,cosphi,cosphiError,termt;
1445 int bin1,bin2,bin3,bin4,NumTriplets=0;
1447 if (Index1==-1 || Index2==-1 || Index3==-1)
return 0;
1449 StHbtParticleCollection *partColl1 = picoEvent->FirstSectoredCollection()[Index1];
1450 StHbtParticleCollection *partColl2 = picoEvent->FirstSectoredCollection()[Index2];
1451 StHbtParticleCollection *partColl3 = picoEvent->FirstSectoredCollection()[Index3];
1453 if (!partColl1->size() || !partColl2->size() || !partColl2->size())
return 0;
1457 StHbtParticleIterator PartIter1;
1458 StHbtParticleIterator PartIter2;
1459 StHbtParticleIterator PartIter3;
1460 StHbtParticleIterator StartOuterLoop = partColl1->begin();
1461 StHbtParticleIterator EndOuterLoop = partColl1->end();
1462 StHbtParticleIterator StartMiddleLoop = partColl2->begin();
1463 StHbtParticleIterator EndMiddleLoop = partColl2->end();
1464 StHbtParticleIterator StartInnerLoop = partColl3->begin();
1465 StHbtParticleIterator EndInnerLoop = partColl3->end();
1467 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1468 TheTriplet->SetTrack1(*PartIter1);
1469 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1470 TheTriplet->SetTrack2(*PartIter2);
1471 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1472 TheTriplet->SetTrack3(*PartIter3);
1478 if (mTripletCut->Pass(TheTriplet)){
1480 bin1 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv12());
1481 bin2 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv23());
1482 bin3 = mQ2CF->GetXaxis()->FindBin(TheTriplet->qInv31());
1483 bin4 = mQ3CF->GetXaxis()->FindBin(TheTriplet->qInv());
1485 C2Q12 = mQ2CF->GetBinContent(bin1);
1486 C2Q23 = mQ2CF->GetBinContent(bin2);
1487 C2Q31 = mQ2CF->GetBinContent(bin3);
1488 C3 = mNormFactor*(mQ3CF->GetBinContent(bin4));
1490 termt = ::sqrt(fabs((C2Q12-1.0)*(C2Q23-1.0)*(C2Q31-1.0)));
1492 cosphi = ((C3-1.0) - (C2Q12-1.0) - (C2Q23-1.0) - (C2Q31-1.0))/(2.0*termt);
1493 arg1 = mQ3CF->GetBinError(bin4);
1494 arg2 = mQ2CF->GetBinError(bin1)*(1.0 + (C2Q23-1.0)*(C2Q31-1.0)*cosphi/termt);
1495 arg3 = mQ2CF->GetBinError(bin2)*(1.0 + (C2Q31-1.0)*(C2Q12-1.0)*cosphi/termt);
1496 arg4 = mQ2CF->GetBinError(bin3)*(1.0 + (C2Q12-1.0)*(C2Q23-1.0)*cosphi/termt);
1497 cosphiError = (1.0/(2.0*termt))*::sqrt(arg1*arg1+arg2*arg2+arg3*arg3+arg4*arg4);
1504 mCosPhi->AddBinContent(bin4, cosphi);
1505 mCosPhiE->AddBinContent(bin4, cosphiError);
1506 mCosPhiN->AddBinContent(bin4);
1520 int StHbtThreeParticleAnalysis::CreateMixedTriplets(StHbtParticleCollection *partColl1, StHbtParticleCollection *partColl2, StHbtParticleCollection *partColl3) {
1524 if (!partColl1->size() || !partColl1->size() || !partColl1->size())
return 0;
1528 StHbtParticleIterator PartIter1;
1529 StHbtParticleIterator PartIter2;
1530 StHbtParticleIterator PartIter3;
1531 StHbtCorrFctnIterator CorrFctnIter;
1532 StHbtParticleIterator StartOuterLoop = partColl1->begin();
1533 StHbtParticleIterator EndOuterLoop = partColl1->end();
1534 StHbtParticleIterator StartMiddleLoop = partColl2->begin();
1535 StHbtParticleIterator EndMiddleLoop = partColl2->end();
1536 StHbtParticleIterator StartInnerLoop = partColl3->begin();
1537 StHbtParticleIterator EndInnerLoop = partColl3->end();
1539 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
1540 TheTriplet->SetTrack1(*PartIter1);
1541 for (PartIter2 = StartMiddleLoop; PartIter2!=EndMiddleLoop;PartIter2++){
1542 TheTriplet->SetTrack2(*PartIter2);
1543 for (PartIter3 = StartInnerLoop; PartIter3!=EndInnerLoop;PartIter3++){
1544 TheTriplet->SetTrack3(*PartIter3);
1550 if (mTripletCut->Pass(TheTriplet)){
1552 for (CorrFctnIter=mCorrFctnCollection->begin();
1553 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
1555 CorrFctn->AddMixedTriplet(TheTriplet);
1569 void StHbtThreeParticleAnalysis::EventBegin(
const StHbtEvent* ev){
1570 mFirstParticleCut->EventBegin(ev);
1571 mSecondParticleCut->EventBegin(ev);
1572 mThirdParticleCut->EventBegin(ev);
1573 for (StHbtCorrFctnIterator iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
1574 (*iter)->EventBegin(ev);
1578 void StHbtThreeParticleAnalysis::EventEnd(
const StHbtEvent* ev){
1579 mFirstParticleCut->EventBegin(ev);
1580 mSecondParticleCut->EventBegin(ev);
1581 mThirdParticleCut->EventBegin(ev);
1582 for (StHbtCorrFctnIterator iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
1583 (*iter)->EventEnd(ev);
1587 void StHbtThreeParticleAnalysis::Finish(){
1590 mCosPhiE->Divide(mCosPhiN);
1591 mCosPhi->Divide(mCosPhiN);
1592 for (
int Iter1=1; Iter1<=mCosPhiN->GetNbinsX();Iter1++)
1593 mCosPhi->SetBinError(Iter1, mCosPhiE->GetBinContent(Iter1));
1595 cout <<
"Writing to file: CosPhi" << endl;
1596 TFile cosfile(mSaveFile,
"NEW");
1597 mCosPhi->Write(
"cosphi");
1598 mCosPhiN->Write(
"cosphiN");
1600 cout <<
"Done writing: CosPhi" << endl;
1602 StHbtCorrFctnIterator iter;
1603 for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
1609 void StHbtThreeParticleAnalysis::AddEventProcessed() {
1610 mNeventsProcessed++;
virtual void ProcessEvent(const StHbtEvent *)
returns reports of all cuts applied and correlation functions being done