]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AOD/AliAODPWG4Particle.cxx
Fix Coverity 24835
[u/mrichter/AliRoot.git] / STEER / AOD / 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 objects class in use in the CaloTrackCorrelations
20 //     analysis pacackge ($ALICE_ROOT/PWGGA/CaloTrackCorrelations)
21 //
22 //     Author: Gustavo Conesa Balbastre - CNRS-LPSC-Grenoble
23 //-------------------------------------------------------------------------
24
25 //-- ROOT system --
26
27 //-- Analysis system
28 #include "AliAODPWG4Particle.h"
29
30 ClassImp(AliAODPWG4Particle)
31
32
33 //______________________________________________________________________________
34 AliAODPWG4Particle::AliAODPWG4Particle() :
35 AliVParticle(),
36 fMomentum(0),fPdg(-1), fTag(0), fLabel(-1),
37 fCaloLabel(), fTrackLabel(), fDetectorTag(-1),
38 fBadDist(0), fNLM(0), fM02(0),
39 fTime(0),fNCells(0),fSuperModule(0),
40 fDecayTag(0),fIsolated(0), fLeadingParticle(0),
41 fDisp(0), fTof(0), fCharged(0),
42 fTagged(0), fFidArea(0), fInputFileIndex(0),fBtag(0)
43 {
44   // constructor
45   fCaloLabel [0] = -1;
46   fCaloLabel [1] = -1;
47   fTrackLabel[0] = -1;
48   fTrackLabel[1] = -1;
49   fTrackLabel[2] = -1;
50   fTrackLabel[3] = -1;
51 }
52
53 //______________________________________________________________________________
54 AliAODPWG4Particle::AliAODPWG4Particle(Double_t px, Double_t py, Double_t pz, Double_t e):
55   AliVParticle(),
56   fMomentum(0),fPdg(-1), fTag(0), fLabel(-1),
57   fCaloLabel(), fTrackLabel(), fDetectorTag(-1),
58   fBadDist(0), fNLM(0), fM02(0),
59   fTime(0),fNCells(0),fSuperModule(0),
60   fDecayTag(0),fIsolated(0), fLeadingParticle(0),
61   fDisp(0), fTof(0), fCharged(0),
62   fTagged(0), fFidArea(0), fInputFileIndex(0),fBtag(0)
63 {
64   // constructor
65   fMomentum = new TLorentzVector(px, py, pz, e);
66   
67   fCaloLabel [0] = -1;
68   fCaloLabel [1] = -1;
69   fTrackLabel[0] = -1;
70   fTrackLabel[1] = -1;  
71   fTrackLabel[2] = -1;
72   fTrackLabel[3] = -1;  
73 }
74
75 //______________________________________________________________________________
76 AliAODPWG4Particle::AliAODPWG4Particle(TLorentzVector & p):
77   AliVParticle(),
78   fMomentum(0),fPdg(-1), fTag(0), fLabel(-1),
79   fCaloLabel(), fTrackLabel(),fDetectorTag(-1),
80   fBadDist(0), fNLM(0), fM02(0),
81   fTime(0),fNCells(0),fSuperModule(0),
82   fDecayTag(0),fIsolated(0), fLeadingParticle(0),
83   fDisp(0), fTof(0), fCharged(0),
84   fTagged(0), fFidArea(0), fInputFileIndex(0),fBtag(0)
85 {
86   // constructor
87   fMomentum = new TLorentzVector(p);
88   
89   fCaloLabel [0] = -1;
90   fCaloLabel [1] = -1;
91   fTrackLabel[0] = -1;
92   fTrackLabel[1] = -1;
93   fTrackLabel[2] = -1;
94   fTrackLabel[3] = -1;
95 }
96
97
98 //______________________________________________________________________________
99 AliAODPWG4Particle::~AliAODPWG4Particle() 
100 {
101   // destructor
102     delete fMomentum;
103 }
104
105 //______________________________________________________________________________
106 void AliAODPWG4Particle::Clear(const Option_t* /*opt*/) 
107 {
108   //clear
109   delete fMomentum;
110 }
111
112 //______________________________________________________________________________
113 AliAODPWG4Particle::AliAODPWG4Particle(const AliAODPWG4Particle& part) :
114   AliVParticle(part),
115   fMomentum(0), fPdg(part.fPdg), fTag(part.fTag), fLabel(part.fLabel),
116   fCaloLabel(), fTrackLabel(), fDetectorTag(part.fDetectorTag),
117   fBadDist(part.fBadDist),fNLM(part.fNLM), fM02(part.fM02),
118   fTime(part.fTime),fNCells(part.fNCells),fSuperModule(part.fSuperModule),
119   fDecayTag(part.fDecayTag),fIsolated(part.fIsolated), fLeadingParticle(part.fLeadingParticle),
120   fDisp(part.fDisp), fTof(part.fTof), fCharged(part.fCharged),
121   fTagged(part.fTagged), fFidArea(part.fFidArea), fInputFileIndex(part.fInputFileIndex),fBtag(part.fBtag)
122 {
123   // Copy constructor
124   fMomentum = new TLorentzVector(*part.fMomentum);
125   
126   fCaloLabel [0] = part.fCaloLabel[0];
127   fCaloLabel [1] = part.fCaloLabel[1];
128   fTrackLabel[0] = part.fTrackLabel[0];
129   fTrackLabel[1] = part.fTrackLabel[1];
130   fTrackLabel[2] = part.fTrackLabel[2];
131   fTrackLabel[3] = part.fTrackLabel[3];
132 }
133
134 //________________________________________________________________________________
135 AliAODPWG4Particle& AliAODPWG4Particle::operator=(const AliAODPWG4Particle & part)
136 {
137   // Assignment operator
138   if(this!=&part)
139   {
140     fPdg   = part.fPdg;
141     fTag   = part.fTag;
142     fLabel = part.fLabel;
143     
144     fCaloLabel [0] = part.fCaloLabel[0];
145     fCaloLabel [1] = part.fCaloLabel[1];
146     fTrackLabel[0] = part.fTrackLabel[0];
147     fTrackLabel[1] = part.fTrackLabel[1];
148     
149     fDetectorTag = part.fDetectorTag;
150     fDisp     = part.fDisp;
151     fTof      = part.fTof;
152     fCharged  = part.fCharged;
153     fBadDist  = part.fBadDist;
154     fDecayTag = part.fDecayTag;
155     
156     fNLM      = part.fNLM;
157     fM02      = part.fM02;
158     fIsolated = part.fIsolated;
159     fLeadingParticle =part.fLeadingParticle;
160
161     fBtag     = part.fBtag;
162     fFidArea  = part.fFidArea;
163     fTagged   = part.fTagged;
164     fInputFileIndex =  part.fInputFileIndex;
165
166     if (fMomentum ) delete fMomentum;
167     fMomentum = new TLorentzVector(*part.fMomentum);
168   }
169   
170   return *this;
171 }
172
173 //_______________________________________________________________
174 Bool_t AliAODPWG4Particle::IsPIDOK(const Int_t ipid, const Int_t pdgwanted) const{
175   // returns true if particle satisfies given PID criterium
176         switch(ipid){
177     case 0: return kTRUE ; //No PID at all
178     case 1:
179           {
180             if (fPdg == pdgwanted) return kTRUE;
181             else return kFALSE; //Overall PID calculated with bayesian methods.
182           }
183     case 2: return fDisp ;   //only dispersion cut
184     case 3: return fTof ;    //Only TOF cut
185     case 4: return fCharged ;    //Only Charged cut
186     case 5: return fDisp && fTof ;  //Dispersion and TOF
187     case 6: return fDisp && fCharged ;  //Dispersion and Charged
188     case 7: return fTof  && fCharged ;  //TOF and Charged
189     case 8: return fDisp && fTof && fCharged ; // all 3 cuts
190     default: return kFALSE ; //Not known combination
191         }
192 }
193
194 //______________________________________________________________________________
195 void AliAODPWG4Particle::Print(Option_t* /*option*/) const 
196 {
197   // Print information of all data members
198   
199   printf("Particle 4-vector:\n");
200   printf("     E  = %13.3f", E() );
201   printf("     Px = %13.3f", Px());
202   printf("     Py = %13.3f", Py());
203   printf("     Pz = %13.3f\n", Pz());
204   printf("Id PDG     : %d\n",fPdg);
205   printf("MC Tag     : %d\n",fTag);
206   printf("Dist. to bad channel : %d\n",fBadDist);
207
208   printf("Detector  : %d, Labels:\n",fDetectorTag);
209   printf("      Calo: %d, %d \n",fCaloLabel[0],fCaloLabel[1]);
210   printf("      Track: %d, %d, %d, %d \n",fTrackLabel[0],fTrackLabel[1],fTrackLabel[2],fTrackLabel[3]);
211   
212   if(fDetectorTag!=2) // Avoid tracks, AliFiducialCut::kCTS
213   {
214     printf("Calo param: \n");
215     printf("      M02: %2.3f\n",fM02);
216     printf("      NCell: %d\n",fNCells);
217     printf("      Time: %2.3f\n",fTime);
218     printf("      SModule: %d\n",fSuperModule);
219   }
220   
221   printf("Tags: \n");
222 //  printf("Btag      : %d\n",fBtag);
223   printf("     Pi0 Tag   : %d\n",fDecayTag);
224   if(fIsolated)        printf("      Isolated! \n");
225   if(fLeadingParticle) printf("      Leading! \n");
226   
227   printf("PID bits :\n");
228   printf("     TOF        : %d",fTof);
229   printf("     Charged    : %d",fCharged);
230   printf("     Dispersion : %d\n",fDisp);
231
232   //  printf("Fid Area  : %d\n",fFidArea);
233   //  printf("Input File Index : %d\n",fInputFileIndex);
234
235 }