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