]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSresponseSDD.cxx
Partial removal of coding convention violations (A. Dainese)
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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
16 /* $Id$ */
17
18 //////////////////////////////////////////////////////
19 //  Base response class forITS                      //
20 //  It is used to set static data members           //
21 //  connected to parameters equal for all           //
22 //  the modules                                     //
23 //                                                  //
24 //                                                  //
25 //////////////////////////////////////////////////////
26
27 #include <TMath.h>
28
29 #include "AliITSresponseSDD.h"
30
31 const Int_t AliITSresponseSDD::fgkMaxAdcDefault = 1024;
32 const Float_t AliITSresponseSDD::fgkDynamicRangeDefault = 132.;
33 const Float_t AliITSresponseSDD::fgkfChargeLossDefault = 0;
34 const Float_t AliITSresponseSDD::fgkDiffCoeffDefault = 3.23;
35 const Float_t AliITSresponseSDD::fgkDiffCoeff1Default = 30.;
36 const TString AliITSresponseSDD::fgkParam1Default = "same";
37 const TString AliITSresponseSDD::fgkParam2Default = "same";
38 const TString AliITSresponseSDD::fgkOptionDefault = "1D";
39 const Float_t AliITSresponseSDD::fgkDriftSpeedDefault = 7.3;
40 const Float_t AliITSresponseSDD::fgkTimeOffsetDefault = 55.07;
41 const Float_t AliITSresponseSDD::fgkADC2keVDefault = 5.243;
42 const Float_t AliITSresponseSDD::fgkNsigmasDefault = 3.;
43 const Int_t AliITSresponseSDD::fgkNcompsDefault = 121;
44
45 ClassImp(AliITSresponseSDD)
46
47 //_________________________________________________________________________
48 AliITSresponseSDD::AliITSresponseSDD():
49 AliITSresponse(),
50 fJitterError(0.),
51 fDynamicRange(0.),
52 fChargeLoss(0.),
53 fDriftSpeed(fgkDriftSpeedDefault),
54 fTimeOffset(fgkTimeOffsetDefault),
55 fADC2keV(fgkADC2keVDefault),
56 fElectronics(0),
57 fMaxAdc(fgkMaxAdcDefault),
58 fNsigmas(fgkNsigmasDefault),
59 fGaus(),
60 fNcomps(0),
61 fBitComp(kFALSE),
62 fOption(),
63 fParam1(),
64 fParam2() {
65   // default constructor
66   fGaus = 0;
67   SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default);
68   //  SetNLookUp(fgkNcompsDefault);
69
70   SetJitterError();
71   SetElectronics();
72   SetDynamicRange(fgkDynamicRangeDefault);
73   SetChargeLoss(fgkfChargeLossDefault);
74   SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data());
75   SetZeroSupp(fgkOptionDefault);
76   SetDo10to8();
77   SetOutputOption();
78 }
79
80
81 //______________________________________________________________________
82 AliITSresponseSDD::~AliITSresponseSDD() { 
83
84   if(fGaus) delete fGaus;
85 }
86
87
88 //______________________________________________________________________
89 Int_t AliITSresponseSDD::Convert8to10(Int_t signal) const {
90   // Undo the lossive 10 to 8 bit compression.
91   // code from Davide C. and Albert W.
92
93   if(Do10to8()){  // kTRUE if the compression is active
94     if (signal < 0 || signal > 255) {
95       Warning("Convert8to10","out of range signal=%d",signal);
96       return 0;
97     } // end if signal <0 || signal >255
98
99     if (signal < 128) return signal;
100     if (signal < 192) {
101       if (TMath::Odd(signal)) return (128+((signal-128)<<1));
102       else  return (128+((signal-128)<<1)+1);
103     } // end if signal < 192
104     if (signal < 224) {
105       if (TMath::Odd(signal)) return (256+((signal-192)<<3)+3);
106       else  return (256+((signal-192)<<3)+4);
107     } // end if signal < 224
108     if (TMath::Odd(signal)) return (512+((signal-224)<<4)+7);
109     return (512+((signal-224)<<4)+8);
110   }
111   else {  
112     return signal;
113   }
114 }
115
116 //________________________________________________________________________
117 void AliITSresponseSDD::SetNLookUp(Int_t p1){
118   // Set number of sigmas over which cluster disintegration is performed
119   fNcomps=p1;
120   if (fGaus) delete fGaus;
121   fGaus = new TArrayF(fNcomps+1);
122   for(Int_t i=0; i<=fNcomps; i++) {
123     Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
124     (*fGaus)[i] = exp(-((x*x)/2));
125   }
126 }