Correction classes + the Demo
[u/mrichter/AliRoot.git] / TPC / AliTPCInverseCorrection.cxx
CommitLineData
0116859c 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// //
18// AliTPCInverseCorrection class //
19// //
20// This is a wrapper that inverts an AliTPCCorrection. This is done by //
21// swapping the CalculateCorrection and CalculateInverseCorrection functions. //
22// The wrapped correction is supplied as a pointer and the class relies //
23// on the fact, that this pointer keeps pointing to the right object. //
24// However, the ownership is not changed, i.e. the wrapped correction //
25// will not be deleted when this correction is destructed. //
26// //
27// date: 27/04/2010 //
28// Authors: Magnus Mager, Stefan Rossegger, Jim Thomas //
29////////////////////////////////////////////////////////////////////////////////
30
31#include <TString.h>
32#include "AliTPCInverseCorrection.h"
33
34AliTPCInverseCorrection::AliTPCInverseCorrection()
35 : fCorrection(0) {
36 //
37 // default constructor
38 // (only meant for ROOT I/O)
39 //
40}
41
42AliTPCInverseCorrection::AliTPCInverseCorrection(AliTPCCorrection *correction)
43 : fCorrection(correction) {
44 //
45 // Constructor that is creating the inverse of the supplied correction.
46 // It automatically sets the name ("inv_[correction name]") and tile
47 // ("Inverse of [correction title]").
48 //
49 TString name,title;
50 name ="inv_";
51 name +=correction->GetName();
52 title ="Inverse of ";
53 title+=correction->GetTitle();
54 SetName(name.Data());
55 SetTitle(title.Data());
56}
57
58AliTPCInverseCorrection::~AliTPCInverseCorrection() {
59 //
60 // virtual destructor
61 //
62}
63
64void AliTPCInverseCorrection::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
65 //
66 // This is just calling the CalculateInverseCorrection of the wrapped
67 // correction -- or puts dr=0 if the latter is 0.
68 //
69 if (fCorrection)
70 fCorrection->GetDistortion(x,roc,dx);
71 else
72 for (Int_t j=0;j<3;++j) dx[j]=0.;
73}
74
75void AliTPCInverseCorrection::GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]) {
76 //
77 // This is just calling the CalculateCorrection of the wrapped
78 // correction -- or puts dr=0 if the latter is 0.
79 //
80 if (fCorrection)
81 fCorrection->GetCorrection(x,roc,dx);
82 else
83 for (Int_t j=0;j<3;++j) dx[j]=0.;
84}
85
86ClassImp(AliTPCInverseCorrection)