TRD nSigma OADB related new codes and modifications and OADB root file -- Xianguo Lu
[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//______________________________________________________________________
fe7d86eb 36
37using std::endl;
38using std::cout;
fcf95fc7 39ClassImp(AliITSCalibrationSDD)
40
4bfbde86 41AliITSCalibrationSDD::AliITSCalibrationSDD():
42AliITSCalibration(),
253e68a0 43fZeroSupp(kTRUE),
b27af87f 44fAMAt20MHz(kFALSE),
4bfbde86 45fDeadChips(0),
46fDeadChannels(0),
eefec958 47fIsBad(kFALSE),
028a3709 48fBadChannels(),
49fMapAW0(0),
50fMapAW1(0),
51fMapTW0(0),
18da6e54 52fMapTW1(0),
53fDrSpeed0(0),
54fDrSpeed1(0)
4bfbde86 55{
fcf95fc7 56 // default constructor
57
58 SetDeadChannels();
f45f6658 59 for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){
60 fBaseline[ian]=fgkBaselineDefault;
61 fNoise[ian]=fgkNoiseDefault;
eefec958 62 fGain[ian]=1.;
f45f6658 63 SetNoiseAfterElectronics(ian);
64 }
65 for(Int_t iw=0;iw<fgkWings;iw++){
20f3f947 66 SetZSLowThreshold(iw);
67 SetZSHighThreshold(iw);
f45f6658 68 for(Int_t icp=0;icp<fgkChips;icp++){
eefec958 69 Int_t chipindex=iw*fgkChips+icp;
70 fIsChipBad[chipindex]=kFALSE;
f45f6658 71 }
72 }
fcf95fc7 73 SetTemperature(fgkTemperatureDefault);
74 SetDataType();
fcf95fc7 75 }
76//______________________________________________________________________
4bfbde86 77AliITSCalibrationSDD::AliITSCalibrationSDD(const char *dataType):
78AliITSCalibration(),
253e68a0 79fZeroSupp(kTRUE),
b27af87f 80fAMAt20MHz(kFALSE),
4bfbde86 81fDeadChips(0),
82fDeadChannels(0),
eefec958 83fIsBad(kFALSE),
028a3709 84fBadChannels(),
85fMapAW0(0),
86fMapAW1(0),
87fMapTW0(0),
18da6e54 88fMapTW1(0),
89fDrSpeed0(0),
90fDrSpeed1(0)
91{
fcf95fc7 92 // constructor
93
94 SetDeadChannels();
f45f6658 95 for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){
96 fBaseline[ian]=fgkBaselineDefault;
eefec958 97 fNoise[ian]=fgkNoiseDefault;
98 fGain[ian]=1.;
99 SetNoiseAfterElectronics(ian);
f45f6658 100 }
101 for(Int_t iw=0;iw<fgkWings;iw++){
20f3f947 102 SetZSLowThreshold(iw);
103 SetZSHighThreshold(iw);
f45f6658 104 for(Int_t icp=0;icp<fgkChips;icp++){
eefec958 105 Int_t chipindex=iw*fgkChips+icp;
106 fIsChipBad[chipindex]=kFALSE;
f45f6658 107 }
108 }
fcf95fc7 109
fcf95fc7 110 SetTemperature(fgkTemperatureDefault);
111 SetDataType(dataType);
fcf95fc7 112 }
028a3709 113//_____________________________________________________________________
114AliITSCalibrationSDD::~AliITSCalibrationSDD(){
fcf95fc7 115
028a3709 116 //destructor
117 if(fMapAW0) delete fMapAW0;
118 if(fMapAW1) delete fMapAW1;
119 if(fMapTW0) delete fMapTW0;
120 if(fMapTW1) delete fMapTW1;
18da6e54 121 if(fDrSpeed0) delete fDrSpeed0;
122 if(fDrSpeed1) delete fDrSpeed1;
028a3709 123}
fcf95fc7 124
125//______________________________________________________________________
20f3f947 126void AliITSCalibrationSDD::GiveCompressParam(Int_t cp[4]) const {
fcf95fc7 127 // give compression param
20f3f947 128 cp[0]=fZSTH[0];
129 cp[1]=fZSTL[0];
130 cp[2]=fZSTH[1];
131 cp[3]=fZSTL[1];
fcf95fc7 132}
f45f6658 133//_____________________________________________________________________
134void AliITSCalibrationSDD::SetBadChannel(Int_t i,Int_t anode){
135 //Set bad anode (set gain=0 for these channels);
fcf95fc7 136
4d350ec2 137 if(anode<0 || anode >fgkChannels*fgkChips*fgkWings-1){
138 AliError("Wrong anode number");
139 return;
140 }
f45f6658 141 fBadChannels[i]=anode;
eefec958 142 fGain[anode]=0;
4952f440 143}
c9a38d3d 144//______________________________________________________________________
145void AliITSCalibrationSDD::GetCorrections(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg){
146 //correction of coordinates using the maps stored in the DB
147 Int_t nSide=seg->GetSideFromLocalX(x);
148 devz=0;
2ebd5518 149// if(nSide==0) devz=fMapAW0->GetCorrection(z,x,seg);
150// else devz=fMapAW1->GetCorrection(z,x,seg);
c9a38d3d 151 devx=0;
ba0a07bf 152 if(nSide==0) devx=fMapTW0->GetCorrection(z,x,seg);
153 else devx=fMapTW1->GetCorrection(z,x,seg);
c9a38d3d 154 return;
155}
fcf95fc7 156//______________________________________________________________________
374200ee 157void AliITSCalibrationSDD::GetShiftsForSimulation(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg){
158 //correction of coordinates using the maps stored in the DB
159 Int_t nSide=seg->GetSideFromLocalX(x);
160 devz=0;
161// if(nSide==0) devz=fMapAW0->GetCorrection(z,x,seg);
162// else devz=fMapAW1->GetCorrection(z,x,seg);
163 devx=0;
164 if(nSide==0) devx=fMapTW0->GetShiftForSimulation(z,x,seg);
165 else devx=fMapTW1->GetShiftForSimulation(z,x,seg);
166 return;
167}
168//______________________________________________________________________
fcf95fc7 169void AliITSCalibrationSDD::PrintGains() const{
374200ee 170 // Print Gains
fcf95fc7 171
172 if( GetDeadChips() == 0 &&
173 GetDeadChannels() == 0 )
174 return;
175
176 // Print Electronics Gains
177 cout << "**************************************************" << endl;
178 cout << " Print Electronics Gains " << endl;
179 cout << "**************************************************" << endl;
180
181 // Print SDD electronic gains
eefec958 182 for(Int_t ian=0; ian<fgkWings*fgkChips*fgkChannels;ian++){
183 printf("Gain for channel %d = %f\n",ian,fGain[ian]);
184 }
fcf95fc7 185}
e56160b8 186
fcf95fc7 187//______________________________________________________________________
188void AliITSCalibrationSDD::Print(){
189 // Print SDD response Parameters
190
191 cout << "**************************************************" << endl;
192 cout << " Silicon Drift Detector Response Parameters " << endl;
193 cout << "**************************************************" << endl;
194 cout << "Hardware compression parameters: " << endl;
f45f6658 195 cout << "Noise before electronics (arbitrary units): " << fNoise[0] << endl;
196 cout << "Baseline (ADC units): " << fBaseline[0] << endl;
197 cout << "Noise after electronics (ADC units): " << fNoiseAfterEl[0] << endl;
fcf95fc7 198 cout << "Temperature: " << Temperature() << " K " << endl;
fcf95fc7 199 PrintGains();
200
5bfe44ce 201}