]>
Commit | Line | Data |
---|---|---|
9825400f | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
d4fa40b7 | 17 | |
4dd5a4bf | 18 | // ---------------------------- |
19 | // Class AliMUONClusterInput | |
20 | // ---------------------------- | |
21 | // Global data service for hit reconstruction | |
22 | // Author: to be added | |
23 | ||
63ed9c6b | 24 | #include "AliMUONClusterInput.h" |
30178c30 | 25 | |
4dd5a4bf | 26 | #include "AliMUONGeometryTransformer.h" |
27 | #include "AliMUONGeometrySegmentation.h" | |
28 | #include "AliMUONSegFactory.h" | |
b7ef3c96 | 29 | #include "AliMUONSegmentation.h" |
7e4a628d | 30 | #include "AliMUONConstants.h" |
7e4a628d | 31 | #include "AliMUONMathieson.h" |
9825400f | 32 | #include "AliMUONRawCluster.h" |
33 | #include "AliMUONDigit.h" | |
63ed9c6b | 34 | |
8c343c7c | 35 | #include "AliLog.h" |
9825400f | 36 | |
63ed9c6b | 37 | #include <TClonesArray.h> |
a1e17193 | 38 | #include <TClass.h> |
63ed9c6b | 39 | #include <TMinuit.h> |
4dd5a4bf | 40 | #include <TGeoManager.h> |
9825400f | 41 | |
36dc66ec | 42 | /// \cond CLASSIMP |
43 | ClassImp(AliMUONClusterInput) | |
44 | /// \endcond | |
45 | ||
4dd5a4bf | 46 | AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0; |
47 | TMinuit* AliMUONClusterInput::fgMinuit = 0; | |
48 | AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0; | |
49 | AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0; | |
50 | AliMUONSegmentation* AliMUONClusterInput::fgSegmentation = 0; | |
9825400f | 51 | |
36dc66ec | 52 | //______________________________________________________________________________ |
30178c30 | 53 | AliMUONClusterInput::AliMUONClusterInput() |
7e4a628d | 54 | : TObject(), |
54d7ba50 | 55 | fNseg(0), |
56 | fChamber(0), | |
7e4a628d | 57 | fCluster(0), |
54d7ba50 | 58 | fZ(0.), |
fed772f3 | 59 | fChargeCorrel(1.), |
fed772f3 | 60 | fDetElemId(0) |
b137f8b9 | 61 | |
30178c30 | 62 | { |
36dc66ec | 63 | /// Default constructor |
4dd5a4bf | 64 | |
3f5cf0b3 | 65 | fDigits[0]=0; |
66 | fDigits[1]=0; | |
fed772f3 | 67 | fSegmentation2[0]=0; |
68 | fSegmentation2[1]=0; | |
3f5cf0b3 | 69 | } |
70 | ||
36dc66ec | 71 | //______________________________________________________________________________ |
9825400f | 72 | AliMUONClusterInput* AliMUONClusterInput::Instance() |
73 | { | |
36dc66ec | 74 | /// return pointer to the singleton instance |
9825400f | 75 | if (fgClusterInput == 0) { |
76 | fgClusterInput = new AliMUONClusterInput(); | |
e357fc46 | 77 | fgMinuit = new TMinuit(8); |
4dd5a4bf | 78 | |
79 | // Create segmentation with activated Root geometry | |
80 | if ( ! gGeoManager ) { | |
81 | AliFatalClass("Geometry not loaded."); | |
82 | return fgClusterInput; | |
83 | } | |
84 | fgTransformer = new AliMUONGeometryTransformer(true); | |
85 | fgTransformer->ReadGeometryData("volpath.dat", gGeoManager); | |
86 | AliMUONSegFactory factory(fgTransformer); | |
87 | fgSegmentation = factory.CreateSegmentation(); | |
9825400f | 88 | } |
89 | ||
90 | return fgClusterInput; | |
91 | } | |
92 | ||
36dc66ec | 93 | //______________________________________________________________________________ |
d4fa40b7 | 94 | AliMUONClusterInput::~AliMUONClusterInput() |
95 | { | |
36dc66ec | 96 | /// Destructor |
d4fa40b7 | 97 | delete fgMinuit; |
7e4a628d | 98 | delete fgMathieson; |
4dd5a4bf | 99 | delete fgTransformer; |
100 | delete fgSegmentation; | |
8fee0ce8 | 101 | fgMinuit = 0; |
102 | fgMathieson = 0; | |
d4fa40b7 | 103 | } |
30178c30 | 104 | |
36dc66ec | 105 | //______________________________________________________________________________ |
a713db22 | 106 | void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2) |
107 | { | |
36dc66ec | 108 | /// Set pointer to digits with corresponding segmentations and responses (two cathode planes) |
a713db22 | 109 | fChamber = chamber; |
110 | fDetElemId = idDE; | |
111 | fDigits[0] = dig1; | |
112 | fDigits[1] = dig2; | |
113 | fNDigits[0] = dig1->GetEntriesFast(); | |
114 | fNDigits[1] = dig2->GetEntriesFast(); | |
115 | ||
8fee0ce8 | 116 | delete fgMathieson; |
b7ef3c96 | 117 | fgMathieson = new AliMUONMathieson(); |
118 | ||
c2a43efa | 119 | fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0); |
120 | fSegmentation2[1]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 1); | |
a713db22 | 121 | |
122 | fNseg = 2; | |
123 | if (chamber < AliMUONConstants::NTrackingCh()) { | |
124 | if (chamber > 1 ) { | |
125 | fgMathieson->SetPitch(AliMUONConstants::Pitch()); | |
126 | fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3()); | |
127 | fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3()); | |
128 | fChargeCorrel = AliMUONConstants::ChargeCorrel(); | |
129 | } else { | |
130 | fgMathieson->SetPitch(AliMUONConstants::PitchSt1()); | |
131 | fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1()); | |
132 | fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1()); | |
133 | fChargeCorrel = AliMUONConstants::ChargeCorrelSt1(); | |
134 | } | |
135 | } | |
136 | } | |
137 | ||
36dc66ec | 138 | //______________________________________________________________________________ |
a713db22 | 139 | void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig) |
140 | { | |
36dc66ec | 141 | /// Set pointer to digits with corresponding segmentations and responses (one cathode plane) |
a713db22 | 142 | |
143 | fChamber = chamber; | |
144 | fDetElemId = idDE; | |
145 | fDigits[0] = dig; | |
146 | ||
c2a43efa | 147 | fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0); |
9825400f | 148 | fNseg=1; |
149 | } | |
150 | ||
36dc66ec | 151 | //______________________________________________________________________________ |
9825400f | 152 | void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster) |
153 | { | |
36dc66ec | 154 | /// Set the current cluster |
b137f8b9 | 155 | //PH printf("\n %p \n", cluster); |
156 | fCluster=cluster; | |
157 | Float_t qtot; | |
158 | Int_t i, cath, ix, iy; | |
159 | AliMUONDigit* digit; | |
160 | fNmul[0]=cluster->GetMultiplicity(0); | |
161 | fNmul[1]=cluster->GetMultiplicity(1); | |
162 | //PH printf("\n %p %p ", fDigits[0], fDigits[1]); | |
163 | ||
164 | for (cath=0; cath<2; cath++) { | |
165 | qtot=0; | |
166 | for (i=0; i<fNmul[cath]; i++) { | |
167 | // pointer to digit | |
168 | digit =(AliMUONDigit*) | |
0164904a | 169 | (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath))); |
9825400f | 170 | // pad coordinates |
08a636a8 | 171 | ix = digit->PadX(); |
172 | iy = digit->PadY(); | |
9825400f | 173 | // pad charge |
08a636a8 | 174 | fCharge[i][cath] = digit->Signal(); |
9825400f | 175 | // pad centre coordinates |
176 | // fSegmentation[cath]->GetPadCxy(ix, iy, x, y); | |
177 | // globals kUsed in fitting functions | |
178 | fix[i][cath]=ix; | |
179 | fiy[i][cath]=iy; | |
180 | // total charge per cluster | |
181 | qtot+=fCharge[i][cath]; | |
e357fc46 | 182 | // Current z |
183 | Float_t xc, yc; | |
002920d1 | 184 | fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ); |
9825400f | 185 | } // loop over cluster digits |
186 | fQtot[cath]=qtot; | |
187 | fChargeTot[cath]=Int_t(qtot); | |
188 | } // loop over cathodes | |
189 | } | |
190 | ||
36dc66ec | 191 | //______________________________________________________________________________ |
9825400f | 192 | Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par) |
193 | { | |
36dc66ec | 194 | /// Compute the charge on first cathod only. |
a1b02be9 | 195 | return DiscrChargeCombiS1(i,par,0); |
9825400f | 196 | } |
197 | ||
36dc66ec | 198 | //______________________________________________________________________________ |
9825400f | 199 | Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath) |
200 | { | |
36dc66ec | 201 | /// \todo add comment |
202 | /// - par[0] x-position of cluster | |
203 | /// - param par[1] y-position of cluster | |
9825400f | 204 | |
c2a43efa | 205 | Float_t q1; |
206 | fSegmentation2[cath]-> SetPad(fDetElemId, fix[i][cath], fiy[i][cath]); | |
207 | // First Cluster | |
208 | fSegmentation2[cath]-> SetHit(fDetElemId, par[0],par[1],fZ); | |
209 | q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); | |
002920d1 | 210 | |
9825400f | 211 | Float_t value = fQtot[cath]*q1; |
212 | return value; | |
213 | } | |
214 | ||
215 | ||
36dc66ec | 216 | //______________________________________________________________________________ |
9825400f | 217 | Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par) |
218 | { | |
36dc66ec | 219 | /// \todo add comment |
220 | /// - par[0] x-position of first cluster | |
221 | /// - par[1] y-position of first cluster | |
222 | /// - par[2] x-position of second cluster | |
223 | /// - par[3] y-position of second cluster | |
224 | /// - par[4] charge fraction of first cluster | |
225 | /// - 1-par[4] charge fraction of second cluster | |
9825400f | 226 | |
a713db22 | 227 | Float_t q1, q2; |
228 | ||
002920d1 | 229 | fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]); |
230 | // First Cluster | |
231 | fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ); | |
232 | q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]); | |
233 | ||
234 | // Second Cluster | |
235 | fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ); | |
236 | q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]); | |
237 | ||
a713db22 | 238 | Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); |
239 | return value; | |
9825400f | 240 | } |
241 | ||
36dc66ec | 242 | //______________________________________________________________________________ |
9825400f | 243 | Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath) |
244 | { | |
36dc66ec | 245 | /// \todo add comment |
246 | /// - par[0] x-position of first cluster | |
247 | /// - par[1] y-position of first cluster | |
248 | /// - par[2] x-position of second cluster | |
249 | /// - par[3] y-position of second cluster | |
250 | /// - par[4] charge fraction of first cluster - first cathode | |
251 | /// - 1-par[4] charge fraction of second cluster | |
252 | /// - par[5] charge fraction of first cluster - second cathode | |
9825400f | 253 | |
a713db22 | 254 | Float_t q1, q2; |
255 | ||
002920d1 | 256 | fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]); |
257 | // First Cluster | |
258 | fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ); | |
259 | q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); | |
260 | ||
261 | // Second Cluster | |
262 | fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ); | |
263 | q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); | |
264 | ||
a713db22 | 265 | Float_t value; |
266 | if (cath==0) { | |
267 | value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); | |
268 | } else { | |
269 | value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2); | |
270 | } | |
271 | return value; | |
9825400f | 272 | } |