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