1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
18 // TRD clusterCorrection //
20 // Marian Ivanov (marian.ivanov@cern.ch) //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliTRDclusterCorrection.h"
27 ClassImp(AliTRDclusterCorrection)
29 AliTRDclusterCorrection *gAliTRDclusterCorrection = 0;
31 //_____________________________________________________________________________
32 AliTRDclusterCorrection::AliTRDclusterCorrection()
37 // Default constructor for AliTRDclusterCorrection
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;
51 //_____________________________________________________________________________
52 AliTRDclusterCorrection::~AliTRDclusterCorrection()
60 //_____________________________________________________________________________
61 void AliTRDclusterCorrection::SetCorrection(Int_t plane,Int_t timebin, Float_t angle
62 , Float_t value, Float_t sigma)
65 // Set the correction factors
68 Int_t iangle = Int_t((angle - fOffsetAngle + 1.0) * 10.0 + 0.5);
69 if (iangle < 0) return;
70 if (iangle >= 20) return;
71 fCorrections[plane][timebin][iangle][0] = value;
72 fCorrections[plane][timebin][iangle][1] = sigma;
76 //_____________________________________________________________________________
77 Float_t AliTRDclusterCorrection::GetCorrection(Int_t plane, Int_t timebin, Float_t angle) const
80 // Get the correction factors
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;
87 return fCorrections[plane][timebin][iangle][0];
91 //_____________________________________________________________________________
92 Float_t AliTRDclusterCorrection::GetSigma(Int_t plane, Int_t timebin, Float_t angle) const
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;
102 return fCorrections[plane][timebin][iangle][1];
106 //_____________________________________________________________________________
107 AliTRDclusterCorrection *AliTRDclusterCorrection::GetCorrection()
110 // Return an instance of AliTRDclusterCorrection and sets the global
111 // pointer gAliTRDclusterCorrection (Is this needed somewhere ????)
114 if (gAliTRDclusterCorrection != 0) {
115 return gAliTRDclusterCorrection;
118 TFile *fileIn = new TFile("$ALICE_ROOT/TRD/TRDcorrection.root");
120 gAliTRDclusterCorrection = new AliTRDclusterCorrection();
121 return gAliTRDclusterCorrection;
124 gAliTRDclusterCorrection = (AliTRDclusterCorrection *)
125 fileIn->Get("TRDcorrection");
126 if (gAliTRDclusterCorrection == 0) {
127 gAliTRDclusterCorrection = new AliTRDclusterCorrection();
130 return gAliTRDclusterCorrection;