1 //Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2 //University of Tennessee at Knoxville
3 //This class is designed for the analysis of the hadronic component of transverse energy. It is used by AliAnalysisTaskHadEt.
4 //This gets information about the hadronic component of the transverse energy from tracks reconstructed in an event
5 //it has daughters, AliAnalysisHadEtMonteCarlo and AliAnalysisHadEtReconstructed, which loop over either Monte Carlo data or real data to get Et
6 #include "AliAnalysisHadEt.h"
12 #include "AliAnalysisEtCuts.h"
13 #include "AliMCEvent.h"
14 #include "AliVEvent.h"
16 #include "AliESDtrackCuts.h"
17 #include "TDatabasePDG.h"
18 #include "TParticle.h"
23 ClassImp(AliAnalysisHadEt);
26 Int_t AliAnalysisHadEt::fgnumOfEtaBins = 46;
27 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};
28 Int_t AliAnalysisHadEt::fgNumOfPtBins = 111;
29 Float_t AliAnalysisHadEt::fgPtAxis[117]=
30 {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,
31 0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48,
32 0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78,
33 .80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2,
34 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,
35 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,
36 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,
37 20.0,25.0,30.0,35.0,40.0, 45.0, 50.0};
39 AliAnalysisHadEt::AliAnalysisHadEt() :
40 fHistogramNameSuffix("")
74 ,fChargedMultiplicity(0)
75 ,fNeutralMultiplicity(0)
76 ,fEtaCut(EtCommonCuts::kEtaCut)
79 //,fPhiCutAccMax(360.)
85 //,fSingleCellEnergyCut(0)
86 //,fClusterEnergyCut(EtCommonCuts::kClusterEnergyCut)
87 //,fTrackPtCut(EtCommonCuts::kTrackPtCut)
88 ,ffesdtrackCutsITSTPC(0)
92 {//default constructor
96 AliAnalysisHadEt::~AliAnalysisHadEt()
101 Int_t AliAnalysisHadEt::AnalyseEvent(AliVEvent *event)
102 { //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.
103 cout<<"This event has "<<event->GetNumberOfTracks()<<" tracks"<<endl;
105 AliMCEvent *mcEvent = dynamic_cast<AliMCEvent*>(event);
107 // Let's play with the stack!
108 AliStack *stack = mcEvent->Stack();
110 Int_t nPrim = stack->GetNtrack();
112 for (Int_t iPart = 0; iPart < nPrim; iPart++)
115 TParticle *part = stack->Particle(iPart);
119 Printf("ERROR: Could not get particle %d", iPart);
126 void AliAnalysisHadEt::FillOutputList()
127 {//fill the output histogram list with histograms in all AliAnalysisHadEt's
130 void AliAnalysisHadEt::Init()
131 {//Initiate member vaiables to reasonable values
132 if(!fPdgDB) fPdgDB = new TDatabasePDG();
133 //the codes are defined in $ROOTSYS/etc/pdg_table.txt
134 fPionMass = fPdgDB->GetParticle("pi+")->Mass();
135 fPiPlusCode = fPdgDB->GetParticle("pi+")->PdgCode();
136 fPiMinusCode = fPdgDB->GetParticle("pi-")->PdgCode();
137 fKPlusCode = fPdgDB->GetParticle("K+")->PdgCode();
138 fKMinusCode = fPdgDB->GetParticle("K-")->PdgCode();
139 fProtonCode = fPdgDB->GetParticle("proton")->PdgCode();
140 fAntiProtonCode = fPdgDB->GetParticle("antiproton")->PdgCode();
141 fLambdaCode = fPdgDB->GetParticle("Lambda0")->PdgCode();
142 fAntiLambdaCode = fPdgDB->GetParticle("Lambda0_bar")->PdgCode();
143 fK0SCode = fPdgDB->GetParticle("K_S0")->PdgCode();
144 fOmegaCode = fPdgDB->GetParticle("Omega-")->PdgCode();
145 fAntiOmegaCode = fPdgDB->GetParticle("Omega+")->PdgCode();
146 fXi0Code = fPdgDB->GetParticle("Xi0")->PdgCode();
147 fAntiXi0Code = fPdgDB->GetParticle("Xi0_bar")->PdgCode();
148 fXiCode = fPdgDB->GetParticle("Xi-")->PdgCode();
149 fAntiXiCode = fPdgDB->GetParticle("Xi-_bar")->PdgCode();
150 fSigmaCode = fPdgDB->GetParticle("Sigma-")->PdgCode();
151 fAntiSigmaCode = fPdgDB->GetParticle("Sigma+")->PdgCode();
152 fK0LCode = fPdgDB->GetParticle("K_L0")->PdgCode();
153 fNeutronCode = fPdgDB->GetParticle("neutron")->PdgCode();
154 fAntiNeutronCode = fPdgDB->GetParticle("antineutron")->PdgCode();
155 fEPlusCode = fPdgDB->GetParticle("e+")->PdgCode();
156 fEMinusCode = fPdgDB->GetParticle("e-")->PdgCode();
159 void AliAnalysisHadEt::CreateHistograms()
160 {//creates histograms included in all AliAnalysisHadEt's
163 void AliAnalysisHadEt::FillHistograms()
164 {//Fills histograms filled for all AliAnalysisHadEt's
167 void AliAnalysisHadEt::ResetEventValues()
168 {//Resets event values of et to zero
172 fTotNeutralEtAcc = 0;
174 fTotChargedEtAcc = 0;
176 fChargedMultiplicity = 0;
177 fNeutralMultiplicity = 0;
179 void AliAnalysisHadEt::CreateEtaPtHisto2D(TString name, TString title)
180 { //creates a 2-d histogram in eta and phi and adds it to the list of histograms to be saved
181 TString *histoname = new TString();
182 TString *histotitle = new TString();
184 histoname->Append(name);
185 histotitle->Append(title);
186 //TH2F *h1 = new TH2F("h1", "Histogram with Gaussian random distribution", fgNumOfPtBins, ptBinsArray, fgnumOfEtaBins, etaBinsArray);
188 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),fgNumOfPtBins, fgPtAxis, fgnumOfEtaBins, fgEtaAxis);
189 histo->SetYTitle("#eta");
190 histo->SetXTitle("p_{T}");
191 histo->SetZTitle("E_{T}");
193 fhistoList->Add(histo);
199 void AliAnalysisHadEt::CreateHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Float_t xlow,Float_t xhigh)
200 { //creates a 1d histogram of the given dimensions and adds it to the list of histograms to be saved
201 TString *histoname = new TString();
202 TString *histotitle = new TString();
204 //cout<<"creating "<<name<<endl;
206 histoname->Append(name);
207 histotitle->Append(title);
208 // printf("%s \n ",histoname->Data());
209 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
210 histo->SetYTitle(ytitle);
211 histo->SetXTitle(xtitle);
213 fhistoList->Add(histo);
218 void AliAnalysisHadEt::CreateIntHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Int_t xlow,Int_t xhigh)
219 { //creates a 1d integer histogram and adds it to the list of histograms to be saved
220 TString *histoname = new TString();
221 TString *histotitle = new TString();
223 //cout<<"creating "<<name<<endl;
225 histoname->Append(name);
226 histotitle->Append(title);
227 // printf("%s \n ",histoname->Data());
228 TH1I *histo = new TH1I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
229 histo->SetYTitle(ytitle);
230 histo->SetXTitle(xtitle);
232 fhistoList->Add(histo);
237 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)
238 { //creates a 2d histogram and adds it to the list of histograms to be saved
239 TString *histoname = new TString();
240 TString *histotitle = new TString();
242 //cout<<"creating "<<name<<endl;
244 histoname->Append(name);
245 histotitle->Append(title);
246 // printf("%s \n ",histoname->Data());
247 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
248 histo->SetYTitle(ytitle);
249 histo->SetXTitle(xtitle);
251 fhistoList->Add(histo);
256 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)
257 { //creates a 2-d integer histogram and adds it to the list of histograms to be saved
258 TString *histoname = new TString();
259 TString *histotitle = new TString();
261 //cout<<"creating "<<name<<endl;
263 histoname->Append(name);
264 histotitle->Append(title);
265 // printf("%s \n ",histoname->Data());
266 TH2I *histo = new TH2I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
267 histo->SetYTitle(ytitle);
268 histo->SetXTitle(xtitle);
270 fhistoList->Add(histo);
276 void AliAnalysisHadEt::CreateEtaHisto1D(TString name, TString title)
277 { //creates 1d histogram in eta and adds it to the list of histograms to be saved
278 TString *histoname = new TString();
279 TString *histotitle = new TString();
282 histoname->Append(name);
283 histotitle->Append(title);
284 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),fgnumOfEtaBins, fgEtaAxis);
285 histo->SetYTitle("E_{T}");
286 histo->SetXTitle("#eta");
288 fhistoList->Add(histo);
293 void AliAnalysisHadEt::FillHisto1D(TString histname, Float_t x, Float_t weight)
294 {//fills a 1d histogram with the name histoname with the value x and the weight "weight"
296 TString *name = new TString();
298 name->Append(histname);
299 histo = (TH1F *)fhistoList->FindObject(name->Data());
301 histo->Fill((Double_t)x, weight);
303 else{cerr<<"CorrelationMaker::FillHisto1D: no histogram "<< name->Data()<<endl;}
306 void AliAnalysisHadEt::FillHisto2D(TString histname, Float_t x, Float_t y, Float_t weight)
307 {//fills a 2d histogram with the name histoname with the value x and the weight "weight"
309 TString *name = new TString();
311 name->Append(histname);
312 histo = (TH2F *)fhistoList->FindObject(name->Data());
314 histo->Fill((Double_t)x,(Double_t)y, weight);
316 else{cerr<<"CorrelationMaker::FillHisto2D: no histogram "<< name->Data()<<endl;}
321 Float_t AliAnalysisHadEt::Et(TParticle *part, float mass){//function to calculate et in the same way as it would be calculated in a calorimeter
322 if(mass+1000<0.01){//if no mass given return default. The default argument is -1000
323 if(TMath::Abs(part->GetPDG(0)->PdgCode())==2212 || TMath::Abs(part->GetPDG(0)->PdgCode())==2112){
324 if(part->GetPDG(0)->PdgCode()==-2212 || part->GetPDG(0)->PdgCode()==-2112){//antiproton or antineutron
325 //for antinucleons we specifically want to return the kinetic energy plus twice the rest mass
326 return (part->Energy()+part->GetMass())*TMath::Sin(part->Theta());
328 if(part->GetPDG(0)->PdgCode()==2212 || part->GetPDG(0)->PdgCode()==2112){//antiproton or antineutron
329 //for nucleons we specifically want to return the kinetic energy only
330 return (part->Energy()-part->GetMass())*TMath::Sin(part->Theta());
333 else{//otherwise go to the default
334 return part->Energy()*TMath::Sin(part->Theta());
337 else{//otherwise use the mass that was given
338 return (TMath::Sqrt(TMath::Power(part->P(),2.0)+TMath::Power(mass,2.0)))*TMath::Sin(part->Theta());