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 **************************************************************************/
21 #include "AliMUONChamber.h"
22 #include "AliMUONClusterInput.h"
23 #include "AliMUONSegmentation.h"
24 #include "AliMUONResponse.h"
25 #include "AliMUONRawCluster.h"
26 #include "AliMUONDigit.h"
28 #include <TClonesArray.h>
31 ClassImp(AliMUONClusterInput)
33 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
34 TMinuit* AliMUONClusterInput::fgMinuit = 0;
36 AliMUONClusterInput* AliMUONClusterInput::Instance()
38 // return pointer to the singleton instance
39 if (fgClusterInput == 0) {
40 fgClusterInput = new AliMUONClusterInput();
41 fgMinuit = new TMinuit(5);
44 return fgClusterInput;
47 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
49 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
53 AliMUONChamber* iChamber;
55 pMUON = (AliMUON*) gAlice->GetModule("MUON");
56 iChamber = &(pMUON->Chamber(chamber));
58 fSegmentation[0]=iChamber->SegmentationModel(1);
59 fSegmentation[1]=iChamber->SegmentationModel(2);
60 fResponse=iChamber->ResponseModel();
64 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
66 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
69 AliMUONChamber* iChamber;
71 pMUON = (AliMUON*) gAlice->GetModule("MUON");
72 iChamber = &(pMUON->Chamber(chamber));
74 fSegmentation[0]=iChamber->SegmentationModel(1);
75 fResponse=iChamber->ResponseModel();
79 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
81 // Set the current cluster
84 Int_t i, cath, ix, iy;
86 fNmul[0]=cluster->fMultiplicity[0];
87 fNmul[1]=cluster->fMultiplicity[1];
88 printf("\n %p %p ", fDigits[0], fDigits[1]);
90 for (cath=0; cath<2; cath++) {
92 for (i=0; i<fNmul[cath]; i++) {
94 digit =(AliMUONDigit*)
95 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
100 fCharge[i][cath] = digit->fSignal;
101 // pad centre coordinates
102 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
103 // globals kUsed in fitting functions
106 // total charge per cluster
107 qtot+=fCharge[i][cath];
108 } // loop over cluster digits
110 fChargeTot[cath]=Int_t(qtot);
111 } // loop over cathodes
116 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
118 // par[0] x-position of cluster
119 // par[1] y-position of cluster
121 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
123 fSegmentation[0]->SetHit(par[0],par[1]);
124 Float_t q1=fResponse->IntXY(fSegmentation[0]);
126 Float_t value = fQtot[0]*q1;
130 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
132 // par[0] x-position of cluster
133 // par[1] y-position of cluster
135 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
137 fSegmentation[cath]->SetHit(par[0],par[1]);
138 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
140 Float_t value = fQtot[cath]*q1;
145 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
147 // par[0] x-position of first cluster
148 // par[1] y-position of first cluster
149 // par[2] x-position of second cluster
150 // par[3] y-position of second cluster
151 // par[4] charge fraction of first cluster
152 // 1-par[4] charge fraction of second cluster
154 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
156 fSegmentation[0]->SetHit(par[0],par[1]);
157 Float_t q1=fResponse->IntXY(fSegmentation[0]);
160 fSegmentation[0]->SetHit(par[2],par[3]);
161 Float_t q2=fResponse->IntXY(fSegmentation[0]);
163 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
167 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
169 // par[0] x-position of first cluster
170 // par[1] y-position of first cluster
171 // par[2] x-position of second cluster
172 // par[3] y-position of second cluster
173 // par[4] charge fraction of first cluster
174 // 1-par[4] charge fraction of second cluster
176 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
178 fSegmentation[cath]->SetHit(par[0],par[1]);
179 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
182 fSegmentation[cath]->SetHit(par[2],par[3]);
183 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
186 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
188 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);