]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONFactoryV2.cxx
1a7116e6e5fa038c91cc4fb2e56809b3d3fbe76d
[u/mrichter/AliRoot.git] / MUON / AliMUONFactoryV2.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 //  Factory for muon chambers, segmentations and response //
18 ////////////////////////////////////////////////////////////
19
20 /* $Id$ */
21
22 #include "AliMUONFactoryV2.h"
23 #include "AliRun.h"
24 #include "AliSegmentation.h"
25 #include "AliLog.h"
26
27 #include "AliMUON.h"
28 #include "AliMUONConstants.h"
29 #include "AliMUONTriggerConstants.h"
30 #include "AliMUONChamber.h"
31 #include "AliMUONResponseV0.h"
32 #include "AliMUONGeometryModule.h"
33 #include "AliMUONGeometryStore.h"
34 #include "AliMUONGeometrySegmentation.h"
35 #include "AliMUONSt12QuadrantSegmentation.h"
36 #include "AliMUONSt345SlatSegmentation.h"
37 #include "AliMUONTriggerSegmentation.h"
38 #include "AliMUONResponseTrigger.h"
39
40 ClassImp(AliMUONFactoryV2)
41
42 //__________________________________________________________________________
43   AliMUONFactoryV2::AliMUONFactoryV2(const char* name)
44     : AliMUONFactory(name),
45       fMUON(0),
46       fResponse0(0),
47       fDESegmentations(0)
48 {
49   // FactoryV2 inherite from Factory for switching in AliMUONv1::Init()
50   // to be changed when old segmentation will be removed.
51
52   fDESegmentations = new TObjArray();
53   fDESegmentations->SetOwner(kTRUE);
54 }
55
56 //__________________________________________________________________________
57   AliMUONFactoryV2::AliMUONFactoryV2()
58     : AliMUONFactory(),
59       fMUON(0),
60       fResponse0(0),
61       fDESegmentations(0)
62 {
63 // Default constructor
64 }
65
66 //__________________________________________________________________________
67 AliMUONFactoryV2::AliMUONFactoryV2(const AliMUONFactoryV2& rhs)
68   : AliMUONFactory(rhs)
69 {
70   // Protected copy constructor
71
72   AliFatal("Not implemented.");
73 }
74
75 //__________________________________________________________________________
76
77 AliMUONFactoryV2::~AliMUONFactoryV2()
78 {
79 // Destructor
80
81   delete fDESegmentations;
82 }
83
84 //__________________________________________________________________________
85 AliMUONFactoryV2&  AliMUONFactoryV2::operator=(const AliMUONFactoryV2& rhs)
86 {
87   // Protected assignement operator
88
89   if (this == &rhs) return *this;
90
91   AliFatal("Not implemented.");
92     
93   return *this;  
94 }    
95           
96 //__________________________________________________________________________
97 void AliMUONFactoryV2::BuildCommon() 
98 {
99   //
100   // Construct the default response.
101   //
102
103   // Default response: 5 mm of gas
104   fResponse0 = new AliMUONResponseV0;
105   fResponse0->SetSqrtKx3AndDeriveKx2Kx4(0.7131); // sqrt(0.5085)
106   fResponse0->SetSqrtKy3AndDeriveKy2Ky4(0.7642); // sqrt(0.5840)
107   fResponse0->SetPitch(AliMUONConstants::Pitch()); // anode-cathode distance
108   fResponse0->SetSigmaIntegration(10.);
109   fResponse0->SetChargeSlope(10);
110   fResponse0->SetChargeSpread(0.18, 0.18);
111   fResponse0->SetMaxAdc(4096);
112   fResponse0->SetSaturation(3000);
113   fResponse0->SetZeroSuppression(6);
114 }       
115         
116 //__________________________________________________________________________
117 void AliMUONFactoryV2::BuildStation1() 
118 {
119   //--------------------------------------------------------
120   // Configuration for Chamber TC1/2  (Station 1) ----------           
121   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122
123
124   // Response for 4 mm of gas (station 1)
125   // automatic consistency with width of sensitive medium in CreateGeometry ????
126   AliMUONResponseV0* responseSt1 = new AliMUONResponseV0;
127   // Mathieson parameters from L.Kharmandarian's thesis, page 190
128   responseSt1->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900)
129   responseSt1->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700)
130   responseSt1->SetPitch(AliMUONConstants::PitchSt1()); // anode-cathode distance
131   responseSt1->SetSigmaIntegration(10.);
132   // ChargeSlope larger to compensate for the smaller anode-cathode distance
133   // and keep the same most probable ADC channel for mip's
134   responseSt1->SetChargeSlope(62.5); 
135   // assumed proportionality to anode-cathode distance for ChargeSpread
136   responseSt1->SetChargeSpread(0.144, 0.144);
137   responseSt1->SetMaxAdc(4096);
138   responseSt1->SetSaturation(3000);
139   responseSt1->SetZeroSuppression(6);
140
141   // Quadrant segmentations:
142   AliMUONSt12QuadrantSegmentation* bendSt1
143     = new AliMUONSt12QuadrantSegmentation(kStation1, kBendingPlane);
144   AliMUONSt12QuadrantSegmentation* nonbendSt1
145     = new AliMUONSt12QuadrantSegmentation(kStation1, kNonBendingPlane);
146   
147   // Add in the array (for safe deleting)  
148   fDESegmentations->Add(bendSt1);  
149   fDESegmentations->Add(nonbendSt1);  
150
151   AliMUONGeometrySegmentation* segmentation[2];
152
153   for (Int_t chamber = 0; chamber < 2; chamber++) {
154
155     segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
156     segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
157         
158     // id detection elt for chamber 1
159     Int_t id0 = (chamber+1)*100;
160
161     //--------------------------------------------------------
162     // Configuration for Chamber TC1/2  (Station 1) ----------           
163
164
165     fMUON->SetNsec(chamber,2);
166
167     // cathode 0
168     segmentation[0]->Add(id0,      bendSt1);
169     segmentation[0]->Add(id0 +  1, nonbendSt1);
170     segmentation[0]->Add(id0 + 50, bendSt1);
171     segmentation[0]->Add(id0 + 51, nonbendSt1); 
172     fMUON->SetSegmentationModel(chamber, 1, segmentation[0]);   
173
174     // cathode 1
175     segmentation[1]->Add(id0,      nonbendSt1);
176     segmentation[1]->Add(id0 +  1, bendSt1);
177     segmentation[1]->Add(id0 + 50, nonbendSt1);
178     segmentation[1]->Add(id0 + 51, bendSt1);
179     fMUON->SetSegmentationModel(chamber, 2, segmentation[1]);
180         
181     fMUON->SetResponseModel(chamber, responseSt1); // special response      
182     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
183         
184   }
185 }
186
187 //__________________________________________________________________________
188 void AliMUONFactoryV2::BuildStation2() 
189 {
190   //
191   //--------------------------------------------------------
192   // Configuration for Chamber TC3/4 (Station 2) -----------
193   ///^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
194
195
196   // Quadrant segmentations:
197   AliMUONSt12QuadrantSegmentation* bendSt2
198     = new AliMUONSt12QuadrantSegmentation(kStation2, kBendingPlane);
199   AliMUONSt12QuadrantSegmentation* nonbendSt2
200     = new AliMUONSt12QuadrantSegmentation(kStation2, kNonBendingPlane);
201
202   // Add in the array (for safe deleting)  
203   fDESegmentations->Add(bendSt2);  
204   fDESegmentations->Add(nonbendSt2);  
205
206   AliMUONGeometrySegmentation* segmentation[2];
207
208   for (Int_t chamber = 2; chamber < 4; chamber++) {
209
210     segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
211     segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
212         
213     // id detection elt for chamber 1
214     Int_t id0 = (chamber+1)*100;
215
216     //--------------------------------------------------------
217     // Configuration for Chamber TC3/4  (Station 2) ----------           
218
219
220     fMUON->SetNsec(chamber,2);
221
222     // cathode 0
223     segmentation[0]->Add(id0,      bendSt2);
224     segmentation[0]->Add(id0 +  1, nonbendSt2);
225     segmentation[0]->Add(id0 + 50, bendSt2);
226     segmentation[0]->Add(id0 + 51, nonbendSt2); 
227     fMUON->SetSegmentationModel(chamber, 1, segmentation[0]);   
228
229     // cathode 1
230     segmentation[1]->Add(id0,      nonbendSt2);
231     segmentation[1]->Add(id0 +  1, bendSt2);
232     segmentation[1]->Add(id0 + 50, nonbendSt2);
233     segmentation[1]->Add(id0 + 51, bendSt2);
234     fMUON->SetSegmentationModel(chamber, 2, segmentation[1]);
235         
236     fMUON->SetResponseModel(chamber, fResponse0); // normal response        
237     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
238         
239   }
240 }       
241         
242         
243 //__________________________________________________________________________
244 void AliMUONFactoryV2::BuildStation3() 
245 {
246   //--------------------------------------------------------
247   // Configuration for Chamber TC5/6  (Station 3) ----------          
248   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249
250   AliMUONGeometrySegmentation* segmentation[2];
251
252   //Slats Segmentations
253   AliMUONSt345SlatSegmentation *slatsegB[4]; // Types of segmentation for St3
254   AliMUONSt345SlatSegmentation *slatsegNB[4]; 
255   // Bending
256
257   Int_t ndiv[4] ={ 4, 4, 2, 1};  // densities zones 
258   for(Int_t i=0; i<4; i++) {
259     slatsegB[i] = new AliMUONSt345SlatSegmentation(1);
260     fDESegmentations->Add(slatsegB[i]);  
261     slatsegB[i]->SetPadSize(10.,0.5);
262     slatsegB[i]->SetPadDivision(ndiv);
263     slatsegB[i]->SetId(1); // Id elt ????
264     slatsegB[i]->SetDAnod(AliMUONConstants::Pitch());
265     slatsegNB[i] = new AliMUONSt345SlatSegmentation(0);
266     fDESegmentations->Add(slatsegNB[i]);  
267     slatsegNB[i]->SetPadSize(0.713,10.); // Nbending
268     slatsegNB[i]->SetPadDivision(ndiv);
269     slatsegNB[i]->SetId(1);
270     slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch());
271   }
272
273   // Type 112200 for 500, 501, 508, 509, 510, 517 
274   // in Ch5 (similar for Ch6) for the futur official numbering
275   // Type 112200 for 503, 504, 505, 555, 554, 553 
276   // in Ch5 (similar for Ch6) actual numbering in the code to be changed in jan05
277   Int_t n0[4] = { 0, 2, 2, 0 };
278   slatsegB[0]->SetPcbBoards(n0);
279   slatsegB[0]->Init(0);
280   slatsegNB[0]->SetPcbBoards(n0);
281   slatsegNB[0]->Init(0);
282     
283   // Type 122200 for 502, 507, 511, 516 (similar in Ch6) 
284   // for future official numbering of ALICE
285   // Type 122200 for 502, 506, 556, 552 (similiarin Ch6) 
286   // for actual numbering in muon code to be changed in jan05
287   Int_t n1[4] = { 0, 1, 3, 0 }; 
288   slatsegB[1]->SetPcbBoards(n1);
289   slatsegB[1]->Init(0); 
290   slatsegNB[1]->SetPcbBoards(n1);
291   slatsegNB[1]->Init(0); 
292     
293   // Type 222000 for 503, 506, 512, 515 (similar in Ch6) 
294   // for future official numbering of ALICE
295   // Type 222000 for 501, 507, 557, 551 (similiarin Ch6) 
296   // for actual numbering in muon code to be changed in jan05
297   Int_t n2[4] = { 0, 0, 3, 0 };
298   slatsegB[2]->SetPcbBoards(n2);
299   slatsegB[2]->Init(0);
300   slatsegNB[2]->SetPcbBoards(n2);
301   slatsegNB[2]->Init(0);
302     
303   // Type 220000 for 504, 505, 513, 514 (similar in Ch6) 
304   // for future official numbering of ALICE
305   // Type 220000 for 500, 508, 558, 550 (similiarin Ch6) 
306   // for actual numbering in muon code to be changed in jan05
307   Int_t n3[4] = { 0, 0, 2, 0 };
308   slatsegB[3]->SetPcbBoards(n3);
309   slatsegB[3]->Init(0); 
310   slatsegNB[3]->SetPcbBoards(n3);
311   slatsegNB[3]->Init(0); 
312
313   for (Int_t chamber = 4; chamber < 6; chamber++) {
314
315     segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
316     segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
317         
318     // id detection elt for chamber 1
319     Int_t id0 = (chamber+1)*100;
320
321     //--------------------------------------------------------
322     // Configuration for Chamber TC3/4  (Station 2) ----------           
323
324
325     fMUON->SetNsec(chamber,2);
326
327     // cathode 0
328     // type 220000
329     segmentation[0]->Add(id0, slatsegB[3]);
330     segmentation[0]->Add(id0+ 8, slatsegB[3]);  
331     segmentation[0]->Add(id0+50, slatsegB[3]);  
332     segmentation[0]->Add(id0+58, slatsegB[3]);
333     // type 222000
334     segmentation[0]->Add(id0+ 1, slatsegB[2]);
335     segmentation[0]->Add(id0+ 7, slatsegB[2]);  
336     segmentation[0]->Add(id0+51, slatsegB[2]);  
337     segmentation[0]->Add(id0+57, slatsegB[2]);
338     // type 122200
339     segmentation[0]->Add(id0+ 2, slatsegB[1]);
340     segmentation[0]->Add(id0+ 6, slatsegB[1]);  
341     segmentation[0]->Add(id0+52, slatsegB[1]);  
342     segmentation[0]->Add(id0+56, slatsegB[1]);
343     // type 112200
344     segmentation[0]->Add(id0+ 3, slatsegB[0]);
345     segmentation[0]->Add(id0+ 4, slatsegB[0]);  
346     segmentation[0]->Add(id0+ 5, slatsegB[0]);  
347     segmentation[0]->Add(id0+53, slatsegB[0]);
348     segmentation[0]->Add(id0+54, slatsegB[0]);     
349     segmentation[0]->Add(id0+55, slatsegB[0]);
350     fMUON->SetSegmentationModel(chamber, 1, segmentation[0]);   
351
352     // cathode 1
353     // type 220000
354     segmentation[1]->Add(id0, slatsegNB[3]);
355     segmentation[1]->Add(id0+ 8, slatsegNB[3]);  
356     segmentation[1]->Add(id0+50, slatsegNB[3]);  
357     segmentation[1]->Add(id0+58, slatsegNB[3]);
358     // type 222000
359     segmentation[1]->Add(id0+ 1, slatsegNB[2]);
360     segmentation[1]->Add(id0+ 7, slatsegNB[2]);  
361     segmentation[1]->Add(id0+51, slatsegNB[2]);  
362     segmentation[1]->Add(id0+57, slatsegNB[2]);
363     // type 122200
364     segmentation[1]->Add(id0+ 2, slatsegNB[1]);
365     segmentation[1]->Add(id0+ 6, slatsegNB[1]);  
366     segmentation[1]->Add(id0+52, slatsegNB[1]);  
367     segmentation[1]->Add(id0+56, slatsegNB[1]);
368     // type 112200
369     segmentation[1]->Add(id0+ 3, slatsegNB[0]);
370     segmentation[1]->Add(id0+ 4, slatsegNB[0]);  
371     segmentation[1]->Add(id0+ 5, slatsegNB[0]);  
372     segmentation[1]->Add(id0+53, slatsegNB[0]);
373     segmentation[1]->Add(id0+54, slatsegNB[0]);     
374     segmentation[1]->Add(id0+55, slatsegNB[0]);
375     fMUON->SetSegmentationModel(chamber, 2, segmentation[1]);
376
377     fMUON->SetResponseModel(chamber, fResponse0);      
378     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
379   }
380 }
381
382         
383 //__________________________________________________________________________
384 void AliMUONFactoryV2::BuildStation4() 
385 {
386   //--------------------------------------------------------
387   // Configuration for Chamber TC7/8  (Station 4) ----------           
388   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
389
390
391   AliMUONGeometrySegmentation* segmentation[2];
392
393   //Slats Segmentations
394   AliMUONSt345SlatSegmentation *slatsegB[7]; // Types of segmentation for St4
395   AliMUONSt345SlatSegmentation *slatsegNB[7]; 
396   // Bending
397
398   Int_t ndiv[4] ={ 4, 4, 2, 1};  // densities zones 
399   for(Int_t i = 0; i < 7; i++) {
400     slatsegB[i] = new AliMUONSt345SlatSegmentation(1);
401     fDESegmentations->Add(slatsegB[i]);  
402     slatsegB[i]->SetPadSize(10.,0.5);
403     slatsegB[i]->SetPadDivision(ndiv);
404     slatsegB[i]->SetId(1);
405     slatsegB[i]->SetDAnod(AliMUONConstants::Pitch());
406     slatsegNB[i] = new AliMUONSt345SlatSegmentation(0);
407     fDESegmentations->Add(slatsegNB[i]);  
408     slatsegNB[i]->SetPadSize(0.713,10.); 
409     slatsegNB[i]->SetPadDivision(ndiv);
410     slatsegNB[i]->SetId(1);
411     slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch());
412   }
413
414   Int_t n4[4] = { 0, 1, 2, 2 };
415   slatsegB[0]->SetPcbBoards(n4);
416   slatsegB[0]->Init(0); // 0 detection element id
417   slatsegNB[0]->SetPcbBoards(n4);
418   slatsegNB[0]->Init(0); // 0 detection element id
419     
420   // Type 112233 for 701, 712, 714, 725 in Ch7 (similar for Ch8) 
421   // for the futur official numbering
422   // Type 112233 for 705, 707, 755, 757 in Ch7 (similar for Ch8) 
423   // actual numbering in the code to be changed in jan05
424   // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 
425   // (similar for Ch10) for the futur official numbering
426   // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 
427   // (similar for Ch10) actual numbering in the code to be changed in jan05
428   Int_t n5[4] = { 0, 2, 2, 2 };
429   slatsegB[1]->SetPcbBoards(n5);
430   slatsegB[1]->Init(0); // 0 detection element id
431   slatsegNB[1]->SetPcbBoards(n5);
432   slatsegNB[1]->Init(0); // 0 detection element id
433     
434   // Type 112230 for 702, 711, 715, 724 in Ch7 (similar for Ch8) 
435   // for the futur official numbering
436   // Type 112230 for 704, 708, 754, 758 in Ch7 (similar for Ch8) 
437   // actual numbering in the code to be changed in jan05
438   Int_t n6[4] = { 0, 2, 2, 1 };
439   slatsegB[2]->SetPcbBoards(n6);
440   slatsegB[2]->Init(0); // 0 detection element id
441   slatsegNB[2]->SetPcbBoards(n6);
442   slatsegNB[2]->Init(0); // 0 detection element id
443     
444   // Type 222330 for 703, 710, 716, 723 in Ch7 (similar for Ch8) 
445   // for the futur official numbering
446   // Type 222330 for 703, 709, 753, 759 in Ch7 (similar for Ch8) 
447   // actual numbering in the code to be changed in jan05
448   Int_t n7[4] = { 0, 0, 3, 2 };
449   slatsegB[3]->SetPcbBoards(n7);
450   slatsegB[3]->Init(0); // 0 detection element id
451   slatsegNB[3]->SetPcbBoards(n7);
452   slatsegNB[4]->Init(0); // 0 detection element id
453     
454   // Type 223300 for 704, 709, 717, 722 in Ch7 (similar for Ch8) 
455   // for the futur official numbering
456   // Type 223300 for 702, 710, 752, 760 in Ch7 (similar for Ch8) 
457   // actual numbering in the code to be changed in jan05
458   Int_t n8[4] = { 0, 0, 2, 2 };
459   slatsegB[4]->SetPcbBoards(n8);
460   slatsegB[4]->Init(0); // 0 detection element id
461   slatsegNB[4]->SetPcbBoards(n8);
462   slatsegNB[4]->Init(0); // 0 detection element id
463     
464   // Type 333000 for 705, 708, 718, 721 in Ch7 (similar for Ch8) 
465   // for the futur official numbering
466   // Type 333000 for 701, 711, 751, 761 in Ch7 (similar for Ch8) 
467   // actual numbering in the code to be changed in jan05
468   // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) 
469   // for the futur official numbering
470   // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) 
471   // actual numbering in the code to be changed in jan05
472   Int_t n9[4] = { 0, 0, 0, 3 };
473   slatsegB[5]->SetPcbBoards(n9);
474   slatsegB[5]->Init(0); // 0 detection element id
475   slatsegNB[5]->SetPcbBoards(n9);
476   slatsegNB[5]->Init(0); // 0 detection element id
477     
478   // Type 330000 for 706, 707, 719, 720 in Ch7 (similar for Ch8) 
479   // for the futur official numbering
480   // Type 330000 for 700, 712, 750, 762 in Ch7 (similar for Ch8) 
481   // actual numbering in the code to be changed in jan05
482   Int_t n10[4] = { 0, 0, 0, 2 };
483   slatsegB[6]->SetPcbBoards(n10);
484   slatsegB[6]->Init(0); // 0 detection element id
485   slatsegNB[6]->SetPcbBoards(n10);
486   slatsegNB[6]->Init(0); // 0 detection element id
487
488
489   for (Int_t chamber = 6; chamber < 8; chamber++) {
490
491     segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
492     segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
493         
494     // id detection elt for chamber 1
495     Int_t id0 = (chamber+1)*100;
496
497     //--------------------------------------------------------
498     // Configuration for Chamber TC6/7  (Station 4) ----------           
499
500
501     fMUON->SetNsec(chamber,2);
502
503     // cathode 0
504     // type 122330
505     segmentation[0]->Add(id0+ 6, slatsegB[0]);
506     segmentation[0]->Add(id0+56, slatsegB[0]);
507   
508     // type 112233
509     segmentation[0]->Add(id0+ 5, slatsegB[1]);
510     segmentation[0]->Add(id0+ 7, slatsegB[1]);  
511     segmentation[0]->Add(id0+55, slatsegB[1]);  
512     segmentation[0]->Add(id0+57, slatsegB[1]);
513    
514     // type 112230
515     segmentation[0]->Add(id0+ 4, slatsegB[2]);
516     segmentation[0]->Add(id0+ 8, slatsegB[2]);  
517     segmentation[0]->Add(id0+54, slatsegB[2]);  
518     segmentation[0]->Add(id0+58, slatsegB[2]);
519
520     // type 222330 
521     segmentation[0]->Add(id0+ 3, slatsegB[3]);
522     segmentation[0]->Add(id0+ 9, slatsegB[3]);  
523     segmentation[0]->Add(id0+53, slatsegB[3]);
524     segmentation[0]->Add(id0+59, slatsegB[3]);
525
526     // type 223300 
527     segmentation[0]->Add(id0+ 2, slatsegB[4]);
528     segmentation[0]->Add(id0+10, slatsegB[4]);  
529     segmentation[0]->Add(id0+52, slatsegB[4]);
530     segmentation[0]->Add(id0+60, slatsegB[4]);
531
532     // type 333000 
533     segmentation[0]->Add(id0+ 1, slatsegB[5]);
534     segmentation[0]->Add(id0+11, slatsegB[5]);  
535     segmentation[0]->Add(id0+51, slatsegB[5]);
536     segmentation[0]->Add(id0+61, slatsegB[5]);
537
538     // type 330000 
539     segmentation[0]->Add(id0   , slatsegB[6]);
540     segmentation[0]->Add(id0+12, slatsegB[6]);  
541     segmentation[0]->Add(id0+50, slatsegB[6]);
542     segmentation[0]->Add(id0+62, slatsegB[6]);
543     fMUON->SetSegmentationModel(chamber, 1, segmentation[0]);   
544
545     // cathode 1
546     // type 122330
547     segmentation[1]->Add(id0+ 6, slatsegNB[0]);
548     segmentation[1]->Add(id0+56, slatsegNB[0]);
549
550     // type 112233
551     segmentation[1]->Add(id0+ 5, slatsegNB[1]);
552     segmentation[1]->Add(id0+ 7, slatsegNB[1]);  
553     segmentation[1]->Add(id0+55, slatsegNB[1]);  
554     segmentation[1]->Add(id0+57, slatsegNB[1]);
555   
556     // type 112230
557     segmentation[1]->Add(id0+ 4, slatsegNB[2]);
558     segmentation[1]->Add(id0+ 8, slatsegNB[2]);  
559     segmentation[1]->Add(id0+54, slatsegNB[2]);  
560     segmentation[1]->Add(id0+58, slatsegNB[2]);
561
562     // type 222330 
563     segmentation[1]->Add(id0+ 3, slatsegNB[3]);
564     segmentation[1]->Add(id0+ 9, slatsegNB[3]);  
565     segmentation[1]->Add(id0+53, slatsegNB[3]);
566     segmentation[1]->Add(id0+59, slatsegNB[3]);
567
568     // type 223300 
569     segmentation[1]->Add(id0+ 2, slatsegNB[4]);
570     segmentation[1]->Add(id0+10, slatsegNB[4]);  
571     segmentation[1]->Add(id0+52, slatsegNB[4]);
572     segmentation[1]->Add(id0+60, slatsegNB[4]);
573
574     // type 333000 
575     segmentation[1]->Add(id0+ 1, slatsegNB[5]);
576     segmentation[1]->Add(id0+11, slatsegNB[5]);  
577     segmentation[1]->Add(id0+51, slatsegNB[5]);
578     segmentation[1]->Add(id0+61, slatsegNB[5]);
579
580     // type 330000 
581     segmentation[1]->Add(id0   , slatsegNB[6]);
582     segmentation[1]->Add(id0+12, slatsegNB[6]);  
583     segmentation[1]->Add(id0+50, slatsegNB[6]);
584     segmentation[1]->Add(id0+62, slatsegNB[6]);
585     fMUON->SetSegmentationModel(chamber, 2, segmentation[1]);
586
587     fMUON->SetResponseModel(chamber, fResponse0);      
588     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
589   }
590 }
591
592 //__________________________________________________________________________
593 void AliMUONFactoryV2::BuildStation5() 
594 {       
595   //--------------------------------------------------------
596   // Configuration for Chamber TC9/10  (Station 5) ---------           
597   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
598
599   AliMUONGeometrySegmentation* segmentation[2];
600
601   //Slats Segmentations
602   AliMUONSt345SlatSegmentation *slatsegB[6]; // Types of segmentation for St5
603   AliMUONSt345SlatSegmentation *slatsegNB[6]; 
604   // Bending
605
606   Int_t ndiv[4] ={ 4, 4, 2, 1};  // densities zones 
607   for(Int_t i = 0; i < 6; i++) {
608     slatsegB[i] = new AliMUONSt345SlatSegmentation(1);
609     fDESegmentations->Add(slatsegB[i]);  
610     slatsegB[i]->SetPadSize(10.,0.5);
611     slatsegB[i]->SetPadDivision(ndiv);
612     slatsegB[i]->SetId(1);
613     slatsegB[i]->SetDAnod(AliMUONConstants::Pitch());
614     slatsegNB[i] = new AliMUONSt345SlatSegmentation(0);
615     fDESegmentations->Add(slatsegNB[i]);  
616     slatsegNB[i]->SetPadSize(0.713,10.); 
617     slatsegNB[i]->SetPadDivision(ndiv);
618     slatsegNB[i]->SetId(1);
619     slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch());
620   }
621
622   // Type 122330 for 900, 913 in Ch9 (similar for Ch10) 
623   // for the futur official numbering
624   // Type 122330 for 906, 956 in Ch9 (similar for Ch10) 
625   // actual numbering in the code to be changed in jan05
626   Int_t n4[4] = { 0, 1, 2, 2 };
627   slatsegB[0]->SetPcbBoards(n4);
628   slatsegB[0]->Init(0); // 0 detection element id
629   slatsegNB[0]->SetPcbBoards(n4);
630   slatsegNB[0]->Init(0); // 0 detection element id
631     
632   // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 
633   // (similar for Ch10) for the futur official numbering
634   // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 
635   // (similar for Ch10) actual numbering in the code to be changed in jan05
636   Int_t n5[4] = { 0, 2, 2, 2 };
637   slatsegB[1]->SetPcbBoards(n5);
638   slatsegB[1]->Init(0); // 0 detection element id
639   slatsegNB[1]->SetPcbBoards(n5);
640   slatsegNB[1]->Init(0); // 0 detection element id
641
642   // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) 
643   // for the futur official numbering
644   // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) 
645   // actual numbering in the code to be changed in jan05
646   Int_t n9[4] = { 0, 0, 0, 3 };
647   slatsegB[2]->SetPcbBoards(n9);
648   slatsegB[2]->Init(0); // 0 detection element id
649   slatsegNB[2]->SetPcbBoards(n9);
650   slatsegNB[2]->Init(0); // 0 detection element id
651
652   // Type 222333 for 903, 910, 916, 923 in Ch9 (similar for Ch10) 
653   // for the futur official numbering
654   // Type 222333 for 903, 909, 953, 959 in Ch9 (similar for Ch10) 
655   // actual numbering in the code to be changed in jan05
656   Int_t n11[4] = { 0, 0, 3, 3 };
657   slatsegB[3]->SetPcbBoards(n11);
658   slatsegB[3]->Init(0); // 0 detection element id
659   slatsegNB[3]->SetPcbBoards(n11);
660   slatsegNB[3]->Init(0); // 0 detection element id
661   
662   // Type 223330 for 904, 909, 917, 922 in Ch9 (similar for Ch10) 
663   // for the futur official numbering
664   // Type 223330 for 902, 910, 952, 960 in Ch9 (similar for Ch10) 
665   // actual numbering in the code to be changed in jan05
666   Int_t n12[4] = { 0, 0, 2, 3 };
667   slatsegB[4]->SetPcbBoards(n12);
668   slatsegB[4]->Init(0); // 0 detection element id
669   slatsegNB[4]->SetPcbBoards(n12);
670   slatsegNB[4]->Init(0); // 0 detection element id
671     
672   // Type 333300 for 905, 908, 918, 921 in Ch9 (similar for Ch10) 
673   // for the futur official numbering
674   // Type 333300 for 901, 911, 951, 961 in Ch9 (similar for Ch10) 
675   // actual numbering in the code to be changed in jan05
676   Int_t n13[4] = { 0, 0, 0, 4 };
677   slatsegB[5]->SetPcbBoards(n13);
678   slatsegB[5]->Init(0); // 0 detection element id
679   slatsegNB[5]->SetPcbBoards(n13);
680   slatsegNB[5]->Init(0); // 0 detection element id
681
682   for (Int_t chamber = 8; chamber < 10; chamber++) {
683
684     segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
685     segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
686
687     // id detection elt for chamber 1
688     Int_t id0 = (chamber+1)*100;
689
690     //--------------------------------------------------------
691     // Configuration for Chamber TC8/9  (Station 5) ----------           
692
693
694     fMUON->SetNsec(chamber,2);
695
696     // cathode 0
697     // type 122330
698     segmentation[0]->Add(id0+ 6, slatsegB[0]);
699     segmentation[0]->Add(id0+56, slatsegB[0]);
700   
701     // type 112233
702     segmentation[0]->Add(id0+ 4, slatsegB[1]);
703     segmentation[0]->Add(id0+ 5, slatsegB[1]);
704     segmentation[0]->Add(id0+ 7, slatsegB[1]);  
705     segmentation[0]->Add(id0+ 8, slatsegB[1]);  
706     segmentation[0]->Add(id0+54, slatsegB[1]);  
707     segmentation[0]->Add(id0+55, slatsegB[1]);  
708     segmentation[0]->Add(id0+57, slatsegB[1]);
709     segmentation[0]->Add(id0+58, slatsegB[1]);
710
711     // type 333000 
712     segmentation[0]->Add(id0   , slatsegB[2]);
713     segmentation[0]->Add(id0+12, slatsegB[2]);  
714     segmentation[0]->Add(id0+50, slatsegB[2]);
715     segmentation[0]->Add(id0+62, slatsegB[2]);
716  
717     // type 222333 
718     segmentation[0]->Add(id0+ 3, slatsegB[3]);
719     segmentation[0]->Add(id0+ 9, slatsegB[3]);  
720     segmentation[0]->Add(id0+53, slatsegB[3]);
721     segmentation[0]->Add(id0+59, slatsegB[3]);
722  
723     // type 223330 
724     segmentation[0]->Add(id0+ 2, slatsegB[4]);
725     segmentation[0]->Add(id0+10, slatsegB[4]);  
726     segmentation[0]->Add(id0+52, slatsegB[4]);
727     segmentation[0]->Add(id0+60, slatsegB[4]);
728   
729     // type 333300 
730     segmentation[0]->Add(id0+ 1, slatsegB[5]);
731     segmentation[0]->Add(id0+11, slatsegB[5]);  
732     segmentation[0]->Add(id0+51, slatsegB[5]);
733     segmentation[0]->Add(id0+61, slatsegB[5]);
734     fMUON->SetSegmentationModel(chamber, 1, segmentation[0]);
735
736     // cathode 1
737     // type 122330
738     segmentation[1]->Add(id0+ 6, slatsegNB[0]);
739     segmentation[1]->Add(id0+56, slatsegNB[0]);
740   
741     // type 112233
742     segmentation[1]->Add(id0+ 4, slatsegNB[1]);
743     segmentation[1]->Add(id0+ 5, slatsegNB[1]);
744     segmentation[1]->Add(id0+ 7, slatsegNB[1]);  
745     segmentation[1]->Add(id0+ 8, slatsegNB[1]);  
746     segmentation[1]->Add(id0+54, slatsegNB[1]);  
747     segmentation[1]->Add(id0+55, slatsegNB[1]);  
748     segmentation[1]->Add(id0+57, slatsegNB[1]);
749     segmentation[1]->Add(id0+58, slatsegNB[1]);
750
751     // type 333000 
752     segmentation[1]->Add(id0   , slatsegNB[2]);
753     segmentation[1]->Add(id0+12, slatsegNB[2]);  
754     segmentation[1]->Add(id0+50, slatsegNB[2]);
755     segmentation[1]->Add(id0+62, slatsegNB[2]);
756  
757     // type 222333 
758     segmentation[1]->Add(id0+ 3, slatsegNB[3]);
759     segmentation[1]->Add(id0+ 9, slatsegNB[3]);  
760     segmentation[1]->Add(id0+53, slatsegNB[3]);
761     segmentation[1]->Add(id0+59, slatsegNB[3]);
762  
763     // type 223330 
764     segmentation[1]->Add(id0+ 2, slatsegNB[4]);
765     segmentation[1]->Add(id0+10, slatsegNB[4]);  
766     segmentation[1]->Add(id0+52, slatsegNB[4]);
767     segmentation[1]->Add(id0+60, slatsegNB[4]);
768   
769     // type 333300 
770     segmentation[1]->Add(id0+ 1, slatsegNB[5]);
771     segmentation[1]->Add(id0+11, slatsegNB[5]);  
772     segmentation[1]->Add(id0+51, slatsegNB[5]);
773     segmentation[1]->Add(id0+61, slatsegNB[5]);
774     fMUON->SetSegmentationModel(chamber, 2, segmentation[1]);
775         
776     fMUON->SetResponseModel(chamber, fResponse0);           
777     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
778   }
779 }
780
781 //__________________________________________________________________________
782 void AliMUONFactoryV2::BuildStation6() 
783 {       
784  // Create Trigger geometry segmentation for given chamber and cathod
785
786  
787     AliMUONGeometrySegmentation *chamberSeg[2];
788 // Cluster-size off
789         AliMUONResponseTrigger* responseTrigger0 =  new AliMUONResponseTrigger;
790 // Cluster-size on  
791 //  AliMUONResponseTriggerV1* responseTrigger0 =  new AliMUONResponseTriggerV1;
792
793     for (Int_t chamber = 10; chamber < 14; chamber++) {
794
795       //Trigger Segmentation
796       AliMUONTriggerSegmentation *trigSegX[9]; 
797       AliMUONTriggerSegmentation *trigSegY[9]; 
798       for(Int_t i=0; i<9; i++) {
799         trigSegX[i] = new AliMUONTriggerSegmentation(1);
800         trigSegY[i] = new AliMUONTriggerSegmentation(0);
801         fDESegmentations->Add(trigSegX[i]);  
802         fDESegmentations->Add(trigSegY[i]);  
803         trigSegX[i]->SetLineNumber(9-i);    
804         trigSegY[i]->SetLineNumber(9-i);    
805       }
806
807       AliMUONChamber *iChamber, *iChamber1;
808       iChamber1 = &fMUON->Chamber(10);
809       iChamber  = &fMUON->Chamber(chamber);
810       Float_t zpos1= - iChamber1->Z();  
811       Float_t zpos = - iChamber->Z();        
812       Float_t zRatio = zpos / zpos1;
813
814       // init
815       Float_t stripWidth[3]={0.,0.,0.};     // 1.0625 2.125 4.25
816       Float_t stripLength[4]={0.,0.,0.,0.}; // 17. 34. 51. 68.
817       for (Int_t i=0; i<3; i++) 
818         stripWidth[i]=AliMUONTriggerConstants::StripWidth(i)*zRatio;
819       for (Int_t i=0; i<4; i++) 
820         stripLength[i]=AliMUONTriggerConstants::StripLength(i)*zRatio;
821       Int_t nStrip[7]={0,0,0,0,0,0,0};    
822       Float_t stripYsize[7]={0.,0.,0.,0.,0.,0.,0.};
823       Float_t stripXsize[7]={0.,0.,0.,0.,0.,0.,0.};
824
825       // chamber 8 0 cathode 0
826       for (Int_t i=0; i<7; i++) nStrip[i]=16;
827       for (Int_t i=0; i<7; i++) stripYsize[i]=stripWidth[2];
828       for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1];
829       stripXsize[6]=stripLength[2];
830       trigSegX[8]->Init(0,nStrip,stripYsize,stripXsize,0.); 
831       trigSegX[0]->Init(0,nStrip,stripYsize,stripXsize,0.); 
832
833       // chamber 8 7 1 0 cathode 1
834       for (Int_t i=0; i<6; i++) nStrip[i]=8;
835       nStrip[7]=16;
836       for (Int_t i=0; i<7; i++) stripYsize[i]=stripLength[3];  
837       for (Int_t i=0; i<7; i++) stripXsize[i]=stripWidth[2];
838       trigSegY[8]->Init(0,nStrip,stripYsize,stripXsize,0.);  
839       trigSegY[7]->Init(0,nStrip,stripYsize,stripXsize,0.);
840       trigSegY[1]->Init(0,nStrip,stripYsize,stripXsize,0.);
841       trigSegY[0]->Init(0,nStrip,stripYsize,stripXsize,0.);
842  
843       // chamber 7 6 2 1 cathode 0
844       for (Int_t i=0; i<6; i++) nStrip[i]=32;
845       nStrip[6]=16;  
846       for (Int_t i=0; i<6; i++) stripYsize[i]=stripWidth[1];
847       stripYsize[6]=stripWidth[2];
848       for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1];
849       stripXsize[6]=stripLength[2];
850       trigSegX[7]->Init(0,nStrip,stripYsize,stripXsize,0.);  
851       trigSegX[6]->Init(0,nStrip,stripYsize,stripXsize,0.);
852       trigSegX[2]->Init(0,nStrip,stripYsize,stripXsize,0.);  
853       trigSegX[1]->Init(0,nStrip,stripYsize,stripXsize,0.);
854
855       // chamber 6 2 cathode 1
856       for (Int_t i=0; i<5; i++) nStrip[i]=16;
857       for (Int_t i=5; i<6; i++) nStrip[i]=8;
858       nStrip[6]=16;
859       for (Int_t i=0; i<7; i++) stripYsize[i]=stripLength[3];
860       for (Int_t i=0; i<5; i++) stripXsize[i]=stripWidth[1];
861       for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2];
862       trigSegY[6]->Init(0,nStrip,stripYsize,stripXsize,0.);  
863       trigSegY[2]->Init(0,nStrip,stripYsize,stripXsize,0.);  
864
865       // chamber 5 3 cathode 0
866       nStrip[0]=48;
867       for (Int_t i=1; i<3; i++) nStrip[i]=64;
868       for (Int_t i=3; i<6; i++) nStrip[i]=32;
869       nStrip[6]=16;  
870       for (Int_t i=0; i<3; i++) stripYsize[i]=stripWidth[0];
871       for (Int_t i=3; i<6; i++) stripYsize[i]=stripWidth[1];
872       stripYsize[6]=stripWidth[2];
873       for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1];
874       stripXsize[6]=stripLength[2];
875       trigSegX[5]->Init(0,nStrip,stripYsize,stripXsize,stripLength[0]);  
876       trigSegX[3]->Init(0,nStrip,stripYsize,stripXsize,0.);
877
878       // chamber 5 3 cathode 1
879       for (Int_t i=0; i<5; i++) nStrip[i]=16;
880       for (Int_t i=5; i<6; i++) nStrip[5]=8;  
881       nStrip[6]=16;  
882       stripYsize[0]=stripLength[2];
883       for (Int_t i=1; i<8; i++) stripYsize[i]=stripLength[3];
884       for (Int_t i=0; i<5; i++) stripXsize[i]=stripWidth[1];
885       for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2];
886       trigSegY[5]->Init(0,nStrip,stripYsize,stripXsize,stripLength[0]);  
887       trigSegY[3]->Init(0,nStrip,stripYsize,stripXsize,0.);
888
889       // chamber 4 cathode 0
890       nStrip[0]=0;
891       for (Int_t i=1; i<3; i++) nStrip[i]=64;  
892       for (Int_t i=3; i<6; i++) nStrip[i]=32;  
893       nStrip[6]=16;
894       stripYsize[0]=0.;
895       for (Int_t i=1; i<3; i++) stripYsize[i]=stripWidth[0];
896       for (Int_t i=3; i<6; i++) stripYsize[i]=stripWidth[1];
897       stripYsize[6]=stripWidth[2];
898       stripXsize[0]=0;  
899       stripXsize[1]=stripLength[0];  
900       for (Int_t i=2; i<6; i++) stripXsize[i]=stripLength[1];
901       stripXsize[6]=stripLength[2];
902       trigSegX[4]->Init(0,nStrip,stripYsize,stripXsize,0.);  
903
904       // chamber 4 cathode 1
905       nStrip[0]=0;  
906       nStrip[1]=8;  
907       for (Int_t i=2; i<5; i++) nStrip[i]=16;
908       for (Int_t i=5; i<6; i++) nStrip[i]=8;
909       nStrip[6]=16;
910       stripYsize[0]=0.;  
911       for (Int_t i=1; i<7; i++) stripYsize[i]=stripLength[3];
912       stripXsize[0]=0.;
913       for (Int_t i=1; i<5; i++) stripXsize[i]=stripWidth[1];
914       for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2];
915       trigSegY[4]->Init(0,nStrip,stripYsize,stripXsize,0.);
916
917       chamberSeg[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
918       chamberSeg[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry());
919
920       fMUON->SetNsec(chamber,2);
921       Int_t icount=chamber-10;  // chamber counter (0 1 2 3)
922       Int_t id0=(10+icount+1)*100;
923
924
925       //  printf("in CreateTriggerSegmentation here 0 id0=%i \n",id0);  
926
927       for (Int_t i = 0; i < 9; i++) {       
928
929         // cathode 0
930         chamberSeg[0]->Add(id0+i,     trigSegX[i]);
931         chamberSeg[0]->Add(id0+50+i,  trigSegX[i]);
932         fMUON->SetSegmentationModel(chamber, 1, chamberSeg[0]);
933
934         // cathode 1
935         chamberSeg[1]->Add(id0+i,     trigSegY[i]);
936         chamberSeg[1]->Add(id0+50+i,  trigSegY[i]);
937         fMUON->SetSegmentationModel(chamber, 2, chamberSeg[1]);
938
939       }
940
941       fMUON->SetResponseModel(chamber, responseTrigger0);      
942       fMUON->Chamber(chamber).SetChargeCorrel(0); // same charge on cathodes
943
944   
945       //  printf("in CreateTriggerSegmentation here 1\n");  
946
947       if (!id0) {
948         AliWarning(Form("Segmentation for chamber %d is not yet defined",chamber));
949         return ;      
950       }
951     }
952 }       
953 //__________________________________________________________________________
954 void AliMUONFactoryV2::Build(AliMUON* where, const char* what) 
955 {
956   //
957   // Construct MUON from chambers, segmentation and responses
958   //
959
960   fMUON = where;
961   char tmp[20];
962   strcpy(tmp, what);
963
964   if (strcmp(tmp, "default")==0) {
965     // Set default parameters
966     fMUON->SetIshunt(0);
967     fMUON->SetMaxStepGas(0.1);
968     fMUON->SetMaxStepAlu(0.1);
969
970     // Build all stations
971     BuildCommon();
972     BuildStation1();
973     BuildStation2();
974     BuildStation3();
975     BuildStation4();
976     BuildStation5();
977     BuildStation6();
978   } 
979   else
980     AliDebug(0,"Non default version of MUON selected. You have to construct yourself the MUON elements !!");
981 }
982
983 //__________________________________________________________________________
984 void AliMUONFactoryV2::BuildStation(AliMUON* where, Int_t stationNumber) 
985 {
986   //
987   // Construct MUON from chambers, segmentation and responses
988   //
989   // Version 0
990   //
991   // First define the number of planes that are segmented (1 or 2) by a call
992   // to SetNsec.
993   // Then chose for each chamber (chamber plane) the segmentation
994   // and response model.
995   // They should be equal for the two chambers of each station. In a future
996   // version this will be enforced.
997   //
998
999   fMUON = where;
1000   if (!fResponse0) BuildCommon(); 
1001     
1002   switch (stationNumber) {    
1003   case 1:  BuildStation1(); break;
1004   case 2:  BuildStation2(); break;
1005   case 3:  BuildStation3(); break;
1006   case 4:  BuildStation4(); break;
1007   case 5:  BuildStation5(); break;
1008   case 6:  BuildStation6(); break;
1009     
1010   default: AliFatal("Wrong station number");
1011   }  
1012 }