]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDclusterCorrection.cxx
Additional protection (Yu.Belikov)
[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 //
19// marian.ivanov@cern.ch //
20// //
21///////////////////////////////////////////////////////////////////////////////
22
23#include "AliTRDclusterCorrection.h"
24#include "TFile.h"
25
26ClassImp(AliTRDclusterCorrection)
27
28AliTRDclusterCorrection * gTRDclusterCorrection=0;
29
30AliTRDclusterCorrection::AliTRDclusterCorrection()
31{
32 //
33 //default constructor for correction
34 //
35 for (Int_t iplane=0;iplane<6;iplane++)
36 for (Int_t itime=0;itime<30;itime++)
37 for(Int_t iangle=0;iangle<20;iangle++){
38 fCorrections[iplane][itime][iangle][0]=0;
39 fCorrections[iplane][itime][iangle][1]=0;
40 }
41 fOffsetAngle =0;
42}
43
44
45void AliTRDclusterCorrection::SetCorrection(Int_t plane,Int_t timebin, Float_t angle,
46 Float_t value, Float_t sigma)
47{
48 Int_t iangle = int( (angle-fOffsetAngle+1.)*10.+0.5);
49 if (iangle<0) return;
50 if (iangle>=20) return;
51 fCorrections[plane][timebin][iangle][0] = value;
52 fCorrections[plane][timebin][iangle][1] = sigma;
53}
54
55Float_t AliTRDclusterCorrection::GetCorrection(Int_t plane, Int_t timebin, Float_t angle)
56{
57 Int_t iangle = int( (angle-fOffsetAngle+1.)*10.+0.5);
58 if (iangle<0) return 0.;
59 if (iangle>=20) return 0.;
60 return fCorrections[plane][timebin][iangle][0];
61}
62
63Float_t AliTRDclusterCorrection::GetSigma(Int_t plane, Int_t timebin, Float_t angle)
64{
65 Int_t iangle = int( (angle-fOffsetAngle+1.)*10.+0.5);
66 if (iangle<0) return 1.;
67 if (iangle>=20) return 1.;
68 return fCorrections[plane][timebin][iangle][1];
69}
70
71
72AliTRDclusterCorrection * AliTRDclusterCorrection::GetCorrection()
73{
74 if (gTRDclusterCorrection!=0) return gTRDclusterCorrection;
75 //
76 TFile * f = new TFile("$ALICE_ROOT/TRD/TRDcorrection.root");
77 if (!f){
78 ////
79 gTRDclusterCorrection = new AliTRDclusterCorrection();
80 return gTRDclusterCorrection;
81 }
82 gTRDclusterCorrection = (AliTRDclusterCorrection*)f->Get("TRDcorrection");
83 if (gTRDclusterCorrection==0) gTRDclusterCorrection = new AliTRDclusterCorrection();
84 return gTRDclusterCorrection;
85
86}