85 #include "StHbtMaker/Infrastructure/StHbtSplitEvalAnalysis.h"
86 #include "StHbtMaker/Infrastructure/StHbtParticleCollection.hh"
87 #include "StHbtMaker/Base/StHbtTrackCut.h"
88 #include "StHbtMaker/Base/StHbtV0Cut.h"
103 StHbtParticleCollection* partCollection);
148 StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(){
151 mFirstParticleCut = 0;
152 mSecondParticleCut = 0;
154 mCorrFctnCollection= 0;
155 mCorrFctnCollection =
new StHbtCorrFctnCollection;
156 mMixingBuffer =
new StHbtPicoEventCollection;
161 float pTbinmax = 2.0;
162 mRealSplits =
new StHbt1DHisto(
"realSplit",
"realSplit",npTbins,0.0,pTbinmax);
163 mRealAll =
new StHbt1DHisto(
"realAll",
"realAll",npTbins,0.0,pTbinmax);
164 mMixedSplits =
new StHbt1DHisto(
"mixedSplit",
"mixedSplit",npTbins,0.0,pTbinmax);
165 mMixedAll =
new StHbt1DHisto(
"mixedAll",
"mixedAll",npTbins,0.0,pTbinmax);
167 mSplitFractionUpperLimit =
new StHbt1DHisto(
"SplitFracUpperLimit",
"SplitFracUpperLImit",npTbins,0.0,pTbinmax);
168 mSplitFractionLowerLimit =
new StHbt1DHisto(
"SplitFracLowerLimit",
"SplitFracLowerLImit",npTbins,0.0,pTbinmax);
176 mFirstParticleCut = 0;
177 mSecondParticleCut = 0;
179 mCorrFctnCollection= 0;
180 mCorrFctnCollection =
new StHbtCorrFctnCollection;
181 mMixingBuffer =
new StHbtPicoEventCollection;
184 mEventCut = a.mEventCut->Clone();
186 mFirstParticleCut = a.mFirstParticleCut->Clone();
188 if (a.mFirstParticleCut==a.mSecondParticleCut)
189 SetSecondParticleCut(mFirstParticleCut);
191 mSecondParticleCut = a.mSecondParticleCut->Clone();
193 mPairCut = a.mPairCut->Clone();
196 SetEventCut(mEventCut);
197 cout <<
" StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(const StHbtSplitEvalAnalysis& a) - event cut set " << endl;
199 if ( mFirstParticleCut ) {
200 SetFirstParticleCut(mFirstParticleCut);
201 cout <<
" StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(const StHbtSplitEvalAnalysis& a) - first particle cut set " << endl;
203 if ( mSecondParticleCut ) {
204 SetSecondParticleCut(mSecondParticleCut);
205 cout <<
" StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(const StHbtSplitEvalAnalysis& a) - second particle cut set " << endl;
207 SetPairCut(mPairCut);
208 cout <<
" StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(const StHbtSplitEvalAnalysis& a) - pair cut set " << endl;
211 StHbtCorrFctnIterator iter;
212 for (iter=a.mCorrFctnCollection->begin(); iter!=a.mCorrFctnCollection->end();iter++){
213 cout <<
" StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(const StHbtSplitEvalAnalysis& a) - looking for correlation functions " << endl;
215 if (fctn) AddCorrFctn(fctn);
216 else cout <<
" StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(const StHbtSplitEvalAnalysis& a) - correlation function not found " << endl;
219 mNumEventsToMix = a.mNumEventsToMix;
221 cout <<
" StHbtSplitEvalAnalysis::StHbtSplitEvalAnalysis(const StHbtSplitEvalAnalysis& a) - analysis copied " << endl;
225 StHbtSplitEvalAnalysis::~StHbtSplitEvalAnalysis(){
228 delete mFirstParticleCut ;
229 delete mSecondParticleCut ;
232 StHbtCorrFctnIterator iter;
233 for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
236 delete mCorrFctnCollection;
238 StHbtPicoEventIterator piter;
239 for (piter=mMixingBuffer->begin();piter!=mMixingBuffer->end();piter++){
242 delete mMixingBuffer;
246 if ( n<0 || n > (
int)mCorrFctnCollection->size() )
248 StHbtCorrFctnIterator iter=mCorrFctnCollection->begin();
249 for (
int i=0; i<n ;i++){
255 StHbtString StHbtSplitEvalAnalysis::Report()
257 cout <<
"StHbtSplitEvalAnalysis - constructing Report..."<<endl;
258 string temp =
"-----------\nHbt Analysis Report:\n";
259 temp +=
"\nEvent Cuts:\n";
260 temp += mEventCut->Report();
261 temp +=
"\nParticle Cuts - First Particle:\n";
262 temp += mFirstParticleCut->Report();
263 temp +=
"\nParticle Cuts - Second Particle:\n";
264 temp += mSecondParticleCut->Report();
265 temp +=
"\nPair Cuts:\n";
266 temp += mPairCut->Report();
267 temp +=
"\nCorrelation Functions:\n";
268 StHbtCorrFctnIterator iter;
269 if ( mCorrFctnCollection->size()==0 ) {
270 cout <<
"StHbtSplitEvalAnalysis-Warning : no correlations functions in this analysis " << endl;
272 for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
273 temp += (*iter)->Report();
276 temp +=
"-------------\n";
277 StHbtString returnThis=temp;
283 EventBegin(hbtEvent);
285 bool tmpPassEvent = mEventCut->Pass(hbtEvent);
286 mEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
288 cout <<
"StHbtSplitEvalAnalysis::ProcessEvent() - Event has passed cut - build picoEvent from " <<
289 hbtEvent->TrackCollection()->size() <<
" tracks in TrackCollection" << endl;
292 FillHbtParticleCollection(mFirstParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->FirstParticleCollection());
293 if ( !(AnalyzeIdenticalParticles()) )
294 FillHbtParticleCollection(mSecondParticleCut,(
StHbtEvent*)hbtEvent,picoEvent->SecondParticleCollection());
295 cout <<
"StHbtSplitEvalAnalysis::ProcessEvent - #particles in First, Second Collections: " <<
296 picoEvent->FirstParticleCollection()->size() <<
" " <<
297 picoEvent->SecondParticleCollection()->size() << endl;
307 StHbtParticleIterator PartIter1;
308 StHbtParticleIterator PartIter2;
309 StHbtCorrFctnIterator CorrFctnIter;
310 StHbtParticleIterator StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
311 StHbtParticleIterator EndOuterLoop = picoEvent->FirstParticleCollection()->end();
312 StHbtParticleIterator StartInnerLoop;
313 StHbtParticleIterator EndInnerLoop;
314 if (AnalyzeIdenticalParticles()) {
316 EndInnerLoop = picoEvent->FirstParticleCollection()->end() ;
319 StartInnerLoop = picoEvent->SecondParticleCollection()->begin();
320 EndInnerLoop = picoEvent->SecondParticleCollection()->end() ;
335 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
337 if (AnalyzeIdenticalParticles()){
338 StartInnerLoop = PartIter1;
341 ThePair->SetTrack1(*PartIter1);
342 trackPT = ThePair->track1()->FourMomentum().vect().perp();
343 for (PartIter2 = StartInnerLoop; PartIter2!=EndInnerLoop;PartIter2++){
344 ThePair->SetTrack2(*PartIter2);
345 if (fabs(ThePair->qInv()) < mQinvCut){
347 if (!(mPairCut->Pass(ThePair))){
353 mRealSplits->Fill(trackPT);
356 mRealAll->Fill(trackPT);
362 cout <<
"StHbtSplitEvalAnalysis::ProcessEvent() - reals done" << endl;
363 if (MixingBufferFull()){
364 cout <<
"Mixing Buffer is full - lets rock and roll" << endl;
367 cout <<
"Mixing Buffer not full -gotta wait " << MixingBuffer()->size() << endl;
369 if (MixingBufferFull()){
371 StHbtPicoEventIterator picoEventIter;
372 for (picoEventIter=MixingBuffer()->begin();picoEventIter!=MixingBuffer()->end();picoEventIter++){
373 storedEvent = *picoEventIter;
374 if (AnalyzeIdenticalParticles()){
375 StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
376 EndOuterLoop = picoEvent->FirstParticleCollection()->end();
377 StartInnerLoop = storedEvent->FirstParticleCollection()->begin();
378 EndInnerLoop = storedEvent->FirstParticleCollection()->end();
379 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
381 ThePair->SetTrack1(*PartIter1);
382 trackPT = ThePair->track1()->FourMomentum().vect().perp();
383 for (PartIter2=StartInnerLoop;PartIter2!=EndInnerLoop;PartIter2++){
384 ThePair->SetTrack2(*PartIter2);
386 if (fabs(ThePair->qInv()) < mQinvCut){
388 if (!(mPairCut->Pass(ThePair))){
394 mMixedSplits->Fill(trackPT);
397 mMixedAll->Fill(trackPT);
403 StartOuterLoop = picoEvent->FirstParticleCollection()->begin();
404 EndOuterLoop = picoEvent->FirstParticleCollection()->end();
405 StartInnerLoop = storedEvent->SecondParticleCollection()->begin();
406 EndInnerLoop = storedEvent->SecondParticleCollection()->end();
407 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
408 ThePair->SetTrack1(*PartIter1);
409 for (PartIter2=StartInnerLoop;PartIter2!=EndInnerLoop;PartIter2++){
410 ThePair->SetTrack2(*PartIter2);
412 if (mPairCut->Pass(ThePair)){
414 for (CorrFctnIter=mCorrFctnCollection->begin();
415 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
417 CorrFctn->AddMixedPair(ThePair);
424 StartOuterLoop = picoEvent->SecondParticleCollection()->begin();
425 EndOuterLoop = picoEvent->SecondParticleCollection()->end();
426 StartInnerLoop = storedEvent->FirstParticleCollection()->begin();
427 EndInnerLoop = storedEvent->FirstParticleCollection()->end();
428 for (PartIter1=StartOuterLoop;PartIter1!=EndOuterLoop;PartIter1++){
429 ThePair->SetTrack1(*PartIter1);
430 for (PartIter2=StartInnerLoop;PartIter2!=EndInnerLoop;PartIter2++){
431 ThePair->SetTrack2(*PartIter2);
433 if (mPairCut->Pass(ThePair)){
435 for (CorrFctnIter=mCorrFctnCollection->begin();
436 CorrFctnIter!=mCorrFctnCollection->end();CorrFctnIter++){
438 CorrFctn->AddMixedPair(ThePair);
448 delete MixingBuffer()->back();
449 MixingBuffer()->pop_back();
452 MixingBuffer()->push_front(picoEvent);
455 cout <<
"StHbtSplitEvalAnalysis::ProcessEvent() - return to caller ... " << endl;
458 void StHbtSplitEvalAnalysis::EventBegin(
const StHbtEvent* ev){
459 mFirstParticleCut->EventBegin(ev);
460 mSecondParticleCut->EventBegin(ev);
461 mPairCut->EventBegin(ev);
462 for (StHbtCorrFctnIterator iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
463 (*iter)->EventBegin(ev);
467 void StHbtSplitEvalAnalysis::EventEnd(
const StHbtEvent* ev){
468 mFirstParticleCut->EventEnd(ev);
469 mSecondParticleCut->EventEnd(ev);
470 mPairCut->EventEnd(ev);
471 for (StHbtCorrFctnIterator iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
472 (*iter)->EventEnd(ev);
476 void StHbtSplitEvalAnalysis::Finish(){
477 StHbtCorrFctnIterator iter;
478 for (iter=mCorrFctnCollection->begin(); iter!=mCorrFctnCollection->end();iter++){
482 mSplitFractionUpperLimit->Divide(mRealSplits,mRealAll);
485 mSplitFractionLowerLimit->Add(mRealSplits,mMixedSplits,1.0,-1.0);
486 mSplitFractionLowerLimit->Divide(mRealAll);
virtual void ProcessEvent(const StHbtEvent *)
returns reports of all cuts applied and correlation functions being done