]>
Commit | Line | Data |
---|---|---|
6cffd6bf | 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$ */ | |
17 | ||
18 | //------------------------------------------------------------------------- | |
19 | // OADB class for run dependent track fixing parameters | |
20 | // Convention for phi-dependent data: 0 : 2pi | |
21 | // Author: ruben.shahoyan@cern.ch | |
22 | //------------------------------------------------------------------------- | |
23 | ||
24 | #include <TGraph.h> | |
25 | #include <TMath.h> | |
26 | #include "AliOADBTrackFix.h" | |
27 | #include "AliLog.h" | |
28 | ||
29 | ClassImp(AliOADBTrackFix); | |
30 | ||
31 | //______________________________________________________________________________ | |
32 | AliOADBTrackFix::AliOADBTrackFix() | |
33 | { | |
34 | // Default constructor | |
35 | for (int imd=0;imd<kNCorModes;imd++) { | |
36 | for (int iside=0;iside<2;iside++) fPtInvCor[imd][iside] = 0; | |
37 | fXIniPtInvCorr[imd] = 0; | |
38 | } | |
39 | // | |
40 | } | |
41 | //______________________________________________________________________________ | |
42 | AliOADBTrackFix::AliOADBTrackFix(const char* name) : | |
43 | TNamed(name, "TrackFix") | |
44 | { | |
45 | // Constructor | |
46 | for (int imd=0;imd<kNCorModes;imd++) { | |
47 | for (int iside=0;iside<2;iside++) fPtInvCor[imd][iside] = 0; | |
48 | fXIniPtInvCorr[imd] = 0; | |
49 | } | |
50 | } | |
51 | ||
52 | //______________________________________________________________________________ | |
53 | AliOADBTrackFix::~AliOADBTrackFix() | |
54 | { | |
55 | // destructor | |
56 | for (int imd=0;imd<kNCorModes;imd++) for (int iside=0;iside<2;iside++) delete fPtInvCor[imd][iside]; | |
57 | // | |
58 | } | |
59 | ||
60 | //______________________________________________________________________________ | |
61 | void AliOADBTrackFix::SetPtInvCorr(int mode,int side, const TGraph* gr) | |
62 | { | |
63 | if (!gr || gr->GetN()<1) { | |
64 | AliInfo(Form("Correction for side %d in mode %d is empty",side,mode)); | |
65 | fPtInvCor[mode][side] = 0; | |
66 | } | |
67 | fPtInvCor[mode][side] = gr; | |
68 | } | |
69 | ||
70 | //______________________________________________________________________________ | |
71 | Double_t AliOADBTrackFix::GetPtInvCorr(int mode, double sideAfrac, double phi) const | |
72 | { | |
73 | // calculate the correction for the track of given model at given phi, provided the sideAfrac fraction of its | |
74 | // total lenght in TPC is in side A. | |
75 | if (!fPtInvCor[mode][0] || !fPtInvCor[mode][1]) return 0; // no graph | |
76 | while (phi>2*TMath::Pi()) phi -= 2*TMath::Pi(); | |
77 | while (phi<0) phi += 2*TMath::Pi(); | |
1112c329 | 78 | int nb = fPtInvCor[mode][0]->GetN(); |
79 | int bin = int( phi/(2*TMath::Pi())*nb ); | |
80 | if (bin==nb) bin = nb-1; | |
6cffd6bf | 81 | return sideAfrac*fPtInvCor[mode][0]->GetY()[bin] + (1.-sideAfrac)*fPtInvCor[mode][1]->GetY()[bin]; |
82 | } | |
83 | ||
84 |