]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/UNICOR/AliUnicorAnalSingle.cxx
Fix Coverity
[u/mrichter/AliRoot.git] / PWG2 / UNICOR / AliUnicorAnalSingle.cxx
1 /************************************************************************* 
2 * Copyright(c) 1998-2048, 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
16 // Author: Dariusz Miskowiec <mailto:d.miskowiec@gsi.de> 2007
17
18 //=============================================================================
19 // single particle analyzer
20 // Loop over tracks of one event and, for tracks that fulfill the quality 
21 // and pid cuts, fill single track histograms. 
22 //=============================================================================
23
24 #include <cmath>
25 #include <TROOT.h>
26 #include <TMath.h>
27 #include <TAxis.h>
28 #include <TParticlePDG.h>
29 #include "AliUnicorHN.h"
30 #include "AliUnicorEvent.h"
31 #include "AliUnicorAnalSingle.h"
32
33 ClassImp(AliUnicorAnalSingle)
34
35 //=============================================================================
36 AliUnicorAnalSingle::AliUnicorAnalSingle(const char *nam, Double_t emi, Double_t ema, Int_t pid) : 
37   AliUnicorAnal(nam), fPid(pid), fMass(0.0) 
38 {
39   // constructor
40   // emi and ema define the rapidity range for histograms
41
42   fPid = pid;
43   TParticlePDG *part = AliUnicorAnal::fgPDG.GetParticle(fPid);
44   fMass = part? part->Mass() : 0;
45
46   double pi = TMath::Pi();
47   TAxis *ax[10];
48   ax[0] = new TAxis(30,-1,1);    ax[0]->SetTitle("vertex z");
49   ax[1] = new TAxis(80,emi,ema); ax[1]->SetTitle("eta");
50   ax[2] = new TAxis(90,-pi,pi);  ax[2]->SetTitle("phi");
51   AliUnicorHN *zep = new AliUnicorHN("zep",3,ax);
52   for (int i=0; i<3; i++) delete ax[i];
53
54   ax[0] = new TAxis(20,0,1);     ax[0]->SetTitle("centrality");
55   ax[1] = new TAxis(80,emi,ema); ax[1]->SetTitle("y");
56   ax[2] = new TAxis(80,0,2);     ax[2]->SetTitle("pt (GeV)");
57   AliUnicorHN *cyp = new AliUnicorHN("cyp",3,ax);
58   for (int i=0; i<3; i++) delete ax[i];
59
60   ax[0] = new TAxis(10,emi,ema); ax[0]->SetTitle("eta");
61   ax[1] = new TAxis(150,0,3);    ax[1]->SetTitle("p (GeV)");
62   ax[2] = new TAxis(150,0.5,3.5);ax[2]->SetTitle("sqrt(dedx (mips))");
63   AliUnicorHN *epd = new AliUnicorHN("epd",3,ax);
64   for (int i=0; i<3; i++) delete ax[i];
65
66   fHistos.Add(zep);
67   fHistos.Add(cyp);
68   fHistos.Add(epd);
69   gROOT->cd();
70 }
71 //=============================================================================
72 void AliUnicorAnalSingle::Process(AliUnicorEvent *ev) 
73 {
74   // fill single particle histograms
75
76   AliUnicorHN *zep = (AliUnicorHN*) fHistos.At(0);
77   AliUnicorHN *cyp = (AliUnicorHN*) fHistos.At(1);
78   AliUnicorHN *epd = (AliUnicorHN*) fHistos.At(2);
79   for (int i=0; i<ev->NParticles(); i++) {
80     if (!ev->ParticleGood(i,fPid)) continue;
81     zep->Fill(ev->Zver(),ev->ParticleEta(i),ev->ParticlePhi(i),1.0);
82     double y = fMass>0? ev->ParticleY(i,fMass) : ev->ParticleEta(i);
83     cyp->Fill(ev->Centrality(),y,ev->ParticlePt(i),1.0);
84     epd->Fill(ev->ParticleEta(i),ev->ParticleP(i),sqrt(ev->ParticleDedx(i)),1.0);
85   }
86 }
87 //=============================================================================