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