#include "AliTOFResponseParams.h"
#include "TGraph.h"
ClassImp(AliTOFResponseParams)
AliTOFResponseParams::AliTOFResponseParams() :
TObject()
{
for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
fNPoints[ipart] = 0;
}
AliTOFResponseParams::AliTOFResponseParams(Int_t *nPoints) :
TObject()
{
for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
fNPoints[ipart] = nPoints[ipart] < fgkMaxPoints ? nPoints[ipart] : fgkMaxPoints;
}
AliTOFResponseParams::~AliTOFResponseParams()
{
}
AliTOFResponseParams::AliTOFResponseParams(const AliTOFResponseParams &source) :
TObject(source)
{
for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
fNPoints[ipart] = source.fNPoints[ipart];
for (Int_t ipoint = 0; ipoint < fNPoints[ipart]; ipoint++) {
fP[ipart][ipoint] = source.fP[ipart][ipoint];
fTExpCorr[ipart][ipoint] = source.fTExpCorr[ipart][ipoint];
}
}
}
AliTOFResponseParams &
AliTOFResponseParams::operator=(const AliTOFResponseParams &source)
{
if (this == &source) return *this;
TObject::operator=(source);
for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
fNPoints[ipart] = source.fNPoints[ipart];
for (Int_t ipoint = 0; ipoint < fNPoints[ipart]; ipoint++) {
fP[ipart][ipoint] = source.fP[ipart][ipoint];
fTExpCorr[ipart][ipoint] = source.fTExpCorr[ipart][ipoint];
}
}
return *this;
}
TGraph *
AliTOFResponseParams::DrawGraph(Int_t ipart, Option_t* option)
{
if (ipart >= AliPID::kSPECIES) return NULL;
if (fNPoints[ipart] == 0) return NULL;
TGraph *graph = new TGraph(fNPoints[ipart], fP[ipart], fTExpCorr[ipart]);
graph->Draw(option);
return graph;
}
Double_t
AliTOFResponseParams::EvalTExpCorr(Int_t ipart, Double_t p)
{
if (ipart >= AliPID::kSPECIES) return 0.;
if (fNPoints[ipart] == 0) return 0.;
if (p < fP[ipart][0]) return fTExpCorr[ipart][0];
if (p >= fP[ipart][fNPoints[ipart] - 1]) return fTExpCorr[ipart][fNPoints[ipart] - 1];
Int_t ipoint;
for (ipoint = 0; ipoint < fNPoints[ipart] - 1; ipoint++)
if (p >= fP[ipart][ipoint] && p < fP[ipart][ipoint + 1]) break;
Double_t coeff = (fTExpCorr[ipart][ipoint + 1] - fTExpCorr[ipart][ipoint]) / (fP[ipart][ipoint + 1] - fP[ipart][ipoint]);
Double_t corr = fTExpCorr[ipart][ipoint] + coeff * (p - fP[ipart][ipoint]);
return corr;
}
AliTOFResponseParams.cxx:1 AliTOFResponseParams.cxx:2 AliTOFResponseParams.cxx:3 AliTOFResponseParams.cxx:4 AliTOFResponseParams.cxx:5 AliTOFResponseParams.cxx:6 AliTOFResponseParams.cxx:7 AliTOFResponseParams.cxx:8 AliTOFResponseParams.cxx:9 AliTOFResponseParams.cxx:10 AliTOFResponseParams.cxx:11 AliTOFResponseParams.cxx:12 AliTOFResponseParams.cxx:13 AliTOFResponseParams.cxx:14 AliTOFResponseParams.cxx:15 AliTOFResponseParams.cxx:16 AliTOFResponseParams.cxx:17 AliTOFResponseParams.cxx:18 AliTOFResponseParams.cxx:19 AliTOFResponseParams.cxx:20 AliTOFResponseParams.cxx:21 AliTOFResponseParams.cxx:22 AliTOFResponseParams.cxx:23 AliTOFResponseParams.cxx:24 AliTOFResponseParams.cxx:25 AliTOFResponseParams.cxx:26 AliTOFResponseParams.cxx:27 AliTOFResponseParams.cxx:28 AliTOFResponseParams.cxx:29 AliTOFResponseParams.cxx:30 AliTOFResponseParams.cxx:31 AliTOFResponseParams.cxx:32 AliTOFResponseParams.cxx:33 AliTOFResponseParams.cxx:34 AliTOFResponseParams.cxx:35 AliTOFResponseParams.cxx:36 AliTOFResponseParams.cxx:37 AliTOFResponseParams.cxx:38 AliTOFResponseParams.cxx:39 AliTOFResponseParams.cxx:40 AliTOFResponseParams.cxx:41 AliTOFResponseParams.cxx:42 AliTOFResponseParams.cxx:43 AliTOFResponseParams.cxx:44 AliTOFResponseParams.cxx:45 AliTOFResponseParams.cxx:46 AliTOFResponseParams.cxx:47 AliTOFResponseParams.cxx:48 AliTOFResponseParams.cxx:49 AliTOFResponseParams.cxx:50 AliTOFResponseParams.cxx:51 AliTOFResponseParams.cxx:52 AliTOFResponseParams.cxx:53 AliTOFResponseParams.cxx:54 AliTOFResponseParams.cxx:55 AliTOFResponseParams.cxx:56 AliTOFResponseParams.cxx:57 AliTOFResponseParams.cxx:58 AliTOFResponseParams.cxx:59 AliTOFResponseParams.cxx:60 AliTOFResponseParams.cxx:61 AliTOFResponseParams.cxx:62 AliTOFResponseParams.cxx:63 AliTOFResponseParams.cxx:64 AliTOFResponseParams.cxx:65 AliTOFResponseParams.cxx:66 AliTOFResponseParams.cxx:67 AliTOFResponseParams.cxx:68 AliTOFResponseParams.cxx:69 AliTOFResponseParams.cxx:70 AliTOFResponseParams.cxx:71 AliTOFResponseParams.cxx:72 AliTOFResponseParams.cxx:73 AliTOFResponseParams.cxx:74 AliTOFResponseParams.cxx:75 AliTOFResponseParams.cxx:76 AliTOFResponseParams.cxx:77 AliTOFResponseParams.cxx:78 AliTOFResponseParams.cxx:79 AliTOFResponseParams.cxx:80 AliTOFResponseParams.cxx:81 AliTOFResponseParams.cxx:82 AliTOFResponseParams.cxx:83 AliTOFResponseParams.cxx:84 AliTOFResponseParams.cxx:85 AliTOFResponseParams.cxx:86 AliTOFResponseParams.cxx:87 AliTOFResponseParams.cxx:88 AliTOFResponseParams.cxx:89 AliTOFResponseParams.cxx:90 AliTOFResponseParams.cxx:91 AliTOFResponseParams.cxx:92 AliTOFResponseParams.cxx:93 AliTOFResponseParams.cxx:94 AliTOFResponseParams.cxx:95 AliTOFResponseParams.cxx:96 AliTOFResponseParams.cxx:97 AliTOFResponseParams.cxx:98 AliTOFResponseParams.cxx:99 AliTOFResponseParams.cxx:100 AliTOFResponseParams.cxx:101 AliTOFResponseParams.cxx:102 AliTOFResponseParams.cxx:103 AliTOFResponseParams.cxx:104 AliTOFResponseParams.cxx:105 AliTOFResponseParams.cxx:106 AliTOFResponseParams.cxx:107 AliTOFResponseParams.cxx:108 AliTOFResponseParams.cxx:109 AliTOFResponseParams.cxx:110 AliTOFResponseParams.cxx:111 AliTOFResponseParams.cxx:112 AliTOFResponseParams.cxx:113 AliTOFResponseParams.cxx:114 AliTOFResponseParams.cxx:115 AliTOFResponseParams.cxx:116 AliTOFResponseParams.cxx:117 AliTOFResponseParams.cxx:118 AliTOFResponseParams.cxx:119 AliTOFResponseParams.cxx:120 AliTOFResponseParams.cxx:121 AliTOFResponseParams.cxx:122 AliTOFResponseParams.cxx:123 AliTOFResponseParams.cxx:124 AliTOFResponseParams.cxx:125 AliTOFResponseParams.cxx:126 AliTOFResponseParams.cxx:127 AliTOFResponseParams.cxx:128 AliTOFResponseParams.cxx:129 AliTOFResponseParams.cxx:130 AliTOFResponseParams.cxx:131 AliTOFResponseParams.cxx:132 AliTOFResponseParams.cxx:133 AliTOFResponseParams.cxx:134 AliTOFResponseParams.cxx:135 AliTOFResponseParams.cxx:136 AliTOFResponseParams.cxx:137 AliTOFResponseParams.cxx:138 AliTOFResponseParams.cxx:139 AliTOFResponseParams.cxx:140 AliTOFResponseParams.cxx:141 AliTOFResponseParams.cxx:142 AliTOFResponseParams.cxx:143 AliTOFResponseParams.cxx:144 AliTOFResponseParams.cxx:145 AliTOFResponseParams.cxx:146 AliTOFResponseParams.cxx:147