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 ---
24 // --- MUON includes ---
26 #include "AliMUONChamber.h"
27 #include "AliMUONGeometryModule.h"
28 #include "AliMUONHit.h"
31 ClassImp(AliMUONChamber)
33 AliMUONChamber::AliMUONChamber()
42 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
48 // Default constructor
51 //_______________________________________________________
52 AliMUONChamber::AliMUONChamber(Int_t id)
61 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
69 fMUON = (AliMUON*)gAlice->GetModule("MUON");
71 AliFatal("MUON detector not defined.");
76 fSegmentation2 = new TObjArray(2);
77 fSegmentation2->AddAt(0,0);
78 fSegmentation2->AddAt(0,1);
80 fGeometry = new AliMUONGeometryModule(fId);
84 //_______________________________________________________
85 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
88 // Protected copy constructor
90 AliFatal("Not implemented.");
91 // Dummy copy constructor
94 //_______________________________________________________
95 AliMUONChamber::~AliMUONChamber()
100 fSegmentation2->Delete();
101 delete fSegmentation2;
107 //_______________________________________________________
108 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
110 // Protected assignement operator
112 if (this == &rhs) return *this;
114 AliFatal("Not implemented.");
119 //_______________________________________________________
120 Bool_t AliMUONChamber::IsSensId(Int_t volId) const
122 // Returns true if the volume specified by volId is in the list
123 // of sesitive volumes for this chamber
125 return fGeometry->IsSensitiveVolume(volId);
129 //_____________________________________________________
130 void AliMUONChamber::ChargeCorrelationInit() {
131 // Initialisation of charge correlation for current hit
132 // the value is stored, and then used by Disintegration
136 // exponential is here to avoid eventual problems in 0
137 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
138 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
141 //_______________________________________________________
142 void AliMUONChamber::InitGeo(Float_t /*zpos*/)
146 // 3% radiation length of aluminum (X0=8.9 cm)
149 //_______________________________________________________
152 //_______________________________________________________
153 void AliMUONChamber::Init(Int_t flag)
157 // ... for chamber segmentation
159 if (!flag) AliFatal("wrong segmentation type.");
162 if (fSegmentation2->At(0))
163 ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->Init(fId);
166 if (fSegmentation2->At(1))
167 ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->Init(fId);
171 //_________________________________________________________________
172 Int_t AliMUONChamber::SigGenCond(AliMUONHit *hit)
174 // Ask segmentation if signal should be generated
176 Float_t x = hit->X();
177 Float_t y = hit->Y();
178 Float_t z = hit->Z();
179 Int_t id = hit->DetElemId();
182 return ((AliMUONGeometrySegmentation*)fSegmentation2->At(0))->SigGenCond(id, x, y, z);
184 return (((AliMUONGeometrySegmentation*) fSegmentation2->At(0))
185 ->SigGenCond(id, x, y, z)) ||
186 (((AliMUONGeometrySegmentation*) fSegmentation2->At(1))
187 ->SigGenCond(id, x, y, z)) ;
191 //_________________________________________________________________
192 void AliMUONChamber::SigGenInit(AliMUONHit *hit)
195 // Initialisation of segmentation for hit
197 Float_t x = hit->X();
198 Float_t y = hit->Y();
199 Float_t z = hit->Z();
200 Int_t id = hit->DetElemId();
203 ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->SigGenInit(id, x, y, z) ;
205 ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->SigGenInit(id, x, y, z) ;
206 ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->SigGenInit(id, x, y, z) ;
210 //_______________________________________________________
211 void AliMUONChamber::DisIntegration(AliMUONHit *hit,
212 Int_t& nnew,Float_t newclust[6][500])
215 // Generates pad hits (simulated cluster)
216 // using the segmentation and the response model
219 Float_t xhit = hit->X();
220 Float_t yhit = hit->Y();
221 Float_t zhit = hit->Z();
222 Int_t id = hit->DetElemId();
223 Float_t eloss = hit->Eloss();
226 // Width of the integration area
228 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
229 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
231 // Get pulse height from energy loss
232 Float_t qtot = fResponse->IntPH(eloss);
239 // Cathode plane loop
240 for (Int_t i=1; i<=fnsec; i++) {
241 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
243 AliMUONGeometrySegmentation* segmentation=
244 (AliMUONGeometrySegmentation*) fSegmentation2->At(i-1);
246 for (segmentation->FirstPad(id, xhit, yhit, zhit, dx, dy);
247 segmentation->MorePads(id);
248 segmentation->NextPad(id))
250 qp=fResponse->IntXY(id, segmentation);
256 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
257 // newclust only contains 500 elements.
259 AliError("Limit of 500 pad responses reached.");
263 // --- store signal information
264 newclust[0][nnew]=qcath; // total charge
265 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
266 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
267 newclust[3][nnew]=qp * qcath; // charge on pad
268 newclust[4][nnew]=segmentation->ISector(); // sector id
269 newclust[5][nnew]=(Float_t) i; // counter
274 } // Cathode plane loop