]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegResV02.cxx
Correct GetWire check on even/odd fnWires
[u/mrichter/AliRoot.git] / MUON / AliMUONSegResV02.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 /*
17 $Log$
18 */
19
20 /////////////////////////////////////////////////////
21 //  Segmentation and Response classes version 02   //
22 /////////////////////////////////////////////////////
23
24 #include <TTUBE.h>
25 #include <TNode.h> 
26 #include <TRandom.h> 
27 #include "AliMUONSegResV02.h"
28 #include "AliRun.h"
29 #include "AliMC.h"
30 #include "iostream.h"
31
32 //___________________________________________
33 ClassImp(AliMUONsegmentationV02)
34
35 void AliMUONsegmentationV02::SetPADSIZ(Float_t p1, Float_t p2)
36 {
37     fDpy=p1;
38     fDpx=p2;
39 }
40
41 Int_t AliMUONsegmentationV02::Npx()
42 {return AliMUONsegmentationV01::Npy();}
43
44 Int_t AliMUONsegmentationV02::Npy()
45 {return AliMUONsegmentationV01::Npx();}
46
47
48 Float_t AliMUONsegmentationV02::Dpx(Int_t)
49 {return fDpy;}
50
51 Float_t AliMUONsegmentationV02::Dpy(Int_t isec)
52 {return fDpxD[isec];}
53
54 Int_t AliMUONsegmentationV02::Sector(Int_t ix, Int_t iy)
55 {return AliMUONsegmentationV01::Sector(iy, ix);}
56
57 void AliMUONsegmentationV02::
58 GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
59 {
60 AliMUONsegmentationV01::GetPadIxy(y, x, iy, ix);
61 // printf("\n x,y,ix,iy %f %f %d %d", x,y,ix,iy);
62 }
63
64 void AliMUONsegmentationV02::
65 GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
66 {
67     AliMUONsegmentationV01::GetPadCxy(iy, ix, y, x);
68 //    printf("\n ix,iy,x,y %d %d %f %f ", ix,iy,x,y);
69 }
70 void    AliMUONsegmentationV02::SetPad(Int_t ix,Int_t iy)
71 {
72     GetPadCxy(ix,iy,fx,fy);
73     fSector=Sector(ix,iy);    
74 }
75
76
77
78 void AliMUONsegmentationV02::NextPad()
79 {
80   // 
81   // Step to next pad in integration region
82     Float_t xc,yc;
83     Int_t   ixc;
84     
85 //  step up    
86     if (fy < fymax && fy != 0) {
87         if (fiy==-1) fiy++;
88         fiy++;
89 //  step right 
90     } else if (fix != fixmax) {
91         if (fix==-1) fix++;
92         fix++;
93 //      get y-position of next row (yc), xc not used here       
94         GetPadCxy(fix,fiy,xc,yc);
95 //      get x-pad coordiante for 1 pad in row (fix)
96         GetPadIxy(xc,fymin,ixc,fiy);
97     } else {
98         printf("\n Error: Stepping outside integration region\n ");
99     }
100     GetPadCxy(fix,fiy,fx,fy);
101     fSector=Sector(fix,fiy);
102     if (MorePads() && 
103         (fSector ==-1 || fSector==0 || 
104          TMath::Abs(fx)<1.5 || TMath::Abs(fy)<1.5)) 
105         NextPad();
106 //    printf("\n this pad %f %f %d %d \n",fx,fy,fix,fiy);
107     
108 }
109
110 Int_t AliMUONsegmentationV02::MorePads()
111 //
112 // Are there more pads in the integration region
113 {
114     if ((fy >= fymax  && fix >= fixmax) || fx==0) {
115         return 0;
116     } else {
117         return 1;
118     }
119 }
120
121 void AliMUONsegmentationV02::
122 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
123 {
124     Int_t N;
125     AliMUONsegmentationV01::Neighbours(iY, iX, &N, Ylist, Xlist);
126     *Nlist=N;
127 }
128
129