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