]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/PHOSTasks/PHOS_PbPb/AliAnalysisTaskPi0FlowMCParamWeights.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / AliAnalysisTaskPi0FlowMCParamWeights.cxx
CommitLineData
8a50cabd 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// Extension to Pi0FlowMC, using parametrized weights.
17// Authors: Boris Polishchuk
18// Date : 09.07.2013
19
20#include "AliStack.h"
21#include "TParticle.h"
22#include "AliCaloPhoton.h"
23#include "TH1.h"
24
25#include "AliAnalysisTaskPi0FlowMCParamWeights.h"
26
27ClassImp(AliAnalysisTaskPi0FlowMCParamWeights);
28
29AliAnalysisTaskPi0FlowMCParamWeights::AliAnalysisTaskPi0FlowMCParamWeights(const char* name, AliAnalysisTaskPi0Flow::Period period)
30: AliAnalysisTaskPi0FlowMC(name, period)
31{}
32
33AliAnalysisTaskPi0FlowMCParamWeights::~AliAnalysisTaskPi0FlowMCParamWeights()
34{}
35
36void AliAnalysisTaskPi0FlowMCParamWeights::UserCreateOutputObjects()
37{
38 // Do Pi0FlowMC CreateOuputObjects and call Sumw2 for newly created histograms.
39 AliAnalysisTaskPi0FlowMC::UserCreateOutputObjects();
40
41 TH1 * hist = 0;
42 char key[80];
43
44 const int kNPID = 14;
45 const char* pidNames[kNPID] = {"All", "Allcore", "Disp", "Disp2", "Dispcore", "Disp2core", "CPV", "CPVcore", "CPV2", "CPV2core", "Both", "Bothcore", "Both2", "Both2core"};
46
47 for(UInt_t iBin=0; iBin<GetNumberOfCentralityBins(); iBin++) {
48 for(Int_t ipid=0; ipid < kNPID; ipid++){
49
50 sprintf(key,"hPi0%s_cen%d", pidNames[ipid],iBin);
51 hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key));
41bd964b 52 if(hist) { hist->Sumw2(); printf(" ->Sumw2 invoked for %s.\n",key); }
8a50cabd 53
54 sprintf(key,"hMiPi0%s_cen%d", pidNames[ipid],iBin);
55 hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key));
41bd964b 56 if(hist) { hist->Sumw2(); printf(" ->Sumw2 invoked for %s.\n",key); }
8a50cabd 57 }
58 }
59
60}
61
62Double_t AliAnalysisTaskPi0FlowMCParamWeights::PrimaryWeight(Int_t primary){
63 //Check who is the primary and introduce weight to correct primary spectrum
64
65 if(primary<0 || primary>=fStack->GetNtrack())
66 return 1 ;
67 //trace primaries up to IP
68 TParticle* particle = fStack->Particle(primary);
69
70 Double_t r=particle->R() ;
71 Int_t mother = particle->GetFirstMother() ;
72 while(mother>-1){
73 if(r<1.)
74 break ;
75 particle = fStack->Particle(mother);
76 mother = particle->GetFirstMother() ;
77 r=particle->R() ;
78 }
79
80 return TMath::Max(0.,PrimaryParticleWeight(particle)) ;
81}
82
83Double_t AliAnalysisTaskPi0FlowMCParamWeights::PrimaryParticleWeight(TParticle * particle){
84 //Weight for particle
85
86
87 // pi0 weight (MC/Data):
88 // w = (par[0]+par[1]*x[0]+par[2]*x[0]*x[0]+par[3]*x[0]*x[0]*x[0])/(1.+par[3]*x[0]+par[4]*x[0]*x[0]+par[5]*x[0]*x[0]*x[0]);
89
90 Int_t pdg = particle->GetPdgCode() ;
91 Double_t x = particle->Pt() ;
92 Int_t mother = particle->GetFirstMother() ;
93 while(TMath::Abs(pdg)<100){//gamma, electrons, muons
94 if(mother>-1){
95 TParticle * tmpP=fStack->Particle(mother) ;
96 pdg=tmpP->GetPdgCode() ;
97 x = tmpP->Pt() ;
98 mother = tmpP->GetFirstMother() ;
99 }
100 else{ //direct photon/electron....
101 return 1.;
102 }
103 }
104
105
106 //lhc13e7
107 Double_t w = 15.9695 -26.2752*x + 16.7259*x*x -4.77561*x*x*x +0.602569*x*x*x*x;
108
109 //single pi0: 0-25GeV-flat
110 //Double_t w = 1.48592 -2.78259*x + 2.01851*x*x -0.661467*x*x*x +0.0980217*x*x*x*x;
111
112 //single pi0: 0-6GeV-flat
113 //Double_t w = 55.6309 -102.175*x + 73.7241*x*x -24.3558*x*x*x +3.74631*x*x*x*x;
114
115 return 1./w;
116
117}
118
119
120