]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSRecoParam.cxx
Modifications to allow reclusterization during analysis
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecoParam.cxx
1 /**************************************************************************
2  * Copyright(c) 2007, 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 /* $Id$ */
17
18 // Base class for the PHOS reconstruction parameters.
19 // Do not use in the reconstruction; use derivative classes instead.
20 // Author: Boris Polichtchouk.
21
22 // --- AliRoot header files ---
23 #include "AliCDBManager.h"
24 #include "AliCDBEntry.h"
25 #include "AliLog.h"
26 #include "AliPHOSRecoParam.h"
27
28 ClassImp(AliPHOSRecoParam)
29
30 TObjArray* AliPHOSRecoParam::fgkMaps =0; //ALTRO mappings
31
32 //-----------------------------------------------------------------------------
33 AliPHOSRecoParam::AliPHOSRecoParam() :
34   AliDetectorRecoParam(),
35   fNonLinearityParams(3),
36   fEMCClusteringThreshold(0.2),
37   fEMCLocMaxCut(0.03),
38   fEMCRawDigitThreshold(2),
39   fEMCMinE(0.012),
40   fEMCW0(4.5),
41   fEMCSampleQualityCut(1.),
42   fTimeGateAmpThresh(10.),
43   fTimeGateLow(1.e-6),
44   fTimeGateHigh(1.e-6),
45   fEMCEcoreRadius(3.),
46   fEMCEcore2ESD(kFALSE),
47   fEMCSubtractPedestals(kTRUE),
48   fEMCUnfold(kTRUE),
49   fEMCEnergyCorrectionOn(kTRUE),
50   fEMCFitterVersion(""),
51   fNonlinearityCorrVersion(""),
52   fGlobalAltroOffset(0),
53   fGlobalAltroThreshold(0),
54   fCPVClusteringThreshold(0.0),
55   fCPVLocMaxCut(0.03),
56   fCPVMinE(0.0),
57   fCPVW0(4.0),
58   fCPVUnfold(kTRUE)
59 {
60   //Default constructor.
61   SetNonlinearityCorrectionVersion("Gustavo2005") ;
62 }
63
64 //-----------------------------------------------------------------------------
65 AliPHOSRecoParam::AliPHOSRecoParam(const AliPHOSRecoParam& ):
66   AliDetectorRecoParam(),
67   fNonLinearityParams(3),
68   fEMCClusteringThreshold(0.2),
69   fEMCLocMaxCut(0.03),
70   fEMCRawDigitThreshold(2),
71   fEMCMinE(0.012),
72   fEMCW0(4.5),
73   fEMCSampleQualityCut(1.),
74   fTimeGateAmpThresh(10.),
75   fTimeGateLow(1.e-6),
76   fTimeGateHigh(1.e-6),
77   fEMCEcoreRadius(3.),
78   fEMCEcore2ESD(kFALSE),
79   fEMCSubtractPedestals(kTRUE),
80   fEMCUnfold(kTRUE),
81   fEMCEnergyCorrectionOn(kTRUE),
82   fEMCFitterVersion(""),
83   fNonlinearityCorrVersion(""),
84   fGlobalAltroOffset(0),
85   fGlobalAltroThreshold(0),
86   fCPVClusteringThreshold(0.0),
87   fCPVLocMaxCut(0.03),
88   fCPVMinE(0.0),
89   fCPVW0(4.0),
90   fCPVUnfold(kTRUE)
91 {
92   //Copy constructor.
93 }
94
95 //-----------------------------------------------------------------------------
96 AliPHOSRecoParam& AliPHOSRecoParam::operator = (const AliPHOSRecoParam& recoParam)
97 {
98   //Assignment operator.
99
100   if(this != &recoParam) {
101     fNonLinearityParams     = recoParam.fNonLinearityParams;
102     fEMCClusteringThreshold = recoParam.fEMCClusteringThreshold;
103     fEMCLocMaxCut           = recoParam.fEMCLocMaxCut;
104     fEMCRawDigitThreshold   = recoParam.fEMCRawDigitThreshold;
105     fEMCMinE                = recoParam.fEMCMinE;
106     fEMCW0                  = recoParam.fEMCW0;
107     fEMCSampleQualityCut    = recoParam.fEMCSampleQualityCut;
108     fTimeGateAmpThresh      = recoParam.fTimeGateAmpThresh ;
109     fTimeGateLow            = recoParam.fTimeGateLow ;
110     fTimeGateHigh           = recoParam.fTimeGateHigh ;
111     fEMCEcoreRadius         = recoParam.fEMCEcoreRadius;
112     fEMCEcore2ESD           = recoParam.fEMCEcore2ESD;
113     fEMCSubtractPedestals   = recoParam.fEMCSubtractPedestals;
114     fEMCUnfold              = recoParam.fEMCUnfold;
115     fEMCEnergyCorrectionOn  = recoParam.fEMCEnergyCorrectionOn;
116     fEMCFitterVersion       = recoParam.fEMCFitterVersion;
117     fNonlinearityCorrVersion= recoParam.fNonlinearityCorrVersion;
118     fGlobalAltroOffset      = recoParam.fGlobalAltroOffset;
119     fGlobalAltroThreshold   = recoParam.fGlobalAltroThreshold;
120     fCPVClusteringThreshold = recoParam.fCPVClusteringThreshold;
121     fCPVLocMaxCut           = recoParam.fCPVLocMaxCut;
122     fCPVMinE                = recoParam.fCPVMinE;
123     fCPVW0                  = recoParam.fCPVW0;
124     fCPVUnfold              = recoParam.fCPVUnfold;
125     fNonLinearityParams     = recoParam.fNonLinearityParams ;
126   }
127
128   return *this;
129 }
130
131 //-----------------------------------------------------------------------------
132 void AliPHOSRecoParam::Print(Option_t * /*option*/) const
133 {
134   AliDebug(2,Form("PHOS reconstruction parameters:\n"
135                   "\tEMCClusteringThreshold = %f\n"
136                   "\tEMCLocMaxCut           = %f\n"
137                   "\tEMCRawDigitThreshold   = %f\n"
138                   "\tEMCMinE                = %f\n"
139                   "\tEMCW0                  = %f\n"
140                   "\tEMCSampleQualityCut    = %f\n"
141                   "\tEMCEcoreRadius         = %f\n"
142                   "\tEMCEcore2ESD           = %d\n"
143                   "\tEMCSubtractPedestals   = %d\n"
144                   "\tEMCUnfold              = %d\n"
145                   "\tEMCEnergyCorrectionOn  = %d\n"
146                   "\tEMCFitterVersion       = \"%s\"\n"
147                   "\tGlobalAltroOffset      = %d\n"
148                   "\tGlobalAltroThreshold   = %d",
149                   fEMCClusteringThreshold,
150                   fEMCLocMaxCut,
151                   fEMCRawDigitThreshold,
152                   fEMCMinE,
153                   fEMCW0,
154                   fEMCSampleQualityCut,
155                   fEMCEcoreRadius,
156                   fEMCEcore2ESD,
157                   fEMCSubtractPedestals,
158                   fEMCUnfold,
159                   fEMCEnergyCorrectionOn,
160                   fEMCFitterVersion.Data(),
161                   fGlobalAltroOffset,
162                   fGlobalAltroThreshold));
163
164 }
165
166 //-----------------------------------------------------------------------------
167 AliPHOSRecoParam* AliPHOSRecoParam::GetDefaultParameters()
168 {
169   //Default parameters for the reconstruction
170
171   AliPHOSRecoParam* params = new AliPHOSRecoParam();
172   return params;
173 }
174
175 //-----------------------------------------------------------------------------
176 const TObjArray* AliPHOSRecoParam::GetMappings()
177 {
178   //Returns array of AliAltroMappings for RCU0..RCU3.
179   //If not found, read it from OCDB.
180
181   //Quick check as follows:
182   //  root [0] AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
183   //  root [1] AliCDBManager::Instance()->SetRun(1);
184   //  root [2] TObjArray* maps = AliPHOSRecoParam::GetMappings();
185   //  root [3] maps->Print();
186   
187   if(fgkMaps) return fgkMaps;
188   
189   AliCDBEntry* entry = AliCDBManager::Instance()->Get("PHOS/Calib/Mapping");
190   if(entry)
191     fgkMaps = (TObjArray*)entry->GetObject();
192   
193   return fgkMaps;
194   
195 }
196 //-----------------------------------------------------------------------------
197 void AliPHOSRecoParam::SetNonlinearityCorrectionVersion(const char * ver){
198   //Set non-linearity correction version and adjust parameters
199
200   if(strcmp(ver,"NoCorrection")==0){
201     fNonLinearityParams.Set(1) ;
202     fNonLinearityParams.AddAt(0.,0) ;
203     fNonlinearityCorrVersion=ver ;
204     return ;
205   }
206   if(strcmp(ver,"Henrik2010")==0){
207     Float_t pars[7]={1.051,2.54e-003,-1.737e-002,5.69e-002,3.3e-001,1.42e-001,1.50e-002} ;
208     fNonLinearityParams.Set(7,pars) ;
209     fNonlinearityCorrVersion=ver ;
210     return ;
211   }
212   if(strcmp(ver,"Gustavo2005")==0){
213     Float_t pars[3]={0.0241, 1.0504, 0.000249} ;
214     fNonLinearityParams.Set(3,pars) ;
215     fNonlinearityCorrVersion=ver ;
216     return ;
217   }
218   AliError(Form("Non known correction version: %s, still using default \n",ver)) ;
219
220
221 }