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>
42 ClassImp(AliMUONClusterInput)
45 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
46 TMinuit* AliMUONClusterInput::fgMinuit = 0;
47 AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0;
48 AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0;
49 AliMUONSegmentation* AliMUONClusterInput::fgSegmentation = 0;
51 //______________________________________________________________________________
52 AliMUONClusterInput::AliMUONClusterInput()
62 /// Default constructor
70 //______________________________________________________________________________
71 AliMUONClusterInput* AliMUONClusterInput::Instance()
73 /// return pointer to the singleton instance
74 if (fgClusterInput == 0) {
75 fgClusterInput = new AliMUONClusterInput();
76 fgMinuit = new TMinuit(8);
78 // Create segmentation with activated Root geometry
79 if ( ! gGeoManager ) {
80 AliFatalClass("Geometry not loaded.");
81 return fgClusterInput;
83 fgTransformer = new AliMUONGeometryTransformer(true);
84 fgTransformer->ReadGeometryData("volpath.dat", gGeoManager);
85 AliMUONSegFactory factory(fgTransformer);
86 fgSegmentation = factory.CreateSegmentation();
89 return fgClusterInput;
92 //______________________________________________________________________________
93 AliMUONClusterInput::~AliMUONClusterInput()
99 delete fgSegmentation;
104 //______________________________________________________________________________
105 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
107 /// Set pointer to digits with corresponding segmentations and responses (two cathode planes)
112 fNDigits[0] = dig1->GetEntriesFast();
113 fNDigits[1] = dig2->GetEntriesFast();
116 fgMathieson = new AliMUONMathieson();
118 fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
119 fSegmentation2[1]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 1);
122 if (chamber < AliMUONConstants::NTrackingCh()) {
124 fgMathieson->SetPitch(AliMUONConstants::Pitch());
125 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
126 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
127 fChargeCorrel = AliMUONConstants::ChargeCorrel();
129 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
130 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
131 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
132 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
137 //______________________________________________________________________________
138 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig)
140 /// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
146 fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
150 //______________________________________________________________________________
151 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
153 /// Set the current cluster
154 //PH printf("\n %p \n", cluster);
157 Int_t i, cath, ix, iy;
159 fNmul[0]=cluster->GetMultiplicity(0);
160 fNmul[1]=cluster->GetMultiplicity(1);
161 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
163 for (cath=0; cath<2; cath++) {
165 for (i=0; i<fNmul[cath]; i++) {
167 digit =(AliMUONDigit*)
168 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
173 fCharge[i][cath] = digit->Signal();
174 // pad centre coordinates
175 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
176 // globals kUsed in fitting functions
179 // total charge per cluster
180 qtot+=fCharge[i][cath];
183 fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ);
184 } // loop over cluster digits
186 fChargeTot[cath]=Int_t(qtot);
187 } // loop over cathodes
190 //______________________________________________________________________________
191 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
193 /// Compute the charge on first cathod only.
194 return DiscrChargeCombiS1(i,par,0);
197 //______________________________________________________________________________
198 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
200 /// \todo add comment
201 /// - par[0] x-position of cluster
202 /// - param par[1] y-position of cluster
205 fSegmentation2[cath]-> SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
207 fSegmentation2[cath]-> SetHit(fDetElemId, par[0],par[1],fZ);
208 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
210 Float_t value = fQtot[cath]*q1;
215 //______________________________________________________________________________
216 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
218 /// \todo add comment
219 /// - par[0] x-position of first cluster
220 /// - par[1] y-position of first cluster
221 /// - par[2] x-position of second cluster
222 /// - par[3] y-position of second cluster
223 /// - par[4] charge fraction of first cluster
224 /// - 1-par[4] charge fraction of second cluster
228 fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]);
230 fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ);
231 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
234 fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ);
235 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
237 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
241 //______________________________________________________________________________
242 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
244 /// \todo add comment
245 /// - par[0] x-position of first cluster
246 /// - par[1] y-position of first cluster
247 /// - par[2] x-position of second cluster
248 /// - par[3] y-position of second cluster
249 /// - par[4] charge fraction of first cluster - first cathode
250 /// - 1-par[4] charge fraction of second cluster
251 /// - par[5] charge fraction of first cluster - second cathode
255 fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]);
257 fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ);
258 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
261 fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ);
262 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
266 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
268 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);