]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationTrigger.cxx
AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTrigger.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 Revision 1.3  2000/06/26 10:00:14  pcrochet
19 global variables removed, problem with HP compiler solved (PH)
20
21 Revision 1.2  2000/06/15 07:58:48  morsch
22 Code from MUON-dev joined
23
24 Revision 1.1.2.1  2000/06/09 21:47:24  morsch
25 Code from AliMUONSegResTrigger.cxx
26
27 */
28
29 /*
30 old Log:
31 AliMUONSegResTrigger.cxx,v $
32 Revision 1.1.2.3  2000/04/26 12:32:39  morsch
33 Mods by P. Crochet:
34 - adapted to the new Trigger chamber geometry
35 - method SetZScale removed
36
37 Revision 1.1.2.2  2000/02/21 16:13:33  morsch
38 Full cluster simulation activated by uncommenting corresponding lines in IntXY()
39
40 Revision 1.1.2.1  2000/02/17 14:32:40  morsch
41 Draft version from P. Crochet
42
43 */
44
45 #include "AliMUONSegmentationTrigger.h"
46 #include "AliMUONTriggerConstants.h"
47 #include "AliRun.h"
48 #include "AliMUON.h"
49 #include <TMath.h>
50 #include <TRandom.h>
51 #include <TArc.h>
52 #include "AliMUONChamber.h"
53 #include <iostream.h>
54  
55 ClassImp(AliMUONSegmentationTrigger)
56
57 //------------------------------------------------------------------
58 void AliMUONSegmentationTrigger::Init(Int_t chamber)
59 {
60   // initialize Module geometry
61   cout << "Initialize Trigger Chamber Module Geometry " << "\n";    
62
63   AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
64   AliMUONChamber* iChamber=&(pMUON->Chamber(chamber));
65
66   Float_t zPos=iChamber->Z();
67   Float_t z1Pos=1603.5;
68   fZscale = zPos/z1Pos;
69
70   Float_t y1Cmin[126];
71   Float_t y1Cmax[126];
72
73   Float_t dz=7.2;
74   Float_t z1PosPlus=z1Pos+dz/2.;
75   Float_t z1PosMinus=z1Pos-dz/2.;
76
77   Float_t z1pm=z1PosPlus/z1PosMinus;
78   Float_t z1mp=z1PosMinus/z1PosPlus;
79
80   cout << " fZscale = " << fZscale << "\n";
81   
82 // calculate yCmin and fYcmax 
83   Int_t i;  
84   for (i=62; i>=0; i--) {
85     Int_t j=ModuleNumber(-AliMUONTriggerConstants::ModuleId(i));  // i == right, j == left 
86     if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==5) {  // start with middle chamber
87       if (AliMUONTriggerConstants::ModuleId(i)==51) {         // special case (empty module)
88         fYcmin[i]=fYcmax[i]=fYcmin[j]=fYcmax[j]=0.;
89       } else {
90         y1Cmin[i]=y1Cmin[j]=-34;
91         y1Cmax[i]=y1Cmax[j]=34;
92         fYcmin[i]=fYcmin[j]=-34.;
93
94         fYcmax[i]=fYcmax[j]=34.;
95       }
96     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==4) { // up
97       if (AliMUONTriggerConstants::ModuleId(i)!=41) {       
98         y1Cmin[i]=y1Cmax[i+7]*z1pm;
99         y1Cmax[i]=y1Cmin[i]+68.;
100         fYcmin[i]=y1Cmin[i];
101         fYcmax[i]=fYcmin[i]+68.;
102
103         y1Cmin[j]=y1Cmax[j+7]*z1mp;
104         y1Cmax[j]=y1Cmin[j]+68.;
105         fYcmin[j]=y1Cmin[j];
106         fYcmax[j]=fYcmin[j]+68.;
107       } else { 
108         y1Cmin[i]=y1Cmin[ModuleNumber(42)]+17;
109         y1Cmax[i]=y1Cmin[i]+51.;
110         fYcmin[i]=y1Cmin[i];
111         fYcmax[i]=fYcmin[i]+51.;
112
113         y1Cmin[j]=y1Cmin[ModuleNumber(-42)]+17;
114         y1Cmax[j]=y1Cmin[j]+51.;
115         fYcmin[j]=y1Cmin[j];
116         fYcmax[j]=fYcmin[j]+51.;
117       }
118     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==3) { 
119       y1Cmin[i]=y1Cmax[i+7]*z1mp;
120       y1Cmax[i]=y1Cmin[i]+68.;
121       fYcmin[i]=y1Cmin[i];
122       fYcmax[i]=fYcmin[i]+68.;
123
124       y1Cmin[j]=y1Cmax[j+7]*z1pm;
125       y1Cmax[j]=y1Cmin[j]+68.;
126       fYcmin[j]=y1Cmin[j];
127       fYcmax[j]=fYcmin[j]+68.;
128     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==2) {
129       y1Cmin[i]=y1Cmax[i+7]*z1pm;
130       y1Cmax[i]=y1Cmin[i]+68.;
131       fYcmin[i]=y1Cmin[i];
132       fYcmax[i]=fYcmin[i]+68.;
133
134       y1Cmin[j]=y1Cmax[j+7]*z1mp;
135       y1Cmax[j]=y1Cmin[j]+68.;
136       fYcmin[j]=y1Cmin[j];
137       fYcmax[j]=fYcmin[j]+68.;
138     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==1) {
139       y1Cmin[i]=y1Cmax[i+7]*z1mp;
140       y1Cmax[i]=y1Cmin[i]+68.;
141       fYcmin[i]=y1Cmin[i];
142       fYcmax[i]=fYcmin[i]+68.;
143
144       y1Cmin[j]=y1Cmax[j+7]*z1pm;
145       y1Cmax[j]=y1Cmin[j]+68.;
146       fYcmin[j]=y1Cmin[j];
147       fYcmax[j]=fYcmin[j]+68.;
148     }
149   }
150
151   for (i=0; i<63; i++) {      // second loop (fill lower part)
152     Int_t j=ModuleNumber(-AliMUONTriggerConstants::ModuleId(i));  // i == right, j == left 
153     if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==6) { 
154       fYcmin[i]=-fYcmax[i-14];
155       fYcmax[i]=-fYcmin[i-14];
156       fYcmin[j]=-fYcmax[j-14];
157       fYcmax[j]=-fYcmin[j-14];
158     } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==7) { 
159       fYcmin[i]=-fYcmax[i-28];
160       fYcmax[i]=-fYcmin[i-28];
161       fYcmin[j]=-fYcmax[j-28];
162       fYcmax[j]=-fYcmin[j-28];
163     } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==8) { 
164       fYcmin[i]=-fYcmax[i-42];
165       fYcmax[i]=-fYcmin[i-42];
166       fYcmin[j]=-fYcmax[j-42];
167       fYcmax[j]=-fYcmin[j-42];
168     } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==9) { 
169       fYcmin[i]=-fYcmax[i-56];
170       fYcmax[i]=-fYcmin[i-56];
171       fYcmin[j]=-fYcmax[j-56];
172       fYcmax[j]=-fYcmin[j-56];
173     } 
174   }
175
176   fNpx=124;
177   fNpy=64;  
178
179   cout << "---------------------------------------------------- \n";   
180
181 }
182
183 //------------------------------------------------------------------
184 Int_t AliMUONSegmentationTrigger::ModuleNumber(Int_t imodule){
185 // returns module number (from 0 to 126) corresponding to module imodule
186   Int_t imod=0;
187   for (Int_t i=0; i<AliMUONTriggerConstants::Nmodule(); i++) {
188     if (AliMUONTriggerConstants::ModuleId(i)==imodule) { 
189       imod=i;
190       break;
191     }
192   }
193   return imod;
194 }
195
196 //------------------------------------------------------------------
197 Float_t AliMUONSegmentationTrigger::StripSizeX(Int_t imodule){
198 // Returns x-strip size for given module imodule
199
200   Int_t absimodule=TMath::Abs(imodule); 
201   Int_t moduleNum=ModuleNumber(imodule);
202   if (absimodule==51) {
203     return 0; 
204   } else {
205     return TMath::Abs((fYcmax[moduleNum]-fYcmin[moduleNum])/
206                       AliMUONTriggerConstants::NstripX(moduleNum));
207   }  
208 }
209
210 //------------------------------------------------------------------
211 Float_t AliMUONSegmentationTrigger::StripSizeY(Int_t imodule){
212 // Returns y-strip size for given module imodule
213         
214   Int_t absimodule=TMath::Abs(imodule); 
215   Int_t moduleNum=ModuleNumber(imodule);
216   if (absimodule==51) {
217     return 0;
218   } else {
219       return TMath::Abs((AliMUONTriggerConstants::XcMax(moduleNum) - 
220                          AliMUONTriggerConstants::XcMin(moduleNum)) / 
221                         AliMUONTriggerConstants::NstripY(moduleNum));
222   }
223 }
224
225 //------------------------------------------------------------------   
226 void AliMUONSegmentationTrigger::SetHit(Float_t xhit, Float_t yhit)
227 {
228     // Sets virtual hit position, needed for evaluating pad response 
229     // outside the tracking program 
230     
231   fxhit=xhit;
232   fyhit=yhit;
233 }
234
235
236
237
238
239
240
241
242