]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCInverseCorrection.cxx
macro to run on alien
[u/mrichter/AliRoot.git] / TPC / AliTPCInverseCorrection.cxx
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 #include <TTimeStamp.h>
34
35
36 AliTPCInverseCorrection::AliTPCInverseCorrection()
37   : fCorrection(0) {
38   //
39   // default constructor
40   // (only meant for ROOT I/O)
41   //
42 }
43
44 AliTPCInverseCorrection::AliTPCInverseCorrection(AliTPCCorrection *correction) 
45   : fCorrection(correction) {
46   //
47   // Constructor that is creating the inverse of the supplied correction.
48   // It automatically sets the name ("inv_[correction name]") and tile
49   // ("Inverse of [correction title]").
50   //
51   TString name,title;
52   name  ="inv_";
53   name +=correction->GetName();
54   title ="Inverse of ";
55   title+=correction->GetTitle();
56   SetName(name.Data());
57   SetTitle(title.Data());
58 }
59
60 AliTPCInverseCorrection::~AliTPCInverseCorrection() {
61   //
62   // virtual destructor
63   //
64 }
65
66
67 void AliTPCInverseCorrection::Init() {
68   //
69   // Initialization funtion (not used at the moment)
70   //
71   if (fCorrection) fCorrection->Init();
72
73 }
74
75 void AliTPCInverseCorrection::Update(const TTimeStamp &timeStamp) {
76   //
77   // Update function 
78   //
79   if (fCorrection) fCorrection->Update(timeStamp);
80
81 }
82
83 void AliTPCInverseCorrection::Print(Option_t* option) const {
84   //
85   // Print function to check which correction classes are used 
86   // option=="d" prints details regarding the setted magnitude 
87   // option=="a" prints the C0 and C1 coefficents for calibration purposes
88   //
89
90   printf("Inverse of ");
91   if (fCorrection) fCorrection->Print(option);
92 }
93
94 void AliTPCInverseCorrection::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
95   //
96   // This is just calling the CalculateInverseCorrection of the wrapped
97   // correction -- or puts dr=0 if the latter is 0.
98   //
99   if (fCorrection)
100     fCorrection->GetDistortion(x,roc,dx);
101   else
102     for (Int_t j=0;j<3;++j) dx[j]=0.;
103 }
104
105 void AliTPCInverseCorrection:: SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2) {
106   //
107   // Virtual funtion to pass the wt values (might become event dependent) to the inherited classes
108   // t1 and t2 represent the "effective omegaTau" corrections and were measured in a dedicated
109   // calibration run
110   //
111   if (fCorrection) fCorrection->SetOmegaTauT1T2(omegaTau, t1, t2);
112 }
113
114 void AliTPCInverseCorrection::GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]) {
115   //
116   // This is just calling the CalculateCorrection of the wrapped
117   // correction -- or puts dr=0 if the latter is 0.
118   //
119   if (fCorrection)
120     fCorrection->GetCorrection(x,roc,dx);
121   else
122     for (Int_t j=0;j<3;++j) dx[j]=0.;
123 }
124
125 ClassImp(AliTPCInverseCorrection)