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