]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationTrigger.cxx
fWSN->Eval(0.001) to avoid fpe.
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationTrigger.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
18#include "AliMUONSegmentationTrigger.h"
0c19630f 19#include "AliMUONTriggerConstants.h"
d81db581 20#include "AliRun.h"
21#include "AliMUON.h"
a9e2aefa 22#include <TMath.h>
23#include <TRandom.h>
24#include <TArc.h>
25#include "AliMUONChamber.h"
70479d0e 26#include <Riostream.h>
5fd73042 27
a9e2aefa 28ClassImp(AliMUONSegmentationTrigger)
29
0c19630f 30//------------------------------------------------------------------
d81db581 31void AliMUONSegmentationTrigger::Init(Int_t chamber)
a9e2aefa 32{
33 // initialize Module geometry
d81db581 34 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
35 AliMUONChamber* iChamber=&(pMUON->Chamber(chamber));
36
ef077202 37 if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Module Geometry\n",ClassName());
9e1a0ddb 38
d81db581 39 Float_t zPos=iChamber->Z();
deea6fd8 40 Float_t z1Pos=-1603.5;
a9e2aefa 41 fZscale = zPos/z1Pos;
42
a9e2aefa 43 Float_t y1Cmin[126];
44 Float_t y1Cmax[126];
45
46 Float_t dz=7.2;
deea6fd8 47// Float_t z1PosPlus=z1Pos+dz/2.;
48// Float_t z1PosMinus=z1Pos-dz/2.;
49 Float_t z1PosPlus=z1Pos-dz/2.;
50 Float_t z1PosMinus=z1Pos+dz/2.;
a9e2aefa 51
52 Float_t z1pm=z1PosPlus/z1PosMinus;
53 Float_t z1mp=z1PosMinus/z1PosPlus;
54
ef077202 55 if(pMUON->GetDebug()>1) printf("%s: fZscale = %f \n",ClassName(),fZscale);
0c19630f 56
57// calculate yCmin and fYcmax
58 Int_t i;
59 for (i=62; i>=0; i--) {
60 Int_t j=ModuleNumber(-AliMUONTriggerConstants::ModuleId(i)); // i == right, j == left
61 if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==5) { // start with middle chamber
62 if (AliMUONTriggerConstants::ModuleId(i)==51) { // special case (empty module)
63 fYcmin[i]=fYcmax[i]=fYcmin[j]=fYcmax[j]=0.;
a9e2aefa 64 } else {
65 y1Cmin[i]=y1Cmin[j]=-34;
66 y1Cmax[i]=y1Cmax[j]=34;
0c19630f 67 fYcmin[i]=fYcmin[j]=-34.;
68
69 fYcmax[i]=fYcmax[j]=34.;
a9e2aefa 70 }
0c19630f 71 } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==4) { // up
72 if (AliMUONTriggerConstants::ModuleId(i)!=41) {
a9e2aefa 73 y1Cmin[i]=y1Cmax[i+7]*z1pm;
74 y1Cmax[i]=y1Cmin[i]+68.;
0c19630f 75 fYcmin[i]=y1Cmin[i];
76 fYcmax[i]=fYcmin[i]+68.;
a9e2aefa 77
78 y1Cmin[j]=y1Cmax[j+7]*z1mp;
79 y1Cmax[j]=y1Cmin[j]+68.;
0c19630f 80 fYcmin[j]=y1Cmin[j];
81 fYcmax[j]=fYcmin[j]+68.;
a9e2aefa 82 } else {
83 y1Cmin[i]=y1Cmin[ModuleNumber(42)]+17;
84 y1Cmax[i]=y1Cmin[i]+51.;
0c19630f 85 fYcmin[i]=y1Cmin[i];
86 fYcmax[i]=fYcmin[i]+51.;
a9e2aefa 87
88 y1Cmin[j]=y1Cmin[ModuleNumber(-42)]+17;
89 y1Cmax[j]=y1Cmin[j]+51.;
0c19630f 90 fYcmin[j]=y1Cmin[j];
91 fYcmax[j]=fYcmin[j]+51.;
a9e2aefa 92 }
0c19630f 93 } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==3) {
a9e2aefa 94 y1Cmin[i]=y1Cmax[i+7]*z1mp;
95 y1Cmax[i]=y1Cmin[i]+68.;
0c19630f 96 fYcmin[i]=y1Cmin[i];
97 fYcmax[i]=fYcmin[i]+68.;
a9e2aefa 98
99 y1Cmin[j]=y1Cmax[j+7]*z1pm;
100 y1Cmax[j]=y1Cmin[j]+68.;
0c19630f 101 fYcmin[j]=y1Cmin[j];
102 fYcmax[j]=fYcmin[j]+68.;
103 } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==2) {
a9e2aefa 104 y1Cmin[i]=y1Cmax[i+7]*z1pm;
105 y1Cmax[i]=y1Cmin[i]+68.;
0c19630f 106 fYcmin[i]=y1Cmin[i];
107 fYcmax[i]=fYcmin[i]+68.;
a9e2aefa 108
109 y1Cmin[j]=y1Cmax[j+7]*z1mp;
110 y1Cmax[j]=y1Cmin[j]+68.;
0c19630f 111 fYcmin[j]=y1Cmin[j];
112 fYcmax[j]=fYcmin[j]+68.;
113 } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==1) {
a9e2aefa 114 y1Cmin[i]=y1Cmax[i+7]*z1mp;
115 y1Cmax[i]=y1Cmin[i]+68.;
0c19630f 116 fYcmin[i]=y1Cmin[i];
117 fYcmax[i]=fYcmin[i]+68.;
a9e2aefa 118
119 y1Cmin[j]=y1Cmax[j+7]*z1pm;
120 y1Cmax[j]=y1Cmin[j]+68.;
0c19630f 121 fYcmin[j]=y1Cmin[j];
122 fYcmax[j]=fYcmin[j]+68.;
a9e2aefa 123 }
124 }
125
0c19630f 126 for (i=0; i<63; i++) { // second loop (fill lower part)
127 Int_t j=ModuleNumber(-AliMUONTriggerConstants::ModuleId(i)); // i == right, j == left
128 if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==6) {
129 fYcmin[i]=-fYcmax[i-14];
130 fYcmax[i]=-fYcmin[i-14];
131 fYcmin[j]=-fYcmax[j-14];
132 fYcmax[j]=-fYcmin[j-14];
133 } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==7) {
134 fYcmin[i]=-fYcmax[i-28];
135 fYcmax[i]=-fYcmin[i-28];
136 fYcmin[j]=-fYcmax[j-28];
137 fYcmax[j]=-fYcmin[j-28];
138 } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==8) {
139 fYcmin[i]=-fYcmax[i-42];
140 fYcmax[i]=-fYcmin[i-42];
141 fYcmin[j]=-fYcmax[j-42];
142 fYcmax[j]=-fYcmin[j-42];
143 } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==9) {
144 fYcmin[i]=-fYcmax[i-56];
145 fYcmax[i]=-fYcmin[i-56];
146 fYcmin[j]=-fYcmax[j-56];
147 fYcmax[j]=-fYcmin[j-56];
a9e2aefa 148 }
149 }
150
a9e2aefa 151 fNpx=124;
152 fNpy=64;
153
5fd73042 154// Set parent chamber number
155 fChamber=&(pMUON->Chamber(chamber));
156 fId=chamber;
157
a9e2aefa 158}
e889a146 159//------------------------------------------------------------------
160void AliMUONSegmentationTrigger::Draw(const char * /*opt*/) const {}
a9e2aefa 161//------------------------------------------------------------------
162Int_t AliMUONSegmentationTrigger::ModuleNumber(Int_t imodule){
163// returns module number (from 0 to 126) corresponding to module imodule
164 Int_t imod=0;
0c19630f 165 for (Int_t i=0; i<AliMUONTriggerConstants::Nmodule(); i++) {
166 if (AliMUONTriggerConstants::ModuleId(i)==imodule) {
a9e2aefa 167 imod=i;
168 break;
169 }
170 }
171 return imod;
172}
e889a146 173//------------------------------------------------------------------
174void AliMUONSegmentationTrigger::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
175{
176 SetHit(xhit, yhit);
177}
a9e2aefa 178//------------------------------------------------------------------
179Float_t AliMUONSegmentationTrigger::StripSizeX(Int_t imodule){
180// Returns x-strip size for given module imodule
181
182 Int_t absimodule=TMath::Abs(imodule);
183 Int_t moduleNum=ModuleNumber(imodule);
0c19630f 184 if (absimodule==51) {
a9e2aefa 185 return 0;
186 } else {
0c19630f 187 return TMath::Abs((fYcmax[moduleNum]-fYcmin[moduleNum])/
188 AliMUONTriggerConstants::NstripX(moduleNum));
189 }
a9e2aefa 190}
191
192//------------------------------------------------------------------
193Float_t AliMUONSegmentationTrigger::StripSizeY(Int_t imodule){
194// Returns y-strip size for given module imodule
195
196 Int_t absimodule=TMath::Abs(imodule);
197 Int_t moduleNum=ModuleNumber(imodule);
0c19630f 198 if (absimodule==51) {
a9e2aefa 199 return 0;
200 } else {
0c19630f 201 return TMath::Abs((AliMUONTriggerConstants::XcMax(moduleNum) -
202 AliMUONTriggerConstants::XcMin(moduleNum)) /
203 AliMUONTriggerConstants::NstripY(moduleNum));
a9e2aefa 204 }
205}
206
207//------------------------------------------------------------------
208void AliMUONSegmentationTrigger::SetHit(Float_t xhit, Float_t yhit)
209{
210 // Sets virtual hit position, needed for evaluating pad response
211 // outside the tracking program
212
ecfa008b 213 fXhit=xhit;
214 fYhit=yhit;
a9e2aefa 215}
0c19630f 216
217
218
219
220
221
222
223
224