]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliAODPWG4Particle.cxx
1) Reference arrays with tracks and clusters before defined in the AliAODPWG4Particl...
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliAODPWG4Particle.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2007, 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 /* $Id:   AliAODPWG4Particle.h $ */
17
18 //-------------------------------------------------------------------------
19 //     AOD class for photon and other particles storage and 
20 //     correlation studies
21 //     Author: Yves Schutz, CERN, Gustavo Conesa, INFN
22 //-------------------------------------------------------------------------
23
24 //-- ROOT system --
25
26 //-- Analysis system
27 #include "AliAODPWG4Particle.h"
28
29 ClassImp(AliAODPWG4Particle)
30
31
32 //______________________________________________________________________________
33 AliAODPWG4Particle::AliAODPWG4Particle() :
34 AliVParticle(),
35 fMomentum(0),fPdg(-1), fTag(-1), fLabel(-1), fCaloLabel(), fTrackLabel(),
36 fDetector(""), fDisp(0), fTof(0), fCharged(0), fBadDist(0)
37 {
38   // constructor
39   fCaloLabel [0] = -1;
40   fCaloLabel [1] = -1;
41   fTrackLabel[0] = -1;
42   fTrackLabel[1] = -1;
43 }
44
45 //______________________________________________________________________________
46 AliAODPWG4Particle::AliAODPWG4Particle(Double_t px, Double_t py, Double_t pz, Double_t e):
47   AliVParticle(),
48   fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fCaloLabel(), fTrackLabel(),
49   fDetector(""), fDisp(0),fTof(0),fCharged(0), fBadDist(0)
50 {
51   // constructor
52   fMomentum = new TLorentzVector(px, py, pz, e);
53   
54   fCaloLabel [0] = -1;
55   fCaloLabel [1] = -1;
56   fTrackLabel[0] = -1;
57   fTrackLabel[1] = -1;  
58 }
59
60 //______________________________________________________________________________
61 AliAODPWG4Particle::AliAODPWG4Particle(TLorentzVector & p):
62   AliVParticle(),
63   fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fCaloLabel(), fTrackLabel(),
64   fDetector(""), fDisp(0),fTof(0),fCharged(0),fBadDist(0)
65 {
66   // constructor
67   fMomentum = new TLorentzVector(p);
68   
69   fCaloLabel [0] = -1;
70   fCaloLabel [1] = -1;
71   fTrackLabel[0] = -1;
72   fTrackLabel[1] = -1;
73 }
74
75
76 //______________________________________________________________________________
77 AliAODPWG4Particle::~AliAODPWG4Particle() 
78 {
79   // destructor
80     delete fMomentum;
81 }
82
83 //______________________________________________________________________________
84 AliAODPWG4Particle::AliAODPWG4Particle(const AliAODPWG4Particle& part) :
85   AliVParticle(part),
86   fMomentum(0), fPdg(part.fPdg), fTag(part.fTag), fLabel(part.fLabel), 
87   fCaloLabel(), fTrackLabel(), fDetector(part.fDetector),fDisp(part.fDisp), 
88   fTof(part.fTof), fCharged(part.fCharged),  fBadDist(part.fBadDist)
89     
90 {
91   // Copy constructor
92   fMomentum = new TLorentzVector(*part.fMomentum);
93   
94   fCaloLabel [0] = part.fCaloLabel[0];
95   fCaloLabel [1] = part.fCaloLabel[1];
96   fTrackLabel[0] = part.fTrackLabel[0];
97   fTrackLabel[1] = part.fTrackLabel[1];
98 }
99
100 //______________________________________________________________________________
101 AliAODPWG4Particle& AliAODPWG4Particle::operator=(const AliAODPWG4Particle& part)
102 {
103   // Assignment operator
104   if(this!=&part) {
105     
106     fPdg   = part.fPdg;
107     fTag   = part.fTag;
108     fLabel = part.fLabel;
109         
110     fCaloLabel [0] = part.fCaloLabel[0];
111     fCaloLabel [1] = part.fCaloLabel[1];
112     fTrackLabel[0] = part.fTrackLabel[0];
113     fTrackLabel[1] = part.fTrackLabel[1];
114         
115     fDetector = part.fDetector;
116     fDisp     = part.fDisp; 
117     fTof      = part.fTof; 
118     fCharged  = part.fCharged; 
119     fBadDist  = part.fBadDist;
120
121     if (fMomentum ) delete fMomentum;   
122     fMomentum = new TLorentzVector(*part.fMomentum);
123   }
124   
125   return *this;
126 }
127
128
129 //_______________________________________________________________
130 Bool_t AliAODPWG4Particle::IsPIDOK(const Int_t ipid, const Int_t pdgwanted) const{
131   // returns true if particle satisfies given PID criterium
132         switch(ipid){
133         case 0: return kTRUE ; //No PID at all
134         case 1: 
135           {
136             if (fPdg == pdgwanted) return kTRUE; 
137             else return kFALSE; //Overall PID calculated with bayesian methods.
138           }
139         case 2: return fDisp ;   //only dispersion cut
140         case 3: return fTof ;    //Only TOF cut
141         case 4: return fCharged ;    //Only Charged cut
142         case 5: return fDisp && fTof ;  //Dispersion and TOF
143         case 6: return fDisp && fCharged ;  //Dispersion and Charged
144         case 7: return fTof  && fCharged ;  //TOF and Charged
145         case 8: return fDisp && fTof && fCharged ; // all 3 cuts
146         default: return kFALSE ; //Not known combination
147         }
148 }
149
150 //______________________________________________________________________________
151 void AliAODPWG4Particle::Print(Option_t* /*option*/) const 
152 {
153   // Print information of all data members
154   printf("Particle 4-vector:\n");
155   printf("     E  = %13.3f", E() );
156   printf("     Px = %13.3f", Px());
157   printf("     Py = %13.3f", Py());
158   printf("     Pz = %13.3f\n", Pz());
159   printf("PID bits :\n");
160   printf("     TOF        : %d",fTof);
161   printf("     Charged    : %d",fCharged);
162   printf("     Dispersion : %d\n",fDisp);
163   printf("PDG       : %d\n",fPdg);
164   printf("Tag       : %d\n",fTag);    
165   printf("Dist. to bad channel : %d\n",fBadDist);  
166   printf("Detector  : %s\n",fDetector.Data());
167   
168 }