]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoVertexMultAnalysis.cxx
ee9ccab52c0d9f49074bce4869034420dae6f426
[u/mrichter/AliRoot.git] / PWGCF / 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 AliFemtoVertexMultAnalysis& AliFemtoVertexMultAnalysis::operator=(const AliFemtoVertexMultAnalysis& TheOriginalAnalysis)
183 {
184   if (this != &TheOriginalAnalysis) {
185     AliFemtoVertexMultAnalysis::operator=(TheOriginalAnalysis);
186     fVertexZBins = TheOriginalAnalysis.fVertexZBins; 
187     fMultBins = TheOriginalAnalysis.fMultBins;
188
189     fEventCut          = 0;
190     fFirstParticleCut  = 0;
191     fSecondParticleCut = 0;
192     fPairCut           = 0;
193     if (fCorrFctnCollection) delete fCorrFctnCollection;
194     fCorrFctnCollection = new AliFemtoCorrFctnCollection;
195     fVertexZ[0] = TheOriginalAnalysis.fVertexZ[0]; 
196     fVertexZ[1] = TheOriginalAnalysis.fVertexZ[1];
197     fUnderFlowVertexZ = 0; 
198     fOverFlowVertexZ = 0; 
199     fMult[0] = TheOriginalAnalysis.fMult[0]; 
200     fMult[1] = TheOriginalAnalysis.fMult[1];
201     fUnderFlowMult = 0; 
202     fOverFlowMult = 0; 
203     if (fMixingBuffer) delete fMixingBuffer;
204     if (fPicoEventCollectionVectorHideAway) delete fPicoEventCollectionVectorHideAway;
205     fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
206                                                                                        fMultBins,fMult[0],fMult[1]);
207
208     // find the right event cut
209     fEventCut = TheOriginalAnalysis.fEventCut->Clone();
210     // find the right first particle cut
211     fFirstParticleCut = TheOriginalAnalysis.fFirstParticleCut->Clone();
212     // find the right second particle cut
213     if (TheOriginalAnalysis.fFirstParticleCut==TheOriginalAnalysis.fSecondParticleCut) 
214       SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
215     else
216       fSecondParticleCut = TheOriginalAnalysis.fSecondParticleCut->Clone();
217
218     fPairCut = TheOriginalAnalysis.fPairCut->Clone();
219   
220     if ( fEventCut ) {
221       SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
222     }
223     if ( fFirstParticleCut ) {
224       SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
225     }
226     if ( fSecondParticleCut ) {
227       SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
228     }  if ( fPairCut ) {
229       SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
230       
231     }
232
233     AliFemtoCorrFctnIterator iter;
234     for (iter=TheOriginalAnalysis.fCorrFctnCollection->begin(); iter!=TheOriginalAnalysis.fCorrFctnCollection->end();iter++){
235       AliFemtoCorrFctn* fctn = (*iter)->Clone();
236       if (fctn) AddCorrFctn(fctn);
237     }
238     
239     fNumEventsToMix = TheOriginalAnalysis.fNumEventsToMix;
240   }
241
242   return *this;
243 }
244 //____________________________
245 AliFemtoVertexMultAnalysis::~AliFemtoVertexMultAnalysis(){
246   // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
247   delete fPicoEventCollectionVectorHideAway;
248 }
249
250 //____________________________
251 AliFemtoString AliFemtoVertexMultAnalysis::Report()
252 {
253   // Prepare a report of the execution
254   cout << "AliFemtoVertexMultAnalysis - constructing Report..."<<endl;
255   char ctemp[200];
256   AliFemtoString temp = "-----------\nHbt AliFemtoVertexMultAnalysis Report:\n";
257   snprintf(ctemp , 200, "Events are mixed in %d VertexZ bins in the range %E cm to %E cm.\n",fVertexZBins,fVertexZ[0],fVertexZ[1]);
258   temp += ctemp;
259   snprintf(ctemp , 200, "Events underflowing: %d\n",fUnderFlowVertexZ);
260   temp += ctemp;
261   snprintf(ctemp , 200, "Events overflowing: %d\n",fOverFlowVertexZ);
262   temp += ctemp;
263   snprintf(ctemp , 200, "Events are mixed in %d Mult bins in the range %E cm to %E cm.\n",fMultBins,fMult[0],fMult[1]);
264   temp += ctemp;
265   snprintf(ctemp , 200, "Events underflowing: %d\n",fUnderFlowMult);
266   temp += ctemp;
267   snprintf(ctemp , 200, "Events overflowing: %d\n",fOverFlowMult);
268   temp += ctemp;
269   snprintf(ctemp , 200, "Now adding AliFemtoSimpleAnalysis(base) Report\n");
270   temp += ctemp;
271   temp += AliFemtoSimpleAnalysis::Report();
272   AliFemtoString returnThis=temp;
273   return returnThis;
274 }
275 //_________________________
276 void AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
277   // Perform event processing
278   // in bins of z vertex and multiplicity
279
280   // cout << " AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
281   // get right mixing buffer
282   double vertexZ = hbtEvent->PrimVertPos().z();
283   double mult = hbtEvent->UncorrectedNumberOfPrimaries();
284   fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ,mult); 
285   if (!fMixingBuffer) {
286     if ( vertexZ < fVertexZ[0] ) fUnderFlowVertexZ++;
287     if ( vertexZ > fVertexZ[1] ) fOverFlowVertexZ++;
288     if ( mult < fMult[0] ) fUnderFlowMult++;
289     if ( mult > fMult[1] ) fOverFlowMult++;
290     return;
291   }
292   //cout<<" AliFemtoVertexMultAnalysis:: -> Simple"<<endl;
293   // call ProcessEvent() from AliFemtoSimpleAnalysis-base
294   AliFemtoSimpleAnalysis::ProcessEvent(hbtEvent);
295 }