AliPhysics  8b695ca (8b695ca)
AliFlowEvent.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /*****************************************************************
17  AliFlowEvent: Event container for flow analysis
18 
19  origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
20  mods: Redmer A. Bertens (rbertens@cern.ch)
21 *****************************************************************/
22 
23 #include <TGrid.h>
24 #include "Riostream.h"
25 #include "TFile.h"
26 #include "TList.h"
27 #include "TH1.h"
28 #include "TH1F.h"
29 #include "TH2F.h"
30 #include "TH3F.h"
31 #include "TArrayD.h"
32 #include "TProfile.h"
33 #include "AliMCEvent.h"
34 #include "AliMCParticle.h"
35 #include "AliCFManager.h"
36 #include "AliESDtrack.h"
37 #include "AliESDPmdTrack.h"
38 #include "AliESDEvent.h"
39 #include "AliAODEvent.h"
40 #include "AliOADBContainer.h"
41 #include "AliGenCocktailEventHeader.h"
42 #include "AliGenEposEventHeader.h"
43 #include "AliGenHijingEventHeader.h"
44 #include "AliGenGeVSimEventHeader.h"
45 #include "AliCollisionGeometry.h"
46 #include "AliMultiplicity.h"
47 #include "AliMultSelection.h"
48 #include "AliFlowTrackCuts.h"
49 #include "AliFlowEventSimple.h"
50 #include "AliFlowTrack.h"
51 #include "AliFlowVector.h"
52 #include "AliFlowEvent.h"
53 #include "AliLog.h"
54 
55 using std::endl;
56 using std::cout;
57 ClassImp(AliFlowEvent)
58 
59 //-----------------------------------------------------------------------
61  AliFlowEventSimple(), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
62 {
63  // constructor
64  for(Int_t i(0); i < 9; i++) {
65  for(Int_t j(0); j < 2; j++) {
66  for(Int_t k(0); k < 2; k++) {
67  fMeanQ[i][j][k] = 0.;
68  fWidthQ[i][j][k] = 0.;
69  fMeanQv3[i][j][k] = 0.;
70  fWidthQv3[i][j][k] = 0.;
71  }
72  }
73  }
74  for(Int_t i(0); i < 5; i++) {
75  fQxavsV0[i] = 0x0;
76  fQyavsV0[i] = 0x0;
77  fQxcvsV0[i] = 0x0;
78  fQycvsV0[i] = 0x0;
79  }
80  //ctor
81  cout << "AliFlowEvent: Default constructor to be used only by root for io" << endl;
82 }
83 
84 //-----------------------------------------------------------------------
86  AliFlowEventSimple(n), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
87 {
88  // constructor
89  for(Int_t i(0); i < 9; i++) {
90  for(Int_t j(0); j < 2; j++) {
91  for(Int_t k(0); k < 2; k++) {
92  fMeanQ[i][j][k] = 0.;
93  fWidthQ[i][j][k] = 0.;
94  fMeanQv3[i][j][k] = 0.;
95  fWidthQv3[i][j][k] = 0.;
96  }
97  }
98  }
99  for(Int_t i(0); i < 5; i++) {
100  fQxavsV0[i] = 0x0;
101  fQyavsV0[i] = 0x0;
102  fQxcvsV0[i] = 0x0;
103  fQycvsV0[i] = 0x0;
104  }
105 }
106 
107 //-----------------------------------------------------------------------
110 {
111  // copy constructor
112  for(Int_t i(0); i < 9; i++) {
113  for(Int_t j(0); j < 2; j++) {
114  for(Int_t k(0); k < 2; k++) {
115  fMeanQ[i][j][k] = 0.;
116  fWidthQ[i][j][k] = 0.;
117  fMeanQv3[i][j][k] = 0.;
118  fWidthQv3[i][j][k] = 0.;
119  }
120  }
121  }
122  for(Int_t i(0); i < 5; i++) {
123  fQxavsV0[i] = 0x0;
124  fQyavsV0[i] = 0x0;
125  fQxcvsV0[i] = 0x0;
126  fQycvsV0[i] = 0x0;
127  }
128 }
129 
130 //-----------------------------------------------------------------------
132 {
133  //assignment operator
134  if (&event==this) return *this; // check self-assignment
135 
136  fApplyRecentering = event.fApplyRecentering;
137  fCachedRun = event.fCachedRun;
138  fVZEROcentralityBin = event.fVZEROcentralityBin;
139  fDivSigma = event.fDivSigma;
140  fEvent = 0x0; // should never be copied
141  fChi2A = 0x0; // do not clone these; if 0x0 they will be retrieved from the rp cuts object
142  fChi2C = 0x0;
143  fChi3A = 0x0;
144  fChi3C = 0x0;
145  for(Int_t i(0); i < 9; i++) {
146  for(Int_t j(0); j < 2; j++) {
147  for(Int_t k(0); k < 2; k++) {
148  fMeanQ[i][j][k] = event.fMeanQ[i][j][k];
149  fWidthQ[i][j][k] = event.fWidthQ[i][j][k];
150  fMeanQv3[i][j][k] = event.fMeanQv3[i][j][k];
151  fWidthQv3[i][j][k] = event.fWidthQv3[i][j][k];
152  }
153  }
154  }
155  for(Int_t i(0); i < 5; i++) {
156  fQxavsV0[i] = 0x0;
157  fQyavsV0[i] = 0x0;
158  fQxcvsV0[i] = 0x0;
159  fQycvsV0[i] = 0x0;
160  }
161 
163  return *this;
164 }
165 //-----------------------------------------------------------------------
167 {
168  //get track i from collection
169  if (i>=fNumberOfTracks) return NULL;
170  AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i)) ;
171  return pTrack;
172 }
173 
174 //-----------------------------------------------------------------------
175 void AliFlowEvent::SetMCReactionPlaneAngle(const AliMCEvent* mcEvent)
176 {
177  //sets the event plane angle from the proper header in the MC
178 
179  //COCKTAIL with HIJING
180  if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) //returns 0 if matches
181  {
182  AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
183  if (headerC)
184  {
185  TList *lhd = headerC->GetHeaders();
186  if (lhd)
187  {
188  AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0));
189  if (hdh) AliFlowEventSimple::SetMCReactionPlaneAngle( hdh->ReactionPlaneAngle() );
190  }
191  }
192  }
193  //THERMINATOR
194  else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Therminator")) //returns 0 if matches
195  {
196  AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
197  if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
198  }
199  //GEVSIM
200  else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"GeVSim header")) //returns 0 if matches
201  {
202  AliGenGeVSimEventHeader* headerG = dynamic_cast<AliGenGeVSimEventHeader*>(mcEvent->GenEventHeader());
203  if (headerG) AliFlowEventSimple::SetMCReactionPlaneAngle( headerG->GetEventPlane() );
204  }
205  //HIJING
206  else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Hijing")) //returns 0 if matches
207  {
208  AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
209  if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
210  }
211  //AMPT
212  else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Ampt")) //returns 0 if matches
213  {
214  AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
215  if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
216  }
217  //EPOS
218  else if (!strcmp(mcEvent->GenEventHeader()->GetName(),"EPOS"))
219  {
220  AliGenEposEventHeader* headerE = dynamic_cast<AliGenEposEventHeader*>(mcEvent->GenEventHeader());
221  if (headerE) AliFlowEventSimple::SetMCReactionPlaneAngle( headerE->ReactionPlaneAngle() );
222  }
223  //Hydjet
224  else
225  {
226  AliCollisionGeometry* header = dynamic_cast<AliCollisionGeometry*>(mcEvent->GenEventHeader());
227  if (header) AliFlowEventSimple::SetMCReactionPlaneAngle( header->ReactionPlaneAngle() );
228  }
229 }
230 
231 //-----------------------------------------------------------------------
232 AliFlowEvent::AliFlowEvent( const AliMCEvent* anInput,
233  const AliCFManager* rpCFManager,
234  const AliCFManager* poiCFManager):
235  AliFlowEventSimple(20), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
236 {
237  // constructor
238  for(Int_t i(0); i < 9; i++) {
239  for(Int_t j(0); j < 2; j++) {
240  for(Int_t k(0); k < 2; k++) {
241  fMeanQ[i][j][k] = 0.;
242  fWidthQ[i][j][k] = 0.;
243  fMeanQv3[i][j][k] = 0.;
244  fWidthQv3[i][j][k] = 0.;
245  }
246  }
247  }
248  for(Int_t i(0); i < 5; i++) {
249  fQxavsV0[i] = 0x0;
250  fQyavsV0[i] = 0x0;
251  fQxcvsV0[i] = 0x0;
252  fQycvsV0[i] = 0x0;
253  }
254 
255  //Fills the event from the MC kinematic information
256  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
257 
258  //loop over tracks
259  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
260  {
261  //get input particle
262  AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(anInput->GetTrack(itrkN));
263  if (!pParticle) continue;
264 
265  //check if pParticle passes the cuts
266  Bool_t rpOK = kTRUE;
267  Bool_t poiOK = kTRUE;
268  if (rpCFManager && poiCFManager)
269  {
270  rpOK = rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
271  poiOK = poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
272  }
273  if (!(rpOK||poiOK)) continue;
274 
275  AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
277 
278  if (rpOK && rpCFManager)
279  {
280  pTrack->SetForRPSelection(kTRUE);
282  }
283  if (poiOK && poiCFManager)
284  {
285  pTrack->SetForPOISelection(kTRUE);
287  }
288 
289  AddTrack(pTrack) ;
290  }//for all tracks
291  SetMCReactionPlaneAngle(anInput);
292 }
293 
294 //-----------------------------------------------------------------------
296  const AliCFManager* rpCFManager,
297  const AliCFManager* poiCFManager ):
298  AliFlowEventSimple(20), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
299 {
300  // constructor
301  for(Int_t i(0); i < 9; i++) {
302  for(Int_t j(0); j < 2; j++) {
303  for(Int_t k(0); k < 2; k++) {
304  fMeanQ[i][j][k] = 0.;
305  fWidthQ[i][j][k] = 0.;
306  fMeanQv3[i][j][k] = 0.;
307  fWidthQv3[i][j][k] = 0.;
308  }
309  }
310  }
311  for(Int_t i(0); i < 5; i++) {
312  fQxavsV0[i] = 0x0;
313  fQyavsV0[i] = 0x0;
314  fQxcvsV0[i] = 0x0;
315  fQycvsV0[i] = 0x0;
316  }
317  //set run number
318  if(anInput->GetRunNumber()) fRun = anInput->GetRunNumber();
319 
320  //Fills the event from the ESD
321 
322  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
323 
324  //loop over tracks
325  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
326  {
327  AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
328 
329  //check if pParticle passes the cuts
330  Bool_t rpOK = kTRUE;
331  Bool_t poiOK = kTRUE;
332  if (rpCFManager && poiCFManager)
333  {
334  rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
335  rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
336  poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
337  poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
338  }
339  if (!(rpOK || poiOK)) continue;
340 
341  //make new AliFLowTrack
342  AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
344 
345  //marking the particles used for int. flow:
346  if(rpOK && rpCFManager)
347  {
348  pTrack->SetForRPSelection(kTRUE);
350  }
351  //marking the particles used for diff. flow:
352  if(poiOK && poiCFManager)
353  {
354  pTrack->SetForPOISelection(kTRUE);
356  }
357 
358  AddTrack(pTrack);
359  }//end of while (itrkN < iNumberOfInputTracks)
360 }
361 
362 //-----------------------------------------------------------------------
364  const AliCFManager* rpCFManager,
365  const AliCFManager* poiCFManager):
366  AliFlowEventSimple(20), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
367 {
368  // constructor
369  for(Int_t i(0); i < 9; i++) {
370  for(Int_t j(0); j < 2; j++) {
371  for(Int_t k(0); k < 2; k++) {
372  fMeanQ[i][j][k] = 0.;
373  fWidthQ[i][j][k] = 0.;
374  fMeanQv3[i][j][k] = 0.;
375  fWidthQv3[i][j][k] = 0.;
376  }
377  }
378  }
379  for(Int_t i(0); i < 5; i++) {
380  fQxavsV0[i] = 0x0;
381  fQyavsV0[i] = 0x0;
382  fQxcvsV0[i] = 0x0;
383  fQycvsV0[i] = 0x0;
384  }
385 
386  //set run number
387  if(anInput->GetRunNumber()) fRun = anInput->GetRunNumber();
388 
389  //Fills the event from the AOD
390  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
391 
392  //loop over tracks
393  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
394  {
395  AliAODTrack* pParticle = dynamic_cast<AliAODTrack*>(anInput->GetTrack(itrkN));
396  if(!pParticle) AliFatal("Not a standard AOD"); //get input particle
397 
398  //check if pParticle passes the cuts
399  Bool_t rpOK = kTRUE;
400  Bool_t poiOK = kTRUE;
401  if (rpCFManager && poiCFManager)
402  {
403  rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
404  rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
405  poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
406  poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
407  }
408  if (!(rpOK || poiOK)) continue;
409 
410  //make new AliFlowTrack
411  AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
413 
414  if (rpOK /* && rpCFManager */ ) // to be fixed - with CF managers uncommented only empty events (NULL in header files)
415  {
416  pTrack->SetForRPSelection(kTRUE);
418  }
419  if (poiOK /* && poiCFManager*/ )
420  {
421  pTrack->SetForPOISelection(kTRUE);
423  }
424  AddTrack(pTrack);
425  }
426 
427  // if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult)
428  // {
429  // if ( (++fCount % 100) == 0)
430  // {
431  // if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
432  // else cout<<" MC Reaction Plane Angle = unknown "<< endl;
433  // cout<<" iGoodTracks = "<<iGoodTracks<<endl;
434  // cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
435  // cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
436  // cout << "# " << fCount << " events processed" << endl;
437  // }
438  // return pEvent;
439  // }
440  // else
441  // {
442  // cout<<"Not enough tracks in the FlowEventSimple"<<endl;
443  // return 0;
444  // }
445  //}
446  //else
447  //{
448  // cout<<"Event does not pass multiplicity cuts"<<endl;
449  // return 0;
450  //}
451 
452 }
453 
454 //-----------------------------------------------------------------------
456  const AliMCEvent* anInputMc,
457  KineSource anOption,
458  const AliCFManager* rpCFManager,
459  const AliCFManager* poiCFManager ):
460  AliFlowEventSimple(20), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
461 {
462  // constructor
463  for(Int_t i(0); i < 9; i++) {
464  for(Int_t j(0); j < 2; j++) {
465  for(Int_t k(0); k < 2; k++) {
466  fMeanQ[i][j][k] = 0.;
467  fWidthQ[i][j][k] = 0.;
468  fMeanQv3[i][j][k] = 0.;
469  fWidthQv3[i][j][k] = 0.;
470  }
471  }
472  }
473  for(Int_t i(0); i < 5; i++) {
474  fQxavsV0[i] = 0x0;
475  fQyavsV0[i] = 0x0;
476  fQxcvsV0[i] = 0x0;
477  fQycvsV0[i] = 0x0;
478  }
479  //fills the event with tracks from the ESD and kinematics from the MC info via the track label
480  if (anOption==kNoKine)
481  {
482  AliFatal("WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, KineSource anOption)");
483  exit(1);
484  }
485 
486  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
487 
488  Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
489  if (iNumberOfInputTracksMC==-1)
490  {
491  AliError("Skipping Event -- No MC information available for this event");
492  return;
493  }
494 
495  //loop over ESD tracks
496  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
497  {
498  AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
499  //get Label
500  Int_t iLabel = pParticle->GetLabel();
501  //match to mc particle
502  AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
503 
504  //check
505  if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label())
506  AliWarning(Form("pParticle->GetLabel()!=pMcParticle->Label(), %i, %i", pParticle->GetLabel(), pMcParticle->Label()));
507 
508  //check if pParticle passes the cuts
509  Bool_t rpOK = kFALSE;
510  Bool_t poiOK = kFALSE;
511  if (rpCFManager && poiCFManager)
512  {
513  if(anOption == kESDkine)
514  {
515  if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
516  rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
517  rpOK=kTRUE;
518  if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
519  poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
520  poiOK=kTRUE;
521  }
522  else if (anOption == kMCkine)
523  {
524  if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
525  rpOK=kTRUE;
526  if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
527  poiOK=kTRUE;
528  }
529  }
530 
531  if (!(rpOK || poiOK)) continue;
532 
533  //make new AliFlowTrack
534  AliFlowTrack* pTrack = NULL;
535  if(anOption == kESDkine) //take the PID from the MC & the kinematics from the ESD
536  {
537  pTrack = new AliFlowTrack(pParticle);
538  }
539  else if (anOption == kMCkine) //take the PID and kinematics from the MC
540  {
541  pTrack = new AliFlowTrack(pMcParticle);
542  }
543 
544  if (rpOK && rpCFManager)
545  {
547  pTrack->SetForRPSelection();
548  }
549  if (poiOK && poiCFManager)
550  {
552  pTrack->SetForPOISelection();
553  }
554 
555  AddTrack(pTrack);
556  }
557  SetMCReactionPlaneAngle(anInputMc);
558 }
559 
560 //-----------------------------------------------------------------------
562  const AliMultiplicity* anInputTracklets,
563  const AliCFManager* poiCFManager ):
564  AliFlowEventSimple(20), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
565 {
566  // constructor
567  for(Int_t i(0); i < 9; i++) {
568  for(Int_t j(0); j < 2; j++) {
569  for(Int_t k(0); k < 2; k++) {
570  fMeanQ[i][j][k] = 0.;
571  fWidthQ[i][j][k] = 0.;
572  fMeanQv3[i][j][k] = 0.;
573  fWidthQv3[i][j][k] = 0.;
574  }
575  }
576  }
577  for(Int_t i(0); i < 5; i++) {
578  fQxavsV0[i] = 0x0;
579  fQyavsV0[i] = 0x0;
580  fQxcvsV0[i] = 0x0;
581  fQycvsV0[i] = 0x0;
582  }
583 
584  //Select the particles of interest from the ESD
585  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
586 
587  //loop over tracks
588  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
589  {
590  AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
591 
592  //check if pParticle passes the cuts
593  Bool_t poiOK = kTRUE;
594  if (poiCFManager)
595  {
596  poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
597  poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
598  }
599  if (!poiOK) continue;
600 
601  //make new AliFLowTrack
602  AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
603 
604  //marking the particles used for the particle of interest (POI) selection:
605  if(poiOK && poiCFManager)
606  {
608  pTrack->SetForPOISelection(kTRUE);
610  }
611 
612  AddTrack(pTrack);
613  }//end of while (itrkN < iNumberOfInputTracks)
614 
615  //Select the reference particles from the SPD tracklets
616  anInputTracklets = anInput->GetMultiplicity();
617  Int_t multSPD = anInputTracklets->GetNumberOfTracklets();
618 
619  //loop over tracklets
620  for (Int_t itracklet=0; itracklet<multSPD; ++itracklet) {
621  Float_t thetaTr= anInputTracklets->GetTheta(itracklet);
622  Float_t phiTr= anInputTracklets->GetPhi(itracklet);
623  // calculate eta
624  Float_t etaTr = -TMath::Log(TMath::Tan(thetaTr/2.));
625 
626  //make new AliFLowTrackSimple
627  AliFlowTrack* pTrack = new AliFlowTrack();
628  pTrack->SetPt(0.0);
629  pTrack->SetEta(etaTr);
630  pTrack->SetPhi(phiTr);
631  //marking the particles used for the reference particle (RP) selection:
633  pTrack->SetForRPSelection(kTRUE);
635 
636  //Add the track to the flowevent
637  AddTrack(pTrack);
638  }
639 
640 }
641 
642 //-----------------------------------------------------------------------
644  const AliCFManager* poiCFManager,
645  Bool_t hybrid):
646  AliFlowEventSimple(20), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
647 {
648  // constructor
649  for(Int_t i(0); i < 9; i++) {
650  for(Int_t j(0); j < 2; j++) {
651  for(Int_t k(0); k < 2; k++) {
652  fMeanQ[i][j][k] = 0.;
653  fWidthQ[i][j][k] = 0.;
654  fMeanQv3[i][j][k] = 0.;
655  fWidthQv3[i][j][k] = 0.;
656  }
657  }
658  }
659  for(Int_t i(0); i < 5; i++) {
660  fQxavsV0[i] = 0x0;
661  fQyavsV0[i] = 0x0;
662  fQxcvsV0[i] = 0x0;
663  fQycvsV0[i] = 0x0;
664  }
665  //Select the particles of interest from the ESD
666  Int_t iNumberOfInputTracks = esd->GetNumberOfTracks() ;
667 
668  //Double_t gPt = 0.0, gP = 0.0;
669  Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0}; //The impact parameters and their covariance.
670 // Double_t dca3D = 0.0; FIXME unused variable
671 
672  AliESDtrack trackTPC;
673 
674  //loop over tracks
675  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
676  {
677 
678  if (!esd->GetTrack(itrkN)) continue;
679 
680  Bool_t useTPC = kFALSE;
681 
682  AliESDtrack* pParticle = esd->GetTrack(itrkN); //get input particle
683 
684  //check if pParticle passes the cuts
685  Bool_t poiOK = kTRUE;
686 
687  if (poiCFManager)
688  {
689  poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
690  poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
691  }
692 
693  if (!(poiOK)) continue;
694 
695  AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)pParticle->GetTPCInnerParam();
696 
697  if (tpcTrack)
698  {
699 
700 // gPt = tpcTrack->Pt();
701 // gP = tpcTrack->P();
702 
703  useTPC = kTRUE;
704 
705  const AliESDVertex *vertexSPD = esd->GetPrimaryVertexSPD();
706  const AliESDVertex *vertexTPC = esd->GetPrimaryVertexTPC();
707 
708  AliExternalTrackParam copy(*tpcTrack);
709  if(hybrid)
710  copy.PropagateToDCA(vertexSPD,esd->GetMagneticField(),100.,dca,cov);
711  else
712  copy.PropagateToDCA(vertexTPC,esd->GetMagneticField(),100.,dca,cov);
713 
714 // dca3D = TMath::Sqrt(TMath::Power(dca[0],2)+TMath::Power(dca[1],2)); FIXME unused variable
715 
716  }
717 
718  //make new AliFLowTrack
719  AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
720 
722 
723  //marking the particles used for diff. flow:
724  if(poiOK && poiCFManager)
725  {
726  pTrack->SetForPOISelection(kTRUE);
728  }
729 
730  if(useTPC)
731  {
732  pTrack->SetForRPSelection(kTRUE);
734  }
735 
736  AddTrack(pTrack);
737 
738  }//end of while (itrkN < iNumberOfInputTracks)
739 
740 }
741 
742 //-----------------------------------------------------------------------
744  const TH2F* anInputFMDhist,
745  const AliCFManager* poiCFManager ):
746  AliFlowEventSimple(20), fApplyRecentering(-1), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
747 {
748  // constructor
749  for(Int_t i(0); i < 9; i++) {
750  for(Int_t j(0); j < 2; j++) {
751  for(Int_t k(0); k < 2; k++) {
752  fMeanQ[i][j][k] = 0.;
753  fWidthQ[i][j][k] = 0.;
754  fMeanQv3[i][j][k] = 0.;
755  fWidthQv3[i][j][k] = 0.;
756  }
757  }
758  }
759  for(Int_t i(0); i < 5; i++) {
760  fQxavsV0[i] = 0x0;
761  fQyavsV0[i] = 0x0;
762  fQxcvsV0[i] = 0x0;
763  fQycvsV0[i] = 0x0;
764  }
765 
766  //Select the particles of interest from the ESD
767  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
768 
769  //loop over tracks
770  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
771  {
772  AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
773 
774  //check if pParticle passes the cuts
775  Bool_t poiOK = kTRUE;
776  if (poiCFManager)
777  {
778  poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
779  poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
780  }
781  if (!poiOK) continue;
782 
783  //make new AliFLowTrack
784  AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
785 
786  //marking the particles used for the particle of interest (POI) selection:
787  if(poiOK && poiCFManager)
788  {
790  pTrack->SetForPOISelection(kTRUE);
792  }
793 
794  AddTrack(pTrack);
795  }//end of while (itrkN < iNumberOfInputTracks)
796 
797  //Select the reference particles from the FMD hits
798  //loop over FMD histogram
799  Int_t iBinsEta = anInputFMDhist->GetNbinsX();
800  Int_t iBinsPhi = anInputFMDhist->GetNbinsY();
801 
802  for (Int_t iEta = 1; iEta <= iBinsEta; iEta++){
803  Double_t etaFMD = anInputFMDhist->GetXaxis()->GetBinCenter(iEta);
804  for (Int_t iPhi = 1; iPhi <= iBinsPhi; iPhi++){
805  Double_t phiFMD = anInputFMDhist->GetYaxis()->GetBinCenter(iPhi);
806  Double_t weightFMD = anInputFMDhist->GetBinContent(iEta,iPhi);
807 
808  if (weightFMD > 0.0) { //do not add empty bins
809  //make new AliFLowTrackSimple
810  AliFlowTrack* pTrack = new AliFlowTrack();
811  pTrack->SetPt(0.0);
812  pTrack->SetEta(etaFMD);
813  pTrack->SetPhi(phiFMD);
814  pTrack->SetWeight(weightFMD);
815  //marking the particles used for the reference particle (RP) selection:
816  pTrack->TagRP();
819 
820  //Add the track to the flowevent
821  AddTrack(pTrack);
822 
823  }
824  }
825  }
826 
827 }
828 
829 //-----------------------------------------------------------------------
830 void AliFlowEvent::FindDaughters(Bool_t keepDaughtersInRPselection)
831 {
832  //each flow track holds it's esd track index as well as its daughters esd index.
833  //fill the array of daughters for every track with the pointers to flow tracks
834  //to associate the mothers with daughters directly
835  for (Int_t iTrack=0; iTrack<fMothersCollection->GetEntriesFast(); iTrack++)
836  {
837  AliFlowTrack* mother = static_cast<AliFlowTrack*>(fMothersCollection->At(iTrack));
838  if (!mother) continue;
839  if (mother->GetNDaughters()<1) continue;
840  for (Int_t iDaughterCandidate=0; iDaughterCandidate<fNumberOfTracks; iDaughterCandidate++)
841  {
842  AliFlowTrack* daughterCandidate = static_cast<AliFlowTrack*>(fTrackCollection->At(iDaughterCandidate));
843  Int_t esdIndexDaughterCandidate = daughterCandidate->GetID();
844  for (Int_t iDaughter=0; iDaughter<mother->GetNDaughters(); iDaughter++)
845  {
846  Int_t esdIndexDaughter = mother->GetIDDaughter(iDaughter);
847  if (esdIndexDaughter==esdIndexDaughterCandidate)
848  {
849  mother->SetDaughter(iDaughter,daughterCandidate);
850  daughterCandidate->SetForRPSelection(keepDaughtersInRPselection);
851  }
852  }
853  }
854  }
855 }
856 
857 //-----------------------------------------------------------------------
859  AliFlowTrackCuts* poiCuts )
860 {
861  //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
862  //the input data needs to be attached to the cuts
863  //we have two cases, if we're cutting the same collection of tracks
864  //(same param type) then we can have tracks that are both rp and poi
865  //in the other case we want to have two exclusive sets of rps and pois
866  //e.g. one tracklets, the other PMD or global - USER IS RESPOSIBLE
867  //FOR MAKING SURE THEY DONT OVERLAP OR ELSE THE SAME PARTICLE WILL BE
868  //TAKEN TWICE
869 
870  ClearFast();
871  if (!rpCuts || !poiCuts) return;
873  AliFlowTrackCuts::trackParameterType sourcePOI = poiCuts->GetParamType();
874  AliFlowTrack* pTrack=NULL;
875 
876  //set run
877  if(rpCuts->GetRun()) fRun = rpCuts->GetRun();
878 
879  // if the source for rp's or poi's is the VZERO detector, get the calibration
880  // and set the calibration parameters
881  if (sourceRP == AliFlowTrackCuts::kBetaVZERO) {
883  fDivSigma = rpCuts->GetDivSigma();
884  if(!rpCuts->GetApplyRecentering()) {
885  // if the user does not want to recenter, switch the flag
886  fApplyRecentering = -1;
887  }
888  // note: this flag is used in the overloaded implementation of Get2Qsub()
889  // and tells the function to use as Qsub vectors the recentered Q-vectors
890  // from the VZERO oadb file or from the event header
891  }
892  if (sourcePOI == AliFlowTrackCuts::kBetaVZERO) {
893  // probably no-one will choose vzero tracks as poi's ...
895  fDivSigma = poiCuts->GetDivSigma();
896  }
897 
898  if (sourceRP == AliFlowTrackCuts::kDeltaVZERO) {
900  fDivSigma = rpCuts->GetDivSigma();
901  if(!rpCuts->GetApplyRecentering()) {
902  // if the user does not want to recenter, switch the flag
903  fApplyRecentering = -1;
904  }
905  }
906  if (sourcePOI == AliFlowTrackCuts::kDeltaVZERO) {
907  // probably no-one will choose vzero tracks as poi's ...
909  fDivSigma = poiCuts->GetDivSigma();
910  }
911 
912  if (sourceRP == AliFlowTrackCuts::kKappaVZERO) {
914  fDivSigma = rpCuts->GetDivSigma();
915  if(!rpCuts->GetApplyRecentering()) {
916  // if the user does not want to recenter, switch the flag
917  fApplyRecentering = -1;
918  }
919  }
920  if (sourcePOI == AliFlowTrackCuts::kKappaVZERO) {
921  // probably no-one will choose vzero tracks as poi's ...
923  fDivSigma = poiCuts->GetDivSigma();
924  }
925 
926  if (sourceRP == AliFlowTrackCuts::kHotfixHI) {
928  }
929  if (sourcePOI == AliFlowTrackCuts::kHotfixHI) {
931  }
932 
933 
934  if (sourceRP == AliFlowTrackCuts::kVZERO) {
936  if(!rpCuts->GetApplyRecentering()) {
937  // if the user does not want to recenter, switch the flag
938  fApplyRecentering = -1;
939  }
940  // note: this flag is used in the overloaded implementation of Get2Qsub()
941  // and tells the function to use as Qsub vectors the recentered Q-vectors
942  // from the VZERO oadb file or from the event header
943  }
944  if (sourcePOI == AliFlowTrackCuts::kVZERO) {
945  // probably no-one will choose vzero tracks as poi's ...
947  }
948 
949  if (sourceRP==sourcePOI)
950  {
951  //loop over tracks
952  Int_t numberOfInputObjects = rpCuts->GetNumberOfInputObjects();
953  for (Int_t i=0; i<numberOfInputObjects; i++)
954  {
955  //get input object (particle)
956  TObject* particle = rpCuts->GetInputObject(i);
957 
958  Bool_t rp = rpCuts->IsSelected(particle,i);
959  Bool_t poi = poiCuts->IsSelected(particle,i);
960 
961  if (!(rp||poi)) continue;
962 
963  //make new AliFlowTrack
964  if (rp)
965  {
967  if (!pTrack) continue;
968  pTrack->Tag(0); IncrementNumberOfPOIs(0);
969  if (poi) {pTrack->Tag(1); IncrementNumberOfPOIs(1);}
970  if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
971  }
972  else if (poi)
973  {
975  if (!pTrack) continue;
976  pTrack->Tag(1); IncrementNumberOfPOIs(1);
977  if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
978  }
979  fNumberOfTracks++;
980  }//end of while (i < numberOfTracks)
981  }
982  else if (sourceRP!=sourcePOI)
983  {
984  //here we have two different sources of particles, so we fill
985  //them independently
986  //POI
987  for (Int_t i=0; i<poiCuts->GetNumberOfInputObjects(); i++)
988  {
989  TObject* particle = poiCuts->GetInputObject(i);
990  Bool_t poi = poiCuts->IsSelected(particle,i);
991  if (!poi) continue;
993  if (!pTrack) continue;
994  pTrack->Tag(1);
996  fNumberOfTracks++;
997  if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
998  }
999  //RP
1000  Int_t numberOfInputObjects = rpCuts->GetNumberOfInputObjects();
1001  for (Int_t i=0; i<numberOfInputObjects; i++)
1002  {
1003  TObject* particle = rpCuts->GetInputObject(i);
1004  Bool_t rp = rpCuts->IsSelected(particle,i);
1005  if (!rp) continue;
1007  if (!pTrack) continue;
1008  pTrack->Tag(0);
1010  fNumberOfTracks++;
1011  if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
1012  }
1013  }
1014 }
1015 
1016 //-----------------------------------------------------------------------
1018  // adds a flow track at the end of the container
1019  AliFlowTrack *pTrack = ReuseTrack( fNumberOfTracks++ );
1020  *pTrack = *track;
1021  if (track->GetNDaughters()>0)
1022  {
1023  fMothersCollection->Add(pTrack);
1024  }
1025  return;
1026 }
1027 
1028 //-----------------------------------------------------------------------
1030 {
1031  //try to reuse an existing track, if empty, make new one
1032  AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i));
1033  if (pTrack)
1034  {
1035  pTrack->Clear();
1036  }
1037  else
1038  {
1039  pTrack = new AliFlowTrack();
1040  fTrackCollection->AddAtAndExpand(pTrack,i);
1041  }
1042  return pTrack;
1043 }
1044 
1045 //-----------------------------------------------------------------------
1047  AliFlowTrackCuts* poiCuts ):
1048  AliFlowEventSimple(20), fApplyRecentering(kFALSE), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
1049 
1050 {
1051  // constructor
1052  for(Int_t i(0); i < 9; i++) {
1053  for(Int_t j(0); j < 2; j++) {
1054  for(Int_t k(0); k < 2; k++) {
1055  fMeanQ[i][j][k] = 0.;
1056  fWidthQ[i][j][k] = 0.;
1057  fMeanQv3[i][j][k] = 0.;
1058  fWidthQv3[i][j][k] = 0.;
1059  }
1060  }
1061  }
1062  for(Int_t i(0); i < 5; i++) {
1063  fQxavsV0[i] = 0x0;
1064  fQyavsV0[i] = 0x0;
1065  fQxcvsV0[i] = 0x0;
1066  fQycvsV0[i] = 0x0;
1067  }
1068  //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
1069  //the input data needs to be attached to the cuts
1070  Fill(rpCuts,poiCuts);
1071 }
1072 
1073 //-------------------------------------------------------------------//
1074 //---- Including PMD tracks as RP --------------------------//
1075 
1077  const AliESDPmdTrack *pmdtracks,
1078  const AliCFManager* poiCFManager ):
1079  AliFlowEventSimple(20), fApplyRecentering(kFALSE), fDivSigma(kTRUE), fCachedRun(-1), fVZEROcentralityBin(-1), fEvent(0x0), fChi2A(0x0), fChi2C(0x0), fChi3A(0x0), fChi3C(0x0)
1080 
1081 {
1082  // constructor
1083  for(Int_t i(0); i < 9; i++) {
1084  for(Int_t j(0); j < 2; j++) {
1085  for(Int_t k(0); k < 2; k++) {
1086  fMeanQ[i][j][k] = 0.;
1087  fWidthQ[i][j][k] = 0.;
1088  fMeanQv3[i][j][k] = 0.;
1089  fWidthQv3[i][j][k] = 0.;
1090  }
1091  }
1092  }
1093  for(Int_t i(0); i < 5; i++) {
1094  fQxavsV0[i] = 0x0;
1095  fQyavsV0[i] = 0x0;
1096  fQxcvsV0[i] = 0x0;
1097  fQycvsV0[i] = 0x0;
1098  }
1099 
1100  Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos);
1101  Float_t GetPmdPhi(Float_t xPos, Float_t yPos);
1102  //Select the particles of interest from the ESD
1103  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
1104 
1105  //loop over tracks
1106  for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
1107  {
1108  AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
1109  //check if pParticle passes the cuts
1110  Bool_t poiOK = kTRUE;
1111  if (poiCFManager)
1112  {
1113  poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
1114  poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
1115  }
1116  if (!poiOK) continue;
1117 
1118  //make new AliFLowTrack
1119  AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
1120 
1121  //marking the particles used for the particle of interest (POI) selection:
1122  if(poiOK && poiCFManager)
1123  {
1125  pTrack->SetForPOISelection(kTRUE);
1127  }
1128 
1129  AddTrack(pTrack);
1130  }//end of while (itrkN < iNumberOfInputTracks)
1131 
1132  //Select the reference particles from the PMD tracks
1133  Int_t npmdcl = anInput->GetNumberOfPmdTracks();
1134  printf("======There are %d PMD tracks in this event\n-------",npmdcl);
1135  //loop over clusters
1136  for(Int_t iclust=0; iclust < npmdcl; iclust++){
1137  //AliESDPmdTrack *pmdtr = anInput->GetPmdTrack(iclust);
1138  pmdtracks = anInput->GetPmdTrack(iclust);
1139  Int_t det = pmdtracks->GetDetector();
1140  //Int_t smn = pmdtracks->GetSmn();
1141  Float_t clsX = pmdtracks->GetClusterX();
1142  Float_t clsY = pmdtracks->GetClusterY();
1143  Float_t clsZ = pmdtracks->GetClusterZ();
1144  Float_t ncell = pmdtracks->GetClusterCells();
1145  Float_t adc = pmdtracks->GetClusterADC();
1146  //Float_t pid = pmdtracks->GetClusterPID();
1147  Float_t etacls = GetPmdEta(clsX,clsY,clsZ);
1148  Float_t phicls = GetPmdPhi(clsX,clsY);
1149  //make new AliFLowTrackSimple
1150  AliFlowTrack* pTrack = new AliFlowTrack();
1151  //if(det == 0){ //selecting preshower plane only
1152  if(det == 0 && adc > 270 && ncell > 1){ //selecting preshower plane only
1153  //pTrack->SetPt(adc);//cluster adc
1154  pTrack->SetPt(0.0);
1155  pTrack->SetEta(etacls);
1156  pTrack->SetPhi(phicls);
1157  //marking the particles used for the reference particle (RP) selection:
1159  pTrack->SetForRPSelection(kTRUE);
1161  //Add the track to the flowevent
1162  AddTrack(pTrack);
1163  }//if det
1164  }
1165 }
1166 //----------------------------------------------------------------------------//
1168 {
1169  Float_t rpxpy, theta, eta;
1170  rpxpy = TMath::Sqrt(xPos*xPos + yPos*yPos);
1171  theta = TMath::ATan2(rpxpy,zPos);
1172  eta = -TMath::Log(TMath::Tan(0.5*theta));
1173  return eta;
1174 }
1175 //--------------------------------------------------------------------------//
1177 {
1178  Float_t pybypx, phi = 0., phi1;
1179  if(xPos==0)
1180  {
1181  if(yPos>0) phi = 90.;
1182  if(yPos<0) phi = 270.;
1183  }
1184  if(xPos != 0)
1185  {
1186  pybypx = yPos/xPos;
1187  if(pybypx < 0) pybypx = - pybypx;
1188  phi1 = TMath::ATan(pybypx)*180./3.14159;
1189 
1190  if(xPos > 0 && yPos > 0) phi = phi1; // 1st Quadrant
1191  if(xPos < 0 && yPos > 0) phi = 180 - phi1; // 2nd Quadrant
1192  if(xPos < 0 && yPos < 0) phi = 180 + phi1; // 3rd Quadrant
1193  if(xPos > 0 && yPos < 0) phi = 360 - phi1; // 4th Quadrant
1194 
1195  }
1196  phi = phi*3.14159/180.;
1197  return phi;
1198 }
1199 //---------------------------------------------------------------//
1200 AliFlowVector AliFlowEvent::GetQ(Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights)
1201 {
1202  // start with the uncalibrated Q-vector. if we're not looking at vzero data, this will be returned
1203  // so this is completely backward compatible
1204  AliFlowVector vQ = AliFlowEventSimple::GetQ(n, weightsList, usePhiWeights, usePhiWeights, useEtaWeights);
1205  // see if we want to re-center 2010 style
1206  if(fApplyRecentering == 2010) {
1207  AliFlowVector Qarray[2];
1208  AliFlowEvent::Get2Qsub(Qarray, n, weightsList, usePhiWeights, usePtWeights, useEtaWeights);
1209  AliFlowVector vA = Qarray[0];
1210  AliFlowVector vB = Qarray[1];
1211 
1212  // now we have the calibrated sub-event q-vectors, these will be merged using a resolution derived weight
1213  Double_t chiA(1.), chiC(1.), dQX(0.), dQY(0.);
1214  if(n==2) {
1215  chiA = fChi2A->At(fVZEROcentralityBin);
1216  chiC = fChi2C->At(fVZEROcentralityBin);
1217  } else if (n==3) {
1218  chiA = fChi3A->At(fVZEROcentralityBin);
1219  chiC = fChi3C->At(fVZEROcentralityBin);
1220  }
1221 
1222  // combine the vzera and vzeroc signal, note that vzeroa is stored in vB and vzeroc in vA
1223  dQX = chiA*chiA*vB.X()+chiC*chiC*vA.X();
1224  dQY = chiA*chiA*vB.Y()+chiC*chiC*vA.Y();
1225  vQ.Set(dQX, dQY);
1226 
1227  } else if (fApplyRecentering == 2011) { // 11h style recentering
1228  Double_t dQX = 0.;
1229  Double_t dQY = 0.;
1230 
1231  if(fEvent && fEvent->GetEventplane()) {
1232  fEvent->GetEventplane()->CalculateVZEROEventPlane(fEvent, 10, n, dQX, dQY);
1233  // set the new q-vectors (which in this case means REPLACING)
1234  vQ.Set(dQX, dQY);
1235  } // if for some reason the info from the event header is not available, the AliFlowTrackCuts object
1236  // has provided the equalized multiplicity info so this should still be relatively safe
1237  }
1238 
1239  // return the Q-vector
1240  return vQ;
1241 }
1242  //---------------------------------------------------------------//
1243 void AliFlowEvent::Get2Qsub(AliFlowVector* Qarray, Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights)
1244 {
1245  // get q vectors for the subevents. if no recentering is necessary, get the guy from the flow event simple
1246  AliFlowEventSimple::Get2Qsub(Qarray, n, weightsList, usePhiWeights, usePtWeights, useEtaWeights);
1247  AliFlowVector vA = Qarray[0];
1248  AliFlowVector vB = Qarray[1];
1249 
1250  // else get the recentering from the cached info
1251  if (fApplyRecentering == 2010) // 10h style recentering, implemented for n=2 and n=3
1252  {
1253  // first retrieve the q-vectors from the AliFlowEventSimple:: routine
1254  // extract the information form the current flow vectors
1255  Double_t Qxc(vA.X()); // IMPORTANT: user is responsible for the sign of eta
1256  Double_t Qyc(vA.Y()); // vzeroC has negative pseudorapidity and is taken as subevent A
1257  Double_t Qxa(vB.X()); // vzeroA has positive pseudorapidity and is taken as subevent B
1258  Double_t Qya(vB.Y());
1259  // init some values for the corrections
1260 
1261  // default values for vector a (VZEROA)
1262  Double_t Qxamean(0);
1263  Double_t Qxarms(1);
1264  Double_t Qyamean(0);
1265  Double_t Qyarms(1);
1266  // default values for vector b (VZEROC)
1267  Double_t Qxcmean(0);
1268  Double_t Qxcrms(1);
1269  Double_t Qycmean(0);
1270  Double_t Qycrms(1);
1271  // note that defaults are chosen such that for n!=2||n!=3 re-centering is a null-operation
1272 
1273  if( n == 2) { // second order symmetry
1274  Qxamean = fMeanQ[fVZEROcentralityBin][1][0];
1275  Qxarms = fWidthQ[fVZEROcentralityBin][1][0];
1276  Qyamean = fMeanQ[fVZEROcentralityBin][1][1];
1277  Qyarms = fWidthQ[fVZEROcentralityBin][1][1];
1278 
1279  Qxcmean = fMeanQ[fVZEROcentralityBin][0][0];
1280  Qxcrms = fWidthQ[fVZEROcentralityBin][0][0];
1281  Qycmean = fMeanQ[fVZEROcentralityBin][0][1];
1282  Qycrms = fWidthQ[fVZEROcentralityBin][0][1];
1283  } else if (n == 3) { // third order symmetry
1284  Qxamean = fMeanQv3[fVZEROcentralityBin][1][0];
1285  Qxarms = fWidthQv3[fVZEROcentralityBin][1][0];
1286  Qyamean = fMeanQv3[fVZEROcentralityBin][1][1];
1287  Qyarms = fWidthQv3[fVZEROcentralityBin][1][1];
1288 
1289  Qxcmean = fMeanQv3[fVZEROcentralityBin][0][0];
1290  Qxcrms = fWidthQv3[fVZEROcentralityBin][0][0];
1291  Qycmean = fMeanQv3[fVZEROcentralityBin][0][1];
1292  Qycrms = fWidthQv3[fVZEROcentralityBin][0][1];
1293  }
1294  // do the correction
1295  Double_t QxaCor = (Qxa - Qxamean)/Qxarms;
1296  Double_t QyaCor = (Qya - Qyamean)/Qyarms;
1297  Double_t QxcCor = (Qxc - Qxcmean)/Qxcrms;
1298  Double_t QycCor = (Qyc - Qycmean)/Qycrms;
1299  // update the vector
1300  vA.Set(QxcCor, QycCor);
1301  vB.Set(QxaCor, QyaCor);
1302  } else if (fApplyRecentering == 2011) { // 11h style recentering
1303 
1304  Double_t QxaCor = 0.;
1305  Double_t QyaCor = 0.;
1306  Double_t QxcCor = 0.;
1307  Double_t QycCor = 0.;
1308 
1309  if(fEvent && fEvent->GetEventplane()) {
1310  fEvent->GetEventplane()->CalculateVZEROEventPlane(fEvent, 8, n, QxaCor, QyaCor);
1311  fEvent->GetEventplane()->CalculateVZEROEventPlane(fEvent, 9, n, QxcCor, QycCor);
1312 
1313  // set the new q-vectors (which in this case means REPLACING)
1314  vA.Set(QxcCor, QycCor);
1315  vB.Set(QxaCor, QyaCor);
1316  } // if for some reason the info from the event header is not available, the AliFlowTrackCuts object
1317  // has provided the equalized multiplicity info so this should still be relatively safe
1318  } else if (fApplyRecentering == 999) {
1319  // experimental VZERO recentering
1320  // first retrieve the q-vectors from the AliFlowEventSimple:: routine
1321  // extract the information form the current flow vectors
1322  Double_t Qxc(vA.X()); // IMPORTANT: user is responsible for the sign of eta
1323  Double_t Qyc(vA.Y()); // vzeroC has negative pseudorapidity and is taken as subevent A
1324  Double_t Qxa(vB.X()); // vzeroA has positive pseudorapidity and is taken as subevent B
1325  Double_t Qya(vB.Y());
1326  // init some values for the corrections
1327  Double_t Cen = - 999;
1328  //Added by Bernhard Hohlweger - bhohlweg@cern.ch
1329  if(fEvent->GetRunNumber() < 209122){
1330  //For Run1 Data the Old Centrality Percentile Method is available whereas for Run2 a new method was implemented
1331  //Cut was done for the first run of the LHC15a period
1332  Cen = fEvent->GetCentrality()->GetCentralityPercentile("V0M");
1333  }else{
1334  AliMultSelection *MultSelection = 0x0;
1335  MultSelection = (AliMultSelection * ) fEvent->FindListObject("MultSelection");
1336  if( !MultSelection) {
1337  //If you get this warning (and EventCentrality -999) please check that the AliMultSelectionTask actually ran (before your task)
1338  AliWarning("AliMultSelection not found, did you Run AliMultSelectionTask? \n");
1339  }else{
1340  Cen = MultSelection->GetMultiplicityPercentile("V0M");
1341  }
1342  }
1343  //01072016 Bernhard Hohlweger
1344  // default values for vector a (VZEROA)
1345  Double_t Qxamean(fQxavsV0[n-1]->GetBinContent(fQxavsV0[n-1]->FindBin(Cen)));
1346  Double_t Qxarms(fQxavsV0[n-1]->GetBinError(fQxavsV0[n-1]->FindBin(Cen)));
1347  Double_t Qyamean(fQyavsV0[n-1]->GetBinContent(fQyavsV0[n-1]->FindBin(Cen)));
1348  Double_t Qyarms(fQyavsV0[n-1]->GetBinError(fQyavsV0[n-1]->FindBin(Cen)));
1349  // default values for vector b (VZEROC)
1350  Double_t Qxcmean(fQxcvsV0[n-1]->GetBinContent(fQxcvsV0[n-1]->FindBin(Cen)));
1351  Double_t Qxcrms(fQxcvsV0[n-1]->GetBinError(fQxcvsV0[n-1]->FindBin(Cen)));
1352  Double_t Qycmean(fQycvsV0[n-1]->GetBinContent(fQycvsV0[n-1]->FindBin(Cen)));
1353  Double_t Qycrms(fQycvsV0[n-1]->GetBinError(fQycvsV0[n-1]->FindBin(Cen)));
1354 
1355  // just a precaution ...
1356  //for n = 4 the calibration does not make sense, the cosine of 4*phi( = pi*(0.5+i) i = 0,1,...7) is always 0
1357 
1358  if(n > 3) {
1359  Qxamean = 0;
1360  Qxarms = 1;
1361  Qyamean = 0;
1362  Qyarms = 1;
1363  Qxcmean = 0;
1364  Qxcrms = 1;
1365  Qycmean = 0; // this effectively disables the calibration
1366  Qycrms = 1;
1367  AliFatal("no calibration available for n>4 for VZEROs \n");
1368  }
1369 
1370  Double_t QxaR = Qxa - Qxamean;
1371  Double_t QyaR = Qya - Qyamean;
1372  Double_t QxcR = Qxc - Qxcmean;
1373  Double_t QycR = Qyc - Qycmean;
1374  if(fDivSigma && Qxarms>0. && Qyarms>0. && Qxcrms>0. && Qycrms>0.) {
1375  QxaR /= Qxarms;
1376  QyaR /= Qyarms;
1377  QxcR /= Qxcrms;
1378  QycR /= Qycrms;
1379  }
1380  // update the vector
1381  vA.Set(QxcR, QycR);
1382  vB.Set(QxaR, QyaR);
1383 
1384  } else if (fApplyRecentering == 666) {
1385  // experimental VZERO recentering for 11h Full TPC Flow data, harmonics 1,2,3
1386  // first retrieve the q-vectors from the AliFlowEventSimple:: routine
1387  // extract the information form the current flow vectors
1388  if(n < 4) {
1389  Double_t Qxc(vA.X()); // IMPORTANT: user is responsible for the sign of eta
1390  Double_t Qyc(vA.Y()); // vzeroC has negative pseudorapidity and is taken as subevent A
1391  Double_t Qxa(vB.X()); // vzeroA has positive pseudorapidity and is taken as subevent B
1392  Double_t Qya(vB.Y());
1393  Double_t MultC = vA.GetMult();
1394  Double_t MultA = vB.GetMult();
1395  // init some values for the corrections
1396  Double_t Cen = - 999;
1397  //Added by Bernhard Hohlweger - bhohlweg@cern.ch
1398  if(fEvent->GetRunNumber() < 209122){
1399  //For Run1 Data the Old Centrality Percentile Method is available whereas for Run2 a new method was implemented
1400  //Cut was done for the first run of the LHC15a period
1401  Cen = fEvent->GetCentrality()->GetCentralityPercentile("V0M");
1402  }else{
1403  AliMultSelection *MultSelection = 0x0;
1404  MultSelection = (AliMultSelection * ) fEvent->FindListObject("MultSelection");
1405  if( !MultSelection) {
1406  //If you get this warning (and EventCentrality -999) please check that the AliMultSelectionTask actually ran (before your task)
1407  AliWarning("AliMultSelection not found, did you Run AliMultSelectionTask? \n");
1408  }else{
1409  Cen = MultSelection->GetMultiplicityPercentile("V0M");
1410  }
1411  }
1412  //14062016 Bernhard Hohlweger
1413  // default values for vector a (VZEROA)
1414  Double_t Qxamean(fQxavsV0[n-1]->GetBinContent(fQxavsV0[n-1]->FindBin(Cen)));
1415  Double_t Qxarms(fQxavsV0[n-1]->GetBinError(fQxavsV0[n-1]->FindBin(Cen)));
1416  Double_t Qyamean(fQyavsV0[n-1]->GetBinContent(fQyavsV0[n-1]->FindBin(Cen)));
1417  Double_t Qyarms(fQyavsV0[n-1]->GetBinError(fQyavsV0[n-1]->FindBin(Cen)));
1418  // default values for vector b (VZEROC)
1419  Double_t Qxcmean(fQxcvsV0[n-1]->GetBinContent(fQxcvsV0[n-1]->FindBin(Cen)));
1420  Double_t Qxcrms(fQxcvsV0[n-1]->GetBinError(fQxcvsV0[n-1]->FindBin(Cen)));
1421  Double_t Qycmean(fQycvsV0[n-1]->GetBinContent(fQycvsV0[n-1]->FindBin(Cen)));
1422  Double_t Qycrms(fQycvsV0[n-1]->GetBinError(fQycvsV0[n-1]->FindBin(Cen)));
1423 
1424  Double_t QxaR = Qxa - Qxamean*MultA;
1425  Double_t QyaR = Qya - Qyamean*MultA;
1426  Double_t QxcR = Qxc - Qxcmean*MultC;
1427  Double_t QycR = Qyc - Qycmean*MultC;
1428  if(fDivSigma && Qxarms>0. && Qyarms>0. && Qxcrms>0. && Qycrms>0.) {
1429  QxaR /= Qxarms;
1430  QyaR /= Qyarms;
1431  QxcR /= Qxcrms;
1432  QycR /= Qycrms;
1433  }
1434  // update the vector
1435  vA.Set(QxcR, QycR);
1436  vB.Set(QxaR, QyaR);
1437 
1438  } else {
1439  cout << " WARNING: recentering not possible for harmonic " << n << " (delta calibration) " << endl;
1440  } // end of if(n < 4)
1441  }
1442 
1443 
1444 
1445  if(fApplyRecentering == 20152){
1446 
1447  Int_t fNHarm = n;
1448  Float_t v0Centr = -1.;
1449  Float_t spdCentr = -1.;
1450  AliMultSelection *MultSelection = 0x0;
1451  MultSelection = (AliMultSelection * ) fEvent->FindListObject("MultSelection");
1452  if( !MultSelection) AliWarning("AliMultSelection not found, did you Run AliMultSelectionTask? \n");
1453  else {
1454  v0Centr = MultSelection->GetMultiplicityPercentile("V0M");
1455  spdCentr = MultSelection->GetMultiplicityPercentile("CL1");
1456  }
1457  Int_t iCentSPD = (Int_t)spdCentr;
1458 
1459 
1460 
1461  Short_t centrCode = -10;
1462  if (v0Centr< 5.)
1463  centrCode = 0;
1464  else if ((v0Centr >= 5.) && (v0Centr < 10.))
1465  centrCode = 1;
1466  else if ((v0Centr >= 10.) && (v0Centr < 20.))
1467  centrCode = 2;
1468  else if ((v0Centr >= 20.) && (v0Centr < 30.))
1469  centrCode = 3;
1470  else if ((v0Centr >= 30.) && (v0Centr < 40.))
1471  centrCode = 4;
1472  else if ((v0Centr >= 40.) && (v0Centr < 50.))
1473  centrCode = 5;
1474  else if ((v0Centr >= 50.) && (v0Centr < 60.))
1475  centrCode = 6;
1476  else if ((v0Centr >= 60.) && (v0Centr < 70.))
1477  centrCode = 7;
1478  else if ((v0Centr >= 70.) && (v0Centr < 80.))
1479  centrCode = 8;
1480 
1481  if (centrCode < 0)
1482  return;
1483 
1484  TH1D* fQxnmV0A = reinterpret_cast<TH1D*>(fQxavsV0[0+2*(fNHarm-2)]);
1485  TH1D* fQynmV0A = reinterpret_cast<TH1D*>(fQyavsV0[0+2*(fNHarm-2)]);
1486  TH1D* fQxnsV0A = reinterpret_cast<TH1D*>(fQxavsV0[1+2*(fNHarm-2)]);
1487  TH1D* fQynsV0A = reinterpret_cast<TH1D*>(fQyavsV0[1+2*(fNHarm-2)]);
1488  TH1D* fQxnmV0C = reinterpret_cast<TH1D*>(fQxcvsV0[0+2*(fNHarm-2)]);
1489  TH1D* fQynmV0C = reinterpret_cast<TH1D*>(fQycvsV0[0+2*(fNHarm-2)]);
1490  TH1D* fQxnsV0C = reinterpret_cast<TH1D*>(fQxcvsV0[1+2*(fNHarm-2)]);
1491  TH1D* fQynsV0C = reinterpret_cast<TH1D*>(fQycvsV0[1+2*(fNHarm-2)]);
1492  TH1D* fMultV0 = reinterpret_cast<TH1D*>(fQxavsV0[4]);
1493 
1494  //V0 info
1495  Double_t Qxan = 0, Qyan = 0;
1496  Double_t Qxcn = 0, Qycn = 0;
1497  Double_t sumMa = 0, sumMc = 0;
1498 
1499  AliAODVZERO* aodV0 = static_cast<AliAODVZERO*>(fEvent->GetVZEROData());
1500 
1501  for (Int_t iV0 = 0; iV0 < 64; iV0++) {
1502  Double_t phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
1503  Float_t multv0 = aodV0->GetMultiplicity(iV0);
1504  if (iV0 < 32){
1505  Double_t multCorC = -10;
1506  if (iV0 < 8)
1507  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(1);
1508  else if (iV0 >= 8 && iV0 < 16)
1509  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(9);
1510  else if (iV0 >= 16 && iV0 < 24)
1511  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(17);
1512  else if (iV0 >= 24 && iV0 < 32)
1513  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(25);
1514 
1515  if (multCorC < 0)
1516  cout<<"Problem with multiplicity in V0C"<<endl;
1517 
1518  Qxcn += TMath::Cos(fNHarm*phiV0) * multCorC;
1519  Qycn += TMath::Sin(fNHarm*phiV0) * multCorC;
1520 
1521  sumMc = sumMc + multCorC;
1522 
1523  } else {
1524 
1525  Double_t multCorA = -10;
1526 
1527  if (iV0 >= 32 && iV0 < 40)
1528  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(33);
1529  else if (iV0 >= 40 && iV0 < 48)
1530  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(41);
1531  else if (iV0 >= 48 && iV0 < 56)
1532  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(49);
1533  else if (iV0 >= 56 && iV0 < 64)
1534  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(57);
1535 
1536  if (multCorA < 0)
1537  cout<<"Problem with multiplicity in V0A"<<endl;
1538 
1539  Qxan += TMath::Cos(fNHarm*phiV0) * multCorA;
1540  Qyan += TMath::Sin(fNHarm*phiV0) * multCorA;
1541 
1542  sumMa = sumMa + multCorA;
1543 
1544  }
1545  }
1546 
1547  if (sumMa <=0 || sumMc <= 0)
1548  return;
1549 
1550  Double_t QxanCor = Qxan;
1551  Double_t QyanCor = (Qyan - fQynmV0A->GetBinContent(iCentSPD+1))/fQynsV0A->GetBinContent(iCentSPD+1);
1552  Double_t QxcnCor = Qxcn;
1553  Double_t QycnCor = (Qycn - fQynmV0C->GetBinContent(iCentSPD+1))/fQynsV0C->GetBinContent(iCentSPD+1);
1554 
1555  if (fNHarm != 4.){
1556  QxanCor = (Qxan - fQxnmV0A->GetBinContent(iCentSPD+1))/fQxnsV0A->GetBinContent(iCentSPD+1);
1557  QxcnCor = (Qxcn - fQxnmV0C->GetBinContent(iCentSPD+1))/fQxnsV0C->GetBinContent(iCentSPD+1);
1558  }
1559 
1560  vA.Set(QxcnCor, QycnCor);
1561  vB.Set(QxanCor, QyanCor);
1562 
1563  //vB.SetMult(sumMa);
1564  //vA.SetMult(sumMc);
1565  }
1566 
1567  Qarray[0] = vA;
1568  Qarray[1] = vB;
1569 
1570 }
1571 //_____________________________________________________________________________
1573  // open calibration info, copied from AliAnalyisTaskVnV0.cxx
1574  fEvent = cuts->GetEvent();
1575  if(!fEvent) return; // coverity. we need to know the event to get the runnumber and centrlaity
1576  // get the vzero centrality percentile (cc dependent calibration)
1577  Float_t v0Centr(fEvent->GetCentrality()->GetCentralityPercentile("V0M"));
1578  if(v0Centr < 5) fVZEROcentralityBin = 0;
1579  else if(v0Centr < 10) fVZEROcentralityBin = 1;
1580  else if(v0Centr < 20) fVZEROcentralityBin = 2;
1581  else if(v0Centr < 30) fVZEROcentralityBin = 3;
1582  else if(v0Centr < 40) fVZEROcentralityBin = 4;
1583  else if(v0Centr < 50) fVZEROcentralityBin = 5;
1584  else if(v0Centr < 60) fVZEROcentralityBin = 6;
1585  else if(v0Centr < 70) fVZEROcentralityBin = 7;
1586  else fVZEROcentralityBin = 8;
1587 
1588  // if this event is from the same run as the previous event
1589  // we can use the cached calibration values, no need to re-open the
1590  // aodb file, else cache the new run
1591  Int_t run(fEvent->GetRunNumber());
1592  if(fCachedRun == run) return;
1593  else fCachedRun = run;
1594 
1595  // relevant for 2010 data: check if the proper chi weights for merging vzero a and vzero c ep are present
1596  // if not, use sane defaults. centrality binning is equal to that given in the fVZEROcentralityBin snippet
1597  //
1598  // chi values can be calculated using the static helper function
1599  // AliAnalysisTaskJetV2::CalculateEventPlaneChi(Double_t res) where res is the event plane
1600  // resolution in a given centrality bin
1601  //
1602  // the resolutions that were used for these defaults are
1603  // Double_t R2VZEROA[] = {.35, .40, .48, .50, .48, .45, .38, .26, .16};
1604  // Double_t R2VZEROC[] = {.45, .60, .70, .73, .68, .60, .40, .36, .17};
1605  //
1606  // Double_t R3VZEROA[] = {.22, .23, .22, .19, .15, .12, .08, .00, .00};
1607  // Double_t R3VZEROC[] = {.30, .30, .28, .25, .22, .17, .11, .00, .00};
1608  // this might need a bit of updating as they were read 'by-eye' from a performance plot ..
1609  Double_t chiC2[] = {0.771423, 1.10236, 1.38116, 1.48077, 1.31964, 1.10236, 0.674622, 0.600403, 0.273865};
1610  Double_t chiA2[] = {0.582214, 0.674622, 0.832214, 0.873962, 0.832214, 0.771423, 0.637146, 0.424255, 0.257385};
1611  Double_t chiC3[] = {0.493347, 0.493347, 0.458557, 0.407166, 0.356628, 0.273865, 0.176208, 6.10352e-05, 6.10352e-05};
1612  Double_t chiA3[] = {0.356628, 0.373474, 0.356628, 0.306702, 0.24115, 0.192322, 0.127869, 6.10352e-05, 6.10352e-05};
1613 
1614  // this may seem redundant but in this way the cuts object is owner of the arrays
1615  // even if they're created here (so we won't get into trouble with dtor, assigmnet and copying)
1616  if(!cuts->GetChi2A()) cuts->SetChi2A(new TArrayD(9, chiA2));
1617  if(!cuts->GetChi2C()) cuts->SetChi2C(new TArrayD(9, chiC2));
1618  if(!cuts->GetChi3A()) cuts->SetChi3A(new TArrayD(9, chiA3));
1619  if(!cuts->GetChi3C()) cuts->SetChi3C(new TArrayD(9, chiC3));
1620 
1621  if(!fChi2A) fChi2A = cuts->GetChi2A();
1622  if(!fChi2C) fChi2C = cuts->GetChi2C();
1623  if(!fChi3A) fChi3A = cuts->GetChi3A();
1624  if(!fChi3C) fChi3C = cuts->GetChi3C();
1625 
1626  TFile *foadb = TFile::Open("$ALICE_PHYSICS/OADB/PWGCF/VZERO/VZEROcalibEP.root");
1627  if(!foadb){
1628  printf("OADB file $ALICE_PHYSICS/OADB/PWGCF/VZERO/VZEROcalibEP.root cannot be opened, CALIBRATION FAILED !");
1629  return;
1630  }
1631 
1632  AliOADBContainer *cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorr");
1633  if(!cont){
1634  printf("OADB object hMultV0BefCorr is not available in the file\n");
1635  return;
1636  }
1637  if(!(cont->GetObject(run))){
1638  // if the multiplicity correction cannot be found for the specified run,
1639  // loop over the 11h runs to see if it's 11h data
1640  Int_t runs11h[] = {170593, 170572, 170556, 170552, 170546, 170390, 170389, 170388, 170387, 170315, 170313, 170312, 170311, 170309, 170308, 170306, 170270, 170269, 170268, 170267, 170264, 170230, 170228, 170208, 170207, 170205, 170204, 170203, 170195, 170193, 170163, 170162, 170159, 170155, 170152, 170091, 170089, 170088, 170085, 170084, 170083, 170081, 170040, 170038, 170036, 170027, 169981, 169975, 169969, 169965, 169961, 169956, 169926, 169924, 169923, 169922, 169919, 169918, 169914, 169859, 169858, 169855, 169846, 169838, 169837, 169835, 169683, 169628, 169591, 169590, 169588, 169587, 169586, 169584, 169557, 169555, 169554, 169553, 169550, 169515, 169512, 169506, 169504, 169498, 169475, 169420, 169419, 169418, 169417, 169415, 169411, 169238, 169236, 169167, 169160, 169156, 169148, 169145, 169144, 169143, 169138, 169099, 169094, 169091, 169045, 169044, 169040, 169035, 168992, 168988, 168984, 168826, 168777, 168514, 168512, 168511, 168467, 168464, 168461, 168460, 168458, 168362, 168361, 168356, 168342, 168341, 168325, 168322, 168318, 168311, 168310, 168213, 168212, 168208, 168207, 168206, 168205, 168204, 168203, 168181, 168177, 168175, 168173, 168172, 168171, 168115, 168108, 168107, 168105, 168104, 168103, 168076, 168069, 168068, 168066, 167988, 167987, 167986, 167985, 167921, 167920, 167915, 167909, 167903, 167902, 167818, 167814, 167813, 167808, 167807, 167806, 167713, 167712, 167711, 167706, 167693};
1641  for(Int_t r(0); r < 176; r++) {
1642  if(run == runs11h[r]) {
1643  printf(" > run has been identified as 11h < \n");
1644  if(cuts->GetVZEROgainEqualizationPerRing()) {
1645  // enable or disable rings through the weights, weight 1. is enabled, 0. is disabled
1646  // start with the vzero c rings (segments 0 through 31)
1647  (cuts->GetUseVZERORing(0)) ? cuts->SetVZEROCpol(0, 1.) : cuts->SetVZEROCpol(0, 0.);
1648  (cuts->GetUseVZERORing(1)) ? cuts->SetVZEROCpol(1, 1.) : cuts->SetVZEROCpol(1, 0.);
1649  (cuts->GetUseVZERORing(2)) ? cuts->SetVZEROCpol(2, 1.) : cuts->SetVZEROCpol(2, 0.);
1650  (cuts->GetUseVZERORing(3)) ? cuts->SetVZEROCpol(3, 1.) : cuts->SetVZEROCpol(3, 0.);
1651  // same for vzero a
1652  (cuts->GetUseVZERORing(4)) ? cuts->SetVZEROApol(0, 1.) : cuts->SetVZEROApol(0, 0.);
1653  (cuts->GetUseVZERORing(5)) ? cuts->SetVZEROApol(1, 1.) : cuts->SetVZEROApol(1, 0.);
1654  (cuts->GetUseVZERORing(6)) ? cuts->SetVZEROApol(2, 1.) : cuts->SetVZEROApol(2, 0.);
1655  (cuts->GetUseVZERORing(7)) ? cuts->SetVZEROApol(3, 1.) : cuts->SetVZEROApol(3, 0.);
1656  } else {
1657  // else enable all rings, which is also default
1658  for(Int_t i(0); i < 4; i++) cuts->SetVZEROCpol(i, 1.);
1659  for(Int_t i(0); i < 4; i++) cuts->SetVZEROApol(i, 1.);
1660  }
1661  // pass a NULL pointer to the track cuts object, the NULL pointer will identify 11h runs
1662  cuts->SetVZEROgainEqualisation(NULL);
1663  fApplyRecentering = 2011;
1664  return; // the rest of the steps are not necessary
1665  }
1666  }
1667  // the run has not been identified as lhc11h data, so we assume a template calibration
1668  printf("OADB object hMultVZEROBefCorr is not available for run %i (used default run 137366)\n",run);
1669  run = 137366;
1670  }
1671  printf(" > run has been identified as 10h < \n");
1672  // step 1) get the proper multiplicity weights from the vzero signal
1673  TProfile* fMultVZERO = ((TH2F *) cont->GetObject(run))->ProfileX();
1674 
1675  TF1 *fpol0 = new TF1("fpol0","pol0");
1676  if(cuts->GetVZEROgainEqualizationPerRing()) {
1677  // do the calibration per ring
1678  // start with the vzero c rings (segments 0 through 31)
1679  fMultVZERO->Fit(fpol0, "N0", "", 0, 8);
1680  (cuts->GetUseVZERORing(0)) ? cuts->SetVZEROCpol(0, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(0, 0.);
1681  fMultVZERO->Fit(fpol0, "N0", "", 8, 16);
1682  (cuts->GetUseVZERORing(1)) ? cuts->SetVZEROCpol(1, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(1, 0.);
1683  fMultVZERO->Fit(fpol0, "N0", "", 16, 24);
1684  (cuts->GetUseVZERORing(2)) ? cuts->SetVZEROCpol(2, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(2, 0.);
1685  fMultVZERO->Fit(fpol0, "N0", "", 24, 32);
1686  (cuts->GetUseVZERORing(3)) ? cuts->SetVZEROCpol(3, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(3, 0.);
1687  // same thing for vero A
1688  fMultVZERO->Fit(fpol0, "N0", "", 32, 40);
1689  (cuts->GetUseVZERORing(4)) ? cuts->SetVZEROApol(0, fpol0->GetParameter(0)) : cuts->SetVZEROApol(0, 0.);
1690  fMultVZERO->Fit(fpol0, "N0", "", 40, 48);
1691  (cuts->GetUseVZERORing(5)) ? cuts->SetVZEROApol(1, fpol0->GetParameter(0)) : cuts->SetVZEROApol(1, 0.);
1692  fMultVZERO->Fit(fpol0, "N0", "", 48, 56);
1693  (cuts->GetUseVZERORing(6)) ? cuts->SetVZEROApol(2, fpol0->GetParameter(0)) : cuts->SetVZEROApol(2, 0.);
1694  fMultVZERO->Fit(fpol0, "N0", "", 56, 64);
1695  (cuts->GetUseVZERORing(7)) ? cuts->SetVZEROApol(3, fpol0->GetParameter(0)) : cuts->SetVZEROApol(3, 0.);
1696  } else {
1697  // do the calibration in one go. the calibration will still be
1698  // stored per ring, but each ring has the same weight now
1699  fMultVZERO->Fit(fpol0,"N0","",0,31);
1700  for(Int_t i(0); i < 4; i++) cuts->SetVZEROCpol(i, fpol0->GetParameter(0));
1701  fMultVZERO->Fit(fpol0,"N0","",32,64);
1702  for(Int_t i(0); i < 4; i++) cuts->SetVZEROApol(i, fpol0->GetParameter(0));
1703  }
1704  // the parameters to weigh the vzero track cuts have been extracted now,
1705  // so we can pass them to the current track cuts obect
1706  cuts->SetVZEROgainEqualisation(fMultVZERO); // passed as a TH1
1707 
1708  // step 2) reweight the q-vectors that will be called by flow methods which use
1709  // subevents
1710  // underlying assumption is that subevent a uses VZEROA
1711  // and subevent b uses VZEROC
1712  for(Int_t iside=0;iside<2;iside++){
1713  for(Int_t icoord=0;icoord<2;icoord++){
1714  for(Int_t i=0;i < 9;i++){
1715  char namecont[100];
1716  if(iside==0 && icoord==0)
1717  snprintf(namecont,100,"hQxc2_%i",i);
1718  else if(iside==1 && icoord==0)
1719  snprintf(namecont,100,"hQxa2_%i",i);
1720  else if(iside==0 && icoord==1)
1721  snprintf(namecont,100,"hQyc2_%i",i);
1722  else if(iside==1 && icoord==1)
1723  snprintf(namecont,100,"hQya2_%i",i);
1724 
1725  cont = (AliOADBContainer*) foadb->Get(namecont);
1726  if(!cont){
1727  printf("OADB object %s is not available in the file\n",namecont);
1728  return;
1729  }
1730 
1731  if(!(cont->GetObject(run))){
1732  printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
1733  run = 137366;
1734  }
1735 
1736  // after grabbing all the info, set the CORRECTION TERMS to
1737  // the 2nd and 3rd order qsub-vectors
1738  // we do this here for all centralities, so that subsequent events
1739  // can grab the correction from these cached values
1740  fMeanQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
1741  fWidthQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
1742 
1743  //for v3
1744  if(iside==0 && icoord==0)
1745  snprintf(namecont,100,"hQxc3_%i",i);
1746  else if(iside==1 && icoord==0)
1747  snprintf(namecont,100,"hQxa3_%i",i);
1748  else if(iside==0 && icoord==1)
1749  snprintf(namecont,100,"hQyc3_%i",i);
1750  else if(iside==1 && icoord==1)
1751  snprintf(namecont,100,"hQya3_%i",i);
1752 
1753  cont = (AliOADBContainer*) foadb->Get(namecont);
1754  if(!cont){
1755  printf("OADB object %s is not available in the file\n",namecont);
1756  return;
1757  }
1758 
1759  if(!(cont->GetObject(run))){
1760  printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
1761  run = 137366;
1762  }
1763  fMeanQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
1764  fWidthQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
1765 
1766  }
1767  }
1768  }
1769  // set the recentering style (might be switched back to -1 if recentering is disabeled)
1770  fApplyRecentering = 2010;
1771 }
1772 //-----------------------------------------------------------------------
1774  // implementation of beta vzero calibration
1775 
1776  fEvent = cuts->GetEvent();
1777  if(!fEvent) return; // coverity. we need to know the event to get the runnumber and centrlaity
1778  // get the vzero centrality percentile (cc dependent calibration)
1779 
1780 
1781  // if this event is from the same run as the previous event
1782  // we can use the cached calibration values, no need to re-open the
1783  // aodb file, else cache the new run
1784  Int_t run(fEvent->GetRunNumber());
1785  if(fCachedRun == run) return;
1786  else fCachedRun = run;
1787 
1788  // check if the proper chi weights for merging vzero a and vzero c ep are present
1789  // if not, use sane defaults. centrality binning is equal to that given in the fVZEROcentralityBin snippet
1790  //
1791  // chi values can be calculated using the static helper function
1792  // AliAnalysisTaskJetV2::CalculateEventPlaneChi(Double_t res) where res is the event plane
1793  // resolution in a given centrality bin
1794  //
1795  // the resolutions that were used for these defaults are
1796  // Double_t R2VZEROA[] = {.35, .40, .48, .50, .48, .45, .38, .26, .16};
1797  // Double_t R2VZEROC[] = {.45, .60, .70, .73, .68, .60, .40, .36, .17};
1798  //
1799  // Double_t R3VZEROA[] = {.22, .23, .22, .19, .15, .12, .08, .00, .00};
1800  // Double_t R3VZEROC[] = {.30, .30, .28, .25, .22, .17, .11, .00, .00};
1801  Double_t chiC2[] = {0.771423, 1.10236, 1.38116, 1.48077, 1.31964, 1.10236, 0.674622, 0.600403, 0.273865};
1802  Double_t chiA2[] = {0.582214, 0.674622, 0.832214, 0.873962, 0.832214, 0.771423, 0.637146, 0.424255, 0.257385};
1803  Double_t chiC3[] = {0.493347, 0.493347, 0.458557, 0.407166, 0.356628, 0.273865, 0.176208, 6.10352e-05, 6.10352e-05};
1804  Double_t chiA3[] = {0.356628, 0.373474, 0.356628, 0.306702, 0.24115, 0.192322, 0.127869, 6.10352e-05, 6.10352e-05};
1805 
1806  // this may seem redundant but in this way the cuts object is owner of the arrays
1807  // even if they're created here (so we won't get into trouble with dtor, assigmnet and copying)
1808  if(!cuts->GetChi2A()) cuts->SetChi2A(new TArrayD(9, chiA2));
1809  if(!cuts->GetChi2C()) cuts->SetChi2C(new TArrayD(9, chiC2));
1810  if(!cuts->GetChi3A()) cuts->SetChi3A(new TArrayD(9, chiA3));
1811  if(!cuts->GetChi3C()) cuts->SetChi3C(new TArrayD(9, chiC3));
1812 
1813  if(!fChi2A) fChi2A = cuts->GetChi2A();
1814  if(!fChi2C) fChi2C = cuts->GetChi2C();
1815  if(!fChi3A) fChi3A = cuts->GetChi3A();
1816  if(!fChi3C) fChi3C = cuts->GetChi3C();
1817 
1818 
1819  TFile *foadb = TFile::Open("$ALICE_PHYSICS/PWGCF/FLOW/database/calibV0_filtered.root");
1820  if(!foadb){
1821  printf("OADB file $ALICE_PHYSICS/PWGCF/FLOW/database/calibV0_filtered.root cannot be opened, CALIBRATION FAILED !");
1822  return;
1823  }
1824 
1825  // first get the mutiplicity of the vzero channels before gain equalization
1826  AliOADBContainer *cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorr_filtered");
1827  if(!cont){
1828  printf("OADB object hMultV0BefCorr is not available in the file\n");
1829  return;
1830  }
1831  if(!(cont->GetObject(run))) {
1832  // if the multiplicity correction cannot be found for the specified run,
1833  // loop over the 11h runs to see if it's 11h data
1834  Int_t runs11h[] = {170593, 170572, 170556, 170552, 170546, 170390, 170389, 170388, 170387, 170315, 170313, 170312, 170311, 170309, 170308, 170306, 170270, 170269, 170268, 170267, 170264, 170230, 170228, 170208, 170207, 170205, 170204, 170203, 170195, 170193, 170163, 170162, 170159, 170155, 170152, 170091, 170089, 170088, 170085, 170084, 170083, 170081, 170040, 170038, 170036, 170027, 169981, 169975, 169969, 169965, 169961, 169956, 169926, 169924, 169923, 169922, 169919, 169918, 169914, 169859, 169858, 169855, 169846, 169838, 169837, 169835, 169683, 169628, 169591, 169590, 169588, 169587, 169586, 169584, 169557, 169555, 169554, 169553, 169550, 169515, 169512, 169506, 169504, 169498, 169475, 169420, 169419, 169418, 169417, 169415, 169411, 169238, 169236, 169167, 169160, 169156, 169148, 169145, 169144, 169143, 169138, 169099, 169094, 169091, 169045, 169044, 169040, 169035, 168992, 168988, 168984, 168826, 168777, 168514, 168512, 168511, 168467, 168464, 168461, 168460, 168458, 168362, 168361, 168356, 168342, 168341, 168325, 168322, 168318, 168311, 168310, 168213, 168212, 168208, 168207, 168206, 168205, 168204, 168203, 168181, 168177, 168175, 168173, 168172, 168171, 168115, 168108, 168107, 168105, 168104, 168103, 168076, 168069, 168068, 168066, 167988, 167987, 167986, 167985, 167921, 167920, 167915, 167909, 167903, 167902, 167818, 167814, 167813, 167808, 167807, 167806, 167713, 167712, 167711, 167706, 167693};
1835  for(Int_t r(0); r < 176; r++) {
1836  if(run == runs11h[r]) {
1837  printf(" > run has been identified as 11h < \n");
1838  if(cuts->GetVZEROgainEqualizationPerRing()) {
1839  // enable or disable rings through the weights, weight 1. is enabled, 0. is disabled
1840  // start with the vzero c rings (segments 0 through 31)
1841  (cuts->GetUseVZERORing(0)) ? cuts->SetVZEROCpol(0, 1.) : cuts->SetVZEROCpol(0, 0.);
1842  (cuts->GetUseVZERORing(1)) ? cuts->SetVZEROCpol(1, 1.) : cuts->SetVZEROCpol(1, 0.);
1843  (cuts->GetUseVZERORing(2)) ? cuts->SetVZEROCpol(2, 1.) : cuts->SetVZEROCpol(2, 0.);
1844  (cuts->GetUseVZERORing(3)) ? cuts->SetVZEROCpol(3, 1.) : cuts->SetVZEROCpol(3, 0.);
1845  // same for vzero a
1846  (cuts->GetUseVZERORing(4)) ? cuts->SetVZEROApol(0, 1.) : cuts->SetVZEROApol(0, 0.);
1847  (cuts->GetUseVZERORing(5)) ? cuts->SetVZEROApol(1, 1.) : cuts->SetVZEROApol(1, 0.);
1848  (cuts->GetUseVZERORing(6)) ? cuts->SetVZEROApol(2, 1.) : cuts->SetVZEROApol(2, 0.);
1849  (cuts->GetUseVZERORing(7)) ? cuts->SetVZEROApol(3, 1.) : cuts->SetVZEROApol(3, 0.);
1850  } else {
1851  // else enable all rings, which is also default
1852  for(Int_t i(0); i < 4; i++) cuts->SetVZEROCpol(i, 1.);
1853  for(Int_t i(0); i < 4; i++) cuts->SetVZEROApol(i, 1.);
1854  }
1855  // pass a NULL pointer to the track cuts object, the NULL pointer will identify 11h runs
1856  cuts->SetVZEROgainEqualisation(NULL);
1857  fApplyRecentering = 2011;
1858  return; // the rest of the steps are not necessary
1859  }
1860  }
1861  // the run has not been identified as lhc11h data, so we assume a template calibration
1862  printf("OADB object hMultVZEROBefCorr is not available for run %i (used default run 138275)\n",run);
1863  run = 138275;
1864  }
1865  printf(" > run has been identified as 10h < \n");
1866  // step 0) get the profile which contains average multiplicity per VZERO channel
1867  TProfile* fMultVZERO = static_cast<TProfile*>(cont->GetObject(run));
1868 
1869  TF1 *fpol0 = new TF1("fpol0","pol0");
1870  // step 1) extract the proper weights from the profile. Q-vector recentering relies on
1871  // ring-by-ring gain equalization, so the terms are extracted ring-by-ring here
1872 
1873  // start with the vzero c rings (segments 0 through 31)
1874  fMultVZERO->Fit(fpol0, "N0", "", 0, 8);
1875  (cuts->GetUseVZERORing(0)) ? cuts->SetVZEROCpol(0, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(0, 0.);
1876  fMultVZERO->Fit(fpol0, "N0", "", 8, 16);
1877  (cuts->GetUseVZERORing(1)) ? cuts->SetVZEROCpol(1, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(1, 0.);
1878  fMultVZERO->Fit(fpol0, "N0", "", 16, 24);
1879  (cuts->GetUseVZERORing(2)) ? cuts->SetVZEROCpol(2, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(2, 0.);
1880  fMultVZERO->Fit(fpol0, "N0", "", 24, 32);
1881  (cuts->GetUseVZERORing(3)) ? cuts->SetVZEROCpol(3, fpol0->GetParameter(0)) : cuts->SetVZEROCpol(3, 0.);
1882  // same thing for vero A
1883  fMultVZERO->Fit(fpol0, "N0", "", 32, 40);
1884  (cuts->GetUseVZERORing(4)) ? cuts->SetVZEROApol(0, fpol0->GetParameter(0)) : cuts->SetVZEROApol(0, 0.);
1885  fMultVZERO->Fit(fpol0, "N0", "", 40, 48);
1886  (cuts->GetUseVZERORing(5)) ? cuts->SetVZEROApol(1, fpol0->GetParameter(0)) : cuts->SetVZEROApol(1, 0.);
1887  fMultVZERO->Fit(fpol0, "N0", "", 48, 56);
1888  (cuts->GetUseVZERORing(6)) ? cuts->SetVZEROApol(2, fpol0->GetParameter(0)) : cuts->SetVZEROApol(2, 0.);
1889  fMultVZERO->Fit(fpol0, "N0", "", 56, 64);
1890  (cuts->GetUseVZERORing(7)) ? cuts->SetVZEROApol(3, fpol0->GetParameter(0)) : cuts->SetVZEROApol(3, 0.);
1891 
1892  // the parameters to weigh the vzero track cuts have been extracted now,
1893  // so we can pass them to the current track cuts obect
1894  cuts->SetVZEROgainEqualisation(fMultVZERO); // passed as a TH1
1895 
1896  // step 2) extract the calibration histograms from the database and
1897  // pass them to the cuts object
1898  //
1899  // first index of the oadb array is the harmonic n, the second index is either qax, qay, qcx, qcy
1900  AliOADBContainer* h[5][4];
1901  for(Int_t i(0); i < 5; i++) {
1902  h[i][0] = (AliOADBContainer*)foadb->Get(Form("hQxa%i_filtered", i+1));
1903  if(h[i][0]) fQxavsV0[i] = static_cast<TH1F*>(h[i][0]->GetObject(run));
1904  h[i][1] = (AliOADBContainer*)foadb->Get(Form("hQya%i_filtered", i+1));
1905  if(h[i][1]) fQyavsV0[i] = static_cast<TH1F*>(h[i][1]->GetObject(run));
1906  h[i][2] = (AliOADBContainer*)foadb->Get(Form("hQxc%i_filtered", i+1));
1907  if(h[i][2]) fQxcvsV0[i] = static_cast<TH1F*>(h[i][2]->GetObject(run));
1908  h[i][3] = (AliOADBContainer*)foadb->Get(Form("hQyc%i_filtered", i+1));
1909  if(h[i][3]) fQycvsV0[i] = static_cast<TH1F*>(h[i][3]->GetObject(run));
1910  }
1911 
1912  // set the recentering style (might be switched back to -1 if recentering is disabeled)
1913  // FIXME as an ugly hack, for now I mark this as 999 to denote the experimental nature
1914  // of this and use it transparently without disrupting the existing calbiration
1915  fApplyRecentering = 999;
1916 }
1917 
1918 //-----------------------------------------------------------------------------
1919 
1921  // implementation of delta vzero calibration 2011
1922 
1923  fEvent = cuts->GetEvent();
1924  if(!fEvent) return; // coverity. we need to know the event to get the runnumber and centrlaity
1925  // get the vzero centrality percentile (cc dependent calibration)
1926 
1927 
1928  // if this event is from the same run as the previous event
1929  // we can use the cached calibration values, no need to re-open the
1930  // aodb file, else cache the new run
1931  Int_t run(fEvent->GetRunNumber());
1932  if(fCachedRun == run) return;
1933  else fCachedRun = run;
1934 
1935  // check if the proper chi weights for merging vzero a and vzero c ep are present
1936  // if not, use sane defaults. centrality binning is equal to that given in the fVZEROcentralityBin snippet
1937  //
1938  // chi values can be calculated using the static helper function
1939  // AliAnalysisTaskJetV2::CalculateEventPlaneChi(Double_t res) where res is the event plane
1940  // resolution in a given centrality bin
1941  //
1942  // the resolutions that were used for these defaults are
1943  // Double_t R2VZEROA[] = {.35, .40, .48, .50, .48, .45, .38, .26, .16};
1944  // Double_t R2VZEROC[] = {.45, .60, .70, .73, .68, .60, .40, .36, .17};
1945  //
1946  // Double_t R3VZEROA[] = {.22, .23, .22, .19, .15, .12, .08, .00, .00};
1947  // Double_t R3VZEROC[] = {.30, .30, .28, .25, .22, .17, .11, .00, .00};
1948  Double_t chiC2[] = {0.771423, 1.10236, 1.38116, 1.48077, 1.31964, 1.10236, 0.674622, 0.600403, 0.273865};
1949  Double_t chiA2[] = {0.582214, 0.674622, 0.832214, 0.873962, 0.832214, 0.771423, 0.637146, 0.424255, 0.257385};
1950  Double_t chiC3[] = {0.493347, 0.493347, 0.458557, 0.407166, 0.356628, 0.273865, 0.176208, 6.10352e-05, 6.10352e-05};
1951  Double_t chiA3[] = {0.356628, 0.373474, 0.356628, 0.306702, 0.24115, 0.192322, 0.127869, 6.10352e-05, 6.10352e-05};
1952 
1953  // this may seem redundant but in this way the cuts object is owner of the arrays
1954  // even if they're created here (so we won't get into trouble with dtor, assigmnet and copying)
1955  if(!cuts->GetChi2A()) cuts->SetChi2A(new TArrayD(9, chiA2));
1956  if(!cuts->GetChi2C()) cuts->SetChi2C(new TArrayD(9, chiC2));
1957  if(!cuts->GetChi3A()) cuts->SetChi3A(new TArrayD(9, chiA3));
1958  if(!cuts->GetChi3C()) cuts->SetChi3C(new TArrayD(9, chiC3));
1959 
1960  if(!fChi2A) fChi2A = cuts->GetChi2A();
1961  if(!fChi2C) fChi2C = cuts->GetChi2C();
1962  if(!fChi3A) fChi3A = cuts->GetChi3A();
1963  if(!fChi3C) fChi3C = cuts->GetChi3C();
1964 
1965  // get the calibration file for the gain equalization
1966  TFile *foadb = TFile::Open("alien:///alice/cern.ch/user/j/jmargutt/gainVZERO.LHC11h.root");
1967  if(!foadb){
1968  printf("file alien:///alice/cern.ch/user/j/jmargutt/gainVZERO.LHC11h.root cannot be opened, CALIBRATION FAILED !");
1969  return;
1970  }
1971  TH3F* Weights = dynamic_cast<TH3F*>(foadb->FindObjectAny("LHC11h")->FindObject("gHistVZEROChannelGainEqualizationMap"));
1972  if(!Weights){
1973  printf("gHistVZEROChannelGainEqualizationMap is not available in the file\n");
1974  return;
1975  }
1976 
1977  if(cuts->GetVZEROgainEqualizationPerRing()) {
1978  // enable or disable rings through the weights, weight 1. is enabled, 0. is disabled
1979  // start with the vzero c rings (segments 0 through 31)
1980  (cuts->GetUseVZERORing(0)) ? cuts->SetVZEROCpol(0, 1.) : cuts->SetVZEROCpol(0, 0.);
1981  (cuts->GetUseVZERORing(1)) ? cuts->SetVZEROCpol(1, 1.) : cuts->SetVZEROCpol(1, 0.);
1982  (cuts->GetUseVZERORing(2)) ? cuts->SetVZEROCpol(2, 1.) : cuts->SetVZEROCpol(2, 0.);
1983  (cuts->GetUseVZERORing(3)) ? cuts->SetVZEROCpol(3, 1.) : cuts->SetVZEROCpol(3, 0.);
1984  // same for vzero a
1985  (cuts->GetUseVZERORing(4)) ? cuts->SetVZEROApol(0, 1.) : cuts->SetVZEROApol(0, 0.);
1986  (cuts->GetUseVZERORing(5)) ? cuts->SetVZEROApol(1, 1.) : cuts->SetVZEROApol(1, 0.);
1987  (cuts->GetUseVZERORing(6)) ? cuts->SetVZEROApol(2, 1.) : cuts->SetVZEROApol(2, 0.);
1988  (cuts->GetUseVZERORing(7)) ? cuts->SetVZEROApol(3, 1.) : cuts->SetVZEROApol(3, 0.);
1989  } else {
1990  // else enable all rings, which is also default
1991  for(Int_t i(0); i < 4; i++) cuts->SetVZEROCpol(i, 1.);
1992  for(Int_t i(0); i < 4; i++) cuts->SetVZEROApol(i, 1.);
1993  }
1994 
1995  // loop over the 11h runs to see if it's 11h data (Full TPC Flow)
1996  Int_t runs11h[] = {167915, 168115, 168460, 169035, 169238, 169859, 170228, 167920, 168310, 168464, 169091, 169411, 169923, 170230, 167985, 168311, 168467, 169094, 169415, 170027, 170268, 167987, 168322, 168511, 169138, 169417, 170081, 170269, 167988, 168325, 168512, 169144, 169835, 170155, 170270, 168069, 168341, 168514, 169145, 169837, 170159, 170306, 168076, 168342, 168777, 169148, 169838, 170163, 170308, 168105, 168361, 168826, 169156, 169846, 170193, 170309, 168107, 168362, 168988, 169160, 169855, 170203, 168108, 168458, 168992, 169167, 169858, 170204};
1997  Int_t RunBin = -1;
1998  for(Int_t r(0); r < 68; r++) {
1999  if(run == runs11h[r]) {
2000  RunBin = r+1;
2001  }
2002  }
2003  if(RunBin>0) {
2004  printf(" > run has been identified as 11h Full TPC Flow < \n");
2005  } else {
2006  printf(" > run has NOT been identified as 11h Full TPC Flow, use default for 11h < \n");
2007  // pass a NULL pointer to the track cuts object, the NULL pointer will identify 11h runs
2008  cuts->SetVZEROgainEqualisation(NULL);
2009  fApplyRecentering = 2011;
2010  return; // the rest of the steps are not necessary
2011  }
2012 
2013  // step 0) get the TH2D which contains the correction factor per VZERO channel per centrality bin
2014  // and pass it to the current track cuts obect
2015  Weights->GetXaxis()->SetRange(RunBin,RunBin);
2016  TH2D* fMultVZEROCen = dynamic_cast<TH2D*>(Weights->Project3D("zy"));
2017  cuts->SetVZEROgainEqualisationCen(fMultVZEROCen); // passed as a TH2
2018 
2019  // get the calibration file for the q-vector recentering
2020  TFile *fqvec = TFile::Open("alien:///alice/cern.ch/user/j/jmargutt/recenteringVZERO.LHC11h.root");
2021  if(!fqvec){
2022  printf("file alien:///alice/cern.ch/user/j/jmargutt/recenteringVZERO.LHC11h.root cannot be opened, CALIBRATION FAILED !");
2023  return;
2024  }
2025 
2026  // first index of the oadb array is the harmonic n, the second index is either qax, qay, qcx, qcy
2027  TH2D* h[3][4];
2028  for(Int_t i(0); i < 3; i++) {
2029  h[i][0] = (TH2D*)(fqvec->FindObjectAny("LHC11h")->FindObject(Form("gHistVZEROAQ%ixRecenteringMap",i+1)));
2030  if(h[i][0]) fQxavsV0[i] = static_cast<TH1D*>(h[i][0]->ProjectionY(Form("fQxavsV0[%i]",i),RunBin,RunBin));
2031  h[i][1] = (TH2D*)(fqvec->FindObjectAny("LHC11h")->FindObject(Form("gHistVZEROAQ%iyRecenteringMap",i+1)));
2032  if(h[i][1]) fQyavsV0[i] = static_cast<TH1D*>(h[i][1]->ProjectionY(Form("fQyavsV0[%i]",i),RunBin,RunBin));
2033  h[i][2] = (TH2D*)(fqvec->FindObjectAny("LHC11h")->FindObject(Form("gHistVZEROCQ%ixRecenteringMap",i+1)));
2034  if(h[i][2]) fQxcvsV0[i] = static_cast<TH1D*>(h[i][2]->ProjectionY(Form("fQxcvsV0[%i]",i),RunBin,RunBin));
2035  h[i][3] = (TH2D*)(fqvec->FindObjectAny("LHC11h")->FindObject(Form("gHistVZEROCQ%iyRecenteringMap",i+1)));
2036  if(h[i][3]) fQycvsV0[i] = static_cast<TH1D*>(h[i][3]->ProjectionY(Form("fQycvsV0[%i]",i),RunBin,RunBin));
2037  }
2038 
2039  // set the recentering style (might be switched back to -1 if recentering is disabeled)
2040  // FIXME as an ugly hack, for now I mark this as 666 to denote the experimental nature
2041  // of this and use it transparently without disrupting the existing calbiration
2042  fApplyRecentering = 666;
2043 }
2044 //-----------------------------------------------------------------------------
2045 
2047  // implementation of delta vzero calibration for LHC2015o Low Intensity Runs
2048 
2049  fEvent = cuts->GetEvent();
2050  if(!fEvent) return; // coverity. we need to know the event to get the runnumber and centrality
2051  // get the vzero centrality percentile (cc dependent calibration)
2052 
2053  // if this event is from the same run as the previous event
2054  // we can use the cached calibration values, no need to re-open the
2055  // aodb file, else cache the new run
2056  Int_t run(fEvent->GetRunNumber());
2057  if(fCachedRun == run){
2058  return;
2059  }else{
2060  fCachedRun = run;
2061  }
2062 
2063  // check if the proper chi weights for merging vzero a and vzero c ep are present
2064  // if not, use sane defaults. centrality binning is equal to that given in the fVZEROcentralityBin snippet
2065  //
2066  // chi values can be calculated using the static helper function
2067  // AliAnalysisTaskJetV2::CalculateEventPlaneChi(Double_t res) where res is the event plane
2068  // resolution in a given centrality bin
2069  //
2070  // the resolutions that were used for these defaults are
2071  // Double_t R2VZEROA[] = {.35, .40, .48, .50, .48, .45, .38, .26, .16};
2072  // Double_t R2VZEROC[] = {.45, .60, .70, .73, .68, .60, .40, .36, .17};
2073  //
2074  // Double_t R3VZEROA[] = {.22, .23, .22, .19, .15, .12, .08, .00, .00};
2075  // Double_t R3VZEROC[] = {.30, .30, .28, .25, .22, .17, .11, .00, .00};
2076  Double_t chiC2[] = {0.771423, 1.10236, 1.38116, 1.48077, 1.31964, 1.10236, 0.674622, 0.600403, 0.273865};
2077  Double_t chiA2[] = {0.582214, 0.674622, 0.832214, 0.873962, 0.832214, 0.771423, 0.637146, 0.424255, 0.257385};
2078  Double_t chiC3[] = {0.493347, 0.493347, 0.458557, 0.407166, 0.356628, 0.273865, 0.176208, 6.10352e-05, 6.10352e-05};
2079  Double_t chiA3[] = {0.356628, 0.373474, 0.356628, 0.306702, 0.24115, 0.192322, 0.127869, 6.10352e-05, 6.10352e-05};
2080 
2081  // this may seem redundant but in this way the cuts object is owner of the arrays
2082  // even if they're created here (so we won't get into trouble with dtor, assigmnet and copying)
2083  if(!cuts->GetChi2A()) cuts->SetChi2A(new TArrayD(9, chiA2));
2084  if(!cuts->GetChi2C()) cuts->SetChi2C(new TArrayD(9, chiC2));
2085  if(!cuts->GetChi3A()) cuts->SetChi3A(new TArrayD(9, chiA3));
2086  if(!cuts->GetChi3C()) cuts->SetChi3C(new TArrayD(9, chiC3));
2087 
2088  if(!fChi2A) fChi2A = cuts->GetChi2A();
2089  if(!fChi2C) fChi2C = cuts->GetChi2C();
2090  if(!fChi3A) fChi3A = cuts->GetChi3A();
2091  if(!fChi3C) fChi3C = cuts->GetChi3C();
2092 
2093  // get the calibration file for the gain equalization
2094  TFile *foadb = TFile::Open("alien:///alice/cern.ch/user/b/bhohlweg/gainVZERO.LHC15oLowIR.root");
2095  if(!foadb){
2096  AliFatal("file alien:///alice/cern.ch/user/b/bhohlweg/gainVZERO.LHC15oLowIR.root cannot be opened, CALIBRATION FAILED !");
2097  return;
2098  }
2099  TH3F* Weights = dynamic_cast<TH3F*>(foadb->FindObjectAny("LHC15oLowIR")->FindObject("gHistVZEROChannelGainEqualizationMapRun2"));
2100  if(!Weights){
2101  AliFatal("gHistVZEROChannelGainEqualizationMapRun2 is not available in the file\n");
2102  return;
2103  }
2104 
2105  if(cuts->GetVZEROgainEqualizationPerRing()) {
2106  // enable or disable rings through the weights, weight 1. is enabled, 0. is disabled
2107  // start with the vzero c rings (segments 0 through 31)
2108  (cuts->GetUseVZERORing(0)) ? cuts->SetVZEROCpol(0, 1.) : cuts->SetVZEROCpol(0, 0.);
2109  (cuts->GetUseVZERORing(1)) ? cuts->SetVZEROCpol(1, 1.) : cuts->SetVZEROCpol(1, 0.);
2110  (cuts->GetUseVZERORing(2)) ? cuts->SetVZEROCpol(2, 1.) : cuts->SetVZEROCpol(2, 0.);
2111  (cuts->GetUseVZERORing(3)) ? cuts->SetVZEROCpol(3, 1.) : cuts->SetVZEROCpol(3, 0.);
2112  // same for vzero a
2113  (cuts->GetUseVZERORing(4)) ? cuts->SetVZEROApol(0, 1.) : cuts->SetVZEROApol(0, 0.);
2114  (cuts->GetUseVZERORing(5)) ? cuts->SetVZEROApol(1, 1.) : cuts->SetVZEROApol(1, 0.);
2115  (cuts->GetUseVZERORing(6)) ? cuts->SetVZEROApol(2, 1.) : cuts->SetVZEROApol(2, 0.);
2116  (cuts->GetUseVZERORing(7)) ? cuts->SetVZEROApol(3, 1.) : cuts->SetVZEROApol(3, 0.);
2117  } else {
2118  // else enable all rings, which is also default
2119  for(Int_t i(0); i < 4; i++) cuts->SetVZEROCpol(i, 1.);
2120  for(Int_t i(0); i < 4; i++) cuts->SetVZEROApol(i, 1.);
2121  }
2122 
2123  // loop over the 15o runs to see if it's 15o LowIR data
2124  // 245061 not included as it has Physics Selection Status 3 and VZERO data is not available
2125 
2126  Int_t runs15oLowIR[11] = {244917 ,244918,244975,244980,244982,244983,245064,245068,246390,246391,246392};
2127  Int_t RunBin = -1;
2128  for(Int_t r(0); r < 11; r++) {
2129  if(run == runs15oLowIR[r]) {
2130  RunBin = r+1;
2131  break;
2132  }
2133  }
2134  if(RunBin < 0){
2135  AliFatal("No calibration file existing for this run Number in SetKappaVZEROCalibrationForTrackCuts \n");
2136  }
2137 
2138  // step 0) get the TH2D which contains the correction factor per VZERO channel per centrality bin
2139  // and pass it to the current track cuts obect
2140  Weights->GetXaxis()->SetRange(RunBin,RunBin);
2141  TH2D* fMultVZEROCen = dynamic_cast<TH2D*>(Weights->Project3D("zy"));
2142  cuts->SetVZEROgainEqualisationCen(fMultVZEROCen); // passed as a TH2
2143 
2144  // get the calibration file for the q-vector recentering
2145  TFile *fqvec = TFile::Open("alien:///alice/cern.ch/user/b/bhohlweg/recenteringVZERO.LHC15oLowIR.root");
2146  if(!fqvec){
2147  AliFatal("file alien:///alice/cern.ch/user/b/bhohlweg/recenteringVZERO.LHC15oLowIR.root cannot be opened, CALIBRATION FAILED !");
2148  }
2149 
2150  // first index of the oadb array is the harmonic n, the second index is either qax, qay, qcx, qcy
2151  TH2D* h[3][4];
2152  for(Int_t i(0); i < 3; i++) {
2153  h[i][0] = (TH2D*)(fqvec->FindObjectAny("LHC15oLowIR")->FindObject(Form("gHistVZEROAQ%ixRecenteringMap",i+1)));
2154  if(h[i][0]) fQxavsV0[i] = static_cast<TH1D*>(h[i][0]->ProjectionY(Form("fQxavsV0[%i]",i),RunBin,RunBin));
2155  h[i][1] = (TH2D*)(fqvec->FindObjectAny("LHC15oLowIR")->FindObject(Form("gHistVZEROAQ%iyRecenteringMap",i+1)));
2156  if(h[i][1]) fQyavsV0[i] = static_cast<TH1D*>(h[i][1]->ProjectionY(Form("fQyavsV0[%i]",i),RunBin,RunBin));
2157  h[i][2] = (TH2D*)(fqvec->FindObjectAny("LHC15oLowIR")->FindObject(Form("gHistVZEROCQ%ixRecenteringMap",i+1)));
2158  if(h[i][2]) fQxcvsV0[i] = static_cast<TH1D*>(h[i][2]->ProjectionY(Form("fQxcvsV0[%i]",i),RunBin,RunBin));
2159  h[i][3] = (TH2D*)(fqvec->FindObjectAny("LHC15oLowIR")->FindObject(Form("gHistVZEROCQ%iyRecenteringMap",i+1)));
2160  if(h[i][3]) fQycvsV0[i] = static_cast<TH1D*>(h[i][3]->ProjectionY(Form("fQycvsV0[%i]",i),RunBin,RunBin));
2161  }
2162 
2163  // set the recentering style (might be switched back to -1 if recentering is disabeled)
2164  // FIXME as an ugly hack, for now I mark this as 999 to denote the experimental nature
2165  // of this and use it transparently without disrupting the existing calbiration
2166  fApplyRecentering = 999;
2167 }
2168 
2169 
2170 //_____________________________________________________________________________
2172 
2173  // V0 calibration for 2015 high interaction rate (IR) data
2174 
2175  fEvent = cuts->GetEvent();
2176  if(!fEvent) return; // coverity. we need to know the event to get the runnumber and centrality
2177  // get the vzero centrality percentile (cc dependent calibration)
2178 
2179  // if this event is from the same run as the previous event
2180  // we can use the cached calibration values, no need to re-open the
2181  // aodb file, else cache the new run
2182  Int_t run(fEvent->GetRunNumber());
2183  if(fCachedRun == run){
2184  return;
2185  }else{
2186  fCachedRun = run;
2187  }
2188  if (!gGrid) TGrid::Connect("alien");
2189  TFile* foadb = 0x0;
2190  if(fCachedRun == 280234 || fCachedRun == 280235) foadb = TFile::Open("alien:///alice/cern.ch/user/r/rbertens/calibV0XeXe.root");
2191  else foadb = TFile::Open("alien:///alice/cern.ch/user/r/rbertens/calibV0HIR.root");
2192 
2193 
2194  if(!foadb){
2195  AliFatal("OADB V0 calibration file cannot be opened\n");
2196  return;
2197  }
2198 
2199 
2200  // we need to do some mapping because I don't want to add another set of histograms to an already
2201  // cluttered class
2202  // so, here goes the mapping of the names
2203  //
2204  // fQxavsV0[0] fQxnmV0A
2205  // fQyavsV0[0] fQynmV0A
2206  // fQxavsV0[1] fQxnsV0A
2207  // fQyavsV0[1] fQynsV0A
2208  // fQxcvsV0[0] fQxnmV0C
2209  // fQycvsV0[0] fQynmV0C
2210  // fQxcvsV0[1] fQxnsV0C
2211  // fQycvsV0[1] fQynsV0C
2212  //
2213  // so the rationale: index zero is mean, index 1 is width, the rest is in the name
2214  //
2215  // the odd one out
2216  // fQxavsV0[4] = fMultV0
2217 
2218  AliOADBContainer* cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorPfpx");
2219  if(!cont){
2220  AliFatal("OADB object hMultV0BefCorr is not available in the file\n");
2221  return;
2222  }
2223  if(!(cont->GetObject(run))){
2224  printf("OADB object hMultV0BefCorPfpx is not available for run %i\n", run);
2225  return;
2226  }
2227  fQxavsV0[4] = ((TH1D*) cont->GetObject(run));
2228 
2229 
2230  for(Int_t harm = 2; harm < 4; harm++) {
2231  AliOADBContainer* contQxnam = 0;
2232  if (harm == 2)
2233  contQxnam = (AliOADBContainer*) foadb->Get("fqxa2m");
2234  else if (harm == 3)
2235  contQxnam = (AliOADBContainer*) foadb->Get("fqxa3m");
2236 
2237  if(!contQxnam){
2238  printf("OADB object fqxanm is not available in the file\n");
2239  return;
2240  }
2241  if(!(contQxnam->GetObject(run))){
2242  printf("OADB object fqxanm is not available for run %i\n", run);
2243  return;
2244  }
2245  fQxavsV0[0+(harm-2)*2] = ((TH1D*) contQxnam->GetObject(run));
2246 
2247 
2248 
2249  AliOADBContainer* contQynam = 0;
2250  if (harm == 2)
2251  contQynam = (AliOADBContainer*) foadb->Get("fqya2m");
2252  else if (harm == 3)
2253  contQynam = (AliOADBContainer*) foadb->Get("fqya3m");
2254 
2255  if(!contQynam){
2256  printf("OADB object fqyanm is not available in the file\n");
2257  return;
2258  }
2259  if(!(contQynam->GetObject(run))){
2260  printf("OADB object fqyanm is not available for run %i\n", run);
2261  return;
2262  }
2263  fQyavsV0[0+(harm-2)*2] = ((TH1D*) contQynam->GetObject(run));
2264 
2265 
2266 
2267  AliOADBContainer* contQxnas = 0;
2268  if (harm == 2)
2269  contQxnas = (AliOADBContainer*) foadb->Get("fqxa2s");
2270  else if (harm == 3)
2271  contQxnas = (AliOADBContainer*) foadb->Get("fqxa3s");
2272 
2273  if(!contQxnas){
2274  printf("OADB object fqxans is not available in the file\n");
2275  return;
2276  }
2277  if(!(contQxnas->GetObject(run))){
2278  printf("OADB object fqxans is not available for run %i\n", run);
2279  return;
2280  }
2281  fQxavsV0[1+(harm-2)*2] = ((TH1D*) contQxnas->GetObject(run));
2282 
2283  AliOADBContainer* contQynas = 0;
2284  if (harm == 2)
2285  contQynas = (AliOADBContainer*) foadb->Get("fqya2s");
2286  else if (harm == 3)
2287  contQynas = (AliOADBContainer*) foadb->Get("fqya3s");
2288 
2289  if(!contQynas){
2290  printf("OADB object fqyans is not available in the file\n");
2291  return;
2292  }
2293  if(!(contQynas->GetObject(run))){
2294  printf("OADB object fqyans is not available for run %i\n", run);
2295  return;
2296  }
2297  fQyavsV0[1+(harm-2)*2] = ((TH1D*) contQynas->GetObject(run));
2298 
2299 
2300 
2301  AliOADBContainer* contQxncm = 0;
2302  if (harm == 2)
2303  contQxncm = (AliOADBContainer*) foadb->Get("fqxc2m");
2304  else if (harm == 3)
2305  contQxncm = (AliOADBContainer*) foadb->Get("fqxc3m");
2306 
2307  if(!contQxncm){
2308  printf("OADB object fqxcnm is not available in the file\n");
2309  return;
2310  }
2311  if(!(contQxncm->GetObject(run))){
2312  printf("OADB object fqxcnm is not available for run %i\n", run);
2313  return;
2314  }
2315  fQxcvsV0[0+(harm-2)*2] = ((TH1D*) contQxncm->GetObject(run));
2316 
2317 
2318 
2319  AliOADBContainer* contQyncm = 0;
2320  if (harm == 2)
2321  contQyncm = (AliOADBContainer*) foadb->Get("fqyc2m");
2322  else if (harm == 3)
2323  contQyncm = (AliOADBContainer*) foadb->Get("fqyc3m");
2324 
2325  if(!contQyncm){
2326  printf("OADB object fqyc2m is not available in the file\n");
2327  return;
2328  }
2329  if(!(contQyncm->GetObject(run))){
2330  printf("OADB object fqyc2m is not available for run %i\n", run);
2331  return;
2332  }
2333  fQycvsV0[0+(harm-2)*2] = ((TH1D*) contQyncm->GetObject(run));
2334 
2335  AliOADBContainer* contQxncs = 0;
2336  if (harm == 2)
2337  contQxncs = (AliOADBContainer*) foadb->Get("fqxc2s");
2338  else if (harm == 3)
2339  contQxncs = (AliOADBContainer*) foadb->Get("fqxc3s");
2340 
2341  if(!contQxncs){
2342  printf("OADB object fqxc2s is not available in the file\n");
2343  return;
2344  }
2345  if(!(contQxncs->GetObject(run))){
2346  printf("OADB object fqxc2s is not available for run %i\n", run);
2347  return;
2348  }
2349  fQxcvsV0[1+(harm-2)*2] = ((TH1D*) contQxncs->GetObject(run));
2350 
2351 
2352 
2353  AliOADBContainer* contQyncs = 0;
2354  if (harm == 2)
2355  contQyncs = (AliOADBContainer*) foadb->Get("fqyc2s");
2356  else if (harm == 3)
2357  contQyncs = (AliOADBContainer*) foadb->Get("fqyc3s");
2358 
2359  if(!contQyncs){
2360  printf("OADB object fqycnm is not available in the file\n");
2361  return;
2362  }
2363  if(!(contQyncs->GetObject(run))){
2364  printf("OADB object fqycns is not available for run %i\n", run);
2365  return;
2366  }
2367  fQycvsV0[1+(harm-2)*2] = ((TH1D*) contQyncs->GetObject(run));
2368 
2370 
2371  }
2372 
2373 
2374  for(Int_t i(0); i < 4; i++) {
2375  cuts->SetVZEROApol(i, 1.);
2376  cuts->SetVZEROCpol(i, 1.);
2377  }
2378 
2379  fApplyRecentering = 20152;
2380 }
2381 
2382 //-----------------------------------------------------------------------------
2383 
2385 {
2386  //clear the event without releasing any memory
2387  //note that cached run number of recentering settigns are not clear
2388  //(see AliFlowEvent::ClearCachedRun() )
2390 }
2391 
2392 //_____________________________________________________________________________
2393 
2395 {
2396  //clear the cached run (not in clear fast as cache needs to be persistent in most cases )
2397  fCachedRun=0;
2399 }
virtual AliFlowVector GetQ(Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE)
Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos)
TArrayD * fChi2A
current event
Definition: AliFlowEvent.h:119
virtual void ClearCachedRun()
void FindDaughters(Bool_t keepDaughtersInRPselection=kFALSE)
void SetVZEROCalibrationForTrackCuts(AliFlowTrackCuts *cuts)
void SetChi3C(TArrayD *Chi3C)
virtual void SetDaughter(Int_t, AliFlowTrackSimple *)
double Double_t
Definition: External.C:58
virtual AliFlowVector GetQ(Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE)
Definition: External.C:260
void SetEta(Double_t eta)
virtual void Clear(Option_t *o="")
Definition: AliFlowTrack.h:42
TObject * GetInputObject(Int_t i)
Definition: External.C:236
virtual Int_t GetNDaughters() const
void SetChi3A(TArrayD *Chi3A)
TArrayD * fChi3C
chi vs cent for vzero A ep_3
Definition: AliFlowEvent.h:122
TArrayD * fChi2C
chi vs cent for vzero A ep_2
Definition: AliFlowEvent.h:120
Double_t GetMult() const
Definition: AliFlowVector.h:46
void SetMCReactionPlaneAngle(const AliMCEvent *mcEvent)
AliFlowEventSimple & operator=(const AliFlowEventSimple &anEvent)
Int_t GetRun() const
AliFlowEvent & operator=(const AliFlowEvent &event)
TArrayD * GetChi2A()
void SetChi2A(TArrayD *Chi2A)
virtual Int_t GetIDDaughter(Int_t) const
void AddTrack(AliFlowTrackSimple *track)
virtual Bool_t IsSelected(TObject *obj, Int_t id=-666)
AliVEvent * fEvent
recentering
Definition: AliFlowEvent.h:118
void SetVZEROgainEqualisationCen(TH2 *g)
TArrayD * GetChi2C()
trackParameterType GetParamType() const
void TagRP(Bool_t b=kTRUE)
Bool_t fDivSigma
Definition: AliFlowEvent.h:105
void IncrementNumberOfPOIs(Int_t poiType=1)
AliFlowTrack * GetTrack(Int_t i)
Bool_t GetVZEROgainEqualizationPerRing() const
void SetForRPSelection(Bool_t b=kTRUE)
Bool_t GetApplyRecentering() const
Int_t GetNumberOfInputObjects() const
void SetDeltaVZEROCalibrationForTrackCuts(AliFlowTrackCuts *cuts)
void Fill(AliFlowTrackCuts *rpCuts, AliFlowTrackCuts *poiCuts)
int Int_t
Definition: External.C:63
Bool_t FillFlowTrack(AliFlowTrack *track) const
float Float_t
Definition: External.C:68
TH1 * fQxcvsV0[5]
recentering
Definition: AliFlowEvent.h:115
void SetVZEROCpol(Int_t ring, Float_t f)
Definition: External.C:228
Definition: External.C:212
TArrayD * GetChi3A()
Bool_t GetDivSigma() const
Float_t fWidthQ[9][2][2]
recentering
Definition: AliFlowEvent.h:109
void SetVZEROgainEqualisation(TH1 *g)
Float_t GetPmdPhi(Float_t xPos, Float_t yPos)
void Tag(Int_t n, Bool_t b=kTRUE)
AliVEvent * GetEvent() const
TObjArray * fTrackCollection
void SetKappaVZEROCalibrationForTrackCuts(AliFlowTrackCuts *cuts)
void SetSource(trackSource s)
Definition: AliFlowTrack.h:37
Float_t fMeanQv3[9][2][2]
recentering
Definition: AliFlowEvent.h:110
virtual void Get2Qsub(AliFlowVector *Qarray, Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE)
void SetPhi(Double_t phi)
Int_t fVZEROcentralityBin
cached calibration info for vzero
Definition: AliFlowEvent.h:107
short Short_t
Definition: External.C:23
void SetPt(Double_t pt)
Bool_t GetUseVZERORing(Int_t i) const
TArrayD * GetChi3C()
void SetWeight(Double_t weight)
void SetBetaVZEROCalibrationForTrackCuts(AliFlowTrackCuts *cuts)
void SetForPOISelection(Bool_t b=kTRUE)
TObjArray * fMothersCollection
void SetMCReactionPlaneAngle(Double_t fPhiRP)
Float_t fMeanQ[9][2][2]
centrality bin for the current event
Definition: AliFlowEvent.h:108
TH1 * fQycvsV0[5]
recentering
Definition: AliFlowEvent.h:116
AliFlowTrack * ReuseTrack(Int_t i)
virtual void Get2Qsub(AliFlowVector *Qarray, Int_t n=2, TList *weightsList=0x0, Bool_t usePhiWeights=0x0, Bool_t usePtWeights=0x0, Bool_t useEtaWeights=0x0)
bool Bool_t
Definition: External.C:53
TH1 * fQyavsV0[5]
recentering
Definition: AliFlowEvent.h:114
Int_t fCachedRun
Definition: AliFlowEvent.h:106
void SetHotfixVZEROCalibrationForTrackCuts(AliFlowTrackCuts *cuts)
void InsertTrack(AliFlowTrack *)
virtual void ClearFast()
void SetChi2C(TArrayD *Chi2C)
TH1 * fQxavsV0[5]
recentering
Definition: AliFlowEvent.h:113
TArrayD * fChi3A
chi vs cent for vzero C ep_2
Definition: AliFlowEvent.h:121
Float_t fWidthQv3[9][2][2]
recentering
Definition: AliFlowEvent.h:111
void SetVZEROApol(Int_t ring, Float_t f)
Int_t fApplyRecentering
Definition: AliFlowEvent.h:104