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 "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()
40 fChargeCorrel(1.) // in case not defined
49 AliMUONClusterInput* AliMUONClusterInput::Instance()
51 // return pointer to the singleton instance
52 if (fgClusterInput == 0) {
53 fgClusterInput = new AliMUONClusterInput();
54 fgMinuit = new TMinuit(8);
57 return fgClusterInput;
60 AliMUONClusterInput::~AliMUONClusterInput()
67 AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
69 // Protected copy constructor
71 AliFatal("Not implemented.");
74 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
76 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
80 fNDigits[0]=dig1->GetEntriesFast();
81 fNDigits[1]=dig2->GetEntriesFast();
84 AliMUONChamber* iChamber;
86 pMUON = (AliMUON*) gAlice->GetModule("MUON");
87 iChamber = &(pMUON->Chamber(chamber));
89 fgMathieson = new AliMUONMathieson();
90 fSegmentation[0]=iChamber->SegmentationModel(1);
91 fSegmentation[1]=iChamber->SegmentationModel(2);
93 if (chamber < AliMUONConstants::NTrackingCh()) {
95 fgMathieson->SetPitch(AliMUONConstants::PitchSlat());
96 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3Slat());
97 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3Slat());
98 fChargeCorrel = AliMUONConstants::ChargeCorrelSlat();
100 fgMathieson->SetPitch(AliMUONConstants::PitchSt12());
101 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St12());
102 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St12());
103 fChargeCorrel = AliMUONConstants::ChargeCorrelSt12();
108 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
110 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
113 AliMUONChamber* iChamber;
115 pMUON = (AliMUON*) gAlice->GetModule("MUON");
116 iChamber = &(pMUON->Chamber(chamber));
118 fSegmentation[0]=iChamber->SegmentationModel(1);
122 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
124 // Set the current cluster
125 //PH printf("\n %p \n", cluster);
128 Int_t i, cath, ix, iy;
130 fNmul[0]=cluster->GetMultiplicity(0);
131 fNmul[1]=cluster->GetMultiplicity(1);
132 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
134 for (cath=0; cath<2; cath++) {
136 for (i=0; i<fNmul[cath]; i++) {
138 digit =(AliMUONDigit*)
139 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
144 fCharge[i][cath] = digit->Signal();
145 // pad centre coordinates
146 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
147 // globals kUsed in fitting functions
150 // total charge per cluster
151 qtot+=fCharge[i][cath];
154 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
155 } // loop over cluster digits
157 fChargeTot[cath]=Int_t(qtot);
158 } // loop over cathodes
163 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
165 // Compute the charge on first cathod only.
166 return DiscrChargeCombiS1(i,par,0);
169 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
171 // par[0] x-position of cluster
172 // par[1] y-position of cluster
174 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
176 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
177 Float_t q1=fgMathieson->IntXY(fSegmentation[cath]);
179 Float_t value = fQtot[cath]*q1;
184 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
186 // par[0] x-position of first cluster
187 // par[1] y-position of first cluster
188 // par[2] x-position of second cluster
189 // par[3] y-position of second cluster
190 // par[4] charge fraction of first cluster
191 // 1-par[4] charge fraction of second cluster
193 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
195 fSegmentation[0]->SetHit(par[0],par[1],fZ);
196 Float_t q1=fgMathieson->IntXY(fSegmentation[0]);
199 fSegmentation[0]->SetHit(par[2],par[3],fZ);
200 Float_t q2=fgMathieson->IntXY(fSegmentation[0]);
202 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
206 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
208 // par[0] x-position of first cluster
209 // par[1] y-position of first cluster
210 // par[2] x-position of second cluster
211 // par[3] y-position of second cluster
212 // par[4] charge fraction of first cluster - first cathode
213 // 1-par[4] charge fraction of second cluster
214 // par[5] charge fraction of first cluster - second cathode
216 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
218 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
219 Float_t q1=fgMathieson->IntXY(fSegmentation[cath]);
222 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
223 Float_t q2=fgMathieson->IntXY(fSegmentation[cath]);
226 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
228 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
233 AliMUONClusterInput& AliMUONClusterInput
234 ::operator = (const AliMUONClusterInput& rhs)
236 // Protected assignement operator
238 if (this == &rhs) return *this;
240 AliFatal("Not implemented.");