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 **************************************************************************/
18 #include <TClonesArray.h>
23 #include "AliMUONChamber.h"
24 #include "AliMUONClusterInput.h"
25 #include "AliMUONResponse.h"
26 #include "AliMUONRawCluster.h"
27 #include "AliMUONDigit.h"
29 ClassImp(AliMUONClusterInput)
31 AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0;
32 TMinuit* AliMUONClusterInput::fgMinuit = 0;
34 AliMUONClusterInput::AliMUONClusterInput()
47 AliMUONClusterInput* AliMUONClusterInput::Instance()
49 // return pointer to the singleton instance
50 if (fgClusterInput == 0) {
51 fgClusterInput = new AliMUONClusterInput();
52 fgMinuit = new TMinuit(8);
55 return fgClusterInput;
58 AliMUONClusterInput::~AliMUONClusterInput()
64 AliMUONClusterInput::AliMUONClusterInput(const AliMUONClusterInput& clusterInput):TObject(clusterInput)
66 // Protected copy constructor
68 Fatal("AliMUONClusterInput", "Not implemented.");
71 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2)
73 // Set pointer to digits with corresponding segmentations and responses (two cathode planes)
77 fNDigits[0]=dig1->GetEntriesFast();
78 fNDigits[1]=dig2->GetEntriesFast();
81 AliMUONChamber* iChamber;
83 pMUON = (AliMUON*) gAlice->GetModule("MUON");
84 iChamber = &(pMUON->Chamber(chamber));
86 fSegmentation[0]=iChamber->SegmentationModel(1);
87 fSegmentation[1]=iChamber->SegmentationModel(2);
88 fResponse=iChamber->ResponseModel();
92 void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig)
94 // Set pointer to digits with corresponding segmentations and responses (one cathode plane)
97 AliMUONChamber* iChamber;
99 pMUON = (AliMUON*) gAlice->GetModule("MUON");
100 iChamber = &(pMUON->Chamber(chamber));
102 fSegmentation[0]=iChamber->SegmentationModel(1);
103 fResponse=iChamber->ResponseModel();
107 void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster)
109 // Set the current cluster
110 //PH printf("\n %p \n", cluster);
113 Int_t i, cath, ix, iy;
115 fNmul[0]=cluster->GetMultiplicity(0);
116 fNmul[1]=cluster->GetMultiplicity(1);
117 //PH printf("\n %p %p ", fDigits[0], fDigits[1]);
119 for (cath=0; cath<2; cath++) {
121 for (i=0; i<fNmul[cath]; i++) {
123 digit =(AliMUONDigit*)
124 (fDigits[cath]->UncheckedAt(cluster->GetIndex(i,cath)));
129 fCharge[i][cath] = digit->Signal();
130 // pad centre coordinates
131 // fSegmentation[cath]->GetPadCxy(ix, iy, x, y);
132 // globals kUsed in fitting functions
135 // total charge per cluster
136 qtot+=fCharge[i][cath];
139 fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ);
140 } // loop over cluster digits
142 fChargeTot[cath]=Int_t(qtot);
143 } // loop over cathodes
148 Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par)
150 // Compute the charge on first cathod only.
151 return DiscrChargeCombiS1(i,par,0);
154 Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath)
156 // par[0] x-position of cluster
157 // par[1] y-position of cluster
159 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
161 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
162 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
164 Float_t value = fQtot[cath]*q1;
169 Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par)
171 // par[0] x-position of first cluster
172 // par[1] y-position of first cluster
173 // par[2] x-position of second cluster
174 // par[3] y-position of second cluster
175 // par[4] charge fraction of first cluster
176 // 1-par[4] charge fraction of second cluster
178 fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]);
180 fSegmentation[0]->SetHit(par[0],par[1],fZ);
181 Float_t q1=fResponse->IntXY(fSegmentation[0]);
184 fSegmentation[0]->SetHit(par[2],par[3],fZ);
185 Float_t q2=fResponse->IntXY(fSegmentation[0]);
187 Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
191 Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath)
193 // par[0] x-position of first cluster
194 // par[1] y-position of first cluster
195 // par[2] x-position of second cluster
196 // par[3] y-position of second cluster
197 // par[4] charge fraction of first cluster - first cathode
198 // 1-par[4] charge fraction of second cluster
199 // par[5] charge fraction of first cluster - second cathode
201 fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]);
203 fSegmentation[cath]->SetHit(par[0],par[1],fZ);
204 Float_t q1=fResponse->IntXY(fSegmentation[cath]);
207 fSegmentation[cath]->SetHit(par[2],par[3],fZ);
208 Float_t q2=fResponse->IntXY(fSegmentation[cath]);
211 value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2);
213 value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2);
218 AliMUONClusterInput& AliMUONClusterInput
219 ::operator = (const AliMUONClusterInput& rhs)
221 // Protected assignement operator
223 if (this == &rhs) return *this;
225 Fatal("operator=", "Not implemented.");