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