]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEERBase/AliPIDValues.cxx
- fast TRD PID implementation with muon constraints (Daniel Lohner)
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliPIDValues.cxx
CommitLineData
8a764dbc 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
22Class to store PID information for each particle species
23
24*/
25// //
26///////////////////////////////////////////////////////////////////////////
27
28
29#include "AliPIDValues.h"
30
31ClassImp(AliPIDValues)
32
33AliPIDValues::AliPIDValues() :
34 TObject(),
35 fPIDStatus(AliPIDResponse::kDetPidOk)
36{
37 //
38 // default constructor
39 //
40 Int_t nspecies=AliPID::kSPECIESCN;
41 for (Int_t i=0; i<nspecies; ++i) fValues[i]=0.;
42}
43
44//_______________________________________________________________________
45AliPIDValues::AliPIDValues(const AliPIDValues &val) :
46 TObject(val),
47 fPIDStatus(val.fPIDStatus)
48{
49 //
50 // copy constructor
51 //
52 Int_t nspecies=AliPID::kSPECIESCN;
53 for (Int_t i=0; i<nspecies; ++i) fValues[i]=val.fValues[i];
54}
55
56//_______________________________________________________________________
57AliPIDValues::AliPIDValues(Double_t val[], Int_t nspecies, AliPIDResponse::EDetPidStatus status) :
58 TObject(),
59 fPIDStatus(AliPIDResponse::kDetPidOk)
60{
61 //
62 // constructor with array of values
63 //
64 SetValues(val,nspecies,status);
65}
66
67//_______________________________________________________________________
68AliPIDValues& AliPIDValues::operator= (const AliPIDValues &val)
69{
70 //
71 // assignment operator
72 //
73 if (this!=&val){
74 TObject::operator=(val);
75
76 Int_t nspecies=AliPID::kSPECIESCN;
77 for (Int_t i=0; i<nspecies; ++i) fValues[i]=val.fValues[i];
78 fPIDStatus=val.fPIDStatus;
79 }
80
81 return *this;
82}
83
84//_______________________________________________________________________
85void 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 if(this==&obj)return;
91 AliPIDValues *robj = dynamic_cast<AliPIDValues*>(&obj);
92 if(!robj)return; // not AliPIDValues
93 *robj = *this;
94}
95
96//_______________________________________________________________________
97void AliPIDValues::SetValues(const Double_t val[], Int_t nspecies, AliPIDResponse::EDetPidStatus status)
98{
99 //
100 // set array of values
101 //
102 if (nspecies>AliPID::kSPECIESCN) nspecies=AliPID::kSPECIESCN;
103 for (Int_t i=0; i<nspecies; ++i) fValues[i]=val[i];
104 fPIDStatus=status;
105}
106
107//_______________________________________________________________________
108AliPIDResponse::EDetPidStatus AliPIDValues::GetValues(Double_t val[], Int_t nspecies) const
109{
110 //
111 // get array of values
112 //
113 if (nspecies>AliPID::kSPECIESCN) nspecies=AliPID::kSPECIESCN;
114 for (Int_t i=0; i<nspecies; ++i) val[i]=fValues[i];
115 return fPIDStatus;
116}
117
118//_______________________________________________________________________
119Double_t AliPIDValues::GetValue(AliPID::EParticleType type) const
120{
121 //
122 // get values for a specific particle type
123 //
124 return fValues[(Int_t)type];
125}
126