]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterInput.cxx
New versions of GDC and CDH raw data headers. Some CDH getters are added
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterInput.cxx
CommitLineData
9825400f 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
88cb7938 16/* $Id$ */
d4fa40b7 17
4dd5a4bf 18// ----------------------------
19// Class AliMUONClusterInput
20// ----------------------------
21// Global data service for hit reconstruction
22// Author: to be added
23
63ed9c6b 24#include "AliMUONClusterInput.h"
30178c30 25
4dd5a4bf 26#include "AliMUONGeometryTransformer.h"
27#include "AliMUONGeometrySegmentation.h"
28#include "AliMUONSegFactory.h"
b7ef3c96 29#include "AliMUONSegmentation.h"
7e4a628d 30#include "AliMUONConstants.h"
7e4a628d 31#include "AliMUONMathieson.h"
9825400f 32#include "AliMUONRawCluster.h"
33#include "AliMUONDigit.h"
63ed9c6b 34
8c343c7c 35#include "AliLog.h"
9825400f 36
63ed9c6b 37#include <TClonesArray.h>
38#include <TMinuit.h>
4dd5a4bf 39#include <TGeoManager.h>
9825400f 40
4dd5a4bf 41AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
42TMinuit* AliMUONClusterInput::fgMinuit = 0;
43AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0;
44AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0;
45AliMUONSegmentation* AliMUONClusterInput::fgSegmentation = 0;
9825400f 46
63ed9c6b 47ClassImp(AliMUONClusterInput)
48
30178c30 49AliMUONClusterInput::AliMUONClusterInput()
7e4a628d 50 : TObject(),
51 fCluster(0),
fed772f3 52 fChargeCorrel(1.),
fed772f3 53 fDetElemId(0)
b137f8b9 54
30178c30 55{
4dd5a4bf 56// Default constructor
57
3f5cf0b3 58 fDigits[0]=0;
59 fDigits[1]=0;
fed772f3 60 fSegmentation2[0]=0;
61 fSegmentation2[1]=0;
3f5cf0b3 62}
63
9825400f 64AliMUONClusterInput* AliMUONClusterInput::Instance()
65{
66// return pointer to the singleton instance
67 if (fgClusterInput == 0) {
68 fgClusterInput = new AliMUONClusterInput();
e357fc46 69 fgMinuit = new TMinuit(8);
4dd5a4bf 70
71 // Create segmentation with activated Root geometry
72 if ( ! gGeoManager ) {
73 AliFatalClass("Geometry not loaded.");
74 return fgClusterInput;
75 }
76 fgTransformer = new AliMUONGeometryTransformer(true);
77 fgTransformer->ReadGeometryData("volpath.dat", gGeoManager);
78 AliMUONSegFactory factory(fgTransformer);
79 fgSegmentation = factory.CreateSegmentation();
9825400f 80 }
81
82 return fgClusterInput;
83}
84
d4fa40b7 85AliMUONClusterInput::~AliMUONClusterInput()
86{
87// Destructor
88 delete fgMinuit;
7e4a628d 89 delete fgMathieson;
4dd5a4bf 90 delete fgTransformer;
91 delete fgSegmentation;
8fee0ce8 92 fgMinuit = 0;
93 fgMathieson = 0;
d4fa40b7 94}
30178c30 95
7b4177a6 96AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
97{
30178c30 98// Protected copy constructor
99
8c343c7c 100 AliFatal("Not implemented.");
7b4177a6 101}
d4fa40b7 102
a713db22 103void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
104{
105 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
106 fChamber = chamber;
107 fDetElemId = idDE;
108 fDigits[0] = dig1;
109 fDigits[1] = dig2;
110 fNDigits[0] = dig1->GetEntriesFast();
111 fNDigits[1] = dig2->GetEntriesFast();
112
8fee0ce8 113 delete fgMathieson;
b7ef3c96 114 fgMathieson = new AliMUONMathieson();
115
4dd5a4bf 116 fSegmentation2[0]= fgSegmentation->GetModuleSegmentation(chamber, 0);
117 fSegmentation2[1]= fgSegmentation->GetModuleSegmentation(chamber, 1);
a713db22 118
119 fNseg = 2;
120 if (chamber < AliMUONConstants::NTrackingCh()) {
121 if (chamber > 1 ) {
122 fgMathieson->SetPitch(AliMUONConstants::Pitch());
123 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
124 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
125 fChargeCorrel = AliMUONConstants::ChargeCorrel();
126 } else {
127 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
128 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
129 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
130 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
131 }
132 }
133}
134
135void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig)
136{
137// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
138
139 fChamber = chamber;
140 fDetElemId = idDE;
141 fDigits[0] = dig;
142
4dd5a4bf 143 fSegmentation2[0]= fgSegmentation->GetModuleSegmentation(chamber, 0);
9825400f 144 fNseg=1;
145}
146
147void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
148{
149// Set the current cluster
b137f8b9 150 //PH printf("\n %p \n", cluster);
151 fCluster=cluster;
152 Float_t qtot;
153 Int_t i, cath, ix, iy;
154 AliMUONDigit* digit;
155 fNmul[0]=cluster->GetMultiplicity(0);
156 fNmul[1]=cluster->GetMultiplicity(1);
157 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
158
159 for (cath=0; cath<2; cath++) {
160 qtot=0;
161 for (i=0; i<fNmul[cath]; i++) {
162 // pointer to digit
163 digit =(AliMUONDigit*)
0164904a 164 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
9825400f 165 // pad coordinates
08a636a8 166 ix = digit->PadX();
167 iy = digit->PadY();
9825400f 168 // pad charge
08a636a8 169 fCharge[i][cath] = digit->Signal();
9825400f 170 // pad centre coordinates
171// fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
172 // globals kUsed in fitting functions
173 fix[i][cath]=ix;
174 fiy[i][cath]=iy;
175 // total charge per cluster
176 qtot+=fCharge[i][cath];
e357fc46 177 // Current z
178 Float_t xc, yc;
002920d1 179 fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ);
9825400f 180 } // loop over cluster digits
181 fQtot[cath]=qtot;
182 fChargeTot[cath]=Int_t(qtot);
183 } // loop over cathodes
184}
185
186
187
188Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
189{
a1b02be9 190// Compute the charge on first cathod only.
191return DiscrChargeCombiS1(i,par,0);
9825400f 192}
193
194Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
195{
196// par[0] x-position of cluster
197// par[1] y-position of cluster
198
a713db22 199 Float_t q1;
002920d1 200 fSegmentation2[cath]->SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
201 // First Cluster
202 fSegmentation2[cath]->SetHit(fDetElemId, par[0],par[1],fZ);
203 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
204
9825400f 205 Float_t value = fQtot[cath]*q1;
206 return value;
207}
208
209
210Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
211{
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
218
a713db22 219 Float_t q1, q2;
220
002920d1 221 fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]);
222 // First Cluster
223 fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ);
224 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
225
226 // Second Cluster
227 fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ);
228 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
229
a713db22 230 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
231 return value;
9825400f 232}
233
234Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
235{
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
a1b02be9 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
9825400f 243
a713db22 244 Float_t q1, q2;
245
002920d1 246 fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]);
247 // First Cluster
248 fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ);
249 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
250
251 // Second Cluster
252 fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ);
253 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
254
a713db22 255 Float_t value;
256 if (cath==0) {
257 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
258 } else {
259 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
260 }
261 return value;
9825400f 262}
263
6a9bc541 264AliMUONClusterInput& AliMUONClusterInput
30178c30 265::operator = (const AliMUONClusterInput& rhs)
6a9bc541 266{
30178c30 267// Protected assignement operator
268
269 if (this == &rhs) return *this;
270
8c343c7c 271 AliFatal("Not implemented.");
30178c30 272
273 return *this;
6a9bc541 274}