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>
40 #include <TGeoManager.h>
43 ClassImp(AliMUONClusterInput)
46 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
47 TMinuit* AliMUONClusterInput::fgMinuit = 0;
48 AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0;
49 AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0;
50 AliMUONSegmentation* AliMUONClusterInput::fgSegmentation = 0;
52 //______________________________________________________________________________
53 AliMUONClusterInput::AliMUONClusterInput()
63 /// Default constructor
71 //______________________________________________________________________________
72 AliMUONClusterInput* AliMUONClusterInput::Instance()
74 /// return pointer to the singleton instance
75 if (fgClusterInput == 0) {
76 fgClusterInput = new AliMUONClusterInput();
77 fgMinuit = new TMinuit(8);
79 // Create segmentation with activated Root geometry
80 if ( ! gGeoManager ) {
81 AliFatalClass("Geometry not loaded.");
82 return fgClusterInput;
84 fgTransformer = new AliMUONGeometryTransformer(true);
85 fgTransformer->ReadGeometryData("volpath.dat", gGeoManager);
86 AliMUONSegFactory factory(fgTransformer);
87 fgSegmentation = factory.CreateSegmentation();
90 return fgClusterInput;
93 //______________________________________________________________________________
94 AliMUONClusterInput::~AliMUONClusterInput()
100 delete fgSegmentation;
105 //______________________________________________________________________________
106 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
108 /// Set pointer to digits with corresponding segmentations and responses (two cathode planes)
113 fNDigits[0] = dig1->GetEntriesFast();
114 fNDigits[1] = dig2->GetEntriesFast();
117 fgMathieson = new AliMUONMathieson();
119 fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
120 fSegmentation2[1]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 1);
123 if (chamber < AliMUONConstants::NTrackingCh()) {
125 fgMathieson->SetPitch(AliMUONConstants::Pitch());
126 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
127 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
128 fChargeCorrel = AliMUONConstants::ChargeCorrel();
130 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
131 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
132 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
133 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
138 //______________________________________________________________________________
139 void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig)
141 /// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
147 fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
151 //______________________________________________________________________________
152 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
154 /// Set the current cluster
155 //PH printf("\n %p \n", cluster);
158 Int_t i, cath, ix, iy;
160 fNmul[0]=cluster->GetMultiplicity(0);
161 fNmul[1]=cluster->GetMultiplicity(1);
162 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
164 for (cath=0; cath<2; cath++) {
166 for (i=0; i<fNmul[cath]; i++) {
168 digit =(AliMUONDigit*)
169 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
174 fCharge[i][cath] = digit->Signal();
175 // pad centre coordinates
176 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
177 // globals kUsed in fitting functions
180 // total charge per cluster
181 qtot+=fCharge[i][cath];
184 fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ);
185 } // loop over cluster digits
187 fChargeTot[cath]=Int_t(qtot);
188 } // loop over cathodes
191 //______________________________________________________________________________
192 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
194 /// Compute the charge on first cathod only.
195 return DiscrChargeCombiS1(i,par,0);
198 //______________________________________________________________________________
199 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
201 /// \todo add comment
202 /// - par[0] x-position of cluster
203 /// - param par[1] y-position of cluster
206 fSegmentation2[cath]-> SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
208 fSegmentation2[cath]-> SetHit(fDetElemId, par[0],par[1],fZ);
209 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
211 Float_t value = fQtot[cath]*q1;
216 //______________________________________________________________________________
217 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
219 /// \todo add comment
220 /// - par[0] x-position of first cluster
221 /// - par[1] y-position of first cluster
222 /// - par[2] x-position of second cluster
223 /// - par[3] y-position of second cluster
224 /// - par[4] charge fraction of first cluster
225 /// - 1-par[4] charge fraction of second cluster
229 fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]);
231 fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ);
232 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
235 fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ);
236 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
238 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
242 //______________________________________________________________________________
243 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
245 /// \todo add comment
246 /// - par[0] x-position of first cluster
247 /// - par[1] y-position of first cluster
248 /// - par[2] x-position of second cluster
249 /// - par[3] y-position of second cluster
250 /// - par[4] charge fraction of first cluster - first cathode
251 /// - 1-par[4] charge fraction of second cluster
252 /// - par[5] charge fraction of first cluster - second cathode
256 fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]);
258 fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ);
259 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
262 fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ);
263 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
267 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
269 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);