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