1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliITSgeom.h"
19 #include "AliITSsegmentationSDD.h"
25 ClassImp(AliITSsegmentationSDD)
26 //------------------------------
27 AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom, AliITSresponse *resp){
37 //_____________________________________________________________________________
38 AliITSsegmentationSDD::AliITSsegmentationSDD(){
47 //_____________________________________________________________________________
48 AliITSsegmentationSDD& AliITSsegmentationSDD::operator=(AliITSsegmentationSDD &source){
50 if(this==&source) return *this;
51 this->fNsamples = source.fNsamples;
52 this->fNanodes = source.fNanodes;
53 this->fPitch = source.fPitch;
54 this->fTimeStep = source.fTimeStep;
55 this->fDx = source.fDx;
56 this->fDz = source.fDz;
57 this->fDy = source.fDy;
58 this->fCorr = new TF1(*(source.fCorr));
59 this->fGeom = source.fGeom; // Just copy the pointer
60 this->fResponse = source.fResponse; //Just copy the pointer
63 //___________________________________________________________________________
64 AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSsegmentationSDD &source){
68 //------------------------------
69 void AliITSsegmentationSDD::Init(){
70 // Standard initilisation routine
72 AliITSgeomSDD *gsdd = (AliITSgeomSDD *) (fGeom->GetShape(3,1,1));
74 const Float_t kconv=10000.;
75 fDz = 2.*kconv*gsdd->GetDz();
76 fDx = kconv*gsdd->GetDx();
77 fDy = 2.*kconv*gsdd->GetDy();
80 //------------------------------
81 void AliITSsegmentationSDD::
82 Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[4], Int_t Zlist[4]){
83 // returns neighbers for use in Cluster Finder routines and the like
89 if (iX < fNanodes) Xlist[3]=iX+1;
93 if (iZ < fNsamples) Zlist[1]=iZ+1;
98 //------------------------------
99 void AliITSsegmentationSDD::GetCellIxz(Float_t &x,Float_t &z,Int_t &timebin,Int_t &anode){
100 // Returns cell coordinates (time sample,anode) for given real local coordinates (x,z)
102 // expects x, z in cm
104 const Float_t kconv=10000; // cm->um
106 Float_t speed=fResponse->DriftSpeed();
107 Int_t na = fNanodes/2;
108 Float_t driftpath=fDx-TMath::Abs(kconv*x);
109 timebin=(Int_t)(driftpath/speed/fTimeStep);
110 anode=(Int_t)(kconv*z/fPitch + na/2);
111 if (x > 0) anode += na;
118 //------------------------------
119 void AliITSsegmentationSDD::GetCellCxz(Int_t timebin,Int_t anode,Float_t &x ,Float_t &z){
120 // Transform from cell to real local coordinates
122 // returns x, z in cm
124 const Float_t kconv=10000; // um->cm
126 Float_t speed=fResponse->DriftSpeed();
127 Int_t na = fNanodes/2;
128 Float_t driftpath=(timebin+1)*fTimeStep*speed;
129 if (anode >= na) x=(fDx-driftpath)/kconv;
130 else x = -(fDx-driftpath)/kconv;
131 if (anode >= na) anode-=na;
132 z=((anode+1)*fPitch-fDz/2)/kconv;
136 //------------------------------
137 void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l){
138 // returns local coordinates from global
140 fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
142 fGeom->GtoL(module,g,l);
144 //------------------------------
145 void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g){
146 // return global coordinates from local
148 fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
151 fGeom->LtoG(module,l,g);