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 "AliMUONSegmentation.h"
24 #include "AliMUONConstants.h"
25 #include "AliMUONClusterInput.h"
26 #include "AliMUONMathieson.h"
27 #include "AliMUONRawCluster.h"
28 #include "AliMUONDigit.h"
31 ClassImp(AliMUONClusterInput)
33 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
34 TMinuit* AliMUONClusterInput::fgMinuit = 0;
35 AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0;
37 AliMUONClusterInput::AliMUONClusterInput()
50 AliMUONClusterInput* AliMUONClusterInput::Instance()
52 // return pointer to the singleton instance
53 if (fgClusterInput == 0) {
54 fgClusterInput = new AliMUONClusterInput();
55 fgMinuit = new TMinuit(8);
58 return fgClusterInput;
61 AliMUONClusterInput::~AliMUONClusterInput()
68 AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
70 // Protected copy constructor
72 AliFatal("Not implemented.");
75 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
77 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
82 fNDigits[0] = dig1->GetEntriesFast();
83 fNDigits[1] = dig2->GetEntriesFast();
85 fgMathieson = new AliMUONMathieson();
88 AliMUONSegmentation* pSegmentation;
90 pMUON = (AliMUON*) gAlice->GetModule("MUON");
91 pSegmentation = pMUON->GetSegmentation();
92 fSegmentation2[0]= pSegmentation->GetModuleSegmentation(chamber, 0);
93 fSegmentation2[1]= pSegmentation->GetModuleSegmentation(chamber, 1);
96 if (chamber < AliMUONConstants::NTrackingCh()) {
98 fgMathieson->SetPitch(AliMUONConstants::Pitch());
99 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
100 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
101 fChargeCorrel = AliMUONConstants::ChargeCorrel();
103 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
104 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
105 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
106 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
111 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig)
113 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
120 AliMUONSegmentation* pSegmentation;
122 pMUON = (AliMUON*) gAlice->GetModule("MUON");
123 pSegmentation = pMUON->GetSegmentation();
124 fSegmentation2[0]= pSegmentation->GetModuleSegmentation(chamber, 0);
129 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
131 // Set the current cluster
132 //PH printf("\n %p \n", cluster);
135 Int_t i, cath, ix, iy;
137 fNmul[0]=cluster->GetMultiplicity(0);
138 fNmul[1]=cluster->GetMultiplicity(1);
139 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
141 for (cath=0; cath<2; cath++) {
143 for (i=0; i<fNmul[cath]; i++) {
145 digit =(AliMUONDigit*)
146 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
151 fCharge[i][cath] = digit->Signal();
152 // pad centre coordinates
153 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
154 // globals kUsed in fitting functions
157 // total charge per cluster
158 qtot+=fCharge[i][cath];
161 fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ);
162 } // loop over cluster digits
164 fChargeTot[cath]=Int_t(qtot);
165 } // loop over cathodes
170 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
172 // Compute the charge on first cathod only.
173 return DiscrChargeCombiS1(i,par,0);
176 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
178 // par[0] x-position of cluster
179 // par[1] y-position of cluster
182 fSegmentation2[cath]->SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
184 fSegmentation2[cath]->SetHit(fDetElemId, par[0],par[1],fZ);
185 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
187 Float_t value = fQtot[cath]*q1;
192 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
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
199 // 1-par[4] charge fraction of second cluster
203 fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]);
205 fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ);
206 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
209 fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ);
210 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
212 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
216 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
218 // par[0] x-position of first cluster
219 // par[1] y-position of first cluster
220 // par[2] x-position of second cluster
221 // par[3] y-position of second cluster
222 // par[4] charge fraction of first cluster - first cathode
223 // 1-par[4] charge fraction of second cluster
224 // par[5] charge fraction of first cluster - second cathode
228 fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]);
230 fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ);
231 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
234 fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ);
235 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
239 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
241 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
246 AliMUONClusterInput& AliMUONClusterInput
247 ::operator = (const AliMUONClusterInput& rhs)
249 // Protected assignement operator
251 if (this == &rhs) return *this;
253 AliFatal("Not implemented.");