]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsegmentationSDD.cxx
Variable format fixed (e.g., fx -> fX)
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSDD.cxx
CommitLineData
b0f5e3fc 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#include <TMath.h>
17
b0f5e3fc 18#include "AliITSsegmentationSDD.h"
19#include "AliITS.h"
314ba410 20#include "AliITSgeom.h"
b0f5e3fc 21#include "AliRun.h"
314ba410 22#include "AliITSresponse.h"
b0f5e3fc 23
b0f5e3fc 24
25ClassImp(AliITSsegmentationSDD)
26//------------------------------
27AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom, AliITSresponse *resp){
28 // constructor
29 fGeom=geom;
30 fResponse=resp;
31 fCorr=0;
32 SetDetSize();
e8189707 33 SetPadSize();
34 SetNPads();
b0f5e3fc 35
36}
37//_____________________________________________________________________________
38AliITSsegmentationSDD::AliITSsegmentationSDD(){
e8189707 39 // standard constructor
b0f5e3fc 40 fGeom=0;
41 fResponse=0;
42 fCorr=0;
43 SetDetSize();
e8189707 44 SetPadSize();
45 SetNPads();
b0f5e3fc 46
47}
48//_____________________________________________________________________________
49AliITSsegmentationSDD& AliITSsegmentationSDD::operator=(AliITSsegmentationSDD &source){
50 // Operator =
51 if(this==&source) return *this;
52 this->fNsamples = source.fNsamples;
53 this->fNanodes = source.fNanodes;
54 this->fPitch = source.fPitch;
55 this->fTimeStep = source.fTimeStep;
56 this->fDx = source.fDx;
57 this->fDz = source.fDz;
58 this->fDy = source.fDy;
59 this->fCorr = new TF1(*(source.fCorr));
60 this->fGeom = source.fGeom; // Just copy the pointer
61 this->fResponse = source.fResponse; //Just copy the pointer
62 return *this;
63}
64//___________________________________________________________________________
65AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSsegmentationSDD &source){
66 // Copy constructor
67 *this = source;
68}
69//------------------------------
70void AliITSsegmentationSDD::Init(){
71 // Standard initilisation routine
72
e8189707 73 if(!fGeom) {
314ba410 74 return;
75 //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
e8189707 76 }
b0f5e3fc 77 AliITSgeomSDD *gsdd = (AliITSgeomSDD *) (fGeom->GetShape(3,1,1));
78
79 const Float_t kconv=10000.;
80 fDz = 2.*kconv*gsdd->GetDz();
81 fDx = kconv*gsdd->GetDx();
82 fDy = 2.*kconv*gsdd->GetDy();
83}
84
85//------------------------------
86void AliITSsegmentationSDD::
314ba410 87Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
88 // returns neighbours for use in Cluster Finder routines and the like
b0f5e3fc 89
e8189707 90 if(iX >= fNanodes) printf("iX > fNanodes %d %d\n",iX,fNanodes);
91 if(iZ >= fNsamples) printf("iZ > fNsamples %d %d\n",iZ,fNsamples);
b0f5e3fc 92 *Nlist=4;
93 Xlist[0]=Xlist[1]=iX;
314ba410 94 if(iX && (iX != fNanodes/2)) Xlist[2]=iX-1;
b0f5e3fc 95 else Xlist[2]=iX;
314ba410 96 if ((iX !=fNanodes/2 -1) && (iX != fNanodes)) Xlist[3]=iX+1;
b0f5e3fc 97 else Xlist[3]=iX;
98 if(iZ) Zlist[0]=iZ-1;
99 else Zlist[0]=iZ;
100 if (iZ < fNsamples) Zlist[1]=iZ+1;
101 else Zlist[1]=iZ;
102 Zlist[2]=Zlist[3]=iZ;
b0f5e3fc 103}
104//------------------------------
e8189707 105void AliITSsegmentationSDD::GetPadIxz(Float_t x,Float_t z,Int_t &timebin,Int_t &anode){
b0f5e3fc 106// Returns cell coordinates (time sample,anode) for given real local coordinates (x,z)
107
108 // expects x, z in cm
109
110 const Float_t kconv=10000; // cm->um
111
112 Float_t speed=fResponse->DriftSpeed();
113 Int_t na = fNanodes/2;
114 Float_t driftpath=fDx-TMath::Abs(kconv*x);
115 timebin=(Int_t)(driftpath/speed/fTimeStep);
e8189707 116 anode=(Int_t)(kconv*z/fPitch) + na/2;
b0f5e3fc 117 if (x > 0) anode += na;
118
119 timebin+=1;
120 anode+=1;
121
122}
123
124//------------------------------
e8189707 125void AliITSsegmentationSDD::GetPadCxz(Int_t timebin,Int_t anode,Float_t &x ,Float_t &z){
b0f5e3fc 126 // Transform from cell to real local coordinates
127
128 // returns x, z in cm
129
130 const Float_t kconv=10000; // um->cm
131
132 Float_t speed=fResponse->DriftSpeed();
133 Int_t na = fNanodes/2;
134 Float_t driftpath=(timebin+1)*fTimeStep*speed;
135 if (anode >= na) x=(fDx-driftpath)/kconv;
136 else x = -(fDx-driftpath)/kconv;
137 if (anode >= na) anode-=na;
138 z=((anode+1)*fPitch-fDz/2)/kconv;
139
140}
141
e8189707 142//------------------------------
143void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z){
144 // Get anode and time bucket as floats - numbering from 0
145
146 // expects x, z in cm
147
148 const Float_t kconv=10000; // cm->um
149
314ba410 150 //Float_t x0=x;
e8189707 151 Float_t speed=fResponse->DriftSpeed();
314ba410 152 //Int_t na = fNanodes/2;
e8189707 153 Float_t driftpath=fDx-TMath::Abs(kconv*x);
154 x=driftpath/speed/fTimeStep;
314ba410 155 z=kconv*z/fPitch;
156 // z=kconv*z/fPitch + (float)na/2;
157 //if (x0 > 0) z += (float)na;
e8189707 158
159}
b0f5e3fc 160//------------------------------
161void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l){
162 // returns local coordinates from global
163 if(!fGeom) {
314ba410 164 return;
165 //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
b0f5e3fc 166 }
167 fGeom->GtoL(module,g,l);
168}
169//------------------------------
170void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g){
171 // return global coordinates from local
172 if(!fGeom) {
314ba410 173 return;
174 //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
b0f5e3fc 175 }
176
177 fGeom->LtoG(module,l,g);
178
179}