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