Changes in modules/Calorimeter.cc [38bf1ae:01f457a] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/Calorimeter.cc
r38bf1ae r01f457a 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 calorimeter towers, performs calorimeter resolution smearing, 23 23 * and creates energy flow objects (tracks, photons, and neutral hadrons). 24 * 25 * $Date$ 26 * $Revision$ 27 * 24 28 * 25 29 * \author P. Demin - UCL, Louvain-la-Neuve … … 82 86 { 83 87 ExRootConfParam param, paramEtaBins, paramPhiBins, paramFractions; 84 Long_t i, j, k, size, sizeEtaBins, sizePhiBins ;88 Long_t i, j, k, size, sizeEtaBins, sizePhiBins, sizeFractions; 85 89 Double_t ecalFraction, hcalFraction; 86 90 TBinMap::iterator itEtaBin; … … 135 139 { 136 140 paramFractions = param[i*2 + 1]; 141 sizeFractions = paramFractions.GetSize(); 137 142 138 143 ecalFraction = paramFractions[0].GetDouble(); … … 141 146 fFractionMap[param[i*2].GetInt()] = make_pair(ecalFraction, hcalFraction); 142 147 } 143 144 148 /* 145 149 TFractionMap::iterator itFractionMap; … … 151 155 152 156 // read min E value for towers to be saved 153 fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0); 154 fHCalEnergyMin = GetDouble("HCalEnergyMin", 0.0); 155 156 fECalEnergySignificanceMin = GetDouble("ECalEnergySignificanceMin", 0.0); 157 fHCalEnergySignificanceMin = GetDouble("HCalEnergySignificanceMin", 0.0); 158 159 // switch on or off the dithering of the center of calorimeter towers 160 fDitherTowerCenter = GetBool("DitherTowerCenter", true); 161 157 fEcalEnergyMin = GetDouble("EcalTowerMinEnergy", 0.0); 158 fHcalEnergyMin = GetDouble("HcalTowerMinEnergy", 0.0); 159 160 fEcalSigmaMin = GetDouble("EcalTowerMinSignificance", 0.0); 161 fHcalSigmaMin = GetDouble("HcalTowerMinSignificance", 0.0); 162 163 162 164 // read resolution formulas 163 165 fECalResolutionFormula->Compile(GetString("ECalResolutionFormula", "0")); … … 174 176 fTowerOutputArray = ExportArray(GetString("TowerOutputArray", "towers")); 175 177 fPhotonOutputArray = ExportArray(GetString("PhotonOutputArray", "photons")); 176 178 177 179 fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks")); 178 180 fEFlowPhotonOutputArray = ExportArray(GetString("EFlowPhotonOutputArray", "eflowPhotons")); 179 181 fEFlowNeutralHadronOutputArray = ExportArray(GetString("EFlowNeutralHadronOutputArray", "eflowNeutralHadrons")); 182 183 180 184 } 181 185 … … 362 366 fTrackHCalTime = 0.0; 363 367 364 fTowerECal TimeWeight = 0.0;365 fTowerHCal TimeWeight= 0.0;366 368 fTowerECalWeightTime = 0.0; 369 fTowerHCalWeightTime = 0.0; 370 367 371 fTowerTrackHits = 0; 368 372 fTowerPhotonHits = 0; 369 373 370 374 fTowerTrackArray->Clear(); 371 375 } … … 380 384 position = track->Position; 381 385 382 386 383 387 ecalEnergy = momentum.E() * fTrackECalFractions[number]; 384 388 hcalEnergy = momentum.E() * fTrackHCalFractions[number]; … … 386 390 fTrackECalEnergy += ecalEnergy; 387 391 fTrackHCalEnergy += hcalEnergy; 388 392 389 393 fTrackECalTime += TMath::Sqrt(ecalEnergy)*position.T(); 390 394 fTrackHCalTime += TMath::Sqrt(hcalEnergy)*position.T(); 391 392 fTrackECal TimeWeight+= TMath::Sqrt(ecalEnergy);393 fTrackHCal TimeWeight+= TMath::Sqrt(hcalEnergy);395 396 fTrackECalWeightTime += TMath::Sqrt(ecalEnergy); 397 fTrackHCalWeightTime += TMath::Sqrt(hcalEnergy); 394 398 395 399 fTowerTrackArray->Add(track); … … 397 401 continue; 398 402 } 399 403 400 404 // check for photon and electron hits in current tower 401 405 if(flags & 2) ++fTowerPhotonHits; 402 406 403 407 particle = static_cast<Candidate*>(fParticleInputArray->At(number)); 404 408 momentum = particle->Momentum; … … 415 419 fTowerHCalTime += TMath::Sqrt(hcalEnergy)*position.T(); 416 420 417 fTowerECal TimeWeight+= TMath::Sqrt(ecalEnergy);418 fTowerHCal TimeWeight+= TMath::Sqrt(hcalEnergy);419 421 fTowerECalWeightTime += TMath::Sqrt(ecalEnergy); 422 fTowerHCalWeightTime += TMath::Sqrt(hcalEnergy); 423 420 424 421 425 fTower->AddCandidate(particle); … … 437 441 438 442 if(!fTower) return; 443 // cout<<"----------------------"<<endl; 444 // cout<<"Finalize Tower"<<endl; 445 // cout<<""<<endl; 446 439 447 440 448 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy); 449 450 // ecalEnergy = gRandom->Gaus(fTowerECalEnergy, ecalSigma); 451 // if(ecalEnergy < 0.0) ecalEnergy = 0.0; 452 453 ecalEnergy = LogNormal(fTowerECalEnergy, ecalSigma); 454 ecalTime = (fTowerECalWeightTime < 1.0E-09 ) ? 0 : fTowerECalTime/fTowerECalWeightTime; 455 441 456 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy); 442 457 443 ecalEnergy = LogNormal(fTowerECalEnergy, ecalSigma); 458 // hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, hcalSigma); 459 // if(hcalEnergy < 0.0) hcalEnergy = 0.0; 460 444 461 hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma); 445 446 ecalTime = (fTowerECalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerECalTime/fTowerECalTimeWeight; 447 hcalTime = (fTowerHCalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerHCalTime/fTowerHCalTimeWeight; 448 462 hcalTime = (fTowerHCalWeightTime < 1.0E-09 ) ? 0 : fTowerHCalTime/fTowerHCalWeightTime; 463 464 449 465 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy); 450 466 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy); 451 467 452 if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin*ecalSigma) ecalEnergy = 0.0;453 if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0;468 ecalEnergy = (ecalEnergy < fEcalEnergyMin || ecalEnergy < fEcalSigmaMin*ecalSigma) ? 0 : ecalEnergy; 469 hcalEnergy = (hcalEnergy < fHcalEnergyMin || hcalEnergy < fHcalSigmaMin*hcalSigma) ? 0 : hcalEnergy; 454 470 455 471 energy = ecalEnergy + hcalEnergy; 456 time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy)); 457 458 if(fDitherTowerCenter) 459 { 460 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); 461 phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]); 462 } 463 else 464 { 465 eta = fTowerEta; 466 phi = fTowerPhi; 467 } 472 time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy)); 473 474 // eta = fTowerEta; 475 // phi = fTowerPhi; 476 477 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); 478 phi = gRandom->Uniform(fTowerEdges[2], fTowerEdges[3]); 468 479 469 480 pt = energy / TMath::CosH(eta); 470 481 482 // fTower->Position.SetXYZT(-time, 0.0, 0.0, time); 471 483 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time); 472 484 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); … … 479 491 fTower->Edges[3] = fTowerEdges[3]; 480 492 481 if( energy > 0.0)493 if( energy > 0.0 ) 482 494 { 483 495 if(fTowerPhotonHits > 0 && fTowerTrackHits == 0) … … 485 497 fPhotonOutputArray->Add(fTower); 486 498 } 487 499 488 500 fTowerOutputArray->Add(fTower); 489 501 } … … 499 511 500 512 ecalEnergy -= fTrackECalEnergy; 513 if(ecalEnergy < fEcalEnergyMin || ecalEnergy < fEcalSigmaMin*fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy)) ecalEnergy = 0.0; 514 501 515 hcalEnergy -= fTrackHCalEnergy; 502 503 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy); 504 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy); 505 506 if(ecalEnergy < fECalEnergyMin || ecalEnergy < fECalEnergySignificanceMin*ecalSigma) ecalEnergy = 0.0; 507 if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0; 516 if(hcalEnergy < fHcalEnergyMin || hcalEnergy < fHcalSigmaMin*fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy)) hcalEnergy = 0.0; 508 517 509 518 energy = ecalEnergy + hcalEnergy; … … 518 527 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalEnergy); 519 528 tower->Eem = ecalEnergy; 520 tower->Ehad = 0 .0;529 tower->Ehad = 0; 521 530 522 531 fEFlowPhotonOutputArray->Add(tower); … … 530 539 531 540 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalEnergy); 532 tower->Eem = 0 .0;541 tower->Eem = 0; 533 542 tower->Ehad = hcalEnergy; 534 543 535 544 fEFlowNeutralHadronOutputArray->Add(tower); 536 545 } 546 547 548 549 537 550 } 538 551 … … 548 561 a = TMath::Log(mean) - 0.5*b*b; 549 562 550 return TMath::Exp(a + b*gRandom->Gaus(0 .0, 1.0));563 return TMath::Exp(a + b*gRandom->Gaus(0, 1)); 551 564 } 552 565 else
Note:
See TracChangeset
for help on using the changeset viewer.