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