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