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