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