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