]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONChamber.cxx
Correction to the destuctors in case of deleting TObjArrays.
[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$
cd4df77b 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
16d57990 23Revision 1.9 2001/01/26 21:35:54 morsch
24All pointers set to 0 in default constructor.
25
0e9bce78 26Revision 1.8 2001/01/17 20:53:40 hristov
27Destructors corrected to avoid memory leaks
28
c2c0190f 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
681d067b 42Revision 1.6 2000/10/09 14:01:12 morsch
43Double inclusion of AliResponse removed.
44
ef495f13 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
a30a000f 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
d81db581 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
802a864d 62Revision 1.2 2000/06/15 07:58:48 morsch
63Code from MUON-dev joined
64
a9e2aefa 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
681d067b 75// --- MUON includes ---
a9e2aefa 76#include "AliMUONChamber.h"
a9e2aefa 77
681d067b 78// --- ROOT includes ---
79
80#include "TRandom.h"
a9e2aefa 81#include "TMath.h"
681d067b 82
a9e2aefa 83ClassImp(AliMUONChamber)
84
d81db581 85 AliMUONChamber::AliMUONChamber()
86{
87// Default constructor
0e9bce78 88 fSegmentation = 0;
d81db581 89 fResponse=0;
90 fnsec=1;
91 fReconstruction=0;
92 fId=0;
681d067b 93 // to avoid mistakes if ChargeCorrelInit is not called
681d067b 94 fCurrentCorrel =1;
d81db581 95}
96
97 AliMUONChamber::AliMUONChamber(Int_t id)
a9e2aefa 98{
d81db581 99// Construtor with chamber id
a9e2aefa 100 fSegmentation = new TObjArray(2);
cd4df77b 101 fSegmentation->AddAt(0,0);
102 fSegmentation->AddAt(0,1);
a9e2aefa 103 fResponse=0;
104 fnsec=1;
105 fReconstruction=0;
d81db581 106 fId=id;
681d067b 107 // to avoid mistakes if ChargeCorrelInit is not called
681d067b 108 fCurrentCorrel =1;
a9e2aefa 109}
110
111AliMUONChamber::~AliMUONChamber()
112{
d81db581 113// Destructor
c2c0190f 114 if (fSegmentation) {
115 fSegmentation->Delete();
116 delete fSegmentation;
117 }
a9e2aefa 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])
a30a000f 133 ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
a9e2aefa 134
135 if (fnsec==2) {
136 if ((*fSegmentation)[1])
a30a000f 137 ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
a9e2aefa 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) {
a30a000f 145 return ((AliSegmentation*) (*fSegmentation)[0])
a9e2aefa 146 ->SigGenCond(x, y, z) ;
147 } else {
a30a000f 148 return (((AliSegmentation*) (*fSegmentation)[0])
a9e2aefa 149 ->SigGenCond(x, y, z)) ||
a30a000f 150 (((AliSegmentation*) (*fSegmentation)[1])
a9e2aefa 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) {
a30a000f 162 ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
a9e2aefa 163 } else {
a30a000f 164 ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
165 ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
a9e2aefa 166 }
167}
168
681d067b 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
16d57990 176 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
177 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
681d067b 178}
179
a9e2aefa 180void AliMUONChamber::DisIntegration(Float_t eloss, Float_t tof,
802a864d 181 Float_t xhit, Float_t yhit, Float_t zhit,
a9e2aefa 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;
ef495f13 201
681d067b 202 // Cathode plane loop
a9e2aefa 203 for (Int_t i=1; i<=fnsec; i++) {
204 qcheck=0;
681d067b 205 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
a30a000f 206 AliSegmentation * segmentation=
207 (AliSegmentation *) (*fSegmentation)[i-1];
802a864d 208 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
a9e2aefa 209 segmentation->MorePads();
210 segmentation->NextPad())
211 {
212 qp=fResponse->IntXY(segmentation);
213 qp=TMath::Abs(qp);
a9e2aefa 214//
215//
216 if (qp > 1.e-4) {
681d067b 217 qcheck+=qp*qcath;
a9e2aefa 218 //
219 // --- store signal information
681d067b 220 newclust[0][nnew]=qcath; // total charge
a9e2aefa 221 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
222 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
681d067b 223 newclust[3][nnew]=qp * qcath; // charge on pad
a9e2aefa 224 newclust[4][nnew]=segmentation->ISector(); // sector id
225 newclust[5][nnew]=(Float_t) i; // counter
226 nnew++;
681d067b 227// if (i==2) printf("\n i, nnew, q %d %d %f", i, nnew, qp*qcath);
ef495f13 228
a9e2aefa 229 }
230 } // Pad loop
ef495f13 231
a9e2aefa 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}