]>
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 // | |
19 | // marian.ivanov@cern.ch // | |
20 | // // | |
21 | /////////////////////////////////////////////////////////////////////////////// | |
22 | ||
23 | #include "AliTRDclusterCorrection.h" | |
24 | #include "TFile.h" | |
25 | ||
26 | ClassImp(AliTRDclusterCorrection) | |
27 | ||
6528d411 | 28 | AliTRDclusterCorrection * gAliTRDclusterCorrection=0; |
456396b8 | 29 | |
6528d411 | 30 | //_____________________________________________________________________________ |
456396b8 | 31 | AliTRDclusterCorrection::AliTRDclusterCorrection() |
32 | { | |
33 | // | |
34 | //default constructor for correction | |
35 | // | |
6528d411 | 36 | |
37 | for (Int_t iplane=0;iplane<6;iplane++) { | |
38 | for (Int_t itime=0;itime<30;itime++) { | |
456396b8 | 39 | for(Int_t iangle=0;iangle<20;iangle++){ |
40 | fCorrections[iplane][itime][iangle][0]=0; | |
41 | fCorrections[iplane][itime][iangle][1]=0; | |
42 | } | |
6528d411 | 43 | } |
44 | } | |
45 | ||
456396b8 | 46 | fOffsetAngle =0; |
456396b8 | 47 | |
6528d411 | 48 | } |
456396b8 | 49 | |
6528d411 | 50 | //_____________________________________________________________________________ |
456396b8 | 51 | void AliTRDclusterCorrection::SetCorrection(Int_t plane,Int_t timebin, Float_t angle, |
52 | Float_t value, Float_t sigma) | |
53 | { | |
6528d411 | 54 | // |
55 | // Set the correction factors | |
56 | // | |
57 | ||
456396b8 | 58 | Int_t iangle = int( (angle-fOffsetAngle+1.)*10.+0.5); |
59 | if (iangle<0) return; | |
60 | if (iangle>=20) return; | |
61 | fCorrections[plane][timebin][iangle][0] = value; | |
62 | fCorrections[plane][timebin][iangle][1] = sigma; | |
6528d411 | 63 | |
456396b8 | 64 | } |
65 | ||
6528d411 | 66 | //_____________________________________________________________________________ |
67 | Float_t AliTRDclusterCorrection::GetCorrection(Int_t plane, Int_t timebin, Float_t angle) const | |
456396b8 | 68 | { |
6528d411 | 69 | // |
70 | // Get the correction factors | |
71 | // | |
72 | ||
456396b8 | 73 | Int_t iangle = int( (angle-fOffsetAngle+1.)*10.+0.5); |
74 | if (iangle<0) return 0.; | |
75 | if (iangle>=20) return 0.; | |
76 | return fCorrections[plane][timebin][iangle][0]; | |
6528d411 | 77 | |
456396b8 | 78 | } |
79 | ||
6528d411 | 80 | //_____________________________________________________________________________ |
81 | Float_t AliTRDclusterCorrection::GetSigma(Int_t plane, Int_t timebin, Float_t angle) const | |
456396b8 | 82 | { |
6528d411 | 83 | // |
84 | // Returns the sigma | |
85 | // | |
86 | ||
456396b8 | 87 | Int_t iangle = int( (angle-fOffsetAngle+1.)*10.+0.5); |
88 | if (iangle<0) return 1.; | |
89 | if (iangle>=20) return 1.; | |
90 | return fCorrections[plane][timebin][iangle][1]; | |
456396b8 | 91 | |
6528d411 | 92 | } |
456396b8 | 93 | |
6528d411 | 94 | //_____________________________________________________________________________ |
456396b8 | 95 | AliTRDclusterCorrection * AliTRDclusterCorrection::GetCorrection() |
96 | { | |
6528d411 | 97 | // |
98 | // Return an instance of AliTRDclusterCorrection | |
99 | // | |
100 | ||
101 | if (gAliTRDclusterCorrection!=0) return gAliTRDclusterCorrection; | |
456396b8 | 102 | // |
103 | TFile * f = new TFile("$ALICE_ROOT/TRD/TRDcorrection.root"); | |
104 | if (!f){ | |
105 | //// | |
6528d411 | 106 | gAliTRDclusterCorrection = new AliTRDclusterCorrection(); |
107 | return gAliTRDclusterCorrection; | |
456396b8 | 108 | } |
6528d411 | 109 | gAliTRDclusterCorrection = (AliTRDclusterCorrection*) f->Get("TRDcorrection"); |
110 | if (gAliTRDclusterCorrection==0) | |
111 | gAliTRDclusterCorrection = new AliTRDclusterCorrection(); | |
112 | ||
113 | return gAliTRDclusterCorrection; | |
456396b8 | 114 | |
115 | } |