]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoVertexMultAnalysis.cxx
Merge branch 'feature-movesplit'
[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
77 //____________________________
78 AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(unsigned int binsVertex, double minVertex, double maxVertex,
79                                                        unsigned int binsMult, double minMult, double maxMult) 
80   : 
81   fVertexZBins(binsVertex), 
82   fOverFlowVertexZ(0), 
83   fUnderFlowVertexZ(0),
84   fMultBins(binsMult) ,
85   fOverFlowMult(0),    
86   fUnderFlowMult(0)    
87 {
88   //  mControlSwitch     = 0;
89   fEventCut          = 0;
90   fFirstParticleCut  = 0;
91   fSecondParticleCut = 0;
92   fPairCut           = 0;
93   fCorrFctnCollection= 0;
94   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
95   fVertexZ[0] = minVertex;
96   fVertexZ[1] = maxVertex;
97   fUnderFlowVertexZ = 0; 
98   fOverFlowVertexZ = 0; 
99   fMult[0] = minMult;
100   fMult[1] = maxMult;
101   fUnderFlowMult = 0; 
102   fOverFlowMult = 0; 
103   if (fMixingBuffer) delete fMixingBuffer;
104   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
105                                                                                   fMultBins,fMult[0],fMult[1]);
106 }
107 //____________________________
108
109 AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) : 
110   AliFemtoSimpleAnalysis(),
111   fVertexZBins(a.fVertexZBins), 
112   fOverFlowVertexZ(0), 
113   fUnderFlowVertexZ(0),
114   fMultBins(a.fMultBins) ,
115   fOverFlowMult(0),    
116   fUnderFlowMult(0)    
117 {
118   //AliFemtoVertexMultAnalysis();
119   fEventCut          = 0;
120   fFirstParticleCut  = 0;
121   fSecondParticleCut = 0;
122   fPairCut           = 0;
123   fCorrFctnCollection= 0;
124   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
125   fVertexZ[0] = a.fVertexZ[0]; 
126   fVertexZ[1] = a.fVertexZ[1];
127   fUnderFlowVertexZ = 0; 
128   fOverFlowVertexZ = 0; 
129   fMult[0] = a.fMult[0]; 
130   fMult[1] = a.fMult[1];
131   fUnderFlowMult = 0; 
132   fOverFlowMult = 0; 
133   if (fMixingBuffer) delete fMixingBuffer;
134   fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
135                                                                                   fMultBins,fMult[0],fMult[1]);
136
137   // find the right event cut
138   fEventCut = a.fEventCut->Clone();
139   // find the right first particle cut
140   fFirstParticleCut = a.fFirstParticleCut->Clone();
141   // find the right second particle cut
142   if (a.fFirstParticleCut==a.fSecondParticleCut) 
143     SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
144   else
145   fSecondParticleCut = a.fSecondParticleCut->Clone();
146
147   fPairCut = a.fPairCut->Clone();
148   
149   if ( fEventCut ) {
150       SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
151       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - event cut set " << endl;
152   }
153   if ( fFirstParticleCut ) {
154       SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
155       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - first particle cut set " << endl;
156   }
157   if ( fSecondParticleCut ) {
158       SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
159       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - second particle cut set " << endl;
160   }  if ( fPairCut ) {
161       SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
162       cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - pair cut set " << endl;
163   }
164
165   AliFemtoCorrFctnIterator iter;
166   for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
167     cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - looking for correlation functions " << endl;
168     AliFemtoCorrFctn* fctn = (*iter)->Clone();
169     if (fctn) AddCorrFctn(fctn);
170     else cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - correlation function not found " << endl;
171   }
172
173   fNumEventsToMix = a.fNumEventsToMix;
174
175   cout << " AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) - analysis copied " << endl;
176
177 }
178 AliFemtoVertexMultAnalysis& AliFemtoVertexMultAnalysis::operator=(const AliFemtoVertexMultAnalysis& TheOriginalAnalysis)
179 {
180   if (this != &TheOriginalAnalysis) {
181     AliFemtoVertexMultAnalysis::operator=(TheOriginalAnalysis);
182     fVertexZBins = TheOriginalAnalysis.fVertexZBins; 
183     fMultBins = TheOriginalAnalysis.fMultBins;
184
185     fEventCut          = 0;
186     fFirstParticleCut  = 0;
187     fSecondParticleCut = 0;
188     fPairCut           = 0;
189     if (fCorrFctnCollection) delete fCorrFctnCollection;
190     fCorrFctnCollection = new AliFemtoCorrFctnCollection;
191     fVertexZ[0] = TheOriginalAnalysis.fVertexZ[0]; 
192     fVertexZ[1] = TheOriginalAnalysis.fVertexZ[1];
193     fUnderFlowVertexZ = 0; 
194     fOverFlowVertexZ = 0; 
195     fMult[0] = TheOriginalAnalysis.fMult[0]; 
196     fMult[1] = TheOriginalAnalysis.fMult[1];
197     fUnderFlowMult = 0; 
198     fOverFlowMult = 0; 
199     if (fMixingBuffer) delete fMixingBuffer;
200     if (fPicoEventCollectionVectorHideAway) delete fPicoEventCollectionVectorHideAway;
201     fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
202                                                                                        fMultBins,fMult[0],fMult[1]);
203
204     // find the right event cut
205     fEventCut = TheOriginalAnalysis.fEventCut->Clone();
206     // find the right first particle cut
207     fFirstParticleCut = TheOriginalAnalysis.fFirstParticleCut->Clone();
208     // find the right second particle cut
209     if (TheOriginalAnalysis.fFirstParticleCut==TheOriginalAnalysis.fSecondParticleCut) 
210       SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
211     else
212       fSecondParticleCut = TheOriginalAnalysis.fSecondParticleCut->Clone();
213
214     fPairCut = TheOriginalAnalysis.fPairCut->Clone();
215   
216     if ( fEventCut ) {
217       SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
218     }
219     if ( fFirstParticleCut ) {
220       SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
221     }
222     if ( fSecondParticleCut ) {
223       SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
224     }  if ( fPairCut ) {
225       SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
226       
227     }
228
229     AliFemtoCorrFctnIterator iter;
230     for (iter=TheOriginalAnalysis.fCorrFctnCollection->begin(); iter!=TheOriginalAnalysis.fCorrFctnCollection->end();iter++){
231       AliFemtoCorrFctn* fctn = (*iter)->Clone();
232       if (fctn) AddCorrFctn(fctn);
233     }
234     
235     fNumEventsToMix = TheOriginalAnalysis.fNumEventsToMix;
236   }
237
238   return *this;
239 }
240 //____________________________
241 AliFemtoVertexMultAnalysis::~AliFemtoVertexMultAnalysis(){
242   // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
243   delete fPicoEventCollectionVectorHideAway;
244 }
245
246 //____________________________
247 AliFemtoString AliFemtoVertexMultAnalysis::Report()
248 {
249   // Prepare a report of the execution
250   cout << "AliFemtoVertexMultAnalysis - constructing Report..."<<endl;
251   char ctemp[200];
252   AliFemtoString temp = "-----------\nHbt AliFemtoVertexMultAnalysis Report:\n";
253   snprintf(ctemp , 200, "Events are mixed in %d VertexZ bins in the range %E cm to %E cm.\n",fVertexZBins,fVertexZ[0],fVertexZ[1]);
254   temp += ctemp;
255   snprintf(ctemp , 200, "Events underflowing: %d\n",fUnderFlowVertexZ);
256   temp += ctemp;
257   snprintf(ctemp , 200, "Events overflowing: %d\n",fOverFlowVertexZ);
258   temp += ctemp;
259   snprintf(ctemp , 200, "Events are mixed in %d Mult bins in the range %E cm to %E cm.\n",fMultBins,fMult[0],fMult[1]);
260   temp += ctemp;
261   snprintf(ctemp , 200, "Events underflowing: %d\n",fUnderFlowMult);
262   temp += ctemp;
263   snprintf(ctemp , 200, "Events overflowing: %d\n",fOverFlowMult);
264   temp += ctemp;
265   snprintf(ctemp , 200, "Now adding AliFemtoSimpleAnalysis(base) Report\n");
266   temp += ctemp;
267   temp += AliFemtoSimpleAnalysis::Report();
268   AliFemtoString returnThis=temp;
269   return returnThis;
270 }
271 //_________________________
272 void AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) {
273   // Perform event processing
274   // in bins of z vertex and multiplicity
275
276   // cout << " AliFemtoVertexMultAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
277   // get right mixing buffer
278   double vertexZ = hbtEvent->PrimVertPos().z();
279   double mult = hbtEvent->UncorrectedNumberOfPrimaries();
280   fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ,mult); 
281   if (!fMixingBuffer) {
282     if ( vertexZ < fVertexZ[0] ) fUnderFlowVertexZ++;
283     if ( vertexZ > fVertexZ[1] ) fOverFlowVertexZ++;
284     if ( mult < fMult[0] ) fUnderFlowMult++;
285     if ( mult > fMult[1] ) fOverFlowMult++;
286     return;
287   }
288   //cout<<" AliFemtoVertexMultAnalysis:: -> Simple"<<endl;
289   // call ProcessEvent() from AliFemtoSimpleAnalysis-base
290   AliFemtoSimpleAnalysis::ProcessEvent(hbtEvent);
291 }