- fixing warnings/coverity
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.h
CommitLineData
b0f5e3fc 1#ifndef ALIITSRESPONSESDD_H
2#define ALIITSRESPONSESDD_H
48058160 3
c2bd28b6 4/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
48058160 5 * See cxx source for full Copyright notice */
6
88cb7938 7
253e68a0 8#include <TObject.h>
3176641e 9#include <AliLog.h>
b0f5e3fc 10
c2bd28b6 11/* $Id$ */
12
fcf95fc7 13/////////////////////////////////////////////////////////////
14// Base settings for the ITS response classes. //
15// The data member of this class are static and set once //
16// for all the modules. //
17/////////////////////////////////////////////////////////////
b0f5e3fc 18
253e68a0 19class AliITSresponseSDD : public TObject {
69b82143 20 public:
ef24eb3b 21 enum {kVDCorr2Side = BIT(14),kVDCorrMult = BIT(15)}; // if bit set, the object contains separate corrections for 2 sides
e71a6286 22 //
69b82143 23 AliITSresponseSDD();
24 virtual ~AliITSresponseSDD(){};
25
26 virtual void SetSideATimeZero(Float_t tzero){
27 SetLayer3ATimeZero(tzero);
28 SetLayer4ATimeZero(tzero);
29 }
30 virtual void SetSideCTimeZero(Float_t tzero){
31 SetLayer3CTimeZero(tzero);
32 SetLayer4CTimeZero(tzero);
33 }
34 virtual void SetLayer3ATimeZero(Float_t tzero){
35 for(Int_t iLad=1; iLad<=kNLaddersLay3; iLad++) SetHalfLadderATimeZero(3,iLad,tzero);
36 }
37 virtual void SetLayer3CTimeZero(Float_t tzero){
38 for(Int_t iLad=1; iLad<=kNLaddersLay3; iLad++) SetHalfLadderCTimeZero(3,iLad,tzero);
39 }
40 virtual void SetLayer4ATimeZero(Float_t tzero){
41 for(Int_t iLad=1; iLad<=kNLaddersLay4; iLad++) SetHalfLadderATimeZero(4,iLad,tzero);
42 }
43 virtual void SetLayer4CTimeZero(Float_t tzero){
44 for(Int_t iLad=1; iLad<=kNLaddersLay4; iLad++) SetHalfLadderCTimeZero(4,iLad,tzero);
45 }
46 virtual void SetHalfLadderATimeZero(Int_t lay, Int_t lad, Float_t tzero);
47 virtual void SetHalfLadderCTimeZero(Int_t lay, Int_t lad, Float_t tzero);
48 virtual void SetModuleTimeZero(Int_t modIndex, Float_t tzero){
41c25d0c 49 if(modIndex<kNSPDmods || modIndex>=kNSPDmods+kNSDDmods){
50 AliError(Form("SDD module number %d out of range",modIndex));
51 return;
52 }
69b82143 53 fTimeZero[modIndex-kNSPDmods]=tzero;
54 }
55
e71a6286 56 virtual void SetDeltaVDrift(Int_t modIndex, Float_t dv, Bool_t rightSide=kFALSE) {
57 int ind = GetVDIndex(modIndex,rightSide);
58 if (ind>=0) fDeltaVDrift[ind] = dv;
57019696 59 }
69b82143 60
e71a6286 61 virtual Float_t GetDeltaVDrift(Int_t modIndex,Bool_t rightSide=kFALSE) const {
62 int ind = GetVDIndex(modIndex,rightSide);
63 return ind<0 ? 0.:fDeltaVDrift[ind];
64 }
65 //
66 Bool_t IsVDCorr2Side() const {return TestBit(kVDCorr2Side);}
ef24eb3b 67 Bool_t IsVDCorrMult() const {return TestBit(kVDCorrMult);}
e71a6286 68 void SetVDCorr2Side(Bool_t v=kTRUE) {SetBit(kVDCorr2Side,v);}
ef24eb3b 69 void SetVDCorrMult(Bool_t v=kTRUE) {SetBit(kVDCorrMult,v);}
e71a6286 70 //
57019696 71 static Float_t DefaultTimeOffset() {return fgkTimeOffsetDefault;}
69b82143 72 virtual void SetTimeOffset(Float_t to){fTimeOffset = to;}
73 virtual Float_t GetTimeOffset()const {return fTimeOffset;}
57019696 74 virtual Float_t GetTimeZero(Int_t modIndex) const {
cb604b08 75 if(modIndex<kNSPDmods || modIndex>=kNSPDmods+kNSDDmods){
69b82143 76 AliError(Form("SDD module number %d out of range",modIndex));
77 return 0.;
3176641e 78 }
69b82143 79 return fTimeZero[modIndex-kNSPDmods];
80 }
57019696 81
82 virtual void SetADC2keV(Float_t conv){fADC2keV=conv;}
83 virtual Float_t GetADC2keV()const {return fADC2keV;}
84 virtual void SetADCtokeV(Int_t modIndex, Float_t conv){
41c25d0c 85 if(modIndex<kNSPDmods || modIndex>=kNSPDmods+kNSDDmods){
86 AliError(Form("SDD module number %d out of range",modIndex));
87 return;
88 }
57019696 89 fADCtokeV[modIndex-kNSPDmods]=conv;
90 }
91 virtual Float_t GetADCtokeV(Int_t modIndex) const {
cb604b08 92 if(modIndex<kNSPDmods || modIndex>=kNSPDmods+kNSDDmods){
69b82143 93 AliError(Form("SDD module number %d out of range",modIndex));
94 return 0.;
3176641e 95 }
57019696 96 return fADCtokeV[modIndex-kNSPDmods];
69b82143 97 }
a66a0eb6 98
d644eb2d 99 virtual void SetChargevsTime(Float_t slope){fChargevsTime=slope;}
d644eb2d 100 virtual Float_t GetChargevsTime()const {return fChargevsTime;}
101
102 static Float_t DefaultADC2keV() {return fgkADC2keVDefault;}
103 static Float_t DefaultChargevsTime() {return fgkChargevsTimeDefault;}
a66a0eb6 104
69b82143 105 static Float_t GetCarlosRXClockPeriod() {return fgkCarlosRXClockPeriod;}
dfb09666 106 void PrintChargeCalibrationParams() const;
107 void PrintTimeZeroes() const;
108 void PrintVdriftCorerctions() const;
e71a6286 109
110
111 protected:
112 //
113 virtual Int_t GetVDIndex(Int_t modIndex, Bool_t rightSide=kFALSE) const {
114 int ind = modIndex - kNSPDmods;
115 if(ind<0 || ind>=kNSDDmods) {AliError(Form("SDD module number %d out of range",modIndex)); return -1;}
116 return (rightSide && IsVDCorr2Side()) ? ind + kNSDDmods : ind;
117 }
118
8ba39da9 119
48058160 120 protected:
fcf95fc7 121
69b82143 122 enum {kNSPDmods = 240};
123 enum {kNSDDmods = 260};
124 enum {kNLaddersLay3 = 14};
125 enum {kNLaddersLay4 = 22};
3176641e 126
127
69b82143 128 static const Float_t fgkTimeOffsetDefault; // default for fTimeOffset
129 static const Float_t fgkADC2keVDefault; // default for fADC2keV
d644eb2d 130 static const Float_t fgkChargevsTimeDefault; // default for fChargevsTime
69b82143 131 static const Float_t fgkCarlosRXClockPeriod; // clock period for CarlosRX
703a4e51 132
69b82143 133 Float_t fTimeOffset; // Time offset due to electronic delays
134 // --> obsolete, kept for backw. comp.
135 Float_t fTimeZero[kNSDDmods]; // Time Zero for each module
e71a6286 136 Float_t fDeltaVDrift[2*kNSDDmods]; // Vdrift correction (um/ns) for each module left (<kNSDDmods) and right (>=kNSDDmods) sides
69b82143 137 Float_t fADC2keV; // Conversion factor from ADC to keV
57019696 138 // --> obsolete, kept for backw. comp.
d644eb2d 139 Float_t fChargevsTime; // Correction for zero suppression effect
57019696 140 Float_t fADCtokeV[kNSDDmods]; // ADC to keV conversion for each module
141
703a4e51 142 private:
703a4e51 143
69b82143 144 AliITSresponseSDD(const AliITSresponseSDD &ob); // copy constructor
145 AliITSresponseSDD& operator=(const AliITSresponseSDD & /* source */); // ass. op.
fa1750f9 146
e71a6286 147 ClassDef(AliITSresponseSDD,20)
69b82143 148
50d05d7b 149 };
b0f5e3fc 150#endif