]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterInput.cxx
adapted to new trigger output
[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
36dc66ec 41/// \cond CLASSIMP
42ClassImp(AliMUONClusterInput)
43/// \endcond
44
4dd5a4bf 45AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
46TMinuit* AliMUONClusterInput::fgMinuit = 0;
47AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0;
48AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0;
49AliMUONSegmentation* AliMUONClusterInput::fgSegmentation = 0;
9825400f 50
36dc66ec 51//______________________________________________________________________________
30178c30 52AliMUONClusterInput::AliMUONClusterInput()
7e4a628d 53 : TObject(),
54d7ba50 54 fNseg(0),
55 fChamber(0),
7e4a628d 56 fCluster(0),
54d7ba50 57 fZ(0.),
fed772f3 58 fChargeCorrel(1.),
fed772f3 59 fDetElemId(0)
b137f8b9 60
30178c30 61{
36dc66ec 62/// Default constructor
4dd5a4bf 63
3f5cf0b3 64 fDigits[0]=0;
65 fDigits[1]=0;
fed772f3 66 fSegmentation2[0]=0;
67 fSegmentation2[1]=0;
3f5cf0b3 68}
69
36dc66ec 70//______________________________________________________________________________
9825400f 71AliMUONClusterInput* AliMUONClusterInput::Instance()
72{
36dc66ec 73/// return pointer to the singleton instance
9825400f 74 if (fgClusterInput == 0) {
75 fgClusterInput = new AliMUONClusterInput();
e357fc46 76 fgMinuit = new TMinuit(8);
4dd5a4bf 77
78 // Create segmentation with activated Root geometry
79 if ( ! gGeoManager ) {
80 AliFatalClass("Geometry not loaded.");
81 return fgClusterInput;
82 }
83 fgTransformer = new AliMUONGeometryTransformer(true);
84 fgTransformer->ReadGeometryData("volpath.dat", gGeoManager);
85 AliMUONSegFactory factory(fgTransformer);
86 fgSegmentation = factory.CreateSegmentation();
9825400f 87 }
88
89 return fgClusterInput;
90}
91
36dc66ec 92//______________________________________________________________________________
d4fa40b7 93AliMUONClusterInput::~AliMUONClusterInput()
94{
36dc66ec 95/// Destructor
d4fa40b7 96 delete fgMinuit;
7e4a628d 97 delete fgMathieson;
4dd5a4bf 98 delete fgTransformer;
99 delete fgSegmentation;
8fee0ce8 100 fgMinuit = 0;
101 fgMathieson = 0;
d4fa40b7 102}
30178c30 103
36dc66ec 104//______________________________________________________________________________
a713db22 105void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2)
106{
36dc66ec 107 /// Set pointer to digits with corresponding segmentations and responses (two cathode planes)
a713db22 108 fChamber = chamber;
109 fDetElemId = idDE;
110 fDigits[0] = dig1;
111 fDigits[1] = dig2;
112 fNDigits[0] = dig1->GetEntriesFast();
113 fNDigits[1] = dig2->GetEntriesFast();
114
8fee0ce8 115 delete fgMathieson;
b7ef3c96 116 fgMathieson = new AliMUONMathieson();
117
c2a43efa 118 fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
119 fSegmentation2[1]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 1);
a713db22 120
121 fNseg = 2;
122 if (chamber < AliMUONConstants::NTrackingCh()) {
123 if (chamber > 1 ) {
124 fgMathieson->SetPitch(AliMUONConstants::Pitch());
125 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3());
126 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3());
127 fChargeCorrel = AliMUONConstants::ChargeCorrel();
128 } else {
129 fgMathieson->SetPitch(AliMUONConstants::PitchSt1());
130 fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1());
131 fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1());
132 fChargeCorrel = AliMUONConstants::ChargeCorrelSt1();
133 }
134 }
135}
136
36dc66ec 137//______________________________________________________________________________
a713db22 138void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig)
139{
36dc66ec 140/// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
a713db22 141
142 fChamber = chamber;
143 fDetElemId = idDE;
144 fDigits[0] = dig;
145
c2a43efa 146 fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0);
9825400f 147 fNseg=1;
148}
149
36dc66ec 150//______________________________________________________________________________
9825400f 151void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
152{
36dc66ec 153/// Set the current cluster
b137f8b9 154 //PH printf("\n %p \n", cluster);
155 fCluster=cluster;
156 Float_t qtot;
157 Int_t i, cath, ix, iy;
158 AliMUONDigit* digit;
159 fNmul[0]=cluster->GetMultiplicity(0);
160 fNmul[1]=cluster->GetMultiplicity(1);
161 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
162
163 for (cath=0; cath<2; cath++) {
164 qtot=0;
165 for (i=0; i<fNmul[cath]; i++) {
166 // pointer to digit
167 digit =(AliMUONDigit*)
0164904a 168 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
9825400f 169 // pad coordinates
08a636a8 170 ix = digit->PadX();
171 iy = digit->PadY();
9825400f 172 // pad charge
08a636a8 173 fCharge[i][cath] = digit->Signal();
9825400f 174 // pad centre coordinates
175// fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
176 // globals kUsed in fitting functions
177 fix[i][cath]=ix;
178 fiy[i][cath]=iy;
179 // total charge per cluster
180 qtot+=fCharge[i][cath];
e357fc46 181 // Current z
182 Float_t xc, yc;
002920d1 183 fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ);
9825400f 184 } // loop over cluster digits
185 fQtot[cath]=qtot;
186 fChargeTot[cath]=Int_t(qtot);
187 } // loop over cathodes
188}
189
36dc66ec 190//______________________________________________________________________________
9825400f 191Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
192{
36dc66ec 193/// Compute the charge on first cathod only.
a1b02be9 194return DiscrChargeCombiS1(i,par,0);
9825400f 195}
196
36dc66ec 197//______________________________________________________________________________
9825400f 198Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
199{
36dc66ec 200/// \todo add comment
201/// - par[0] x-position of cluster
202/// - param par[1] y-position of cluster
9825400f 203
c2a43efa 204 Float_t q1;
205 fSegmentation2[cath]-> SetPad(fDetElemId, fix[i][cath], fiy[i][cath]);
206 // First Cluster
207 fSegmentation2[cath]-> SetHit(fDetElemId, par[0],par[1],fZ);
208 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
002920d1 209
9825400f 210 Float_t value = fQtot[cath]*q1;
211 return value;
212}
213
214
36dc66ec 215//______________________________________________________________________________
9825400f 216Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
217{
36dc66ec 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
9825400f 225
a713db22 226 Float_t q1, q2;
227
002920d1 228 fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]);
229 // First Cluster
230 fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ);
231 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
232
233 // Second Cluster
234 fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ);
235 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]);
236
a713db22 237 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
238 return value;
9825400f 239}
240
36dc66ec 241//______________________________________________________________________________
9825400f 242Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
243{
36dc66ec 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
9825400f 252
a713db22 253 Float_t q1, q2;
254
002920d1 255 fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]);
256 // First Cluster
257 fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ);
258 q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
259
260 // Second Cluster
261 fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ);
262 q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]);
263
a713db22 264 Float_t value;
265 if (cath==0) {
266 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
267 } else {
268 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
269 }
270 return value;
9825400f 271}