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