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