]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONChamber.cxx
Reading MUONtracks from new ESD object tree
[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
681d067b 18// --- MUON includes ---
a9e2aefa 19#include "AliMUONChamber.h"
d1cd2474 20#include "AliMUONChamberGeometry.h"
a9e2aefa 21
681d067b 22// --- ROOT includes ---
23
24#include "TRandom.h"
a9e2aefa 25#include "TMath.h"
681d067b 26
a9e2aefa 27ClassImp(AliMUONChamber)
28
d81db581 29 AliMUONChamber::AliMUONChamber()
30{
31// Default constructor
0e9bce78 32 fSegmentation = 0;
d81db581 33 fResponse=0;
34 fnsec=1;
35 fReconstruction=0;
d1cd2474 36 fGeometry = 0;
37
d81db581 38 fId=0;
681d067b 39 // to avoid mistakes if ChargeCorrelInit is not called
681d067b 40 fCurrentCorrel =1;
d81db581 41}
42
43 AliMUONChamber::AliMUONChamber(Int_t id)
a9e2aefa 44{
d81db581 45// Construtor with chamber id
a9e2aefa 46 fSegmentation = new TObjArray(2);
cd4df77b 47 fSegmentation->AddAt(0,0);
48 fSegmentation->AddAt(0,1);
a9e2aefa 49 fResponse=0;
50 fnsec=1;
51 fReconstruction=0;
d81db581 52 fId=id;
c6df4ef2 53 fGeometry = new AliMUONChamberGeometry(fId);
681d067b 54 // to avoid mistakes if ChargeCorrelInit is not called
681d067b 55 fCurrentCorrel =1;
a9e2aefa 56}
57
58AliMUONChamber::~AliMUONChamber()
59{
d81db581 60// Destructor
c2c0190f 61 if (fSegmentation) {
62 fSegmentation->Delete();
63 delete fSegmentation;
64 }
c6df4ef2 65 delete fGeometry;
a9e2aefa 66}
67
390151b8 68AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber):TObject(rChamber)
69{
70 // Dummy copy constructor
71 ;
72}
a9e2aefa 73
74
d1cd2474 75Bool_t AliMUONChamber::IsSensId(Int_t volId) const
76{
77// Returns true if the volume specified by volId is in the list
78// of sesitive volumes for this chamber
79
80 return fGeometry->IsSensitiveVolume(volId);
81}
82
a9e2aefa 83void AliMUONChamber::Init()
84{
85// Initalisation ..
86//
87// ... for chamber segmentation
2682e810 88 //PH if ((*fSegmentation)[0])
89 //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
90 if (fSegmentation->At(0))
91 ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
a9e2aefa 92
93 if (fnsec==2) {
2682e810 94 //PH if ((*fSegmentation)[1])
95 //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
96 if (fSegmentation->At(1))
97 ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
a9e2aefa 98 }
99}
100
101Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
102{
103// Ask segmentation if signal should be generated
104 if (fnsec==1) {
2682e810 105 //PH return ((AliSegmentation*) (*fSegmentation)[0])
106 return ((AliSegmentation*) fSegmentation->At(0))
a9e2aefa 107 ->SigGenCond(x, y, z) ;
108 } else {
2682e810 109 //PH return (((AliSegmentation*) (*fSegmentation)[0])
110 return (((AliSegmentation*) fSegmentation->At(0))
a9e2aefa 111 ->SigGenCond(x, y, z)) ||
2682e810 112 //PH (((AliSegmentation*) (*fSegmentation)[1])
113 (((AliSegmentation*) fSegmentation->At(1))
a9e2aefa 114 ->SigGenCond(x, y, z)) ;
115 }
116}
117
118
119void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
120{
121//
122// Initialisation of segmentation for hit
123//
124 if (fnsec==1) {
2682e810 125 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
126 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
a9e2aefa 127 } else {
2682e810 128 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
129 //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
130 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
131 ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
a9e2aefa 132 }
133}
134
681d067b 135void AliMUONChamber::ChargeCorrelationInit() {
136// Initialisation of charge correlation for current hit
137// the value is stored, and then used by Disintegration
138if (fnsec==1)
139 fCurrentCorrel =1;
140else
141 // exponential is here to avoid eventual problems in 0
16d57990 142 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
143 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
681d067b 144}
145
24fe6002 146void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
802a864d 147 Float_t xhit, Float_t yhit, Float_t zhit,
a9e2aefa 148 Int_t& nnew,Float_t newclust[6][500])
149{
150//
151// Generates pad hits (simulated cluster)
152// using the segmentation and the response model
153 Float_t dx, dy;
154 //
155 // Width of the integration area
156 //
157 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
158 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
159 //
160 // Get pulse height from energy loss
161 Float_t qtot = fResponse->IntPH(eloss);
162 //
163 // Loop Over Pads
164
3194a39e 165 Float_t qp;
a9e2aefa 166 nnew=0;
ef495f13 167
681d067b 168 // Cathode plane loop
a9e2aefa 169 for (Int_t i=1; i<=fnsec; i++) {
681d067b 170 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
a30a000f 171 AliSegmentation * segmentation=
2682e810 172 //PH (AliSegmentation *) (*fSegmentation)[i-1];
173 (AliSegmentation *) fSegmentation->At(i-1);
802a864d 174 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
a9e2aefa 175 segmentation->MorePads();
176 segmentation->NextPad())
177 {
178 qp=fResponse->IntXY(segmentation);
179 qp=TMath::Abs(qp);
a9e2aefa 180//
181//
3194a39e 182 if (qp > 1.e-4)
183 {
184 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
185 // newclust only contains 500 elements.
186 {
187 Error("DisIntegration", "Limit of 500 pad responses reached.");
188 return;
189 };
190 //
191 // --- store signal information
681d067b 192 newclust[0][nnew]=qcath; // total charge
a9e2aefa 193 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
194 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
681d067b 195 newclust[3][nnew]=qp * qcath; // charge on pad
a9e2aefa 196 newclust[4][nnew]=segmentation->ISector(); // sector id
197 newclust[5][nnew]=(Float_t) i; // counter
198 nnew++;
ef495f13 199
a9e2aefa 200 }
201 } // Pad loop
ef495f13 202
a9e2aefa 203 } // Cathode plane loop
204}
205
206
207
24fe6002 208void AliMUONChamber::InitGeo(Float_t /*zpos*/)
a9e2aefa 209{
210// sensitive gas gap
211 fdGas= 0.5;
212// 3% radiation length of aluminum (X0=8.9 cm)
213 fdAlu= 3.0/100*8.9;
214}
215
216
24fe6002 217AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& /*rhs*/)
a9e2aefa 218{
219// Dummy assignment operator
220 return *this;
221}