Changing once more (hopefully we get it correct this time...) the logic to trig the...
[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;
87}
88//______________________________________________________________________
fcf95fc7 89void AliITSCalibrationSSD::SetDetParam(Double_t *par){
90 // set det param
91 Int_t i;
92
93 for (i=0; i<fNPar; i++) {
94 fDetPar[i]=par[i];
95 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
96 } // end for i
97}
98//______________________________________________________________________
99void AliITSCalibrationSSD::GetDetParam(Double_t *par) const {
100 // get det param
101 Int_t i;
102
103 for (i=0; i<fNPar; i++) {
104 par[i]=fDetPar[i];
105 } // end for i
106}
23197852 107
108//______________________________________________________________________
109void AliITSCalibrationSSD::FillBadChipMap() {
110
aac93143 111 // reset
112 fIsBad=kFALSE;
113 for(Int_t i=0;i<fgkChipsPerModule;i++){
114 fIsChipBad[i]=kFALSE;
115 }
116
117
23197852 118 Int_t mc=0;
aac93143 119 Int_t cc[fgkChipsPerModule];
23197852 120
121 // P-side
aac93143 122 for(Int_t i=0; i<fgkChipsPerModule/2; i++){
23197852 123 cc[i]=0;
124 for(Int_t j=0; j<ChannelsPerChip(); j++) {
125 if(IsPChannelBad(i*ChannelsPerChip()+j)) cc[i]++;
126 }
127 if(cc[i]==ChannelsPerChip()) { SetChipBad(i); mc++; }
128 }
129
130 // N-side
aac93143 131 for(Int_t i=fgkChipsPerModule/2; i<fgkChipsPerModule; i++){
23197852 132 cc[i]=0;
133 for(Int_t j=0; j<ChannelsPerChip(); j++) {
134 if(IsNChannelBad(1535-i*ChannelsPerChip()-j)) cc[i]++;
135 }
136 if(cc[i]==ChannelsPerChip()) { SetChipBad(i); mc++; }
137 }
138
aac93143 139 if(mc==fgkChipsPerModule) fIsBad=kTRUE;
23197852 140}