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