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