1 //Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2 //University of Tennessee at Knoxville
4 // This class is designed for the analysis of the hadronic component of
5 // transverse energy. It is used by AliAnalysisTaskHadEt.
6 // This gets information about the hadronic component of the transverse energy
7 // from tracks reconstructed in an event
8 // it has daughters, AliAnalysisHadEtMonteCarlo and
9 // AliAnalysisHadEtReconstructed which loop over either Monte Carlo data or
10 // real data to get Et
12 #include "AliAnalysisHadEt.h"
18 #include "AliAnalysisEtCuts.h"
19 #include "AliMCEvent.h"
20 #include "AliVEvent.h"
22 #include "AliESDtrackCuts.h"
23 #include "TDatabasePDG.h"
24 #include "TParticle.h"
30 ClassImp(AliAnalysisHadEt);
33 Int_t AliAnalysisHadEt::fgnumOfEtaBins = 16;
34 Float_t AliAnalysisHadEt::fgEtaAxis[17]={-0.78, -0.7, -0.58, -0.46, -0.34, -0.22, -0.12, -0.06, -0.0, 0.06, 0.12, 0.22, 0.34, 0.46, 0.58, 0.7, 0.78};
35 Int_t AliAnalysisHadEt::fgNumOfPtBins = 111;
36 Float_t AliAnalysisHadEt::fgPtAxis[117]=
37 {0.0,0.01,0.02,0.03,0.04, 0.05, 0.06,0.07,0.08,0.09, 0.10,0.11, .12,0.13, .14,0.15, .16,0.17, .18,0.19,
38 0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48,
39 0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78,
40 .80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2,
41 1.25, 1.3,1.35,1.40,1.45, 1.50, 1.55, 1.6,1.65, 1.7, 1.75, 1.8,1.85, 1.9,1.95,
42 2.0, 2.2, 2.4, 2.6, 2.8, 3.00, 3.20, 3.4, 3.6, 3.8, 4.00, 4.2, 4.4, 4.6, 4.8,
43 5.0, 5.5, 6.0, 6.5, 7.0, 7.50, 8.00, 8.5, 9.0, 9.5, 10.0,12.0,14.0,16.0,18.0,
44 20.0,25.0,30.0,35.0,40.0, 45.0, 50.0};
47 AliAnalysisHadEt::AliAnalysisHadEt() : AliAnalysisEtCommon()
57 ,fChargedMultiplicity(0)
58 ,fNeutralMultiplicity(0)
60 {//default constructor
64 AliAnalysisHadEt::~AliAnalysisHadEt()
66 delete fEsdtrackCutsITSTPC;
67 delete fEsdtrackCutsITS;
68 delete fEsdtrackCutsTPC;
71 Int_t AliAnalysisHadEt::AnalyseEvent(AliVEvent *event)
72 { //this line is basically here to eliminate a compiler warning that event is not used. Making it a virtual function did not work with the plugin.
73 AliAnalysisEtCommon::AnalyseEvent(event);
79 void AliAnalysisHadEt::Init()
80 {// clear variables, set up cuts and PDG info
81 AliAnalysisEtCommon::Init();
84 void AliAnalysisHadEt::ResetEventValues()
85 {//Resets event values of et to zero
86 AliAnalysisEtCommon::ResetEventValues();
94 fChargedMultiplicity = 0;
95 fNeutralMultiplicity = 0;
98 void AliAnalysisHadEt::CreateEtaPtHisto2D(TString name, TString title)
99 { //creates a 2-d histogram in eta and phi and adds it to the list of histograms to be saved
100 TString *histoname = new TString();
101 TString *histotitle = new TString();
103 histoname->Append(name);
104 histotitle->Append(title);
106 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),fgNumOfPtBins, fgPtAxis, fgnumOfEtaBins, fgEtaAxis);
107 histo->SetYTitle("#eta");
108 histo->SetXTitle("p_{T}");
109 histo->SetZTitle("E_{T}");
111 fhistoList->Add(histo);
117 void AliAnalysisHadEt::CreateHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Float_t xlow,Float_t xhigh)
118 { //creates a 1d histogram of the given dimensions and adds it to the list of histograms to be saved
119 TString *histoname = new TString();
120 TString *histotitle = new TString();
121 histoname->Append(name);
122 histotitle->Append(title);
123 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
124 histo->SetYTitle(ytitle);
125 histo->SetXTitle(xtitle);
127 fhistoList->Add(histo);
131 void AliAnalysisHadEt::CreateIntHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Int_t xlow,Int_t xhigh)
132 { //creates a 1d integer histogram and adds it to the list of histograms to be saved
133 TString *histoname = new TString();
134 TString *histotitle = new TString();
135 histoname->Append(name);
136 histotitle->Append(title);
137 TH1I *histo = new TH1I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
138 histo->SetYTitle(ytitle);
139 histo->SetXTitle(xtitle);
141 fhistoList->Add(histo);
146 void AliAnalysisHadEt::CreateHisto2D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Float_t xlow,Float_t xhigh,Int_t ybins,Float_t ylow,Float_t yhigh)
147 { //creates a 2d histogram and adds it to the list of histograms to be saved
148 TString *histoname = new TString();
149 TString *histotitle = new TString();
150 histoname->Append(name);
151 histotitle->Append(title);
152 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
153 histo->SetYTitle(ytitle);
154 histo->SetXTitle(xtitle);
156 fhistoList->Add(histo);
161 void AliAnalysisHadEt::CreateIntHisto2D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Int_t xlow,Int_t xhigh,Int_t ybins,Int_t ylow,Int_t yhigh)
162 { //creates a 2-d integer histogram and adds it to the list of histograms to be saved
163 TString *histoname = new TString();
164 TString *histotitle = new TString();
165 histoname->Append(name);
166 histotitle->Append(title);
167 TH2I *histo = new TH2I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
168 histo->SetYTitle(ytitle);
169 histo->SetXTitle(xtitle);
171 fhistoList->Add(histo);
177 void AliAnalysisHadEt::CreateEtaHisto1D(TString name, TString title)
178 { //creates 1d histogram in eta and adds it to the list of histograms to be saved
179 TString *histoname = new TString();
180 TString *histotitle = new TString();
181 histoname->Append(name);
182 histotitle->Append(title);
183 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),fgnumOfEtaBins, fgEtaAxis);
184 histo->SetYTitle("E_{T}");
185 histo->SetXTitle("#eta");
187 fhistoList->Add(histo);
191 void AliAnalysisHadEt::FillHisto1D(TString histname, Float_t x, Float_t weight)
192 {//fills a 1d histogram with the name histoname with the value x and the weight "weight"
194 TString *name = new TString();
195 name->Append(histname);
196 histo = (TH1F *)fhistoList->FindObject(name->Data());
198 histo->Fill((Double_t)x, weight);
200 else{cerr<<"CorrelationMaker::FillHisto1D: no histogram "<< name->Data()<<endl;}
203 void AliAnalysisHadEt::FillHisto2D(TString histname, Float_t x, Float_t y, Float_t weight)
204 {//fills a 2d histogram with the name histoname with the value x and the weight "weight"
206 TString *name = new TString();
207 name->Append(histname);
208 histo = (TH2F *)fhistoList->FindObject(name->Data());
210 histo->Fill((Double_t)x,(Double_t)y, weight);
212 else{cerr<<"CorrelationMaker::FillHisto2D: no histogram "<< name->Data()<<endl;}
217 Float_t AliAnalysisHadEt::Et(TParticle *part, float mass){//function to calculate et in the same way as it would be calculated in a calorimeter
218 if(mass+1000<0.01){//if no mass given return default. The default argument is -1000
219 if(TMath::Abs(part->GetPDG(0)->PdgCode())==2212 || TMath::Abs(part->GetPDG(0)->PdgCode())==2112){
220 if(part->GetPDG(0)->PdgCode()==-2212 || part->GetPDG(0)->PdgCode()==-2112){//antiproton or antineutron
221 //for antinucleons we specifically want to return the kinetic energy plus twice the rest mass
222 return (part->Energy()+part->GetMass())*TMath::Sin(part->Theta());
224 if(part->GetPDG(0)->PdgCode()==2212 || part->GetPDG(0)->PdgCode()==2112){//proton or neutron
225 //for nucleons we specifically want to return the kinetic energy only
226 return (part->Energy()-part->GetMass())*TMath::Sin(part->Theta());
229 else{//otherwise go to the default
230 return part->Energy()*TMath::Sin(part->Theta());
233 else{//otherwise use the mass that was given
234 return (TMath::Sqrt(TMath::Power(part->P(),2.0)+TMath::Power(mass,2.0)))*TMath::Sin(part->Theta());
238 Float_t AliAnalysisHadEt::Et(Float_t p, Float_t theta, Int_t pid, Short_t charge) const {//function to calculate et in the same way as it would be calculated in a calorimeter
239 if(pid==AliAnalysisEtCommon::fgPiPlusCode || pid==AliAnalysisEtCommon::fgPiMinusCode){//Nothing special for pions
240 return TMath::Sqrt(p*p + fgPionMass*fgPionMass) * TMath::Sin(theta);
242 if(pid==AliAnalysisEtCommon::fgKPlusCode || pid==AliAnalysisEtCommon::fgKMinusCode){//Nothing special for kaons
243 return TMath::Sqrt(p*p + AliAnalysisEtCommon::fgKaonMass*AliAnalysisEtCommon::fgKaonMass) * TMath::Sin(theta);
245 if(pid==AliAnalysisEtCommon::fgEPlusCode || pid==AliAnalysisEtCommon::fgEMinusCode){//Nothing special for electrons
246 return TMath::Sqrt(p*p + AliAnalysisEtCommon::fgElectronMass*AliAnalysisEtCommon::fgElectronMass) * TMath::Sin(theta);
248 if(pid==AliAnalysisEtCommon::fgProtonCode || pid==AliAnalysisEtCommon::fgAntiProtonCode){//But for protons we must be careful...
249 if(charge<0.0){//antiprotns: kinetic energy plus twice the rest mass
250 return (TMath::Sqrt(p*p + AliAnalysisEtCommon::fgProtonMass*AliAnalysisEtCommon::fgProtonMass) + AliAnalysisEtCommon::fgProtonMass) * TMath::Sin(theta);
252 if(charge>0.0){//antiprotns: kinetic energy only
253 return (TMath::Sqrt(p*p + AliAnalysisEtCommon::fgProtonMass*AliAnalysisEtCommon::fgProtonMass) - AliAnalysisEtCommon::fgProtonMass) * TMath::Sin(theta);
256 cerr<<"Uh-oh! Et not set properly!"<<endl;