]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSresponseSDD.cxx
Coverity
[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 #include <AliITSgeomTGeo.h>
31
32 const Float_t AliITSresponseSDD::fgkTimeOffsetDefault = 54.30;
33 const Float_t AliITSresponseSDD::fgkADC2keVDefault = 3.34;
34 const Float_t AliITSresponseSDD::fgkChargevsTimeDefault = 0.00355;
35 const Float_t AliITSresponseSDD::fgkCarlosRXClockPeriod = 25.;
36 ClassImp(AliITSresponseSDD)
37
38 //_________________________________________________________________________
39 AliITSresponseSDD::AliITSresponseSDD():
40 TObject(),
41   fTimeOffset(fgkTimeOffsetDefault),
42   fADC2keV(fgkADC2keVDefault),
43   fChargevsTime(fgkChargevsTimeDefault){
44   // default constructor
45   for(Int_t i=0; i<kNSDDmods;i++){
46     fTimeZero[i]=fgkTimeOffsetDefault;
47     fDeltaVDrift[i] = fDeltaVDrift[i+kNSDDmods] = 0.;
48     fADCtokeV[i]=fgkADC2keVDefault;
49   }  
50   SetVDCorr2Side(kTRUE); // default for new objects will be separate corrections for 2 sides (bwd compatible)
51   //  SetVDCorrMult(kTRUE); // default for new objects will have multiplicative correction v'=(1+corr)*v (bwd compatible)
52 }
53 //_________________________________________________________________________
54 void AliITSresponseSDD::SetHalfLadderATimeZero(Int_t lay, Int_t lad, Float_t tzero){
55   // Sets time Zero for all modules of a ladder on side A (Z>0)
56   Int_t minMod,maxMod;
57   if(lay==3){
58     minMod=1; 
59     maxMod=3;
60     if(lad>kNLaddersLay3){
61       AliError(Form("Ladder number %d out of range",lad));
62       return;
63     }
64   }else if(lay==4){
65     minMod=1; 
66     maxMod=4;
67     if(lad>kNLaddersLay4){
68       AliError(Form("Ladder number %d out of range",lad));
69       return;
70     }
71   }else{
72     AliError(Form("Layer number %d out of range",lay));
73     return;
74   }
75   for(Int_t iMod=minMod; iMod<=maxMod; iMod++){
76     Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(lay,lad,iMod);
77     SetModuleTimeZero(modIndex,tzero);
78   }
79 }
80 //_________________________________________________________________________
81 void AliITSresponseSDD::SetHalfLadderCTimeZero(Int_t lay, Int_t lad, Float_t tzero){
82   // Sets time Zero for all modules of a ladder on side C (Z<0)
83   Int_t minMod,maxMod;
84   if(lay==3){
85     minMod=4; 
86     maxMod=6;
87     if(lad>kNLaddersLay3){
88       AliError(Form("Ladder number %d out of range",lad));
89       return;
90     }
91   }else if(lay==4){
92     minMod=5; 
93     maxMod=8;
94     if(lad>kNLaddersLay4){
95       AliError(Form("Ladder number %d out of range",lad));
96       return;
97     }
98   }else{
99     AliError(Form("Layer number %d out of range",lay));
100     return;
101   }
102   for(Int_t iMod=minMod; iMod<=maxMod; iMod++){
103     Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(lay,lad,iMod);
104     SetModuleTimeZero(modIndex,tzero);
105   }
106 }
107 //_________________________________________________________________________
108 void AliITSresponseSDD::PrintChargeCalibrationParams() const{
109   //
110   printf("ADC vs. drift time corr=%f\n",GetChargevsTime());
111   printf("-------------------------------------\n");
112   printf("Layer 3\n");
113   for(Int_t ilad=1; ilad<=14; ilad++){
114     for(Int_t idet=1; idet<=6;idet++){
115       Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(3,ilad,idet);
116       Float_t tz=GetADCtokeV(modIndex);
117       printf("%7.2f   ",tz);
118     }
119     printf("\n");
120   }
121   printf("\n");
122   printf("Layer 4\n");
123   for(Int_t ilad=1; ilad<=22; ilad++){
124     for(Int_t idet=1; idet<=8;idet++){
125       Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(4,ilad,idet);
126       Float_t tz=GetADCtokeV(modIndex);
127       printf("%7.2f   ",tz);
128     }
129     printf("\n");
130   }  
131 }
132 //_________________________________________________________________________
133 void AliITSresponseSDD::PrintTimeZeroes() const{
134   //
135   printf("Layer 3\n");
136   for(Int_t ilad=1; ilad<=14; ilad++){
137     for(Int_t idet=1; idet<=6;idet++){
138       Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(3,ilad,idet);
139       Float_t tz=GetTimeZero(modIndex);
140       printf("%7.2f   ",tz);
141     }
142     printf("\n");
143   }
144   printf("\n");
145   printf("Layer 4\n");
146   for(Int_t ilad=1; ilad<=22; ilad++){
147     for(Int_t idet=1; idet<=8;idet++){
148       Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(4,ilad,idet);
149       Float_t tz=GetTimeZero(modIndex);
150       printf("%7.2f   ",tz);
151     }
152     printf("\n");
153   }
154   
155 }
156 //_________________________________________________________________________
157 void AliITSresponseSDD::PrintVdriftCorerctions() const{
158   //
159   for(Int_t iMod=240; iMod<500; iMod++){
160     printf("Module %d   dVleft=%f   dVright=%f\n",iMod,GetDeltaVDrift(iMod,0),GetDeltaVDrift(iMod,1));
161   }
162 }