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