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