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