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