AliMUONHitMap and AliMUONSegmentation moved to STEER as AliHitMap and AliSegmentation
[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$
802a864d 18Revision 1.2 2000/06/28 12:19:18 morsch
19More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
20cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
21AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
22It requires two cathode planes. Small modifications in the code will make it usable for
23one cathode plane and, hence, more general (for test beam data).
24AliMUONClusterFinder is now obsolete.
25
30aaba74 26Revision 1.1 2000/06/28 08:06:10 morsch
27Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
28algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
29It also naturally takes care of the TMinuit instance.
30
9825400f 31*/
32#include "AliRun.h"
33#include "AliMUON.h"
34#include "AliMUONChamber.h"
35#include "AliMUONClusterInput.h"
36#include "AliMUONSegmentation.h"
37#include "AliMUONResponse.h"
38#include "AliMUONRawCluster.h"
39#include "AliMUONDigit.h"
40
41#include <TClonesArray.h>
42#include <TMinuit.h>
43
44ClassImp(AliMUONClusterInput)
45
46AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
47TMinuit* AliMUONClusterInput::fgMinuit = 0;
48
49AliMUONClusterInput* AliMUONClusterInput::Instance()
50{
51// return pointer to the singleton instance
52 if (fgClusterInput == 0) {
53 fgClusterInput = new AliMUONClusterInput();
54 fgMinuit = new TMinuit(5);
55 }
56
57 return fgClusterInput;
58}
59
60void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
61{
62// Set pointer to digits with corresponding segmentations and responses (two cathode planes)
30aaba74 63 fChamber=chamber;
9825400f 64 fDigits[0]=dig1;
65 fDigits[1]=dig2;
30aaba74 66 fNDigits[0]=dig1->GetEntriesFast();
67 fNDigits[1]=dig2->GetEntriesFast();
68
9825400f 69 AliMUON *pMUON;
70 AliMUONChamber* iChamber;
71
72 pMUON = (AliMUON*) gAlice->GetModule("MUON");
73 iChamber = &(pMUON->Chamber(chamber));
74
75 fSegmentation[0]=iChamber->SegmentationModel(1);
76 fSegmentation[1]=iChamber->SegmentationModel(2);
77 fResponse=iChamber->ResponseModel();
78 fNseg = 2;
79}
80
81void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
82{
83// Set pointer to digits with corresponding segmentations and responses (one cathode plane)
84 fDigits[0]=dig;
85 AliMUON *pMUON;
86 AliMUONChamber* iChamber;
87
88 pMUON = (AliMUON*) gAlice->GetModule("MUON");
89 iChamber = &(pMUON->Chamber(chamber));
90
91 fSegmentation[0]=iChamber->SegmentationModel(1);
92 fResponse=iChamber->ResponseModel();
93 fNseg=1;
94}
95
96void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
97{
98// Set the current cluster
30aaba74 99 printf("\n %p \n", cluster);
9825400f 100 fCluster=cluster;
101 Float_t qtot;
102 Int_t i, cath, ix, iy;
103 AliMUONDigit* digit;
104 fNmul[0]=cluster->fMultiplicity[0];
105 fNmul[1]=cluster->fMultiplicity[1];
106 printf("\n %p %p ", fDigits[0], fDigits[1]);
107
108 for (cath=0; cath<2; cath++) {
109 qtot=0;
110 for (i=0; i<fNmul[cath]; i++) {
111 // pointer to digit
112 digit =(AliMUONDigit*)
113 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
114 // pad coordinates
115 ix = digit->fPadX;
116 iy = digit->fPadY;
117 // pad charge
118 fCharge[i][cath] = digit->fSignal;
119 // pad centre coordinates
120// fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
121 // globals kUsed in fitting functions
122 fix[i][cath]=ix;
123 fiy[i][cath]=iy;
124 // total charge per cluster
125 qtot+=fCharge[i][cath];
126 } // loop over cluster digits
127 fQtot[cath]=qtot;
128 fChargeTot[cath]=Int_t(qtot);
129 } // loop over cathodes
130}
131
132
133
134Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
135{
136// par[0] x-position of cluster
137// par[1] y-position of cluster
138
139 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
140// First Cluster
802a864d 141 fSegmentation[0]->SetHit(par[0],par[1],0);
9825400f 142 Float_t q1=fResponse->IntXY(fSegmentation[0]);
143
144 Float_t value = fQtot[0]*q1;
145 return value;
146}
147
148Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
149{
150// par[0] x-position of cluster
151// par[1] y-position of cluster
152
153 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
154// First Cluster
802a864d 155 fSegmentation[cath]->SetHit(par[0],par[1],0);
9825400f 156 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
157
158 Float_t value = fQtot[cath]*q1;
159 return value;
160}
161
162
163Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
164{
165// par[0] x-position of first cluster
166// par[1] y-position of first cluster
167// par[2] x-position of second cluster
168// par[3] y-position of second cluster
169// par[4] charge fraction of first cluster
170// 1-par[4] charge fraction of second cluster
171
172 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
173// First Cluster
802a864d 174 fSegmentation[0]->SetHit(par[0],par[1],0);
9825400f 175 Float_t q1=fResponse->IntXY(fSegmentation[0]);
176
177// Second Cluster
802a864d 178 fSegmentation[0]->SetHit(par[2],par[3],0);
9825400f 179 Float_t q2=fResponse->IntXY(fSegmentation[0]);
180
181 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
182 return value;
183}
184
185Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
186{
187// par[0] x-position of first cluster
188// par[1] y-position of first cluster
189// par[2] x-position of second cluster
190// par[3] y-position of second cluster
191// par[4] charge fraction of first cluster
192// 1-par[4] charge fraction of second cluster
193
194 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
195// First Cluster
802a864d 196 fSegmentation[cath]->SetHit(par[0],par[1],0);
9825400f 197 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
198
199// Second Cluster
802a864d 200 fSegmentation[cath]->SetHit(par[2],par[3],0);
9825400f 201 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
202 Float_t value;
203 if (cath==0) {
204 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
205 } else {
206 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
207 }
208 return value;
209}
210
30aaba74 211void AliMUONClusterInput::Streamer(TBuffer &R__b) {}
9825400f 212
213