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