]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegFactory.cxx
Class description on 5 lines
[u/mrichter/AliRoot.git] / MUON / AliMUONSegFactory.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 // --------------------------
23 // Class AliMUONSegFactory
24 // --------------------------
25 // New factory for building segmentations at all levels
26 // Authors: Ivana Hrivnacova, IPN Orsay
27
28 #include "AliMUONSegFactory.h"
29 #include "AliMUONConstants.h"
30 #include "AliMUONGeometryStore.h"
31 #include "AliMUONGeometryTransformer.h"
32 #include "AliMUONGeometryModule.h"
33 #include "AliMUONSegmentation.h"
34 #include "AliMUONGeometrySegmentation.h"
35 #include "AliMUONSt12QuadrantSegmentation.h"
36 #include "AliMUONSt345SlatSegmentation.h"
37 #include "AliMUONSt345SlatSegmentationV2.h"
38 #include "AliMUONTriggerSegmentation.h"
39 #include "AliMUONTriggerSegmentationV2.h"
40 #include "AliMUONTriggerConstants.h"
41
42 #include "AliMpDEManager.h"
43 #include "AliMpDEIterator.h"
44
45 #include "AliLog.h"
46
47 #include <Riostream.h>
48 #include <TSystem.h>
49 #include <TObjString.h>
50 #include <TMap.h>
51
52 ClassImp(AliMUONSegFactory)
53
54 //______________________________________________________________________________
55 AliMUONSegFactory::AliMUONSegFactory(const AliMUONGeometryTransformer* geometry)
56     : TObject(),
57       fMpSegFactory(),
58       fDESegmentations(),
59       fSegmentation(0),
60       fkTransformer(geometry)
61 {  
62 /// Standard constructor
63
64 }
65
66 //______________________________________________________________________________
67 AliMUONSegFactory::AliMUONSegFactory(const TString& volPathsFileName,
68                                      const TString& transformsFileName)
69     : TObject(),
70       fMpSegFactory(),
71       fDESegmentations(),
72       fSegmentation(0),
73       fkTransformer(0)
74 {  
75 /// Standard constructor
76
77   // Transformer
78   AliMUONGeometryTransformer* transformer = new AliMUONGeometryTransformer(true);
79   transformer->ReadGeometryData(volPathsFileName, transformsFileName);
80   fkTransformer = transformer;  
81 }
82
83 //______________________________________________________________________________
84   AliMUONSegFactory::AliMUONSegFactory()
85     : TObject(),      
86       fMpSegFactory(),
87       fDESegmentations(),
88       fSegmentation(0),
89       fkTransformer(0)
90 {
91 /// Default constructor
92 }
93
94 //______________________________________________________________________________
95 AliMUONSegFactory::AliMUONSegFactory(const AliMUONSegFactory& rhs)
96  : TObject(rhs)
97 {
98 /// Protected copy constructor
99
100   AliFatal("Not implemented.");
101 }
102
103 //______________________________________________________________________________
104
105 AliMUONSegFactory::~AliMUONSegFactory()
106 {
107 /// Destructor
108
109   //delete fSegmentation;
110         // The segmentation is supposed to be deleted in the client code
111 }
112
113 //______________________________________________________________________________
114 AliMUONSegFactory&  AliMUONSegFactory::operator=(const AliMUONSegFactory& rhs)
115 {
116   // Protected assignement operator
117
118   if (this == &rhs) return *this;
119
120   AliFatal("Not implemented.");
121     
122   return *this;  
123 }    
124           
125 //
126 // Private methods
127 //
128
129 //______________________________________________________________________________
130 Bool_t AliMUONSegFactory::IsGeometryDefined(Int_t ichamber)
131 {
132 // Return true, if det elements for the chamber with the given ichamber Id
133 // are defined in geometry (the geometry builder for this chamber was activated)
134
135   if ( ! fkTransformer ||
136        ! fkTransformer->GetModuleTransformer(ichamber, false) )
137        
138     return kFALSE;
139   
140   return kTRUE;
141 }  
142
143 //__________________________________________________________________________
144 AliMUONSegmentation* AliMUONSegFactory::Segmentation()
145
146 /// Return the segmentation container, create it if it does not yet exist
147
148   if ( ! fSegmentation ) 
149     fSegmentation = new AliMUONSegmentation(AliMUONConstants::NCh());
150
151   return fSegmentation; 
152 }
153
154 //
155 // public methods
156 //
157
158 //______________________________________________________________________________
159 AliMpVSegmentation* 
160 AliMUONSegFactory::CreateMpSegmentation(Int_t detElemId, Int_t cath)
161 {
162 /// Create mapping segmentation for given detElemId and cath
163 /// using mapping manager
164
165   AliMpVSegmentation* mpSegmentation 
166     = fMpSegFactory.CreateMpSegmentation(detElemId, cath);
167
168   Segmentation()->AddMpSegmentation(mpSegmentation);
169   
170   return mpSegmentation;
171
172     
173 //______________________________________________________________________________
174 AliMUONVGeometryDESegmentation*  
175 AliMUONSegFactory::CreateDESegmentation(Int_t detElemId, Int_t cath)
176
177 // Create DE segmentation, operating in local DE reference frame
178
179   // Check detElemId & cath  
180   if ( ! AliMpDEManager::IsValid(detElemId, cath, true) ) return 0;
181   
182   // Check if transformer is defined
183   if ( ! fkTransformer) {
184     AliErrorStream() << "Geometry transformer not defined" << endl;
185     return 0;
186   }  
187
188   // Only return it, if DE segmentation for this detElemId and cath
189   // was already defined
190   //
191   const AliMUONVGeometryDESegmentation* kdeSegmentation
192     = Segmentation()->GetDESegmentation(detElemId, cath, false);
193   if ( kdeSegmentation ) 
194     return const_cast<AliMUONVGeometryDESegmentation*>(kdeSegmentation);
195   
196   // Get module, create it if it does not exist 
197   //
198   Int_t moduleId = AliMUONGeometryStore::GetModuleId(detElemId);               
199   AliMUONGeometrySegmentation* moduleSegmentation
200     = Segmentation()->GetModuleSegmentation(moduleId, cath, false);
201   if (! moduleSegmentation) {
202     moduleSegmentation 
203       = new AliMUONGeometrySegmentation(
204                fkTransformer->GetModuleTransformer(moduleId));
205     Segmentation()->AddModuleSegmentation(moduleId, cath, moduleSegmentation);
206   }        
207    
208   // Get DE segmentation for this DE type, create it if it does not exist 
209   // 
210   AliMUONVGeometryDESegmentation* deSegmentation = 0;
211   TString deName = AliMpDEManager::GetDEName(detElemId, cath);
212   TObject* objSegmentation = fDESegmentations.Get(deName);
213   if ( objSegmentation ) 
214     deSegmentation = (AliMUONVGeometryDESegmentation*)objSegmentation;  
215     
216   if ( !deSegmentation ) {
217
218     // Get/Create mapping segmentation via mapping manager
219     AliMpVSegmentation* mpSegmentation 
220       = CreateMpSegmentation(detElemId, cath);
221  
222     AliMpStationType stationType = AliMpDEManager::GetStationType(detElemId);
223     AliMpPlaneType planeType = AliMpDEManager::GetPlaneType(detElemId, cath);
224     
225     switch (stationType) {
226
227       case kStation1:
228       case kStation2:
229         deSegmentation = new AliMUONSt12QuadrantSegmentation(
230                                  mpSegmentation, stationType, planeType);
231         //cout << "   new AliMUONSt12QuadrantSegmentation "
232         //     << StationTypeName(stationType) << "  "  
233         //     << PlaneTypeName(planeType) << "  "
234         //     << deName << endl;
235                                           
236         break;
237         
238       case kStation345:                   
239         deSegmentation = new AliMUONSt345SlatSegmentationV2(
240                                  mpSegmentation, detElemId, planeType); 
241         //cout << "   new AliMUONSt345SlatSegmentationV2 "                        
242         //     << StationTypeName(stationType) << "  "  
243         //     << PlaneTypeName(planeType) << "  "
244         //     << deName << endl;                                 
245         break;
246     
247       case kStationTrigger:               
248         deSegmentation = new AliMUONTriggerSegmentationV2(
249                                  mpSegmentation, detElemId, planeType); 
250         //cout << "   new AliMUONTriggerSegmentationV2 "                          
251         //     << StationTypeName(stationType) << "  "  
252         //     << PlaneTypeName(planeType) << "  "                        
253         //     << deName << endl;                                 
254         break;
255     }
256     
257     // Map new DE segmentation
258     fDESegmentations.Add(deName, deSegmentation);
259     Segmentation()->AddDESegmentation(deSegmentation);
260   }
261   
262   // Add  DE segmentation to module
263   //
264   moduleSegmentation->Add(detElemId, deName, deSegmentation);  
265   
266   return deSegmentation;
267 }        
268   
269
270 //______________________________________________________________________________
271 AliMUONGeometrySegmentation*  
272 AliMUONSegFactory::CreateModuleSegmentation(Int_t moduleId, Int_t cath)
273
274 // Create module segmentation, operating in global reference frame
275 // Detection elements are defined via DE names map.
276
277   // Check cathod & module Id 
278   if ( ! AliMpDEManager::IsValidCathod(cath, true) || 
279        ! AliMpDEManager::IsValidModuleId(moduleId, true) ) return 0;
280
281   AliMpDEIterator it;
282   for ( it.First(moduleId); ! it.IsDone(); it.Next() )
283     CreateDESegmentation(it.CurrentDE(), cath);
284   
285   return Segmentation()->GetModuleSegmentation(moduleId, cath);  
286 }  
287     
288 //______________________________________________________________________________
289 AliMUONSegmentation*  
290 AliMUONSegFactory::CreateSegmentation(const TString& option)
291 {
292 /// Create segmentations on all levels and return their container.
293
294   // Check options
295   if ( option != "default"   && 
296        option != "FactoryV2" && 
297        option != "FactoryV3" &&
298        option != "FactoryV4" &&
299        option != "new") {
300
301     AliErrorStream() << "Option " << option << " not defined." << endl;
302     return 0;
303   }         
304  
305   if ( option == "FactoryV2" ) { 
306     // Default segmentation version
307     for (Int_t moduleId = 0; moduleId<4; moduleId++)
308       for (Int_t cath = 0; cath < 2; cath++) {
309         if ( IsGeometryDefined(moduleId) ) 
310           CreateModuleSegmentation( moduleId, cath);
311     }
312     if ( IsGeometryDefined(4) )  BuildStation3();
313     if ( IsGeometryDefined(6) )  BuildStation4();
314     if ( IsGeometryDefined(8) )  BuildStation5();
315     if ( IsGeometryDefined(10))  BuildStation6();
316   }      
317        
318   if ( option == "FactoryV3" ) { 
319     // New slat segmentation
320     for (Int_t moduleId = 0; moduleId<10; moduleId++)
321       for (Int_t cath = 0; cath < 2; cath++) {
322         if ( IsGeometryDefined(moduleId) )
323            CreateModuleSegmentation( moduleId, cath);
324     }
325     if ( IsGeometryDefined(10) ) BuildStation6();
326   }      
327       
328   if (option == "default" || option == "new" || option == "FactoryV4" ) {    
329
330     for (Int_t moduleId = 0; moduleId<AliMUONConstants::NCh(); moduleId++)
331       for (Int_t cath = 0; cath < 2; cath++) {
332         if ( IsGeometryDefined(moduleId) )
333           CreateModuleSegmentation( moduleId, cath);
334     }
335   }
336   return Segmentation();
337 }
338
339 //
340 //  Functions for building old segmentations (not based on mapping)
341 // 
342        
343 //__________________________________________________________________________
344 void AliMUONSegFactory::BuildStation3() 
345 {
346   //--------------------------------------------------------
347   // Configuration for Chamber TC5/6  (Station 3) ----------          
348   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
349
350   AliMUONGeometrySegmentation* segmentation[2];
351
352   //Slats Segmentations
353   AliMUONSt345SlatSegmentation *slatsegB[4]; // Types of segmentation for St3
354   AliMUONSt345SlatSegmentation *slatsegNB[4]; 
355   // Bending
356
357   Int_t ndiv[4] ={ 4, 4, 2, 1};  // densities zones 
358   for(Int_t i=0; i<4; i++) {
359     slatsegB[i] = new AliMUONSt345SlatSegmentation(1);
360     Segmentation()->AddDESegmentation(slatsegB[i]);  
361     slatsegB[i]->SetPadSize(10.,0.5);
362     slatsegB[i]->SetPadDivision(ndiv);
363     slatsegB[i]->SetId(1); // Id elt ????
364     slatsegB[i]->SetDAnod(AliMUONConstants::Pitch());
365     slatsegNB[i] = new AliMUONSt345SlatSegmentation(0);
366     Segmentation()->AddDESegmentation(slatsegNB[i]);  
367     slatsegNB[i]->SetPadSize(1./1.4,10.); // Nbending
368     slatsegNB[i]->SetPadDivision(ndiv);
369     slatsegNB[i]->SetId(1);
370     slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch());
371   }
372
373   // Type 112200 for 500, 501, 508, 509, 510, 517 
374   // in Ch5 (similar for Ch6) for the futur official numbering
375   // Type 112200 for 503, 504, 505, 555, 554, 553 
376   // in Ch5 (similar for Ch6) actual numbering in the code to be changed in jan05
377   Int_t n0[4] = { 0, 2, 2, 0 };
378   slatsegB[0]->SetPcbBoards(n0);
379   slatsegB[0]->Init(0);
380   slatsegNB[0]->SetPcbBoards(n0);
381   slatsegNB[0]->Init(0);
382     
383   // Type 122200 for 502, 507, 511, 516 (similar in Ch6) 
384   // for future official numbering of ALICE
385   // Type 122200 for 502, 506, 556, 552 (similiarin Ch6) 
386   // for actual numbering in muon code to be changed in jan05
387   Int_t n1[4] = { 0, 1, 3, 0 }; 
388   slatsegB[1]->SetPcbBoards(n1);
389   slatsegB[1]->Init(0); 
390   slatsegNB[1]->SetPcbBoards(n1);
391   slatsegNB[1]->Init(0); 
392     
393   // Type 222000 for 503, 506, 512, 515 (similar in Ch6) 
394   // for future official numbering of ALICE
395   // Type 222000 for 501, 507, 557, 551 (similiarin Ch6) 
396   // for actual numbering in muon code to be changed in jan05
397   Int_t n2[4] = { 0, 0, 3, 0 };
398   slatsegB[2]->SetPcbBoards(n2);
399   slatsegB[2]->Init(0);
400   slatsegNB[2]->SetPcbBoards(n2);
401   slatsegNB[2]->Init(0);
402     
403   // Type 220000 for 504, 505, 513, 514 (similar in Ch6) 
404   // for future official numbering of ALICE
405   // Type 220000 for 500, 508, 558, 550 (similiarin Ch6) 
406   // for actual numbering in muon code to be changed in jan05
407   Int_t n3[4] = { 0, 0, 2, 0 };
408   slatsegB[3]->SetPcbBoards(n3);
409   slatsegB[3]->Init(0); 
410   slatsegNB[3]->SetPcbBoards(n3);
411   slatsegNB[3]->Init(0); 
412
413   for (Int_t chamber = 4; chamber < 6; chamber++) {
414
415     const AliMUONGeometryModuleTransformer* kModuleTransformer 
416       = fkTransformer->GetModuleTransformer(chamber);
417       
418     segmentation[0] = new AliMUONGeometrySegmentation(kModuleTransformer);
419     segmentation[1] = new AliMUONGeometrySegmentation(kModuleTransformer);
420         
421     // id detection elt for chamber 1
422     Int_t id0 = (chamber+1)*100;
423
424     // cathode 0
425     // type 220000
426     segmentation[0]->Add(id0+14, "Undefined", slatsegB[3]);
427     segmentation[0]->Add(id0+ 4, "Undefined", slatsegB[3]);  
428     segmentation[0]->Add(id0+13, "Undefined", slatsegB[3]);  
429     segmentation[0]->Add(id0+ 5, "Undefined", slatsegB[3]);
430     // type 222000
431     segmentation[0]->Add(id0+15, "Undefined", slatsegB[2]);
432     segmentation[0]->Add(id0+ 3, "Undefined", slatsegB[2]);  
433     segmentation[0]->Add(id0+12, "Undefined", slatsegB[2]);  
434     segmentation[0]->Add(id0+ 6, "Undefined", slatsegB[2]);
435     // type 122200
436     segmentation[0]->Add(id0+16, "Undefined", slatsegB[1]);
437     segmentation[0]->Add(id0+ 2, "Undefined", slatsegB[1]);  
438     segmentation[0]->Add(id0+11, "Undefined", slatsegB[1]);  
439     segmentation[0]->Add(id0+ 7, "Undefined", slatsegB[1]);
440     // type 112200
441     segmentation[0]->Add(id0+17, "Undefined", slatsegB[0]);
442     segmentation[0]->Add(id0,    "Undefined", slatsegB[0]);  
443     segmentation[0]->Add(id0+ 1, "Undefined", slatsegB[0]);  
444     segmentation[0]->Add(id0+10, "Undefined", slatsegB[0]);
445     segmentation[0]->Add(id0+ 9, "Undefined", slatsegB[0]);     
446     segmentation[0]->Add(id0+ 8, "Undefined", slatsegB[0]);
447     Segmentation()->AddModuleSegmentation(chamber, 0, segmentation[0]);   
448
449     // cathode 1
450     // type 220000
451     segmentation[1]->Add(id0+14, "Undefined", slatsegNB[3]);
452     segmentation[1]->Add(id0+ 4, "Undefined", slatsegNB[3]);  
453     segmentation[1]->Add(id0+13, "Undefined", slatsegNB[3]);  
454     segmentation[1]->Add(id0+ 5, "Undefined", slatsegNB[3]);
455     // type 222000
456     segmentation[1]->Add(id0+15, "Undefined", slatsegNB[2]);
457     segmentation[1]->Add(id0+ 3, "Undefined", slatsegNB[2]);  
458     segmentation[1]->Add(id0+12, "Undefined", slatsegNB[2]);  
459     segmentation[1]->Add(id0+ 6, "Undefined", slatsegNB[2]);
460     // type 122200
461     segmentation[1]->Add(id0+16, "Undefined", slatsegNB[1]);
462     segmentation[1]->Add(id0+ 2, "Undefined", slatsegNB[1]);  
463     segmentation[1]->Add(id0+11, "Undefined", slatsegNB[1]);  
464     segmentation[1]->Add(id0+ 7, "Undefined", slatsegNB[1]);
465     // type 112200
466     segmentation[1]->Add(id0+17, "Undefined", slatsegNB[0]);
467     segmentation[1]->Add(id0,    "Undefined", slatsegNB[0]);  
468     segmentation[1]->Add(id0+ 1, "Undefined", slatsegNB[0]);  
469     segmentation[1]->Add(id0+10, "Undefined", slatsegNB[0]);
470     segmentation[1]->Add(id0+ 9, "Undefined", slatsegNB[0]);     
471     segmentation[1]->Add(id0+ 8, "Undefined", slatsegNB[0]);
472     Segmentation()->AddModuleSegmentation(chamber, 1, segmentation[1]);   
473   }
474 }
475
476 //__________________________________________________________________________
477 void AliMUONSegFactory::BuildStation4() 
478 {
479   //--------------------------------------------------------
480   // Configuration for Chamber TC7/8  (Station 4) ----------           
481   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
482
483
484   AliMUONGeometrySegmentation* segmentation[2];
485
486   //Slats Segmentations
487   AliMUONSt345SlatSegmentation *slatsegB[7]; // Types of segmentation for St4
488   AliMUONSt345SlatSegmentation *slatsegNB[7]; 
489   // Bending
490
491   Int_t ndiv[4] ={ 4, 4, 2, 1};  // densities zones 
492   for(Int_t i = 0; i < 7; i++) {
493     slatsegB[i] = new AliMUONSt345SlatSegmentation(1);
494     Segmentation()->AddDESegmentation(slatsegB[i]);  
495     slatsegB[i]->SetPadSize(10.,0.5);
496     slatsegB[i]->SetPadDivision(ndiv);
497     slatsegB[i]->SetId(1);
498     slatsegB[i]->SetDAnod(AliMUONConstants::Pitch());
499     slatsegNB[i] = new AliMUONSt345SlatSegmentation(0);
500     Segmentation()->AddDESegmentation(slatsegNB[i]);  
501     slatsegNB[i]->SetPadSize(1./1.4,10.); 
502     slatsegNB[i]->SetPadDivision(ndiv);
503     slatsegNB[i]->SetId(1);
504     slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch());
505   }
506
507   Int_t n4[4] = { 0, 1, 2, 2 };
508   slatsegB[0]->SetPcbBoards(n4);
509   slatsegB[0]->Init(0); // 0 detection element id
510   slatsegNB[0]->SetPcbBoards(n4);
511   slatsegNB[0]->Init(0); // 0 detection element id
512     
513   // Type 112233 for 701, 712, 714, 725 in Ch7 (similar for Ch8) 
514   // for the futur official numbering
515   // Type 112233 for 705, 707, 755, 757 in Ch7 (similar for Ch8) 
516   // actual numbering in the code to be changed in jan05
517   // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 
518   // (similar for Ch10) for the futur official numbering
519   // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 
520   // (similar for Ch10) actual numbering in the code to be changed in jan05
521   Int_t n5[4] = { 0, 2, 2, 2 };
522   slatsegB[1]->SetPcbBoards(n5);
523   slatsegB[1]->Init(0); // 0 detection element id
524   slatsegNB[1]->SetPcbBoards(n5);
525   slatsegNB[1]->Init(0); // 0 detection element id
526     
527   // Type 112230 for 702, 711, 715, 724 in Ch7 (similar for Ch8) 
528   // for the futur official numbering
529   // Type 112230 for 704, 708, 754, 758 in Ch7 (similar for Ch8) 
530   // actual numbering in the code to be changed in jan05
531   Int_t n6[4] = { 0, 2, 2, 1 };
532   slatsegB[2]->SetPcbBoards(n6);
533   slatsegB[2]->Init(0); // 0 detection element id
534   slatsegNB[2]->SetPcbBoards(n6);
535   slatsegNB[2]->Init(0); // 0 detection element id
536     
537   // Type 222330 for 703, 710, 716, 723 in Ch7 (similar for Ch8) 
538   // for the futur official numbering
539   // Type 222330 for 703, 709, 753, 759 in Ch7 (similar for Ch8) 
540   // actual numbering in the code to be changed in jan05
541   Int_t n7[4] = { 0, 0, 3, 2 };
542   slatsegB[3]->SetPcbBoards(n7);
543   slatsegB[3]->Init(0); // 0 detection element id
544   slatsegNB[3]->SetPcbBoards(n7);
545   slatsegNB[3]->Init(0); // 0 detection element id
546     
547   // Type 223300 for 704, 709, 717, 722 in Ch7 (similar for Ch8) 
548   // for the futur official numbering
549   // Type 223300 for 702, 710, 752, 760 in Ch7 (similar for Ch8) 
550   // actual numbering in the code to be changed in jan05
551   Int_t n8[4] = { 0, 0, 2, 2 };
552   slatsegB[4]->SetPcbBoards(n8);
553   slatsegB[4]->Init(0); // 0 detection element id
554   slatsegNB[4]->SetPcbBoards(n8);
555   slatsegNB[4]->Init(0); // 0 detection element id
556     
557   // Type 333000 for 705, 708, 718, 721 in Ch7 (similar for Ch8) 
558   // for the futur official numbering
559   // Type 333000 for 701, 711, 751, 761 in Ch7 (similar for Ch8) 
560   // actual numbering in the code to be changed in jan05
561   // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) 
562   // for the futur official numbering
563   // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) 
564   // actual numbering in the code to be changed in jan05
565   Int_t n9[4] = { 0, 0, 0, 3 };
566   slatsegB[5]->SetPcbBoards(n9);
567   slatsegB[5]->Init(0); // 0 detection element id
568   slatsegNB[5]->SetPcbBoards(n9);
569   slatsegNB[5]->Init(0); // 0 detection element id
570     
571   // Type 330000 for 706, 707, 719, 720 in Ch7 (similar for Ch8) 
572   // for the futur official numbering
573   // Type 330000 for 700, 712, 750, 762 in Ch7 (similar for Ch8) 
574   // actual numbering in the code to be changed in jan05
575   Int_t n10[4] = { 0, 0, 0, 2 };
576   slatsegB[6]->SetPcbBoards(n10);
577   slatsegB[6]->Init(0); // 0 detection element id
578   slatsegNB[6]->SetPcbBoards(n10);
579   slatsegNB[6]->Init(0); // 0 detection element id
580
581
582   for (Int_t chamber = 6; chamber < 8; chamber++) {
583
584     const AliMUONGeometryModuleTransformer* kModuleTransformer 
585       = fkTransformer->GetModuleTransformer(chamber);
586       
587     segmentation[0] = new AliMUONGeometrySegmentation(kModuleTransformer);
588     segmentation[1] = new AliMUONGeometrySegmentation(kModuleTransformer);
589         
590     // id detection elt for chamber 1
591     Int_t id0 = (chamber+1)*100;
592
593     //--------------------------------------------------------
594     // Configuration for Chamber TC6/7  (Station 4) ----------           
595
596     // cathode 0
597     // type 122330
598     segmentation[0]->Add(id0+13, "Undefined", slatsegB[0]);
599     segmentation[0]->Add(id0   , "Undefined", slatsegB[0]);
600   
601     // type 112233
602     segmentation[0]->Add(id0+14, "Undefined", slatsegB[1]);
603     segmentation[0]->Add(id0+12, "Undefined", slatsegB[1]);  
604     segmentation[0]->Add(id0+25, "Undefined", slatsegB[1]);  
605     segmentation[0]->Add(id0+ 1, "Undefined", slatsegB[1]);
606    
607     // type 112230
608     segmentation[0]->Add(id0+15, "Undefined", slatsegB[2]);
609     segmentation[0]->Add(id0+11, "Undefined", slatsegB[2]);  
610     segmentation[0]->Add(id0+24, "Undefined", slatsegB[2]);  
611     segmentation[0]->Add(id0+ 2, "Undefined", slatsegB[2]);
612
613     // type 222330 
614     segmentation[0]->Add(id0+16, "Undefined", slatsegB[3]);
615     segmentation[0]->Add(id0+10, "Undefined", slatsegB[3]);  
616     segmentation[0]->Add(id0+23, "Undefined", slatsegB[3]);
617     segmentation[0]->Add(id0+ 3, "Undefined", slatsegB[3]);
618
619     // type 223300 
620     segmentation[0]->Add(id0+17, "Undefined", slatsegB[4]);
621     segmentation[0]->Add(id0+ 9, "Undefined", slatsegB[4]);  
622     segmentation[0]->Add(id0+22, "Undefined", slatsegB[4]);
623     segmentation[0]->Add(id0+ 4, "Undefined", slatsegB[4]);
624
625     // type 333000 
626     segmentation[0]->Add(id0+18, "Undefined", slatsegB[5]);
627     segmentation[0]->Add(id0+ 8, "Undefined", slatsegB[5]);  
628     segmentation[0]->Add(id0+21, "Undefined", slatsegB[5]);
629     segmentation[0]->Add(id0+ 5, "Undefined", slatsegB[5]);
630
631     // type 330000 
632     segmentation[0]->Add(id0+19, "Undefined", slatsegB[6]);
633     segmentation[0]->Add(id0+ 7, "Undefined", slatsegB[6]);  
634     segmentation[0]->Add(id0+20, "Undefined", slatsegB[6]);
635     segmentation[0]->Add(id0+ 6, "Undefined", slatsegB[6]);
636     Segmentation()->AddModuleSegmentation(chamber, 0, segmentation[0]);   
637
638     // cathode 1
639     // type 122330
640     segmentation[1]->Add(id0+13, "Undefined", slatsegNB[0]);
641     segmentation[1]->Add(id0   , "Undefined", slatsegNB[0]);
642
643     // type 112233
644     segmentation[1]->Add(id0+14, "Undefined", slatsegNB[1]);
645     segmentation[1]->Add(id0+12, "Undefined", slatsegNB[1]);  
646     segmentation[1]->Add(id0+25, "Undefined", slatsegNB[1]);  
647     segmentation[1]->Add(id0+ 1, "Undefined", slatsegNB[1]);
648   
649     // type 112230
650     segmentation[1]->Add(id0+15, "Undefined", slatsegNB[2]);
651     segmentation[1]->Add(id0+11, "Undefined", slatsegNB[2]);  
652     segmentation[1]->Add(id0+24, "Undefined", slatsegNB[2]);  
653     segmentation[1]->Add(id0+ 2, "Undefined", slatsegNB[2]);
654
655     // type 222330 
656     segmentation[1]->Add(id0+16, "Undefined", slatsegNB[3]);
657     segmentation[1]->Add(id0+10, "Undefined", slatsegNB[3]);  
658     segmentation[1]->Add(id0+23, "Undefined", slatsegNB[3]);
659     segmentation[1]->Add(id0+ 3, "Undefined", slatsegNB[3]);
660
661     // type 223300 
662     segmentation[1]->Add(id0+17, "Undefined", slatsegNB[4]);
663     segmentation[1]->Add(id0+ 9, "Undefined", slatsegNB[4]);  
664     segmentation[1]->Add(id0+22, "Undefined", slatsegNB[4]);
665     segmentation[1]->Add(id0+ 4, "Undefined", slatsegNB[4]);
666
667     // type 333000 
668     segmentation[1]->Add(id0+18, "Undefined", slatsegNB[5]);
669     segmentation[1]->Add(id0+ 8, "Undefined", slatsegNB[5]);  
670     segmentation[1]->Add(id0+21, "Undefined", slatsegNB[5]);
671     segmentation[1]->Add(id0+ 5, "Undefined", slatsegNB[5]);
672
673     // type 330000 
674     segmentation[1]->Add(id0+19, "Undefined", slatsegNB[6]);
675     segmentation[1]->Add(id0+ 7, "Undefined", slatsegNB[6]);  
676     segmentation[1]->Add(id0+20, "Undefined", slatsegNB[6]);
677     segmentation[1]->Add(id0+ 6, "Undefined", slatsegNB[6]);
678     Segmentation()->AddModuleSegmentation(chamber, 1, segmentation[1]);   
679   }
680 }
681
682 //__________________________________________________________________________
683 void AliMUONSegFactory::BuildStation5() 
684 {       
685   //--------------------------------------------------------
686   // Configuration for Chamber TC9/10  (Station 5) ---------           
687   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
688
689   AliMUONGeometrySegmentation* segmentation[2];
690
691   //Slats Segmentations
692   AliMUONSt345SlatSegmentation *slatsegB[6]; // Types of segmentation for St5
693   AliMUONSt345SlatSegmentation *slatsegNB[6]; 
694   // Bending
695
696   Int_t ndiv[4] ={ 4, 4, 2, 1};  // densities zones 
697   for(Int_t i = 0; i < 6; i++) {
698     slatsegB[i] = new AliMUONSt345SlatSegmentation(1);
699     Segmentation()->AddDESegmentation(slatsegB[i]);  
700     slatsegB[i]->SetPadSize(10.,0.5);
701     slatsegB[i]->SetPadDivision(ndiv);
702     slatsegB[i]->SetId(1);
703     slatsegB[i]->SetDAnod(AliMUONConstants::Pitch());
704     slatsegNB[i] = new AliMUONSt345SlatSegmentation(0);
705     Segmentation()->AddDESegmentation(slatsegNB[i]);  
706     slatsegNB[i]->SetPadSize(1./1.4,10.); 
707     slatsegNB[i]->SetPadDivision(ndiv);
708     slatsegNB[i]->SetId(1);
709     slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch());
710   }
711
712   // Type 122330 for 900, 913 in Ch9 (similar for Ch10) 
713   // for the futur official numbering
714   // Type 122330 for 906, 956 in Ch9 (similar for Ch10) 
715   // actual numbering in the code to be changed in jan05
716   Int_t n4[4] = { 0, 1, 2, 2 };
717   slatsegB[0]->SetPcbBoards(n4);
718   slatsegB[0]->Init(0); // 0 detection element id
719   slatsegNB[0]->SetPcbBoards(n4);
720   slatsegNB[0]->Init(0); // 0 detection element id
721     
722   // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 
723   // (similar for Ch10) for the futur official numbering
724   // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 
725   // (similar for Ch10) actual numbering in the code to be changed in jan05
726   Int_t n5[4] = { 0, 2, 2, 2 };
727   slatsegB[1]->SetPcbBoards(n5);
728   slatsegB[1]->Init(0); // 0 detection element id
729   slatsegNB[1]->SetPcbBoards(n5);
730   slatsegNB[1]->Init(0); // 0 detection element id
731
732   // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) 
733   // for the futur official numbering
734   // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) 
735   // actual numbering in the code to be changed in jan05
736   Int_t n9[4] = { 0, 0, 0, 3 };
737   slatsegB[2]->SetPcbBoards(n9);
738   slatsegB[2]->Init(0); // 0 detection element id
739   slatsegNB[2]->SetPcbBoards(n9);
740   slatsegNB[2]->Init(0); // 0 detection element id
741
742   // Type 222333 for 903, 910, 916, 923 in Ch9 (similar for Ch10) 
743   // for the futur official numbering
744   // Type 222333 for 903, 909, 953, 959 in Ch9 (similar for Ch10) 
745   // actual numbering in the code to be changed in jan05
746   Int_t n11[4] = { 0, 0, 3, 3 };
747   slatsegB[3]->SetPcbBoards(n11);
748   slatsegB[3]->Init(0); // 0 detection element id
749   slatsegNB[3]->SetPcbBoards(n11);
750   slatsegNB[3]->Init(0); // 0 detection element id
751   
752   // Type 223330 for 904, 909, 917, 922 in Ch9 (similar for Ch10) 
753   // for the futur official numbering
754   // Type 223330 for 902, 910, 952, 960 in Ch9 (similar for Ch10) 
755   // actual numbering in the code to be changed in jan05
756   Int_t n12[4] = { 0, 0, 2, 3 };
757   slatsegB[4]->SetPcbBoards(n12);
758   slatsegB[4]->Init(0); // 0 detection element id
759   slatsegNB[4]->SetPcbBoards(n12);
760   slatsegNB[4]->Init(0); // 0 detection element id
761     
762   // Type 333300 for 905, 908, 918, 921 in Ch9 (similar for Ch10) 
763   // for the futur official numbering
764   // Type 333300 for 901, 911, 951, 961 in Ch9 (similar for Ch10) 
765   // actual numbering in the code to be changed in jan05
766   Int_t n13[4] = { 0, 0, 0, 4 };
767   slatsegB[5]->SetPcbBoards(n13);
768   slatsegB[5]->Init(0); // 0 detection element id
769   slatsegNB[5]->SetPcbBoards(n13);
770   slatsegNB[5]->Init(0); // 0 detection element id
771
772   for (Int_t chamber = 8; chamber < 10; chamber++) {
773
774     const AliMUONGeometryModuleTransformer* kModuleTransformer 
775       = fkTransformer->GetModuleTransformer(chamber);
776       
777     segmentation[0] = new AliMUONGeometrySegmentation(kModuleTransformer);
778     segmentation[1] = new AliMUONGeometrySegmentation(kModuleTransformer);
779
780     // id detection elt for chamber 1
781     Int_t id0 = (chamber+1)*100;
782
783     //--------------------------------------------------------
784     // Configuration for Chamber TC8/9  (Station 5) ----------           
785
786     // cathode 0
787     // type 122330
788     segmentation[0]->Add(id0+13, "Undefined", slatsegB[0]);
789     segmentation[0]->Add(id0   , "Undefined", slatsegB[0]);
790   
791     // type 112233
792     segmentation[0]->Add(id0+15, "Undefined", slatsegB[1]);
793     segmentation[0]->Add(id0+14, "Undefined", slatsegB[1]);
794     segmentation[0]->Add(id0+12, "Undefined", slatsegB[1]);  
795     segmentation[0]->Add(id0+11, "Undefined", slatsegB[1]);  
796     segmentation[0]->Add(id0+24, "Undefined", slatsegB[1]);  
797     segmentation[0]->Add(id0+25, "Undefined", slatsegB[1]);  
798     segmentation[0]->Add(id0+ 1, "Undefined", slatsegB[1]);
799     segmentation[0]->Add(id0+ 2, "Undefined", slatsegB[1]);
800
801     // type 333000 
802     segmentation[0]->Add(id0+19, "Undefined", slatsegB[2]);
803     segmentation[0]->Add(id0+ 7, "Undefined", slatsegB[2]);  
804     segmentation[0]->Add(id0+20, "Undefined", slatsegB[2]);
805     segmentation[0]->Add(id0+ 6, "Undefined", slatsegB[2]);
806  
807     // type 222333 
808     segmentation[0]->Add(id0+16, "Undefined", slatsegB[3]);
809     segmentation[0]->Add(id0+10, "Undefined", slatsegB[3]);  
810     segmentation[0]->Add(id0+23, "Undefined", slatsegB[3]);
811     segmentation[0]->Add(id0+ 3, "Undefined", slatsegB[3]);
812  
813     // type 223330 
814     segmentation[0]->Add(id0+17, "Undefined", slatsegB[4]);
815     segmentation[0]->Add(id0+ 9, "Undefined", slatsegB[4]);  
816     segmentation[0]->Add(id0+22, "Undefined", slatsegB[4]);
817     segmentation[0]->Add(id0+ 4, "Undefined", slatsegB[4]);
818   
819     // type 333300 
820     segmentation[0]->Add(id0+18, "Undefined", slatsegB[5]);
821     segmentation[0]->Add(id0+ 8, "Undefined", slatsegB[5]);  
822     segmentation[0]->Add(id0+21, "Undefined", slatsegB[5]);
823     segmentation[0]->Add(id0+ 5, "Undefined", slatsegB[5]);
824     Segmentation()->AddModuleSegmentation(chamber, 0, segmentation[0]);   
825
826     // cathode 1
827     // type 122330
828     segmentation[1]->Add(id0+13, "Undefined", slatsegNB[0]);
829     segmentation[1]->Add(id0   , "Undefined", slatsegNB[0]);
830   
831     // type 112233
832     segmentation[1]->Add(id0+15, "Undefined", slatsegNB[1]);
833     segmentation[1]->Add(id0+14, "Undefined", slatsegNB[1]);
834     segmentation[1]->Add(id0+12, "Undefined", slatsegNB[1]);  
835     segmentation[1]->Add(id0+11, "Undefined", slatsegNB[1]);  
836     segmentation[1]->Add(id0+24, "Undefined", slatsegNB[1]);  
837     segmentation[1]->Add(id0+25, "Undefined", slatsegNB[1]);  
838     segmentation[1]->Add(id0+ 1, "Undefined", slatsegNB[1]);
839     segmentation[1]->Add(id0+ 2, "Undefined", slatsegNB[1]);
840
841     // type 333000 
842     segmentation[1]->Add(id0+19 , "Undefined", slatsegNB[2]);
843     segmentation[1]->Add(id0+ 7, "Undefined", slatsegNB[2]);  
844     segmentation[1]->Add(id0+20, "Undefined", slatsegNB[2]);
845     segmentation[1]->Add(id0+ 6, "Undefined", slatsegNB[2]);
846  
847     // type 222333 
848     segmentation[1]->Add(id0+16, "Undefined", slatsegNB[3]);
849     segmentation[1]->Add(id0+10, "Undefined", slatsegNB[3]);  
850     segmentation[1]->Add(id0+23, "Undefined", slatsegNB[3]);
851     segmentation[1]->Add(id0+ 3, "Undefined", slatsegNB[3]);
852  
853     // type 223330 
854     segmentation[1]->Add(id0+17, "Undefined", slatsegNB[4]);
855     segmentation[1]->Add(id0+ 9, "Undefined", slatsegNB[4]);  
856     segmentation[1]->Add(id0+22, "Undefined", slatsegNB[4]);
857     segmentation[1]->Add(id0+ 4, "Undefined", slatsegNB[4]);
858   
859     // type 333300 
860     segmentation[1]->Add(id0+18, "Undefined", slatsegNB[5]);
861     segmentation[1]->Add(id0+ 8, "Undefined", slatsegNB[5]);  
862     segmentation[1]->Add(id0+21, "Undefined", slatsegNB[5]);
863     segmentation[1]->Add(id0+ 5, "Undefined", slatsegNB[5]);
864     Segmentation()->AddModuleSegmentation(chamber, 1, segmentation[1]);   
865   }
866 }
867
868 //__________________________________________________________________________
869 void AliMUONSegFactory::BuildStation6() 
870
871   //--------------------------------------------------------
872   // Configuration for Trigger stations
873   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
874
875  
876     AliMUONGeometrySegmentation *chamberSeg[2];
877
878     for (Int_t chamber = 10; chamber < 14; chamber++) {
879
880       //Trigger Segmentation
881       AliMUONTriggerSegmentation *trigSegX[9]; 
882       AliMUONTriggerSegmentation *trigSegY[9]; 
883       for(Int_t i=0; i<9; i++) {
884         trigSegX[i] = new AliMUONTriggerSegmentation(1);
885         trigSegY[i] = new AliMUONTriggerSegmentation(0);
886         Segmentation()->AddDESegmentation(trigSegX[i]);  
887         Segmentation()->AddDESegmentation(trigSegY[i]);  
888         trigSegX[i]->SetLineNumber(9-i);    
889         trigSegY[i]->SetLineNumber(9-i);    
890       }
891
892       //AliMUONChamber *iChamber, *iChamber1;
893       //iChamber1 = &fMUON->Chamber(10);
894       //iChamber  = &fMUON->Chamber(chamber);
895       //Float_t zpos1= iChamber1->Z();  
896       //Float_t zpos = iChamber->Z();        
897       Float_t zpos1= AliMUONConstants::DefaultChamberZ(10); 
898       Float_t zpos = AliMUONConstants::DefaultChamberZ(chamber);  
899       Float_t zRatio = zpos / zpos1;
900
901       // init
902       Float_t stripWidth[3]={0.,0.,0.};     // 1.0625 2.125 4.25
903       Float_t stripLength[4]={0.,0.,0.,0.}; // 17. 34. 51. 68.
904       for (Int_t i=0; i<3; i++) 
905         stripWidth[i]=AliMUONTriggerConstants::StripWidth(i)*zRatio;
906       for (Int_t i=0; i<4; i++) 
907         stripLength[i]=AliMUONTriggerConstants::StripLength(i)*zRatio;
908       Int_t nStrip[7]={0,0,0,0,0,0,0};    
909       Float_t stripYsize[7]={0.,0.,0.,0.,0.,0.,0.};
910       Float_t stripXsize[7]={0.,0.,0.,0.,0.,0.,0.};
911
912       // chamber 8 0 cathode 0
913       for (Int_t i=0; i<7; i++) nStrip[i]=16;
914       for (Int_t i=0; i<7; i++) stripYsize[i]=stripWidth[2];
915       for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1];
916       stripXsize[6]=stripLength[2];
917       trigSegX[8]->Init(0,nStrip,stripYsize,stripXsize,0.); 
918       trigSegX[0]->Init(0,nStrip,stripYsize,stripXsize,0.); 
919
920       // chamber 8 7 1 0 cathode 1
921       for (Int_t i=0; i<6; i++) nStrip[i]=8;
922       nStrip[6]=16;
923       for (Int_t i=0; i<7; i++) stripYsize[i]=stripLength[3];  
924       for (Int_t i=0; i<7; i++) stripXsize[i]=stripWidth[2];
925       trigSegY[8]->Init(0,nStrip,stripYsize,stripXsize,0.);  
926       trigSegY[7]->Init(0,nStrip,stripYsize,stripXsize,0.);
927       trigSegY[1]->Init(0,nStrip,stripYsize,stripXsize,0.);
928       trigSegY[0]->Init(0,nStrip,stripYsize,stripXsize,0.);
929  
930       // chamber 7 6 2 1 cathode 0
931       for (Int_t i=0; i<6; i++) nStrip[i]=32;
932       nStrip[6]=16;  
933       for (Int_t i=0; i<6; i++) stripYsize[i]=stripWidth[1];
934       stripYsize[6]=stripWidth[2];
935       for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1];
936       stripXsize[6]=stripLength[2];
937       trigSegX[7]->Init(0,nStrip,stripYsize,stripXsize,0.);  
938       trigSegX[6]->Init(0,nStrip,stripYsize,stripXsize,0.);
939       trigSegX[2]->Init(0,nStrip,stripYsize,stripXsize,0.);  
940       trigSegX[1]->Init(0,nStrip,stripYsize,stripXsize,0.);
941
942       // chamber 6 2 cathode 1
943       for (Int_t i=0; i<5; i++) nStrip[i]=16;
944       for (Int_t i=5; i<6; i++) nStrip[i]=8;
945       nStrip[6]=16;
946       for (Int_t i=0; i<7; i++) stripYsize[i]=stripLength[3];
947       for (Int_t i=0; i<5; i++) stripXsize[i]=stripWidth[1];
948       for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2];
949       trigSegY[6]->Init(0,nStrip,stripYsize,stripXsize,0.);  
950       trigSegY[2]->Init(0,nStrip,stripYsize,stripXsize,0.);  
951
952       // chamber 5 3 cathode 0
953       nStrip[0]=48;
954       for (Int_t i=1; i<3; i++) nStrip[i]=64;
955       for (Int_t i=3; i<6; i++) nStrip[i]=32;
956       nStrip[6]=16;  
957       for (Int_t i=0; i<3; i++) stripYsize[i]=stripWidth[0];
958       for (Int_t i=3; i<6; i++) stripYsize[i]=stripWidth[1];
959       stripYsize[6]=stripWidth[2];
960       for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1];
961       stripXsize[6]=stripLength[2];
962       trigSegX[5]->Init(0,nStrip,stripYsize,stripXsize,stripLength[0]);  
963       trigSegX[3]->Init(0,nStrip,stripYsize,stripXsize,0.);
964
965       // chamber 5 3 cathode 1
966       for (Int_t i=0; i<5; i++) nStrip[i]=16;
967       for (Int_t i=5; i<6; i++) nStrip[5]=8;  
968       nStrip[6]=16;  
969       stripYsize[0]=stripLength[2];
970       for (Int_t i=1; i<7; i++) stripYsize[i]=stripLength[3];
971       for (Int_t i=0; i<5; i++) stripXsize[i]=stripWidth[1];
972       for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2];
973       trigSegY[5]->Init(0,nStrip,stripYsize,stripXsize,stripLength[0]);  
974       trigSegY[3]->Init(0,nStrip,stripYsize,stripXsize,0.);
975
976       // chamber 4 cathode 0
977       nStrip[0]=0;
978       for (Int_t i=1; i<3; i++) nStrip[i]=64;  
979       for (Int_t i=3; i<6; i++) nStrip[i]=32;  
980       nStrip[6]=16;
981       stripYsize[0]=0.;
982       for (Int_t i=1; i<3; i++) stripYsize[i]=stripWidth[0];
983       for (Int_t i=3; i<6; i++) stripYsize[i]=stripWidth[1];
984       stripYsize[6]=stripWidth[2];
985       stripXsize[0]=0;  
986       stripXsize[1]=stripLength[0];  
987       for (Int_t i=2; i<6; i++) stripXsize[i]=stripLength[1];
988       stripXsize[6]=stripLength[2];
989       trigSegX[4]->Init(0,nStrip,stripYsize,stripXsize,0.);  
990
991       // chamber 4 cathode 1
992       nStrip[0]=0;  
993       nStrip[1]=8;  
994       for (Int_t i=2; i<5; i++) nStrip[i]=16;
995       for (Int_t i=5; i<6; i++) nStrip[i]=8;
996       nStrip[6]=16;
997       stripYsize[0]=0.;  
998       for (Int_t i=1; i<7; i++) stripYsize[i]=stripLength[3];
999       stripXsize[0]=0.;
1000       for (Int_t i=1; i<5; i++) stripXsize[i]=stripWidth[1];
1001       for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2];
1002       trigSegY[4]->Init(0,nStrip,stripYsize,stripXsize,0.);
1003
1004       const AliMUONGeometryModuleTransformer* kModuleTransformer 
1005         = fkTransformer->GetModuleTransformer(chamber);
1006       
1007       chamberSeg[0] = new AliMUONGeometrySegmentation(kModuleTransformer);
1008       chamberSeg[1] = new AliMUONGeometrySegmentation(kModuleTransformer);
1009
1010       Int_t icount=chamber-10;  // chamber counter (0 1 2 3)
1011       Int_t id0=(10+icount+1)*100;
1012
1013
1014       //  printf("in CreateTriggerSegmentation here 0 id0=%i \n",id0);  
1015       chamberSeg[0]->Add(id0+0,  "Undefined", trigSegX[4]);
1016       chamberSeg[0]->Add(id0+1,  "Undefined", trigSegX[5]);
1017       chamberSeg[0]->Add(id0+2,  "Undefined", trigSegX[6]);
1018       chamberSeg[0]->Add(id0+3,  "Undefined", trigSegX[7]);
1019       chamberSeg[0]->Add(id0+4,  "Undefined", trigSegX[8]);
1020       chamberSeg[0]->Add(id0+5,  "Undefined", trigSegX[8]);
1021       chamberSeg[0]->Add(id0+6,  "Undefined", trigSegX[7]);
1022       chamberSeg[0]->Add(id0+7,  "Undefined", trigSegX[6]);
1023       chamberSeg[0]->Add(id0+8,  "Undefined", trigSegX[5]);
1024       chamberSeg[0]->Add(id0+9,  "Undefined", trigSegX[4]);
1025       chamberSeg[0]->Add(id0+10, "Undefined", trigSegX[3]);
1026       chamberSeg[0]->Add(id0+11, "Undefined", trigSegX[2]);
1027       chamberSeg[0]->Add(id0+12, "Undefined", trigSegX[1]);
1028       chamberSeg[0]->Add(id0+13, "Undefined", trigSegX[0]);
1029       chamberSeg[0]->Add(id0+14, "Undefined", trigSegX[0]);
1030       chamberSeg[0]->Add(id0+15, "Undefined", trigSegX[1]);
1031       chamberSeg[0]->Add(id0+16, "Undefined", trigSegX[2]);
1032       chamberSeg[0]->Add(id0+17, "Undefined", trigSegX[3]);
1033
1034       chamberSeg[1]->Add(id0+0,  "Undefined", trigSegY[4]);
1035       chamberSeg[1]->Add(id0+1,  "Undefined", trigSegY[5]);
1036       chamberSeg[1]->Add(id0+2,  "Undefined", trigSegY[6]);
1037       chamberSeg[1]->Add(id0+3,  "Undefined", trigSegY[7]);
1038       chamberSeg[1]->Add(id0+4,  "Undefined", trigSegY[8]);
1039       chamberSeg[1]->Add(id0+5,  "Undefined", trigSegY[8]);
1040       chamberSeg[1]->Add(id0+6,  "Undefined", trigSegY[7]);
1041       chamberSeg[1]->Add(id0+7,  "Undefined", trigSegY[6]);
1042       chamberSeg[1]->Add(id0+8,  "Undefined", trigSegY[5]);
1043       chamberSeg[1]->Add(id0+9,  "Undefined", trigSegY[4]);
1044       chamberSeg[1]->Add(id0+10, "Undefined", trigSegY[3]);
1045       chamberSeg[1]->Add(id0+11, "Undefined", trigSegY[2]);
1046       chamberSeg[1]->Add(id0+12, "Undefined", trigSegY[1]);
1047       chamberSeg[1]->Add(id0+13, "Undefined", trigSegY[0]);
1048       chamberSeg[1]->Add(id0+14, "Undefined", trigSegY[0]);
1049       chamberSeg[1]->Add(id0+15, "Undefined", trigSegY[1]);
1050       chamberSeg[1]->Add(id0+16, "Undefined", trigSegY[2]);
1051       chamberSeg[1]->Add(id0+17, "Undefined", trigSegY[3]);
1052
1053       Segmentation()->AddModuleSegmentation(chamber, 0, chamberSeg[0]);
1054       Segmentation()->AddModuleSegmentation(chamber, 1, chamberSeg[1]);
1055   
1056       //  printf("in CreateTriggerSegmentation here 1\n");  
1057       if (!id0) {
1058         AliWarning(Form("Segmentation for chamber %d is not yet defined",chamber));
1059         return ;      
1060       }
1061     }
1062 }
1063