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