Reco parameters were adjusted to make consistent a reconstruction
[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   fEMCClusteringThreshold(0.2),
36   fEMCLocMaxCut(0.03),
37   fEMCRawDigitThreshold(2),
38   fEMCMinE(0.012),
39   fEMCW0(4.5),
40   fEMCSampleQualityCut(1.),
41   fEMCEcoreRadius(3.),
42   fEMCEcore2ESD(kFALSE),
43   fEMCSubtractPedestals(kTRUE),
44   fEMCUnfold(kTRUE),
45   fEMCEnergyCorrectionOn(kTRUE),
46   fEMCDecoderVersion(""),
47   fGlobalAltroOffset(0),
48   fCPVClusteringThreshold(0.0),
49   fCPVLocMaxCut(0.03),
50   fCPVMinE(0.0),
51   fCPVW0(4.0),
52   fCPVUnfold(kTRUE)
53 {
54   //Default constructor.
55 }
56
57 //-----------------------------------------------------------------------------
58 AliPHOSRecoParam::AliPHOSRecoParam(const AliPHOSRecoParam& ):
59   AliDetectorRecoParam(),
60   fEMCClusteringThreshold(0.2),
61   fEMCLocMaxCut(0.03),
62   fEMCRawDigitThreshold(2),
63   fEMCMinE(0.012),
64   fEMCW0(4.5),
65   fEMCSampleQualityCut(1.),
66   fEMCEcoreRadius(3.),
67   fEMCEcore2ESD(kFALSE),
68   fEMCSubtractPedestals(kTRUE),
69   fEMCUnfold(kTRUE),
70   fEMCEnergyCorrectionOn(kTRUE),
71   fEMCDecoderVersion(""),
72   fGlobalAltroOffset(0),
73   fCPVClusteringThreshold(0.0),
74   fCPVLocMaxCut(0.03),
75   fCPVMinE(0.0),
76   fCPVW0(4.0),
77   fCPVUnfold(kTRUE)
78 {
79   //Copy constructor.
80 }
81
82 //-----------------------------------------------------------------------------
83 AliPHOSRecoParam& AliPHOSRecoParam::operator = (const AliPHOSRecoParam& recoParam)
84 {
85   //Assignment operator.
86
87   if(this != &recoParam) {
88     fEMCClusteringThreshold = recoParam.fEMCClusteringThreshold;
89     fEMCLocMaxCut           = recoParam.fEMCLocMaxCut;
90     fEMCRawDigitThreshold   = recoParam.fEMCRawDigitThreshold;
91     fEMCMinE                = recoParam.fEMCMinE;
92     fEMCW0                  = recoParam.fEMCW0;
93     fEMCSampleQualityCut    = recoParam.fEMCSampleQualityCut;
94     fEMCEcoreRadius         = recoParam.fEMCEcoreRadius;
95     fEMCEcore2ESD           = recoParam.fEMCEcore2ESD;
96     fEMCSubtractPedestals   = recoParam.fEMCSubtractPedestals;
97     fEMCUnfold              = recoParam.fEMCUnfold;
98     fEMCEnergyCorrectionOn  = recoParam.fEMCEnergyCorrectionOn;
99     fEMCDecoderVersion      = recoParam.fEMCDecoderVersion;
100     fGlobalAltroOffset      = recoParam.fGlobalAltroOffset;
101     fCPVClusteringThreshold = recoParam.fCPVClusteringThreshold;
102     fCPVLocMaxCut           = recoParam.fCPVLocMaxCut;
103     fCPVMinE                = recoParam.fCPVMinE;
104     fCPVW0                  = recoParam.fCPVW0;
105     fCPVUnfold              = recoParam.fCPVUnfold;
106   }
107
108   return *this;
109 }
110
111 //-----------------------------------------------------------------------------
112 void AliPHOSRecoParam::Print(Option_t * /*option*/) const
113 {
114   AliDebug(2,Form("PHOS reconstruction parameters:\n"
115                   "\tEMCClusteringThreshold = %f\n"
116                   "\tEMCLocMaxCut           = %f\n"
117                   "\tEMCRawDigitThreshold   = %f\n"
118                   "\tEMCMinE                = %f\n"
119                   "\tEMCW0                  = %f\n"
120                   "\tEMCSampleQualityCut    = %f\n"
121                   "\tEMCEcoreRadius         = %f\n"
122                   "\tEMCEcore2ESD           = %d\n"
123                   "\tEMCSubtractPedestals   = %d\n"
124                   "\tEMCUnfold              = %d\n"
125                   "\tEMCEnergyCorrectionOn  = %d\n"
126                   "\tEMCDecoderVersion      = \"%s\"\n"
127                   "\tGlobalAltroOffset      = %d",
128                   fEMCClusteringThreshold,
129                   fEMCLocMaxCut,
130                   fEMCRawDigitThreshold,
131                   fEMCMinE,
132                   fEMCW0,
133                   fEMCSampleQualityCut,
134                   fEMCEcoreRadius,
135                   fEMCEcore2ESD,
136                   fEMCSubtractPedestals,
137                   fEMCUnfold,
138                   fEMCEnergyCorrectionOn,
139                   fEMCDecoderVersion.Data(),
140                   fGlobalAltroOffset));
141
142 }
143
144 //-----------------------------------------------------------------------------
145 AliPHOSRecoParam* AliPHOSRecoParam::GetDefaultParameters()
146 {
147   //Default parameters for the reconstruction
148
149   AliPHOSRecoParam* params = new AliPHOSRecoParam();
150   return params;
151 }
152
153 //-----------------------------------------------------------------------------
154 const TObjArray* AliPHOSRecoParam::GetMappings()
155 {
156   //Returns array of AliAltroMappings for RCU0..RCU3.
157   //If not found, read it from OCDB.
158
159   //Quick check as follows:
160   //  root [0] AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
161   //  root [1] AliCDBManager::Instance()->SetRun(1);
162   //  root [2] TObjArray* maps = AliPHOSRecoParam::GetMappings();
163   //  root [3] maps->Print();
164   
165   if(fgkMaps) return fgkMaps;
166   
167   AliCDBEntry* entry = AliCDBManager::Instance()->Get("PHOS/Calib/Mapping");
168   if(entry)
169     fgkMaps = (TObjArray*)entry->GetObject();
170   
171   return fgkMaps;
172   
173 }