Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSSD.cxx
CommitLineData
fcf95fc7 1/**************************************************************************
b42cfa25 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 **************************************************************************/
b42cfa25 15/* $Id$ */
fcf95fc7 16
17#include "AliITSCalibrationSSD.h"
18//////////////////////////////////////////////////////
19// Calibration class for set:ITS //
20// Specific subdetector implementation //
21// for silicon strips detectors //
22// //
23// //
24//////////////////////////////////////////////////////
25
fcf95fc7 26const Int_t AliITSCalibrationSSD::fgkNParDefault = 6;
fcf95fc7 27
28ClassImp(AliITSCalibrationSSD)
29
30//______________________________________________________________________
e56160b8 31AliITSCalibrationSSD::AliITSCalibrationSSD():
ced4d9bc 32 fModule(0),
e56160b8 33fNPar(0),
34fDetPar(0),
fb4dfab9 35fNoise(0),
5a88c45b 36fPedestal(),
fb4dfab9 37fGain(0),
38fBadChannels(0),
8be4e1b1 39 fIsBad(kFALSE),
40fSSDADCpereV(0.),
41 fKeVperADC(0)
42{
fcf95fc7 43 // Default Constructor
44
df1d5598 45 for(Int_t i=0;i<fgkChipsPerModule;i++){
46 fIsChipBad[i]=kFALSE;
47 }
8be4e1b1 48 SetSSDADCpereV();
49 SetKeVperADC();
fcf95fc7 50}
51//______________________________________________________________________
e56160b8 52AliITSCalibrationSSD::AliITSCalibrationSSD(const char *dataType):
ced4d9bc 53 fModule(0),
e56160b8 54fNPar(0),
55fDetPar(0),
fb4dfab9 56fNoise(0),
b42cfa25 57fPedestal(0),
fb4dfab9 58fGain(0),
59fBadChannels(0),
8be4e1b1 60fIsBad(kFALSE) ,
61fSSDADCpereV(0.),
62fKeVperADC(0){
fcf95fc7 63 // constructor
64
fcf95fc7 65 SetDataType(dataType);
fcf95fc7 66 SetNDetParam(fgkNParDefault); // Sets fNPar=6 by default.
67 fDetPar = new Double_t[fNPar];
68 if (fNPar==6) {
69 fDetPar[0]=10.;
70 fDetPar[1]=5.;
71 fDetPar[2]=0.02;
72 fDetPar[3]=0.02;
73 fDetPar[4]=0.02;
74 fDetPar[5]=0.03;
75 } // end if
df1d5598 76 for(Int_t i=0;i<fgkChipsPerModule;i++){
77 fIsChipBad[i]=kFALSE;
78 }
8be4e1b1 79 SetSSDADCpereV();
80 SetKeVperADC();
fcf95fc7 81}
82//______________________________________________________________________
83AliITSCalibrationSSD::~AliITSCalibrationSSD(){
84 // destructor
23197852 85
fcf95fc7 86 delete [] fDetPar;
964d8c19 87 if(fNoise)delete fNoise;
88 if(fPedestal)delete fPedestal;
89 if(fGain)delete fGain;
90 if(fBadChannels)delete fBadChannels;
fcf95fc7 91}
92//______________________________________________________________________
fcf95fc7 93void AliITSCalibrationSSD::SetDetParam(Double_t *par){
94 // set det param
95 Int_t i;
96
97 for (i=0; i<fNPar; i++) {
98 fDetPar[i]=par[i];
99 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
100 } // end for i
101}
102//______________________________________________________________________
103void AliITSCalibrationSSD::GetDetParam(Double_t *par) const {
104 // get det param
105 Int_t i;
106
107 for (i=0; i<fNPar; i++) {
108 par[i]=fDetPar[i];
109 } // end for i
110}
23197852 111
112//______________________________________________________________________
113void AliITSCalibrationSSD::FillBadChipMap() {
114
aac93143 115 // reset
116 fIsBad=kFALSE;
117 for(Int_t i=0;i<fgkChipsPerModule;i++){
118 fIsChipBad[i]=kFALSE;
119 }
120
121
23197852 122 Int_t mc=0;
aac93143 123 Int_t cc[fgkChipsPerModule];
23197852 124
125 // P-side
aac93143 126 for(Int_t i=0; i<fgkChipsPerModule/2; i++){
23197852 127 cc[i]=0;
128 for(Int_t j=0; j<ChannelsPerChip(); j++) {
129 if(IsPChannelBad(i*ChannelsPerChip()+j)) cc[i]++;
130 }
131 if(cc[i]==ChannelsPerChip()) { SetChipBad(i); mc++; }
132 }
133
134 // N-side
aac93143 135 for(Int_t i=fgkChipsPerModule/2; i<fgkChipsPerModule; i++){
23197852 136 cc[i]=0;
137 for(Int_t j=0; j<ChannelsPerChip(); j++) {
138 if(IsNChannelBad(1535-i*ChannelsPerChip()-j)) cc[i]++;
139 }
140 if(cc[i]==ChannelsPerChip()) { SetChipBad(i); mc++; }
141 }
142
aac93143 143 if(mc==fgkChipsPerModule) fIsBad=kTRUE;
23197852 144}