]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONChamber.cxx
Obsolete file (Ivana)
[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 **************************************************************************/
2682e810 15
88cb7938 16/* $Id$ */
a9e2aefa 17
30178c30 18// --- ROOT includes ---
19#include <TRandom.h>
20#include <TMath.h>
a713db22 21#include "AliRun.h"
22
30178c30 23
681d067b 24// --- MUON includes ---
a713db22 25#include "AliMUON.h"
a9e2aefa 26#include "AliMUONChamber.h"
e118b27e 27#include "AliMUONGeometryModule.h"
a713db22 28#include "AliMUONHit.h"
8c343c7c 29#include "AliLog.h"
a9e2aefa 30
a9e2aefa 31ClassImp(AliMUONChamber)
32
30178c30 33AliMUONChamber::AliMUONChamber()
34 : TObject(),
35 fId(0),
36 fdGas(0.),
37 fdAlu(0.),
38 fZ(0.),
39 fnsec(1),
40 frMin(0.),
41 frMax(0.),
42 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
a713db22 43 fSegmentation2(0),
30178c30 44 fResponse(0),
a713db22 45 fGeometry(0),
46 fMUON(0)
d81db581 47{
48// Default constructor
d81db581 49}
50
a713db22 51//_______________________________________________________
30178c30 52AliMUONChamber::AliMUONChamber(Int_t id)
53 : TObject(),
54 fId(id),
55 fdGas(0.),
56 fdAlu(0.),
57 fZ(0.),
58 fnsec(1),
59 frMin(0.),
60 frMax(0.),
61 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
a713db22 62 fSegmentation2(0),
30178c30 63 fResponse(0),
a713db22 64 fGeometry(0),
65 fMUON(0)
a9e2aefa 66{
a713db22 67
68 // muon
69 fMUON = (AliMUON*)gAlice->GetModule("MUON");
70 if (!fMUON) {
71 AliFatal("MUON detector not defined.");
72 return;
73 }
002920d1 74
a713db22 75 // new segmentation
76 fSegmentation2 = new TObjArray(2);
77 fSegmentation2->AddAt(0,0);
78 fSegmentation2->AddAt(0,1);
79
e118b27e 80 fGeometry = new AliMUONGeometryModule(fId);
a713db22 81
30178c30 82}
83
a713db22 84//_______________________________________________________
30178c30 85AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
86 : TObject(rChamber)
87{
a713db22 88 // Protected copy constructor
30178c30 89
8c343c7c 90 AliFatal("Not implemented.");
a713db22 91 // Dummy copy constructor
a9e2aefa 92}
93
a713db22 94//_______________________________________________________
a9e2aefa 95AliMUONChamber::~AliMUONChamber()
96{
a713db22 97 // Destructor
002920d1 98
99 if (fSegmentation2) {
100 fSegmentation2->Delete();
101 delete fSegmentation2;
c2c0190f 102 }
002920d1 103
c6df4ef2 104 delete fGeometry;
a9e2aefa 105}
106
a713db22 107//_______________________________________________________
30178c30 108AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
390151b8 109{
a713db22 110 // Protected assignement operator
a9e2aefa 111
30178c30 112 if (this == &rhs) return *this;
113
8c343c7c 114 AliFatal("Not implemented.");
30178c30 115
116 return *this;
117}
a9e2aefa 118
a713db22 119//_______________________________________________________
d1cd2474 120Bool_t AliMUONChamber::IsSensId(Int_t volId) const
121{
a713db22 122 // Returns true if the volume specified by volId is in the list
123 // of sesitive volumes for this chamber
d1cd2474 124
125 return fGeometry->IsSensitiveVolume(volId);
126}
127
a9e2aefa 128
a713db22 129//_____________________________________________________
681d067b 130void AliMUONChamber::ChargeCorrelationInit() {
a713db22 131 // Initialisation of charge correlation for current hit
132 // the value is stored, and then used by Disintegration
133 if (fnsec==1)
681d067b 134 fCurrentCorrel =1;
a713db22 135 else
681d067b 136 // exponential is here to avoid eventual problems in 0
16d57990 137 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
138 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
681d067b 139}
140
a713db22 141//_______________________________________________________
142void AliMUONChamber::InitGeo(Float_t /*zpos*/)
143{
144 // sensitive gas gap
145 fdGas= 0.5;
146 // 3% radiation length of aluminum (X0=8.9 cm)
147 fdAlu= 3.0/100*8.9;
148}
149//_______________________________________________________
150//
151// NEW SEGMENTATION
152//_______________________________________________________
153void AliMUONChamber::Init(Int_t flag)
154{
155 // Initalisation ..
156 //
157 // ... for chamber segmentation
a9e2aefa 158
a713db22 159 if (!flag) AliFatal("wrong segmentation type.");
a9e2aefa 160
a713db22 161
162 if (fSegmentation2->At(0))
163 ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->Init(fId);
164
165 if (fnsec==2) {
166 if (fSegmentation2->At(1))
167 ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->Init(fId);
168 }
169}
170
171//_________________________________________________________________
172Int_t AliMUONChamber::SigGenCond(AliMUONHit *hit)
173{
174 // Ask segmentation if signal should be generated
175
176 Float_t x = hit->X();
177 Float_t y = hit->Y();
178 Float_t z = hit->Z();
179 Int_t id = hit->DetElemId();
180
181 if (fnsec==1) {
182 return ((AliMUONGeometrySegmentation*)fSegmentation2->At(0))->SigGenCond(id, x, y, z);
183 } else {
184 return (((AliMUONGeometrySegmentation*) fSegmentation2->At(0))
185 ->SigGenCond(id, x, y, z)) ||
186 (((AliMUONGeometrySegmentation*) fSegmentation2->At(1))
187 ->SigGenCond(id, x, y, z)) ;
188 }
189}
190
191//_________________________________________________________________
192void AliMUONChamber::SigGenInit(AliMUONHit *hit)
a9e2aefa 193{
a713db22 194 //
195 // Initialisation of segmentation for hit
196 //
197 Float_t x = hit->X();
198 Float_t y = hit->Y();
199 Float_t z = hit->Z();
200 Int_t id = hit->DetElemId();
201
202 if (fnsec==1) {
203 ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->SigGenInit(id, x, y, z) ;
204 } else {
205 ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->SigGenInit(id, x, y, z) ;
206 ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->SigGenInit(id, x, y, z) ;
207 }
a9e2aefa 208}
209
a713db22 210//_______________________________________________________
211void AliMUONChamber::DisIntegration(AliMUONHit *hit,
212 Int_t& nnew,Float_t newclust[6][500])
213{
214 //
215 // Generates pad hits (simulated cluster)
216 // using the segmentation and the response model
217 Float_t dx, dy;
218
219 Float_t xhit = hit->X();
220 Float_t yhit = hit->Y();
221 Float_t zhit = hit->Z();
222 Int_t id = hit->DetElemId();
223 Float_t eloss = hit->Eloss();
a9e2aefa 224
a713db22 225 //
226 // Width of the integration area
227 //
228 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
229 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
230 //
231 // Get pulse height from energy loss
232 Float_t qtot = fResponse->IntPH(eloss);
233 //
234 // Loop Over Pads
235
236 Float_t qp;
237 nnew=0;
238
239 // Cathode plane loop
240 for (Int_t i=1; i<=fnsec; i++) {
241 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
242
243 AliMUONGeometrySegmentation* segmentation=
244 (AliMUONGeometrySegmentation*) fSegmentation2->At(i-1);
245
246 for (segmentation->FirstPad(id, xhit, yhit, zhit, dx, dy);
247 segmentation->MorePads(id);
248 segmentation->NextPad(id))
249 {
250 qp=fResponse->IntXY(id, segmentation);
251 qp=TMath::Abs(qp);
252 //
253 //
254 if (qp > 1.e-4)
255 {
256 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
257 // newclust only contains 500 elements.
258 {
259 AliError("Limit of 500 pad responses reached.");
260 return;
261 };
262 //
263 // --- store signal information
264 newclust[0][nnew]=qcath; // total charge
265 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
266 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
267 newclust[3][nnew]=qp * qcath; // charge on pad
268 newclust[4][nnew]=segmentation->ISector(); // sector id
269 newclust[5][nnew]=(Float_t) i; // counter
270 nnew++;
271
272 }
273 } // Pad loop
274 } // Cathode plane loop
275}