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 // ----------------------------
19 // Class AliMUONClusterInput
20 // ----------------------------
21 // Global data service for hit reconstruction
22 // Author: to be added
24 #include "AliMUONClusterInput.h"
26 #include "AliMUONGeometryTransformer.h"
27 #include "AliMUONGeometrySegmentation.h"
28 #include "AliMUONSegFactory.h"
29 #include "AliMUONSegmentation.h"
30 #include "AliMUONConstants.h"
31 #include "AliMUONMathieson.h"
32 #include "AliMUONRawCluster.h"
33 #include "AliMUONDigit.h"
37 #include <TClonesArray.h>
39 #include <TGeoManager.h>
41 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
42 TMinuit* AliMUONClusterInput::fgMinuit = 0;
43 AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0;
44 AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0;
45 AliMUONSegmentation* AliMUONClusterInput::fgSegmentation = 0;
47 ClassImp(AliMUONClusterInput)
49 AliMUONClusterInput::AliMUONClusterInput()
56 // Default constructor
64 AliMUONClusterInput* AliMUONClusterInput::Instance()
66 // return pointer to the singleton instance
67 if (fgClusterInput == 0) {
68 fgClusterInput = new AliMUONClusterInput();
69 fgMinuit = new TMinuit(8);
71 // Create segmentation with activated Root geometry
72 if ( ! gGeoManager ) {
73 AliFatalClass("Geometry not loaded.");
74 return fgClusterInput;
76 fgTransformer = new AliMUONGeometryTransformer(true);
77 fgTransformer->ReadGeometryData("volpath.dat", gGeoManager);
78 AliMUONSegFactory factory(fgTransformer);
79 fgSegmentation = factory.CreateSegmentation();
82 return fgClusterInput;
85 AliMUONClusterInput::~AliMUONClusterInput()
91 delete fgSegmentation;
96 AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
98 // Protected copy constructor
100 AliFatal("Not implemented.");
103 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
105 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
110 fNDigits[0] = dig1->GetEntriesFast();
111 fNDigits[1] = dig2->GetEntriesFast();
114 fgMathieson = new AliMUONMathieson();
116 fSegmentation2[0]= fgSegmentation->GetModuleSegmentation(chamber, 0);
117 fSegmentation2[1]= fgSegmentation->GetModuleSegmentation(chamber, 1);
120 if (chamber < AliMUONConstants::NTrackingCh()) {
122 fgMathieson->SetPitch(AliMUONConstants::Pitch());
123 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
124 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
125 fChargeCorrel = AliMUONConstants::ChargeCorrel();
127 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
128 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
129 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
130 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
135 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig)
137 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
143 fSegmentation2[0]= fgSegmentation->GetModuleSegmentation(chamber, 0);
147 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
149 // Set the current cluster
150 //PH printf("\n %p \n", cluster);
153 Int_t i, cath, ix, iy;
155 fNmul[0]=cluster->GetMultiplicity(0);
156 fNmul[1]=cluster->GetMultiplicity(1);
157 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
159 for (cath=0; cath<2; cath++) {
161 for (i=0; i<fNmul[cath]; i++) {
163 digit =(AliMUONDigit*)
164 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
169 fCharge[i][cath] = digit->Signal();
170 // pad centre coordinates
171 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
172 // globals kUsed in fitting functions
175 // total charge per cluster
176 qtot+=fCharge[i][cath];
179 fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ);
180 } // loop over cluster digits
182 fChargeTot[cath]=Int_t(qtot);
183 } // loop over cathodes
188 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
190 // Compute the charge on first cathod only.
191 return DiscrChargeCombiS1(i,par,0);
194 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
196 // par[0] x-position of cluster
197 // par[1] y-position of cluster
200 fSegmentation2[cath]->SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
202 fSegmentation2[cath]->SetHit(fDetElemId, par[0],par[1],fZ);
203 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
205 Float_t value = fQtot[cath]*q1;
210 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
212 // par[0] x-position of first cluster
213 // par[1] y-position of first cluster
214 // par[2] x-position of second cluster
215 // par[3] y-position of second cluster
216 // par[4] charge fraction of first cluster
217 // 1-par[4] charge fraction of second cluster
221 fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]);
223 fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ);
224 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
227 fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ);
228 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
230 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
234 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
236 // par[0] x-position of first cluster
237 // par[1] y-position of first cluster
238 // par[2] x-position of second cluster
239 // par[3] y-position of second cluster
240 // par[4] charge fraction of first cluster - first cathode
241 // 1-par[4] charge fraction of second cluster
242 // par[5] charge fraction of first cluster - second cathode
246 fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]);
248 fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ);
249 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
252 fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ);
253 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
257 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
259 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
264 AliMUONClusterInput& AliMUONClusterInput
265 ::operator = (const AliMUONClusterInput& rhs)
267 // Protected assignement operator
269 if (this == &rhs) return *this;
271 AliFatal("Not implemented.");