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"
29 ClassImp(AliAnalysisHadEt);
32 Int_t AliAnalysisHadEt::fgnumOfEtaBins = 46;
33 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};
34 Int_t AliAnalysisHadEt::fgNumOfPtBins = 111;
35 Float_t AliAnalysisHadEt::fgPtAxis[117]=
36 {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,
37 0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48,
38 0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78,
39 .80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2,
40 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,
41 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,
42 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,
43 20.0,25.0,30.0,35.0,40.0, 45.0, 50.0};
45 AliAnalysisHadEt::AliAnalysisHadEt() :
46 fHistogramNameSuffix("")
88 ,fChargedMultiplicity(0)
89 ,fNeutralMultiplicity(0)
90 ,fEsdtrackCutsITSTPC(0)
94 {//default constructor
98 AliAnalysisHadEt::~AliAnalysisHadEt()
103 Int_t AliAnalysisHadEt::AnalyseEvent(AliVEvent *event)
104 { //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.
105 cout << "This event has " << event->GetNumberOfTracks() << " tracks" << endl;
110 void AliAnalysisHadEt::FillOutputList()
111 {//fill the output histogram list with histograms in all AliAnalysisHadEt's
114 void AliAnalysisHadEt::Init()
115 {// clear variables, set up cuts and PDG info
120 void AliAnalysisHadEt::CreateHistograms()
121 {//creates histograms included in all AliAnalysisHadEt's
124 void AliAnalysisHadEt::FillHistograms()
125 {//Fills histograms filled for all AliAnalysisHadEt's
128 void AliAnalysisHadEt::ResetEventValues()
129 {//Resets event values of et to zero
133 fTotNeutralEtAcc = 0;
135 fTotChargedEtAcc = 0;
137 fChargedMultiplicity = 0;
138 fNeutralMultiplicity = 0;
140 if (!fCuts || !fPdgDB || fPiPlusCode==0) { // some Init's needed
141 cout << __FILE__ << ":" << __LINE__ << " : Init " << endl;
143 cout << " setting up Cuts " << endl;
144 fCuts = new AliAnalysisEtCuts();
147 cout << " setting up PdgDB " << endl;
148 fPdgDB = new TDatabasePDG();
151 if (fPiPlusCode==0) {
157 void AliAnalysisHadEt::SetParticleCodes()
158 { //the codes are defined in $ROOTSYS/etc/pdg_table.txt
159 fPionMass = fPdgDB->GetParticle("pi+")->Mass();
160 fKaonMass = fPdgDB->GetParticle("K+")->Mass();
161 fProtonMass = fPdgDB->GetParticle("proton")->Mass();
162 fElectronMass = fPdgDB->GetParticle("e+")->Mass();
163 fPiPlusCode = fPdgDB->GetParticle("pi+")->PdgCode();
164 fPiMinusCode = fPdgDB->GetParticle("pi-")->PdgCode();
165 fKPlusCode = fPdgDB->GetParticle("K+")->PdgCode();
166 fKMinusCode = fPdgDB->GetParticle("K-")->PdgCode();
167 fProtonCode = fPdgDB->GetParticle("proton")->PdgCode();
168 fAntiProtonCode = fPdgDB->GetParticle("antiproton")->PdgCode();
169 fLambdaCode = fPdgDB->GetParticle("Lambda0")->PdgCode();
170 fAntiLambdaCode = fPdgDB->GetParticle("Lambda0_bar")->PdgCode();
171 fK0SCode = fPdgDB->GetParticle("K_S0")->PdgCode();
172 fOmegaCode = fPdgDB->GetParticle("Omega-")->PdgCode();
173 fAntiOmegaCode = fPdgDB->GetParticle("Omega+")->PdgCode();
174 fXi0Code = fPdgDB->GetParticle("Xi0")->PdgCode();
175 fAntiXi0Code = fPdgDB->GetParticle("Xi0_bar")->PdgCode();
176 fXiCode = fPdgDB->GetParticle("Xi-")->PdgCode();
177 fAntiXiCode = fPdgDB->GetParticle("Xi-_bar")->PdgCode();
178 fSigmaCode = fPdgDB->GetParticle("Sigma-")->PdgCode();
179 fAntiSigmaCode = fPdgDB->GetParticle("Sigma+")->PdgCode();
180 fK0LCode = fPdgDB->GetParticle("K_L0")->PdgCode();
181 fNeutronCode = fPdgDB->GetParticle("neutron")->PdgCode();
182 fAntiNeutronCode = fPdgDB->GetParticle("antineutron")->PdgCode();
183 fEPlusCode = fPdgDB->GetParticle("e+")->PdgCode();
184 fEMinusCode = fPdgDB->GetParticle("e-")->PdgCode();
185 fGammaCode = fPdgDB->GetParticle("gamma")->PdgCode();
186 fPi0Code = fPdgDB->GetParticle("pi0")->PdgCode();
187 fEtaCode = fPdgDB->GetParticle("eta")->PdgCode();
188 fOmega0Code = fPdgDB->GetParticle("omega")->PdgCode();
189 cout << "Resetting Codes: Pion " << fPiPlusCode
190 << "," << fPiMinusCode
191 << " Kaon " << fKPlusCode
192 << "," << fKMinusCode
193 << " Gamma "<<fGammaCode
196 << " omega "<<fOmega0Code
200 void AliAnalysisHadEt::CreateEtaPtHisto2D(TString name, TString title)
201 { //creates a 2-d histogram in eta and phi and adds it to the list of histograms to be saved
202 TString *histoname = new TString();
203 TString *histotitle = new TString();
205 histoname->Append(name);
206 histotitle->Append(title);
207 //TH2F *h1 = new TH2F("h1", "Histogram with Gaussian random distribution", fgNumOfPtBins, ptBinsArray, fgnumOfEtaBins, etaBinsArray);
209 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),fgNumOfPtBins, fgPtAxis, fgnumOfEtaBins, fgEtaAxis);
210 histo->SetYTitle("#eta");
211 histo->SetXTitle("p_{T}");
212 histo->SetZTitle("E_{T}");
214 fhistoList->Add(histo);
220 void AliAnalysisHadEt::CreateHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Float_t xlow,Float_t xhigh)
221 { //creates a 1d histogram of the given dimensions and adds it to the list of histograms to be saved
222 TString *histoname = new TString();
223 TString *histotitle = new TString();
225 //cout<<"creating "<<name<<endl;
227 histoname->Append(name);
228 histotitle->Append(title);
229 // printf("%s \n ",histoname->Data());
230 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
231 histo->SetYTitle(ytitle);
232 histo->SetXTitle(xtitle);
234 fhistoList->Add(histo);
239 void AliAnalysisHadEt::CreateIntHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Int_t xlow,Int_t xhigh)
240 { //creates a 1d integer histogram and adds it to the list of histograms to be saved
241 TString *histoname = new TString();
242 TString *histotitle = new TString();
244 //cout<<"creating "<<name<<endl;
246 histoname->Append(name);
247 histotitle->Append(title);
248 // printf("%s \n ",histoname->Data());
249 TH1I *histo = new TH1I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
250 histo->SetYTitle(ytitle);
251 histo->SetXTitle(xtitle);
253 fhistoList->Add(histo);
258 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)
259 { //creates a 2d histogram and adds it to the list of histograms to be saved
260 TString *histoname = new TString();
261 TString *histotitle = new TString();
263 //cout<<"creating "<<name<<endl;
265 histoname->Append(name);
266 histotitle->Append(title);
267 // printf("%s \n ",histoname->Data());
268 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
269 histo->SetYTitle(ytitle);
270 histo->SetXTitle(xtitle);
272 fhistoList->Add(histo);
277 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)
278 { //creates a 2-d integer histogram and adds it to the list of histograms to be saved
279 TString *histoname = new TString();
280 TString *histotitle = new TString();
282 //cout<<"creating "<<name<<endl;
284 histoname->Append(name);
285 histotitle->Append(title);
286 // printf("%s \n ",histoname->Data());
287 TH2I *histo = new TH2I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
288 histo->SetYTitle(ytitle);
289 histo->SetXTitle(xtitle);
291 fhistoList->Add(histo);
297 void AliAnalysisHadEt::CreateEtaHisto1D(TString name, TString title)
298 { //creates 1d histogram in eta and adds it to the list of histograms to be saved
299 TString *histoname = new TString();
300 TString *histotitle = new TString();
303 histoname->Append(name);
304 histotitle->Append(title);
305 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),fgnumOfEtaBins, fgEtaAxis);
306 histo->SetYTitle("E_{T}");
307 histo->SetXTitle("#eta");
309 fhistoList->Add(histo);
314 void AliAnalysisHadEt::FillHisto1D(TString histname, Float_t x, Float_t weight)
315 {//fills a 1d histogram with the name histoname with the value x and the weight "weight"
317 TString *name = new TString();
319 name->Append(histname);
320 histo = (TH1F *)fhistoList->FindObject(name->Data());
322 histo->Fill((Double_t)x, weight);
324 else{cerr<<"CorrelationMaker::FillHisto1D: no histogram "<< name->Data()<<endl;}
327 void AliAnalysisHadEt::FillHisto2D(TString histname, Float_t x, Float_t y, Float_t weight)
328 {//fills a 2d histogram with the name histoname with the value x and the weight "weight"
330 TString *name = new TString();
332 name->Append(histname);
333 histo = (TH2F *)fhistoList->FindObject(name->Data());
335 histo->Fill((Double_t)x,(Double_t)y, weight);
337 else{cerr<<"CorrelationMaker::FillHisto2D: no histogram "<< name->Data()<<endl;}
342 Float_t AliAnalysisHadEt::Et(TParticle *part, float mass){//function to calculate et in the same way as it would be calculated in a calorimeter
343 if(mass+1000<0.01){//if no mass given return default. The default argument is -1000
344 if(TMath::Abs(part->GetPDG(0)->PdgCode())==2212 || TMath::Abs(part->GetPDG(0)->PdgCode())==2112){
345 if(part->GetPDG(0)->PdgCode()==-2212 || part->GetPDG(0)->PdgCode()==-2112){//antiproton or antineutron
346 //for antinucleons we specifically want to return the kinetic energy plus twice the rest mass
347 return (part->Energy()+part->GetMass())*TMath::Sin(part->Theta());
349 if(part->GetPDG(0)->PdgCode()==2212 || part->GetPDG(0)->PdgCode()==2112){//antiproton or antineutron
350 //for nucleons we specifically want to return the kinetic energy only
351 return (part->Energy()-part->GetMass())*TMath::Sin(part->Theta());
354 else{//otherwise go to the default
355 return part->Energy()*TMath::Sin(part->Theta());
358 else{//otherwise use the mass that was given
359 return (TMath::Sqrt(TMath::Power(part->P(),2.0)+TMath::Power(mass,2.0)))*TMath::Sin(part->Theta());
363 Float_t AliAnalysisHadEt::Et(Float_t p, Float_t theta, Int_t pid, Short_t charge){//function to calculate et in the same way as it would be calculated in a calorimeter
364 if(pid==fPiPlusCode || pid==fPiMinusCode){//Nothing special for pions
365 return TMath::Sqrt(p*p + fPionMass*fPionMass) * TMath::Sin(theta);
367 if(pid==fKPlusCode || pid==fKMinusCode){//Nothing special for kaons
368 return TMath::Sqrt(p*p + fKaonMass*fKaonMass) * TMath::Sin(theta);
370 if(pid==fEPlusCode || pid==fEMinusCode){//Nothing special for electrons
371 return TMath::Sqrt(p*p + fElectronMass*fElectronMass) * TMath::Sin(theta);
373 if(pid==fProtonCode || pid==fAntiProtonCode){//But for protons we must be careful...
374 if(charge<0.0){//antiprotns: kinetic energy plus twice the rest mass
375 return (TMath::Sqrt(p*p + fProtonMass*fProtonMass) + fProtonMass) * TMath::Sin(theta);
377 if(charge>0.0){//antiprotns: kinetic energy only
378 return (TMath::Sqrt(p*p + fProtonMass*fProtonMass) - fProtonMass) * TMath::Sin(theta);
381 cerr<<"Uh-oh! Et not set properly!"<<endl;