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