adding mode makefile
[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(),
40fDeadChips(0),
41fDeadChannels(0),
eefec958 42fIsBad(kFALSE),
028a3709 43fBadChannels(),
c9a38d3d 44fUseACorrMap(0),
45fUseTCorrMap(0),
028a3709 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);
c9a38d3d 71 SetUseCorrectionMaps(kTRUE,kTRUE);
fcf95fc7 72 SetDataType();
fcf95fc7 73 }
74//______________________________________________________________________
4bfbde86 75AliITSCalibrationSDD::AliITSCalibrationSDD(const char *dataType):
76AliITSCalibration(),
77fDeadChips(0),
78fDeadChannels(0),
eefec958 79fIsBad(kFALSE),
028a3709 80fBadChannels(),
c9a38d3d 81fUseACorrMap(0),
82fUseTCorrMap(0),
028a3709 83fMapAW0(0),
84fMapAW1(0),
85fMapTW0(0),
18da6e54 86fMapTW1(0),
87fDrSpeed0(0),
88fDrSpeed1(0)
89{
fcf95fc7 90 // constructor
91
92 SetDeadChannels();
f45f6658 93 for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){
94 fBaseline[ian]=fgkBaselineDefault;
eefec958 95 fNoise[ian]=fgkNoiseDefault;
96 fGain[ian]=1.;
97 SetNoiseAfterElectronics(ian);
f45f6658 98 }
99 for(Int_t iw=0;iw<fgkWings;iw++){
20f3f947 100 SetZSLowThreshold(iw);
101 SetZSHighThreshold(iw);
f45f6658 102 for(Int_t icp=0;icp<fgkChips;icp++){
eefec958 103 Int_t chipindex=iw*fgkChips+icp;
104 fIsChipBad[chipindex]=kFALSE;
f45f6658 105 }
106 }
fcf95fc7 107
fcf95fc7 108 SetTemperature(fgkTemperatureDefault);
c9a38d3d 109 SetUseCorrectionMaps(kTRUE,kTRUE);
fcf95fc7 110 SetDataType(dataType);
fcf95fc7 111 }
028a3709 112//_____________________________________________________________________
113AliITSCalibrationSDD::~AliITSCalibrationSDD(){
fcf95fc7 114
028a3709 115 //destructor
116 if(fMapAW0) delete fMapAW0;
117 if(fMapAW1) delete fMapAW1;
118 if(fMapTW0) delete fMapTW0;
119 if(fMapTW1) delete fMapTW1;
18da6e54 120 if(fDrSpeed0) delete fDrSpeed0;
121 if(fDrSpeed1) delete fDrSpeed1;
028a3709 122}
fcf95fc7 123
124//______________________________________________________________________
20f3f947 125void AliITSCalibrationSDD::GiveCompressParam(Int_t cp[4]) const {
fcf95fc7 126 // give compression param
20f3f947 127 cp[0]=fZSTH[0];
128 cp[1]=fZSTL[0];
129 cp[2]=fZSTH[1];
130 cp[3]=fZSTL[1];
fcf95fc7 131}
f45f6658 132//_____________________________________________________________________
133void AliITSCalibrationSDD::SetBadChannel(Int_t i,Int_t anode){
134 //Set bad anode (set gain=0 for these channels);
fcf95fc7 135
f45f6658 136 if(anode<0 || anode >fgkChannels*fgkChips*fgkWings-1)AliError("Wrong anode number");
f45f6658 137 fBadChannels[i]=anode;
eefec958 138 fGain[anode]=0;
4952f440 139}
c9a38d3d 140//______________________________________________________________________
141void AliITSCalibrationSDD::GetCorrections(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg){
142 //correction of coordinates using the maps stored in the DB
143 Int_t nSide=seg->GetSideFromLocalX(x);
144 devz=0;
145 if(fUseACorrMap){
146 if(nSide==0) devz=fMapAW0->GetCorrection(z,x,seg);
147 else devz=fMapAW1->GetCorrection(z,x,seg);
148 }
149 devx=0;
150 if(fUseTCorrMap){
151 if(nSide==0) devx=fMapTW0->GetCorrection(z,x,seg);
152 else devx=fMapTW1->GetCorrection(z,x,seg);
153 }
154 return;
155}
fcf95fc7 156//______________________________________________________________________
157void AliITSCalibrationSDD::PrintGains() const{
158 //
159
160 if( GetDeadChips() == 0 &&
161 GetDeadChannels() == 0 )
162 return;
163
164 // Print Electronics Gains
165 cout << "**************************************************" << endl;
166 cout << " Print Electronics Gains " << endl;
167 cout << "**************************************************" << endl;
168
169 // Print SDD electronic gains
eefec958 170 for(Int_t ian=0; ian<fgkWings*fgkChips*fgkChannels;ian++){
171 printf("Gain for channel %d = %f\n",ian,fGain[ian]);
172 }
fcf95fc7 173}
e56160b8 174
fcf95fc7 175//______________________________________________________________________
176void AliITSCalibrationSDD::Print(){
177 // Print SDD response Parameters
178
179 cout << "**************************************************" << endl;
180 cout << " Silicon Drift Detector Response Parameters " << endl;
181 cout << "**************************************************" << endl;
182 cout << "Hardware compression parameters: " << endl;
f45f6658 183 cout << "Noise before electronics (arbitrary units): " << fNoise[0] << endl;
184 cout << "Baseline (ADC units): " << fBaseline[0] << endl;
185 cout << "Noise after electronics (ADC units): " << fNoiseAfterEl[0] << endl;
fcf95fc7 186 cout << "Temperature: " << Temperature() << " K " << endl;
fcf95fc7 187 PrintGains();
188
5bfe44ce 189}