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