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()
41 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
47 // Default constructor
50 //_______________________________________________________
51 AliMUONChamber::AliMUONChamber(Int_t id)
59 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
67 fMUON = (AliMUON*)gAlice->GetModule("MUON");
69 AliFatal("MUON detector not defined.");
74 fSegmentation2 = new TObjArray(2);
75 fSegmentation2->AddAt(0,0);
76 fSegmentation2->AddAt(0,1);
78 fGeometry = new AliMUONGeometryModule(fId);
82 //_______________________________________________________
83 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
86 // Protected copy constructor
88 AliFatal("Not implemented.");
89 // Dummy copy constructor
92 //_______________________________________________________
93 AliMUONChamber::~AliMUONChamber()
98 fSegmentation2->Delete();
99 delete fSegmentation2;
105 //_______________________________________________________
106 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
108 // Protected assignement operator
110 if (this == &rhs) return *this;
112 AliFatal("Not implemented.");
117 //_______________________________________________________
118 Bool_t AliMUONChamber::IsSensId(Int_t volId) const
120 // Returns true if the volume specified by volId is in the list
121 // of sesitive volumes for this chamber
123 return fGeometry->IsSensitiveVolume(volId);
127 //_____________________________________________________
128 void AliMUONChamber::ChargeCorrelationInit() {
129 // Initialisation of charge correlation for current hit
130 // the value is stored, and then used by Disintegration
132 // exponential is here to avoid eventual problems in 0
133 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
134 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
137 //_______________________________________________________
138 void AliMUONChamber::InitGeo(Float_t /*zpos*/)
142 // 3% radiation length of aluminum (X0=8.9 cm)
145 //_______________________________________________________
148 //_______________________________________________________
149 void AliMUONChamber::Init(Int_t flag)
153 // ... for chamber segmentation
155 if (!flag) AliFatal("wrong segmentation type.");
157 if (fSegmentation2->At(0))
158 ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->Init(fId);
159 if (fSegmentation2->At(1))
160 ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->Init(fId);
163 // //_________________________________________________________________
164 // void AliMUONChamber::SigGenInit(AliMUONHit *hit)
167 // // Initialisation of segmentation for hit
169 // Float_t x = hit->X();
170 // Float_t y = hit->Y();
171 // Float_t z = hit->Z();
172 // Int_t id = hit->DetElemId();
174 // ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->SigGenInit(id, x, y, z) ;
175 // ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->SigGenInit(id, x, y, z) ;
179 //_______________________________________________________
180 void AliMUONChamber::DisIntegration(AliMUONHit *hit,
181 Int_t& nnew,Float_t newclust[6][500])
184 // Generates pad hits (simulated cluster)
185 // using the segmentation and the response model
188 Float_t xhit = hit->X();
189 Float_t yhit = hit->Y();
190 Float_t zhit = hit->Z();
191 Int_t id = hit->DetElemId();
192 Float_t eloss = hit->Eloss();
195 // Width of the integration area
197 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
198 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
200 // Get pulse height from energy loss
201 Float_t qtot = fResponse->IntPH(eloss);
208 // Cathode plane loop
209 for (Int_t i = 1; i <= 2; i++) {
210 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
212 AliMUONGeometrySegmentation* segmentation=
213 (AliMUONGeometrySegmentation*) fSegmentation2->At(i-1);
215 for (segmentation->FirstPad(id, xhit, yhit, zhit, dx, dy);
216 segmentation->MorePads(id);
217 segmentation->NextPad(id))
219 qp=fResponse->IntXY(id, segmentation);
225 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
226 // newclust only contains 500 elements.
228 AliError("Limit of 500 pad responses reached.");
232 // --- store signal information
233 newclust[0][nnew]=qcath; // total charge
234 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
235 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
236 newclust[3][nnew]=qp * qcath; // charge on pad
237 newclust[4][nnew]=segmentation->ISector(); // sector id
238 newclust[5][nnew]=(Float_t) i; // counter
243 } // Cathode plane loop