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