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 // --- ROOT includes ---
22 // --- MUON includes ---
23 #include "AliMUONChamber.h"
24 #include "AliMUONGeometryModule.h"
27 ClassImp(AliMUONChamber)
29 AliMUONChamber::AliMUONChamber()
38 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
43 // Default constructor
46 AliMUONChamber::AliMUONChamber(Int_t id)
55 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
60 // Construtor with chamber id
61 fSegmentation = new TObjArray(2);
62 fSegmentation->AddAt(0,0);
63 fSegmentation->AddAt(0,1);
65 fGeometry = new AliMUONGeometryModule(fId);
68 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
71 // Protected copy constructor
73 AliFatal("Not implemented.");
74 // Dummy copy constructor
77 AliMUONChamber::~AliMUONChamber()
81 fSegmentation->Delete();
87 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
89 // Protected assignement operator
91 if (this == &rhs) return *this;
93 AliFatal("Not implemented.");
98 Bool_t AliMUONChamber::IsSensId(Int_t volId) const
100 // Returns true if the volume specified by volId is in the list
101 // of sesitive volumes for this chamber
103 return fGeometry->IsSensitiveVolume(volId);
106 void AliMUONChamber::Init()
110 // ... for chamber segmentation
111 //PH if ((*fSegmentation)[0])
112 //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
113 if (fSegmentation->At(0))
114 ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
117 //PH if ((*fSegmentation)[1])
118 //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
119 if (fSegmentation->At(1))
120 ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
124 Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
126 // Ask segmentation if signal should be generated
128 //PH return ((AliSegmentation*) (*fSegmentation)[0])
129 return ((AliSegmentation*) fSegmentation->At(0))
130 ->SigGenCond(x, y, z) ;
132 //PH return (((AliSegmentation*) (*fSegmentation)[0])
133 return (((AliSegmentation*) fSegmentation->At(0))
134 ->SigGenCond(x, y, z)) ||
135 //PH (((AliSegmentation*) (*fSegmentation)[1])
136 (((AliSegmentation*) fSegmentation->At(1))
137 ->SigGenCond(x, y, z)) ;
142 void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
145 // Initialisation of segmentation for hit
148 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
149 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
151 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
152 //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
153 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
154 ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
158 void AliMUONChamber::ChargeCorrelationInit() {
159 // Initialisation of charge correlation for current hit
160 // the value is stored, and then used by Disintegration
164 // exponential is here to avoid eventual problems in 0
165 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
166 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
169 void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
170 Float_t xhit, Float_t yhit, Float_t zhit,
171 Int_t& nnew,Float_t newclust[6][500])
174 // Generates pad hits (simulated cluster)
175 // using the segmentation and the response model
178 // Width of the integration area
180 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
181 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
183 // Get pulse height from energy loss
184 Float_t qtot = fResponse->IntPH(eloss);
191 // Cathode plane loop
192 for (Int_t i=1; i<=fnsec; i++) {
193 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
194 AliSegmentation * segmentation=
195 //PH (AliSegmentation *) (*fSegmentation)[i-1];
196 (AliSegmentation *) fSegmentation->At(i-1);
197 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
198 segmentation->MorePads();
199 segmentation->NextPad())
201 qp=fResponse->IntXY(segmentation);
207 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
208 // newclust only contains 500 elements.
210 AliError("Limit of 500 pad responses reached.");
214 // --- store signal information
215 newclust[0][nnew]=qcath; // total charge
216 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
217 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
218 newclust[3][nnew]=qp * qcath; // charge on pad
219 newclust[4][nnew]=segmentation->ISector(); // sector id
220 newclust[5][nnew]=(Float_t) i; // counter
226 } // Cathode plane loop
231 void AliMUONChamber::InitGeo(Float_t /*zpos*/)
235 // 3% radiation length of aluminum (X0=8.9 cm)