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.5 2000/10/02 16:58:29 egangler
19 Cleaning of the code :
22 -> some useless includes removed or replaced by "class" statement
24 Revision 1.4 2000/07/03 11:54:57 morsch
25 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
26 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
28 Revision 1.3 2000/06/28 15:16:35 morsch
29 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
30 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
31 framework. The changes should have no side effects (mostly dummy arguments).
32 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
33 of chambers with overlapping modules (MakePadHits, Disintegration).
35 Revision 1.2 2000/06/28 12:19:18 morsch
36 More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
37 cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
38 AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
39 It requires two cathode planes. Small modifications in the code will make it usable for
40 one cathode plane and, hence, more general (for test beam data).
41 AliMUONClusterFinder is now obsolete.
43 Revision 1.1 2000/06/28 08:06:10 morsch
44 Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
45 algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
46 It also naturally takes care of the TMinuit instance.
51 #include "AliMUONChamber.h"
52 #include "AliMUONClusterInput.h"
53 #include "AliSegmentation.h"
54 #include "AliMUONResponse.h"
55 #include "AliMUONRawCluster.h"
56 #include "AliMUONDigit.h"
58 #include <TClonesArray.h>
61 ClassImp(AliMUONClusterInput)
63 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
64 TMinuit* AliMUONClusterInput::fgMinuit = 0;
66 AliMUONClusterInput* AliMUONClusterInput::Instance()
68 // return pointer to the singleton instance
69 if (fgClusterInput == 0) {
70 fgClusterInput = new AliMUONClusterInput();
71 fgMinuit = new TMinuit(8);
74 return fgClusterInput;
77 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
79 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
83 fNDigits[0]=dig1->GetEntriesFast();
84 fNDigits[1]=dig2->GetEntriesFast();
87 AliMUONChamber* iChamber;
89 pMUON = (AliMUON*) gAlice->GetModule("MUON");
90 iChamber = &(pMUON->Chamber(chamber));
92 fSegmentation[0]=iChamber->SegmentationModel(1);
93 fSegmentation[1]=iChamber->SegmentationModel(2);
94 fResponse=iChamber->ResponseModel();
98 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
100 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
103 AliMUONChamber* iChamber;
105 pMUON = (AliMUON*) gAlice->GetModule("MUON");
106 iChamber = &(pMUON->Chamber(chamber));
108 fSegmentation[0]=iChamber->SegmentationModel(1);
109 fResponse=iChamber->ResponseModel();
113 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
115 // Set the current cluster
116 printf("\n %p \n", cluster);
119 Int_t i, cath, ix, iy;
121 fNmul[0]=cluster->fMultiplicity[0];
122 fNmul[1]=cluster->fMultiplicity[1];
123 printf("\n %p %p ", fDigits[0], fDigits[1]);
125 for (cath=0; cath<2; cath++) {
127 for (i=0; i<fNmul[cath]; i++) {
129 digit =(AliMUONDigit*)
130 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
135 fCharge[i][cath] = digit->fSignal;
136 // pad centre coordinates
137 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
138 // globals kUsed in fitting functions
141 // total charge per cluster
142 qtot+=fCharge[i][cath];
145 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
146 } // loop over cluster digits
148 fChargeTot[cath]=Int_t(qtot);
149 } // loop over cathodes
154 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
156 // par[0] x-position of cluster
157 // par[1] y-position of cluster
159 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
161 fSegmentation[0]->SetHit(par[0],par[1],fZ);
162 Float_t q1=fResponse->IntXY(fSegmentation[0]);
164 Float_t value = fQtot[0]*q1;
168 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
170 // par[0] x-position of cluster
171 // par[1] y-position of cluster
173 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
175 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
176 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
178 Float_t value = fQtot[cath]*q1;
183 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
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
192 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
194 fSegmentation[0]->SetHit(par[0],par[1],fZ);
195 Float_t q1=fResponse->IntXY(fSegmentation[0]);
198 fSegmentation[0]->SetHit(par[2],par[3],fZ);
199 Float_t q2=fResponse->IntXY(fSegmentation[0]);
201 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
205 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
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
214 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
216 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
217 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
220 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
221 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
224 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
226 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);