]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx
cd50d69fc9438182bea07bf48b836a3459cd6be3
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / Analysis / AliFemtoVertexAnalysis.cxx
1 /***************************************************************************
2  *
3  * $Id$
4  *
5  * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: AliFemtoMaker 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$
16  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
17  * First version on CVS
18  *
19  * Revision 1.5  2001/05/25 23:24:00  lisa
20  * Added in AliFemtoKink stuff
21  *
22  * Revision 1.4  2000/08/31 22:31:32  laue
23  * AliFemtoAnalysis: output changed (a little bit less)
24  * AliFemtoEvent: new version, members for reference mult added
25  * AliFemtoIOBinary: new IO for new AliFemtoEvent version
26  * AliFemtoTypes: TTree typedef to AliFemtoTTree added
27  * AliFemtoVertexAnalysis: overflow and underflow added
28  *
29  * Revision 1.1  2000/07/16 21:44:11  laue
30  * Collection and analysis for vertex dependent event mixing
31  *
32  *
33  **************************************************************************/
34
35 #include "Analysis/AliFemtoVertexAnalysis.h"
36 #include "Infrastructure/AliFemtoParticleCollection.h"
37 #include "Base/AliFemtoTrackCut.h"
38 #include "Base/AliFemtoV0Cut.h"
39 #include "Base/AliFemtoKinkCut.h"
40 #include "Infrastructure/AliFemtoPicoEventCollectionVector.h"
41 #include "Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.h"
42
43
44 #ifdef __ROOT__ 
45 ClassImp(AliFemtoVertexAnalysis)
46 #endif
47
48 extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
49                                      AliFemtoEvent*               hbtEvent,
50                                      AliFemtoParticleCollection*  partCollection);
51
52
53 //____________________________
54 AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(unsigned int bins, double min, double max){
55   //  mControlSwitch     = 0;
56   fEventCut          = 0;
57   fFirstParticleCut  = 0;
58   fSecondParticleCut = 0;
59   fPairCut           = 0;
60   fCorrFctnCollection= 0;
61   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
62   fVertexBins = bins;
63   fVertexZ[0] = min;
64   fVertexZ[1] = max;
65   fUnderFlow = 0; 
66   fOverFlow = 0; 
67   if (fMixingBuffer) delete fMixingBuffer;
68   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
69 };
70 //____________________________
71
72 AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) : AliFemtoAnalysis() {
73   //AliFemtoVertexAnalysis();
74   fEventCut          = 0;
75   fFirstParticleCut  = 0;
76   fSecondParticleCut = 0;
77   fPairCut           = 0;
78   fCorrFctnCollection= 0;
79   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
80   fVertexBins = a.fVertexBins; 
81   fVertexZ[0] = a.fVertexZ[0]; 
82   fVertexZ[1] = a.fVertexZ[1];
83   fUnderFlow = 0; 
84   fOverFlow = 0; 
85   if (fMixingBuffer) delete fMixingBuffer;
86   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
87
88   // find the right event cut
89   fEventCut = a.fEventCut->Clone();
90   // find the right first particle cut
91   fFirstParticleCut = a.fFirstParticleCut->Clone();
92   // find the right second particle cut
93   if (a.fFirstParticleCut==a.fSecondParticleCut) 
94     SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
95   else
96   fSecondParticleCut = a.fSecondParticleCut->Clone();
97
98   fPairCut = a.fPairCut->Clone();
99   
100   if ( fEventCut ) {
101       SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
102       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - event cut set " << endl;
103   }
104   if ( fFirstParticleCut ) {
105       SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
106       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - first particle cut set " << endl;
107   }
108   if ( fSecondParticleCut ) {
109       SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
110       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - second particle cut set " << endl;
111   }  if ( fPairCut ) {
112       SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
113       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - pair cut set " << endl;
114   }
115
116   AliFemtoCorrFctnIterator iter;
117   for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
118     cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - looking for correlation functions " << endl;
119     AliFemtoCorrFctn* fctn = (*iter)->Clone();
120     if (fctn) AddCorrFctn(fctn);
121     else cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - correlation function not found " << endl;
122   }
123
124   fNumEventsToMix = a.fNumEventsToMix;
125
126   cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - analysis copied " << endl;
127
128 }
129 //____________________________
130 AliFemtoVertexAnalysis::~AliFemtoVertexAnalysis(){
131   // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
132   delete fPicoEventCollectionVectorHideAway;
133 }
134
135 //____________________________
136 AliFemtoString AliFemtoVertexAnalysis::Report()
137 {
138   cout << "AliFemtoVertexAnalysis - constructing Report..."<<endl;
139   char Ctemp[200];
140   AliFemtoString temp = "-----------\nHbt AliFemtoVertexAnalysis Report:\n";
141   sprintf(Ctemp,"Events are mixed in %d bins in the range %E cm to %E cm.\n",fVertexBins,fVertexZ[0],fVertexZ[1]);
142   temp += Ctemp;
143   sprintf(Ctemp,"Events underflowing: %d\n",fUnderFlow);
144   temp += Ctemp;
145   sprintf(Ctemp,"Events overflowing: %d\n",fOverFlow);
146   temp += Ctemp;
147   sprintf(Ctemp,"Now adding AliFemtoAnalysis(base) Report\n");
148   temp += Ctemp;
149   temp += AliFemtoAnalysis::Report();
150   AliFemtoString returnThis=temp;
151   return returnThis;
152 }
153 //_________________________
154 void AliFemtoVertexAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
155   cout << " AliFemtoVertexAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
156   // get right mixing buffer
157   double vertexZ = hbtEvent->PrimVertPos().z();
158   fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ); 
159   if (!fMixingBuffer) {
160     if ( vertexZ < fVertexZ[0] ) fUnderFlow++;
161     if ( vertexZ > fVertexZ[1] ) fOverFlow++;
162     return;
163   }
164   // call ProcessEvent() from AliFemtoAnalysis-base
165   AliFemtoAnalysis::ProcessEvent(hbtEvent);
166 }