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
11 #include "AliAnalysisHadEt.h"
17 #include "AliAnalysisEtCuts.h"
18 #include "AliMCEvent.h"
19 #include "AliVEvent.h"
21 #include "AliESDtrackCuts.h"
22 #include "TDatabasePDG.h"
23 #include "TParticle.h"
28 ClassImp(AliAnalysisHadEt);
31 Int_t AliAnalysisHadEt::fgnumOfEtaBins = 46;
32 Float_t AliAnalysisHadEt::fgEtaAxis[47]={-0.78, -0.74, -0.7, -0.66, -0.62, -0.58, -0.54, -0.5, -0.46, -0.42, -0.38, -0.34, -0.3, -0.26, -0.22, -0.18, -0.14, -0.12, -0.1, -0.08, -0.06, -0.04, -0.02, -0.0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.18, 0.22, 0.26, 0.3, 0.34, 0.38, 0.42, 0.46, 0.5, 0.54, 0.58, 0.62, 0.66, 0.7, 0.74, 0.78};
33 Int_t AliAnalysisHadEt::fgNumOfPtBins = 111;
34 Float_t AliAnalysisHadEt::fgPtAxis[117]=
35 {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,
36 0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48,
37 0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78,
38 .80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2,
39 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,
40 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,
41 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,
42 20.0,25.0,30.0,35.0,40.0, 45.0, 50.0};
44 AliAnalysisHadEt::AliAnalysisHadEt() :
45 fHistogramNameSuffix("")
80 ,fChargedMultiplicity(0)
81 ,fNeutralMultiplicity(0)
82 ,fEsdtrackCutsITSTPC(0)
86 {//default constructor
90 AliAnalysisHadEt::~AliAnalysisHadEt()
95 Int_t AliAnalysisHadEt::AnalyseEvent(AliVEvent *event)
96 { //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.
97 cout<<"This event has "<<event->GetNumberOfTracks()<<" tracks"<<endl;
99 AliMCEvent *mcEvent = dynamic_cast<AliMCEvent*>(event);
101 // Let's play with the stack!
102 AliStack *stack = mcEvent->Stack();
104 Int_t nPrim = stack->GetNtrack();
106 for (Int_t iPart = 0; iPart < nPrim; iPart++)
109 TParticle *part = stack->Particle(iPart);
113 Printf("ERROR: Could not get particle %d", iPart);
120 void AliAnalysisHadEt::FillOutputList()
121 {//fill the output histogram list with histograms in all AliAnalysisHadEt's
124 void AliAnalysisHadEt::Init()
125 {//Initiate member vaiables to reasonable values
126 if (!fCuts) fCuts = new AliAnalysisEtCuts();
128 if(!fPdgDB) fPdgDB = new TDatabasePDG();
132 void AliAnalysisHadEt::CreateHistograms()
133 {//creates histograms included in all AliAnalysisHadEt's
136 void AliAnalysisHadEt::FillHistograms()
137 {//Fills histograms filled for all AliAnalysisHadEt's
140 void AliAnalysisHadEt::ResetEventValues()
141 {//Resets event values of et to zero
145 fTotNeutralEtAcc = 0;
147 fTotChargedEtAcc = 0;
149 fChargedMultiplicity = 0;
150 fNeutralMultiplicity = 0;
153 void AliAnalysisHadEt::SetParticleCodes()
154 { //the codes are defined in $ROOTSYS/etc/pdg_table.txt
155 fPionMass = fPdgDB->GetParticle("pi+")->Mass();
156 fPiPlusCode = fPdgDB->GetParticle("pi+")->PdgCode();
157 fPiMinusCode = fPdgDB->GetParticle("pi-")->PdgCode();
158 fKPlusCode = fPdgDB->GetParticle("K+")->PdgCode();
159 fKMinusCode = fPdgDB->GetParticle("K-")->PdgCode();
160 fProtonCode = fPdgDB->GetParticle("proton")->PdgCode();
161 fAntiProtonCode = fPdgDB->GetParticle("antiproton")->PdgCode();
162 fLambdaCode = fPdgDB->GetParticle("Lambda0")->PdgCode();
163 fAntiLambdaCode = fPdgDB->GetParticle("Lambda0_bar")->PdgCode();
164 fK0SCode = fPdgDB->GetParticle("K_S0")->PdgCode();
165 fOmegaCode = fPdgDB->GetParticle("Omega-")->PdgCode();
166 fAntiOmegaCode = fPdgDB->GetParticle("Omega+")->PdgCode();
167 fXi0Code = fPdgDB->GetParticle("Xi0")->PdgCode();
168 fAntiXi0Code = fPdgDB->GetParticle("Xi0_bar")->PdgCode();
169 fXiCode = fPdgDB->GetParticle("Xi-")->PdgCode();
170 fAntiXiCode = fPdgDB->GetParticle("Xi-_bar")->PdgCode();
171 fSigmaCode = fPdgDB->GetParticle("Sigma-")->PdgCode();
172 fAntiSigmaCode = fPdgDB->GetParticle("Sigma+")->PdgCode();
173 fK0LCode = fPdgDB->GetParticle("K_L0")->PdgCode();
174 fNeutronCode = fPdgDB->GetParticle("neutron")->PdgCode();
175 fAntiNeutronCode = fPdgDB->GetParticle("antineutron")->PdgCode();
176 fEPlusCode = fPdgDB->GetParticle("e+")->PdgCode();
177 fEMinusCode = fPdgDB->GetParticle("e-")->PdgCode();
180 void AliAnalysisHadEt::CreateEtaPtHisto2D(TString name, TString title)
181 { //creates a 2-d histogram in eta and phi and adds it to the list of histograms to be saved
182 TString *histoname = new TString();
183 TString *histotitle = new TString();
185 histoname->Append(name);
186 histotitle->Append(title);
187 //TH2F *h1 = new TH2F("h1", "Histogram with Gaussian random distribution", fgNumOfPtBins, ptBinsArray, fgnumOfEtaBins, etaBinsArray);
189 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),fgNumOfPtBins, fgPtAxis, fgnumOfEtaBins, fgEtaAxis);
190 histo->SetYTitle("#eta");
191 histo->SetXTitle("p_{T}");
192 histo->SetZTitle("E_{T}");
194 fhistoList->Add(histo);
200 void AliAnalysisHadEt::CreateHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Float_t xlow,Float_t xhigh)
201 { //creates a 1d histogram of the given dimensions and adds it to the list of histograms to be saved
202 TString *histoname = new TString();
203 TString *histotitle = new TString();
205 //cout<<"creating "<<name<<endl;
207 histoname->Append(name);
208 histotitle->Append(title);
209 // printf("%s \n ",histoname->Data());
210 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
211 histo->SetYTitle(ytitle);
212 histo->SetXTitle(xtitle);
214 fhistoList->Add(histo);
219 void AliAnalysisHadEt::CreateIntHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Int_t xlow,Int_t xhigh)
220 { //creates a 1d integer histogram and adds it to the list of histograms to be saved
221 TString *histoname = new TString();
222 TString *histotitle = new TString();
224 //cout<<"creating "<<name<<endl;
226 histoname->Append(name);
227 histotitle->Append(title);
228 // printf("%s \n ",histoname->Data());
229 TH1I *histo = new TH1I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
230 histo->SetYTitle(ytitle);
231 histo->SetXTitle(xtitle);
233 fhistoList->Add(histo);
238 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)
239 { //creates a 2d histogram and adds it to the list of histograms to be saved
240 TString *histoname = new TString();
241 TString *histotitle = new TString();
243 //cout<<"creating "<<name<<endl;
245 histoname->Append(name);
246 histotitle->Append(title);
247 // printf("%s \n ",histoname->Data());
248 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
249 histo->SetYTitle(ytitle);
250 histo->SetXTitle(xtitle);
252 fhistoList->Add(histo);
257 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)
258 { //creates a 2-d integer histogram and adds it to the list of histograms to be saved
259 TString *histoname = new TString();
260 TString *histotitle = new TString();
262 //cout<<"creating "<<name<<endl;
264 histoname->Append(name);
265 histotitle->Append(title);
266 // printf("%s \n ",histoname->Data());
267 TH2I *histo = new TH2I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
268 histo->SetYTitle(ytitle);
269 histo->SetXTitle(xtitle);
271 fhistoList->Add(histo);
277 void AliAnalysisHadEt::CreateEtaHisto1D(TString name, TString title)
278 { //creates 1d histogram in eta and adds it to the list of histograms to be saved
279 TString *histoname = new TString();
280 TString *histotitle = new TString();
283 histoname->Append(name);
284 histotitle->Append(title);
285 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),fgnumOfEtaBins, fgEtaAxis);
286 histo->SetYTitle("E_{T}");
287 histo->SetXTitle("#eta");
289 fhistoList->Add(histo);
294 void AliAnalysisHadEt::FillHisto1D(TString histname, Float_t x, Float_t weight)
295 {//fills a 1d histogram with the name histoname with the value x and the weight "weight"
297 TString *name = new TString();
299 name->Append(histname);
300 histo = (TH1F *)fhistoList->FindObject(name->Data());
302 histo->Fill((Double_t)x, weight);
304 else{cerr<<"CorrelationMaker::FillHisto1D: no histogram "<< name->Data()<<endl;}
307 void AliAnalysisHadEt::FillHisto2D(TString histname, Float_t x, Float_t y, Float_t weight)
308 {//fills a 2d histogram with the name histoname with the value x and the weight "weight"
310 TString *name = new TString();
312 name->Append(histname);
313 histo = (TH2F *)fhistoList->FindObject(name->Data());
315 histo->Fill((Double_t)x,(Double_t)y, weight);
317 else{cerr<<"CorrelationMaker::FillHisto2D: no histogram "<< name->Data()<<endl;}
322 Float_t AliAnalysisHadEt::Et(TParticle *part, float mass){//function to calculate et in the same way as it would be calculated in a calorimeter
323 if(mass+1000<0.01){//if no mass given return default. The default argument is -1000
324 if(TMath::Abs(part->GetPDG(0)->PdgCode())==2212 || TMath::Abs(part->GetPDG(0)->PdgCode())==2112){
325 if(part->GetPDG(0)->PdgCode()==-2212 || part->GetPDG(0)->PdgCode()==-2112){//antiproton or antineutron
326 //for antinucleons we specifically want to return the kinetic energy plus twice the rest mass
327 return (part->Energy()+part->GetMass())*TMath::Sin(part->Theta());
329 if(part->GetPDG(0)->PdgCode()==2212 || part->GetPDG(0)->PdgCode()==2112){//antiproton or antineutron
330 //for nucleons we specifically want to return the kinetic energy only
331 return (part->Energy()-part->GetMass())*TMath::Sin(part->Theta());
334 else{//otherwise go to the default
335 return part->Energy()*TMath::Sin(part->Theta());
338 else{//otherwise use the mass that was given
339 return (TMath::Sqrt(TMath::Power(part->P(),2.0)+TMath::Power(mass,2.0)))*TMath::Sin(part->Theta());