[608] | 1 |
|
---|
[814] | 2 | /** \class Calorimeter
|
---|
| 3 | *
|
---|
[894] | 4 | * Fills calorimeter towers, performs calorimeter resolution smearing,
|
---|
[1356] | 5 | * and creates energy flow objects (tracks, photons, and neutral hadrons).
|
---|
[814] | 6 | *
|
---|
| 7 | * $Date: 2014-04-16 13:29:31 +0000 (Wed, 16 Apr 2014) $
|
---|
| 8 | * $Revision: 1364 $
|
---|
| 9 | *
|
---|
| 10 | *
|
---|
| 11 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
| 12 | *
|
---|
| 13 | */
|
---|
| 14 |
|
---|
[608] | 15 | #include "modules/Calorimeter.h"
|
---|
| 16 |
|
---|
[687] | 17 | #include "classes/DelphesClasses.h"
|
---|
| 18 | #include "classes/DelphesFactory.h"
|
---|
[766] | 19 | #include "classes/DelphesFormula.h"
|
---|
[608] | 20 |
|
---|
[703] | 21 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
| 22 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
| 23 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
| 24 |
|
---|
[608] | 25 | #include "TMath.h"
|
---|
| 26 | #include "TString.h"
|
---|
[629] | 27 | #include "TFormula.h"
|
---|
[703] | 28 | #include "TRandom3.h"
|
---|
| 29 | #include "TObjArray.h"
|
---|
| 30 | #include "TDatabasePDG.h"
|
---|
| 31 | #include "TLorentzVector.h"
|
---|
[608] | 32 |
|
---|
[935] | 33 | #include <algorithm>
|
---|
[703] | 34 | #include <stdexcept>
|
---|
[608] | 35 | #include <iostream>
|
---|
[703] | 36 | #include <sstream>
|
---|
[608] | 37 |
|
---|
| 38 | using namespace std;
|
---|
| 39 |
|
---|
| 40 | //------------------------------------------------------------------------------
|
---|
| 41 |
|
---|
| 42 | Calorimeter::Calorimeter() :
|
---|
[1364] | 43 | fResolutionFormula(0),
|
---|
[886] | 44 | fItParticleInputArray(0), fItTrackInputArray(0),
|
---|
[1273] | 45 | fTowerTrackArray(0), fItTowerTrackArray(0)
|
---|
[608] | 46 | {
|
---|
[1364] | 47 | fResolutionFormula = new DelphesFormula;
|
---|
| 48 |
|
---|
[1235] | 49 | fTowerTrackArray = new TObjArray;
|
---|
| 50 | fItTowerTrackArray = fTowerTrackArray->MakeIterator();
|
---|
[608] | 51 | }
|
---|
| 52 |
|
---|
| 53 | //------------------------------------------------------------------------------
|
---|
| 54 |
|
---|
| 55 | Calorimeter::~Calorimeter()
|
---|
| 56 | {
|
---|
[1364] | 57 | if(fResolutionFormula) delete fResolutionFormula;
|
---|
| 58 |
|
---|
[1235] | 59 | if(fTowerTrackArray) delete fTowerTrackArray;
|
---|
| 60 | if(fItTowerTrackArray) delete fItTowerTrackArray;
|
---|
[1273] | 61 | }
|
---|
[1233] | 62 |
|
---|
[608] | 63 | //------------------------------------------------------------------------------
|
---|
| 64 |
|
---|
| 65 | void Calorimeter::Init()
|
---|
| 66 | {
|
---|
[704] | 67 | ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions;
|
---|
[1364] | 68 | Long_t i, j, k, size, sizeEtaBins, sizePhiBins;
|
---|
| 69 | Double_t fraction;
|
---|
[622] | 70 | TBinMap::iterator itEtaBin;
|
---|
[659] | 71 | set< Double_t >::iterator itPhiBin;
|
---|
| 72 | vector< Double_t > *phiBins;
|
---|
[608] | 73 |
|
---|
[613] | 74 | // read eta and phi bins
|
---|
[646] | 75 | param = GetParam("EtaPhiBins");
|
---|
[608] | 76 | size = param.GetSize();
|
---|
[622] | 77 | fBinMap.clear();
|
---|
[663] | 78 | fEtaBins.clear();
|
---|
| 79 | fPhiBins.clear();
|
---|
[613] | 80 | for(i = 0; i < size/2; ++i)
|
---|
[608] | 81 | {
|
---|
[646] | 82 | paramEtaBins = param[i*2];
|
---|
| 83 | sizeEtaBins = paramEtaBins.GetSize();
|
---|
[613] | 84 | paramPhiBins = param[i*2 + 1];
|
---|
| 85 | sizePhiBins = paramPhiBins.GetSize();
|
---|
[646] | 86 |
|
---|
| 87 | for(j = 0; j < sizeEtaBins; ++j)
|
---|
[613] | 88 | {
|
---|
[646] | 89 | for(k = 0; k < sizePhiBins; ++k)
|
---|
| 90 | {
|
---|
[659] | 91 | fBinMap[paramEtaBins[j].GetDouble()].insert(paramPhiBins[k].GetDouble());
|
---|
[646] | 92 | }
|
---|
[613] | 93 | }
|
---|
[608] | 94 | }
|
---|
| 95 |
|
---|
[661] | 96 | // for better performance we transform map of sets to parallel vectors:
|
---|
[659] | 97 | // vector< double > and vector< vector< double >* >
|
---|
[622] | 98 | for(itEtaBin = fBinMap.begin(); itEtaBin != fBinMap.end(); ++itEtaBin)
|
---|
[813] | 99 | {
|
---|
[659] | 100 | fEtaBins.push_back(itEtaBin->first);
|
---|
| 101 | phiBins = new vector< double >(itEtaBin->second.size());
|
---|
| 102 | fPhiBins.push_back(phiBins);
|
---|
[666] | 103 | phiBins->clear();
|
---|
[659] | 104 | for(itPhiBin = itEtaBin->second.begin(); itPhiBin != itEtaBin->second.end(); ++itPhiBin)
|
---|
[622] | 105 | {
|
---|
[659] | 106 | phiBins->push_back(*itPhiBin);
|
---|
[622] | 107 | }
|
---|
| 108 | }
|
---|
[935] | 109 |
|
---|
[608] | 110 | // read energy fractions for different particles
|
---|
| 111 | param = GetParam("EnergyFraction");
|
---|
| 112 | size = param.GetSize();
|
---|
[935] | 113 |
|
---|
[608] | 114 | // set default energy fractions values
|
---|
| 115 | fFractionMap.clear();
|
---|
[1364] | 116 | fFractionMap[0] = 1.0;
|
---|
[935] | 117 |
|
---|
[608] | 118 | for(i = 0; i < size/2; ++i)
|
---|
| 119 | {
|
---|
[703] | 120 | paramFractions = param[i*2 + 1];
|
---|
[1364] | 121 | fraction = paramFractions[0].GetDouble();
|
---|
| 122 | fFractionMap[param[i*2].GetInt()] = fraction;
|
---|
[608] | 123 | }
|
---|
[629] | 124 | /*
|
---|
[626] | 125 | TFractionMap::iterator itFractionMap;
|
---|
| 126 | for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
|
---|
| 127 | {
|
---|
| 128 | cout << itFractionMap->first << " " << itFractionMap->second.first << " " << itFractionMap->second.second << endl;
|
---|
| 129 | }
|
---|
[629] | 130 | */
|
---|
[935] | 131 | // read resolution formulas
|
---|
[1364] | 132 | fResolutionFormula->Compile(GetString("ResolutionFormula", "0"));
|
---|
| 133 |
|
---|
[608] | 134 | // import array with output from other modules
|
---|
[886] | 135 | fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles"));
|
---|
| 136 | fItParticleInputArray = fParticleInputArray->MakeIterator();
|
---|
[608] | 137 |
|
---|
[886] | 138 | fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
|
---|
| 139 | fItTrackInputArray = fTrackInputArray->MakeIterator();
|
---|
| 140 |
|
---|
[766] | 141 | // create output arrays
|
---|
[629] | 142 | fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers"));
|
---|
[1364] | 143 | fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers"));
|
---|
| 144 |
|
---|
[608] | 145 | }
|
---|
| 146 |
|
---|
| 147 | //------------------------------------------------------------------------------
|
---|
| 148 |
|
---|
| 149 | void Calorimeter::Finish()
|
---|
| 150 | {
|
---|
[1273] | 151 | vector< vector< Double_t >* >::iterator itPhiBin;
|
---|
[886] | 152 | if(fItParticleInputArray) delete fItParticleInputArray;
|
---|
[938] | 153 | if(fItTrackInputArray) delete fItTrackInputArray;
|
---|
[660] | 154 | for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin)
|
---|
| 155 | {
|
---|
| 156 | delete *itPhiBin;
|
---|
| 157 | }
|
---|
[608] | 158 | }
|
---|
| 159 |
|
---|
| 160 | //------------------------------------------------------------------------------
|
---|
| 161 |
|
---|
| 162 | void Calorimeter::Process()
|
---|
| 163 | {
|
---|
[886] | 164 | Candidate *particle, *track;
|
---|
[680] | 165 | TLorentzVector position, momentum;
|
---|
[1002] | 166 | Short_t etaBin, phiBin, flags;
|
---|
| 167 | Int_t number;
|
---|
[745] | 168 | Long64_t towerHit, towerEtaPhi, hitEtaPhi;
|
---|
[1364] | 169 | Double_t fraction;
|
---|
| 170 | Double_t energy;
|
---|
[608] | 171 | Int_t pdgCode;
|
---|
| 172 |
|
---|
| 173 | TFractionMap::iterator itFractionMap;
|
---|
| 174 |
|
---|
[659] | 175 | vector< Double_t >::iterator itEtaBin;
|
---|
| 176 | vector< Double_t >::iterator itPhiBin;
|
---|
| 177 | vector< Double_t > *phiBins;
|
---|
[622] | 178 |
|
---|
[745] | 179 | vector< Long64_t >::iterator itTowerHits;
|
---|
[935] | 180 |
|
---|
[687] | 181 | DelphesFactory *factory = GetFactory();
|
---|
[661] | 182 | fTowerHits.clear();
|
---|
[1364] | 183 | fTowerFractions.clear();
|
---|
| 184 | fTrackFractions.clear();
|
---|
| 185 |
|
---|
[608] | 186 | // loop over all particles
|
---|
[886] | 187 | fItParticleInputArray->Reset();
|
---|
[666] | 188 | number = -1;
|
---|
[886] | 189 | while((particle = static_cast<Candidate*>(fItParticleInputArray->Next())))
|
---|
[608] | 190 | {
|
---|
[886] | 191 | const TLorentzVector &particlePosition = particle->Position;
|
---|
[666] | 192 | ++number;
|
---|
[608] | 193 |
|
---|
[886] | 194 | pdgCode = TMath::Abs(particle->PID);
|
---|
[626] | 195 |
|
---|
| 196 | itFractionMap = fFractionMap.find(pdgCode);
|
---|
| 197 | if(itFractionMap == fFractionMap.end())
|
---|
| 198 | {
|
---|
| 199 | itFractionMap = fFractionMap.find(0);
|
---|
| 200 | }
|
---|
| 201 |
|
---|
[1364] | 202 | fraction = itFractionMap->second;
|
---|
| 203 | fTowerFractions.push_back(fraction);
|
---|
| 204 |
|
---|
| 205 | if(fraction < 1.0E-9) continue;
|
---|
[666] | 206 |
|
---|
[730] | 207 | // find eta bin [1, fEtaBins.size - 1]
|
---|
[886] | 208 | itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), particlePosition.Eta());
|
---|
[659] | 209 | if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
|
---|
[730] | 210 | etaBin = distance(fEtaBins.begin(), itEtaBin);
|
---|
[935] | 211 |
|
---|
[730] | 212 | // phi bins for given eta bin
|
---|
[659] | 213 | phiBins = fPhiBins[etaBin];
|
---|
[730] | 214 |
|
---|
| 215 | // find phi bin [1, phiBins.size - 1]
|
---|
[886] | 216 | itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), particlePosition.Phi());
|
---|
[659] | 217 | if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
|
---|
[666] | 218 | phiBin = distance(phiBins->begin(), itPhiBin);
|
---|
[608] | 219 |
|
---|
[1233] | 220 | flags = 0;
|
---|
[1273] | 221 | flags |= (pdgCode == 11 || pdgCode == 22) << 1;
|
---|
[745] | 222 |
|
---|
[1004] | 223 | // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for particle number}
|
---|
| 224 | towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
|
---|
[935] | 225 |
|
---|
[661] | 226 | fTowerHits.push_back(towerHit);
|
---|
| 227 | }
|
---|
| 228 |
|
---|
[886] | 229 | // loop over all tracks
|
---|
| 230 | fItTrackInputArray->Reset();
|
---|
| 231 | number = -1;
|
---|
| 232 | while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
|
---|
| 233 | {
|
---|
| 234 | const TLorentzVector &trackPosition = track->Position;
|
---|
| 235 | ++number;
|
---|
| 236 |
|
---|
[1233] | 237 | pdgCode = TMath::Abs(track->PID);
|
---|
| 238 |
|
---|
| 239 | itFractionMap = fFractionMap.find(pdgCode);
|
---|
| 240 | if(itFractionMap == fFractionMap.end())
|
---|
| 241 | {
|
---|
| 242 | itFractionMap = fFractionMap.find(0);
|
---|
| 243 | }
|
---|
| 244 |
|
---|
[1364] | 245 | fraction = itFractionMap->second;
|
---|
| 246 |
|
---|
| 247 | fTrackFractions.push_back(fraction);
|
---|
| 248 |
|
---|
[886] | 249 | // find eta bin [1, fEtaBins.size - 1]
|
---|
| 250 | itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta());
|
---|
| 251 | if(itEtaBin == fEtaBins.begin() || itEtaBin == fEtaBins.end()) continue;
|
---|
| 252 | etaBin = distance(fEtaBins.begin(), itEtaBin);
|
---|
[935] | 253 |
|
---|
[886] | 254 | // phi bins for given eta bin
|
---|
| 255 | phiBins = fPhiBins[etaBin];
|
---|
| 256 |
|
---|
| 257 | // find phi bin [1, phiBins.size - 1]
|
---|
| 258 | itPhiBin = lower_bound(phiBins->begin(), phiBins->end(), trackPosition.Phi());
|
---|
| 259 | if(itPhiBin == phiBins->begin() || itPhiBin == phiBins->end()) continue;
|
---|
| 260 | phiBin = distance(phiBins->begin(), itPhiBin);
|
---|
| 261 |
|
---|
[1233] | 262 | flags = 1;
|
---|
| 263 |
|
---|
[1004] | 264 | // make tower hit {16-bits for eta bin number, 16-bits for phi bin number, 8-bits for flags, 24-bits for track number}
|
---|
[1233] | 265 | towerHit = (Long64_t(etaBin) << 48) | (Long64_t(phiBin) << 32) | (Long64_t(flags) << 24) | Long64_t(number);
|
---|
[935] | 266 |
|
---|
[886] | 267 | fTowerHits.push_back(towerHit);
|
---|
| 268 | }
|
---|
| 269 |
|
---|
[894] | 270 | // all hits are sorted first by eta bin number, then by phi bin number,
|
---|
| 271 | // then by flags and then by particle or track number
|
---|
[661] | 272 | sort(fTowerHits.begin(), fTowerHits.end());
|
---|
| 273 |
|
---|
[730] | 274 | // loop over all hits
|
---|
[661] | 275 | towerEtaPhi = 0;
|
---|
[732] | 276 | fTower = 0;
|
---|
[661] | 277 | for(itTowerHits = fTowerHits.begin(); itTowerHits != fTowerHits.end(); ++itTowerHits)
|
---|
| 278 | {
|
---|
| 279 | towerHit = (*itTowerHits);
|
---|
[1004] | 280 | flags = (towerHit >> 24) & 0x00000000000000FFLL;
|
---|
| 281 | number = (towerHit) & 0x0000000000FFFFFFLL;
|
---|
| 282 | hitEtaPhi = towerHit >> 32;
|
---|
[730] | 283 |
|
---|
[661] | 284 | if(towerEtaPhi != hitEtaPhi)
|
---|
[608] | 285 | {
|
---|
[730] | 286 | // switch to next tower
|
---|
[661] | 287 | towerEtaPhi = hitEtaPhi;
|
---|
[730] | 288 |
|
---|
[661] | 289 | // finalize previous tower
|
---|
[730] | 290 | FinalizeTower();
|
---|
[661] | 291 |
|
---|
| 292 | // create new tower
|
---|
[730] | 293 | fTower = factory->NewCandidate();
|
---|
[661] | 294 |
|
---|
[1004] | 295 | phiBin = (towerHit >> 32) & 0x000000000000FFFFLL;
|
---|
| 296 | etaBin = (towerHit >> 48) & 0x000000000000FFFFLL;
|
---|
[730] | 297 |
|
---|
| 298 | // phi bins for given eta bin
|
---|
[661] | 299 | phiBins = fPhiBins[etaBin];
|
---|
[608] | 300 |
|
---|
[730] | 301 | // calculate eta and phi of the tower's center
|
---|
[731] | 302 | fTowerEta = 0.5*(fEtaBins[etaBin - 1] + fEtaBins[etaBin]);
|
---|
| 303 | fTowerPhi = 0.5*((*phiBins)[phiBin - 1] + (*phiBins)[phiBin]);
|
---|
[626] | 304 |
|
---|
[898] | 305 | fTowerEdges[0] = fEtaBins[etaBin - 1];
|
---|
| 306 | fTowerEdges[1] = fEtaBins[etaBin];
|
---|
| 307 | fTowerEdges[2] = (*phiBins)[phiBin - 1];
|
---|
| 308 | fTowerEdges[3] = (*phiBins)[phiBin];
|
---|
| 309 |
|
---|
[1364] | 310 | fTowerEnergy = 0.0;
|
---|
| 311 | fTrackEnergy = 0.0;
|
---|
| 312 |
|
---|
| 313 | fTowerTime = 0.0;
|
---|
| 314 | fTrackTime = 0.0;
|
---|
[1345] | 315 |
|
---|
[1364] | 316 | fTowerWeightTime = 0.0;
|
---|
| 317 |
|
---|
[1273] | 318 | fTowerTrackHits = 0;
|
---|
[1233] | 319 | fTowerPhotonHits = 0;
|
---|
[1356] | 320 |
|
---|
[1235] | 321 | fTowerTrackArray->Clear();
|
---|
[661] | 322 | }
|
---|
| 323 |
|
---|
[886] | 324 | // check for track hits
|
---|
[1233] | 325 | if(flags & 1)
|
---|
[886] | 326 | {
|
---|
[1273] | 327 | ++fTowerTrackHits;
|
---|
| 328 |
|
---|
[886] | 329 | track = static_cast<Candidate*>(fTrackInputArray->At(number));
|
---|
[1273] | 330 | momentum = track->Momentum;
|
---|
[1345] | 331 | position = track->Position;
|
---|
[1364] | 332 |
|
---|
| 333 | energy = momentum.E() * fTrackFractions[number];
|
---|
[1345] | 334 |
|
---|
[1364] | 335 | fTrackEnergy += energy;
|
---|
[1345] | 336 |
|
---|
[1364] | 337 | fTrackTime += TMath::Sqrt(energy)*position.T();
|
---|
| 338 | fTrackWeightTime += TMath::Sqrt(energy);
|
---|
| 339 |
|
---|
[886] | 340 | fTowerTrackArray->Add(track);
|
---|
[1235] | 341 |
|
---|
[886] | 342 | continue;
|
---|
| 343 | }
|
---|
[1356] | 344 |
|
---|
[1233] | 345 | // check for photon and electron hits in current tower
|
---|
[1273] | 346 | if(flags & 2) ++fTowerPhotonHits;
|
---|
[1356] | 347 |
|
---|
[886] | 348 | particle = static_cast<Candidate*>(fParticleInputArray->At(number));
|
---|
[888] | 349 | momentum = particle->Momentum;
|
---|
[1345] | 350 | position = particle->Position;
|
---|
[886] | 351 |
|
---|
[735] | 352 | // fill current tower
|
---|
[1364] | 353 | energy = momentum.E() * fTowerFractions[number];
|
---|
| 354 |
|
---|
| 355 | fTowerEnergy += energy;
|
---|
[1345] | 356 |
|
---|
[1364] | 357 | fTowerTime += TMath::Sqrt(energy)*position.T();
|
---|
| 358 | fTowerWeightTime += TMath::Sqrt(energy);
|
---|
| 359 |
|
---|
[1242] | 360 | fTower->AddCandidate(particle);
|
---|
[608] | 361 | }
|
---|
| 362 |
|
---|
[661] | 363 | // finalize last tower
|
---|
[730] | 364 | FinalizeTower();
|
---|
| 365 | }
|
---|
| 366 |
|
---|
| 367 | //------------------------------------------------------------------------------
|
---|
[931] | 368 |
|
---|
[730] | 369 | void Calorimeter::FinalizeTower()
|
---|
| 370 | {
|
---|
[1364] | 371 | Candidate *tower;
|
---|
[1078] | 372 | Double_t energy, pt, eta, phi;
|
---|
[1364] | 373 | Double_t sigma;
|
---|
| 374 | Double_t time;
|
---|
[1145] | 375 |
|
---|
[734] | 376 | if(!fTower) return;
|
---|
[733] | 377 |
|
---|
[1364] | 378 | sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerEnergy);
|
---|
[1275] | 379 |
|
---|
[1364] | 380 | // energy = gRandom->Gaus(fTowerEnergy, sigma);
|
---|
| 381 | // if(energy < 0.0) energy = 0.0;
|
---|
[733] | 382 |
|
---|
[1364] | 383 | energy = LogNormal(fTowerEnergy, sigma);
|
---|
| 384 | time = (fTowerWeightTime < 1.0E-09 ) ? 0 : fTowerTime/fTowerWeightTime;
|
---|
[733] | 385 |
|
---|
[1078] | 386 | eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
|
---|
| 387 | phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]);
|
---|
| 388 |
|
---|
[1086] | 389 | pt = energy / TMath::CosH(eta);
|
---|
| 390 |
|
---|
[1345] | 391 | // fTower->Position.SetXYZT(-time, 0.0, 0.0, time);
|
---|
| 392 | fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
|
---|
[1078] | 393 | fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
|
---|
[1364] | 394 |
|
---|
[898] | 395 | fTower->Edges[0] = fTowerEdges[0];
|
---|
| 396 | fTower->Edges[1] = fTowerEdges[1];
|
---|
| 397 | fTower->Edges[2] = fTowerEdges[2];
|
---|
| 398 | fTower->Edges[3] = fTowerEdges[3];
|
---|
[886] | 399 |
|
---|
[1345] | 400 |
|
---|
[1356] | 401 | // fill calorimeter towers
|
---|
[1364] | 402 | if(energy > 0.0) fTowerOutputArray->Add(fTower);
|
---|
[935] | 403 |
|
---|
[1364] | 404 |
|
---|
[931] | 405 | // fill energy flow candidates
|
---|
[1364] | 406 | energy -= fTrackEnergy;
|
---|
| 407 | if(energy < 0.0) energy = 0.0;
|
---|
| 408 |
|
---|
| 409 | // save energy excess as an energy flow tower
|
---|
| 410 | if(energy > 0.0)
|
---|
[735] | 411 | {
|
---|
[1356] | 412 | // create new photon tower
|
---|
[1273] | 413 | tower = static_cast<Candidate*>(fTower->Clone());
|
---|
[1364] | 414 | pt = energy / TMath::CosH(eta);
|
---|
[1241] | 415 |
|
---|
[1364] | 416 | tower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
|
---|
| 417 | fEFlowTowerOutputArray->Add(tower);
|
---|
[1356] | 418 | }
|
---|
| 419 |
|
---|
[608] | 420 | }
|
---|
| 421 |
|
---|
| 422 | //------------------------------------------------------------------------------
|
---|
[1142] | 423 |
|
---|
[1145] | 424 | Double_t Calorimeter::LogNormal(Double_t mean, Double_t sigma)
|
---|
| 425 | {
|
---|
| 426 | Double_t a, b;
|
---|
| 427 |
|
---|
| 428 | if(mean > 0.0)
|
---|
[1142] | 429 | {
|
---|
[1145] | 430 | b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean))));
|
---|
| 431 | a = TMath::Log(mean) - 0.5*b*b;
|
---|
| 432 |
|
---|
| 433 | return TMath::Exp(a + b*gRandom->Gaus(0, 1));
|
---|
[1142] | 434 | }
|
---|
[1145] | 435 | else
|
---|
| 436 | {
|
---|
| 437 | return 0.0;
|
---|
| 438 | }
|
---|
| 439 | }
|
---|