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