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