]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationTriggerX.cxx
previous error corrected
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTriggerX.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.7 2000/10/03 21:48:07 morsch
19Adopt to const declaration of some of the methods in AliSegmentation.
20
c3eff6ad 21Revision 1.6 2000/10/02 16:58:29 egangler
22Cleaning of the code :
23-> coding conventions
24-> void Streamers
25-> some useless includes removed or replaced by "class" statement
26
ecfa008b 27Revision 1.5 2000/07/03 11:54:57 morsch
28AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
29The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
30
a30a000f 31Revision 1.4 2000/06/29 12:34:09 morsch
32AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
33it usable with any other geometry class. The link to the object to which it belongs is
34established via an index. This assumes that there exists a global geometry manager
35from which the pointer to the parent object can be obtained (in our case gAlice).
36
d81db581 37Revision 1.3 2000/06/26 10:01:26 pcrochet
38global variables removed
39
3f2cdba8 40Revision 1.2 2000/06/15 07:58:48 morsch
41Code from MUON-dev joined
42
a9e2aefa 43Revision 1.1.2.1 2000/06/09 21:51:03 morsch
44Code from AliMUONSegResTrigger.cxx
45
46*/
47
48
3f2cdba8 49
a9e2aefa 50/*
51Old Log:
52Revision 1.1.2.4 2000/04/26 12:33:25 morsch
53Minor changes in some methods (CP)
54
55Revision 1.1.2.3 2000/03/20 18:14:16 morsch
56Missing sector added.
57
58Revision 1.1.2.2 2000/02/20 07:50:49 morsch
59Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
60
61Revision 1.1.2.1 2000/02/17 14:33:49 morsch
62Draft version from P. Crochet
63
64*/
65
5fd73042 66#include <TMath.h>
67#include <TBRIK.h>
68#include <TNode.h>
69#include <TGeometry.h>
70
71#include "AliMUON.h"
a9e2aefa 72#include "AliMUONSegmentationTriggerX.h"
3f2cdba8 73#include "AliMUONTriggerConstants.h"
a9e2aefa 74#include "TMath.h"
75#include "TRandom.h"
76#include "TArc.h"
77#include "AliMUONChamber.h"
5fd73042 78#include "AliRun.h" // gAlice
a9e2aefa 79#include <iostream.h>
80ClassImp(AliMUONSegmentationTriggerX)
3f2cdba8 81
82//------------------------------------------------------------------
d81db581 83void AliMUONSegmentationTriggerX::Init(Int_t chamber)
a9e2aefa 84{
3f2cdba8 85// intialize X segmentation
a9e2aefa 86 cout << "Initialize Trigger Chamber Geometry X " << "\n";
d81db581 87 AliMUONSegmentationTrigger::Init(chamber);
a9e2aefa 88
89// calculate x & y position of X strips
3f2cdba8 90 Int_t nModule=AliMUONTriggerConstants::Nmodule();
91 for (Int_t imodule=0; imodule<nModule; imodule++) {
92 Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));
93 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
94 for (Int_t istrip=0; istrip<nStrip; istrip++){
95 fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
96 fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
a9e2aefa 97
3f2cdba8 98 fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
99 fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
a9e2aefa 100 }
101 }
102}
103
104//------------------------------------------------------------------
c3eff6ad 105void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
106{
a9e2aefa 107// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
108// x,y = real coordinates; ix = module number , iy = strip number
109 ix = 0;
110 iy = 0;
3f2cdba8 111 Int_t nModule=AliMUONTriggerConstants::Nmodule();
112 for (Int_t imodule=0; imodule<nModule; imodule++) {
113 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
114 for (Int_t istrip=0; istrip<nStrip; istrip++){
115 if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
116 y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
117 ix = AliMUONTriggerConstants::ModuleId(imodule);
118 iy = istrip;
119 }
a9e2aefa 120 }
a9e2aefa 121 }
122}
123
124//------------------------------------------------------------------
c3eff6ad 125void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
126{
a9e2aefa 127// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
128// ix = module number , iy = strip number; x,y = center of strip
129 x = 0.;
130 y = 0.;
3f2cdba8 131 Int_t nModule=AliMUONTriggerConstants::Nmodule();
132
133 for (Int_t imodule=0; imodule<nModule; imodule++) {
134 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 135 x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
136 y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
137 }
138 }
139}
140
141//------------------------------------------------------------------
142void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
143{
144// Sets the padsize
145//
146 fDpx=p1;
147 fDpy=p2;
148}
149
150//------------------------------------------------------------------
151void AliMUONSegmentationTriggerX::
c3eff6ad 152Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2])
153{
a9e2aefa 154// Returns list of next neighbours for given Pad (ix, iy)
155
156 Int_t absiX=TMath::Abs(iX);
157 *Nlist = 0;
158
159 if (absiX!=0) {
160 Int_t numModule=ModuleNumber(absiX);
161
3f2cdba8 162 if (iY<AliMUONTriggerConstants::NstripX(numModule)-1) { // strip up in same module
a9e2aefa 163 *Nlist=1;
164 Xlist[0]=absiX;
165 Ylist[0]=iY+1;
166 }
167
168 if (iY>0) { // strip down in same module
169 *Nlist=*Nlist+1;
170 Xlist[*Nlist-1]=absiX;
171 Ylist[*Nlist-1]=iY-1;
172 }
173
174 if (iX<0) { // left side of chamber
175 for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
176 }
177 }
178}
179
180//------------------------------------------------------------------
181void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
182{
183 // Sets virtual pad coordinates, needed for evaluating pad response
184 // outside the tracking program
ecfa008b 185 GetPadC(ix,iy,fX,fY);
186 GetPadI(fX,fY,fIx,fIy);
a9e2aefa 187 fSector=Sector(ix,iy);
188}
189
190//------------------------------------------------------------------
c3eff6ad 191Int_t AliMUONSegmentationTriggerX::ISector()
a9e2aefa 192{ return fSector;}
193
194//------------------------------------------------------------------
195Int_t AliMUONSegmentationTriggerX::Ix()
ecfa008b 196{ return fIx;}
a9e2aefa 197
198//------------------------------------------------------------------
c3eff6ad 199
a9e2aefa 200Int_t AliMUONSegmentationTriggerX::Iy()
ecfa008b 201{ return fIy;}
a9e2aefa 202
203//------------------------------------------------------------------
c3eff6ad 204Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const
3f2cdba8 205{
206// returns x size of x strips for sector isec
a9e2aefa 207
208 if (isec==1) {
209 return 17.0*fZscale;
210 } else if (isec==2) {
211 return 34.0*fZscale;
212 } else if (isec==3) {
213 return 34.0*fZscale;
214 } else if (isec==4) {
215 return 34.0*fZscale;
216 } else if (isec==5) {
217 return 34.0*fZscale;
218 } else if (isec==6) {
219 return 68.0*fZscale;
220 } else {
221 return 0.;
222 }
223}
224
225//------------------------------------------------------------------
c3eff6ad 226Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const
3f2cdba8 227{
228// returns y size of x strips for sector isec
a9e2aefa 229
230 if (isec==1) {
231 return 1.0625*fZscale;
232 } else if (isec==2) {
233 return 1.0625*fZscale;
234 } else if (isec==3) {
235 return 1.0625*fZscale;
236 } else if (isec==4) {
237 return 2.125*fZscale;
238 } else if (isec==5) {
239 return 4.25*fZscale;
240 } else if (isec==6) {
241 return 4.25*fZscale;
242 } else {
243 return 0.;
244 }
245}
246
247//------------------------------------------------------------------
248void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 249{
250// set hit during disIntegration
251AliMUONSegmentationTrigger::SetHit(xhit,yhit);
252}
a9e2aefa 253
254//------------------------------------------------------------------
c3eff6ad 255Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy)
a9e2aefa 256{
257// Returns sector number for given module
258//
3f2cdba8 259
a9e2aefa 260 Int_t absix=TMath::Abs(ix);
261 Int_t iwidth=Int_t(StripSizeX(absix));
3f2cdba8 262
a9e2aefa 263 if (absix==52) {
264 return 1;
265 } else if (absix==41||absix==61) {
266 return 2;
267 } else if (iwidth==1) {
268 return 3;
269 } else if (iwidth==2) {
270 return 4;
271 } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) {
272 return 5;
273 } else if (iwidth==4) {
274 return 6;
275 } else {
276 return 0;
277 }
278}
279
280//------------------------------------------------------------------
281void AliMUONSegmentationTriggerX::
282IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
3f2cdba8 283{
284// returns quantities needed to evaluate neighbour strip response
285
a9e2aefa 286 Int_t ix,iy;
287 Float_t xstrip,ystrip;
ecfa008b 288 GetPadI(fXhit,fYhit,ix,iy);
a30a000f 289 GetPadC(ix,iy,xstrip,ystrip);
ecfa008b 290 x1=fYhit; // hit y position
a9e2aefa 291 x2=ystrip; // y coordinate of the main strip
ecfa008b 292 x3=fY; // current strip real y coordinate
a9e2aefa 293 width=StripSizeX(ix); // width of the main strip
294}
295
5fd73042 296//------------------------------------------------------------------
297void AliMUONSegmentationTriggerX::Draw(const char* opt) const
298{
299
300 if (!strcmp(opt,"eventdisplay")) {
301 TNode *node, *nodeS;
302 char nameChamber[10], nameNode[10];
303 char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10];
304
305 TNode* top=gAlice->GetGeometry()->GetNode("alice");
306 sprintf(nameChamber,"C_MUON%d",fId+1);
307 new TBRIK(nameChamber,"Mother","void",340.,340.,0.25);
308 top->cd();
309 sprintf(nameNode,"MUON%d",100+fId+1);
310 node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
311 node->SetLineColor(kBlack);
312 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
313 (pMUON->Nodes())->Add(node);
314
315 sprintf(nameSense1,"S1_MUON%d",fId+1);
316 sprintf(nameSense2,"S2_MUON%d",fId+1);
317 sprintf(nameSense3,"S3_MUON%d",fId+1);
318 sprintf(nameSense4,"S4_MUON%d",fId+1);
319
320 for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) {
321 Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule);
322
323 if (TMath::Abs(idModule)!=51) {
324
325 Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule);
326 Float_t xmin=fXofxsmin[imodule][0];
327 Float_t xmax=fXofxsmax[imodule][nStripX-1];
328 Float_t ymin=fYofxsmin[imodule][0];
329 Float_t ymax=fYofxsmax[imodule][nStripX-1];
330 Float_t xpos=xmin+(xmax-xmin)/2.;
331 Float_t ypos=ymin+(ymax-ymin)/2.;
332 Float_t halfx=(xmax-xmin)/2.;
333 Float_t halfy=(ymax-ymin)/2.;
334
335 if (idModule==11)
336 new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25);
337 if (idModule==17)
338 new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25);
339 if (idModule==41)
340 new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25);
341 if (idModule==52)
342 new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25);
343 node->cd();
344 sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule);
345
346 if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) {
347 nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,"");
348 } else if (TMath::Abs(idModule)==52) {
349 nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,"");
350 } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) {
351 nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,"");
352 } else {
353 // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) {
354 nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,"");
355 }
356 nodeS->SetLineColor(kBlue);
357 node->cd();
358 }
359 }
360 }
361}
a9e2aefa 362
363