Changeset d870fc5 in git for modules/SimpleCalorimeter.cc
- Timestamp:
- Dec 21, 2014, 4:03:35 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- d77b51d
- Parents:
- 7f12612 (diff), e5767b57 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/SimpleCalorimeter.cc
r7f12612 rd870fc5 2 2 * Delphes: a framework for fast simulation of a generic collider experiment 3 3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium 4 * 4 * 5 5 * This program is free software: you can redistribute it and/or modify 6 6 * it under the terms of the GNU General Public License as published by 7 7 * the Free Software Foundation, either version 3 of the License, or 8 8 * (at your option) any later version. 9 * 9 * 10 10 * This program is distributed in the hope that it will be useful, 11 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 13 * GNU General Public License for more details. 14 * 14 * 15 15 * You should have received a copy of the GNU General Public License 16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. … … 22 22 * Fills SimpleCalorimeter towers, performs SimpleCalorimeter resolution smearing, 23 23 * and creates energy flow objects (tracks, photons, and neutral hadrons). 24 *25 * $Date: 2014-04-16 15:29:31 +0200 (Wed, 16 Apr 2014) $26 * $Revision: 1364 $27 *28 24 * 29 25 * \author P. Demin - UCL, Louvain-la-Neuve … … 64 60 { 65 61 fResolutionFormula = new DelphesFormula; 66 62 67 63 fTowerTrackArray = new TObjArray; 68 64 fItTowerTrackArray = fTowerTrackArray->MakeIterator(); … … 74 70 { 75 71 if(fResolutionFormula) delete fResolutionFormula; 76 72 77 73 if(fTowerTrackArray) delete fTowerTrackArray; 78 74 if(fItTowerTrackArray) delete fItTowerTrackArray; … … 140 136 fFractionMap[param[i*2].GetInt()] = fraction; 141 137 } 138 142 139 /* 143 140 TFractionMap::iterator itFractionMap; … … 149 146 150 147 // read min E value for towers to be saved 151 fEnergyMin = GetDouble("TowerMinEnergy", 0.0); 152 fSigmaMin = GetDouble("TowerMinSignificance", 0.0); 153 148 fEnergyMin = GetDouble("EnergyMin", 0.0); 149 150 fEnergySignificanceMin = GetDouble("EnergySignificanceMin", 0.0); 151 152 // switch on or off the dithering of the center of calorimeter towers 153 fDitherTowerCenter = GetBool("DitherTowerCenter", true); 154 154 155 // read resolution formulas 155 156 fResolutionFormula->Compile(GetString("ResolutionFormula", "0")); 156 157 157 158 // import array with output from other modules 158 159 fParticleInputArray = ImportArray(GetString("ParticleInputArray", "ParticlePropagator/particles")); … … 165 166 fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers")); 166 167 fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers")); 167 168 168 } 169 169 … … 206 206 fTowerFractions.clear(); 207 207 fTrackFractions.clear(); 208 208 209 209 // loop over all particles 210 210 fItParticleInputArray->Reset(); … … 225 225 fraction = itFractionMap->second; 226 226 fTowerFractions.push_back(fraction); 227 227 228 228 if(fraction < 1.0E-9) continue; 229 229 … … 267 267 268 268 fraction = itFractionMap->second; 269 269 270 270 fTrackFractions.push_back(fraction); 271 271 272 272 // find eta bin [1, fEtaBins.size - 1] 273 273 itEtaBin = lower_bound(fEtaBins.begin(), fEtaBins.end(), trackPosition.Eta()); … … 333 333 fTowerEnergy = 0.0; 334 334 fTrackEnergy = 0.0; 335 335 336 336 fTowerTime = 0.0; 337 337 fTrackTime = 0.0; 338 339 fTower WeightTime = 0.0;340 338 339 fTowerTimeWeight = 0.0; 340 341 341 fTowerTrackHits = 0; 342 342 fTowerPhotonHits = 0; 343 343 344 344 fTowerTrackArray->Clear(); 345 345 } … … 353 353 momentum = track->Momentum; 354 354 position = track->Position; 355 355 356 356 energy = momentum.E() * fTrackFractions[number]; 357 357 358 358 fTrackEnergy += energy; 359 359 360 360 fTrackTime += TMath::Sqrt(energy)*position.T(); 361 fTrack WeightTime+= TMath::Sqrt(energy);362 361 fTrackTimeWeight += TMath::Sqrt(energy); 362 363 363 fTowerTrackArray->Add(track); 364 364 365 365 continue; 366 366 } 367 367 368 368 // check for photon and electron hits in current tower 369 369 if(flags & 2) ++fTowerPhotonHits; 370 370 371 371 particle = static_cast<Candidate*>(fParticleInputArray->At(number)); 372 372 momentum = particle->Momentum; … … 375 375 // fill current tower 376 376 energy = momentum.E() * fTowerFractions[number]; 377 377 378 378 fTowerEnergy += energy; 379 379 380 380 fTowerTime += TMath::Sqrt(energy)*position.T(); 381 fTower WeightTime+= TMath::Sqrt(energy);382 381 fTowerTimeWeight += TMath::Sqrt(energy); 382 383 383 fTower->AddCandidate(particle); 384 384 } … … 401 401 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerEnergy); 402 402 403 // energy = gRandom->Gaus(fTowerEnergy, sigma);404 // if(energy < 0.0) energy = 0.0;405 406 403 energy = LogNormal(fTowerEnergy, sigma); 407 time = (fTowerWeightTime < 1.0E-09 ) ? 0 : fTowerTime/fTowerWeightTime; 404 405 time = (fTowerTimeWeight < 1.0E-09 ) ? 0.0 : fTowerTime/fTowerTimeWeight; 408 406 409 407 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy); 410 411 energy = (energy < fEnergyMin || energy < fSigmaMin*sigma) ? 0 : energy; 412 413 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); 414 phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]); 408 409 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 410 411 if(fDitherTowerCenter) 412 { 413 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); 414 phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]); 415 } 416 else 417 { 418 eta = fTowerEta; 419 phi = fTowerPhi; 420 } 415 421 416 422 pt = energy / TMath::CosH(eta); 417 423 418 // fTower->Position.SetXYZT(-time, 0.0, 0.0, time);419 424 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time); 420 425 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 421 426 422 427 fTower->Edges[0] = fTowerEdges[0]; 423 428 fTower->Edges[1] = fTowerEdges[1]; … … 425 430 fTower->Edges[3] = fTowerEdges[3]; 426 431 427 428 432 // fill SimpleCalorimeter towers 429 433 if(energy > 0.0) fTowerOutputArray->Add(fTower); 430 434 431 432 435 // fill energy flow candidates 433 436 energy -= fTrackEnergy; 434 if(energy < fEnergyMin || energy < fSigmaMin*fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy)) energy = 0.0; 435 437 438 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy); 439 440 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 441 436 442 // save energy excess as an energy flow tower 437 443 if(energy > 0.0) … … 444 450 fEFlowTowerOutputArray->Add(tower); 445 451 } 446 447 452 } 448 453 … … 458 463 a = TMath::Log(mean) - 0.5*b*b; 459 464 460 return TMath::Exp(a + b*gRandom->Gaus(0 , 1));465 return TMath::Exp(a + b*gRandom->Gaus(0.0, 1.0)); 461 466 } 462 467 else
Note:
See TracChangeset
for help on using the changeset viewer.