remove AliMUONTriggerConstants (Philippe)
[u/mrichter/AliRoot.git] / MUON / AliMUONResponseFactory.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 // Class AliMUONResponseFactory
18 // -----------------------------
19 // Factory for muon response
20 // Class separated from AliMUONFactoryV4
21
22 /* $Id$ */
23
24 #include "AliMUONResponseFactory.h"
25 #include "AliRun.h"
26 #include "AliLog.h"
27
28 #include "AliMpPlaneType.h"
29
30 #include "AliMUON.h"
31 #include "AliMUONConstants.h"
32 #include "AliMUONChamber.h"
33 #include "AliMUONResponseV0.h"
34 #include "AliMUONResponseTrigger.h"
35 #include "AliMUONResponseTriggerV1.h"
36
37 ClassImp(AliMUONResponseFactory)
38
39 //__________________________________________________________________________
40   AliMUONResponseFactory::AliMUONResponseFactory(const char* name)
41     : TNamed(name, ""),
42       fMUON(0),
43       fResponse0(0)
44 {
45 /// Standard constructor
46   
47   AliDebug(1,Form("ctor this=%p",this));
48 }
49
50 //__________________________________________________________________________
51   AliMUONResponseFactory::AliMUONResponseFactory()
52     : TNamed(),
53       fMUON(0),
54       fResponse0(0)
55 {
56 /// Default constructor
57
58   AliDebug(1,Form("default (empty) ctor this=%p",this));
59 }
60
61 //__________________________________________________________________________
62
63 AliMUONResponseFactory::~AliMUONResponseFactory()
64 {
65 /// Destructor
66         AliDebug(1,Form("dtor this=%p",this));
67 }
68           
69 //__________________________________________________________________________
70 void AliMUONResponseFactory::BuildCommon() 
71 {
72 /// Construct the default response.
73
74   // Default response: 5 mm of gas
75   fResponse0 = new AliMUONResponseV0;
76   fResponse0->SetSqrtKx3AndDeriveKx2Kx4(0.7131); // sqrt(0.5085)
77   fResponse0->SetSqrtKy3AndDeriveKy2Ky4(0.7642); // sqrt(0.5840)
78   fResponse0->SetPitch(AliMUONConstants::Pitch()); // anode-cathode distance
79   fResponse0->SetSigmaIntegration(10.);
80   fResponse0->SetChargeSlope(10);
81   fResponse0->SetChargeSpread(0.18, 0.18);
82   fResponse0->SetMaxAdc(4096);
83   fResponse0->SetSaturation(3000);
84   fResponse0->SetZeroSuppression(6);
85 }       
86         
87 //__________________________________________________________________________
88 void AliMUONResponseFactory::BuildStation1() 
89 {
90 /// Configuration for Chamber TC1/2  (Station 1) ----------           
91
92   // Response for 4 mm of gas (station 1)
93   // automatic consistency with width of sensitive medium in CreateGeometry ????
94   AliMUONResponseV0* responseSt1 = new AliMUONResponseV0;
95   // Mathieson parameters from L.Kharmandarian's thesis, page 190
96   responseSt1->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900)
97   responseSt1->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700)
98   responseSt1->SetPitch(AliMUONConstants::PitchSt1()); // anode-cathode distance
99   responseSt1->SetSigmaIntegration(10.);
100   // ChargeSlope larger to compensate for the smaller anode-cathode distance
101   // and keep the same most probable ADC channel for mip's
102   responseSt1->SetChargeSlope(62.5); 
103   // assumed proportionality to anode-cathode distance for ChargeSpread
104   responseSt1->SetChargeSpread(0.144, 0.144);
105   responseSt1->SetMaxAdc(4096);
106   responseSt1->SetSaturation(3000);
107   responseSt1->SetZeroSuppression(6);
108
109    for (Int_t chamber = 0; chamber < 2; chamber++) {
110     fMUON->SetResponseModel(chamber, responseSt1); // special response      
111     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
112   }
113 }
114
115 //__________________________________________________________________________
116 void AliMUONResponseFactory::BuildStation2() 
117 {
118 /// Configuration for Chamber TC3/4 (Station 2) -----------
119
120   for (Int_t chamber = 2; chamber < 4; chamber++) {
121     fMUON->SetResponseModel(chamber, fResponse0); // normal response        
122     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
123   }
124 }       
125         
126 //__________________________________________________________________________
127 void AliMUONResponseFactory::BuildStation3() 
128 {
129 /// Configuration for Chamber TC5/6  (Station 3) ----------          
130
131   for (Int_t chamber = 4; chamber < 6; chamber++) {
132     fMUON->SetResponseModel(chamber, fResponse0); // normal response        
133     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
134   }
135 }       
136         
137 //__________________________________________________________________________
138 void AliMUONResponseFactory::BuildStation4() 
139 {
140 /// Configuration for Chamber TC7/8  (Station 4) ----------          
141
142   for (Int_t chamber = 6; chamber < 8; chamber++) {
143     fMUON->SetResponseModel(chamber, fResponse0); // normal response        
144     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
145   }
146 }       
147         
148 //__________________________________________________________________________
149 void AliMUONResponseFactory::BuildStation5() 
150 {
151 /// Configuration for Chamber TC9/10  (Station 5) ---------           
152
153   for (Int_t chamber = 8; chamber < 10; chamber++) {
154     fMUON->SetResponseModel(chamber, fResponse0); // normal response        
155     fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread
156   }
157 }       
158         
159 //__________________________________________________________________________
160 void AliMUONResponseFactory::BuildStation6() 
161 {
162 /// Configuration for Trigger Chambers   (Station 6,7) ---------           
163
164     Bool_t resTrigV1 = fMUON->GetTriggerResponseV1();    
165
166     for (Int_t chamber = 10; chamber < 14; chamber++) {
167         
168         if (!resTrigV1) 
169             fMUON->SetResponseModel(chamber, new AliMUONResponseTrigger);
170         else 
171             fMUON->SetResponseModel(chamber, new AliMUONResponseTriggerV1);
172         
173         fMUON->Chamber(chamber).SetChargeCorrel(0); // same charge on both cathodes
174   }
175 }       
176
177 //__________________________________________________________________________
178 void AliMUONResponseFactory::Build(AliMUON* where) 
179 {
180 /// Construct MUON responses
181
182   fMUON = where;
183
184   // Set default parameters
185   fMUON->SetIshunt(0);
186   fMUON->SetMaxStepGas(0.1);
187   fMUON->SetMaxStepAlu(0.1);
188
189   // Build stations
190   BuildCommon();
191   BuildStation1();
192   BuildStation2();
193   BuildStation3();
194   BuildStation4();
195   BuildStation5();
196   BuildStation6();
197 }
198
199 //__________________________________________________________________________
200 void AliMUONResponseFactory::BuildStation(AliMUON* where, Int_t stationNumber) 
201 {
202 /// Construct MUON responses for given station
203
204   fMUON = where;
205   if (!fResponse0) BuildCommon(); 
206     
207   switch (stationNumber) {    
208     case 1:  BuildStation1(); break;
209     case 2:  BuildStation2(); break;
210     case 3:  BuildStation3(); break;
211     case 4:  BuildStation4(); break;
212     case 5:  BuildStation5(); break;
213     case 6:  BuildStation6(); break;
214     
215     default: AliFatal("Wrong station number");
216   }  
217 }