]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationTrigger.cxx
trigger geometry & segmentation as in Fig.2.4 & 2.5 of ALICE-EN-2003-010
[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   fId=chamber;
167 }
168 //------------------------------------------------------------------
169 void  AliMUONSegmentationTrigger::Draw(const char * /*opt*/) {}
170 //------------------------------------------------------------------
171 Int_t AliMUONSegmentationTrigger::ModuleNumber(Int_t imodule){
172 // returns module number (from 0 to 126) corresponding to module imodule
173   Int_t imod=0;
174   for (Int_t i=0; i<AliMUONTriggerConstants::Nmodule(); i++) {
175     if (AliMUONTriggerConstants::ModuleId(i)==imodule) { 
176       imod=i;
177       break;
178     }
179   }
180   return imod;
181 }
182 //------------------------------------------------------------------
183 void   AliMUONSegmentationTrigger::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
184 {
185   SetHit(xhit, yhit);
186 }
187 //------------------------------------------------------------------
188 Float_t AliMUONSegmentationTrigger::StripSizeX(Int_t imodule){
189 // Returns x-strip size for given module imodule
190
191   Int_t absimodule=TMath::Abs(imodule); 
192   Int_t moduleNum=ModuleNumber(imodule);
193   if (absimodule==51) {
194     return 0; 
195   } else {
196     return TMath::Abs((fYcmax[moduleNum]-fYcmin[moduleNum])/
197                       AliMUONTriggerConstants::NstripX(moduleNum));
198   }  
199 }
200
201 //------------------------------------------------------------------
202 Float_t AliMUONSegmentationTrigger::StripSizeY(Int_t imodule, Int_t istrip){
203 // Returns y-strip size for given module imodule
204         
205   Int_t absimodule=TMath::Abs(imodule); 
206   Int_t moduleNum=ModuleNumber(imodule);
207   if (absimodule==51) {
208       return 0;
209   } else if (TMath::Abs(imodule-10*Int_t(imodule/10.))==7) {
210       if (istrip<8) {
211           return 4.25;
212       }
213       else if (istrip>7) {            
214           return 2.125;
215       } 
216       else {
217           return 0.;
218       }      
219   } else {
220       return TMath::Abs((AliMUONTriggerConstants::XcMax(moduleNum) - 
221                          AliMUONTriggerConstants::XcMin(moduleNum)) / 
222                         AliMUONTriggerConstants::NstripY(moduleNum));
223   }
224 }
225
226 //------------------------------------------------------------------   
227 void AliMUONSegmentationTrigger::SetHit(Float_t xhit, Float_t yhit)
228 {
229     // Sets virtual hit position, needed for evaluating pad response 
230     // outside the tracking program 
231     
232   fXhit=xhit;
233   fYhit=yhit;
234 }
235
236
237
238
239
240
241
242
243