]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationTriggerX.cxx
First PHOS calibration object data (Y.K.)
[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
88cb7938 16/* $Id$ */
a9e2aefa 17
5fd73042 18#include <TMath.h>
19#include <TBRIK.h>
20#include <TNode.h>
21#include <TGeometry.h>
22
23#include "AliMUON.h"
a9e2aefa 24#include "AliMUONSegmentationTriggerX.h"
3f2cdba8 25#include "AliMUONTriggerConstants.h"
a9e2aefa 26#include "AliMUONChamber.h"
5fd73042 27#include "AliRun.h" // gAlice
8c343c7c 28#include "AliLog.h"
30178c30 29
a9e2aefa 30ClassImp(AliMUONSegmentationTriggerX)
3f2cdba8 31
32//------------------------------------------------------------------
d81db581 33void AliMUONSegmentationTriggerX::Init(Int_t chamber)
a9e2aefa 34{
3f2cdba8 35// intialize X segmentation
8c343c7c 36 AliDebug(2,"Initialize Trigger Chamber Geometry X");
d81db581 37 AliMUONSegmentationTrigger::Init(chamber);
a9e2aefa 38
39// calculate x & y position of X strips
3f2cdba8 40 Int_t nModule=AliMUONTriggerConstants::Nmodule();
41 for (Int_t imodule=0; imodule<nModule; imodule++) {
42 Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));
43 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
44 for (Int_t istrip=0; istrip<nStrip; istrip++){
45 fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
46 fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
a9e2aefa 47
3f2cdba8 48 fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
49 fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
b6a52ffa 50/*
51 if (TMath::Abs(AliMUONTriggerConstants::ModuleId(imodule))==11) {
52 printf("module Id istrip fXofxsmin fXofxsmax fYofxsmin fYofxsmax %d %d %f %f %f %f \n",
53 AliMUONTriggerConstants::ModuleId(imodule),
54 istrip,
55 fXofxsmin[imodule][istrip],
56 fXofxsmax[imodule][istrip],
57 fYofxsmin[imodule][istrip],
58 fYofxsmax[imodule][istrip]);
59 }
60*/
61 }
a9e2aefa 62 }
63}
64
65//------------------------------------------------------------------
c3eff6ad 66void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
67{
a9e2aefa 68// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
69// x,y = real coordinates; ix = module number , iy = strip number
70 ix = 0;
71 iy = 0;
3f2cdba8 72 Int_t nModule=AliMUONTriggerConstants::Nmodule();
73 for (Int_t imodule=0; imodule<nModule; imodule++) {
74 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
75 for (Int_t istrip=0; istrip<nStrip; istrip++){
76 if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
77 y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
78 ix = AliMUONTriggerConstants::ModuleId(imodule);
79 iy = istrip;
80 }
a9e2aefa 81 }
a9e2aefa 82 }
83}
84
85//------------------------------------------------------------------
c3eff6ad 86void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
87{
a9e2aefa 88// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
89// ix = module number , iy = strip number; x,y = center of strip
90 x = 0.;
91 y = 0.;
3f2cdba8 92 Int_t nModule=AliMUONTriggerConstants::Nmodule();
93
94 for (Int_t imodule=0; imodule<nModule; imodule++) {
95 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
a9e2aefa 96 x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
97 y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
98 }
99 }
100}
101
102//------------------------------------------------------------------
103void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
104{
105// Sets the padsize
106//
107 fDpx=p1;
108 fDpy=p2;
109}
110
111//------------------------------------------------------------------
112void AliMUONSegmentationTriggerX::
03f221a7 113Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
114// Returns list of 10 next neighbours for given X strip (ix, iy)
115// neighbour number 4 in the list -
116// neighbour number 3 in the list |
117// neighbour number 2 in the list |_ Upper part
118// neighbour number 1 in the list |
119// neighbour number 0 in the list -
120// X strip (ix, iy)
121// neighbour number 5 in the list -
122// neighbour number 6 in the list | _ Lower part
123// neighbour number 7 in the list |
124// neighbour number 8 in the list |
125// neighbour number 9 in the list -
126
127 Int_t absiX = TMath::Abs(iX);
128 Int_t numModule = ModuleNumber(absiX); // module number Id.
129 Int_t nStrip = AliMUONTriggerConstants::NstripX(numModule); //numb of strips
130 Int_t iCandidateUp, iCandidateDo;
131 Int_t j;
132
133 *Nlist = 10;
134 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
135
136 if (iY < nStrip) {
137
138 for (Int_t i=0; i<5; i++) {
139 j = i + 5;
140 iCandidateUp = iY + (i + 1);
141 iCandidateDo = iY - (i + 1);
142 if (iCandidateUp < nStrip) {
143 Xlist[i] = iX;
144 Ylist[i] = iCandidateUp;
145 }
146 if (iCandidateDo >= 0) {
147 Xlist[j] = iX;
148 Ylist[j] = iCandidateDo;
149 }
a9e2aefa 150 }
03f221a7 151
152 } // iY < nStrip
a9e2aefa 153}
154
155//------------------------------------------------------------------
156void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
157{
158 // Sets virtual pad coordinates, needed for evaluating pad response
159 // outside the tracking program
ecfa008b 160 GetPadC(ix,iy,fX,fY);
161 GetPadI(fX,fY,fIx,fIy);
a9e2aefa 162 fSector=Sector(ix,iy);
163}
164
165//------------------------------------------------------------------
c3eff6ad 166Int_t AliMUONSegmentationTriggerX::ISector()
a9e2aefa 167{ return fSector;}
168
169//------------------------------------------------------------------
170Int_t AliMUONSegmentationTriggerX::Ix()
ecfa008b 171{ return fIx;}
a9e2aefa 172
173//------------------------------------------------------------------
c3eff6ad 174
a9e2aefa 175Int_t AliMUONSegmentationTriggerX::Iy()
ecfa008b 176{ return fIy;}
a9e2aefa 177
178//------------------------------------------------------------------
c3eff6ad 179Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const
3f2cdba8 180{
181// returns x size of x strips for sector isec
a9e2aefa 182
183 if (isec==1) {
3f434b6f 184 return AliMUONTriggerConstants::StripLength(0)*fZscale;
a9e2aefa 185 } else if (isec==2) {
3f434b6f 186 return AliMUONTriggerConstants::StripLength(1)*fZscale;
a9e2aefa 187 } else if (isec==3) {
3f434b6f 188 return AliMUONTriggerConstants::StripLength(1)*fZscale;
a9e2aefa 189 } else if (isec==4) {
3f434b6f 190 return AliMUONTriggerConstants::StripLength(1)*fZscale;
a9e2aefa 191 } else if (isec==5) {
3f434b6f 192 return AliMUONTriggerConstants::StripLength(1)*fZscale;
a9e2aefa 193 } else if (isec==6) {
3f434b6f 194 return AliMUONTriggerConstants::StripLength(2)*fZscale;
a9e2aefa 195 } else {
196 return 0.;
197 }
198}
199
200//------------------------------------------------------------------
c3eff6ad 201Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const
3f2cdba8 202{
203// returns y size of x strips for sector isec
a9e2aefa 204
205 if (isec==1) {
3f434b6f 206 return AliMUONTriggerConstants::StripWidth(0)*fZscale;
a9e2aefa 207 } else if (isec==2) {
3f434b6f 208 return AliMUONTriggerConstants::StripWidth(0)*fZscale;
a9e2aefa 209 } else if (isec==3) {
3f434b6f 210 return AliMUONTriggerConstants::StripWidth(0)*fZscale;
a9e2aefa 211 } else if (isec==4) {
3f434b6f 212 return AliMUONTriggerConstants::StripWidth(1)*fZscale;
a9e2aefa 213 } else if (isec==5) {
3f434b6f 214 return AliMUONTriggerConstants::StripWidth(2)*fZscale;
a9e2aefa 215 } else if (isec==6) {
3f434b6f 216 return AliMUONTriggerConstants::StripWidth(2)*fZscale;
a9e2aefa 217 } else {
218 return 0.;
219 }
220}
221
e889a146 222//------------------------------------------------------------------
223void AliMUONSegmentationTriggerX::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy)
224{
225 GetPadI(x, y, ix, iy);
226}
227
a9e2aefa 228//------------------------------------------------------------------
229void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
3f2cdba8 230{
231// set hit during disIntegration
232AliMUONSegmentationTrigger::SetHit(xhit,yhit);
233}
e889a146 234//------------------------------------------------------------------
235void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
236{
237 SetHit(xhit, yhit);
238}
a9e2aefa 239
240//------------------------------------------------------------------
e889a146 241Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t /*iy*/)
a9e2aefa 242{
243// Returns sector number for given module
244//
3f2cdba8 245
a9e2aefa 246 Int_t absix=TMath::Abs(ix);
247 Int_t iwidth=Int_t(StripSizeX(absix));
3f2cdba8 248
a9e2aefa 249 if (absix==52) {
250 return 1;
251 } else if (absix==41||absix==61) {
252 return 2;
253 } else if (iwidth==1) {
254 return 3;
255 } else if (iwidth==2) {
256 return 4;
257 } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) {
258 return 5;
259 } else if (iwidth==4) {
260 return 6;
261 } else {
262 return 0;
263 }
264}
265
266//------------------------------------------------------------------
267void AliMUONSegmentationTriggerX::
03f221a7 268IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
3f2cdba8 269{
270// returns quantities needed to evaluate neighbour strip response
271
a9e2aefa 272 Int_t ix,iy;
273 Float_t xstrip,ystrip;
ecfa008b 274 GetPadI(fXhit,fYhit,ix,iy);
a30a000f 275 GetPadC(ix,iy,xstrip,ystrip);
ecfa008b 276 x1=fYhit; // hit y position
a9e2aefa 277 x2=ystrip; // y coordinate of the main strip
ecfa008b 278 x3=fY; // current strip real y coordinate
03f221a7 279 // width=StripSizeX(ix); // width of the main strip
280
281 // find the position of the 2 borders of the current strip
282 Float_t ymin = fYofxsmin[ModuleNumber(fIx)][fIy];
283 Float_t ymax = fYofxsmax[ModuleNumber(fIx)][fIy];
284
285 // dist. between the hit and the closest border of the current strip
286 x4 = (TMath::Abs(ymax-x1) > TMath::Abs(ymin-x1)) ?
287 TMath::Abs(ymin-x1):TMath::Abs(ymax-x1);
288
a9e2aefa 289}
290
5fd73042 291//------------------------------------------------------------------
e2f5c97f 292void AliMUONSegmentationTriggerX::Draw(const char* opt)
5fd73042 293{
de05461e 294// Draw method for event display
5fd73042 295 if (!strcmp(opt,"eventdisplay")) {
e2f5c97f 296
5fd73042 297 TNode *node, *nodeS;
a5bf1dba 298 char nameChamber[10], nameNode[12];
5fd73042 299 char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10];
300
301 TNode* top=gAlice->GetGeometry()->GetNode("alice");
302 sprintf(nameChamber,"C_MUON%d",fId+1);
303 new TBRIK(nameChamber,"Mother","void",340.,340.,0.25);
304 top->cd();
305 sprintf(nameNode,"MUON%d",100+fId+1);
306 node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
307 node->SetLineColor(kBlack);
308 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
309 (pMUON->Nodes())->Add(node);
310
311 sprintf(nameSense1,"S1_MUON%d",fId+1);
312 sprintf(nameSense2,"S2_MUON%d",fId+1);
313 sprintf(nameSense3,"S3_MUON%d",fId+1);
314 sprintf(nameSense4,"S4_MUON%d",fId+1);
315
316 for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) {
317 Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule);
318
319 if (TMath::Abs(idModule)!=51) {
320
321 Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule);
322 Float_t xmin=fXofxsmin[imodule][0];
323 Float_t xmax=fXofxsmax[imodule][nStripX-1];
324 Float_t ymin=fYofxsmin[imodule][0];
325 Float_t ymax=fYofxsmax[imodule][nStripX-1];
326 Float_t xpos=xmin+(xmax-xmin)/2.;
327 Float_t ypos=ymin+(ymax-ymin)/2.;
328 Float_t halfx=(xmax-xmin)/2.;
329 Float_t halfy=(ymax-ymin)/2.;
330
331 if (idModule==11)
332 new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25);
333 if (idModule==17)
334 new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25);
335 if (idModule==41)
336 new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25);
337 if (idModule==52)
338 new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25);
339 node->cd();
340 sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule);
341
342 if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) {
343 nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,"");
344 } else if (TMath::Abs(idModule)==52) {
345 nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,"");
346 } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) {
347 nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,"");
348 } else {
349 // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) {
350 nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,"");
351 }
352 nodeS->SetLineColor(kBlue);
353 node->cd();
354 }
355 }
356 }
357}
a9e2aefa 358
359
de05461e 360
361