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.2 2000/06/28 12:19:18 morsch
19 More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
20 cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
21 AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
22 It requires two cathode planes. Small modifications in the code will make it usable for
23 one cathode plane and, hence, more general (for test beam data).
24 AliMUONClusterFinder is now obsolete.
26 Revision 1.1 2000/06/28 08:06:10 morsch
27 Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
28 algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
29 It also naturally takes care of the TMinuit instance.
34 #include "AliMUONChamber.h"
35 #include "AliMUONClusterInput.h"
36 #include "AliMUONSegmentation.h"
37 #include "AliMUONResponse.h"
38 #include "AliMUONRawCluster.h"
39 #include "AliMUONDigit.h"
41 #include <TClonesArray.h>
44 ClassImp(AliMUONClusterInput)
46 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
47 TMinuit* AliMUONClusterInput::fgMinuit = 0;
49 AliMUONClusterInput* AliMUONClusterInput::Instance()
51 // return pointer to the singleton instance
52 if (fgClusterInput == 0) {
53 fgClusterInput = new AliMUONClusterInput();
54 fgMinuit = new TMinuit(5);
57 return fgClusterInput;
60 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
62 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
66 fNDigits[0]=dig1->GetEntriesFast();
67 fNDigits[1]=dig2->GetEntriesFast();
70 AliMUONChamber* iChamber;
72 pMUON = (AliMUON*) gAlice->GetModule("MUON");
73 iChamber = &(pMUON->Chamber(chamber));
75 fSegmentation[0]=iChamber->SegmentationModel(1);
76 fSegmentation[1]=iChamber->SegmentationModel(2);
77 fResponse=iChamber->ResponseModel();
81 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
83 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
86 AliMUONChamber* iChamber;
88 pMUON = (AliMUON*) gAlice->GetModule("MUON");
89 iChamber = &(pMUON->Chamber(chamber));
91 fSegmentation[0]=iChamber->SegmentationModel(1);
92 fResponse=iChamber->ResponseModel();
96 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
98 // Set the current cluster
99 printf("\n %p \n", cluster);
102 Int_t i, cath, ix, iy;
104 fNmul[0]=cluster->fMultiplicity[0];
105 fNmul[1]=cluster->fMultiplicity[1];
106 printf("\n %p %p ", fDigits[0], fDigits[1]);
108 for (cath=0; cath<2; cath++) {
110 for (i=0; i<fNmul[cath]; i++) {
112 digit =(AliMUONDigit*)
113 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
118 fCharge[i][cath] = digit->fSignal;
119 // pad centre coordinates
120 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
121 // globals kUsed in fitting functions
124 // total charge per cluster
125 qtot+=fCharge[i][cath];
126 } // loop over cluster digits
128 fChargeTot[cath]=Int_t(qtot);
129 } // loop over cathodes
134 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
136 // par[0] x-position of cluster
137 // par[1] y-position of cluster
139 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
141 fSegmentation[0]->SetHit(par[0],par[1],0);
142 Float_t q1=fResponse->IntXY(fSegmentation[0]);
144 Float_t value = fQtot[0]*q1;
148 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
150 // par[0] x-position of cluster
151 // par[1] y-position of cluster
153 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
155 fSegmentation[cath]->SetHit(par[0],par[1],0);
156 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
158 Float_t value = fQtot[cath]*q1;
163 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
165 // par[0] x-position of first cluster
166 // par[1] y-position of first cluster
167 // par[2] x-position of second cluster
168 // par[3] y-position of second cluster
169 // par[4] charge fraction of first cluster
170 // 1-par[4] charge fraction of second cluster
172 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
174 fSegmentation[0]->SetHit(par[0],par[1],0);
175 Float_t q1=fResponse->IntXY(fSegmentation[0]);
178 fSegmentation[0]->SetHit(par[2],par[3],0);
179 Float_t q2=fResponse->IntXY(fSegmentation[0]);
181 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
185 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
187 // par[0] x-position of first cluster
188 // par[1] y-position of first cluster
189 // par[2] x-position of second cluster
190 // par[3] y-position of second cluster
191 // par[4] charge fraction of first cluster
192 // 1-par[4] charge fraction of second cluster
194 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
196 fSegmentation[cath]->SetHit(par[0],par[1],0);
197 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
200 fSegmentation[cath]->SetHit(par[2],par[3],0);
201 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
204 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
206 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
211 void AliMUONClusterInput::Streamer(TBuffer &R__b) {}