AliPhysics  dc874a1 (dc874a1)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliLocalRhoParameter.h
Go to the documentation of this file.
1 #ifndef ALILOCALRHOPARAMETER_H
2 #define ALILOCALRHOPARAMETER_H
3 
4 // $Id$
5 
6 #include <TMath.h>
7 #include <TF1.h>
8 #include <AliRhoParameter.h>
9 
11  public:
13  AliLocalRhoParameter(const char* name, Double_t val);
14  void SetLocalRho(TF1* f) { fLocalRho = f; }
15  TF1* GetLocalRho() const { return fLocalRho; }
17  if(!fLocalRho) return GetVal();
18  Double_t denom(2*r*fLocalRho->GetParameter(0));
19  return (denom <= 0.) ? GetVal() : n*(fLocalRho->Integral(phi-r, phi+r)/denom);
20  }
22  return GetLocalVal(phi, r, GetVal());
23  }
25  // calls the old 'get local val', function added for transparency
26  // integrates the local rho function only in phi
27  return GetLocalVal(phi, r, n);
28  }
30  // numerical approximation for integrating over a circular area in eta phi
31  // instead of 'rectangle' around phi - gran determines step size of integral
32  if(!fLocalRho) return GetVal(); // fallback value
33  Double_t denom(2*r*fLocalRho->GetParameter(0));
34  if (denom < 0) return GetVal();
35  Double_t sum(0), sumWeight(0), weight(0);
36  // make sure gran is an even number and then divide it by two
37  if(gran%2 != 0) gran++;
38  gran/=2;
39  gran = TMath::Nint(gran);
40  for(Int_t i(0); i < gran; i++) {
41  // since the function has no eta dependence, it is just weighted by the approximate
42  // fraction of the circle that covers a given eta, phi region set by the granularity
43  weight = TMath::Sqrt(r*r-((r/(double)gran)*(double)i)*(r/(double)gran)*(double)i);
44  sumWeight+=weight;
45  sum += TMath::Abs(weight * fLocalRho->Integral(phi + (r/(double)gran)*(double)(i), phi + (r/(double)gran)*(double)(i+1)));
46  sum += TMath::Abs(weight * fLocalRho->Integral(phi - (r/(double)gran)*(double)(i), phi - (r/(double)gran)*(double)(i+1)));
47  }
48  if(sumWeight>0) sum/=sumWeight;
49  else return GetVal();
50  return (double)gran*n*(sum/denom);
51  }
53  if(!fLocalRho) return 999.;
54  Double_t intError(fLocalRho->IntegralError(phi-r,phi+r));
55  Double_t absConst(TMath::Abs(n/(2*r*fLocalRho->GetParameter(0))));
56  return intError*absConst; // absolute error on local rho
57  }
59  return GetLocalUncertainty(phi, r, GetVal());
60  }
61  private:
62  TF1* fLocalRho; // ! rho as function of phi
63 
64  AliLocalRhoParameter(const AliLocalRhoParameter&); // not implemented
65  AliLocalRhoParameter& operator=(const AliLocalRhoParameter&); // not implemented
66 
67  ClassDef(AliLocalRhoParameter, 1); // Rho parameter for local (flow) variations
68 };
69 #endif
double Double_t
Definition: External.C:58
Double_t GetLocalVal(Double_t phi, Double_t r, Double_t n) const
ClassDef(AliLocalRhoParameter, 1)
Double_t GetLocalVal(Double_t phi, Double_t r) const
int Int_t
Definition: External.C:63
Double_t GetLocalValInPhi(Double_t phi, Double_t r, Double_t n) const
Double_t GetLocalValInEtaPhi(Double_t phi, Double_t r, Double_t n, Int_t gran=20) const
Double_t GetLocalUncertainty(Double_t phi, Double_t r, Double_t n) const
Double_t GetLocalUncertainty(Double_t phi, Double_t r) const
AliLocalRhoParameter & operator=(const AliLocalRhoParameter &)