Fork me on GitHub

source: git/modules/Calorimeter.cc@ 406b698

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 406b698 was cab38f6, checked in by Pavel Demin <pavel.demin@…>, 10 years ago

remove svn tags and fix formatting

  • Property mode set to 100644
File size: 16.7 KB
RevLine 
[01f457a]1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
[1fa50c2]4 *
[01f457a]5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
[1fa50c2]9 *
[01f457a]10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
[1fa50c2]14 *
[01f457a]15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
[d7d2da3]19
20/** \class Calorimeter
21 *
22 * Fills calorimeter towers, performs calorimeter resolution smearing,
[d4c4d9d]23 * and creates energy flow objects (tracks, photons, and neutral hadrons).
[d7d2da3]24 *
25 * \author P. Demin - UCL, Louvain-la-Neuve
26 *
27 */
28
29#include "modules/Calorimeter.h"
30
31#include "classes/DelphesClasses.h"
32#include "classes/DelphesFactory.h"
33#include "classes/DelphesFormula.h"
34
35#include "ExRootAnalysis/ExRootResult.h"
36#include "ExRootAnalysis/ExRootFilter.h"
37#include "ExRootAnalysis/ExRootClassifier.h"
38
39#include "TMath.h"
40#include "TString.h"
41#include "TFormula.h"
42#include "TRandom3.h"
43#include "TObjArray.h"
44#include "TDatabasePDG.h"
45#include "TLorentzVector.h"
46
47#include <algorithm>
48#include <stdexcept>
49#include <iostream>
50#include <sstream>
51
52using namespace std;
53
54//------------------------------------------------------------------------------
55
56Calorimeter::Calorimeter() :
[82575a3]57 fECalResolutionFormula(0), fHCalResolutionFormula(0),
[d7d2da3]58 fItParticleInputArray(0), fItTrackInputArray(0),
[2dab783]59 fTowerTrackArray(0), fItTowerTrackArray(0)
[d7d2da3]60{
[82575a3]61 fECalResolutionFormula = new DelphesFormula;
62 fHCalResolutionFormula = new DelphesFormula;
63
[9493a0f]64 fTowerTrackArray = new TObjArray;
65 fItTowerTrackArray = fTowerTrackArray->MakeIterator();
[d7d2da3]66}
67
68//------------------------------------------------------------------------------
69
70Calorimeter::~Calorimeter()
71{
[82575a3]72 if(fECalResolutionFormula) delete fECalResolutionFormula;
73 if(fHCalResolutionFormula) delete fHCalResolutionFormula;
74
[9493a0f]75 if(fTowerTrackArray) delete fTowerTrackArray;
76 if(fItTowerTrackArray) delete fItTowerTrackArray;
[2dab783]77}
[d7d2da3]78
79//------------------------------------------------------------------------------
80
81void Calorimeter::Init()
82{
83 ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
[a221d1f]84 Long_t i, j, k, size, sizeEtaBins, sizePhiBins;
[82575a3]85 Double_t ecalFraction, hcalFraction;
[d7d2da3]86 TBinMap::iterator itEtaBin;
87 set< Double_t >::iterator itPhiBin;
88 vector< Double_t > *phiBins;
89
90 // read eta and phi bins
91 param = GetParam("EtaPhiBins");
92 size = param.GetSize();
93 fBinMap.clear();
94 fEtaBins.clear();
95 fPhiBins.clear();
96 for(i = 0; i < size/2; ++i)
97 {
98 paramEtaBins = param[i*2];
99 sizeEtaBins = paramEtaBins.GetSize();
100 paramPhiBins = param[i*2 + 1];
101 sizePhiBins = paramPhiBins.GetSize();
102
103 for(j = 0; j < sizeEtaBins; ++j)
104 {
105 for(k = 0; k < sizePhiBins; ++k)
106 {
107 fBinMap[paramEtaBins[j].GetDouble()].insert(paramPhiBins[k].GetDouble());
108 }
109 }
110 }
111
112 // for better performance we transform map of sets to parallel vectors:
113 // vector< double > and vector< vector< double >* >
114 for(itEtaBin = fBinMap.begin(); itEtaBin != fBinMap.end(); ++itEtaBin)
115 {
116 fEtaBins.push_back(itEtaBin->first);
117 phiBins = new vector< double >(itEtaBin->second.size());
118 fPhiBins.push_back(phiBins);
119 phiBins->clear();
120 for(itPhiBin = itEtaBin->second.begin(); itPhiBin != itEtaBin->second.end(); ++itPhiBin)
121 {
122 phiBins->push_back(*itPhiBin);
123 }
124 }
125
126 // read energy fractions for different particles
127 param = GetParam("EnergyFraction");
128 size = param.GetSize();
129
130 // set default energy fractions values
131 fFractionMap.clear();
[82575a3]132 fFractionMap[0] = make_pair(0.0, 1.0);
[d7d2da3]133
134 for(i = 0; i < size/2; ++i)
135 {
136 paramFractions = param[i*2 + 1];
[82575a3]137
138 ecalFraction = paramFractions[0].GetDouble();
139 hcalFraction = paramFractions[1].GetDouble();
140
141 fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction);
[d7d2da3]142 }
[8624f58]143
[d7d2da3]144/*
145 TFractionMap::iterator itFractionMap;
146 for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
147 {
148 cout << itFractionMap->first << " " << itFractionMap->second.first << " " << itFractionMap->second.second << endl;
149 }
150*/
[4b9a2dc]151
152 // read min E value for towers to be saved
[8624f58]153 fECalEnergyMin = GetDouble("ECalMinEnergy", 0.0);
154 fHCalEnergyMin = GetDouble("HCalMinEnergy", 0.0);
[a221d1f]155
[8624f58]156 fECalSigmaMin = GetDouble("ECalMinSignificance", 0.0);
157 fHCalSigmaMin = GetDouble("HCalMinSignificance", 0.0);
[a221d1f]158
[8624f58]159 // switch on or off the dithering of the center of calorimeter towers
160 fDitherTowerCenter = GetBool("DitherTowerCenter", true);
[4b9a2dc]161
[d7d2da3]162 // read resolution formulas
[82575a3]163 fECalResolutionFormula->Compile(GetString("ECalResolutionFormula", "0"));
164 fHCalResolutionFormula->Compile(GetString("HCalResolutionFormula", "0"));
165
[d7d2da3]166 // import array with output from other modules
167 fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles"));
168 fItParticleInputArray = fParticleInputArray->MakeIterator();
169
170 fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
171 fItTrackInputArray = fTrackInputArray->MakeIterator();
172
173 // create output arrays
174 fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
[82575a3]175 fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "photons"));
[a221d1f]176
[82575a3]177 fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks"));
178 fEFlowPhotonOutputArray = ExportArray(GetString("EFlowPhotonOutputArray", "eflowPhotons"));
179 fEFlowNeutralHadronOutputArray = ExportArray(GetString("EFlowNeutralHadronOutputArray", "eflowNeutralHadrons"));
180
[d7d2da3]181}
182
183//------------------------------------------------------------------------------
184
185void Calorimeter::Finish()
186{
[2dab783]187 vector< vector< Double_t >* >::iterator itPhiBin;
[d7d2da3]188 if(fItParticleInputArray) delete fItParticleInputArray;
189 if(fItTrackInputArray) delete fItTrackInputArray;
190 for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin)
191 {
192 delete *itPhiBin;
193 }
194}
195
196//------------------------------------------------------------------------------
197
198void Calorimeter::Process()
199{
200 Candidate *particle, *track;
201 TLorentzVector position, momentum;
202 Short_t etaBin, phiBin, flags;
203 Int_t number;
204 Long64_t towerHit, towerEtaPhi, hitEtaPhi;
[82575a3]205 Double_t ecalFraction, hcalFraction;
206 Double_t ecalEnergy, hcalEnergy;
[d7d2da3]207 Int_t pdgCode;
208
209 TFractionMap::iterator itFractionMap;
210
211 vector< Double_t >::iterator itEtaBin;
212 vector< Double_t >::iterator itPhiBin;
213 vector< Double_t > *phiBins;
214
215 vector< Long64_t >::iterator itTowerHits;
216
217 DelphesFactory *factory = GetFactory();
218 fTowerHits.clear();
[82575a3]219 fTowerECalFractions.clear();
220 fTowerHCalFractions.clear();
221 fTrackECalFractions.clear();
222 fTrackHCalFractions.clear();
223
[d7d2da3]224 // loop over all particles
225 fItParticleInputArray->Reset();
226 number = -1;
227 while((particle = static_cast<Candidate*>(fItParticleInputArray->Next())))
228 {
229 const TLorentzVector &particlePosition = particle->Position;
230 ++number;
231
232 pdgCode = TMath::Abs(particle->PID);
233
234 itFractionMap = fFractionMap.find(pdgCode);
235 if(itFractionMap == fFractionMap.end())
236 {
237 itFractionMap = fFractionMap.find(0);
238 }
239
[82575a3]240 ecalFraction = itFractionMap->second.first;
241 hcalFraction = itFractionMap->second.second;
242
243 fTowerECalFractions.push_back(ecalFraction);
244 fTowerHCalFractions.push_back(hcalFraction);
245
246 if(ecalFraction < 1.0E-9 && hcalFraction < 1.0E-9) continue;
[d7d2da3]247
248 // find eta bin [1, fEtaBins.size - 1]
249 itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), particlePosition.Eta());
250 if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
251 etaBin = distance(fEtaBins.begin(), itEtaBin);
252
253 // phi bins for given eta bin
254 phiBins = fPhiBins[etaBin];
255
256 // find phi bin [1, phiBins.size - 1]
257 itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), particlePosition.Phi());
258 if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
259 phiBin = distance(phiBins->begin(), itPhiBin);
260
[73e0386]261 flags = 0;
[2dab783]262 flags |= (pdgCode == 11 || pdgCode == 22) << 1;
[d7d2da3]263
264 // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for particle number}
265 towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
266
267 fTowerHits.push_back(towerHit);
268 }
269
270 // loop over all tracks
271 fItTrackInputArray->Reset();
272 number = -1;
273 while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
274 {
275 const TLorentzVector &trackPosition = track->Position;
276 ++number;
277
[73e0386]278 pdgCode = TMath::Abs(track->PID);
279
280 itFractionMap = fFractionMap.find(pdgCode);
281 if(itFractionMap == fFractionMap.end())
282 {
283 itFractionMap = fFractionMap.find(0);
284 }
285
[82575a3]286 ecalFraction = itFractionMap->second.first;
287 hcalFraction = itFractionMap->second.second;
288
289 fTrackECalFractions.push_back(ecalFraction);
290 fTrackHCalFractions.push_back(hcalFraction);
291
[d7d2da3]292 // find eta bin [1, fEtaBins.size - 1]
293 itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
294 if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
295 etaBin = distance(fEtaBins.begin(), itEtaBin);
296
297 // phi bins for given eta bin
298 phiBins = fPhiBins[etaBin];
299
300 // find phi bin [1, phiBins.size - 1]
301 itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), trackPosition.Phi());
302 if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
303 phiBin = distance(phiBins->begin(), itPhiBin);
304
[73e0386]305 flags = 1;
306
[d7d2da3]307 // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number}
[73e0386]308 towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
[d7d2da3]309
310 fTowerHits.push_back(towerHit);
311 }
312
313 // all hits are sorted first by eta bin number, then by phi bin number,
314 // then by flags and then by particle or track number
315 sort(fTowerHits.begin(), fTowerHits.end());
316
317 // loop over all hits
318 towerEtaPhi = 0;
319 fTower = 0;
320 for(itTowerHits = fTowerHits.begin(); itTowerHits != fTowerHits.end(); ++itTowerHits)
321 {
322 towerHit = (*itTowerHits);
323 flags = (towerHit >> 24) & 0x00000000000000FFLL;
324 number = (towerHit) & 0x0000000000FFFFFFLL;
325 hitEtaPhi = towerHit >> 32;
326
327 if(towerEtaPhi != hitEtaPhi)
328 {
329 // switch to next tower
330 towerEtaPhi = hitEtaPhi;
331
332 // finalize previous tower
333 FinalizeTower();
334
335 // create new tower
336 fTower = factory->NewCandidate();
337
338 phiBin = (towerHit >> 32) & 0x000000000000FFFFLL;
339 etaBin = (towerHit >> 48) & 0x000000000000FFFFLL;
340
341 // phi bins for given eta bin
342 phiBins = fPhiBins[etaBin];
343
344 // calculate eta and phi of the tower's center
345 fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
346 fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
347
348 fTowerEdges[0] = fEtaBins[etaBin - 1];
349 fTowerEdges[1] = fEtaBins[etaBin];
350 fTowerEdges[2] = (*phiBins)[phiBin - 1];
351 fTowerEdges[3] = (*phiBins)[phiBin];
352
[82575a3]353 fTowerECalEnergy = 0.0;
354 fTowerHCalEnergy = 0.0;
355
356 fTrackECalEnergy = 0.0;
357 fTrackHCalEnergy = 0.0;
358
359 fTowerECalTime = 0.0;
360 fTowerHCalTime = 0.0;
361
362 fTrackECalTime = 0.0;
363 fTrackHCalTime = 0.0;
364
[ca29ad7]365 fTowerECalTimeWeight = 0.0;
366 fTowerHCalTimeWeight = 0.0;
[a221d1f]367
[2dab783]368 fTowerTrackHits = 0;
369 fTowerPhotonHits = 0;
[a221d1f]370
[9493a0f]371 fTowerTrackArray->Clear();
[d7d2da3]372 }
373
374 // check for track hits
[73e0386]375 if(flags & 1)
[d7d2da3]376 {
[2dab783]377 ++fTowerTrackHits;
[73e0386]378
[2dab783]379 track = static_cast<Candidate*>(fTrackInputArray->At(number));
380 momentum = track->Momentum;
[22dc7fd]381 position = track->Position;
[82575a3]382
[a221d1f]383
[82575a3]384 ecalEnergy = momentum.E() * fTrackECalFractions[number];
385 hcalEnergy = momentum.E() * fTrackHCalFractions[number];
386
387 fTrackECalEnergy += ecalEnergy;
388 fTrackHCalEnergy += hcalEnergy;
[a221d1f]389
[82575a3]390 fTrackECalTime += TMath::Sqrt(ecalEnergy)*position.T();
391 fTrackHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
[a221d1f]392
[ca29ad7]393 fTrackECalTimeWeight += TMath::Sqrt(ecalEnergy);
394 fTrackHCalTimeWeight += TMath::Sqrt(hcalEnergy);
[82575a3]395
[2dab783]396 fTowerTrackArray->Add(track);
[73e0386]397
[2dab783]398 continue;
[73e0386]399 }
[a221d1f]400
[73e0386]401 // check for photon and electron hits in current tower
[2dab783]402 if(flags & 2) ++fTowerPhotonHits;
[a221d1f]403
[d7d2da3]404 particle = static_cast<Candidate*>(fParticleInputArray->At(number));
405 momentum = particle->Momentum;
[22dc7fd]406 position = particle->Position;
[d7d2da3]407
408 // fill current tower
[82575a3]409 ecalEnergy = momentum.E() * fTowerECalFractions[number];
410 hcalEnergy = momentum.E() * fTowerHCalFractions[number];
411
412 fTowerECalEnergy += ecalEnergy;
413 fTowerHCalEnergy += hcalEnergy;
414
415 fTowerECalTime += TMath::Sqrt(ecalEnergy)*position.T();
416 fTowerHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
417
[ca29ad7]418 fTowerECalTimeWeight += TMath::Sqrt(ecalEnergy);
419 fTowerHCalTimeWeight += TMath::Sqrt(hcalEnergy);
[a221d1f]420
[82575a3]421
[3079350]422 fTower->AddCandidate(particle);
[d7d2da3]423 }
424
425 // finalize last tower
426 FinalizeTower();
427}
428
429//------------------------------------------------------------------------------
430
431void Calorimeter::FinalizeTower()
432{
[82575a3]433 Candidate *track, *tower;
[d7d2da3]434 Double_t energy, pt, eta, phi;
[82575a3]435 Double_t ecalEnergy, hcalEnergy;
436 Double_t ecalSigma, hcalSigma;
437 Double_t ecalTime, hcalTime, time;
[4600a41]438
[d7d2da3]439 if(!fTower) return;
440
[82575a3]441 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy);
442
443 ecalEnergy = LogNormal(fTowerECalEnergy, ecalSigma);
[ca29ad7]444 ecalTime = (fTowerECalTimeWeight < 1.0E-09 ) ? 0 : fTowerECalTime/fTowerECalTimeWeight;
[bdd52a7]445
[82575a3]446 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy);
[4600a41]447
[82575a3]448 hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma);
[ca29ad7]449 hcalTime = (fTowerHCalTimeWeight < 1.0E-09 ) ? 0 : fTowerHCalTime/fTowerHCalTimeWeight;
[82575a3]450
[a221d1f]451
[4b9a2dc]452 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
453 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
454
[8624f58]455 ecalEnergy = (ecalEnergy < fECalEnergyMin || ecalEnergy < fECalSigmaMin*ecalSigma) ? 0 : ecalEnergy;
456 hcalEnergy = (hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalSigmaMin*hcalSigma) ? 0 : hcalEnergy;
[4b9a2dc]457
[82575a3]458 energy = ecalEnergy + hcalEnergy;
[a221d1f]459 time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy));
[82575a3]460
[a221d1f]461 if(fDitherTowerCenter)
462 {
463 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
464 phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
465 }
466 else
467 {
468 eta = fTowerEta;
469 phi = fTowerPhi;
470 }
[d7d2da3]471
472 pt = energy / TMath::CosH(eta);
473
[22dc7fd]474 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
[d7d2da3]475 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
[82575a3]476 fTower->Eem = ecalEnergy;
477 fTower->Ehad = hcalEnergy;
478
[d7d2da3]479 fTower->Edges[0] = fTowerEdges[0];
480 fTower->Edges[1] = fTowerEdges[1];
481 fTower->Edges[2] = fTowerEdges[2];
482 fTower->Edges[3] = fTowerEdges[3];
483
[4b9a2dc]484 if( energy > 0.0 )
[82575a3]485 {
486 if(fTowerPhotonHits > 0 && fTowerTrackHits == 0)
487 {
488 fPhotonOutputArray->Add(fTower);
489 }
[a221d1f]490
[82575a3]491 fTowerOutputArray->Add(fTower);
492 }
[0d5f77c]493
[f6b9fec]494 // fill energy flow candidates
[82575a3]495
496 // save all the tracks as energy flow tracks
497 fItTowerTrackArray->Reset();
498 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next())))
499 {
500 fEFlowTrackOutputArray->Add(track);
501 }
502
503 ecalEnergy -= fTrackECalEnergy;
[8624f58]504 if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalSigmaMin*fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy)) ecalEnergy = 0.0;
[82575a3]505
506 hcalEnergy -= fTrackHCalEnergy;
[8624f58]507 if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalSigmaMin*fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy)) hcalEnergy = 0.0;
[82575a3]508
509 energy = ecalEnergy + hcalEnergy;
510
511 if(ecalEnergy > 0.0)
[2dab783]512 {
[d4c4d9d]513 // create new photon tower
[2dab783]514 tower = static_cast<Candidate*>(fTower->Clone());
[0d5f77c]515
[82575a3]516 pt = ecalEnergy / TMath::CosH(eta);
517
518 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalEnergy);
519 tower->Eem = ecalEnergy;
520 tower->Ehad = 0;
521
522 fEFlowPhotonOutputArray->Add(tower);
523 }
524 if(hcalEnergy > 0.0)
525 {
526 // create new neutral hadron tower
527 tower = static_cast<Candidate*>(fTower->Clone());
528
529 pt = hcalEnergy / TMath::CosH(eta);
530
531 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalEnergy);
532 tower->Eem = 0;
533 tower->Ehad = hcalEnergy;
534
535 fEFlowNeutralHadronOutputArray->Add(tower);
[d7d2da3]536 }
537}
538
539//------------------------------------------------------------------------------
[39022b6]540
[4600a41]541Double_t Calorimeter::LogNormal(Double_t mean, Double_t sigma)
542{
543 Double_t a, b;
544
545 if(mean > 0.0)
[39022b6]546 {
[4600a41]547 b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean))));
548 a = TMath::Log(mean) - 0.5*b*b;
549
550 return TMath::Exp(a + b*gRandom->Gaus(0, 1));
[39022b6]551 }
[4600a41]552 else
553 {
554 return 0.0;
555 }
556}
Note: See TracBrowser for help on using the repository browser.