1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////
22 Class to store PID information for each particle species
26 ///////////////////////////////////////////////////////////////////////////
29 #include "AliPIDValues.h"
31 ClassImp(AliPIDValues)
33 AliPIDValues::AliPIDValues() :
35 fPIDStatus(AliPIDResponse::kDetPidOk)
38 // default constructor
40 Int_t nspecies=AliPID::kSPECIESCN;
41 for (Int_t i=0; i<nspecies; ++i) fValues[i]=0.;
44 //_______________________________________________________________________
45 AliPIDValues::AliPIDValues(const AliPIDValues &val) :
47 fPIDStatus(val.fPIDStatus)
52 Int_t nspecies=AliPID::kSPECIESCN;
53 for (Int_t i=0; i<nspecies; ++i) fValues[i]=val.fValues[i];
56 //_______________________________________________________________________
57 AliPIDValues::AliPIDValues(Double_t val[], Int_t nspecies, AliPIDResponse::EDetPidStatus status) :
59 fPIDStatus(AliPIDResponse::kDetPidOk)
62 // constructor with array of values
64 SetValues(val,nspecies,status);
67 //_______________________________________________________________________
68 AliPIDValues& AliPIDValues::operator= (const AliPIDValues &val)
71 // assignment operator
74 TObject::operator=(val);
76 Int_t nspecies=AliPID::kSPECIESCN;
77 for (Int_t i=0; i<nspecies; ++i) fValues[i]=val.fValues[i];
78 fPIDStatus=val.fPIDStatus;
84 //_______________________________________________________________________
85 void AliPIDValues::Copy(TObject &obj) const {
86 // this overwrites the virtual TObject::Copy()
87 // to allow run time copying without casting
91 AliPIDValues *robj = dynamic_cast<AliPIDValues*>(&obj);
92 if(!robj)return; // not AliPIDValues
96 //_______________________________________________________________________
97 void AliPIDValues::SetValues(const Double_t val[], Int_t nspecies, AliPIDResponse::EDetPidStatus status)
100 // set array of values
102 if (nspecies>AliPID::kSPECIESCN) nspecies=AliPID::kSPECIESCN;
103 for (Int_t i=0; i<nspecies; ++i) fValues[i]=val[i];
107 //_______________________________________________________________________
108 AliPIDResponse::EDetPidStatus AliPIDValues::GetValues(Double_t val[], Int_t nspecies) const
111 // get array of values
113 if (nspecies>AliPID::kSPECIESCN) nspecies=AliPID::kSPECIESCN;
114 for (Int_t i=0; i<nspecies; ++i) val[i]=fValues[i];
118 //_______________________________________________________________________
119 Double_t AliPIDValues::GetValue(AliPID::EParticleType type) const
122 // get values for a specific particle type
124 return fValues[(Int_t)type];