]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegmentationTrigger.cxx
New files for folders and Stack
[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 /*
17 $Log$
18 Revision 1.6  2000/11/12 17:17:03  pcrochet
19 BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers)
20
21 Revision 1.5  2000/10/02 16:58:29  egangler
22 Cleaning of the code :
23 -> coding conventions
24 -> void Streamers
25 -> some useless includes removed or replaced by "class" statement
26
27 Revision 1.4  2000/06/29 12:34:09  morsch
28 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
29 it usable with any other geometry class. The link to the object to which it belongs is
30 established via an index. This assumes that there exists a global geometry manager
31 from which the pointer to the parent object can be obtained (in our case gAlice).
32
33 Revision 1.3  2000/06/26 10:00:14  pcrochet
34 global variables removed, problem with HP compiler solved (PH)
35
36 Revision 1.2  2000/06/15 07:58:48  morsch
37 Code from MUON-dev joined
38
39 Revision 1.1.2.1  2000/06/09 21:47:24  morsch
40 Code from AliMUONSegResTrigger.cxx
41
42 */
43
44 /*
45 old Log:
46 AliMUONSegResTrigger.cxx,v $
47 Revision 1.1.2.3  2000/04/26 12:32:39  morsch
48 Mods by P. Crochet:
49 - adapted to the new Trigger chamber geometry
50 - method SetZScale removed
51
52 Revision 1.1.2.2  2000/02/21 16:13:33  morsch
53 Full cluster simulation activated by uncommenting corresponding lines in IntXY()
54
55 Revision 1.1.2.1  2000/02/17 14:32:40  morsch
56 Draft version from P. Crochet
57
58 */
59
60 #include "AliMUONSegmentationTrigger.h"
61 #include "AliMUONTriggerConstants.h"
62 #include "AliRun.h"
63 #include "AliMUON.h"
64 #include <TMath.h>
65 #include <TRandom.h>
66 #include <TArc.h>
67 #include "AliMUONChamber.h"
68 #include <iostream.h>
69
70 ClassImp(AliMUONSegmentationTrigger)
71
72 //------------------------------------------------------------------
73 void AliMUONSegmentationTrigger::Init(Int_t chamber)
74 {
75   // initialize Module geometry
76   AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
77   AliMUONChamber* iChamber=&(pMUON->Chamber(chamber));
78
79   if(pMUON->GetDebug()) cout << ClassName() << ": Initialize Trigger Chamber Module Geometry " << "\n";    
80
81   Float_t zPos=iChamber->Z();
82   Float_t z1Pos=1603.5;
83   fZscale = zPos/z1Pos;
84
85   Float_t y1Cmin[126];
86   Float_t y1Cmax[126];
87
88   Float_t dz=7.2;
89   Float_t z1PosPlus=z1Pos+dz/2.;
90   Float_t z1PosMinus=z1Pos-dz/2.;
91
92   Float_t z1pm=z1PosPlus/z1PosMinus;
93   Float_t z1mp=z1PosMinus/z1PosPlus;
94
95   if(pMUON->GetDebug()) cout << ClassName() << ": fZscale = " << fZscale << "\n";
96   
97 // calculate yCmin and fYcmax 
98   Int_t i;  
99   for (i=62; i>=0; i--) {
100     Int_t j=ModuleNumber(-AliMUONTriggerConstants::ModuleId(i));  // i == right, j == left 
101     if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==5) {  // start with middle chamber
102       if (AliMUONTriggerConstants::ModuleId(i)==51) {         // special case (empty module)
103         fYcmin[i]=fYcmax[i]=fYcmin[j]=fYcmax[j]=0.;
104       } else {
105         y1Cmin[i]=y1Cmin[j]=-34;
106         y1Cmax[i]=y1Cmax[j]=34;
107         fYcmin[i]=fYcmin[j]=-34.;
108
109         fYcmax[i]=fYcmax[j]=34.;
110       }
111     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==4) { // up
112       if (AliMUONTriggerConstants::ModuleId(i)!=41) {       
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 { 
123         y1Cmin[i]=y1Cmin[ModuleNumber(42)]+17;
124         y1Cmax[i]=y1Cmin[i]+51.;
125         fYcmin[i]=y1Cmin[i];
126         fYcmax[i]=fYcmin[i]+51.;
127
128         y1Cmin[j]=y1Cmin[ModuleNumber(-42)]+17;
129         y1Cmax[j]=y1Cmin[j]+51.;
130         fYcmin[j]=y1Cmin[j];
131         fYcmax[j]=fYcmin[j]+51.;
132       }
133     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==3) { 
134       y1Cmin[i]=y1Cmax[i+7]*z1mp;
135       y1Cmax[i]=y1Cmin[i]+68.;
136       fYcmin[i]=y1Cmin[i];
137       fYcmax[i]=fYcmin[i]+68.;
138
139       y1Cmin[j]=y1Cmax[j+7]*z1pm;
140       y1Cmax[j]=y1Cmin[j]+68.;
141       fYcmin[j]=y1Cmin[j];
142       fYcmax[j]=fYcmin[j]+68.;
143     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==2) {
144       y1Cmin[i]=y1Cmax[i+7]*z1pm;
145       y1Cmax[i]=y1Cmin[i]+68.;
146       fYcmin[i]=y1Cmin[i];
147       fYcmax[i]=fYcmin[i]+68.;
148
149       y1Cmin[j]=y1Cmax[j+7]*z1mp;
150       y1Cmax[j]=y1Cmin[j]+68.;
151       fYcmin[j]=y1Cmin[j];
152       fYcmax[j]=fYcmin[j]+68.;
153     } else if (Int_t(AliMUONTriggerConstants::ModuleId(i)/10)==1) {
154       y1Cmin[i]=y1Cmax[i+7]*z1mp;
155       y1Cmax[i]=y1Cmin[i]+68.;
156       fYcmin[i]=y1Cmin[i];
157       fYcmax[i]=fYcmin[i]+68.;
158
159       y1Cmin[j]=y1Cmax[j+7]*z1pm;
160       y1Cmax[j]=y1Cmin[j]+68.;
161       fYcmin[j]=y1Cmin[j];
162       fYcmax[j]=fYcmin[j]+68.;
163     }
164   }
165
166   for (i=0; i<63; i++) {      // second loop (fill lower part)
167     Int_t j=ModuleNumber(-AliMUONTriggerConstants::ModuleId(i));  // i == right, j == left 
168     if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==6) { 
169       fYcmin[i]=-fYcmax[i-14];
170       fYcmax[i]=-fYcmin[i-14];
171       fYcmin[j]=-fYcmax[j-14];
172       fYcmax[j]=-fYcmin[j-14];
173     } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==7) { 
174       fYcmin[i]=-fYcmax[i-28];
175       fYcmax[i]=-fYcmin[i-28];
176       fYcmin[j]=-fYcmax[j-28];
177       fYcmax[j]=-fYcmin[j-28];
178     } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==8) { 
179       fYcmin[i]=-fYcmax[i-42];
180       fYcmax[i]=-fYcmin[i-42];
181       fYcmin[j]=-fYcmax[j-42];
182       fYcmax[j]=-fYcmin[j-42];
183     } else if (TMath::Abs(Int_t(AliMUONTriggerConstants::ModuleId(i)/10))==9) { 
184       fYcmin[i]=-fYcmax[i-56];
185       fYcmax[i]=-fYcmin[i-56];
186       fYcmin[j]=-fYcmax[j-56];
187       fYcmax[j]=-fYcmin[j-56];
188     } 
189   }
190
191   fNpx=124;
192   fNpy=64;  
193
194 // Set parent chamber number
195   fChamber=&(pMUON->Chamber(chamber));
196   fId=chamber;
197
198   if(pMUON->GetDebug()) cout << ClassName() << ": ---------------------------------------------------- \n";   
199
200 }
201
202 //------------------------------------------------------------------
203 Int_t AliMUONSegmentationTrigger::ModuleNumber(Int_t imodule){
204 // returns module number (from 0 to 126) corresponding to module imodule
205   Int_t imod=0;
206   for (Int_t i=0; i<AliMUONTriggerConstants::Nmodule(); i++) {
207     if (AliMUONTriggerConstants::ModuleId(i)==imodule) { 
208       imod=i;
209       break;
210     }
211   }
212   return imod;
213 }
214
215 //------------------------------------------------------------------
216 Float_t AliMUONSegmentationTrigger::StripSizeX(Int_t imodule){
217 // Returns x-strip size for given module imodule
218
219   Int_t absimodule=TMath::Abs(imodule); 
220   Int_t moduleNum=ModuleNumber(imodule);
221   if (absimodule==51) {
222     return 0; 
223   } else {
224     return TMath::Abs((fYcmax[moduleNum]-fYcmin[moduleNum])/
225                       AliMUONTriggerConstants::NstripX(moduleNum));
226   }  
227 }
228
229 //------------------------------------------------------------------
230 Float_t AliMUONSegmentationTrigger::StripSizeY(Int_t imodule){
231 // Returns y-strip size for given module imodule
232         
233   Int_t absimodule=TMath::Abs(imodule); 
234   Int_t moduleNum=ModuleNumber(imodule);
235   if (absimodule==51) {
236     return 0;
237   } else {
238       return TMath::Abs((AliMUONTriggerConstants::XcMax(moduleNum) - 
239                          AliMUONTriggerConstants::XcMin(moduleNum)) / 
240                         AliMUONTriggerConstants::NstripY(moduleNum));
241   }
242 }
243
244 //------------------------------------------------------------------   
245 void AliMUONSegmentationTrigger::SetHit(Float_t xhit, Float_t yhit)
246 {
247     // Sets virtual hit position, needed for evaluating pad response 
248     // outside the tracking program 
249     
250   fXhit=xhit;
251   fYhit=yhit;
252 }
253
254
255
256
257
258
259
260
261