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