1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // An analysis task to check the HMPID data in simulated data
21 //*-- Annalisa Mastroserio
22 //////////////////////////////////////////////////////////////////////////////
35 #include "AliHMPIDQATask.h"
40 //______________________________________________________________________________
41 AliHMPIDQATask::AliHMPIDQATask(const char *name) :
42 AliAnalysisTask(name,""),
52 // Input slot #0 works with an Ntuple
53 DefineInput(0, TChain::Class());
54 // Output slot #0 writes into a TH1 container
55 DefineOutput(0, TObjArray::Class()) ;
58 for(i = 0 ; i < 5 ; i++)
62 //______________________________________________________________________________
63 AliHMPIDQATask::~AliHMPIDQATask()
66 fOutputContainer->Clear() ;
67 delete fOutputContainer ;
73 delete [] fhHMPIDProb ;
76 //______________________________________________________________________________
77 void AliHMPIDQATask::ConnectInputData(const Option_t*)
79 // Initialisation of branch container and histograms
81 AliInfo(Form("*** Initialization of %s", GetName())) ;
84 fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
86 AliError(Form("Input 0 for %s not found\n", GetName()));
90 // One should first check if the branch address was taken by some other task
91 char ** address = (char **)GetBranchAddress(0, "ESD");
93 fESD = (AliESD*)(*address);
96 SetBranchAddress(0, "ESD", &fESD);
100 //________________________________________________________________________
101 void AliHMPIDQATask::CreateOutputObjects()
107 fhHMPIDCkovP = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]", 150, 0, 7 ,100, -3, 1);
108 fhHMPIDSigP = new TH2F("SigP" ,"#sigma_{#theta_c}" , 150, 0, 7 ,100, 0, 1e20);
109 fhHMPIDMipXY = new TH2F("MipXY" ,"mip position" , 260, 0,130 ,252,0,126);
110 fhHMPIDDifXY = new TH2F("DifXY" ,"diff" , 260, -10, 10 ,252,-10,10);
112 fhHMPIDProb[0] = new TH1F("PidE" ,"PID: e yellow #mu magenta" ,100,0,1);
113 fhHMPIDProb[0]->SetLineColor(kYellow);
114 fhHMPIDProb[1] = new TH1F("PidMu","pid of #mu" ,100,0,1);
115 fhHMPIDProb[1]->SetLineColor(kMagenta);
116 fhHMPIDProb[2] = new TH1F("PidPi","PID: #pi red K green p blue",100,0,1);
117 fhHMPIDProb[2]->SetLineColor(kRed);
118 fhHMPIDProb[3] = new TH1F("PidK" ,"pid of K" ,100,0,1);
119 fhHMPIDProb[3]->SetLineColor(kGreen);
120 fhHMPIDProb[4] = new TH1F("PidP" ,"pid of p" ,100,0,1);
121 fhHMPIDProb[4]->SetLineColor(kBlue);
125 // create output container
127 fOutputContainer = new TObjArray(9) ;
128 fOutputContainer->SetName(GetName()) ;
130 fOutputContainer->AddAt(fhHMPIDCkovP, 0) ;
131 fOutputContainer->AddAt(fhHMPIDSigP, 1) ;
132 fOutputContainer->AddAt(fhHMPIDMipXY, 2) ;
133 fOutputContainer->AddAt(fhHMPIDDifXY, 3) ;
134 fOutputContainer->AddAt(fhHMPIDProb[0], 4) ;
135 fOutputContainer->AddAt(fhHMPIDProb[1], 5) ;
136 fOutputContainer->AddAt(fhHMPIDProb[2], 6) ;
137 fOutputContainer->AddAt(fhHMPIDProb[3], 7) ;
138 fOutputContainer->AddAt(fhHMPIDProb[4], 8) ;
141 //______________________________________________________________________________
142 void AliHMPIDQATask::Exec(Option_t *)
144 // Processing of one event
146 Long64_t entry = fChain->GetReadEntry() ;
149 AliError("fESD is not connected to the input!") ;
153 if ( !((entry-1)%100) )
154 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
156 // ************************ HMPID *************************************
158 for(iTrk = 0 ; iTrk < fESD->GetNumberOfTracks() ; iTrk++){
159 AliESDtrack *pTrk = fESD->GetTrack(iTrk) ;
161 fhHMPIDCkovP->Fill( pTrk->GetP(), pTrk->GetHMPIDsignal() ) ;
162 fhHMPIDSigP ->Fill( pTrk->GetP(), TMath::Sqrt(pTrk->GetHMPIDchi2()) ) ;
164 // Float_t xm,ym; Int_t q,np; pTrk->GetHMPIDmip(xm,ym,q,np); fMipXY->Fill(xm,ym); //mip info
165 // Float_t xd,yd,th,ph; pTrk->GetHMPIDtrk(xd,yd,th,ph); fDifXY->Fill(xd,yd); //track info
168 pTrk->GetHMPIDpid(pid) ;
170 for(i = 0 ; i < 5 ; i++)
171 fhHMPIDProb[i]->Fill(pid[i]) ;
174 PostData(0, fOutputContainer);
177 //______________________________________________________________________________
178 void AliHMPIDQATask::Terminate(Option_t *)
180 // Processing when the event loop is ended
181 fOutputContainer = (TObjArray*)GetOutputData(0);
182 fhHMPIDCkovP = (TH2F*)fOutputContainer->At(0);
183 fhHMPIDSigP = (TH2F*)fOutputContainer->At(1);
184 fhHMPIDMipXY = (TH2F*)fOutputContainer->At(2);
185 fhHMPIDDifXY = (TH2F*)fOutputContainer->At(3);
186 fhHMPIDProb[0] = (TH1F*)fOutputContainer->At(4);
187 fhHMPIDProb[1] = (TH1F*)fOutputContainer->At(5);
188 fhHMPIDProb[2] = (TH1F*)fOutputContainer->At(6);
189 fhHMPIDProb[3] = (TH1F*)fOutputContainer->At(7);
190 fhHMPIDProb[4] = (TH1F*)fOutputContainer->At(8);
192 Bool_t problem = kFALSE ;
193 AliInfo(Form(" *** %s Report:", GetName())) ;
195 Float_t n = 1.292 ; //mean freon ref idx
196 TF1 * hHMPIDpPi = new TF1("RiPiTheo", "acos(sqrt(x*x+[0]*[0])/(x*[1]))", 1.2, 7) ;
197 hHMPIDpPi->SetLineWidth(1) ;
198 hHMPIDpPi->SetParameter(1,n) ;
201 hHMPIDpPi->SetLineColor(kRed);
202 hHMPIDpPi->SetParameter(0,AliPID::ParticleMass(AliPID::kPion)); //mass
204 TF1 * hHMPIDK = static_cast<TF1*>(hHMPIDpPi->Clone()) ;
205 hHMPIDK ->SetLineColor(kGreen) ;
206 hHMPIDK ->SetParameter(0, AliPID::ParticleMass(AliPID::kKaon)) ;
208 TF1 * hHMPIDP=static_cast<TF1*>(hHMPIDpPi->Clone()) ;
209 hHMPIDP ->SetLineColor(kBlue) ;
210 hHMPIDP ->SetParameter(0,AliPID::ParticleMass(AliPID::kProton)) ;
212 TCanvas * cHMPID = new TCanvas("cHMPID","HMPID ESD Test") ;
213 cHMPID->SetFillColor(10) ;
214 cHMPID->SetHighLightColor(10) ;
215 cHMPID->Divide(3,2) ;
218 fhHMPIDCkovP->Draw() ;
219 hHMPIDpPi->Draw("same") ;
220 hHMPIDK->Draw("same") ;
221 hHMPIDP->Draw("same") ;
224 fhHMPIDMipXY->Draw() ;
227 fhHMPIDProb[0]->Draw() ;
228 fhHMPIDProb[1]->Draw("same") ;
231 fhHMPIDSigP ->Draw() ;
234 fhHMPIDDifXY->Draw() ;
237 fhHMPIDProb[2]->Draw() ;
238 fhHMPIDProb[3]->Draw("same") ;
239 fhHMPIDProb[4]->Draw("same") ;
241 cHMPID->Print("HMPID.eps");
244 sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ;
245 gROOT->ProcessLine(line);
246 sprintf(line, ".!rm -fR *.eps");
247 gROOT->ProcessLine(line);
249 AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ;
253 report="Problems found, please check!!!";
257 AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report.Data())) ;