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