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