1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.9 2001/01/26 21:38:49 morsch
19 Use access functions to AliMUONDigit member data.
21 Revision 1.8 2001/01/23 18:58:19 hristov
22 Initialisation of some pointers
24 Revision 1.7 2000/12/21 22:14:38 morsch
25 Clean-up of coding rule violations.
27 Revision 1.6 2000/10/06 09:04:50 morsch
29 - Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate
30 to make code work with slat chambers.
32 Revision 1.5 2000/10/02 16:58:29 egangler
33 Cleaning of the code :
36 -> some useless includes removed or replaced by "class" statement
38 Revision 1.4 2000/07/03 11:54:57 morsch
39 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
40 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
42 Revision 1.3 2000/06/28 15:16:35 morsch
43 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
44 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
45 framework. The changes should have no side effects (mostly dummy arguments).
46 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
47 of chambers with overlapping modules (MakePadHits, Disintegration).
49 Revision 1.2 2000/06/28 12:19:18 morsch
50 More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
51 cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
52 AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
53 It requires two cathode planes. Small modifications in the code will make it usable for
54 one cathode plane and, hence, more general (for test beam data).
55 AliMUONClusterFinder is now obsolete.
57 Revision 1.1 2000/06/28 08:06:10 morsch
58 Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
59 algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
60 It also naturally takes care of the TMinuit instance.
65 #include "AliMUONChamber.h"
66 #include "AliMUONClusterInput.h"
67 #include "AliSegmentation.h"
68 #include "AliMUONResponse.h"
69 #include "AliMUONRawCluster.h"
70 #include "AliMUONDigit.h"
72 #include <TClonesArray.h>
75 ClassImp(AliMUONClusterInput)
77 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
78 TMinuit* AliMUONClusterInput::fgMinuit = 0;
80 AliMUONClusterInput::AliMUONClusterInput(){
91 AliMUONClusterInput* AliMUONClusterInput::Instance()
93 // return pointer to the singleton instance
94 if (fgClusterInput == 0) {
95 fgClusterInput = new AliMUONClusterInput();
96 fgMinuit = new TMinuit(8);
99 return fgClusterInput;
102 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
104 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
108 fNDigits[0]=dig1->GetEntriesFast();
109 fNDigits[1]=dig2->GetEntriesFast();
112 AliMUONChamber* iChamber;
114 pMUON = (AliMUON*) gAlice->GetModule("MUON");
115 iChamber = &(pMUON->Chamber(chamber));
117 fSegmentation[0]=iChamber->SegmentationModel(1);
118 fSegmentation[1]=iChamber->SegmentationModel(2);
119 fResponse=iChamber->ResponseModel();
123 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
125 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
128 AliMUONChamber* iChamber;
130 pMUON = (AliMUON*) gAlice->GetModule("MUON");
131 iChamber = &(pMUON->Chamber(chamber));
133 fSegmentation[0]=iChamber->SegmentationModel(1);
134 fResponse=iChamber->ResponseModel();
138 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
140 // Set the current cluster
141 printf("\n %p \n", cluster);
144 Int_t i, cath, ix, iy;
146 fNmul[0]=cluster->fMultiplicity[0];
147 fNmul[1]=cluster->fMultiplicity[1];
148 printf("\n %p %p ", fDigits[0], fDigits[1]);
150 for (cath=0; cath<2; cath++) {
152 for (i=0; i<fNmul[cath]; i++) {
154 digit =(AliMUONDigit*)
155 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
160 fCharge[i][cath] = digit->Signal();
161 // pad centre coordinates
162 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
163 // globals kUsed in fitting functions
166 // total charge per cluster
167 qtot+=fCharge[i][cath];
170 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
171 } // loop over cluster digits
173 fChargeTot[cath]=Int_t(qtot);
174 } // loop over cathodes
179 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
181 // Compute the charge on first cathod only.
182 return DiscrChargeCombiS1(i,par,0);
185 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
187 // par[0] x-position of cluster
188 // par[1] y-position of cluster
190 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
192 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
193 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
195 Float_t value = fQtot[cath]*q1;
200 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
202 // par[0] x-position of first cluster
203 // par[1] y-position of first cluster
204 // par[2] x-position of second cluster
205 // par[3] y-position of second cluster
206 // par[4] charge fraction of first cluster
207 // 1-par[4] charge fraction of second cluster
209 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
211 fSegmentation[0]->SetHit(par[0],par[1],fZ);
212 Float_t q1=fResponse->IntXY(fSegmentation[0]);
215 fSegmentation[0]->SetHit(par[2],par[3],fZ);
216 Float_t q2=fResponse->IntXY(fSegmentation[0]);
218 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
222 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
224 // par[0] x-position of first cluster
225 // par[1] y-position of first cluster
226 // par[2] x-position of second cluster
227 // par[3] y-position of second cluster
228 // par[4] charge fraction of first cluster - first cathode
229 // 1-par[4] charge fraction of second cluster
230 // par[5] charge fraction of first cluster - second cathode
232 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
234 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
235 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
238 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
239 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
242 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
244 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
249 AliMUONClusterInput& AliMUONClusterInput
250 ::operator = (const AliMUONClusterInput& rhs)
252 // Dummy assignment operator