Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 1998-1999, 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 : ///////////////////////////////////////////////////////////////////////////
17 : // PID Values //
18 : // //
19 : // //
20 : /*
21 :
22 : Class to store PID information for each particle species
23 :
24 : */
25 : // //
26 : ///////////////////////////////////////////////////////////////////////////
27 :
28 :
29 : #include "AliPIDValues.h"
30 :
31 176 : ClassImp(AliPIDValues)
32 :
33 : AliPIDValues::AliPIDValues() :
34 0 : TObject(),
35 0 : fPIDStatus(AliPIDResponse::kDetPidOk)
36 0 : {
37 : //
38 : // default constructor
39 : //
40 : Int_t nspecies=AliPID::kSPECIESCN;
41 0 : for (Int_t i=0; i<nspecies; ++i) fValues[i]=0.;
42 0 : }
43 :
44 : //_______________________________________________________________________
45 : AliPIDValues::AliPIDValues(const AliPIDValues &val) :
46 0 : TObject(val),
47 0 : fPIDStatus(val.fPIDStatus)
48 0 : {
49 : //
50 : // copy constructor
51 : //
52 : Int_t nspecies=AliPID::kSPECIESCN;
53 0 : for (Int_t i=0; i<nspecies; ++i) fValues[i]=val.fValues[i];
54 0 : }
55 :
56 : //_______________________________________________________________________
57 : AliPIDValues::AliPIDValues(Double_t val[], Int_t nspecies, AliPIDResponse::EDetPidStatus status) :
58 0 : TObject(),
59 0 : fPIDStatus(AliPIDResponse::kDetPidOk)
60 0 : {
61 : //
62 : // constructor with array of values
63 : //
64 0 : SetValues(val,nspecies,status);
65 0 : }
66 :
67 : //_______________________________________________________________________
68 : AliPIDValues& AliPIDValues::operator= (const AliPIDValues &val)
69 : {
70 : //
71 : // assignment operator
72 : //
73 0 : if (this!=&val){
74 0 : TObject::operator=(val);
75 :
76 : Int_t nspecies=AliPID::kSPECIESCN;
77 0 : for (Int_t i=0; i<nspecies; ++i) fValues[i]=val.fValues[i];
78 0 : fPIDStatus=val.fPIDStatus;
79 0 : }
80 :
81 0 : return *this;
82 : }
83 :
84 : //_______________________________________________________________________
85 : void AliPIDValues::Copy(TObject &obj) const {
86 : // this overwrites the virtual TObject::Copy()
87 : // to allow run time copying without casting
88 : // in AliPIDValues
89 :
90 0 : if(this==&obj)return;
91 0 : AliPIDValues *robj = dynamic_cast<AliPIDValues*>(&obj);
92 0 : if(!robj)return; // not AliPIDValues
93 0 : *robj = *this;
94 0 : }
95 :
96 : //_______________________________________________________________________
97 : void AliPIDValues::SetValues(const Double_t val[], Int_t nspecies, AliPIDResponse::EDetPidStatus status)
98 : {
99 : //
100 : // set array of values
101 : //
102 0 : if (nspecies>AliPID::kSPECIESCN) nspecies=AliPID::kSPECIESCN;
103 0 : for (Int_t i=0; i<nspecies; ++i) fValues[i]=val[i];
104 0 : fPIDStatus=status;
105 0 : }
106 :
107 : //_______________________________________________________________________
108 : AliPIDResponse::EDetPidStatus AliPIDValues::GetValues(Double_t val[], Int_t nspecies) const
109 : {
110 : //
111 : // get array of values
112 : //
113 0 : if (nspecies>AliPID::kSPECIESCN) nspecies=AliPID::kSPECIESCN;
114 0 : for (Int_t i=0; i<nspecies; ++i) val[i]=fValues[i];
115 0 : return fPIDStatus;
116 : }
117 :
118 : //_______________________________________________________________________
119 : Double_t AliPIDValues::GetValue(AliPID::EParticleType type) const
120 : {
121 : //
122 : // get values for a specific particle type
123 : //
124 0 : return fValues[(Int_t)type];
125 : }
126 :
|