PartCorr split in 2 Base and Dep; coding violations corrected; PHOS geometry can...
[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), fCaloLabel(), fTrackLabel(),
87 fDetector(part.fDetector),fDisp(part.fDisp), fTof(part.fTof), fCharged(part.fCharged),  fBadDist(part.fBadDist)
88
89 {
90         // Copy constructor
91         fMomentum = new TLorentzVector(*part.fMomentum);
92         
93         fCaloLabel [0] = part.fCaloLabel[0];
94         fCaloLabel [1] = part.fCaloLabel[1];
95         fTrackLabel[0] = part.fTrackLabel[0];
96         fTrackLabel[1] = part.fTrackLabel[1];
97 }
98
99 //______________________________________________________________________________
100 AliAODPWG4Particle& AliAODPWG4Particle::operator=(const AliAODPWG4Particle& part)
101 {
102         // Assignment operator
103         if(this!=&part) {
104                 
105                 fPdg = part.fPdg;
106                 fTag = part.fTag;
107                 fLabel = part.fLabel;
108                 fCaloLabel [0] = part.fCaloLabel[0];
109                 fCaloLabel [1] = part.fCaloLabel[1];
110                 fTrackLabel[0] = part.fTrackLabel[0];
111                 fTrackLabel[1] = part.fTrackLabel[1];
112                 fDetector =part.fDetector;
113                 
114                 fDisp = part.fDisp; 
115                 fTof = part.fTof; 
116                 fCharged = part.fCharged; 
117                 fBadDist=part.fBadDist;
118                 
119                 if (fMomentum ) delete fMomentum;       
120                 fMomentum = new TLorentzVector(*part.fMomentum);
121         }
122         
123         return *this;
124 }
125
126
127 //_______________________________________________________________
128 Bool_t AliAODPWG4Particle::IsPIDOK(const Int_t ipid, const Int_t pdgwanted) const{
129         // returns true if particle satisfies given PID criterium
130         switch(ipid){
131                 case 0: return kTRUE ; //No PID at all
132                 case 1: 
133                 {
134                         if (fPdg == pdgwanted) return kTRUE; 
135                         else return kFALSE; //Overall PID calculated with bayesian methods.
136                 }
137                 case 2: return fDisp ;   //only dispersion cut
138                 case 3: return fTof ;    //Only TOF cut
139                 case 4: return fCharged ;    //Only Charged cut
140                 case 5: return fDisp && fTof ;  //Dispersion and TOF
141                 case 6: return fDisp && fCharged ;  //Dispersion and Charged
142                 case 7: return fTof  && fCharged ;  //TOF and Charged
143                 case 8: return fDisp && fTof && fCharged ; // all 3 cuts
144                 default: return kFALSE ; //Not known combination
145         }
146 }
147
148 //______________________________________________________________________________
149 void AliAODPWG4Particle::Print(Option_t* /*option*/) const 
150 {
151         // Print information of all data members
152         printf("Particle 4-vector:\n");
153         printf("     E  = %13.3f\n", E() );
154         printf("     Px = %13.3f\n", Px());
155         printf("     Py = %13.3f\n", Py());
156         printf("     Pz = %13.3f\n", Pz());
157         printf("TOF bit        : %d\n",fTof);
158         printf("Charged bit    : %d\n",fCharged);
159         printf("Dispersion bit : %d\n",fDisp);
160         printf("pdg : %d\n",fPdg);
161         printf("tag : %d\n",fTag);  
162         printf("Trigger Detector : %s\n",fDetector.Data());
163         
164 }