Changes needed to work with Root 3.01 (substitute lhs [] operator). (Jiri Chudoba)
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.cxx
... / ...
CommitLineData
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$Log$
17Revision 1.10 2001/03/20 13:17:30 egangler
18fChargeCorrel moved from AliMUONChamber to AliMUONResponse as decided by
19January meeting.
20Setters and Getters are modified accordingly.
21This modification is transparent to the user code
22
23Revision 1.9 2001/01/26 21:35:54 morsch
24All pointers set to 0 in default constructor.
25
26Revision 1.8 2001/01/17 20:53:40 hristov
27Destructors corrected to avoid memory leaks
28
29Revision 1.7 2000/12/20 13:00:22 egangler
30
31Added charge correlation between cathods.
32In Config_slat.C, use
33 MUON->Chamber(chamber-1).SetChargeCorrel(0.11); to set the RMS of
34 q1/q2 to 11 % (number from Alberto)
35 This is stored in AliMUONChamber fChargeCorrel member.
36 At generation time, when a tracks enters the volume,
37 AliMUONv1::StepManager calls
38 AliMUONChamber::ChargeCorrelationInit() to set the current value of
39 fCurrentCorrel which is then used at Disintegration level to scale
40 appropriately the PadHit charges.
41
42Revision 1.6 2000/10/09 14:01:12 morsch
43Double inclusion of AliResponse removed.
44
45Revision 1.5 2000/07/03 11:54:57 morsch
46AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
47The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
48
49Revision 1.4 2000/06/29 12:34:09 morsch
50AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
51it usable with any other geometry class. The link to the object to which it belongs is
52established via an index. This assumes that there exists a global geometry manager
53from which the pointer to the parent object can be obtained (in our case gAlice).
54
55Revision 1.3 2000/06/28 15:16:35 morsch
56(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
57to allow development of slat-muon chamber simulation and reconstruction code in the MUON
58framework. The changes should have no side effects (mostly dummy arguments).
59(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
60of chambers with overlapping modules (MakePadHits, Disintegration).
61
62Revision 1.2 2000/06/15 07:58:48 morsch
63Code from MUON-dev joined
64
65Revision 1.1.2.5 2000/06/09 21:27:01 morsch
66Most coding rule violations corrected.
67
68Revision 1.1.2.4 2000/05/05 11:34:12 morsch
69Log inside comments.
70
71Revision 1.1.2.3 2000/05/05 10:09:52 morsch
72Log messages included
73*/
74
75// --- MUON includes ---
76#include "AliMUONChamber.h"
77
78// --- ROOT includes ---
79
80#include "TRandom.h"
81#include "TMath.h"
82
83ClassImp(AliMUONChamber)
84
85 AliMUONChamber::AliMUONChamber()
86{
87// Default constructor
88 fSegmentation = 0;
89 fResponse=0;
90 fnsec=1;
91 fReconstruction=0;
92 fId=0;
93 // to avoid mistakes if ChargeCorrelInit is not called
94 fCurrentCorrel =1;
95}
96
97 AliMUONChamber::AliMUONChamber(Int_t id)
98{
99// Construtor with chamber id
100 fSegmentation = new TObjArray(2);
101 fSegmentation->AddAt(0,0);
102 fSegmentation->AddAt(0,1);
103 fResponse=0;
104 fnsec=1;
105 fReconstruction=0;
106 fId=id;
107 // to avoid mistakes if ChargeCorrelInit is not called
108 fCurrentCorrel =1;
109}
110
111AliMUONChamber::~AliMUONChamber()
112{
113// Destructor
114 if (fSegmentation) {
115 fSegmentation->Delete();
116 delete fSegmentation;
117 }
118}
119
120AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
121{
122// Dummy copy constructor
123 ;
124}
125
126
127void AliMUONChamber::Init()
128{
129// Initalisation ..
130//
131// ... for chamber segmentation
132 if ((*fSegmentation)[0])
133 ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
134
135 if (fnsec==2) {
136 if ((*fSegmentation)[1])
137 ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
138 }
139}
140
141Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
142{
143// Ask segmentation if signal should be generated
144 if (fnsec==1) {
145 return ((AliSegmentation*) (*fSegmentation)[0])
146 ->SigGenCond(x, y, z) ;
147 } else {
148 return (((AliSegmentation*) (*fSegmentation)[0])
149 ->SigGenCond(x, y, z)) ||
150 (((AliSegmentation*) (*fSegmentation)[1])
151 ->SigGenCond(x, y, z)) ;
152 }
153}
154
155
156void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
157{
158//
159// Initialisation of segmentation for hit
160//
161 if (fnsec==1) {
162 ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
163 } else {
164 ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
165 ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
166 }
167}
168
169void AliMUONChamber::ChargeCorrelationInit() {
170// Initialisation of charge correlation for current hit
171// the value is stored, and then used by Disintegration
172if (fnsec==1)
173 fCurrentCorrel =1;
174else
175 // exponential is here to avoid eventual problems in 0
176 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
177 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
178}
179
180void AliMUONChamber::DisIntegration(Float_t eloss, Float_t tof,
181 Float_t xhit, Float_t yhit, Float_t zhit,
182 Int_t& nnew,Float_t newclust[6][500])
183{
184//
185// Generates pad hits (simulated cluster)
186// using the segmentation and the response model
187 Float_t dx, dy;
188 //
189 // Width of the integration area
190 //
191 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
192 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
193 //
194 // Get pulse height from energy loss
195 Float_t qtot = fResponse->IntPH(eloss);
196 //
197 // Loop Over Pads
198
199 Float_t qcheck=0, qp;
200 nnew=0;
201
202 // Cathode plane loop
203 for (Int_t i=1; i<=fnsec; i++) {
204 qcheck=0;
205 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
206 AliSegmentation * segmentation=
207 (AliSegmentation *) (*fSegmentation)[i-1];
208 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
209 segmentation->MorePads();
210 segmentation->NextPad())
211 {
212 qp=fResponse->IntXY(segmentation);
213 qp=TMath::Abs(qp);
214//
215//
216 if (qp > 1.e-4) {
217 qcheck+=qp*qcath;
218 //
219 // --- store signal information
220 newclust[0][nnew]=qcath; // total charge
221 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
222 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
223 newclust[3][nnew]=qp * qcath; // charge on pad
224 newclust[4][nnew]=segmentation->ISector(); // sector id
225 newclust[5][nnew]=(Float_t) i; // counter
226 nnew++;
227// if (i==2) printf("\n i, nnew, q %d %d %f", i, nnew, qp*qcath);
228
229 }
230 } // Pad loop
231
232 } // Cathode plane loop
233}
234
235
236
237void AliMUONChamber::InitGeo(Float_t zpos)
238{
239// sensitive gas gap
240 fdGas= 0.5;
241// 3% radiation length of aluminum (X0=8.9 cm)
242 fdAlu= 3.0/100*8.9;
243}
244
245
246AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
247{
248// Dummy assignment operator
249 return *this;
250}