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