Comment out copy ctors and assignment opetators from classes source code, not needed.
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDAnalysisTask.cxx
CommitLineData
9a8aafa5 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
dcb23f7e 16//==============================================================================
17// AliHMPIDAnalysysTask - Class representing a basic analysis tool of HMPID data at
18// level of ESD.
19// A set of histograms is created.
20//==============================================================================
21//
22// By means of AliHMPIDAnalysisTask.C macro it is possible to use this class
23// to perform the analysis on local data, on data on alien using local machine
24// and on CAF.
25
9a8aafa5 26#ifndef AliHMPIDAnalysisTASK_CXX
27#define AliHMPIDAnalysisTASK_CXX
28
dcb23f7e 29#include <TH2.h>
30#include <AliLog.h>
9a8aafa5 31#include "AliAnalysisManager.h"
38b8c336 32#include "AliESDInputHandler.h"
9a8aafa5 33#include "AliESDtrack.h"
38b8c336 34#include "AliHMPIDAnalysisTask.h"
9a8aafa5 35
36ClassImp(AliHMPIDAnalysisTask)
37
38//__________________________________________________________________________
39AliHMPIDAnalysisTask::AliHMPIDAnalysisTask() :
38b8c336 40 fESD(0x0),fHmpHistList(0x0),
9a8aafa5 41 fNevts(0),
42 fTrigNevts(0),
38b8c336 43 fTrigger(0),
dcb23f7e 44 fHmpPesdPhmp(0x0),fHmpCkovPesd(0x0),fHmpCkovPhmp(0x0),
38b8c336 45 fHmpMipTrkDist(0x0),fHmpMipTrkDistX(0x0),fHmpMipTrkDistY(0x0),fHmpMipCharge3cm(0x0),fHmpMipCharge1cm(0x0),fHmpNumPhots(0x0),
46 fHmpTrkFlags(0x0)
9a8aafa5 47{
48 //
49 //Default ctor
50 //
38b8c336 51
9a8aafa5 52}
53//___________________________________________________________________________
54AliHMPIDAnalysisTask::AliHMPIDAnalysisTask(const Char_t* name) :
55 AliAnalysisTaskSE(name),
38b8c336 56 fESD(0),fHmpHistList(0x0), fNevts(0),
9a8aafa5 57 fTrigNevts(0),
38b8c336 58 fTrigger(0),
dcb23f7e 59 fHmpPesdPhmp(0x0),fHmpCkovPesd(0x0),fHmpCkovPhmp(0x0),
38b8c336 60 fHmpMipTrkDist(0x0),fHmpMipTrkDistX(0x0),fHmpMipTrkDistY(0x0),fHmpMipCharge3cm(0x0),fHmpMipCharge1cm(0x0),fHmpNumPhots(0x0),
61 fHmpTrkFlags(0x0)
9a8aafa5 62{
63 //
64 // Constructor. Initialization of Inputs and Outputs
65 //
38b8c336 66
67 DefineOutput(0,TList::Class());
68 }
9a8aafa5 69//___________________________________________________________________________
dcb23f7e 70AliHMPIDAnalysisTask& AliHMPIDAnalysisTask::operator=(const AliHMPIDAnalysisTask& c)
71{
72 //
73 // Assignment operator
74 //
75 if (this!=&c) {
76 AliAnalysisTaskSE::operator=(c) ;
77 fESD = c.fESD ;
78 fHmpHistList = c.fHmpHistList ;
79 fNevts = c.fNevts;
80 fTrigNevts = c.fTrigNevts;
81 fTrigger = c.fTrigger;
82 fHmpPesdPhmp = c.fHmpPesdPhmp ;
83 fHmpCkovPesd = c.fHmpCkovPesd ;
84 fHmpCkovPhmp = c.fHmpCkovPhmp ;
85 fHmpMipTrkDist = c.fHmpMipTrkDist;
86 fHmpMipTrkDistX = c.fHmpMipTrkDistX;
87 fHmpMipTrkDistY = c.fHmpMipTrkDistY;
88 fHmpMipCharge3cm = c.fHmpMipCharge3cm;
89 fHmpMipCharge1cm = c.fHmpMipCharge1cm;
90 fHmpNumPhots = c.fHmpNumPhots;
91 fHmpTrkFlags = c.fHmpTrkFlags;
92
93 }
94 return *this;
95}
96
97//___________________________________________________________________________
98AliHMPIDAnalysisTask::AliHMPIDAnalysisTask(const AliHMPIDAnalysisTask& c) :
99 AliAnalysisTaskSE(c),
100 fESD(c.fESD),fHmpHistList(c.fHmpHistList), fNevts(c.fNevts),
101 fTrigNevts(c.fTrigNevts),
102 fTrigger(c.fTrigger),
103 fHmpPesdPhmp(c.fHmpPesdPhmp),fHmpCkovPesd(c.fHmpCkovPesd),fHmpCkovPhmp(c.fHmpCkovPhmp),
104 fHmpMipTrkDist(c.fHmpMipTrkDist),fHmpMipTrkDistX(c.fHmpMipTrkDistX),fHmpMipTrkDistY(c.fHmpMipTrkDistY),fHmpMipCharge3cm(c.fHmpMipCharge3cm),
105 fHmpMipCharge1cm(c.fHmpMipCharge1cm),fHmpNumPhots(c.fHmpNumPhots),
106 fHmpTrkFlags(c.fHmpTrkFlags)
107{
108 //
109 // Copy Constructor
110 //
111}
112
113//___________________________________________________________________________
9a8aafa5 114AliHMPIDAnalysisTask::~AliHMPIDAnalysisTask() {
115 //
116 //destructor
117 //
118 Info("~AliHMPIDAnalysisask","Calling Destructor");
38b8c336 119 if (fHmpHistList) {fHmpHistList->Clear(); delete fHmpHistList;}
9a8aafa5 120}
38b8c336 121//___________________________________________________________________________
122void AliHMPIDAnalysisTask::ConnectInputData(Option_t *)
123{
124 // Connect ESD here
125
126 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
127 if (!esdH) {
128 AliDebug(2,Form("ERROR: Could not get ESDInputHandler"));
129 } else
130 fESD = esdH->GetEvent();
131 }
9a8aafa5 132//_________________________________________________
38b8c336 133void AliHMPIDAnalysisTask::Exec(Option_t *)
9a8aafa5 134{
135 //
136 // Main loop function, executed on Event basis
137 //
9a8aafa5 138 for (Int_t iTrack = 0; iTrack<fESD->GetNumberOfTracks(); iTrack++) {
139
140 AliESDtrack* track = fESD->GetTrack(iTrack);
141 if(!track) continue;
142 Double_t rin[3], rout[3];
143 track->GetInnerXYZ(rin);
144 track->GetOuterXYZ(rout);
38b8c336 145 /*
146 ((TH2F *)fHmpHistList->At(22))->Fill(rin[0],rin[1]);
147 ((TH2F *)fHmpHistList->At(23))->Fill(rout[0],rout[1]);
148*/
dcb23f7e 149 Double_t ktol = 0.001;
150
151 if(Equal(track->GetHMPIDsignal(),-20.,ktol)) fHmpTrkFlags->Fill(0);
152 else if(Equal(track->GetHMPIDsignal(),-9.,ktol)) fHmpTrkFlags->Fill(1);
153 else if(Equal(track->GetHMPIDsignal(),-5.,ktol)) fHmpTrkFlags->Fill(2);
154 else if(Equal(track->GetHMPIDsignal(),-11.,ktol)) fHmpTrkFlags->Fill(3);
155 else if(Equal(track->GetHMPIDsignal(),-22.,ktol)) fHmpTrkFlags->Fill(4);
156 else fHmpTrkFlags->Fill(4);
157
158
159 if(Equal(track->GetHMPIDsignal(),-20.,ktol)) continue;
38b8c336 160 if(track->GetHMPIDcluIdx() < 0) continue;
161
dcb23f7e 162 //Int_t ch = track->GetHMPIDcluIdx()/1000000;
9a8aafa5 163 Float_t x, y; Int_t q, nph;
9a8aafa5 164 Float_t xpc, ypc, th, ph;
38b8c336 165
166 track->GetHMPIDmip(x,y,q,nph);
167 track->GetHMPIDtrk(xpc,ypc,th,ph);
168
dcb23f7e 169 if(Equal(x,0.,ktol) && Equal(y,0.,ktol) && Equal(xpc,0.,ktol) && Equal(ypc,0.,ktol)) continue;
38b8c336 170 //Printf("%s %s Good track is found",(char*)__FILE__,__LINE__);
171
9a8aafa5 172 Double_t dist = TMath::Sqrt( (xpc-x)*(xpc-x) + (ypc - y)*(ypc - y));
38b8c336 173 fHmpMipTrkDist->Fill(dist);
174 fHmpMipTrkDistX->Fill(xpc-x);
175 fHmpMipTrkDistY->Fill(ypc - y);
176 if(dist<=3.0) fHmpMipCharge3cm->Fill(q);
177
178 if(track->GetHMPIDsignal() > 0 )
179 {
180 Printf("EvtNumInFile: %d HMPID ThetaC: %lf x: %lf xpc: %lf y: %lf ypx: %lf Q: %d nPh: %d IncTheta; %lf IncPhi: %lf",fESD->GetEventNumberInFile(),track->GetHMPIDsignal(),x,xpc,y,ypc,q,nph,th,ph);
181 Double_t pHmp[3] = {0},pmod = 0;if(track->GetOuterHmpPxPyPz(pHmp)) pmod = TMath::Sqrt(pHmp[0]*pHmp[0]+pHmp[1]*pHmp[1]+pHmp[2]*pHmp[2]);
182 fHmpPesdPhmp->Fill(track->P(),pmod);
183 if(dist<=1.0) fHmpMipCharge1cm->Fill(q);
184 fHmpNumPhots->Fill(nph);
185 fHmpCkovPesd->Fill(track->P(),track->GetHMPIDsignal());
dcb23f7e 186 fHmpCkovPhmp->Fill(pmod,track->GetHMPIDsignal());
38b8c336 187 }//there is signal
188
9a8aafa5 189 }//track loop
9a8aafa5 190
191 /* PostData(0) is taken care of by AliAnalysisTaskSE */
38b8c336 192 PostData(0,fHmpHistList) ;
9a8aafa5 193}
194
9a8aafa5 195//___________________________________________________________________________
196void AliHMPIDAnalysisTask::Terminate(Option_t*)
197{
198 // The Terminate() function is the last function to be called during
199 // a query. It always runs on the client, it can be used to present
200 // the results graphically or save the results to file.
201
202 Info("Terminate","");
203 AliAnalysisTaskSE::Terminate();
204
205}
206
9a8aafa5 207//___________________________________________________________________________
38b8c336 208void AliHMPIDAnalysisTask::CreateOutputObjects() {
9a8aafa5 209 //
210 //HERE ONE CAN CREATE OUTPUT OBJECTS
211 //TO BE SET BEFORE THE EXECUTION OF THE TASK
212 //
9a8aafa5 213
214 //slot #1
38b8c336 215 OpenFile(0);
216 fHmpHistList = new TList();
38b8c336 217 fHmpPesdPhmp = new TH2F("fHmpPesdPhmp","HMPID: ESD p - running p;HMP p (GeV/c);ESD p (Gev/c)",100,0,10,100,0,10);
218 fHmpHistList->Add(fHmpPesdPhmp);
219
220 fHmpCkovPesd = new TH2F("fHmpCkovPesd","HMPID: ThetaCherenkov vs P;p_esd (GeV/c);#Theta_C;Entries",100,0,10,110,0,1.1);
221 fHmpHistList->Add(fHmpCkovPesd);
222
223 fHmpCkovPhmp = new TH2F("fHmpCkovPhmp","HMPID: ThetaCherenkov vs P;p_hmp (GeV/c);#Theta_C;Entries",100,0,10,110,0,1.1);
224 fHmpHistList->Add(fHmpCkovPhmp);
9a8aafa5 225
38b8c336 226 fHmpMipTrkDist = new TH1F("fHmpMipTrkDist","HMPID MIP-Track distance;distance (cm);Entries",800,-20,20);
227 fHmpHistList->Add(fHmpMipTrkDist);
228 fHmpMipTrkDistX = new TH1F("fHmpMipTrkDistX","HMPID MIP-Track distance in local X;distance (cm);Entries",800,-20,20);
229 fHmpHistList->Add(fHmpMipTrkDistX);
230 fHmpMipTrkDistY = new TH1F("fHmpMipTrkDistY","HMPID MIP-Track distance in local Y;distance (cm);Entries",800,-20,20);
231 fHmpHistList->Add(fHmpMipTrkDistY);
232
233 fHmpMipCharge3cm = new TH1F("fHmpMipCharge3cm","HMPID MIP Charge;MIP Charge (ADC);Entries",5001,-0.5,5000.5);
234 fHmpHistList->Add(fHmpMipCharge3cm);
235
236 fHmpMipCharge1cm = new TH1F("fHmpMipCharge1cm","HMPID MIP Charge;MIP Charge (ADC);Entries",5001,-0.5,5000.5);
237 fHmpHistList->Add(fHmpMipCharge1cm);
238
239 fHmpNumPhots = new TH1F("fHmpNumPhots","HMPID Number of photon clusters on ring;#photon clus.;Entries",51,-0.5,50.5);
240 fHmpHistList->Add(fHmpNumPhots);
241
242 fHmpTrkFlags = new TH1F("fHmpTrkFlags","HMPID track flags",6,0,6);
243 TString summary[6] = {"NotPerformed","MipDistCut", "MipQdcCut", "NoPhotAccept", "kNoRad", "other"};
244 for(Int_t ibin = 0; ibin < 6; ibin++) fHmpTrkFlags->GetXaxis()->SetBinLabel(ibin+1,Form("%i %s",ibin+1,summary[ibin].Data()));
245 fHmpHistList->Add(fHmpTrkFlags);
246 /*
9a8aafa5 247 //0
248 TH1F *trkH = new TH1F("trkH","signal flags in HMPID",6,0,6);
249 TString summary[6] = {"NotPerformed","MipDistCut", "MipQdcCut", "NoPhotAccept", "kNoRad", "other"};
250 for(Int_t ibin = 0; ibin < 6; ibin++) trkH->GetXaxis()->SetBinLabel(ibin+1,Form("%i %s",ibin+1,summary[ibin].Data()));
38b8c336 251 fHmpHistList->Add(trkH);
9a8aafa5 252
253
254 TH2F *mod[7], *dq[7];
255 TH1F *q[7];
256
257 //1-7
258 for(Int_t i=0; i< 7 ; i++) {// to preserve the histo sorting
259 mod[i] = new TH2F(Form("mod%i",i),Form("MIP position in chamber %i",i),180,0,180,180,0,180);
260 mod[i]->SetMarkerStyle(8);
261 mod[i]->SetMarkerColor(2);
38b8c336 262 fHmpHistList->Add(mod[i]);
9a8aafa5 263 }
264 //8-14
265 for(Int_t i=0; i< 7 ; i++) {//to reserve the histo sorting
266 q[i] = new TH1F(Form("q%i",i),Form("MIP charge distribution in chamber %i",i),5000,0,5000);
267 q[i]->SetMarkerColor(2);
38b8c336 268 fHmpHistList->Add(q[i]);
9a8aafa5 269 }
270 //15-21
271 for(Int_t i=0; i< 7 ; i++) {//to reserve the histo sorting
272 dq[i] = new TH2F(Form("dq%i",i),Form("#Delta(mip-track) vs Q_{mip} in chamber %i",i),1000,0,100,5000,0,5000),
273 dq[i]->SetMarkerStyle(6);
38b8c336 274 fHmpHistList->Add(dq[i]);
9a8aafa5 275 }
276 //22
277 TH2F *inner = new TH2F("inner","inner track XY",800,-400,400,800,-400,400);
278 inner->SetMarkerStyle(6);
279 inner->SetXTitle("X cm");
280 inner->SetYTitle("Y cm");
38b8c336 281 fHmpHistList->Add(inner);
9a8aafa5 282 //23
283 TH2F *outer = new TH2F("outer","outer track XY",800,-400,400,800,-400,400);
284 outer->SetMarkerStyle(6);
285 outer->SetXTitle("X cm");
286 outer->SetYTitle("Y cm");
38b8c336 287 fHmpHistList->Add(outer);
288*/
9a8aafa5 289}
dcb23f7e 290//____________________________________________________________________________________________________________________________________
291Bool_t AliHMPIDAnalysisTask::Equal(Double_t x, Double_t y, Double_t tolerance)
292{
293 return abs(x - y) <= tolerance ;
294}
295
9a8aafa5 296#endif