1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include "AliMUONChamber.h"
21 #include "AliMUONClusterInput.h"
22 #include "AliSegmentation.h"
23 #include "AliMUONResponse.h"
24 #include "AliMUONRawCluster.h"
25 #include "AliMUONDigit.h"
27 #include <TClonesArray.h>
30 ClassImp(AliMUONClusterInput)
32 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
33 TMinuit* AliMUONClusterInput::fgMinuit = 0;
35 AliMUONClusterInput::AliMUONClusterInput(){
46 AliMUONClusterInput* AliMUONClusterInput::Instance()
48 // return pointer to the singleton instance
49 if (fgClusterInput == 0) {
50 fgClusterInput = new AliMUONClusterInput();
51 fgMinuit = new TMinuit(8);
54 return fgClusterInput;
57 AliMUONClusterInput::~AliMUONClusterInput()
64 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
66 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
70 fNDigits[0]=dig1->GetEntriesFast();
71 fNDigits[1]=dig2->GetEntriesFast();
74 AliMUONChamber* iChamber;
76 pMUON = (AliMUON*) gAlice->GetModule("MUON");
77 iChamber = &(pMUON->Chamber(chamber));
79 fSegmentation[0]=iChamber->SegmentationModel(1);
80 fSegmentation[1]=iChamber->SegmentationModel(2);
81 fResponse=iChamber->ResponseModel();
85 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
87 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
90 AliMUONChamber* iChamber;
92 pMUON = (AliMUON*) gAlice->GetModule("MUON");
93 iChamber = &(pMUON->Chamber(chamber));
95 fSegmentation[0]=iChamber->SegmentationModel(1);
96 fResponse=iChamber->ResponseModel();
100 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
102 // Set the current cluster
103 printf("\n %p \n", cluster);
106 Int_t i, cath, ix, iy;
108 fNmul[0]=cluster->fMultiplicity[0];
109 fNmul[1]=cluster->fMultiplicity[1];
110 printf("\n %p %p ", fDigits[0], fDigits[1]);
112 for (cath=0; cath<2; cath++) {
114 for (i=0; i<fNmul[cath]; i++) {
116 digit =(AliMUONDigit*)
117 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
122 fCharge[i][cath] = digit->Signal();
123 // pad centre coordinates
124 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
125 // globals kUsed in fitting functions
128 // total charge per cluster
129 qtot+=fCharge[i][cath];
132 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
133 } // loop over cluster digits
135 fChargeTot[cath]=Int_t(qtot);
136 } // loop over cathodes
141 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
143 // Compute the charge on first cathod only.
144 return DiscrChargeCombiS1(i,par,0);
147 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
149 // par[0] x-position of cluster
150 // par[1] y-position of cluster
152 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
154 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
155 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
157 Float_t value = fQtot[cath]*q1;
162 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
164 // par[0] x-position of first cluster
165 // par[1] y-position of first cluster
166 // par[2] x-position of second cluster
167 // par[3] y-position of second cluster
168 // par[4] charge fraction of first cluster
169 // 1-par[4] charge fraction of second cluster
171 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
173 fSegmentation[0]->SetHit(par[0],par[1],fZ);
174 Float_t q1=fResponse->IntXY(fSegmentation[0]);
177 fSegmentation[0]->SetHit(par[2],par[3],fZ);
178 Float_t q2=fResponse->IntXY(fSegmentation[0]);
180 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
184 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
186 // par[0] x-position of first cluster
187 // par[1] y-position of first cluster
188 // par[2] x-position of second cluster
189 // par[3] y-position of second cluster
190 // par[4] charge fraction of first cluster - first cathode
191 // 1-par[4] charge fraction of second cluster
192 // par[5] charge fraction of first cluster - second cathode
194 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
196 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
197 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
200 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
201 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
204 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
206 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
211 AliMUONClusterInput& AliMUONClusterInput
212 ::operator = (const AliMUONClusterInput& rhs)
214 // Dummy assignment operator