]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
d19b6003 | 19 | // Class AliMUONResponseV0 |
20 | // -------------------------- | |
9265505b | 21 | // Implementation of |
22 | // Mathieson response | |
3d1463c8 | 23 | //----------------------------------------------------------------------------- |
a9e2aefa | 24 | |
30178c30 | 25 | #include "AliMUONResponseV0.h" |
885d501b | 26 | #include "AliMUON.h" |
27 | #include "AliMUONConstants.h" | |
28 | #include "AliMUONDigit.h" | |
885d501b | 29 | #include "AliMUONGeometryTransformer.h" |
30 | #include "AliMUONHit.h" | |
2a5f75ae | 31 | #include "AliMUONConstants.h" |
9265505b | 32 | |
885d501b | 33 | #include "AliMpArea.h" |
34 | #include "AliMpDEManager.h" | |
885d501b | 35 | #include "AliMpVPadIterator.h" |
9265505b | 36 | #include "AliMpSegmentation.h" |
885d501b | 37 | #include "AliMpVSegmentation.h" |
866c3232 | 38 | #include "AliMpCathodType.h" |
9265505b | 39 | |
885d501b | 40 | #include "AliRun.h" |
9265505b | 41 | #include "AliLog.h" |
42 | ||
885d501b | 43 | #include "Riostream.h" |
44 | #include "TVector2.h" | |
45 | #include <TMath.h> | |
46 | #include <TRandom.h> | |
8c343c7c | 47 | |
9265505b | 48 | /// \cond CLASSIMP |
d5bfadcc | 49 | ClassImp(AliMUONResponseV0) |
9265505b | 50 | /// \endcond |
d5bfadcc | 51 | |
885d501b | 52 | AliMUON* muon() |
53 | { | |
54 | return static_cast<AliMUON*>(gAlice->GetModule("MUON")); | |
55 | } | |
56 | ||
57 | void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg, | |
58 | Double_t& xl, Double_t& yl, Double_t& zl) | |
59 | { | |
9265505b | 60 | /// ideally should be : |
61 | /// Double_t x,y,z; | |
62 | /// AliMUONGeometry::Global2Local(detElemId,xg,yg,zg,x,y,z); | |
63 | /// but while waiting for this geometry singleton, let's go through | |
64 | /// AliMUON still. | |
885d501b | 65 | |
66 | const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer(); | |
67 | transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl); | |
68 | } | |
69 | ||
30178c30 | 70 | //__________________________________________________________________________ |
71 | AliMUONResponseV0::AliMUONResponseV0() | |
885d501b | 72 | : AliMUONResponse(), |
73 | fChargeSlope(0.0), | |
74 | fChargeSpreadX(0.0), | |
75 | fChargeSpreadY(0.0), | |
76 | fSigmaIntegration(0.0), | |
77 | fMaxAdc(0), | |
ccea41d4 | 78 | fSaturation(0), |
885d501b | 79 | fZeroSuppression(0), |
80 | fChargeCorrel(0.0), | |
81 | fMathieson(new AliMUONMathieson), | |
d1bb9a6f | 82 | fChargeThreshold(1e-4), |
83 | fIsTailEffect(kFALSE) | |
30178c30 | 84 | { |
9265505b | 85 | /// Normal constructor |
885d501b | 86 | AliDebug(1,Form("Default ctor")); |
30178c30 | 87 | } |
f29ba3e1 | 88 | |
2a7d64a9 | 89 | //__________________________________________________________________________ |
90 | AliMUONResponseV0::AliMUONResponseV0(const AliMUONResponseV0& other) | |
91 | : AliMUONResponse(), | |
92 | fChargeSlope(0.0), | |
93 | fChargeSpreadX(0.0), | |
94 | fChargeSpreadY(0.0), | |
95 | fSigmaIntegration(0.0), | |
96 | fMaxAdc(0), | |
97 | fSaturation(0), | |
98 | fZeroSuppression(0), | |
99 | fChargeCorrel(0.0), | |
100 | fMathieson(0), | |
d1bb9a6f | 101 | fChargeThreshold(1e-4), |
102 | fIsTailEffect(kFALSE) | |
2a7d64a9 | 103 | { |
104 | /// copy ctor | |
105 | other.CopyTo(*this); | |
106 | } | |
107 | ||
108 | //__________________________________________________________________________ | |
109 | AliMUONResponseV0& | |
110 | AliMUONResponseV0::operator=(const AliMUONResponseV0& other) | |
111 | { | |
112 | /// Assignment operator | |
113 | other.CopyTo(*this); | |
114 | return *this; | |
115 | } | |
116 | ||
ccea41d4 | 117 | //__________________________________________________________________________ |
a713db22 | 118 | AliMUONResponseV0::~AliMUONResponseV0() |
119 | { | |
9265505b | 120 | /// Destructor |
121 | ||
885d501b | 122 | AliDebug(1,""); |
a713db22 | 123 | delete fMathieson; |
124 | } | |
f29ba3e1 | 125 | |
2a7d64a9 | 126 | //______________________________________________________________________________ |
127 | void | |
128 | AliMUONResponseV0::CopyTo(AliMUONResponseV0& other) const | |
129 | { | |
130 | /// Copy *this to other | |
131 | other.fChargeSlope=fChargeSlope; | |
132 | other.fChargeSpreadX=fChargeSpreadX; | |
133 | other.fChargeSpreadY=fChargeSpreadY; | |
134 | other.fSigmaIntegration=fSigmaIntegration; | |
135 | other.fMaxAdc=fMaxAdc; | |
136 | other.fSaturation=fSaturation; | |
137 | other.fZeroSuppression=fZeroSuppression; | |
138 | other.fChargeCorrel=fChargeCorrel; | |
139 | delete other.fMathieson; | |
140 | other.fMathieson = new AliMUONMathieson(*fMathieson); | |
141 | other.fChargeThreshold=fChargeThreshold; | |
142 | } | |
143 | ||
885d501b | 144 | //______________________________________________________________________________ |
145 | void | |
146 | AliMUONResponseV0::Print(Option_t*) const | |
147 | { | |
9265505b | 148 | /// Printing |
d19b6003 | 149 | |
885d501b | 150 | cout << " ChargeSlope=" << fChargeSlope |
151 | << " ChargeSpreadX,Y=" << fChargeSpreadX | |
152 | << fChargeSpreadY | |
153 | << " ChargeCorrelation=" << fChargeCorrel | |
154 | << endl; | |
f29ba3e1 | 155 | } |
156 | ||
d5bfadcc | 157 | //__________________________________________________________________________ |
158 | void AliMUONResponseV0::SetSqrtKx3AndDeriveKx2Kx4(Float_t SqrtKx3) | |
159 | { | |
9265505b | 160 | /// Set to "SqrtKx3" the Mathieson parameter K3 ("fSqrtKx3") |
161 | /// in the X direction, perpendicular to the wires, | |
162 | /// and derive the Mathieson parameters K2 ("fKx2") and K4 ("fKx4") | |
163 | /// in the same direction | |
a713db22 | 164 | fMathieson->SetSqrtKx3AndDeriveKx2Kx4(SqrtKx3); |
d5bfadcc | 165 | } |
166 | ||
167 | //__________________________________________________________________________ | |
168 | void AliMUONResponseV0::SetSqrtKy3AndDeriveKy2Ky4(Float_t SqrtKy3) | |
169 | { | |
9265505b | 170 | /// Set to "SqrtKy3" the Mathieson parameter K3 ("fSqrtKy3") |
171 | /// in the Y direction, along the wires, | |
172 | /// and derive the Mathieson parameters K2 ("fKy2") and K4 ("fKy4") | |
173 | /// in the same direction | |
a713db22 | 174 | fMathieson->SetSqrtKy3AndDeriveKy2Ky4(SqrtKy3); |
d5bfadcc | 175 | } |
a713db22 | 176 | //__________________________________________________________________________ |
85fec35d | 177 | Float_t AliMUONResponseV0::IntPH(Float_t eloss) const |
a9e2aefa | 178 | { |
9265505b | 179 | /// Calculate charge from given ionization energy loss |
a9e2aefa | 180 | Int_t nel; |
4ac9d21e | 181 | nel= Int_t(eloss*1.e9/27.4); |
a9e2aefa | 182 | Float_t charge=0; |
183 | if (nel == 0) nel=1; | |
184 | for (Int_t i=1;i<=nel;i++) { | |
01997fa2 | 185 | Float_t arg=0.; |
186 | while(!arg) arg = gRandom->Rndm(); | |
187 | charge -= fChargeSlope*TMath::Log(arg); | |
a9e2aefa | 188 | } |
189 | return charge; | |
190 | } | |
a713db22 | 191 | |
885d501b | 192 | //_____________________________________________________________________________ |
193 | Float_t | |
194 | AliMUONResponseV0::GetAnod(Float_t x) const | |
195 | { | |
9265505b | 196 | /// Return wire coordinate closest to x. |
197 | ||
885d501b | 198 | Int_t n = Int_t(x/Pitch()); |
199 | Float_t wire = (x>0) ? n+0.5 : n-0.5; | |
200 | return Pitch()*wire; | |
201 | } | |
a9e2aefa | 202 | |
885d501b | 203 | //______________________________________________________________________________ |
204 | void | |
2a5f75ae | 205 | AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t timeDif) |
885d501b | 206 | { |
9265505b | 207 | /// Go from 1 hit to a list of digits. |
208 | /// The energy deposition of that hit is first converted into charge | |
209 | /// (in IntPH() method), and then this charge is dispatched on several | |
210 | /// pads, according to the Mathieson distribution. | |
885d501b | 211 | |
212 | digits.Clear(); | |
213 | ||
214 | Int_t detElemId = hit.DetElemId(); | |
d1bb9a6f | 215 | Double_t hitX = hit.X() ; |
216 | Double_t hitY = hit.Y() ; | |
217 | Double_t hitZ = hit.Z() ; | |
218 | ||
885d501b | 219 | // Width of the integration area |
885d501b | 220 | Double_t dx = SigmaIntegration()*ChargeSpreadX(); |
221 | Double_t dy = SigmaIntegration()*ChargeSpreadY(); | |
222 | ||
d1bb9a6f | 223 | //Modify to take the tailing effect. |
224 | if(fIsTailEffect){ | |
225 | Double_t locX,locY,locZ,globXCenter,globYCenter,globZ; | |
5fe36481 | 226 | Int_t para = 5; // This parameter is a natural number(excluding zero), higher the value less is the tailing effect |
d1bb9a6f | 227 | Double_t termA = 1.0; |
228 | Double_t termB = 1.0; | |
229 | if(para>0){ | |
230 | for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath ) | |
231 | { | |
232 | // Get an iterator to loop over pads, within the given area. | |
233 | const AliMpVSegmentation* seg = | |
234 | AliMpSegmentation::Instance() | |
235 | ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath)); | |
236 | AliMp::PlaneType plane = seg->PlaneType(); | |
237 | ||
238 | if(plane == AliMp::kBendingPlane) { | |
239 | Global2Local(detElemId,hitX,hitY,hitZ,locX,locY,locZ); | |
6e97fbb8 | 240 | AliMpPad pad = seg->PadByPosition(locX,locY,kFALSE); |
5fe36481 | 241 | if(pad.IsValid()){ |
6e97fbb8 | 242 | Double_t locYCenter = pad.GetPositionY(); |
243 | Double_t locXCenter = pad.GetPositionX(); | |
5fe36481 | 244 | const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer(); |
245 | transformer->Local2Global(detElemId,locXCenter,locYCenter,locZ,globXCenter,globYCenter,globZ); | |
246 | for(Int_t itime = 0; itime<para; itime++) | |
247 | termA *= 10.0; | |
248 | ||
249 | for(Int_t itime = 0; itime<Int_t((2*para) + 1); itime++) | |
250 | termB *= (hitY - globYCenter) ; | |
251 | ||
252 | hitY = hitY + termA*termB; | |
253 | }// if the pad is a valid one | |
d1bb9a6f | 254 | }// if bending plane |
255 | }// cathode loop | |
256 | }// if para > 0 condn | |
257 | }// if tail effect | |
258 | ||
885d501b | 259 | // Use that (dx,dy) to specify the area upon which |
260 | // we will iterate to spread charge into. | |
261 | Double_t x,y,z; | |
d1bb9a6f | 262 | Global2Local(detElemId,hitX,hitY,hitZ,x,y,z); |
885d501b | 263 | x = GetAnod(x); |
6e97fbb8 | 264 | AliMpArea area(x,y,dx,dy); |
885d501b | 265 | |
32c9ead9 | 266 | // Get pulse height from energy loss. |
885d501b | 267 | Float_t qtot = IntPH(hit.Eloss()); |
268 | ||
2a5f75ae | 269 | // If from a pileup event we apply a reduction factor to the charge |
270 | if (timeDif!=0){ | |
271 | qtot = AliMUONConstants::ReducedQTot(qtot,timeDif); | |
272 | } | |
273 | ||
32c9ead9 | 274 | // Get the charge correlation between cathodes. |
885d501b | 275 | Float_t currentCorrel = TMath::Exp(gRandom->Gaus(0.0,ChargeCorrel()/2.0)); |
a9e2aefa | 276 | |
866c3232 | 277 | for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath ) |
885d501b | 278 | { |
279 | Float_t qcath = qtot * ( cath == 0 ? currentCorrel : 1.0/currentCorrel); | |
280 | ||
885d501b | 281 | // Get an iterator to loop over pads, within the given area. |
32c9ead9 | 282 | const AliMpVSegmentation* seg = |
866c3232 | 283 | AliMpSegmentation::Instance() |
284 | ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath)); | |
885d501b | 285 | |
32c9ead9 | 286 | AliMpVPadIterator* it = seg->CreateIterator(area); |
287 | ||
288 | if (!it) | |
289 | { | |
290 | AliError(Form("Could not get iterator for detElemId %d",detElemId)); | |
291 | return; | |
292 | } | |
293 | ||
294 | // Start loop over pads. | |
295 | it->First(); | |
296 | ||
297 | if ( it->IsDone() ) | |
298 | { | |
299 | // Exceptional case : iterator is built, but is invalid from the start. | |
6e97fbb8 | 300 | AliMpPad pad = seg->PadByPosition(area.GetPositionX(),area.GetPositionY(), |
301 | kFALSE); | |
32c9ead9 | 302 | if ( pad.IsValid() ) |
885d501b | 303 | { |
ae7445c5 | 304 | AliDebug(1, Form("Got an invalid iterator bug (area.Position() is within " |
32c9ead9 | 305 | " DE but the iterator is void) for detElemId %d cath %d", |
306 | detElemId,cath)); | |
885d501b | 307 | } |
32c9ead9 | 308 | else |
885d501b | 309 | { |
ae7445c5 | 310 | AliDebug(1, Form("Got an invalid iterator bug for detElemId %d cath %d." |
32c9ead9 | 311 | "Might be a bad hit ? area.Position()=(%e,%e) " |
312 | "Dimensions()=(%e,%e)", | |
6e97fbb8 | 313 | detElemId,cath,area.GetPositionX(),area.GetPositionY(), |
314 | area.GetDimensionX(),area.GetDimensionY())); | |
885d501b | 315 | } |
316 | delete it; | |
32c9ead9 | 317 | return; |
318 | } | |
319 | ||
320 | while ( !it->IsDone() ) | |
321 | { | |
322 | // For each pad given by the iterator, compute the charge of that | |
323 | // pad, according to the Mathieson distribution. | |
324 | AliMpPad pad = it->CurrentItem(); | |
6e97fbb8 | 325 | TVector2 lowerLeft(TVector2(x,y)-TVector2(pad.GetPositionX(),pad.GetPositionY())- |
326 | TVector2(pad.GetDimensionX(),pad.GetDimensionY())); | |
327 | TVector2 upperRight(lowerLeft + TVector2(pad.GetDimensionX(),pad.GetDimensionY())*2.0); | |
32c9ead9 | 328 | Float_t qp = TMath::Abs(fMathieson->IntXY(lowerLeft.X(),lowerLeft.Y(), |
329 | upperRight.X(),upperRight.Y())); | |
330 | ||
331 | Int_t icharge = Int_t(qp*qcath); | |
332 | ||
333 | if ( qp > fChargeThreshold ) | |
334 | { | |
335 | // If we're above threshold, then we create a digit, | |
336 | // and fill it with relevant information, including electronics. | |
168e9c4d | 337 | AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetManuId(), |
338 | pad.GetManuChannel(),cath); | |
339 | d->SetPadXY(pad.GetIx(),pad.GetIy()); | |
2a7d64a9 | 340 | d->SetCharge(icharge); |
32c9ead9 | 341 | digits.Add(d); |
342 | } | |
343 | it->Next(); | |
344 | } | |
345 | delete it; | |
885d501b | 346 | } |
347 | } | |
a9e2aefa | 348 | |
349 | ||
350 |