- fixing warnings/coverity
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSDD.cxx
CommitLineData
fcf95fc7 1/**************************************************************************
c2bd28b6 2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
fcf95fc7 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
c2bd28b6 16/* $Id$ */
fcf95fc7 17
18#include <Riostream.h>
19#include <TRandom.h>
20#include "AliITSCalibrationSDD.h"
f45f6658 21#include "AliLog.h"
fcf95fc7 22
23//////////////////////////////////////////////////////
24// Calibration class for set:ITS //
25// Specific subdetector implementation //
26// for silicon drift detectors //
27// //
28// //
29//////////////////////////////////////////////////////
30
4bfbde86 31const Float_t AliITSCalibrationSDD::fgkTemperatureDefault = 296.;
20f3f947 32const Float_t AliITSCalibrationSDD::fgkNoiseDefault = 2.38;
4bfbde86 33const Float_t AliITSCalibrationSDD::fgkGainDefault = 1.;
34const Float_t AliITSCalibrationSDD::fgkBaselineDefault = 20.;
fcf95fc7 35//______________________________________________________________________
36ClassImp(AliITSCalibrationSDD)
37
4bfbde86 38AliITSCalibrationSDD::AliITSCalibrationSDD():
39AliITSCalibration(),
253e68a0 40fZeroSupp(kTRUE),
b27af87f 41fAMAt20MHz(kFALSE),
4bfbde86 42fDeadChips(0),
43fDeadChannels(0),
eefec958 44fIsBad(kFALSE),
028a3709 45fBadChannels(),
46fMapAW0(0),
47fMapAW1(0),
48fMapTW0(0),
18da6e54 49fMapTW1(0),
50fDrSpeed0(0),
51fDrSpeed1(0)
4bfbde86 52{
fcf95fc7 53 // default constructor
54
55 SetDeadChannels();
f45f6658 56 for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){
57 fBaseline[ian]=fgkBaselineDefault;
58 fNoise[ian]=fgkNoiseDefault;
eefec958 59 fGain[ian]=1.;
f45f6658 60 SetNoiseAfterElectronics(ian);
61 }
62 for(Int_t iw=0;iw<fgkWings;iw++){
20f3f947 63 SetZSLowThreshold(iw);
64 SetZSHighThreshold(iw);
f45f6658 65 for(Int_t icp=0;icp<fgkChips;icp++){
eefec958 66 Int_t chipindex=iw*fgkChips+icp;
67 fIsChipBad[chipindex]=kFALSE;
f45f6658 68 }
69 }
fcf95fc7 70 SetTemperature(fgkTemperatureDefault);
71 SetDataType();
fcf95fc7 72 }
73//______________________________________________________________________
4bfbde86 74AliITSCalibrationSDD::AliITSCalibrationSDD(const char *dataType):
75AliITSCalibration(),
253e68a0 76fZeroSupp(kTRUE),
b27af87f 77fAMAt20MHz(kFALSE),
4bfbde86 78fDeadChips(0),
79fDeadChannels(0),
eefec958 80fIsBad(kFALSE),
028a3709 81fBadChannels(),
82fMapAW0(0),
83fMapAW1(0),
84fMapTW0(0),
18da6e54 85fMapTW1(0),
86fDrSpeed0(0),
87fDrSpeed1(0)
88{
fcf95fc7 89 // constructor
90
91 SetDeadChannels();
f45f6658 92 for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){
93 fBaseline[ian]=fgkBaselineDefault;
eefec958 94 fNoise[ian]=fgkNoiseDefault;
95 fGain[ian]=1.;
96 SetNoiseAfterElectronics(ian);
f45f6658 97 }
98 for(Int_t iw=0;iw<fgkWings;iw++){
20f3f947 99 SetZSLowThreshold(iw);
100 SetZSHighThreshold(iw);
f45f6658 101 for(Int_t icp=0;icp<fgkChips;icp++){
eefec958 102 Int_t chipindex=iw*fgkChips+icp;
103 fIsChipBad[chipindex]=kFALSE;
f45f6658 104 }
105 }
fcf95fc7 106
fcf95fc7 107 SetTemperature(fgkTemperatureDefault);
108 SetDataType(dataType);
fcf95fc7 109 }
028a3709 110//_____________________________________________________________________
111AliITSCalibrationSDD::~AliITSCalibrationSDD(){
fcf95fc7 112
028a3709 113 //destructor
114 if(fMapAW0) delete fMapAW0;
115 if(fMapAW1) delete fMapAW1;
116 if(fMapTW0) delete fMapTW0;
117 if(fMapTW1) delete fMapTW1;
18da6e54 118 if(fDrSpeed0) delete fDrSpeed0;
119 if(fDrSpeed1) delete fDrSpeed1;
028a3709 120}
fcf95fc7 121
122//______________________________________________________________________
20f3f947 123void AliITSCalibrationSDD::GiveCompressParam(Int_t cp[4]) const {
fcf95fc7 124 // give compression param
20f3f947 125 cp[0]=fZSTH[0];
126 cp[1]=fZSTL[0];
127 cp[2]=fZSTH[1];
128 cp[3]=fZSTL[1];
fcf95fc7 129}
f45f6658 130//_____________________________________________________________________
131void AliITSCalibrationSDD::SetBadChannel(Int_t i,Int_t anode){
132 //Set bad anode (set gain=0 for these channels);
fcf95fc7 133
4d350ec2 134 if(anode<0 || anode >fgkChannels*fgkChips*fgkWings-1){
135 AliError("Wrong anode number");
136 return;
137 }
f45f6658 138 fBadChannels[i]=anode;
eefec958 139 fGain[anode]=0;
4952f440 140}
c9a38d3d 141//______________________________________________________________________
142void AliITSCalibrationSDD::GetCorrections(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg){
143 //correction of coordinates using the maps stored in the DB
144 Int_t nSide=seg->GetSideFromLocalX(x);
145 devz=0;
2ebd5518 146// if(nSide==0) devz=fMapAW0->GetCorrection(z,x,seg);
147// else devz=fMapAW1->GetCorrection(z,x,seg);
c9a38d3d 148 devx=0;
ba0a07bf 149 if(nSide==0) devx=fMapTW0->GetCorrection(z,x,seg);
150 else devx=fMapTW1->GetCorrection(z,x,seg);
c9a38d3d 151 return;
152}
fcf95fc7 153//______________________________________________________________________
154void AliITSCalibrationSDD::PrintGains() const{
155 //
156
157 if( GetDeadChips() == 0 &&
158 GetDeadChannels() == 0 )
159 return;
160
161 // Print Electronics Gains
162 cout << "**************************************************" << endl;
163 cout << " Print Electronics Gains " << endl;
164 cout << "**************************************************" << endl;
165
166 // Print SDD electronic gains
eefec958 167 for(Int_t ian=0; ian<fgkWings*fgkChips*fgkChannels;ian++){
168 printf("Gain for channel %d = %f\n",ian,fGain[ian]);
169 }
fcf95fc7 170}
e56160b8 171
fcf95fc7 172//______________________________________________________________________
173void AliITSCalibrationSDD::Print(){
174 // Print SDD response Parameters
175
176 cout << "**************************************************" << endl;
177 cout << " Silicon Drift Detector Response Parameters " << endl;
178 cout << "**************************************************" << endl;
179 cout << "Hardware compression parameters: " << endl;
f45f6658 180 cout << "Noise before electronics (arbitrary units): " << fNoise[0] << endl;
181 cout << "Baseline (ADC units): " << fBaseline[0] << endl;
182 cout << "Noise after electronics (ADC units): " << fNoiseAfterEl[0] << endl;
fcf95fc7 183 cout << "Temperature: " << Temperature() << " K " << endl;
fcf95fc7 184 PrintGains();
185
5bfe44ce 186}