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