]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSresponseSDD.cxx
Part of Reset() moved to base class.
[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::fgkNsigmasDefault = 3.;
41 const Int_t AliITSresponseSDD::fgkNcompsDefault = 121;
42
43 ClassImp(AliITSresponseSDD)
44
45 //_________________________________________________________________________
46 AliITSresponseSDD::AliITSresponseSDD():
47 AliITSresponse(),
48 fJitterError(0.),
49 fDynamicRange(0.),
50 fChargeLoss(0.),
51 fDriftSpeed(fgkDriftSpeedDefault),
52 fElectronics(0),
53 fMaxAdc(fgkMaxAdcDefault),
54 fNsigmas(fgkNsigmasDefault),
55 fGaus(),
56 fNcomps(0),
57 fBitComp(kFALSE),
58 fOption(),
59 fParam1(),
60 fParam2() {
61   // default constructor
62   fGaus = 0;
63   SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default);
64   //  SetNLookUp(fgkNcompsDefault);
65
66   SetJitterError();
67   SetElectronics();
68   SetDynamicRange(fgkDynamicRangeDefault);
69   SetChargeLoss(fgkfChargeLossDefault);
70   SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data());
71   SetZeroSupp(fgkOptionDefault);
72   SetDo10to8();
73   SetOutputOption();
74 }
75
76
77 //______________________________________________________________________
78 AliITSresponseSDD::~AliITSresponseSDD() { 
79
80   if(fGaus) delete fGaus;
81 }
82
83
84 //______________________________________________________________________
85 Int_t AliITSresponseSDD::Convert8to10(Int_t signal) const {
86   // Undo the lossive 10 to 8 bit compression.
87   // code from Davide C. and Albert W.
88
89   if(Do10to8()){  // kTRUE if the compression is active
90     if (signal < 0 || signal > 255) {
91       Warning("Convert8to10","out of range signal=%d",signal);
92       return 0;
93     } // end if signal <0 || signal >255
94
95     if (signal < 128) return signal;
96     if (signal < 192) {
97       if (TMath::Odd(signal)) return (128+((signal-128)<<1));
98       else  return (128+((signal-128)<<1)+1);
99     } // end if signal < 192
100     if (signal < 224) {
101       if (TMath::Odd(signal)) return (256+((signal-192)<<3)+3);
102       else  return (256+((signal-192)<<3)+4);
103     } // end if signal < 224
104     if (TMath::Odd(signal)) return (512+((signal-224)<<4)+7);
105     return (512+((signal-224)<<4)+8);
106   }
107   else {  
108     return signal;
109   }
110 }
111
112 //________________________________________________________________________
113 void AliITSresponseSDD::SetNLookUp(Int_t p1){
114   // Set number of sigmas over which cluster disintegration is performed
115   fNcomps=p1;
116   if (fGaus) delete fGaus;
117   fGaus = new TArrayF(fNcomps+1);
118   for(Int_t i=0; i<=fNcomps; i++) {
119     Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
120     (*fGaus)[i] = exp(-((x*x)/2));
121   }
122 }