1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 **************************************************************************/
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 //-------------------------------------------------------------------------
26 #include "AliOADBTrackFix.h"
29 ClassImp(AliOADBTrackFix);
31 //______________________________________________________________________________
32 AliOADBTrackFix::AliOADBTrackFix()
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;
41 //______________________________________________________________________________
42 AliOADBTrackFix::AliOADBTrackFix(const char* name) :
43 TNamed(name, "TrackFix")
46 for (int imd=0;imd<kNCorModes;imd++) {
47 for (int iside=0;iside<2;iside++) fPtInvCor[imd][iside] = 0;
48 fXIniPtInvCorr[imd] = 0;
52 //______________________________________________________________________________
53 AliOADBTrackFix::~AliOADBTrackFix()
56 for (int imd=0;imd<kNCorModes;imd++) for (int iside=0;iside<2;iside++) delete fPtInvCor[imd][iside];
60 //______________________________________________________________________________
61 void AliOADBTrackFix::SetPtInvCorr(int mode,int side, const TGraph* gr)
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;
67 fPtInvCor[mode][side] = gr;
70 //______________________________________________________________________________
71 Double_t AliOADBTrackFix::GetPtInvCorr(int mode, double sideAfrac, double phi) const
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();
78 int nb = fPtInvCor[mode][0]->GetN();
79 int bin = int( phi/(2*TMath::Pi())*nb );
80 if (bin==nb) bin = nb-1;
81 return sideAfrac*fPtInvCor[mode][0]->GetY()[bin] + (1.-sideAfrac)*fPtInvCor[mode][1]->GetY()[bin];