ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// AliTPCInverseCorrection class                                              //
//                                                                            //
// This is a wrapper that inverts an AliTPCCorrection. This is done by        //
// swapping the CalculateCorrection and CalculateInverseCorrection functions. //
// The wrapped correction is supplied as a pointer and the class relies       //
// on the fact, that this pointer keeps pointing to the right object.         //
// However, the ownership is not changed, i.e. the wrapped correction         //
// will not be deleted when this correction is destructed.                    //
//                                                                            //
// date: 27/04/2010                                                           //
// Authors: Magnus Mager, Stefan Rossegger, Jim Thomas                        //
////////////////////////////////////////////////////////////////////////////////

#include <TString.h>
#include "AliTPCInverseCorrection.h"
#include <TTimeStamp.h>


AliTPCInverseCorrection::AliTPCInverseCorrection()
  : fCorrection(0) {
  //
  // default constructor
  // (only meant for ROOT I/O)
  //
}

AliTPCInverseCorrection::AliTPCInverseCorrection(AliTPCCorrection *correction) 
  : fCorrection(correction) {
  //
  // Constructor that is creating the inverse of the supplied correction.
  // It automatically sets the name ("inv_[correction name]") and tile
  // ("Inverse of [correction title]").
  //
  TString name,title;
  name  ="inv_";
  name +=correction->GetName();
  title ="Inverse of ";
  title+=correction->GetTitle();
  SetName(name.Data());
  SetTitle(title.Data());
}

AliTPCInverseCorrection::~AliTPCInverseCorrection() {
  //
  // virtual destructor
  //
  if (fCorrection) delete fCorrection;
}


void AliTPCInverseCorrection::Init() {
  //
  // Initialization funtion (not used at the moment)
  //
  if (fCorrection) fCorrection->Init();

}

void AliTPCInverseCorrection::Update(const TTimeStamp &timeStamp) {
  //
  // Update function 
  //
  if (fCorrection) fCorrection->Update(timeStamp);

}

void AliTPCInverseCorrection::Print(Option_t* option) const {
  //
  // Print function to check which correction classes are used 
  // option=="d" prints details regarding the setted magnitude 
  // option=="a" prints the C0 and C1 coefficents for calibration purposes
  //

  printf("Inverse of ");
  if (fCorrection) fCorrection->Print(option);
}

void AliTPCInverseCorrection::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
  //
  // This is just calling the CalculateInverseCorrection of the wrapped
  // correction -- or puts dr=0 if the latter is 0.
  //
  if (fCorrection)
    fCorrection->GetDistortion(x,roc,dx);
  else
    for (Int_t j=0;j<3;++j) dx[j]=0.;
}

void AliTPCInverseCorrection:: SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2) {
  //
  // Virtual funtion to pass the wt values (might become event dependent) to the inherited classes
  // t1 and t2 represent the "effective omegaTau" corrections and were measured in a dedicated
  // calibration run
  //
  if (fCorrection) fCorrection->SetOmegaTauT1T2(omegaTau, t1, t2);
}

void AliTPCInverseCorrection::GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]) {
  //
  // This is just calling the CalculateCorrection of the wrapped
  // correction -- or puts dr=0 if the latter is 0.
  //
  if (fCorrection)
    fCorrection->GetCorrection(x,roc,dx);
  else
    for (Int_t j=0;j<3;++j) dx[j]=0.;
}

ClassImp(AliTPCInverseCorrection)
 AliTPCInverseCorrection.cxx:1
 AliTPCInverseCorrection.cxx:2
 AliTPCInverseCorrection.cxx:3
 AliTPCInverseCorrection.cxx:4
 AliTPCInverseCorrection.cxx:5
 AliTPCInverseCorrection.cxx:6
 AliTPCInverseCorrection.cxx:7
 AliTPCInverseCorrection.cxx:8
 AliTPCInverseCorrection.cxx:9
 AliTPCInverseCorrection.cxx:10
 AliTPCInverseCorrection.cxx:11
 AliTPCInverseCorrection.cxx:12
 AliTPCInverseCorrection.cxx:13
 AliTPCInverseCorrection.cxx:14
 AliTPCInverseCorrection.cxx:15
 AliTPCInverseCorrection.cxx:16
 AliTPCInverseCorrection.cxx:17
 AliTPCInverseCorrection.cxx:18
 AliTPCInverseCorrection.cxx:19
 AliTPCInverseCorrection.cxx:20
 AliTPCInverseCorrection.cxx:21
 AliTPCInverseCorrection.cxx:22
 AliTPCInverseCorrection.cxx:23
 AliTPCInverseCorrection.cxx:24
 AliTPCInverseCorrection.cxx:25
 AliTPCInverseCorrection.cxx:26
 AliTPCInverseCorrection.cxx:27
 AliTPCInverseCorrection.cxx:28
 AliTPCInverseCorrection.cxx:29
 AliTPCInverseCorrection.cxx:30
 AliTPCInverseCorrection.cxx:31
 AliTPCInverseCorrection.cxx:32
 AliTPCInverseCorrection.cxx:33
 AliTPCInverseCorrection.cxx:34
 AliTPCInverseCorrection.cxx:35
 AliTPCInverseCorrection.cxx:36
 AliTPCInverseCorrection.cxx:37
 AliTPCInverseCorrection.cxx:38
 AliTPCInverseCorrection.cxx:39
 AliTPCInverseCorrection.cxx:40
 AliTPCInverseCorrection.cxx:41
 AliTPCInverseCorrection.cxx:42
 AliTPCInverseCorrection.cxx:43
 AliTPCInverseCorrection.cxx:44
 AliTPCInverseCorrection.cxx:45
 AliTPCInverseCorrection.cxx:46
 AliTPCInverseCorrection.cxx:47
 AliTPCInverseCorrection.cxx:48
 AliTPCInverseCorrection.cxx:49
 AliTPCInverseCorrection.cxx:50
 AliTPCInverseCorrection.cxx:51
 AliTPCInverseCorrection.cxx:52
 AliTPCInverseCorrection.cxx:53
 AliTPCInverseCorrection.cxx:54
 AliTPCInverseCorrection.cxx:55
 AliTPCInverseCorrection.cxx:56
 AliTPCInverseCorrection.cxx:57
 AliTPCInverseCorrection.cxx:58
 AliTPCInverseCorrection.cxx:59
 AliTPCInverseCorrection.cxx:60
 AliTPCInverseCorrection.cxx:61
 AliTPCInverseCorrection.cxx:62
 AliTPCInverseCorrection.cxx:63
 AliTPCInverseCorrection.cxx:64
 AliTPCInverseCorrection.cxx:65
 AliTPCInverseCorrection.cxx:66
 AliTPCInverseCorrection.cxx:67
 AliTPCInverseCorrection.cxx:68
 AliTPCInverseCorrection.cxx:69
 AliTPCInverseCorrection.cxx:70
 AliTPCInverseCorrection.cxx:71
 AliTPCInverseCorrection.cxx:72
 AliTPCInverseCorrection.cxx:73
 AliTPCInverseCorrection.cxx:74
 AliTPCInverseCorrection.cxx:75
 AliTPCInverseCorrection.cxx:76
 AliTPCInverseCorrection.cxx:77
 AliTPCInverseCorrection.cxx:78
 AliTPCInverseCorrection.cxx:79
 AliTPCInverseCorrection.cxx:80
 AliTPCInverseCorrection.cxx:81
 AliTPCInverseCorrection.cxx:82
 AliTPCInverseCorrection.cxx:83
 AliTPCInverseCorrection.cxx:84
 AliTPCInverseCorrection.cxx:85
 AliTPCInverseCorrection.cxx:86
 AliTPCInverseCorrection.cxx:87
 AliTPCInverseCorrection.cxx:88
 AliTPCInverseCorrection.cxx:89
 AliTPCInverseCorrection.cxx:90
 AliTPCInverseCorrection.cxx:91
 AliTPCInverseCorrection.cxx:92
 AliTPCInverseCorrection.cxx:93
 AliTPCInverseCorrection.cxx:94
 AliTPCInverseCorrection.cxx:95
 AliTPCInverseCorrection.cxx:96
 AliTPCInverseCorrection.cxx:97
 AliTPCInverseCorrection.cxx:98
 AliTPCInverseCorrection.cxx:99
 AliTPCInverseCorrection.cxx:100
 AliTPCInverseCorrection.cxx:101
 AliTPCInverseCorrection.cxx:102
 AliTPCInverseCorrection.cxx:103
 AliTPCInverseCorrection.cxx:104
 AliTPCInverseCorrection.cxx:105
 AliTPCInverseCorrection.cxx:106
 AliTPCInverseCorrection.cxx:107
 AliTPCInverseCorrection.cxx:108
 AliTPCInverseCorrection.cxx:109
 AliTPCInverseCorrection.cxx:110
 AliTPCInverseCorrection.cxx:111
 AliTPCInverseCorrection.cxx:112
 AliTPCInverseCorrection.cxx:113
 AliTPCInverseCorrection.cxx:114
 AliTPCInverseCorrection.cxx:115
 AliTPCInverseCorrection.cxx:116
 AliTPCInverseCorrection.cxx:117
 AliTPCInverseCorrection.cxx:118
 AliTPCInverseCorrection.cxx:119
 AliTPCInverseCorrection.cxx:120
 AliTPCInverseCorrection.cxx:121
 AliTPCInverseCorrection.cxx:122
 AliTPCInverseCorrection.cxx:123
 AliTPCInverseCorrection.cxx:124
 AliTPCInverseCorrection.cxx:125
 AliTPCInverseCorrection.cxx:126