Dependency on implementations of AliSegmentation and AliMUONResponse moved to AliMUON...
[u/mrichter/AliRoot.git] / MUON / AliMUONFactory.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 /*
21 $Log$
22 */
23 #include "AliMUONFactory.h"
24 #include "AliMUON.h"
25 #include "AliMUONChamber.h"
26 #include "AliMUONResponseV0.h"
27 #include "AliMUONResponseTrigger.h"
28 #include "AliMUONSegmentationV0.h"
29 #include "AliMUONSegmentationV01.h"
30 #include "AliMUONSegmentationV02.h"
31 #include "AliMUONSegmentationV04.h"
32 #include "AliMUONSegmentationV05.h"
33 #include "AliMUONSegmentationSlat.h"
34 #include "AliMUONSegmentationSlatN.h"
35 #include "AliMUONSegmentationTrigger.h"
36 #include "AliMUONSegmentationTriggerX.h"
37 #include "AliMUONSegmentationTriggerY.h"
38
39 ClassImp(AliMUONFactory)
40
41     
42 void AliMUONFactory::Build(AliMUON* where, const char* what) 
43 {
44 //
45 // Construct MUON from chambers, segmentation and responses
46 //
47     char tmp[20];
48     AliMUON* pMUON = where;
49     strcpy(tmp, what);
50
51     if (strcmp(tmp, "default")==0) {
52
53         printf("\n--------AliMUONFactory------------------------------");
54         printf("\n Non default version of MUON selected               ");
55         printf("\n You have to construct yourself the MUON elements !!");       
56         printf("\n----------------------------------------------------");
57
58         pMUON->SetIshunt(0);
59         pMUON->SetMaxStepGas(0.1);
60         pMUON->SetMaxStepAlu(0.1);
61 //
62 // Version 0
63 //
64 // First define the number of planes that are segmented (1 or 2) by a call
65 // to SetNsec. 
66 // Then chose for each chamber (chamber plane) the segmentation 
67 // and response model.
68 // They should be equal for the two chambers of each station. In a future
69 // version this will be enforced.
70 //
71 //  
72         Int_t chamber;
73         // Default response: 5 mm of gas
74         AliMUONResponseV0* response0 = new AliMUONResponseV0;
75         response0->SetSqrtKx3AndDeriveKx2Kx4(0.7131); // sqrt(0.5085)
76         response0->SetSqrtKy3AndDeriveKy2Ky4(0.7642); // sqrt(0.5840)
77         response0->SetPitch(0.25); // anode-cathode distance
78         response0->SetSigmaIntegration(10.);
79         response0->SetChargeSlope(50);
80         response0->SetChargeSpread(0.18, 0.18);
81         response0->SetMaxAdc(4096);
82         response0->SetZeroSuppression(6);
83         
84         // Response for 4 mm of gas (station 1)
85         // automatic consistency with width of sensitive medium in CreateGeometry ????
86         AliMUONResponseV0* responseSt1 = new AliMUONResponseV0;
87         // Mathieson parameters from L.Kharmandarian's thesis, page 190
88         responseSt1->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900)
89         responseSt1->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700)
90         responseSt1->SetPitch(0.20); // anode-cathode distance
91         responseSt1->SetSigmaIntegration(10.);
92         // ChargeSlope larger to compensate for the smaller anode-cathode distance
93         // and keep the same most probable ADC channel for mip's
94         responseSt1->SetChargeSlope(62.5); 
95         // assumed proportionality to anode-cathode distance for ChargeSpread
96         responseSt1->SetChargeSpread(0.144, 0.144);
97         responseSt1->SetMaxAdc(4096);
98         responseSt1->SetZeroSuppression(6);
99         
100 //--------------------------------------------------------
101 // Configuration for Chamber TC1/2  (Station 1) ----------           
102 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103         Float_t rseg1[4]={17.5, 55.2, 71.3, 95.5};
104         Int_t   nseg1[4]={4, 4, 2, 1};
105 //
106         chamber=1;
107 //      ^^^^^^^^^
108         pMUON->SetNsec(chamber-1,2);
109 //
110         AliMUONSegmentationV01 *seg11=new AliMUONSegmentationV01(4);
111         
112         seg11->SetSegRadii(rseg1);
113         seg11->SetPadSize(2.4, 0.4); // smaller pad size
114         seg11->SetDAnod(0.20); // smaller distance between anode wires
115         seg11->SetPadDivision(nseg1);
116         
117         pMUON->SetSegmentationModel(chamber-1, 1, seg11);
118         
119         AliMUONSegmentationV02 *seg12=new AliMUONSegmentationV02(4);
120         seg12->SetSegRadii(rseg1); 
121         seg12->SetPadSize(0.6, 1.6); // smaller pad size
122         seg12->SetDAnod(0.20); // smaller distance between anode wires
123         seg12->SetPadDivision(nseg1);
124         
125         pMUON->SetSegmentationModel(chamber-1, 2, seg12);
126         
127         pMUON->SetResponseModel(chamber-1, responseSt1); // special response        
128         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
129         
130         chamber=2;
131 //      ^^^^^^^^^
132 //
133         pMUON->SetNsec(chamber-1,2);
134 //
135         AliMUONSegmentationV01 *seg21=new AliMUONSegmentationV01(4);
136         seg21->SetSegRadii(rseg1);
137         seg21->SetPadSize(2.4, 0.4); // smaller pad size
138         seg21->SetDAnod(0.20); // smaller distance between anode wires
139         seg21->SetPadDivision(nseg1);
140         pMUON->SetSegmentationModel(chamber-1, 1, seg21);
141 //
142         AliMUONSegmentationV02 *seg22=new AliMUONSegmentationV02(4);
143         seg22->SetSegRadii(rseg1); 
144         seg22->SetPadSize(0.6, 1.6); // smaller pad size
145         seg22->SetDAnod(0.20); // smaller distance between anode wires
146         seg22->SetPadDivision(nseg1);
147         pMUON->SetSegmentationModel(chamber-1, 2, seg22);
148         
149         pMUON->SetResponseModel(chamber-1, responseSt1); // special response
150         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
151         
152 //
153 //--------------------------------------------------------
154 // Configuration for Chamber TC3/4 (Station 2) -----------
155 ///^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156 // Float_t rseg2[4]={23.5, 87.7, 122.4, 122.5};
157         Float_t rseg2[4]={23.5, 47.1, 87.7, 122.5};
158         Int_t   nseg2[4]={4, 4, 2, 1};
159 //
160         chamber=3;
161 //      ^^^^^^^^^
162         pMUON->SetNsec(chamber-1,2);
163 //
164         AliMUONSegmentationV01 *seg31=new AliMUONSegmentationV01(4);
165         seg31->SetSegRadii(rseg2);
166         seg31->SetPadSize(3.0, 0.5);
167         seg31->SetDAnod(3.0/3./4);
168         seg31->SetPadDivision(nseg2);
169         pMUON->SetSegmentationModel(chamber-1, 1, seg31);
170 //
171         AliMUONSegmentationV02 *seg32=new AliMUONSegmentationV02(4);
172         seg32->SetSegRadii(rseg2); 
173         seg32->SetPadSize(0.75, 2.0);
174         seg32->SetPadDivision(nseg2);
175         seg32->SetDAnod(3.0/3./4);
176         
177         pMUON->SetSegmentationModel(chamber-1, 2, seg32);
178         
179         pMUON->SetResponseModel(chamber-1, response0);      
180         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
181         
182         chamber=4;
183 //      ^^^^^^^^^
184 //
185         pMUON->SetNsec(chamber-1,2);
186 //
187         AliMUONSegmentationV01 *seg41=new AliMUONSegmentationV01(4);
188         seg41->SetSegRadii(rseg2);
189         seg41->SetPadSize(3.0, 0.5);
190         seg41->SetDAnod(3.0/3./4);
191         seg41->SetPadDivision(nseg2);
192         pMUON->SetSegmentationModel(chamber-1, 1, seg41);
193 //
194         AliMUONSegmentationV02 *seg42=new AliMUONSegmentationV02(4);
195         seg42->SetSegRadii(rseg2); 
196         seg42->SetPadSize(0.75, 2.0);
197         seg42->SetPadDivision(nseg2);
198         seg42->SetDAnod(3.0/3./4);
199         
200         pMUON->SetSegmentationModel(chamber-1, 2, seg42);
201         
202         pMUON->SetResponseModel(chamber-1, response0);      
203         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
204         
205         
206 //--------------------------------------------------------
207 // Configuration for Chamber TC5/6  (Station 3) ----------          
208 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209         Int_t   nseg3[4]={4, 4, 2, 1};
210         Int_t   npcb5[36] = {0,0,2,0,
211                              0,0,3,0,
212                              0,1,3,0,
213                              0,2,2,0,
214                              0,1,2,0, 
215                              0,2,2,0, 
216                              0,1,3,0, 
217                              0,0,3,0,
218                              0,0,2,0};
219         
220         Float_t shift = 1.5/2.;
221         Float_t xpos5[9]    = {2., 2., 2., 2.,33., 2., 2., 2., 2.};
222         Float_t ypos5       = -(20.+4.*(40.-2.*shift));
223         
224         chamber=5;
225         pMUON->SetNsec(chamber-1,2);
226         AliMUONSegmentationSlat *seg51=new AliMUONSegmentationSlat(4);
227         seg51->SetNSlats(9); 
228         seg51->SetShift(shift);  
229         seg51->SetNPCBperSector(npcb5); 
230         seg51->SetSlatXPositions(xpos5);
231         seg51->SetSlatYPosition(ypos5);
232         seg51->SetPadSize(10.,0.5);
233         seg51->SetDAnod(0.25);
234         seg51->SetPadDivision(nseg3);
235         pMUON->SetSegmentationModel(chamber-1, 1, seg51);
236         
237         AliMUONSegmentationSlatN *seg52=new AliMUONSegmentationSlatN(4);
238         seg52->SetNSlats(9); 
239         seg52->SetShift(shift);  
240         seg52->SetNPCBperSector(npcb5); 
241         seg52->SetSlatXPositions(xpos5);
242         seg52->SetSlatYPosition(ypos5);
243         seg52->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
244         seg52->SetDAnod(0.25);
245         seg52->SetPadDivision(nseg3);
246         pMUON->SetSegmentationModel(chamber-1, 2, seg52);
247         pMUON->SetResponseModel(chamber-1, response0);      
248         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
249         
250         chamber=6;
251         pMUON->SetNsec(chamber-1,2);
252         AliMUONSegmentationSlat *seg61=new AliMUONSegmentationSlat(4);
253         seg61->SetNSlats(9); 
254         seg61->SetShift(shift);  
255         seg61->SetNPCBperSector(npcb5); 
256         seg61->SetSlatXPositions(xpos5);
257         seg61->SetSlatYPosition(ypos5);
258         seg61->SetPadSize(10.,0.5);
259         seg61->SetDAnod(0.25);
260         seg61->SetPadDivision(nseg3);
261         pMUON->SetSegmentationModel(chamber-1, 1, seg61);
262         
263         AliMUONSegmentationSlatN *seg62=new AliMUONSegmentationSlatN(4);
264         seg62->SetNSlats(9); 
265         seg62->SetShift(shift);  
266         seg62->SetNPCBperSector(npcb5); 
267         seg62->SetSlatXPositions(xpos5);
268         seg62->SetSlatYPosition(ypos5);
269         seg62->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
270         seg62->SetDAnod(0.25);
271         seg62->SetPadDivision(nseg3);
272         pMUON->SetSegmentationModel(chamber-1, 2, seg62);
273         pMUON->SetResponseModel(chamber-1, response0);      
274         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
275         
276 //--------------------------------------------------------
277 // Configuration for Chamber TC7/8  (Station 4) ----------           
278 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
279
280         Int_t   nseg4[4]={4, 4, 2, 1};
281         
282         chamber=7;
283 //      ^^^^^^^^^
284         
285         pMUON->SetNsec(chamber-1,2);
286 //
287         AliMUONSegmentationSlat *seg71=new AliMUONSegmentationSlat(4);
288         Int_t npcb7[44] = {0,0,0,3,
289                            0,0,2,2,
290                            0,0,3,2,
291                            0,2,2,1,
292                            0,2,2,1,
293                            0,1,2,1, 
294                            0,2,2,1, 
295                            0,2,2,1, 
296                            0,0,3,2, 
297                            0,0,2,2, 
298                            0,0,0,3};
299         Float_t xpos7[11]   = {2., 2., 2., 2., 2., 40.5, 2., 2., 2., 2., 2.};
300         Float_t ypos7       = -(20.+5.*(40.-2.*shift));
301         
302         seg71->SetNSlats(11);  
303         seg71->SetShift(shift);  
304         seg71->SetNPCBperSector(npcb7); 
305         seg71->SetSlatXPositions(xpos7);
306         seg71->SetSlatYPosition(ypos7);
307         
308         seg71->SetPadSize(10.,0.5);
309         seg71->SetDAnod(0.25);
310         seg71->SetPadDivision(nseg4);
311         pMUON->SetSegmentationModel(chamber-1, 1, seg71);
312         
313         AliMUONSegmentationSlatN *seg72=new AliMUONSegmentationSlatN(4);
314         
315         pMUON->SetSegmentationModel(chamber-1, 2, seg72);
316         seg72->SetNSlats(11);  
317         seg72->SetShift(shift);   
318         seg72->SetNPCBperSector(npcb7); 
319         seg72->SetSlatXPositions(xpos7);
320         seg72->SetSlatYPosition(ypos7);
321         seg72->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
322         seg72->SetDAnod(0.25);
323         seg72->SetPadDivision(nseg4);
324         
325         pMUON->SetResponseModel(chamber-1, response0);      
326         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
327         
328         chamber=8;
329 //      ^^^^^^^^^
330         pMUON->SetNsec(chamber-1,2);
331 //
332         AliMUONSegmentationSlat *seg81=new AliMUONSegmentationSlat(4);
333         
334         seg81->SetNSlats(11);  
335         seg81->SetShift(shift);  
336         seg81->SetNPCBperSector(npcb7); 
337         seg81->SetSlatXPositions(xpos7);
338         seg81->SetSlatYPosition(ypos7);
339         seg81->SetPadSize(10.,0.5);
340         seg81->SetDAnod(0.25);
341         seg81->SetPadDivision(nseg4);
342         pMUON->SetSegmentationModel(chamber-1, 1, seg81);
343         
344         AliMUONSegmentationSlat *seg82=new AliMUONSegmentationSlatN(4);
345         
346         pMUON->SetSegmentationModel(chamber-1, 2, seg82);
347         seg82->SetNSlats(11);  
348         seg82->SetShift(shift);  
349         seg82->SetNPCBperSector(npcb7); 
350         seg82->SetSlatXPositions(xpos7);
351         seg82->SetSlatYPosition(ypos7);
352         seg82->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
353         seg82->SetDAnod(0.25);
354         seg82->SetPadDivision(nseg4);
355         
356         pMUON->SetResponseModel(chamber-1, response0);      
357         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
358         
359
360 //--------------------------------------------------------
361 // Configuration for Chamber TC9/10  (Station 5) ---------           
362 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
363         chamber=9;
364 //      ^^^^^^^^^
365
366         pMUON->SetNsec(chamber-1,2);
367 //
368         AliMUONSegmentationSlat *seg91=new AliMUONSegmentationSlat(4);
369         Int_t   npcb9[52] = {0,0,0,3,
370                              0,0,0,4,
371                              0,0,2,3,
372                              0,0,3,3,
373                              0,2,2,2,
374                              0,2,2,2,
375                              0,1,2,2, 
376                              0,2,2,2, 
377                              0,2,2,2, 
378                              0,0,3,3, 
379                              0,0,2,3, 
380                              0,0,0,4, 
381                              0,0,0,3};   
382         
383         Float_t xpos9[13]   = {2., 2., 2., 2., 2., 2., 40.5, 2., 2., 2., 2., 2., 2.};
384         Float_t ypos9       = -(20.+6.*(40.-2.*shift));
385         
386         seg91->SetNSlats(13);  
387         seg91->SetShift(shift);  
388         seg91->SetNPCBperSector(npcb9); 
389         seg91->SetSlatXPositions(xpos9);
390         seg91->SetSlatYPosition(ypos9);
391         seg91->SetPadSize(10.,0.5);
392         seg91->SetDAnod(0.25);
393         seg91->SetPadDivision(nseg4);
394         pMUON->SetSegmentationModel(chamber-1, 1, seg91);
395         
396         AliMUONSegmentationSlatN *seg92=new AliMUONSegmentationSlatN(4);
397         
398         pMUON->SetSegmentationModel(chamber-1, 2, seg92);
399         seg92->SetNSlats(13);  
400         seg92->SetShift(shift);   
401         seg92->SetNPCBperSector(npcb9); 
402         seg92->SetSlatXPositions(xpos9);
403         seg92->SetSlatYPosition(ypos9);
404         seg92->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
405         seg92->SetDAnod(0.25);
406         seg92->SetPadDivision(nseg4);
407         
408         pMUON->SetResponseModel(chamber-1, response0);      
409         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
410         
411         chamber=10;
412 //      ^^^^^^^^^
413         pMUON->SetNsec(chamber-1,2);
414 //
415         AliMUONSegmentationSlat *seg101=new AliMUONSegmentationSlat(4);
416         
417         seg101->SetNSlats(13);  
418         seg101->SetShift(shift);  
419         seg101->SetNPCBperSector(npcb9); 
420         seg101->SetSlatXPositions(xpos9);
421         seg101->SetSlatYPosition(ypos9);
422         seg101->SetPadSize(10.,0.5);
423         seg101->SetDAnod(0.25);
424         seg101->SetPadDivision(nseg4);
425         pMUON->SetSegmentationModel(chamber-1, 1, seg101);
426         
427         AliMUONSegmentationSlatN *seg102=new AliMUONSegmentationSlatN(4);
428         
429         pMUON->SetSegmentationModel(chamber-1, 2, seg102);
430         seg102->SetNSlats(13);  
431         seg102->SetShift(shift);   
432         seg102->SetNPCBperSector(npcb9); 
433         seg102->SetSlatXPositions(xpos9);
434         seg102->SetSlatYPosition(ypos9);
435         seg102->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
436         seg102->SetDAnod(0.25);
437         seg102->SetPadDivision(nseg4);
438         
439         pMUON->SetResponseModel(chamber-1, response0);      
440         pMUON->Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
441
442 //--------------------------------------------------------
443 // Configuration for Trigger Stations -------------------- 
444 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
445 // Cluster-size off
446         AliMUONResponseTrigger* responseTrigger0 =  new AliMUONResponseTrigger;
447 // Cluster-size on  
448 // AliMUONResponseTriggerV1* responseTrigger0 =  new AliMUONResponseTriggerV1;
449  
450         chamber=11;
451         pMUON->SetNsec(chamber-1,2);
452         AliMUONSegmentationTriggerX *seg111=new AliMUONSegmentationTriggerX;
453         pMUON->SetSegmentationModel(chamber-1, 1, seg111);
454         AliMUONSegmentationTriggerY *seg112=new AliMUONSegmentationTriggerY;
455         pMUON->SetSegmentationModel(chamber-1, 2, seg112);
456         
457         pMUON->SetResponseModel(chamber-1, responseTrigger0);      
458         pMUON->Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
459         
460  
461         chamber=12;
462         pMUON->SetNsec(chamber-1,2);
463         AliMUONSegmentationTriggerX *seg121=new AliMUONSegmentationTriggerX;
464         pMUON->SetSegmentationModel(chamber-1, 1, seg121);
465         AliMUONSegmentationTriggerY *seg122=new AliMUONSegmentationTriggerY;
466         pMUON->SetSegmentationModel(chamber-1, 2, seg122);
467         
468         pMUON->SetResponseModel(chamber-1, responseTrigger0);
469         pMUON->Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
470         
471         chamber=13;
472         pMUON->SetNsec(chamber-1,2);
473         AliMUONSegmentationTriggerX *seg131=new AliMUONSegmentationTriggerX;
474         pMUON->SetSegmentationModel(chamber-1, 1, seg131);
475         AliMUONSegmentationTriggerY *seg132=new AliMUONSegmentationTriggerY;
476         pMUON->SetSegmentationModel(chamber-1, 2, seg132);
477         pMUON->SetResponseModel(chamber-1, responseTrigger0);      
478         pMUON->Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
479         
480         chamber=14;
481         pMUON->SetNsec(chamber-1,2);
482         AliMUONSegmentationTriggerX *seg141=new AliMUONSegmentationTriggerX;
483         pMUON->SetSegmentationModel(chamber-1, 1, seg141);
484         AliMUONSegmentationTriggerY *seg142=new AliMUONSegmentationTriggerY;
485         pMUON->SetSegmentationModel(chamber-1, 2, seg142);
486         
487         pMUON->SetResponseModel(chamber-1, responseTrigger0); 
488         pMUON->Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
489     } else {
490         printf("\n--------AliMUONFactory------------------------------");
491         printf("\n Non default version of MUON selected               ");
492         printf("\n You have to construct yourself the MUON elements !!");       
493         printf("\n----------------------------------------------------");
494     }
495 }
496