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