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