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