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