]>
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 | ||
16 | /* | |
17 | $Log$ | |
6a9bc541 | 18 | Revision 1.6 2000/10/06 09:04:50 morsch |
19 | ||
20 | - Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate | |
21 | to make code work with slat chambers. | |
22 | ||
e357fc46 | 23 | Revision 1.5 2000/10/02 16:58:29 egangler |
24 | Cleaning of the code : | |
25 | -> coding conventions | |
26 | -> void Streamers | |
27 | -> some useless includes removed or replaced by "class" statement | |
28 | ||
ecfa008b | 29 | Revision 1.4 2000/07/03 11:54:57 morsch |
30 | AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER | |
31 | The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. | |
32 | ||
a30a000f | 33 | Revision 1.3 2000/06/28 15:16:35 morsch |
34 | (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there) | |
35 | to allow development of slat-muon chamber simulation and reconstruction code in the MUON | |
36 | framework. The changes should have no side effects (mostly dummy arguments). | |
37 | (2) Hit disintegration uses 3-dim hit coordinates to allow simulation | |
38 | of chambers with overlapping modules (MakePadHits, Disintegration). | |
39 | ||
802a864d | 40 | Revision 1.2 2000/06/28 12:19:18 morsch |
41 | More consequent seperation of global input data services (AliMUONClusterInput singleton) and the | |
42 | cluster and hit reconstruction algorithms in AliMUONClusterFinderVS. | |
43 | AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction. | |
44 | It requires two cathode planes. Small modifications in the code will make it usable for | |
45 | one cathode plane and, hence, more general (for test beam data). | |
46 | AliMUONClusterFinder is now obsolete. | |
47 | ||
30aaba74 | 48 | Revision 1.1 2000/06/28 08:06:10 morsch |
49 | Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the | |
50 | algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton. | |
51 | It also naturally takes care of the TMinuit instance. | |
52 | ||
9825400f | 53 | */ |
54 | #include "AliRun.h" | |
55 | #include "AliMUON.h" | |
56 | #include "AliMUONChamber.h" | |
57 | #include "AliMUONClusterInput.h" | |
a30a000f | 58 | #include "AliSegmentation.h" |
9825400f | 59 | #include "AliMUONResponse.h" |
60 | #include "AliMUONRawCluster.h" | |
61 | #include "AliMUONDigit.h" | |
62 | ||
63 | #include <TClonesArray.h> | |
64 | #include <TMinuit.h> | |
65 | ||
66 | ClassImp(AliMUONClusterInput) | |
67 | ||
68 | AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0; | |
69 | TMinuit* AliMUONClusterInput::fgMinuit = 0; | |
70 | ||
71 | AliMUONClusterInput* AliMUONClusterInput::Instance() | |
72 | { | |
73 | // return pointer to the singleton instance | |
74 | if (fgClusterInput == 0) { | |
75 | fgClusterInput = new AliMUONClusterInput(); | |
e357fc46 | 76 | fgMinuit = new TMinuit(8); |
9825400f | 77 | } |
78 | ||
79 | return fgClusterInput; | |
80 | } | |
81 | ||
82 | void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2) | |
83 | { | |
84 | // Set pointer to digits with corresponding segmentations and responses (two cathode planes) | |
30aaba74 | 85 | fChamber=chamber; |
9825400f | 86 | fDigits[0]=dig1; |
87 | fDigits[1]=dig2; | |
30aaba74 | 88 | fNDigits[0]=dig1->GetEntriesFast(); |
89 | fNDigits[1]=dig2->GetEntriesFast(); | |
90 | ||
9825400f | 91 | AliMUON *pMUON; |
92 | AliMUONChamber* iChamber; | |
93 | ||
94 | pMUON = (AliMUON*) gAlice->GetModule("MUON"); | |
95 | iChamber = &(pMUON->Chamber(chamber)); | |
96 | ||
97 | fSegmentation[0]=iChamber->SegmentationModel(1); | |
98 | fSegmentation[1]=iChamber->SegmentationModel(2); | |
99 | fResponse=iChamber->ResponseModel(); | |
100 | fNseg = 2; | |
101 | } | |
102 | ||
103 | void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig) | |
104 | { | |
105 | // Set pointer to digits with corresponding segmentations and responses (one cathode plane) | |
106 | fDigits[0]=dig; | |
107 | AliMUON *pMUON; | |
108 | AliMUONChamber* iChamber; | |
109 | ||
110 | pMUON = (AliMUON*) gAlice->GetModule("MUON"); | |
111 | iChamber = &(pMUON->Chamber(chamber)); | |
112 | ||
113 | fSegmentation[0]=iChamber->SegmentationModel(1); | |
114 | fResponse=iChamber->ResponseModel(); | |
115 | fNseg=1; | |
116 | } | |
117 | ||
118 | void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster) | |
119 | { | |
120 | // Set the current cluster | |
30aaba74 | 121 | printf("\n %p \n", cluster); |
9825400f | 122 | fCluster=cluster; |
123 | Float_t qtot; | |
124 | Int_t i, cath, ix, iy; | |
125 | AliMUONDigit* digit; | |
126 | fNmul[0]=cluster->fMultiplicity[0]; | |
127 | fNmul[1]=cluster->fMultiplicity[1]; | |
128 | printf("\n %p %p ", fDigits[0], fDigits[1]); | |
129 | ||
130 | for (cath=0; cath<2; cath++) { | |
131 | qtot=0; | |
132 | for (i=0; i<fNmul[cath]; i++) { | |
133 | // pointer to digit | |
134 | digit =(AliMUONDigit*) | |
135 | (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath])); | |
136 | // pad coordinates | |
137 | ix = digit->fPadX; | |
138 | iy = digit->fPadY; | |
139 | // pad charge | |
140 | fCharge[i][cath] = digit->fSignal; | |
141 | // pad centre coordinates | |
142 | // fSegmentation[cath]->GetPadCxy(ix, iy, x, y); | |
143 | // globals kUsed in fitting functions | |
144 | fix[i][cath]=ix; | |
145 | fiy[i][cath]=iy; | |
146 | // total charge per cluster | |
147 | qtot+=fCharge[i][cath]; | |
e357fc46 | 148 | // Current z |
149 | Float_t xc, yc; | |
150 | fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ); | |
9825400f | 151 | } // loop over cluster digits |
152 | fQtot[cath]=qtot; | |
153 | fChargeTot[cath]=Int_t(qtot); | |
154 | } // loop over cathodes | |
155 | } | |
156 | ||
157 | ||
158 | ||
159 | Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par) | |
160 | { | |
161 | // par[0] x-position of cluster | |
162 | // par[1] y-position of cluster | |
163 | ||
164 | fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]); | |
165 | // First Cluster | |
e357fc46 | 166 | fSegmentation[0]->SetHit(par[0],par[1],fZ); |
9825400f | 167 | Float_t q1=fResponse->IntXY(fSegmentation[0]); |
168 | ||
169 | Float_t value = fQtot[0]*q1; | |
170 | return value; | |
171 | } | |
172 | ||
173 | Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath) | |
174 | { | |
175 | // par[0] x-position of cluster | |
176 | // par[1] y-position of cluster | |
177 | ||
178 | fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); | |
179 | // First Cluster | |
e357fc46 | 180 | fSegmentation[cath]->SetHit(par[0],par[1],fZ); |
9825400f | 181 | Float_t q1=fResponse->IntXY(fSegmentation[cath]); |
182 | ||
183 | Float_t value = fQtot[cath]*q1; | |
184 | return value; | |
185 | } | |
186 | ||
187 | ||
188 | Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par) | |
189 | { | |
190 | // par[0] x-position of first cluster | |
191 | // par[1] y-position of first cluster | |
192 | // par[2] x-position of second cluster | |
193 | // par[3] y-position of second cluster | |
194 | // par[4] charge fraction of first cluster | |
195 | // 1-par[4] charge fraction of second cluster | |
196 | ||
197 | fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]); | |
198 | // First Cluster | |
e357fc46 | 199 | fSegmentation[0]->SetHit(par[0],par[1],fZ); |
9825400f | 200 | Float_t q1=fResponse->IntXY(fSegmentation[0]); |
201 | ||
202 | // Second Cluster | |
e357fc46 | 203 | fSegmentation[0]->SetHit(par[2],par[3],fZ); |
9825400f | 204 | Float_t q2=fResponse->IntXY(fSegmentation[0]); |
205 | ||
206 | Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); | |
207 | return value; | |
208 | } | |
209 | ||
210 | Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath) | |
211 | { | |
212 | // par[0] x-position of first cluster | |
213 | // par[1] y-position of first cluster | |
214 | // par[2] x-position of second cluster | |
215 | // par[3] y-position of second cluster | |
216 | // par[4] charge fraction of first cluster | |
217 | // 1-par[4] charge fraction of second cluster | |
218 | ||
219 | fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); | |
220 | // First Cluster | |
e357fc46 | 221 | fSegmentation[cath]->SetHit(par[0],par[1],fZ); |
9825400f | 222 | Float_t q1=fResponse->IntXY(fSegmentation[cath]); |
223 | ||
224 | // Second Cluster | |
e357fc46 | 225 | fSegmentation[cath]->SetHit(par[2],par[3],fZ); |
9825400f | 226 | Float_t q2=fResponse->IntXY(fSegmentation[cath]); |
227 | Float_t value; | |
228 | if (cath==0) { | |
229 | value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); | |
230 | } else { | |
231 | value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2); | |
232 | } | |
233 | return value; | |
234 | } | |
235 | ||
6a9bc541 | 236 | AliMUONClusterInput& AliMUONClusterInput |
237 | ::operator = (const AliMUONClusterInput& rhs) | |
238 | { | |
239 | // Dummy assignment operator | |
240 | return *this; | |
241 | } | |
9825400f | 242 | |
243 |