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