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 #include <TClonesArray.h>
23 #include "AliMUONChamber.h"
24 #include "AliMUONClusterInput.h"
25 #include "AliMUONResponse.h"
26 #include "AliMUONRawCluster.h"
27 #include "AliMUONDigit.h"
30 ClassImp(AliMUONClusterInput)
32 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
33 TMinuit* AliMUONClusterInput::fgMinuit = 0;
35 AliMUONClusterInput::AliMUONClusterInput()
48 AliMUONClusterInput* AliMUONClusterInput::Instance()
50 // return pointer to the singleton instance
51 if (fgClusterInput == 0) {
52 fgClusterInput = new AliMUONClusterInput();
53 fgMinuit = new TMinuit(8);
56 return fgClusterInput;
59 AliMUONClusterInput::~AliMUONClusterInput()
65 AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
67 // Protected copy constructor
69 AliFatal("Not implemented.");
72 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
74 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
78 fNDigits[0]=dig1->GetEntriesFast();
79 fNDigits[1]=dig2->GetEntriesFast();
82 AliMUONChamber* iChamber;
84 pMUON = (AliMUON*) gAlice->GetModule("MUON");
85 iChamber = &(pMUON->Chamber(chamber));
87 fSegmentation[0]=iChamber->SegmentationModel(1);
88 fSegmentation[1]=iChamber->SegmentationModel(2);
89 fResponse=iChamber->ResponseModel();
93 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
95 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
98 AliMUONChamber* iChamber;
100 pMUON = (AliMUON*) gAlice->GetModule("MUON");
101 iChamber = &(pMUON->Chamber(chamber));
103 fSegmentation[0]=iChamber->SegmentationModel(1);
104 fResponse=iChamber->ResponseModel();
108 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
110 // Set the current cluster
111 //PH printf("\n %p \n", cluster);
114 Int_t i, cath, ix, iy;
116 fNmul[0]=cluster->GetMultiplicity(0);
117 fNmul[1]=cluster->GetMultiplicity(1);
118 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
120 for (cath=0; cath<2; cath++) {
122 for (i=0; i<fNmul[cath]; i++) {
124 digit =(AliMUONDigit*)
125 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
130 fCharge[i][cath] = digit->Signal();
131 // pad centre coordinates
132 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
133 // globals kUsed in fitting functions
136 // total charge per cluster
137 qtot+=fCharge[i][cath];
140 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
141 } // loop over cluster digits
143 fChargeTot[cath]=Int_t(qtot);
144 } // loop over cathodes
149 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
151 // Compute the charge on first cathod only.
152 return DiscrChargeCombiS1(i,par,0);
155 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
157 // par[0] x-position of cluster
158 // par[1] y-position of cluster
160 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
162 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
163 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
165 Float_t value = fQtot[cath]*q1;
170 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
172 // par[0] x-position of first cluster
173 // par[1] y-position of first cluster
174 // par[2] x-position of second cluster
175 // par[3] y-position of second cluster
176 // par[4] charge fraction of first cluster
177 // 1-par[4] charge fraction of second cluster
179 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
181 fSegmentation[0]->SetHit(par[0],par[1],fZ);
182 Float_t q1=fResponse->IntXY(fSegmentation[0]);
185 fSegmentation[0]->SetHit(par[2],par[3],fZ);
186 Float_t q2=fResponse->IntXY(fSegmentation[0]);
188 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
192 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
194 // par[0] x-position of first cluster
195 // par[1] y-position of first cluster
196 // par[2] x-position of second cluster
197 // par[3] y-position of second cluster
198 // par[4] charge fraction of first cluster - first cathode
199 // 1-par[4] charge fraction of second cluster
200 // par[5] charge fraction of first cluster - second cathode
202 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
204 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
205 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
208 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
209 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
212 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
214 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
219 AliMUONClusterInput& AliMUONClusterInput
220 ::operator = (const AliMUONClusterInput& rhs)
222 // Protected assignement operator
224 if (this == &rhs) return *this;
226 AliFatal("Not implemented.");