]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterInput.cxx
Connect only MUON branches when reading the event to speed up digitisation.
[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
16/*
17$Log$
d4fa40b7 18Revision 1.10 2001/03/20 13:33:23 egangler
19Small cleanup
20
a1b02be9 21Revision 1.9 2001/01/26 21:38:49 morsch
22Use access functions to AliMUONDigit member data.
23
08a636a8 24Revision 1.8 2001/01/23 18:58:19 hristov
25Initialisation of some pointers
26
3f5cf0b3 27Revision 1.7 2000/12/21 22:14:38 morsch
28Clean-up of coding rule violations.
29
6a9bc541 30Revision 1.6 2000/10/06 09:04:50 morsch
31
32- Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate
33 to make code work with slat chambers.
34
e357fc46 35Revision 1.5 2000/10/02 16:58:29 egangler
36Cleaning of the code :
37-> coding conventions
38-> void Streamers
39-> some useless includes removed or replaced by "class" statement
40
ecfa008b 41Revision 1.4 2000/07/03 11:54:57 morsch
42AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
43The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
44
a30a000f 45Revision 1.3 2000/06/28 15:16:35 morsch
46(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
47to allow development of slat-muon chamber simulation and reconstruction code in the MUON
48framework. The changes should have no side effects (mostly dummy arguments).
49(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
50of chambers with overlapping modules (MakePadHits, Disintegration).
51
802a864d 52Revision 1.2 2000/06/28 12:19:18 morsch
53More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
54cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
55AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
56It requires two cathode planes. Small modifications in the code will make it usable for
57one cathode plane and, hence, more general (for test beam data).
58AliMUONClusterFinder is now obsolete.
59
30aaba74 60Revision 1.1 2000/06/28 08:06:10 morsch
61Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
62algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
63It also naturally takes care of the TMinuit instance.
64
9825400f 65*/
66#include "AliRun.h"
67#include "AliMUON.h"
68#include "AliMUONChamber.h"
69#include "AliMUONClusterInput.h"
a30a000f 70#include "AliSegmentation.h"
9825400f 71#include "AliMUONResponse.h"
72#include "AliMUONRawCluster.h"
73#include "AliMUONDigit.h"
74
75#include <TClonesArray.h>
76#include <TMinuit.h>
77
78ClassImp(AliMUONClusterInput)
79
80AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
81TMinuit* AliMUONClusterInput::fgMinuit = 0;
82
3f5cf0b3 83AliMUONClusterInput::AliMUONClusterInput(){
84 fgClusterInput = 0;
85 fgMinuit = 0;
86 fDigits[0]=0;
87 fDigits[1]=0;
88 fSegmentation[0]=0;
89 fSegmentation[1]=0;
90 fResponse=0;
91 fCluster=0;
92}
93
9825400f 94AliMUONClusterInput* AliMUONClusterInput::Instance()
95{
96// return pointer to the singleton instance
97 if (fgClusterInput == 0) {
98 fgClusterInput = new AliMUONClusterInput();
e357fc46 99 fgMinuit = new TMinuit(8);
9825400f 100 }
101
102 return fgClusterInput;
103}
104
d4fa40b7 105AliMUONClusterInput::~AliMUONClusterInput()
106{
107// Destructor
108 delete fgMinuit;
109}
110
111
9825400f 112void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
113{
114// Set pointer to digits with corresponding segmentations and responses (two cathode planes)
30aaba74 115 fChamber=chamber;
9825400f 116 fDigits[0]=dig1;
117 fDigits[1]=dig2;
30aaba74 118 fNDigits[0]=dig1->GetEntriesFast();
119 fNDigits[1]=dig2->GetEntriesFast();
120
9825400f 121 AliMUON *pMUON;
122 AliMUONChamber* iChamber;
123
124 pMUON = (AliMUON*) gAlice->GetModule("MUON");
125 iChamber = &(pMUON->Chamber(chamber));
126
127 fSegmentation[0]=iChamber->SegmentationModel(1);
128 fSegmentation[1]=iChamber->SegmentationModel(2);
129 fResponse=iChamber->ResponseModel();
130 fNseg = 2;
131}
132
133void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
134{
135// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
136 fDigits[0]=dig;
137 AliMUON *pMUON;
138 AliMUONChamber* iChamber;
139
140 pMUON = (AliMUON*) gAlice->GetModule("MUON");
141 iChamber = &(pMUON->Chamber(chamber));
142
143 fSegmentation[0]=iChamber->SegmentationModel(1);
144 fResponse=iChamber->ResponseModel();
145 fNseg=1;
146}
147
148void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
149{
150// Set the current cluster
30aaba74 151 printf("\n %p \n", cluster);
9825400f 152 fCluster=cluster;
153 Float_t qtot;
154 Int_t i, cath, ix, iy;
155 AliMUONDigit* digit;
156 fNmul[0]=cluster->fMultiplicity[0];
157 fNmul[1]=cluster->fMultiplicity[1];
158 printf("\n %p %p ", fDigits[0], fDigits[1]);
159
160 for (cath=0; cath<2; cath++) {
161 qtot=0;
162 for (i=0; i<fNmul[cath]; i++) {
163 // pointer to digit
164 digit =(AliMUONDigit*)
165 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
166 // pad coordinates
08a636a8 167 ix = digit->PadX();
168 iy = digit->PadY();
9825400f 169 // pad charge
08a636a8 170 fCharge[i][cath] = digit->Signal();
9825400f 171 // pad centre coordinates
172// fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
173 // globals kUsed in fitting functions
174 fix[i][cath]=ix;
175 fiy[i][cath]=iy;
176 // total charge per cluster
177 qtot+=fCharge[i][cath];
e357fc46 178 // Current z
179 Float_t xc, yc;
180 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
9825400f 181 } // loop over cluster digits
182 fQtot[cath]=qtot;
183 fChargeTot[cath]=Int_t(qtot);
184 } // loop over cathodes
185}
186
187
188
189Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
190{
a1b02be9 191// Compute the charge on first cathod only.
192return DiscrChargeCombiS1(i,par,0);
9825400f 193}
194
195Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
196{
197// par[0] x-position of cluster
198// par[1] y-position of cluster
199
200 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
201// First Cluster
e357fc46 202 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
9825400f 203 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
204
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
219 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
220// First Cluster
e357fc46 221 fSegmentation[0]->SetHit(par[0],par[1],fZ);
9825400f 222 Float_t q1=fResponse->IntXY(fSegmentation[0]);
223
224// Second Cluster
e357fc46 225 fSegmentation[0]->SetHit(par[2],par[3],fZ);
9825400f 226 Float_t q2=fResponse->IntXY(fSegmentation[0]);
227
228 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
229 return value;
230}
231
232Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
233{
234// par[0] x-position of first cluster
235// par[1] y-position of first cluster
236// par[2] x-position of second cluster
237// par[3] y-position of second cluster
a1b02be9 238// par[4] charge fraction of first cluster - first cathode
239// 1-par[4] charge fraction of second cluster
240// par[5] charge fraction of first cluster - second cathode
9825400f 241
242 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
243// First Cluster
e357fc46 244 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
9825400f 245 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
246
247// Second Cluster
e357fc46 248 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
9825400f 249 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
250 Float_t value;
251 if (cath==0) {
252 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
253 } else {
254 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
255 }
256 return value;
257}
258
6a9bc541 259AliMUONClusterInput& AliMUONClusterInput
260::operator = (const AliMUONClusterInput& rhs)
261{
262// Dummy assignment operator
263 return *this;
264}