]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/UNICOR/AliUnicorEventAliceESD.cxx
Bug coreected in PTM gain array indexes
[u/mrichter/AliRoot.git] / PWG2 / UNICOR / AliUnicorEventAliceESD.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> 2008
17
18 //=============================================================================
19 // AliUnicorEvent-AliESD interface                                                   //
20 //=============================================================================
21
22 #include <cmath>
23 #include "AliESDEvent.h"
24 #include "AliUnicorEventAliceESD.h"
25
26 ClassImp(AliUnicorEventAliceESD)
27
28 //=============================================================================
29 AliUnicorEventAliceESD::AliUnicorEventAliceESD(AliESDEvent *esd) : AliUnicorEvent(), fESD(esd) 
30 {
31   // constructor 
32
33   //  printf("%s object created\n",ClassName());
34   if (!fESD) fESD = new AliESDEvent();
35 }
36 //=============================================================================
37 AliUnicorEventAliceESD::~AliUnicorEventAliceESD()
38 {
39   // destructor
40
41 }
42 //=============================================================================
43 Bool_t AliUnicorEventAliceESD::Good() const 
44 {
45   // event cuts
46
47   if (fabs(Zver())>1) return kFALSE;
48   if (fESD->GetPrimaryVertex()->GetZRes()>0.1) return kFALSE;
49   return kTRUE;
50 }
51 //=============================================================================
52 Bool_t AliUnicorEventAliceESD::ParticleGood(Int_t i, Int_t pidi) const 
53 {
54   // track cuts and particle id cuts; pidi=0 means take all species
55   // consider using the standard ESDcut
56
57   // track quality cuts
58
59   AliESDtrack *track = fESD->GetTrack(i);
60   if (!track->IsOn(AliESDtrack::kTPCrefit)) return 0;        // TPC refit
61   if (track->GetTPCNcls() < 120) return 0;                   // number of TPC clusters
62   const AliExternalTrackParam *tp = track->GetTPCInnerParam();
63   if (!tp) return 0;           
64
65   Float_t r,z;
66   track->GetImpactParameters(r,z);
67   //  if (fabs(z)>0.2) return 0;                          // impact parameter in z
68   //  if (fabs(r)>0.1) return 0;                          // impact parameter in xy
69
70   // pid
71
72   if (pidi==0) return 1;
73   if (!track->IsOn(AliESDtrack::kTPCpid)) return 0;
74   Double_t p[AliPID::kSPECIES];
75   track->GetTPCpid(p);
76   Int_t q = tp->Charge();
77   if (pidi == -211) return p[AliPID::kPion]+p[AliPID::kMuon]>0.5 && q==-1;
78   else if (pidi == 211) return p[AliPID::kPion]+p[AliPID::kMuon]>0.5 && q==1;
79   else return 0;
80 }
81 //=============================================================================
82 Bool_t AliUnicorEventAliceESD::PairGood(Double_t /*p0*/, Double_t the0, Double_t phi0, 
83                                 Double_t /*p1*/, Double_t the1, Double_t phi1) const {
84
85   // two-track separation cut
86
87   double r = 85; // TPC entrance radius in cm
88   double x0 = r*sin(the0)*cos(phi0);
89   double x1 = r*sin(the1)*cos(phi0);
90   double y0 = r*sin(the0)*sin(phi0);
91   double y1 = r*sin(the1)*sin(phi1);
92   double z0 = r*cos(the0);
93   double z1 = r*cos(the1);
94   double dx = x1-x0;
95   double dy = y1-y0;
96   double dz = z1-z0;
97   double dist2 = dx*dx+dy*dy+dz*dz;
98   return dist2>2*2;
99 }
100 //=============================================================================