Change of argument list of methods GetPadCxy, GetPadIxy, SetHit and FirstPad
[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
16/*
17$Log$
30aaba74 18Revision 1.1 2000/06/28 08:06:10 morsch
19Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
20algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
21It also naturally takes care of the TMinuit instance.
22
9825400f 23*/
24#include "AliRun.h"
25#include "AliMUON.h"
26#include "AliMUONChamber.h"
27#include "AliMUONClusterInput.h"
28#include "AliMUONSegmentation.h"
29#include "AliMUONResponse.h"
30#include "AliMUONRawCluster.h"
31#include "AliMUONDigit.h"
32
33#include <TClonesArray.h>
34#include <TMinuit.h>
35
36ClassImp(AliMUONClusterInput)
37
38AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
39TMinuit* AliMUONClusterInput::fgMinuit = 0;
40
41AliMUONClusterInput* AliMUONClusterInput::Instance()
42{
43// return pointer to the singleton instance
44 if (fgClusterInput == 0) {
45 fgClusterInput = new AliMUONClusterInput();
46 fgMinuit = new TMinuit(5);
47 }
48
49 return fgClusterInput;
50}
51
52void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
53{
54// Set pointer to digits with corresponding segmentations and responses (two cathode planes)
30aaba74 55 fChamber=chamber;
9825400f 56 fDigits[0]=dig1;
57 fDigits[1]=dig2;
30aaba74 58 fNDigits[0]=dig1->GetEntriesFast();
59 fNDigits[1]=dig2->GetEntriesFast();
60
9825400f 61 AliMUON *pMUON;
62 AliMUONChamber* iChamber;
63
64 pMUON = (AliMUON*) gAlice->GetModule("MUON");
65 iChamber = &(pMUON->Chamber(chamber));
66
67 fSegmentation[0]=iChamber->SegmentationModel(1);
68 fSegmentation[1]=iChamber->SegmentationModel(2);
69 fResponse=iChamber->ResponseModel();
70 fNseg = 2;
71}
72
73void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
74{
75// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
76 fDigits[0]=dig;
77 AliMUON *pMUON;
78 AliMUONChamber* iChamber;
79
80 pMUON = (AliMUON*) gAlice->GetModule("MUON");
81 iChamber = &(pMUON->Chamber(chamber));
82
83 fSegmentation[0]=iChamber->SegmentationModel(1);
84 fResponse=iChamber->ResponseModel();
85 fNseg=1;
86}
87
88void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
89{
90// Set the current cluster
30aaba74 91 printf("\n %p \n", cluster);
9825400f 92 fCluster=cluster;
93 Float_t qtot;
94 Int_t i, cath, ix, iy;
95 AliMUONDigit* digit;
96 fNmul[0]=cluster->fMultiplicity[0];
97 fNmul[1]=cluster->fMultiplicity[1];
98 printf("\n %p %p ", fDigits[0], fDigits[1]);
99
100 for (cath=0; cath<2; cath++) {
101 qtot=0;
102 for (i=0; i<fNmul[cath]; i++) {
103 // pointer to digit
104 digit =(AliMUONDigit*)
105 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
106 // pad coordinates
107 ix = digit->fPadX;
108 iy = digit->fPadY;
109 // pad charge
110 fCharge[i][cath] = digit->fSignal;
111 // pad centre coordinates
112// fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
113 // globals kUsed in fitting functions
114 fix[i][cath]=ix;
115 fiy[i][cath]=iy;
116 // total charge per cluster
117 qtot+=fCharge[i][cath];
118 } // loop over cluster digits
119 fQtot[cath]=qtot;
120 fChargeTot[cath]=Int_t(qtot);
121 } // loop over cathodes
122}
123
124
125
126Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
127{
128// par[0] x-position of cluster
129// par[1] y-position of cluster
130
131 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
132// First Cluster
133 fSegmentation[0]->SetHit(par[0],par[1]);
134 Float_t q1=fResponse->IntXY(fSegmentation[0]);
135
136 Float_t value = fQtot[0]*q1;
137 return value;
138}
139
140Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
141{
142// par[0] x-position of cluster
143// par[1] y-position of cluster
144
145 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
146// First Cluster
147 fSegmentation[cath]->SetHit(par[0],par[1]);
148 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
149
150 Float_t value = fQtot[cath]*q1;
151 return value;
152}
153
154
155Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
156{
157// par[0] x-position of first cluster
158// par[1] y-position of first cluster
159// par[2] x-position of second cluster
160// par[3] y-position of second cluster
161// par[4] charge fraction of first cluster
162// 1-par[4] charge fraction of second cluster
163
164 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
165// First Cluster
166 fSegmentation[0]->SetHit(par[0],par[1]);
167 Float_t q1=fResponse->IntXY(fSegmentation[0]);
168
169// Second Cluster
170 fSegmentation[0]->SetHit(par[2],par[3]);
171 Float_t q2=fResponse->IntXY(fSegmentation[0]);
172
173 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
174 return value;
175}
176
177Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
178{
179// par[0] x-position of first cluster
180// par[1] y-position of first cluster
181// par[2] x-position of second cluster
182// par[3] y-position of second cluster
183// par[4] charge fraction of first cluster
184// 1-par[4] charge fraction of second cluster
185
186 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
187// First Cluster
188 fSegmentation[cath]->SetHit(par[0],par[1]);
189 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
190
191// Second Cluster
192 fSegmentation[cath]->SetHit(par[2],par[3]);
193 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
194 Float_t value;
195 if (cath==0) {
196 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
197 } else {
198 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
199 }
200 return value;
201}
202
30aaba74 203void AliMUONClusterInput::Streamer(TBuffer &R__b) {}
9825400f 204
205