]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/AliFemtoVertexMultAnalysis.cxx
Port changes from v4-06-Release to the HEAD
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoVertexMultAnalysis.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.2.2.2  2007/10/12 14:28:37  akisiel
17  * New wave of cleanup and rule conformance
18  *
19  * Revision 1.2.2.1  2007/10/05 09:38:17  akisiel
20  * Fix stray colons
21  *
22  * Revision 1.2  2007/07/09 16:17:11  mlisa
23  * several files changed to change name of AliFemtoAnalysis to AliFemtoSimpleAnalysis and AliFemtoBaseAnalysis to AliFemtoAnalysis.  Also removed some hard-coded cuts of Marek
24  *
25  * Revision 1.1  2007/05/16 10:22:12  akisiel
26  * Making the directory structure of AliFemto flat. All files go into one common directory
27  *
28  * Revision 1.2  2007/05/03 09:39:37  akisiel
29  * Fixing Effective C++ warnings
30  *
31  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
32  * Importing the HBT code dir
33  *
34  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
35  * First version on CVS
36  *
37  * Revision 1.2  2005/06/28 23:12:24  chajecki
38  * UncorrectedNumberOfNegativePrimaries() -> UncorrectedNumberOfPrimaries()
39  *
40  * For data taken in Y2 and later the centrality definition bases
41  * on UncorrectedNumberOfPrimaries() while for Y1(AuAu@130)
42  * it based on UncorrectedNumberOfNegativePrimaries().
43  * But in many places of HBT code the number of negative primaries
44  * was used as a multiplicity for all productions.
45  * This has been fixed.
46  *
47  * Revision 1.1  2001/11/11 18:34:14  laue
48  * AliFemtoPicoEventCollectionVectorHideAway: updated for 3d grid
49  * AliFemtoVertexMultAnalysis: new
50  *
51  *
52  **************************************************************************/
53 ////////////////////////////////////////////////////////////////////////////
54 //                                                                        //
55 // AliFemtoVertexMultAnalysis - Femtoscopic analysis which mixes event    //
56 // with respect to the z position of the primary vertex and event total   //
57 // multiplicity                                                           //
58 // You need to provide the number of z-vertex and multiplicity bins       //
59 // as well as ranges for the variables                                    //
60 //                                                                        //
61 ////////////////////////////////////////////////////////////////////////////
62
63 #include "AliFemtoVertexMultAnalysis.h"
64 #include "AliFemtoParticleCollection.h"
65 #include "AliFemtoTrackCut.h"
66 #include "AliFemtoV0Cut.h"
67 #include "AliFemtoKinkCut.h"
68 #include "AliFemtoPicoEventCollectionVector.h"
69 #include "AliFemtoPicoEventCollectionVectorHideAway.h"
70
71
72 #ifdef __ROOT__ 
73 ClassImp(AliFemtoVertexMultAnalysis)
74 #endif
75
76 extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
77                                       AliFemtoEvent*               hbtEvent,
78                                       AliFemtoParticleCollection*  partCollection);
79
80
81 //____________________________
82 AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(unsigned int binsVertex, double minVertex, double maxVertex,
83                                                        unsigned int binsMult, double minMult, double maxMult) 
84   : 
85   fVertexZBins(binsVertex), 
86   fOverFlowVertexZ(0), 
87   fUnderFlowVertexZ(0),
88   fMultBins(binsMult) ,
89   fOverFlowMult(0),    
90   fUnderFlowMult(0)    
91 {
92   //  mControlSwitch     = 0;
93   fEventCut          = 0;
94   fFirstParticleCut  = 0;
95   fSecondParticleCut = 0;
96   fPairCut           = 0;
97   fCorrFctnCollection= 0;
98   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
99   fVertexZ[0] = minVertex;
100   fVertexZ[1] = maxVertex;
101   fUnderFlowVertexZ = 0; 
102   fOverFlowVertexZ = 0; 
103   fMult[0] = minMult;
104   fMult[1] = maxMult;
105   fUnderFlowMult = 0; 
106   fOverFlowMult = 0; 
107   if (fMixingBuffer) delete fMixingBuffer;
108   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
109                                                                                   fMultBins,fMult[0],fMult[1]);
110 }
111 //____________________________
112
113 AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) : 
114   AliFemtoSimpleAnalysis(),
115   fVertexZBins(a.fVertexZBins), 
116   fOverFlowVertexZ(0), 
117   fUnderFlowVertexZ(0),
118   fMultBins(a.fMultBins) ,
119   fOverFlowMult(0),    
120   fUnderFlowMult(0)    
121 {
122   //AliFemtoVertexMultAnalysis();
123   fEventCut          = 0;
124   fFirstParticleCut  = 0;
125   fSecondParticleCut = 0;
126   fPairCut           = 0;
127   fCorrFctnCollection= 0;
128   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
129   fVertexZ[0] = a.fVertexZ[0]; 
130   fVertexZ[1] = a.fVertexZ[1];
131   fUnderFlowVertexZ = 0; 
132   fOverFlowVertexZ = 0; 
133   fMult[0] = a.fMult[0]; 
134   fMult[1] = a.fMult[1];
135   fUnderFlowMult = 0; 
136   fOverFlowMult = 0; 
137   if (fMixingBuffer) delete fMixingBuffer;
138   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
139                                                                                   fMultBins,fMult[0],fMult[1]);
140
141   // find the right event cut
142   fEventCut = a.fEventCut->Clone();
143   // find the right first particle cut
144   fFirstParticleCut = a.fFirstParticleCut->Clone();
145   // find the right second particle cut
146   if (a.fFirstParticleCut==a.fSecondParticleCut) 
147     SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
148   else
149   fSecondParticleCut = a.fSecondParticleCut->Clone();
150
151   fPairCut = a.fPairCut->Clone();
152   
153   if ( fEventCut ) {
154       SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
155       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - event cut set " << endl;
156   }
157   if ( fFirstParticleCut ) {
158       SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
159       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - first particle cut set " << endl;
160   }
161   if ( fSecondParticleCut ) {
162       SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
163       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - second particle cut set " << endl;
164   }  if ( fPairCut ) {
165       SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
166       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - pair cut set " << endl;
167   }
168
169   AliFemtoCorrFctnIterator iter;
170   for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
171     cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - looking for correlation functions " << endl;
172     AliFemtoCorrFctn* fctn = (*iter)->Clone();
173     if (fctn) AddCorrFctn(fctn);
174     else cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - correlation function not found " << endl;
175   }
176
177   fNumEventsToMix = a.fNumEventsToMix;
178
179   cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - analysis copied " << endl;
180
181 }
182 //____________________________
183 AliFemtoVertexMultAnalysis::~AliFemtoVertexMultAnalysis(){
184   // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
185   delete fPicoEventCollectionVectorHideAway;
186 }
187
188 //____________________________
189 AliFemtoString AliFemtoVertexMultAnalysis::Report()
190 {
191   // Prepare a report of the execution
192   cout << "AliFemtoVertexMultAnalysis - constructing Report..."<<endl;
193   char ctemp[200];
194   AliFemtoString temp = "-----------\nHbt AliFemtoVertexMultAnalysis Report:\n";
195   sprintf(ctemp,"Events are mixed in %d VertexZ bins in the range %E cm to %E cm.\n",fVertexZBins,fVertexZ[0],fVertexZ[1]);
196   temp += ctemp;
197   sprintf(ctemp,"Events underflowing: %d\n",fUnderFlowVertexZ);
198   temp += ctemp;
199   sprintf(ctemp,"Events overflowing: %d\n",fOverFlowVertexZ);
200   temp += ctemp;
201   sprintf(ctemp,"Events are mixed in %d Mult bins in the range %E cm to %E cm.\n",fMultBins,fMult[0],fMult[1]);
202   temp += ctemp;
203   sprintf(ctemp,"Events underflowing: %d\n",fUnderFlowMult);
204   temp += ctemp;
205   sprintf(ctemp,"Events overflowing: %d\n",fOverFlowMult);
206   temp += ctemp;
207   sprintf(ctemp,"Now adding AliFemtoSimpleAnalysis(base) Report\n");
208   temp += ctemp;
209   temp += AliFemtoSimpleAnalysis::Report();
210   AliFemtoString returnThis=temp;
211   return returnThis;
212 }
213 //_________________________
214 void AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
215   // Perform event processing
216   // in bins of z vertex and multiplicity
217
218   cout << " AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
219   // get right mixing buffer
220   double vertexZ = hbtEvent->PrimVertPos().z();
221   double mult = hbtEvent->UncorrectedNumberOfPrimaries();
222   fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ,mult); 
223   if (!fMixingBuffer) {
224     if ( vertexZ < fVertexZ[0] ) fUnderFlowVertexZ++;
225     if ( vertexZ > fVertexZ[1] ) fOverFlowVertexZ++;
226     if ( mult < fMult[0] ) fUnderFlowMult++;
227     if ( mult > fMult[1] ) fOverFlowMult++;
228     return;
229   }
230   // call ProcessEvent() from AliFemtoSimpleAnalysis-base
231   AliFemtoSimpleAnalysis::ProcessEvent(hbtEvent);
232 }