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()
62 AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
67 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
69 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
73 fNDigits[0]=dig1->GetEntriesFast();
74 fNDigits[1]=dig2->GetEntriesFast();
77 AliMUONChamber* iChamber;
79 pMUON = (AliMUON*) gAlice->GetModule("MUON");
80 iChamber = &(pMUON->Chamber(chamber));
82 fSegmentation[0]=iChamber->SegmentationModel(1);
83 fSegmentation[1]=iChamber->SegmentationModel(2);
84 fResponse=iChamber->ResponseModel();
88 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
90 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
93 AliMUONChamber* iChamber;
95 pMUON = (AliMUON*) gAlice->GetModule("MUON");
96 iChamber = &(pMUON->Chamber(chamber));
98 fSegmentation[0]=iChamber->SegmentationModel(1);
99 fResponse=iChamber->ResponseModel();
103 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
105 // Set the current cluster
106 printf("\n %p \n", cluster);
109 Int_t i, cath, ix, iy;
111 fNmul[0]=cluster->fMultiplicity[0];
112 fNmul[1]=cluster->fMultiplicity[1];
113 printf("\n %p %p ", fDigits[0], fDigits[1]);
115 for (cath=0; cath<2; cath++) {
117 for (i=0; i<fNmul[cath]; i++) {
119 digit =(AliMUONDigit*)
120 (fDigits[cath]->UncheckedAt(cluster->fIndexMap[i][cath]));
125 fCharge[i][cath] = digit->Signal();
126 // pad centre coordinates
127 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
128 // globals kUsed in fitting functions
131 // total charge per cluster
132 qtot+=fCharge[i][cath];
135 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
136 } // loop over cluster digits
138 fChargeTot[cath]=Int_t(qtot);
139 } // loop over cathodes
144 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
146 // Compute the charge on first cathod only.
147 return DiscrChargeCombiS1(i,par,0);
150 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
152 // par[0] x-position of cluster
153 // par[1] y-position of cluster
155 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
157 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
158 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
160 Float_t value = fQtot[cath]*q1;
165 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
167 // par[0] x-position of first cluster
168 // par[1] y-position of first cluster
169 // par[2] x-position of second cluster
170 // par[3] y-position of second cluster
171 // par[4] charge fraction of first cluster
172 // 1-par[4] charge fraction of second cluster
174 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
176 fSegmentation[0]->SetHit(par[0],par[1],fZ);
177 Float_t q1=fResponse->IntXY(fSegmentation[0]);
180 fSegmentation[0]->SetHit(par[2],par[3],fZ);
181 Float_t q2=fResponse->IntXY(fSegmentation[0]);
183 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
187 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
189 // par[0] x-position of first cluster
190 // par[1] y-position of first cluster
191 // par[2] x-position of second cluster
192 // par[3] y-position of second cluster
193 // par[4] charge fraction of first cluster - first cathode
194 // 1-par[4] charge fraction of second cluster
195 // par[5] charge fraction of first cluster - second cathode
197 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
199 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
200 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
203 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
204 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
207 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
209 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
214 AliMUONClusterInput& AliMUONClusterInput
215 ::operator = (const AliMUONClusterInput& /*rhs*/)
217 // Dummy assignment operator