]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDclusterCorrection.cxx
Adding new classes (Laurent)
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterCorrection.cxx
CommitLineData
456396b8 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// TRD clusterCorrection //
15ed8ba1 19// Author: //
20// Marian Ivanov (marian.ivanov@cern.ch) //
456396b8 21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliTRDclusterCorrection.h"
25#include "TFile.h"
26
27ClassImp(AliTRDclusterCorrection)
28
15ed8ba1 29AliTRDclusterCorrection *gAliTRDclusterCorrection = 0;
456396b8 30
6528d411 31//_____________________________________________________________________________
456396b8 32AliTRDclusterCorrection::AliTRDclusterCorrection()
15ed8ba1 33 :TObject()
34 ,fOffsetAngle(0)
456396b8 35{
36 //
15ed8ba1 37 // Default constructor for AliTRDclusterCorrection
456396b8 38 //
6528d411 39
15ed8ba1 40 for (Int_t iplane = 0; iplane < 6; iplane++) {
41 for (Int_t itime = 0; itime < 30; itime++) {
42 for (Int_t iangle = 0; iangle < 20; iangle++) {
43 fCorrections[iplane][itime][iangle][0] = 0.0;
44 fCorrections[iplane][itime][iangle][1] = 0.0;
456396b8 45 }
6528d411 46 }
47 }
48
15ed8ba1 49}
50
51//_____________________________________________________________________________
52AliTRDclusterCorrection::~AliTRDclusterCorrection()
53{
54 //
55 // Destructor
56 //
456396b8 57
6528d411 58}
456396b8 59
6528d411 60//_____________________________________________________________________________
15ed8ba1 61void AliTRDclusterCorrection::SetCorrection(Int_t plane,Int_t timebin, Float_t angle
62 , Float_t value, Float_t sigma)
456396b8 63{
6528d411 64 //
65 // Set the correction factors
66 //
67
15ed8ba1 68 Int_t iangle = Int_t((angle - fOffsetAngle + 1.0) * 10.0 + 0.5);
69 if (iangle < 0) return;
70 if (iangle >= 20) return;
456396b8 71 fCorrections[plane][timebin][iangle][0] = value;
72 fCorrections[plane][timebin][iangle][1] = sigma;
6528d411 73
456396b8 74}
75
6528d411 76//_____________________________________________________________________________
77Float_t AliTRDclusterCorrection::GetCorrection(Int_t plane, Int_t timebin, Float_t angle) const
456396b8 78{
6528d411 79 //
80 // Get the correction factors
81 //
82
15ed8ba1 83 Int_t iangle = Int_t((angle - fOffsetAngle + 1.0) * 10.0 + 0.5);
84 if (iangle < 0) return 0.0;
85 if (iangle >= 20) return 0.0;
86
456396b8 87 return fCorrections[plane][timebin][iangle][0];
6528d411 88
456396b8 89}
90
6528d411 91//_____________________________________________________________________________
92Float_t AliTRDclusterCorrection::GetSigma(Int_t plane, Int_t timebin, Float_t angle) const
456396b8 93{
6528d411 94 //
95 // Returns the sigma
96 //
97
15ed8ba1 98 Int_t iangle = Int_t((angle - fOffsetAngle + 1.0) * 10.0 + 0.5);
99 if (iangle < 0) return 1.0;
100 if (iangle >= 20) return 1.0;
101
456396b8 102 return fCorrections[plane][timebin][iangle][1];
456396b8 103
6528d411 104}
456396b8 105
6528d411 106//_____________________________________________________________________________
15ed8ba1 107AliTRDclusterCorrection *AliTRDclusterCorrection::GetCorrection()
456396b8 108{
6528d411 109 //
15ed8ba1 110 // Return an instance of AliTRDclusterCorrection and sets the global
111 // pointer gAliTRDclusterCorrection (Is this needed somewhere ????)
6528d411 112 //
113
15ed8ba1 114 if (gAliTRDclusterCorrection != 0) {
115 return gAliTRDclusterCorrection;
116 }
117
118 TFile *fileIn = new TFile("$ALICE_ROOT/TRD/TRDcorrection.root");
119 if (!fileIn){
6528d411 120 gAliTRDclusterCorrection = new AliTRDclusterCorrection();
121 return gAliTRDclusterCorrection;
456396b8 122 }
15ed8ba1 123
124 gAliTRDclusterCorrection = (AliTRDclusterCorrection *)
125 fileIn->Get("TRDcorrection");
126 if (gAliTRDclusterCorrection == 0) {
6528d411 127 gAliTRDclusterCorrection = new AliTRDclusterCorrection();
15ed8ba1 128 }
6528d411 129
130 return gAliTRDclusterCorrection;
456396b8 131
132}