Update master to aliroot
[u/mrichter/AliRoot.git] / ITS / ITSbase / AliITSCalibrationSSD.h
CommitLineData
fcf95fc7 1#ifndef ALIITSCALIBRATIONSSD_H
2#define ALIITSCALIBRATIONSSD_H
b42cfa25 3/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
fcf95fc7 5#include "AliITSCalibration.h"
88128115 6#include "AliITSNoiseSSDv2.h"
7#include "AliITSPedestalSSDv2.h"
8#include "AliITSGainSSDv2.h"
9#include "AliITSBadChannelsSSDv2.h"
fcf95fc7 10
b42cfa25 11/* $Id$ */
fcf95fc7 12//////////////////////////////////////////////
8be4e1b1 13// Calibration class for SSD //
fcf95fc7 14// //
15//////////////////////////////////////////////
16class AliITSCalibrationSSD : public AliITSCalibration {
17
18 public:
19 AliITSCalibrationSSD();
20 AliITSCalibrationSSD(const char *dataType);
21 virtual ~AliITSCalibrationSSD();
14a74335 22
ced4d9bc 23 Float_t GetNoiseP(Int_t n) {return fNoise->GetNoiseP(fModule,n); }
24 Float_t GetNoiseN(Int_t n) {return fNoise->GetNoiseN(fModule,n); }
88128115 25 void SetNoise( AliITSNoiseSSDv2* noise) {fNoise=noise;}
fb4dfab9 26
ced4d9bc 27 Float_t GetPedestalP(Int_t n) {return fPedestal->GetPedestalP(fModule,n); }
28 Float_t GetPedestalN(Int_t n) {return fPedestal->GetPedestalN(fModule,n); }
88128115 29 void SetPedestal( AliITSPedestalSSDv2* pedestal) {fPedestal=pedestal;}
b42cfa25 30
ced4d9bc 31 Float_t GetGainP(Int_t n) {return fGain->GetGainP(fModule,n); }
32 Float_t GetGainN(Int_t n) {return fGain->GetGainN(fModule,n); }
33 void SetGainP(Int_t n, Float_t value) {fGain->AddGainP(fModule,n,value);}
34 void SetGainN(Int_t n, Float_t value) {fGain->AddGainN(fModule,n,value);}
88128115 35 void SetGain( AliITSGainSSDv2* gain) {fGain=gain;}
fb4dfab9 36
df1d5598 37 void SetBad() {
38 fIsBad = kTRUE;
39 for(Int_t i=0;i<fgkChipsPerModule;i++) fIsChipBad[i]=kTRUE;
40 }
41 virtual Bool_t IsBad() const { return fIsBad; }
42 void SetChipBad(Int_t nChip) {
43 fIsChipBad[nChip] = kTRUE;
44 }
23197852 45 void FillBadChipMap();
df1d5598 46 virtual Bool_t IsChipBad(Int_t nChip) const {
47 return fIsChipBad[nChip];
48 }
ced4d9bc 49 Int_t ChipsPerModule() const{return fgkChipsPerModule;} // # chips/module
50 Int_t ChannelsPerChip() const{ return fgkChannelsPerChip;}// #channels/chip
51
88128115 52 void SetBadChannels( AliITSBadChannelsSSDv2* badchannels) {
ced4d9bc 53 fBadChannels=badchannels;}
54 Char_t GetBadPChannel(Int_t n) {
55 return fBadChannels->GetBadChannelP(fModule,n); }
56 Char_t GetBadNChannel(Int_t n) {
57 return fBadChannels->GetBadChannelN(fModule,n); }
58 Bool_t IsPChannelBad(Int_t n) {
59 return fBadChannels->GetBadChannelP(fModule,n)&1; }
60 Bool_t IsNChannelBad(Int_t n) {
61 return fBadChannels->GetBadChannelN(fModule,n)&1; }
14a74335 62
ced4d9bc 63 //
fcf95fc7 64 virtual void SetNDetParam(Int_t npar) {
65 // set number of param
66 fNPar=npar;
67 }
68 virtual void SetDetParam(Double_t *par);
69
70 // Parameters options
71 virtual Int_t NDetParam() const {
72 // number of param
73 return fNPar;
74 }
75 virtual void GetDetParam(Double_t *dpar) const;
76
ced4d9bc 77 virtual void SetSigmaSpread(Double_t, Double_t) {
78 NotImplemented("SetSigmaSpread");}
79
80 virtual void SigmaSpread(Double_t &, Double_t &) const {
81 NotImplemented("SetSigmaSpread");}
82
bb292d31 83 void SetModule(Int_t mod){fModule = mod;}
aac93143 84 void SetModuleIndex(Int_t modId){
85 fModule=modId-500; // temporary patch, 500 is n. of SPD+SDD modules
86 FillBadChipMap();
87 }
bb292d31 88 void SetKeVperADC(Double_t a=86.4/120.){fKeVperADC = a;}
89 Double_t ADCToKeV(Double_t adc) const {return adc*fKeVperADC;}
14a74335 90
c23ff1b4 91 void SetSSDADCpereV(Double_t a=(120./24888.9)*(85.0/77.0)){fSSDADCpereV = a;}
bb292d31 92 Double_t GetSSDDEvToADC(Double_t eV) const {return eV*fSSDADCpereV;}
93 Int_t GetSSDIEvToADC(Double_t eV) const {
94 return ((Int_t) GetSSDDEvToADC(eV)); }
14a74335 95
ced4d9bc 96
8be4e1b1 97 protected:
df1d5598 98
99 static const Int_t fgkChipsPerModule = 12; // Number of chips/module
100 static const Int_t fgkChannelsPerChip = 128; // Number of channels/chip
101
fcf95fc7 102 static const Int_t fgkNParDefault; // default for fNPar
14a74335 103
ced4d9bc 104 Int_t fModule; //! module number (range 0 -> 1697)
105
fcf95fc7 106 Int_t fNPar; // Number of detector param
107 Double_t *fDetPar; //[fNPar] Array of parameters
108
7ab0e0a5 109 AliITSNoiseSSDv2 *fNoise; // pointer to noise calib object
110 AliITSPedestalSSDv2 *fPedestal; // pointer to pedestal calib object
111 AliITSGainSSDv2 *fGain; // pointer to gain calib object
112 AliITSBadChannelsSSDv2 *fBadChannels; // pointer to bad channels calib object
fb4dfab9 113
df1d5598 114 Bool_t fIsBad; // module is dead or alive ?
115 Bool_t fIsChipBad[fgkChipsPerModule]; // chip is dead or alive ?
116
8be4e1b1 117 Double_t fSSDADCpereV; // Constant to convert eV to ADC for SSD.
118 Double_t fKeVperADC; // Constant to convert ADC to keV
119
fcf95fc7 120 private:
121 AliITSCalibrationSSD(const AliITSCalibrationSSD &source); // copy constructor
122 AliITSCalibrationSSD& operator=(const AliITSCalibrationSSD &source); // ass. op.
123
c23ff1b4 124 ClassDef(AliITSCalibrationSSD,6) //Response class for SSD
ced4d9bc 125 };
fcf95fc7 126#endif