]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSCalibrationSSD.cxx
Memory leak correction (savannah #84632) Melinda
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSSD.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
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 /* $Id$  */
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
26 const Int_t AliITSCalibrationSSD::fgkNParDefault = 6;
27
28 ClassImp(AliITSCalibrationSSD)
29
30 //______________________________________________________________________
31 AliITSCalibrationSSD::AliITSCalibrationSSD():
32   fModule(0),
33 fNPar(0),
34 fDetPar(0),
35 fNoise(0),
36 fPedestal(),
37 fGain(0),
38 fBadChannels(0),
39   fIsBad(kFALSE),
40 fSSDADCpereV(0.),
41   fKeVperADC(0)
42 {
43     // Default Constructor
44
45     for(Int_t i=0;i<fgkChipsPerModule;i++){
46       fIsChipBad[i]=kFALSE;
47     }
48   SetSSDADCpereV();
49     SetKeVperADC();
50 }
51 //______________________________________________________________________
52 AliITSCalibrationSSD::AliITSCalibrationSSD(const char *dataType):
53   fModule(0),
54 fNPar(0),
55 fDetPar(0),
56 fNoise(0),
57 fPedestal(0),
58 fGain(0),
59 fBadChannels(0),
60 fIsBad(kFALSE) ,
61 fSSDADCpereV(0.),
62 fKeVperADC(0){
63     // constructor
64
65     SetDataType(dataType);
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
76     for(Int_t i=0;i<fgkChipsPerModule;i++){
77       fIsChipBad[i]=kFALSE;
78     }
79     SetSSDADCpereV();
80     SetKeVperADC();
81 }
82 //______________________________________________________________________
83 AliITSCalibrationSSD::~AliITSCalibrationSSD(){
84     // destructor
85  
86     delete [] fDetPar;
87     if(fNoise)delete fNoise;
88     if(fPedestal)delete fPedestal;
89     if(fGain)delete fGain;
90     if(fBadChannels)delete fBadChannels;
91 }
92 //______________________________________________________________________
93 void 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 //______________________________________________________________________
103 void 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 }
111
112 //______________________________________________________________________
113 void AliITSCalibrationSSD::FillBadChipMap() {
114
115   // reset
116   fIsBad=kFALSE;
117   for(Int_t i=0;i<fgkChipsPerModule;i++){
118     fIsChipBad[i]=kFALSE;
119   }
120
121
122   Int_t mc=0;
123   Int_t cc[fgkChipsPerModule];
124
125   // P-side
126   for(Int_t i=0; i<fgkChipsPerModule/2; i++){
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
135   for(Int_t i=fgkChipsPerModule/2; i<fgkChipsPerModule; i++){
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   
143   if(mc==fgkChipsPerModule) fIsBad=kTRUE;
144 }