]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoVertexAnalysis.cxx
Output arguments (AliFemtoEvent*, AliFemtoTrack*) changed to return value in CopyAODt...
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemto / AliFemtoVertexAnalysis.cxx
1 ////////////////////////////////////////////////////////////////////////////
2 //                                                                        //
3 // AliFemtoVertexAnalysis - Femtoscopic analysis which mixes events       //
4 // with respect to the z position of the primary vertex                   //
5 //                                                                        //
6 ////////////////////////////////////////////////////////////////////////////
7 /***************************************************************************
8  *
9  * $Id$
10  *
11  * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
12  ***************************************************************************
13  *
14  * Description: part of STAR HBT Framework: AliFemtoMaker package
15  *      This is the Class for Analysis objects.  Each of the simultaneous
16  *      Analyses running should have one of these instantiated.  They link
17  *      into the Manager in an Analysis Collection.
18  *
19  ***************************************************************************
20  *
21  * $Log$
22  * Revision 1.2.2.2  2007/10/12 14:28:37  akisiel
23  * New wave of cleanup and rule conformance
24  *
25  * Revision 1.2.2.1  2007/10/05 09:38:17  akisiel
26  * Fix stray colons
27  *
28  * Revision 1.2  2007/07/09 16:17:11  mlisa
29  * several files changed to change name of AliFemtoAnalysis to AliFemtoSimpleAnalysis and AliFemtoBaseAnalysis to AliFemtoAnalysis.  Also removed some hard-coded cuts of Marek
30  *
31  * Revision 1.1  2007/05/16 10:22:12  akisiel
32  * Making the directory structure of AliFemto flat. All files go into one common directory
33  *
34  * Revision 1.2  2007/05/03 09:39:37  akisiel
35  * Fixing Effective C++ warnings
36  *
37  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
38  * Importing the HBT code dir
39  *
40  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
41  * First version on CVS
42  *
43  * Revision 1.5  2001/05/25 23:24:00  lisa
44  * Added in AliFemtoKink stuff
45  *
46  * Revision 1.4  2000/08/31 22:31:32  laue
47  * AliFemtoSimpleAnalysis: output changed (a little bit less)
48  * AliFemtoEvent: new version, members for reference mult added
49  * AliFemtoIOBinary: new IO for new AliFemtoEvent version
50  * AliFemtoTypes: TTree typedef to AliFemtoTTree added
51  * AliFemtoVertexAnalysis: overflow and underflow added
52  *
53  * Revision 1.1  2000/07/16 21:44:11  laue
54  * Collection and analysis for vertex dependent event mixing
55  *
56  *
57  **************************************************************************/
58
59 #include "AliFemtoVertexAnalysis.h"
60 #include "AliFemtoParticleCollection.h"
61 #include "AliFemtoTrackCut.h"
62 #include "AliFemtoV0Cut.h"
63 #include "AliFemtoKinkCut.h"
64 #include "AliFemtoPicoEventCollectionVector.h"
65 #include "AliFemtoPicoEventCollectionVectorHideAway.h"
66
67
68 #ifdef __ROOT__ 
69 ClassImp(AliFemtoVertexAnalysis)
70 #endif
71
72 extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
73                                      AliFemtoEvent*               hbtEvent,
74                                      AliFemtoParticleCollection*  partCollection);
75
76
77 //____________________________
78 AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(unsigned int bins, double min, double max):
79   fVertexBins(0),
80   fOverFlow(0),  
81   fUnderFlow(0)
82 {
83   //  mControlSwitch     = 0;
84   fEventCut          = 0;
85   fFirstParticleCut  = 0;
86   fSecondParticleCut = 0;
87   fPairCut           = 0;
88   fCorrFctnCollection= 0;
89   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
90   fVertexBins = bins;
91   fVertexZ[0] = min;
92   fVertexZ[1] = max;
93   fUnderFlow = 0; 
94   fOverFlow = 0; 
95   if (fMixingBuffer) delete fMixingBuffer;
96   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
97 }
98 //____________________________
99
100 AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) : 
101   AliFemtoSimpleAnalysis(),
102   fVertexBins(0),
103   fOverFlow(0),  
104   fUnderFlow(0)
105 {
106   //AliFemtoVertexAnalysis();
107   fEventCut          = 0;
108   fFirstParticleCut  = 0;
109   fSecondParticleCut = 0;
110   fPairCut           = 0;
111   fCorrFctnCollection= 0;
112   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
113   fVertexBins = a.fVertexBins; 
114   fVertexZ[0] = a.fVertexZ[0]; 
115   fVertexZ[1] = a.fVertexZ[1];
116   fUnderFlow = 0; 
117   fOverFlow = 0; 
118   if (fMixingBuffer) delete fMixingBuffer;
119   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
120
121   // find the right event cut
122   fEventCut = a.fEventCut->Clone();
123   // find the right first particle cut
124   fFirstParticleCut = a.fFirstParticleCut->Clone();
125   // find the right second particle cut
126   if (a.fFirstParticleCut==a.fSecondParticleCut) 
127     SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
128   else
129   fSecondParticleCut = a.fSecondParticleCut->Clone();
130
131   fPairCut = a.fPairCut->Clone();
132   
133   if ( fEventCut ) {
134       SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
135       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - event cut set " << endl;
136   }
137   if ( fFirstParticleCut ) {
138       SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
139       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - first particle cut set " << endl;
140   }
141   if ( fSecondParticleCut ) {
142       SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
143       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - second particle cut set " << endl;
144   }  if ( fPairCut ) {
145       SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
146       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - pair cut set " << endl;
147   }
148
149   AliFemtoCorrFctnIterator iter;
150   for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
151     cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - looking for correlation functions " << endl;
152     AliFemtoCorrFctn* fctn = (*iter)->Clone();
153     if (fctn) AddCorrFctn(fctn);
154     else cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - correlation function not found " << endl;
155   }
156
157   fNumEventsToMix = a.fNumEventsToMix;
158
159   cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - analysis copied " << endl;
160
161 }
162
163 AliFemtoVertexAnalysis& AliFemtoVertexAnalysis::operator=(const AliFemtoVertexAnalysis& OriginalAnalysis)
164 {
165   if (this != &OriginalAnalysis) {
166     //AliFemtoVertexAnalysis();
167     fEventCut          = 0;
168     fFirstParticleCut  = 0;
169     fSecondParticleCut = 0;
170     fPairCut           = 0;
171     fCorrFctnCollection= 0;
172     fCorrFctnCollection = new AliFemtoCorrFctnCollection;
173     fVertexBins = OriginalAnalysis.fVertexBins; 
174     fVertexZ[0] = OriginalAnalysis.fVertexZ[0]; 
175     fVertexZ[1] = OriginalAnalysis.fVertexZ[1];
176     fUnderFlow = 0; 
177     fOverFlow = 0; 
178     if (fMixingBuffer) delete fMixingBuffer;
179     fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexBins,fVertexZ[0],fVertexZ[1]);
180     
181     // find the right event cut
182     fEventCut = OriginalAnalysis.fEventCut->Clone();
183     // find the right first particle cut
184     fFirstParticleCut = OriginalAnalysis.fFirstParticleCut->Clone();
185     // find the right second particle cut
186     if (OriginalAnalysis.fFirstParticleCut==OriginalAnalysis.fSecondParticleCut) 
187       SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
188     else
189       fSecondParticleCut = OriginalAnalysis.fSecondParticleCut->Clone();
190     
191     fPairCut = OriginalAnalysis.fPairCut->Clone();
192     
193     if ( fEventCut ) {
194       SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
195       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - event cut set " << endl;
196     }
197     if ( fFirstParticleCut ) {
198       SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
199       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - first particle cut set " << endl;
200     }
201     if ( fSecondParticleCut ) {
202       SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
203       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - second particle cut set " << endl;
204     }  if ( fPairCut ) {
205       SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
206       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - pair cut set " << endl;
207     }
208     
209     AliFemtoCorrFctnIterator iter;
210     for (iter=OriginalAnalysis.fCorrFctnCollection->begin(); iter!=OriginalAnalysis.fCorrFctnCollection->end();iter++){
211       cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - looking for correlation functions " << endl;
212       AliFemtoCorrFctn* fctn = (*iter)->Clone();
213       if (fctn) AddCorrFctn(fctn);
214       else cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - correlation function not found " << endl;
215     }
216     
217     fNumEventsToMix = OriginalAnalysis.fNumEventsToMix;
218     
219     cout << " AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) - analysis copied " << endl;
220   }
221
222   return *this;
223 }
224
225 //____________________________
226 AliFemtoVertexAnalysis::~AliFemtoVertexAnalysis(){
227   // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
228   delete fPicoEventCollectionVectorHideAway;
229 }
230
231 //____________________________
232 AliFemtoString AliFemtoVertexAnalysis::Report()
233 {
234   // prepare report fromt the execution
235   cout << "AliFemtoVertexAnalysis - constructing Report..."<<endl;
236   char ctemp[200];
237   AliFemtoString temp = "-----------\nHbt AliFemtoVertexAnalysis Report:\n";
238   snprintf(ctemp , 200, "Events are mixed in %d bins in the range %E cm to %E cm.\n",fVertexBins,fVertexZ[0],fVertexZ[1]);
239   temp += ctemp;
240   snprintf(ctemp , 200, "Events underflowing: %d\n",fUnderFlow);
241   temp += ctemp;
242   snprintf(ctemp , 200, "Events overflowing: %d\n",fOverFlow);
243   temp += ctemp;
244   snprintf(ctemp , 200, "Now adding AliFemtoSimpleAnalysis(base) Report\n");
245   temp += ctemp;
246   temp += AliFemtoSimpleAnalysis::Report();
247   AliFemtoString returnThis=temp;
248   return returnThis;
249 }
250 //_________________________
251 void AliFemtoVertexAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
252   // Put the event though the analysis
253   cout << " AliFemtoVertexAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
254   // get right mixing buffer
255   double vertexZ = hbtEvent->PrimVertPos().z();
256   fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ); 
257   if (!fMixingBuffer) {
258     if ( vertexZ < fVertexZ[0] ) fUnderFlow++;
259     if ( vertexZ > fVertexZ[1] ) fOverFlow++;
260     return;
261   }
262   // call ProcessEvent() from AliFemtoSimpleAnalysis-base
263   AliFemtoSimpleAnalysis::ProcessEvent(hbtEvent);
264 }