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