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