Fixes for Coverity warnings (M. van Leeuwen)
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.cxx
CommitLineData
b0f5e3fc 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2aea926d 3 * *
b0f5e3fc 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 **************************************************************************/
b9d0a01d 15
090026bf 16/* $Id$ */
17
fcf95fc7 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 //
703a4e51 23// //
24// //
25//////////////////////////////////////////////////////
50d05d7b 26
090026bf 27#include <TMath.h>
28
29#include "AliITSresponseSDD.h"
3176641e 30#include <AliITSgeomTGeo.h>
fcf95fc7 31
10add0d4 32const Float_t AliITSresponseSDD::fgkTimeOffsetDefault = 54.30;
d644eb2d 33const Float_t AliITSresponseSDD::fgkADC2keVDefault = 3.34;
34const Float_t AliITSresponseSDD::fgkChargevsTimeDefault = 0.00355;
374200ee 35const Float_t AliITSresponseSDD::fgkADCvsDrTimeDefault = 0.0101;
de075dae 36const Float_t AliITSresponseSDD::fgkCarlosRXClockPeriod = 25.;
48058160 37ClassImp(AliITSresponseSDD)
50d05d7b 38
fcf95fc7 39//_________________________________________________________________________
4bfbde86 40AliITSresponseSDD::AliITSresponseSDD():
253e68a0 41TObject(),
e71a6286 42 fTimeOffset(fgkTimeOffsetDefault),
43 fADC2keV(fgkADC2keVDefault),
374200ee 44 fChargevsTime(fgkChargevsTimeDefault)
45{
50d05d7b 46 // default constructor
3176641e 47 for(Int_t i=0; i<kNSDDmods;i++){
48 fTimeZero[i]=fgkTimeOffsetDefault;
e71a6286 49 fDeltaVDrift[i] = fDeltaVDrift[i+kNSDDmods] = 0.;
57019696 50 fADCtokeV[i]=fgkADC2keVDefault;
374200ee 51 fADCvsDriftTime[i]=fgkADCvsDrTimeDefault;
3176641e 52 }
e71a6286 53 SetVDCorr2Side(kTRUE); // default for new objects will be separate corrections for 2 sides (bwd compatible)
ef24eb3b 54 // SetVDCorrMult(kTRUE); // default for new objects will have multiplicative correction v'=(1+corr)*v (bwd compatible)
3176641e 55}
56//_________________________________________________________________________
57void AliITSresponseSDD::SetHalfLadderATimeZero(Int_t lay, Int_t lad, Float_t tzero){
58 // Sets time Zero for all modules of a ladder on side A (Z>0)
59 Int_t minMod,maxMod;
60 if(lay==3){
61 minMod=1;
62 maxMod=3;
63 if(lad>kNLaddersLay3){
64 AliError(Form("Ladder number %d out of range",lad));
65 return;
66 }
67 }else if(lay==4){
68 minMod=1;
69 maxMod=4;
70 if(lad>kNLaddersLay4){
71 AliError(Form("Ladder number %d out of range",lad));
72 return;
73 }
74 }else{
75 AliError(Form("Layer number %d out of range",lay));
76 return;
77 }
78 for(Int_t iMod=minMod; iMod<=maxMod; iMod++){
79 Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(lay,lad,iMod);
80 SetModuleTimeZero(modIndex,tzero);
81 }
82}
83//_________________________________________________________________________
84void AliITSresponseSDD::SetHalfLadderCTimeZero(Int_t lay, Int_t lad, Float_t tzero){
85 // Sets time Zero for all modules of a ladder on side C (Z<0)
86 Int_t minMod,maxMod;
87 if(lay==3){
88 minMod=4;
89 maxMod=6;
90 if(lad>kNLaddersLay3){
91 AliError(Form("Ladder number %d out of range",lad));
92 return;
93 }
94 }else if(lay==4){
95 minMod=5;
96 maxMod=8;
97 if(lad>kNLaddersLay4){
98 AliError(Form("Ladder number %d out of range",lad));
99 return;
100 }
101 }else{
102 AliError(Form("Layer number %d out of range",lay));
103 return;
104 }
105 for(Int_t iMod=minMod; iMod<=maxMod; iMod++){
106 Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(lay,lad,iMod);
107 SetModuleTimeZero(modIndex,tzero);
108 }
9de0700b 109}
dfb09666 110//_________________________________________________________________________
111void AliITSresponseSDD::PrintChargeCalibrationParams() const{
374200ee 112 // Dump charge calibration parameters
113
dfb09666 114 printf("ADC vs. drift time corr=%f\n",GetChargevsTime());
115 printf("-------------------------------------\n");
116 printf("Layer 3\n");
117 for(Int_t ilad=1; ilad<=14; ilad++){
118 for(Int_t idet=1; idet<=6;idet++){
119 Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(3,ilad,idet);
120 Float_t tz=GetADCtokeV(modIndex);
121 printf("%7.2f ",tz);
122 }
123 printf("\n");
124 }
125 printf("\n");
126 printf("Layer 4\n");
127 for(Int_t ilad=1; ilad<=22; ilad++){
128 for(Int_t idet=1; idet<=8;idet++){
129 Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(4,ilad,idet);
130 Float_t tz=GetADCtokeV(modIndex);
131 printf("%7.2f ",tz);
132 }
133 printf("\n");
134 }
135}
136//_________________________________________________________________________
137void AliITSresponseSDD::PrintTimeZeroes() const{
374200ee 138 // Dump time zero values
139
dfb09666 140 printf("Layer 3\n");
141 for(Int_t ilad=1; ilad<=14; ilad++){
142 for(Int_t idet=1; idet<=6;idet++){
143 Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(3,ilad,idet);
144 Float_t tz=GetTimeZero(modIndex);
145 printf("%7.2f ",tz);
146 }
147 printf("\n");
148 }
149 printf("\n");
150 printf("Layer 4\n");
151 for(Int_t ilad=1; ilad<=22; ilad++){
152 for(Int_t idet=1; idet<=8;idet++){
153 Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(4,ilad,idet);
154 Float_t tz=GetTimeZero(modIndex);
155 printf("%7.2f ",tz);
156 }
157 printf("\n");
158 }
159
160}
161//_________________________________________________________________________
162void AliITSresponseSDD::PrintVdriftCorerctions() const{
374200ee 163 // Dump corrections to vdrift
164
dfb09666 165 for(Int_t iMod=240; iMod<500; iMod++){
166 printf("Module %d dVleft=%f dVright=%f\n",iMod,GetDeltaVDrift(iMod,0),GetDeltaVDrift(iMod,1));
167 }
168}