]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterInput.cxx
remove obsolete flange (Pascal)
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterInput.cxx
CommitLineData
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 31ClassImp(AliMUONClusterInput)
32
33AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
34TMinuit* AliMUONClusterInput::fgMinuit = 0;
7e4a628d 35AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0;
9825400f 36
30178c30 37AliMUONClusterInput::AliMUONClusterInput()
7e4a628d 38 : TObject(),
39 fCluster(0),
fed772f3 40 fChargeCorrel(1.),
41 fSegmentationType(1),
42 fDetElemId(0)
7e4a628d 43
30178c30 44{
3f5cf0b3 45 fDigits[0]=0;
46 fDigits[1]=0;
47 fSegmentation[0]=0;
48 fSegmentation[1]=0;
fed772f3 49 fSegmentation2[0]=0;
50 fSegmentation2[1]=0;
3f5cf0b3 51}
52
9825400f 53AliMUONClusterInput* AliMUONClusterInput::Instance()
54{
55// return pointer to the singleton instance
56 if (fgClusterInput == 0) {
57 fgClusterInput = new AliMUONClusterInput();
e357fc46 58 fgMinuit = new TMinuit(8);
9825400f 59 }
60
61 return fgClusterInput;
62}
63
d4fa40b7 64AliMUONClusterInput::~AliMUONClusterInput()
65{
66// Destructor
67 delete fgMinuit;
7e4a628d 68 delete fgMathieson;
d4fa40b7 69}
30178c30 70
7b4177a6 71AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
72{
30178c30 73// Protected copy constructor
74
8c343c7c 75 AliFatal("Not implemented.");
7b4177a6 76}
d4fa40b7 77
9825400f 78void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
79{
80// Set pointer to digits with corresponding segmentations and responses (two cathode planes)
30aaba74 81 fChamber=chamber;
9825400f 82 fDigits[0]=dig1;
83 fDigits[1]=dig2;
30aaba74 84 fNDigits[0]=dig1->GetEntriesFast();
85 fNDigits[1]=dig2->GetEntriesFast();
86
9825400f 87 AliMUON *pMUON;
88 AliMUONChamber* iChamber;
89
90 pMUON = (AliMUON*) gAlice->GetModule("MUON");
a713db22 91 if ((fSegmentationType = pMUON->WhichSegmentation()) != 1)
92 AliFatal("Wrong segmentation type");
9825400f 93
a713db22 94 iChamber = &(pMUON->Chamber(chamber));
7e4a628d 95 fgMathieson = new AliMUONMathieson();
a713db22 96
9825400f 97 fSegmentation[0]=iChamber->SegmentationModel(1);
98 fSegmentation[1]=iChamber->SegmentationModel(2);
a713db22 99
9825400f 100 fNseg = 2;
7e4a628d 101 if (chamber < AliMUONConstants::NTrackingCh()) {
1c334adf 102 if (chamber > 1 ) {
103 fgMathieson->SetPitch(AliMUONConstants::Pitch());
104 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
105 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
106 fChargeCorrel = AliMUONConstants::ChargeCorrel();
7e4a628d 107 } else {
1c334adf 108 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
109 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
110 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
111 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
7e4a628d 112 }
113 }
9825400f 114}
115
116void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
117{
118// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
119 fDigits[0]=dig;
120 AliMUON *pMUON;
121 AliMUONChamber* iChamber;
122
123 pMUON = (AliMUON*) gAlice->GetModule("MUON");
a713db22 124 if ((fSegmentationType = pMUON->WhichSegmentation()) != 1)
125 AliFatal("Wrong segmentation type");
9825400f 126
a713db22 127 iChamber = &(pMUON->Chamber(chamber));
9825400f 128 fSegmentation[0]=iChamber->SegmentationModel(1);
a713db22 129
130 fNseg=1;
131}
132void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
133{
134 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
135 fChamber = chamber;
136 fDetElemId = idDE;
137 fDigits[0] = dig1;
138 fDigits[1] = dig2;
139 fNDigits[0] = dig1->GetEntriesFast();
140 fNDigits[1] = dig2->GetEntriesFast();
141
142 AliMUON *pMUON;
143 AliMUONChamber* iChamber;
144
145 pMUON = (AliMUON*) gAlice->GetModule("MUON");
146 iChamber = &(pMUON->Chamber(chamber));
147
148 fgMathieson = new AliMUONMathieson();
149 if ((fSegmentationType = pMUON->WhichSegmentation()) != 2)
150 AliFatal("Wrong segmentation type");
151
152 fSegmentation2[0]=iChamber->SegmentationModel2(1);
153 fSegmentation2[1]=iChamber->SegmentationModel2(2);
154
155 fNseg = 2;
156 if (chamber < AliMUONConstants::NTrackingCh()) {
157 if (chamber > 1 ) {
158 fgMathieson->SetPitch(AliMUONConstants::Pitch());
159 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
160 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
161 fChargeCorrel = AliMUONConstants::ChargeCorrel();
162 } else {
163 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
164 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
165 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
166 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
167 }
168 }
169}
170
171void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig)
172{
173// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
174
175 fChamber = chamber;
176 fDetElemId = idDE;
177 fDigits[0] = dig;
178
179 AliMUON *pMUON;
180 AliMUONChamber* iChamber;
181
182 pMUON = (AliMUON*) gAlice->GetModule("MUON");
183 iChamber = &(pMUON->Chamber(chamber));
184 if ((fSegmentationType = pMUON->WhichSegmentation()) != 2)
185 AliFatal("Wrong segmentation type");
fed772f3 186
a713db22 187 fSegmentation2[0]=iChamber->SegmentationModel2(1);
188
9825400f 189 fNseg=1;
190}
191
192void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
193{
194// Set the current cluster
19dd5b2f 195 //PH printf("\n %p \n", cluster);
9825400f 196 fCluster=cluster;
197 Float_t qtot;
198 Int_t i, cath, ix, iy;
199 AliMUONDigit* digit;
9e993f2a 200 fNmul[0]=cluster->GetMultiplicity(0);
201 fNmul[1]=cluster->GetMultiplicity(1);
19dd5b2f 202 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
9825400f 203
204 for (cath=0; cath<2; cath++) {
205 qtot=0;
206 for (i=0; i<fNmul[cath]; i++) {
207 // pointer to digit
208 digit =(AliMUONDigit*)
0164904a 209 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
9825400f 210 // pad coordinates
08a636a8 211 ix = digit->PadX();
212 iy = digit->PadY();
9825400f 213 // pad charge
08a636a8 214 fCharge[i][cath] = digit->Signal();
9825400f 215 // pad centre coordinates
216// fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
217 // globals kUsed in fitting functions
218 fix[i][cath]=ix;
219 fiy[i][cath]=iy;
220 // total charge per cluster
221 qtot+=fCharge[i][cath];
e357fc46 222 // Current z
223 Float_t xc, yc;
a713db22 224 if (fSegmentationType == 1)
225 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
226 else
227 fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ);
228
9825400f 229 } // loop over cluster digits
230 fQtot[cath]=qtot;
231 fChargeTot[cath]=Int_t(qtot);
232 } // loop over cathodes
233}
234
235
236
237Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
238{
a1b02be9 239// Compute the charge on first cathod only.
240return DiscrChargeCombiS1(i,par,0);
9825400f 241}
242
243Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
244{
245// par[0] x-position of cluster
246// par[1] y-position of cluster
247
a713db22 248 Float_t q1;
249 if (fSegmentationType == 1) {
250
251 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
252 // First Cluster
253 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
254 q1 = fgMathieson->IntXY(fSegmentation[cath]);
255
256 } else {
257
258 fSegmentation2[cath]->SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
259 // First Cluster
260 fSegmentation2[cath]->SetHit(fDetElemId, par[0],par[1],fZ);
261 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
262 }
9825400f 263
264 Float_t value = fQtot[cath]*q1;
265 return value;
266}
267
268
269Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
270{
271// par[0] x-position of first cluster
272// par[1] y-position of first cluster
273// par[2] x-position of second cluster
274// par[3] y-position of second cluster
275// par[4] charge fraction of first cluster
276// 1-par[4] charge fraction of second cluster
277
a713db22 278 Float_t q1, q2;
279
280 if (fSegmentationType == 1) {
281
282 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
283 // First Cluster
284 fSegmentation[0]->SetHit(par[0],par[1],fZ);
285 q1 = fgMathieson->IntXY(fSegmentation[0]);
9825400f 286
a713db22 287 // Second Cluster
288 fSegmentation[0]->SetHit(par[2],par[3],fZ);
289 q2 = fgMathieson->IntXY(fSegmentation[0]);
290
291 } else {
292
293 fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]);
294 // First Cluster
295 fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ);
296 q1 = fgMathieson->IntXY(fSegmentation[0]);
9825400f 297
a713db22 298 // Second Cluster
299 fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ);
300 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
301 }
302
303 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
304 return value;
9825400f 305}
306
307Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
308{
309// par[0] x-position of first cluster
310// par[1] y-position of first cluster
311// par[2] x-position of second cluster
312// par[3] y-position of second cluster
a1b02be9 313// par[4] charge fraction of first cluster - first cathode
314// 1-par[4] charge fraction of second cluster
315// par[5] charge fraction of first cluster - second cathode
9825400f 316
a713db22 317 Float_t q1, q2;
318
319 if (fSegmentationType == 1) {
320
321 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
322 // First Cluster
323 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
324 q1 = fgMathieson->IntXY(fSegmentation[cath]);
9825400f 325
a713db22 326 // Second Cluster
327 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
328 q2 = fgMathieson->IntXY(fSegmentation[cath]);
329
330 } else {
331 fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]);
332 // First Cluster
333 fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ);
334 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
335
336 // Second Cluster
337 fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ);
338 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
339 }
340 Float_t value;
341 if (cath==0) {
342 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
343 } else {
344 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
345 }
346 return value;
9825400f 347}
348
6a9bc541 349AliMUONClusterInput& AliMUONClusterInput
30178c30 350::operator = (const AliMUONClusterInput& rhs)
6a9bc541 351{
30178c30 352// Protected assignement operator
353
354 if (this == &rhs) return *this;
355
8c343c7c 356 AliFatal("Not implemented.");
30178c30 357
358 return *this;
6a9bc541 359}