15 #include "StHbtMaker/Infrastructure/StHbtLikeSignAnalysis.h"
16 #include "StHbtMaker/Infrastructure/StHbtParticleCollection.hh"
17 #include "StHbtMaker/Base/StHbtTrackCut.h"
18 #include "StHbtMaker/Base/StHbtV0Cut.h"
19 #include "StHbtMaker/Infrastructure/StHbtPicoEventCollectionVector.hh"
20 #include "StHbtMaker/Infrastructure/StHbtPicoEventCollectionVectorHideAway.hh"
33 StHbtParticleCollection* partCollection);
37 StHbtLikeSignAnalysis::StHbtLikeSignAnalysis(
unsigned int bins,
double min,
double max) :
StHbtAnalysis() {
43 if (mMixingBuffer)
delete mMixingBuffer;
49 mVertexBins = a.mVertexBins;
50 mVertexZ[0] = a.mVertexZ[0];
51 mVertexZ[1] = a.mVertexZ[1];
54 if (mMixingBuffer)
delete mMixingBuffer;
58 StHbtLikeSignAnalysis::~StHbtLikeSignAnalysis(){
59 delete mPicoEventCollectionVectorHideAway; mPicoEventCollectionVectorHideAway=0;
62 StHbtString StHbtLikeSignAnalysis::Report()
65 cout <<
"StHbtLikeSignAnalysis - constructing Report..."<<endl;
66 StHbtString temp =
"-----------\nHbt Analysis Report:\n";
67 sprintf(Ctemp,
"Events are mixed in %d bins in the range %E cm to %E cm.\n",mVertexBins,mVertexZ[0],mVertexZ[1]);
69 sprintf(Ctemp,
"Events underflowing: %d\n",mUnderFlow);
71 sprintf(Ctemp,
"Events overflowing: %d\n",mOverFlow);
73 sprintf(Ctemp,
"Now adding StHbtAnalysis(base) Report\n");
75 temp +=
"Adding StHbtAnalysis(base) Report now:\n";
76 temp += StHbtAnalysis::Report();
77 temp +=
"-------------\n";
78 StHbtString returnThis=temp;
84 double vertexZ = hbtEvent->PrimVertPos().z();
85 mMixingBuffer = mPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ);
87 if ( vertexZ < mVertexZ[0] ) mUnderFlow++;
88 if ( vertexZ > mVertexZ[1] ) mOverFlow++;
95 bool tmpPassEvent = mEventCut->Pass(hbtEvent);
96 mEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
99 cout <<
"StHbtLikeSignAnalysis::ProcessEvent() - " << hbtEvent->TrackCollection()->size();
100 cout <<
" #track=" << hbtEvent->TrackCollection()->size();
103 FillHbtParticleCollection(mFirstParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->FirstParticleCollection());
104 if ( !(AnalyzeIdenticalParticles()) )
105 FillHbtParticleCollection(mSecondParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->SecondParticleCollection());
106 cout <<
" #particles in First, Second Collections: " <<
107 picoEvent->FirstParticleCollection()->size() <<
" " <<
108 picoEvent->SecondParticleCollection()->size() << endl;
110 if (picoEvent->SecondParticleCollection()->size()*picoEvent->FirstParticleCollection()->size()==0) {
112 cout <<
"StHbtLikeSignAnalysis - picoEvent deleted due to empty collection " <<endl;
123 StHbtParticleIterator PartIter1;
124 StHbtParticleIterator PartIter2;
125 StHbtCorrFctnIterator CorrFctnIter;
126 StHbtParticleIterator StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
127 StHbtParticleIterator EndOuterLoop = picoEvent->FirstParticleCollection()->end();
128 StHbtParticleIterator StartInnerLoop;
129 StHbtParticleIterator EndInnerLoop;
130 if (AnalyzeIdenticalParticles()) {
132 EndInnerLoop = picoEvent->FirstParticleCollection()->end() ;
135 StartInnerLoop = picoEvent->SecondParticleCollection()->begin();
136 EndInnerLoop = picoEvent->SecondParticleCollection()->end() ;
139 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
140 if (AnalyzeIdenticalParticles()){
141 StartInnerLoop = PartIter1;
144 ThePair->SetTrack1(*PartIter1);
145 for (PartIter2 = StartInnerLoop; PartIter2!=EndInnerLoop;PartIter2++){
146 ThePair->SetTrack2(*PartIter2);
152 if (mPairCut->Pass(ThePair)){
153 for (CorrFctnIter=mCorrFctnCollection->begin();
154 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
156 if (CorrFctn) CorrFctn->AddRealPair(ThePair);
162 cout <<
"StHbtLikeSignAnalysis::ProcessEvent() - reals done" << endl;
165 StHbtParticleIterator nextIter;
166 StHbtParticleIterator prevIter;
169 prevIter = EndOuterLoop;
171 for (PartIter1=StartOuterLoop;PartIter1!=prevIter;PartIter1++){
172 ThePair->SetTrack1(*PartIter1);
173 nextIter = PartIter1;
175 for (PartIter2 = nextIter; PartIter2!=EndOuterLoop;PartIter2++){
176 ThePair->SetTrack2(*PartIter2);
182 if (mPairCut->Pass(ThePair)){
183 for (CorrFctnIter=mCorrFctnCollection->begin();
184 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
186 if (CorrFctn) CorrFctn->AddLikeSignPositivePair(ThePair);
192 cout <<
"StHbtLikeSignAnalysis::ProcessEvent() - like sign first collection done" << endl;
195 prevIter = EndInnerLoop;
197 for (PartIter1=StartInnerLoop;PartIter1!=prevIter;PartIter1++){
198 ThePair->SetTrack1(*PartIter1);
199 nextIter = PartIter1;
201 for (PartIter2 = nextIter; PartIter2!=EndInnerLoop;PartIter2++){
202 ThePair->SetTrack2(*PartIter2);
208 if (mPairCut->Pass(ThePair)){
209 for (CorrFctnIter=mCorrFctnCollection->begin();
210 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
212 if (CorrFctn) CorrFctn->AddLikeSignNegativePair(ThePair);
218 cout <<
"StHbtLikeSignAnalysis::ProcessEvent() - like sign second collection done" << endl;
221 if (MixingBufferFull()){
223 cout <<
"Mixing Buffer is full - lets rock and roll" << endl;
227 cout <<
"Mixing Buffer not full -gotta wait " << MixingBuffer()->size() << endl;
229 if (MixingBufferFull()){
230 StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
231 EndOuterLoop = picoEvent->FirstParticleCollection()->end();
233 StHbtPicoEventIterator picoEventIter;
234 for (picoEventIter=MixingBuffer()->begin();picoEventIter!=MixingBuffer()->end();picoEventIter++){
235 storedEvent = *picoEventIter;
236 if (AnalyzeIdenticalParticles()){
237 StartInnerLoop = storedEvent->FirstParticleCollection()->begin();
238 EndInnerLoop = storedEvent->FirstParticleCollection()->end();
241 StartInnerLoop = storedEvent->SecondParticleCollection()->begin();
242 EndInnerLoop = storedEvent->SecondParticleCollection()->end();
244 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
245 ThePair->SetTrack1(*PartIter1);
246 for (PartIter2=StartInnerLoop;PartIter2!=EndInnerLoop;PartIter2++){
247 ThePair->SetTrack2(*PartIter2);
249 if (mPairCut->Pass(ThePair)){
251 for (CorrFctnIter=mCorrFctnCollection->begin();
252 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
255 CorrFctn->AddMixedPair(ThePair);
265 delete MixingBuffer()->back();
266 MixingBuffer()->pop_back();
269 MixingBuffer()->push_front(picoEvent);
virtual void ProcessEvent(const StHbtEvent *)
returns reports of all cuts applied and correlation functions being done