StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtVertexAnalysis.cxx
1 /***************************************************************************
2  *
3  * $Id: StHbtVertexAnalysis.cxx,v 1.5 2001/05/25 23:24:00 lisa Exp $
4  *
5  * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * This is the Class for Analysis objects. Each of the simultaneous
10  * Analyses running should have one of these instantiated. They link
11  * into the Manager in an Analysis Collection.
12  *
13  ***************************************************************************
14  *
15  * $Log: StHbtVertexAnalysis.cxx,v $
16  * Revision 1.5 2001/05/25 23:24:00 lisa
17  * Added in StHbtKink stuff
18  *
19  * Revision 1.4 2000/08/31 22:31:32 laue
20  * StHbtAnalysis: output changed (a little bit less)
21  * StHbtEvent: new version, members for reference mult added
22  * StHbtIOBinary: new IO for new StHbtEvent version
23  * StHbtTypes: TTree typedef to StHbtTTree added
24  * StHbtVertexAnalysis: overflow and underflow added
25  *
26  * Revision 1.1 2000/07/16 21:44:11 laue
27  * Collection and analysis for vertex dependent event mixing
28  *
29  *
30  **************************************************************************/
31 
32 #include "StHbtMaker/Infrastructure/StHbtVertexAnalysis.h"
33 #include "StHbtMaker/Infrastructure/StHbtParticleCollection.hh"
34 #include "StHbtMaker/Base/StHbtTrackCut.h"
35 #include "StHbtMaker/Base/StHbtV0Cut.h"
36 #include "StHbtMaker/Base/StHbtKinkCut.h"
37 #include "StHbtMaker/Infrastructure/StHbtPicoEventCollectionVector.hh"
38 #include "StHbtMaker/Infrastructure/StHbtPicoEventCollectionVectorHideAway.hh"
39 
40 
41 #ifdef __ROOT__
42 ClassImp(StHbtVertexAnalysis)
43 #endif
44 
45 extern void FillHbtParticleCollection(StHbtParticleCut* partCut,
46  StHbtEvent* hbtEvent,
47  StHbtParticleCollection* partCollection);
48 
49 
50 //____________________________
51 StHbtVertexAnalysis::StHbtVertexAnalysis(unsigned int bins, double min, double max){
52  // mControlSwitch = 0;
53  mEventCut = 0;
54  mFirstParticleCut = 0;
55  mSecondParticleCut = 0;
56  mPairCut = 0;
57  mCorrFctnCollection= 0;
58  mCorrFctnCollection = new StHbtCorrFctnCollection;
59  mVertexBins = bins;
60  mVertexZ[0] = min;
61  mVertexZ[1] = max;
62  mUnderFlow = 0;
63  mOverFlow = 0;
64  if (mMixingBuffer) delete mMixingBuffer;
65  mPicoEventCollectionVectorHideAway = new StHbtPicoEventCollectionVectorHideAway(mVertexBins,mVertexZ[0],mVertexZ[1]);
66 };
67 //____________________________
68 
69 StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) : StHbtAnalysis() {
70  //StHbtVertexAnalysis();
71  mEventCut = 0;
72  mFirstParticleCut = 0;
73  mSecondParticleCut = 0;
74  mPairCut = 0;
75  mCorrFctnCollection= 0;
76  mCorrFctnCollection = new StHbtCorrFctnCollection;
77  mVertexBins = a.mVertexBins;
78  mVertexZ[0] = a.mVertexZ[0];
79  mVertexZ[1] = a.mVertexZ[1];
80  mUnderFlow = 0;
81  mOverFlow = 0;
82  if (mMixingBuffer) delete mMixingBuffer;
83  mPicoEventCollectionVectorHideAway = new StHbtPicoEventCollectionVectorHideAway(mVertexBins,mVertexZ[0],mVertexZ[1]);
84 
85  // find the right event cut
86  mEventCut = a.mEventCut->Clone();
87  // find the right first particle cut
88  mFirstParticleCut = a.mFirstParticleCut->Clone();
89  // find the right second particle cut
90  if (a.mFirstParticleCut==a.mSecondParticleCut)
91  SetSecondParticleCut(mFirstParticleCut); // identical particle hbt
92  else
93  mSecondParticleCut = a.mSecondParticleCut->Clone();
94 
95  mPairCut = a.mPairCut->Clone();
96 
97  if ( mEventCut ) {
98  SetEventCut(mEventCut); // this will set the myAnalysis pointer inside the cut
99  cout << " StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) - event cut set " << endl;
100  }
101  if ( mFirstParticleCut ) {
102  SetFirstParticleCut(mFirstParticleCut); // this will set the myAnalysis pointer inside the cut
103  cout << " StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) - first particle cut set " << endl;
104  }
105  if ( mSecondParticleCut ) {
106  SetSecondParticleCut(mSecondParticleCut); // this will set the myAnalysis pointer inside the cut
107  cout << " StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) - second particle cut set " << endl;
108  } if ( mPairCut ) {
109  SetPairCut(mPairCut); // this will set the myAnalysis pointer inside the cut
110  cout << " StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) - pair cut set " << endl;
111  }
112 
113  StHbtCorrFctnIterator iter;
114  for (iter=a.mCorrFctnCollection->begin(); iter!=a.mCorrFctnCollection->end();iter++){
115  cout << " StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) - looking for correlation functions " << endl;
116  StHbtCorrFctn* fctn = (*iter)->Clone();
117  if (fctn) AddCorrFctn(fctn);
118  else cout << " StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) - correlation function not found " << endl;
119  }
120 
121  mNumEventsToMix = a.mNumEventsToMix;
122 
123  cout << " StHbtVertexAnalysis::StHbtVertexAnalysis(const StHbtVertexAnalysis& a) - analysis copied " << endl;
124 
125 }
126 //____________________________
127 StHbtVertexAnalysis::~StHbtVertexAnalysis(){
128  // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
129  delete mPicoEventCollectionVectorHideAway;
130 }
131 
132 //____________________________
133 StHbtString StHbtVertexAnalysis::Report()
134 {
135  cout << "StHbtVertexAnalysis - constructing Report..."<<endl;
136  char Ctemp[200];
137  StHbtString temp = "-----------\nHbt StHbtVertexAnalysis Report:\n";
138  sprintf(Ctemp,"Events are mixed in %d bins in the range %E cm to %E cm.\n",mVertexBins,mVertexZ[0],mVertexZ[1]);
139  temp += Ctemp;
140  sprintf(Ctemp,"Events underflowing: %d\n",mUnderFlow);
141  temp += Ctemp;
142  sprintf(Ctemp,"Events overflowing: %d\n",mOverFlow);
143  temp += Ctemp;
144  sprintf(Ctemp,"Now adding StHbtAnalysis(base) Report\n");
145  temp += Ctemp;
146  temp += StHbtAnalysis::Report();
147  StHbtString returnThis=temp;
148  return returnThis;
149 }
150 //_________________________
152  cout << " StHbtVertexAnalysis::ProcessEvent(const StHbtEvent* hbtEvent) " << endl;
153  // get right mixing buffer
154  double vertexZ = hbtEvent->PrimVertPos().z();
155  mMixingBuffer = mPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ);
156  if (!mMixingBuffer) {
157  if ( vertexZ < mVertexZ[0] ) mUnderFlow++;
158  if ( vertexZ > mVertexZ[1] ) mOverFlow++;
159  return;
160  }
161  // call ProcessEvent() from StHbtAnalysis-base
162  StHbtAnalysis::ProcessEvent(hbtEvent);
163 }
virtual void ProcessEvent(const StHbtEvent *)
returns reports of all cuts applied and correlation functions being done
virtual void ProcessEvent(const StHbtEvent *)
returns reports of all cuts applied and correlation functions being done