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 "AliMUONChamberGeometry.h"
26 ClassImp(AliMUONChamber)
28 AliMUONChamber::AliMUONChamber()
37 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
61 // Construtor with chamber id
62 fSegmentation = new TObjArray(2);
63 fSegmentation->AddAt(0,0);
64 fSegmentation->AddAt(0,1);
66 fGeometry = new AliMUONChamberGeometry(fId);
69 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
72 // Protected copy constructor
74 Fatal("AliMUONMergerModule", "Not implemented.");
75 // Dummy copy constructor
78 AliMUONChamber::~AliMUONChamber()
82 fSegmentation->Delete();
88 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
90 // Protected assignement operator
92 if (this == &rhs) return *this;
94 Fatal("operator=", "Not implemented.");
99 Bool_t AliMUONChamber::IsSensId(Int_t volId) const
101 // Returns true if the volume specified by volId is in the list
102 // of sesitive volumes for this chamber
104 return fGeometry->IsSensitiveVolume(volId);
107 void AliMUONChamber::Init()
111 // ... for chamber segmentation
112 //PH if ((*fSegmentation)[0])
113 //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
114 if (fSegmentation->At(0))
115 ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
118 //PH if ((*fSegmentation)[1])
119 //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
120 if (fSegmentation->At(1))
121 ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
125 Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
127 // Ask segmentation if signal should be generated
129 //PH return ((AliSegmentation*) (*fSegmentation)[0])
130 return ((AliSegmentation*) fSegmentation->At(0))
131 ->SigGenCond(x, y, z) ;
133 //PH return (((AliSegmentation*) (*fSegmentation)[0])
134 return (((AliSegmentation*) fSegmentation->At(0))
135 ->SigGenCond(x, y, z)) ||
136 //PH (((AliSegmentation*) (*fSegmentation)[1])
137 (((AliSegmentation*) fSegmentation->At(1))
138 ->SigGenCond(x, y, z)) ;
143 void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
146 // Initialisation of segmentation for hit
149 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
150 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
152 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
153 //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
154 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
155 ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
159 void AliMUONChamber::ChargeCorrelationInit() {
160 // Initialisation of charge correlation for current hit
161 // the value is stored, and then used by Disintegration
165 // exponential is here to avoid eventual problems in 0
166 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
167 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
170 void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
171 Float_t xhit, Float_t yhit, Float_t zhit,
172 Int_t& nnew,Float_t newclust[6][500])
175 // Generates pad hits (simulated cluster)
176 // using the segmentation and the response model
179 // Width of the integration area
181 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
182 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
184 // Get pulse height from energy loss
185 Float_t qtot = fResponse->IntPH(eloss);
192 // Cathode plane loop
193 for (Int_t i=1; i<=fnsec; i++) {
194 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
195 AliSegmentation * segmentation=
196 //PH (AliSegmentation *) (*fSegmentation)[i-1];
197 (AliSegmentation *) fSegmentation->At(i-1);
198 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
199 segmentation->MorePads();
200 segmentation->NextPad())
202 qp=fResponse->IntXY(segmentation);
208 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
209 // newclust only contains 500 elements.
211 Error("DisIntegration", "Limit of 500 pad responses reached.");
215 // --- store signal information
216 newclust[0][nnew]=qcath; // total charge
217 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
218 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
219 newclust[3][nnew]=qp * qcath; // charge on pad
220 newclust[4][nnew]=segmentation->ISector(); // sector id
221 newclust[5][nnew]=(Float_t) i; // counter
227 } // Cathode plane loop
232 void AliMUONChamber::InitGeo(Float_t /*zpos*/)
236 // 3% radiation length of aluminum (X0=8.9 cm)